当前位置: 首页>>代码示例>>Java>>正文


Java Command类代码示例

本文整理汇总了Java中org.inventivetalent.pluginannotations.command.Command的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Command类属于org.inventivetalent.pluginannotations.command包,在下文中一共展示了Command类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: leave

import org.inventivetalent.pluginannotations.command.Command; //导入依赖的package包/类
@Command(name = "murderLeave",
		 description = "Leave the current game",
		 aliases = {
				 "mLeave",
				 "ml" },
		 max = 0,
		 errorHandler = MurderErrorHandler.class)
@Permission(PERM_BASE + "leave")
public void leave(Player sender) {
	PlayerData playerData = plugin.playerManager.getData(sender.getUniqueId());
	if (playerData == null || playerData.gameId == null) {
		sender.sendMessage(MESSAGE_LOADER.getMessage("game.error.notIngame", "game.error.notIngame"));
		return;
	}

	Game game = plugin.gameManager.getGame(playerData.gameId);
	if (game != null) { game.removePlayer(sender); }
}
 
开发者ID:InventivetalentDev,项目名称:Murder,代码行数:19,代码来源:PlayerCommands.java

示例2: helpCommand

import org.inventivetalent.pluginannotations.command.Command; //导入依赖的package包/类
@Command(name = "animatedframes",
		 aliases = {
				 "af",
				 "afhelp",
				 "framehelp" },
		 usage = "",
		 max = 0,
		 fallbackPrefix = "animatedframes")
public void helpCommand(final CommandSender sender) {
	sender.sendMessage("§6AnimatedFrames v" + plugin.getDescription().getVersion() + (plugin.updateAvailable ? " §a*Update available" : ""));
	sender.sendMessage(" ");

	int c = 0;
	if (sender.hasPermission("animatedframes.create")) {
		c++;
		sender.sendMessage("§e/afcreate <Name> <Image>");
		sender.sendMessage("§bCreate a new image");
		sender.sendMessage(" ");
	}
	if (sender.hasPermission("animatedframes.remove")) {
		c++;
		sender.sendMessage("§e/afremove <Name>");
		sender.sendMessage("§bRemove an existing image");
		sender.sendMessage(" ");
	}
	if (sender.hasPermission("animatedframes.list")) {
		c++;
		sender.sendMessage("§e/aflist");
		sender.sendMessage("§bGet a list of images");
		sender.sendMessage(" ");
	}

	if (c > 0) {
		sender.sendMessage("§eType §a/help <Command> §efor more information.");
	}
}
 
开发者ID:InventivetalentDev,项目名称:AnimatedFrames,代码行数:37,代码来源:Commands.java

示例3: frameList

import org.inventivetalent.pluginannotations.command.Command; //导入依赖的package包/类
@Command(name = "framelist",
		 aliases = {
				 "aflist",
				 "listframes",
				 "afl" },
		 usage = "",
		 description = "Get a list of frames",
		 max = 0,
		 fallbackPrefix = "animatedframes")
@Permission("animatedframes.list")
public void frameList(final Player sender) {
	sender.sendMessage("  ");

	Set<AnimatedFrame> frames = plugin.frameManager.getFrames();
	sender.sendMessage("§eFrames (" + frames.size() + "): ");
	for (AnimatedFrame frame : frames) {
		TextComponent component = new TextComponent(frame.getName());

		Vector3DDouble teleportVector = frame.getBaseVector();
		ClickEvent teleportClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + teleportVector.getX() + " " + teleportVector.getY() + " " + teleportVector.getZ());
		HoverEvent teleportHover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Teleport to " + teleportVector.getX() + "," + teleportVector.getY() + "," + teleportVector.getZ()).color(ChatColor.GRAY).create());
		component.addExtra(new ComponentBuilder(" [Teleport]").color(ChatColor.YELLOW).bold(true).event(teleportClick).event(teleportHover).create()[0]);

		ClickEvent deleteClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/frameremove " + frame.getName());
		component.addExtra(new ComponentBuilder(" [Delete]").color(ChatColor.RED).bold(true).event(deleteClick).create()[0]);

		sender.spigot().sendMessage(component);
	}
}
 
开发者ID:InventivetalentDev,项目名称:AnimatedFrames,代码行数:30,代码来源:Commands.java


注:本文中的org.inventivetalent.pluginannotations.command.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。