本文整理汇总了Java中net.canarymod.chat.MessageReceiver类的典型用法代码示例。如果您正苦于以下问题:Java MessageReceiver类的具体用法?Java MessageReceiver怎么用?Java MessageReceiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageReceiver类属于net.canarymod.chat包,在下文中一共展示了MessageReceiver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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] + "'.");
}
}
}
示例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] + "'.");
}
}
}
示例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.");
}
}
}
示例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());
}
}
}
}
示例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 + "'.");
}
}
}
示例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());
}
}
}
示例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;
}
示例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.");
}
}
示例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());
}
}
示例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");
}
}
示例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);
}
}
示例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);
}
}
示例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"));
}
示例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));
}
示例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));
}