本文整理汇总了Java中net.canarymod.chat.MessageReceiver类的典型用法代码示例。如果您正苦于以下问题:Java MessageReceiver类的具体用法?Java MessageReceiver怎么用?Java MessageReceiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageReceiver类属于net.canarymod.chat包,在下文中一共展示了MessageReceiver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: copyTemplate
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"copy"
}, parent = "template", description = "zown template copy", permissions = {
"zown.template.copy"
}, toolTip = "/zown template copy <fromTemplate> <template>")
public void copyTemplate(final MessageReceiver caller, final String[] parameters) {
if (parameters.length != 3) {
sendMessage(caller, "Usage: /zown template copy <fromTemplate> <template>");
} else {
final ITemplate template = templateManager.copyTemplate(parameters[1], parameters[2]);
if (template == null) {
sendMessage(caller, "Template '" + parameters[2] + "' already exists or from template '"
+ parameters[1] + "' does not.");
} else {
sendMessage(caller, "Copied template '" + parameters[1] + "' into '" + parameters[2] + "'.");
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:19,代码来源:ZownCommand.java
示例2: createTemplate
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"create"
}, parent = "template", description = "zown template create", permissions = {
"zown.template.create"
}, toolTip = "/zown template create <template>")
public void createTemplate(final MessageReceiver caller, final String[] parameters) {
if (parameters.length != 2) {
sendMessage(caller, "Usage: /zown template create <template>");
} else {
final ITemplate template = templateManager.createTemplate(parameters[1]);
if (template == null) {
sendMessage(caller, "Template '" + parameters[1] + "' already exists.");
} else {
sendMessage(caller, "Created template '" + parameters[1] + "'.");
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:18,代码来源:ZownCommand.java
示例3: deleteTemplate
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"delete"
}, parent = "template", description = "zown template delete", permissions = {
"zown.template.delete"
}, toolTip = "/zown template delete <template>")
public void deleteTemplate(final MessageReceiver caller, final String[] parameters) {
if (parameters.length != 2) {
sendMessage(caller, "Usage: /zown template delete <template>");
} else {
if (templateManager.removeTemplate(parameters[1])) {
sendMessage(caller, "Deleted template '" + parameters[1] + "'.");
} else {
sendMessage(caller, "Template '" + parameters[1] + "' doesn't exist.");
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:17,代码来源:ZownCommand.java
示例4: listTemplates
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"list"
}, parent = "template", description = "zown template list", permissions = {
"zown.template.list"
}, toolTip = "/zown template list")
public void listTemplates(final MessageReceiver caller, final String[] parameters) {
if (parameters.length > 1) {
sendMessage(caller, "Usage: /zown template list");
} else {
final Collection<? extends ITemplate> templates = templateManager.getTemplates();
if (templates.isEmpty()) {
sendMessage(caller, "No templates.");
} else {
for (final ITemplate template : templates) {
sendMessage(caller, template.getName());
}
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:20,代码来源:ZownCommand.java
示例5: renameTemplate
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"rename"
}, parent = "template", description = "zown template rename", permissions = {
"zown.template.rename"
}, toolTip = "/zown template rename <template> <newTemplate>")
public void renameTemplate(final MessageReceiver caller, final String[] parameters) {
if (parameters.length != 3) {
sendMessage(caller, "Usage: /zown template rename <template> <newTemplate>");
} else {
final String curName = parameters[1];
final String newName = parameters[2];
if (templateManager.renameTemplate(curName, newName)) {
sendMessage(caller, "Renamed template '" + curName + "' to '" + newName + "'.");
} else {
sendMessage(caller, "Could not rename template '" + curName + "' to '" + newName + "'.");
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:19,代码来源:ZownCommand.java
示例6: templateInfo
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"info"
}, parent = "template", description = "zown template info", permissions = {
"zown.template.info"
}, toolTip = "/zown template info <template>")
public void templateInfo(final MessageReceiver caller, final String[] parameters) {
if (parameters.length != 2) {
sendMessage(caller, "Usage: /zown template info <template>");
} else {
final ITemplate template = templateManager.getTemplate(parameters[1]);
if (template == null) {
sendMessage(caller, "No template '" + parameters[1] + "' exists.");
} else {
sendMessage(caller, template.getDisplay());
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:18,代码来源:ZownCommand.java
示例7: executeCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Override
public int executeCommand(ICommandSender sender, String command) {
command = command.trim();
if (command.startsWith("/")) {
command = command.substring(1);
}
String[] args = command.split(" ");
String commandName = args[0];
boolean exists = Canary.commands().parseCommand((MessageReceiver) sender, commandName, args);
if (!exists) {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.notFound", new Object[0]);
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
sender.addChatMessage(chatcomponenttranslation);
}
return exists ? 1 : 0;
}
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:20,代码来源:MixinServerCommandManager.java
示例8: pairCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
/**
*
* @param caller Who sent the message.
* @param parameters Params
*/
@Command(aliases = { "latch_pair" },
description = "Pair a Minecraft player with a latch account.",
permissions = { "" },
toolTip = "/latch_pair <token>",
min = 2)
public void pairCommand(MessageReceiver caller, String[] parameters) {
if (caller instanceof Player) {
String token = parameters[1];
latch.pairPlayer((Player)caller, token);
}
else {
// TODO: Manage error
plugin.getLogman().info("/latch_pair should be run by a player.");
}
}
开发者ID:escueladebits,项目名称:canary_latch,代码行数:21,代码来源:LatchCommands.java
示例9: getBlockInfo
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"info"
}, parent = "r2w", description = "Get Block info", permissions = {
"r2w.info"
}, toolTip = "/r2w info x y z", min = 4, max = 4)
public void getBlockInfo(final MessageReceiver caller, final String[] parameters)
throws InterruptedException, ExecutionException {
if (caller instanceof Player) {
final int x = Integer.parseInt(parameters[1]);
final int y = Integer.parseInt(parameters[2]);
final int z = Integer.parseInt(parameters[3]);
final Player player = (Player) caller;
final Block block = player.getWorld().getBlockAt(x, y, z);
sendMessage(caller, "Type: " + block.getType().getId() + ":" + block.getType().getData());
sendMessage(caller, "Data: " + block.getData());
sendMessage(caller, "Properties: " + block.getProperties());
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:20,代码来源:ReturnCommand.java
示例10: update
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"update", "u"
}, parent = "r2w", helpLookup = "r2w update", description = "Update the template", permissions = {
"r2w.command.update"
}, toolTip = "/r2w update <world_name> <world_dimension> x1 y1 z1 x2 y2 z2", min = 9, max = 9)
public void update(final MessageReceiver caller, final String[] parameters)
throws InterruptedException, ExecutionException {
final int x1 = Integer.parseInt(parameters[3]);
final int y1 = Integer.parseInt(parameters[4]);
final int z1 = Integer.parseInt(parameters[5]);
final int x2 = Integer.parseInt(parameters[6]);
final int y2 = Integer.parseInt(parameters[7]);
final int z2 = Integer.parseInt(parameters[8]);
final Future<Boolean> future = templateManager.update(parameters[1],
DimensionType.fromName(parameters[2]), x1, y1, z1, x2, y2, z2);
if (future.get()) {
sendMessage(caller, "Completed updating template");
} else {
sendMessage(caller, "Failed updating template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:22,代码来源:ReturnCommand.java
示例11: saveCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"save"
}, parent = "playerstate", description = "Save player state", permissions = {
"playerstate.command.save"
}, toolTip = "/playerstate <save> <name> [player]", min = 2, max = 3)
public void saveCommand(final MessageReceiver caller, final String[] parameters)
throws DatabaseWriteException {
Player player = null;
if (parameters.length > 2) {
player = Canary.getServer().matchPlayer(parameters[2]);
} else if (caller instanceof Player) {
player = (Player) caller;
}
if (player != null) {
final String state = parameters[1];
manager.savePlayerState(player, state, saves);
caller.message("Saved " + player.getDisplayName() + " current state as " + state);
}
}
开发者ID:toddharrison,项目名称:PlayerState,代码行数:20,代码来源:PlayerStateCommand.java
示例12: changeCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"load"
}, parent = "playerstate", description = "Load player state", permissions = {
"playerstate.command.load"
}, toolTip = "/playerstate <load> <name> [player]", min = 2, max = 3)
public void changeCommand(final MessageReceiver caller, final String[] parameters)
throws DatabaseReadException {
Player player = null;
if (parameters.length > 2) {
player = Canary.getServer().matchPlayer(parameters[2]);
} else if (caller instanceof Player) {
player = (Player) caller;
}
if (player != null) {
final String state = parameters[1];
manager.loadPlayerState(player, state, saves);
// TODO
// manager.restorePlayerLocation(player, state);
caller.message("Changed " + player.getDisplayName() + " current state to " + state);
}
}
开发者ID:toddharrison,项目名称:PlayerState,代码行数:22,代码来源:PlayerStateCommand.java
示例13: executeSubCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
/**
* Executes the command as a subcommand.
*
* @param caller The caller.
* @param args The given arguments.
*/
public void executeSubCommand(MessageReceiver caller, String[] args) {
CommandExecutor executor = ((CanaryPluginBackend) getServerBackend()).wrapReceiver(caller);
args = (String[]) ArrayUtils.remove(args, 0);
String name;
if (args.length == 0) {
name = CommandHandler.FALLBACK_COMMAND_NAME;
args = new String[0];
} else {
name = args[0];
args = (String[]) ArrayUtils.remove(args, 0);
}
if (!this.execute(executor, name, args))
executor.sendMessage(T(executor, "cmd.notfound"));
}
开发者ID:StuxSoftware,项目名称:SimpleDev,代码行数:24,代码来源:CanaryCommandHandler.java
示例14: dynmapCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = { "dynmap" },
description = "Dynmap commands", permissions = { "" }, toolTip = "")
public void dynmapCommand(MessageReceiver sender, String[] parameters) {
DynmapCommandSender dsender;
if(sender instanceof Player) {
dsender = new BukkitPlayer((Player)sender);
}
else {
dsender = new CanaryCommandSender(sender);
}
core.processCommand(dsender, "dynmap", parameters[0], Arrays.copyOfRange(parameters, 1, parameters.length));
}
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:13,代码来源:DynmapPlugin.java
示例15: dmarkerCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = { "dmarker" },
description = "Dynmap marker commands", permissions = { "" }, toolTip = "")
public void dmarkerCommand(MessageReceiver sender, String[] parameters) {
DynmapCommandSender dsender;
if(sender instanceof Player) {
dsender = new BukkitPlayer((Player)sender);
}
else {
dsender = new CanaryCommandSender(sender);
}
core.processCommand(dsender, "dmarker", parameters[0], Arrays.copyOfRange(parameters, 1, parameters.length));
}
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:13,代码来源:DynmapPlugin.java
示例16: dmapCommand
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = { "dmap" },
description = "Dynmap map commands", permissions = { "" }, toolTip = "")
public void dmapCommand(MessageReceiver sender, String[] parameters) {
DynmapCommandSender dsender;
if(sender instanceof Player) {
dsender = new BukkitPlayer((Player)sender);
}
else {
dsender = new CanaryCommandSender(sender);
}
core.processCommand(dsender, "dmap", parameters[0], Arrays.copyOfRange(parameters, 1, parameters.length));
}
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:13,代码来源:DynmapPlugin.java
示例17: sendMessage
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
public static void sendMessage(final MessageReceiver caller, final String message) {
if (caller instanceof Player) {
caller.asPlayer().message(message);
} else {
ZownPlugin.LOG.info(ChatFormat.removeFormatting(message));
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:8,代码来源:ZownMessenger.java
示例18: deleteZown
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"delete"
}, parent = "zown", description = "zown delete", permissions = {
"zown.zown.manage.delete"
}, toolTip = "/zown delete <zown>")
public void deleteZown(final MessageReceiver caller, final String[] parameters) {
World world = null;
Player player = null;
String zown = null;
if (caller instanceof Player) {
player = caller.asPlayer();
switch (parameters.length) {
case 2:
world = player.getWorld();
zown = parameters[1];
break;
default:
sendMessage(caller, "Usage: /zown delete <zown>");
}
} else {
switch (parameters.length) {
case 3:
world = worldManager.getWorld(parameters[1], false);
zown = parameters[2];
break;
default:
sendMessage(caller, "Usage: /zown delete <world> <zown>");
}
}
if (world != null && zown != null) {
if (zownManager.removeZown(world, zown, player)) {
sendMessage(caller, "Deleted zown '" + zown + "'.");
} else {
sendMessage(caller, "Failed to delete zown '" + zown + "'.");
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:40,代码来源:ZownCommand.java
示例19: flagTemplate
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"flag"
}, parent = "template", description = "zown template flag", permissions = {
"zown.template.flag"
}, toolTip = "/zown template flag <template> <flag>:<ALLOW | DENY>...")
public void flagTemplate(final MessageReceiver caller, final String[] parameters) {
if (parameters.length < 3) {
sendMessage(caller, "Usage: /zown template flag <template> <flag>:<ALLOW | DENY>...");
} else {
final String name = parameters[1];
final ITemplate template = templateManager.getTemplate(name);
if (template == null) {
sendMessage(caller, "Template '" + parameters[1] + "' doesn't exist.");
} else {
for (int i = 2; i < parameters.length; i++) {
final String[] flag = parameters[i].split(":");
if (flag.length == 2) {
final IConfiguration config = template.getConfiguration();
config.setFlag(flag[0], "allow".equalsIgnoreCase(flag[1]));
} else {
sendMessage(caller, "Bad flag: " + parameters[i]);
}
}
templateManager.saveTemplateConfiguration(name);
sendMessage(caller, "Added flags to template '" + parameters[1] + "'.");
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:29,代码来源:ZownCommand.java
示例20: listZowns
import net.canarymod.chat.MessageReceiver; //导入依赖的package包/类
@Command(aliases = {
"list"
}, parent = "zown", description = "zown list", permissions = {
"zown.zown.list"
}, toolTip = "/zown list")
public void listZowns(final MessageReceiver caller, final String[] parameters) {
World world = null;
if (caller instanceof Player) {
final Player player = caller.asPlayer();
switch (parameters.length) {
case 1:
world = player.getWorld();
break;
default:
sendMessage(caller, "Usage: /zown list");
}
} else {
switch (parameters.length) {
case 2:
world = worldManager.getWorld(parameters[1], false);
break;
default:
sendMessage(caller, "Usage: /zown list <world>");
}
}
if (world != null) {
final Tree<? extends IZown> zownRootTree = zownManager.getZown(world);
for (final Tree<? extends IZown> zownTree : zownRootTree) {
sendMessage(caller, zownTree.getData().getName());
}
}
}
开发者ID:toddharrison,项目名称:Zown,代码行数:35,代码来源:ZownCommand.java
注:本文中的net.canarymod.chat.MessageReceiver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论