co.aikar.commands.annotation.Description Java Examples
The following examples show how to use
co.aikar.commands.annotation.Description.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandRestoreNature.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("modenature") @Description("Switches the shovel tool to restoration mode.") @Subcommand("mode nature") public void execute(Player player) { if (true) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().FEATURE_NOT_AVAILABLE); return; } if (!NMSUtil.getInstance().hasItemInOneHand(player, GriefDefenderPlugin.getInstance().modificationTool)) { TextAdapter.sendComponent(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.TOOL_NOT_EQUIPPED, ImmutableMap.of("tool", TextComponent.of(GriefDefenderPlugin.getInstance().modificationTool.getName().toLowerCase(), TextColor.GREEN)))); return; } final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); playerData.shovelMode = ShovelTypes.RESTORE; GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().MODE_NATURE); }
Example #2
Source File: CommandClaimFlagDebug.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("cfdebug") @Description("Toggles claim flag debug mode.") @Subcommand("claim debug") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player); final Component result = claim.allowEdit(user, true); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } playerData.debugClaimPermissions = !playerData.debugClaimPermissions; if (!playerData.debugClaimPermissions) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMFLAGDEBUG_DISABLED); } else { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMFLAGDEBUG_ENABLED); } }
Example #3
Source File: CommandPagination.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("gd:pagination") @Description("Used internally by GD for pagination purposes.") public void execute(CommandSource src, String[] args) throws CommandException { if (args == null || args.length == 0) { return; } final String id = args[0]; final ActivePagination activePagination = GDPaginationHolder.getInstance().getActivePagination(src, id); if (activePagination == null) { TextAdapter.sendComponent(src, TextComponent.of("Source " + src.getName() + " has no paginations!", TextColor.RED)); return; } final String action = args[1]; if (action.equals("page")) { activePagination.currentPage(); } else if (action.equals("next")) { activePagination.nextPage(); } else if (action.equals("prev")) { activePagination.previousPage(); } else { int page = Integer.parseInt(action); activePagination.specificPage(page); } }
Example #4
Source File: CommandClaimFlagPlayer.java From GriefDefender with MIT License | 6 votes |
@CommandCompletion("@gdplayers @gdflags @gdmcids @gdtristates @gdcontexts @gddummy") @CommandAlias("cfp") @Description("Gets/Sets flag permission for a player in claim you are standing in.") @Syntax("<player> <flag> <target> <value> [context[key=value]]") @Subcommand("flag player") public void execute(Player player, User user, @Optional String[] args) throws InvalidCommandArgument { this.subject = PermissionHolderCache.getInstance().getOrCreateUser(user); this.friendlySubjectName = user.getName(); if (user.hasPermission(GDPermissions.COMMAND_ADMIN_CLAIMS) && !player.hasPermission(GDPermissions.SET_ADMIN_FLAGS)) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_PLAYER_ADMIN_FLAGS); return; } super.execute(player, args); }
Example #5
Source File: CommandTownChat.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("townchat") @Description("Toggles town chat.") @Subcommand("town chat") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation()); if (!claim.isInTown()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().TOWN_NOT_IN); return; } playerData.townChat = !playerData.townChat; // toggle ignore claims mode on or off if (!playerData.townChat) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().TOWN_CHAT_DISABLED); } else { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().TOWN_CHAT_ENABLED); } }
Example #6
Source File: CommandClaimSetSpawn.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("claimsetspawn") @Description("Sets the spawn of claim.") @Subcommand("claim setspawn") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component result = claim.allowEdit(player); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } final Vector3i pos = VecHelper.toVector3i(player.getLocation()); claim.getInternalClaimData().setSpawnPos(pos); final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.SPAWN_SET_SUCCESS, ImmutableMap.of( "location", pos)); GriefDefenderPlugin.sendMessage(player, message); }
Example #7
Source File: CommandClaimFlagDebug.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("cfdebug") @Description("Toggles claim flag debug mode.") @Subcommand("claim debug") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player); final Component result = claim.allowEdit(user, true); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } playerData.debugClaimPermissions = !playerData.debugClaimPermissions; if (!playerData.debugClaimPermissions) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMFLAGDEBUG_DISABLED); } else { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMFLAGDEBUG_ENABLED); } }
Example #8
Source File: CommandClaimSetSpawn.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("claimsetspawn") @Description("Sets the spawn of claim.") @Subcommand("claim setspawn") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component result = claim.allowEdit(player); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } final Vector3i pos = VecHelper.toVector3i(player.getLocation()); claim.getInternalClaimData().setSpawnPos(pos); final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.SPAWN_SET_SUCCESS, ImmutableMap.of( "location", pos)); GriefDefenderPlugin.sendMessage(player, message); }
Example #9
Source File: CommandPagination.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("gd:pagination") @Description("Used internally by GD for pagination purposes.") public void execute(CommandSender src, String[] args) throws CommandException { if (args == null || args.length == 0) { return; } final String id = args[0]; final ActivePagination activePagination = GDPaginationHolder.getInstance().getActivePagination(src, id); if (activePagination == null) { TextAdapter.sendComponent(src, TextComponent.of("Source " + src.getName() + " has no paginations!", TextColor.RED)); return; } final String action = args[1]; if (action.equals("page")) { activePagination.currentPage(); } else if (action.equals("next")) { activePagination.nextPage(); } else if (action.equals("prev")) { activePagination.previousPage(); } else { int page = Integer.parseInt(action); activePagination.specificPage(page); } }
Example #10
Source File: CommandClaimOptionGroup.java From GriefDefender with MIT License | 6 votes |
@CommandCompletion("@gdgroups @gdoptions @gdcontexts @gddummy") @CommandAlias("cog") @Description("Gets/Sets option for a group in claim you are standing in.") @Syntax("<group> <option> <value> [context[key=value]]") @Subcommand("option group") public void execute(Player player, String group, @Optional String[] args) throws InvalidCommandArgument { if (!PermissionUtil.getInstance().hasGroupSubject(group)) { final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.COMMAND_INVALID_GROUP, ImmutableMap.of( "group", group)); GriefDefenderPlugin.sendMessage(player, message); return; } this.subject = PermissionHolderCache.getInstance().getOrCreateHolder(group); this.friendlySubjectName = group; super.execute(player, args); }
Example #11
Source File: CommandClaimIgnore.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("claimignore|ignoreclaims|ic") @Description("Toggles ignore claims mode.") @Subcommand("claim ignore") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation()); if (claim.isBasicClaim() && !playerData.ignoreBasicClaims || claim.isWilderness() && !playerData.ignoreWilderness || claim.isAdminClaim() && !playerData.ignoreAdminClaims) { final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_IGNORE, ImmutableMap.of( "type", claim.getType().getName())); GriefDefenderPlugin.sendMessage(player, message); return; } playerData.ignoreClaims = !playerData.ignoreClaims; if (!playerData.ignoreClaims) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_RESPECTING); } else { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_IGNORE); } }
Example #12
Source File: CommandRestoreClaim.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("restoreclaim|claimrestore") @Description("Restores claim to its natural state. Use with caution.") @Subcommand("claim restore") public void execute(Player player) { final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation()); if (claim.isWilderness()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_FOUND); return; } final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_DELETE, ImmutableMap.of( "type", claim.getType().getName())); if (!player.hasPermission(GDPermissions.DELETE_CLAIM_ADMIN)) { GriefDefenderPlugin.sendMessage(player, message); return; } displayConfirmationConsumer(player, claim); }
Example #13
Source File: CommandRestoreClaim.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("restoreclaim|claimrestore") @Description("Restores claim to its natural state. Use with caution.") @Subcommand("claim restore") public void execute(Player player) { final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation()); if (claim.isWilderness()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_FOUND); return; } final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_DELETE, ImmutableMap.of( "type", claim.getType().getName())); if (!player.hasPermission(GDPermissions.DELETE_CLAIM_ADMIN)) { GriefDefenderPlugin.sendMessage(player, message); return; } displayConfirmationConsumer(player, claim); }
Example #14
Source File: CommandClaimInherit.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("claiminherit") @Description("Toggles subdivision inherit mode.") @Subcommand("claim inherit") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component result = claim.allowEdit(player); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } if (claim.parent == null) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_INHERIT_ONLY_CHILD); return; } claim.getData().setInheritParent(!claim.getData().doesInheritParent()); claim.getInternalClaimData().setRequiresSave(true); if (!claim.getData().doesInheritParent()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMINHERIT_DISABLED); } else { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMINHERIT_ENABLED); } }
Example #15
Source File: CommandClaimInherit.java From GriefDefender with MIT License | 6 votes |
@CommandAlias("claiminherit") @Description("Toggles subdivision inherit mode.") @Subcommand("claim inherit") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component result = claim.allowEdit(player); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } if (claim.parent == null) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_INHERIT_ONLY_CHILD); return; } claim.getData().setInheritParent(!claim.getData().doesInheritParent()); claim.getInternalClaimData().setRequiresSave(true); if (!claim.getData().doesInheritParent()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMINHERIT_DISABLED); } else { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_CLAIMINHERIT_ENABLED); } }
Example #16
Source File: CommandClaimFlagPlayer.java From GriefDefender with MIT License | 6 votes |
@CommandCompletion("@gdplayers @gdflags @gdmcids @gdtristates @gdcontexts @gddummy") @CommandAlias("cfp") @Description("Gets/Sets flag permission for a player in claim you are standing in.") @Syntax("<player> <flag> <target> <value> [context[key=value]]") @Subcommand("flag player") public void execute(Player src, OfflinePlayer player, @Optional String[] args) throws InvalidCommandArgument { this.subject = PermissionHolderCache.getInstance().getOrCreateUser(player); this.friendlySubjectName = player.getName(); if (src.hasPermission(GDPermissions.COMMAND_ADMIN_CLAIMS) && !src.hasPermission(GDPermissions.SET_ADMIN_FLAGS)) { GriefDefenderPlugin.sendMessage(src, MessageCache.getInstance().PERMISSION_PLAYER_ADMIN_FLAGS); return; } super.execute(src, args); }
Example #17
Source File: CommandClaimDelete.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("deleteclaim") @Description("Deletes the claim you're standing in, even if it's not your claim.") @Subcommand("delete claim") public void execute(Player player) { final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation()); if (claim.isWilderness()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_FOUND); return; } final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_DELETE, ImmutableMap.of( "type", claim.getType().getName())); if (claim.isAdminClaim() && !player.hasPermission(GDPermissions.DELETE_CLAIM_ADMIN)) { GriefDefenderPlugin.sendMessage(player, message); return; } if (claim.isBasicClaim() && !player.hasPermission(GDPermissions.DELETE_CLAIM_BASIC)) { GriefDefenderPlugin.sendMessage(player, message); return; } final Component confirmationText = TextComponent.builder() .append(GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.DELETE_CLAIM_WARNING, ImmutableMap.of("player", claim.getOwnerDisplayName().color(TextColor.AQUA)))) .append(TextComponent.builder() .append("\n[") .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) .append("]\n") .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, claim, deleteTopLevelClaim), true))) .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) .build(); TextAdapter.sendComponent(player, confirmationText); }
Example #18
Source File: CommandClaimTown.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("modetown|townclaims") @Description("Switches the shovel tool to town claims mode.") @Subcommand("mode town") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); playerData.shovelMode = ShovelTypes.TOWN; playerData.claimSubdividing = null; GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().MODE_TOWN); }
Example #19
Source File: CommandClaimName.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("claimname") @Syntax("<name>|clear") @Description("Sets the name of your claim.") @Subcommand("claim name") public void execute(Player player, String name) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component result = claim.allowEdit(player); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } if (!player.hasPermission(GDPermissions.USE_RESERVED_CLAIM_NAMES)) { final GriefDefenderConfig<?> activeConfig = GriefDefenderPlugin.getActiveConfig(player.getWorld().getProperties()); for (String str : activeConfig.getConfig().claim.reservedClaimNames) { if (FilenameUtils.wildcardMatch(name, str)) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_RESERVED_NAME); return; } } } final TextComponent text = LegacyComponentSerializer.legacy().deserialize(name, '&'); if (text == TextComponent.empty() || text.content().equals("clear")) { claim.getInternalClaimData().setName(null); } else { claim.getInternalClaimData().setName(text); } claim.getInternalClaimData().setRequiresSave(true); claim.getInternalClaimData().save(); final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CLAIM_NAME, ImmutableMap.of( "name", text)); GriefDefenderPlugin.sendMessage(player, message); }
Example #20
Source File: CommandClaimDelete.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("deleteclaim") @Description("Deletes the claim you're standing in, even if it's not your claim.") @Subcommand("delete claim") public void execute(Player player) { final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation()); if (claim.isWilderness()) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_FOUND); return; } final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_DELETE, ImmutableMap.of( "type", claim.getType().getName())); if (claim.isAdminClaim() && !player.hasPermission(GDPermissions.DELETE_CLAIM_ADMIN)) { GriefDefenderPlugin.sendMessage(player, message); return; } if (claim.isBasicClaim() && !player.hasPermission(GDPermissions.DELETE_CLAIM_BASIC)) { GriefDefenderPlugin.sendMessage(player, message); return; } final Component confirmationText = TextComponent.builder() .append(GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.DELETE_CLAIM_WARNING, ImmutableMap.of("player", claim.getOwnerDisplayName().color(TextColor.AQUA)))) .append(TextComponent.builder() .append("\n[") .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) .append("]\n") .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, claim, deleteTopLevelClaim), true))) .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) .build(); TextAdapter.sendComponent(player, confirmationText); }
Example #21
Source File: CommandClaimOptionPlayer.java From GriefDefender with MIT License | 5 votes |
@CommandCompletion("@gdplayers @gdoptions @gdcontexts @gddummy") @CommandAlias("cop") @Description("Gets/Sets option for a player in claim you are standing in.") @Syntax("<player> <option> <value> [context[key=value]]") @Subcommand("option player") public void execute(Player src, User player, @Optional String[] args) throws InvalidCommandArgument { this.subject = PermissionHolderCache.getInstance().getOrCreateUser(player); this.friendlySubjectName = player.getName(); super.execute(src, args); }
Example #22
Source File: CommandClaimGreeting.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("claimgreeting") @Description("Sets the greeting message of your claim.") @Syntax("<message>|clear") @Subcommand("claim greeting") public void execute(Player player, String message) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component result = claim.allowEdit(player); if (result != null) { GriefDefenderPlugin.sendMessage(player, result); return; } final TextComponent greeting = LegacyComponentSerializer.legacy().deserialize(message, '&'); if (greeting == TextComponent.empty() || greeting.content().equals("clear")) { claim.getInternalClaimData().setGreeting(null); } else { claim.getInternalClaimData().setGreeting(greeting); } claim.getInternalClaimData().setRequiresSave(true); claim.getInternalClaimData().save(); Component resultMessage = null; if (!claim.getInternalClaimData().getGreeting().isPresent()) { resultMessage = MessageCache.getInstance().CLAIM_GREETING_CLEAR; } else { resultMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CLAIM_GREETING, ImmutableMap.of( "greeting", greeting)); } TextAdapter.sendComponent(player, resultMessage); }
Example #23
Source File: CommandGDVersion.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("gdversion") @Description("Displays GriefDefender's version information.") @Subcommand("version") public void execute(CommandSender src) { Component gpVersion = TextComponent.builder("") .append(GriefDefenderPlugin.GD_TEXT) .append("Running ") .append("GriefDefender " + GriefDefenderPlugin.IMPLEMENTATION_VERSION, TextColor.AQUA) .build(); Component bukkitVersion = TextComponent.builder("") .append(GriefDefenderPlugin.GD_TEXT) .append("Running ") .append(Bukkit.getVersion(), TextColor.YELLOW) .build(); String permissionPlugin = Bukkit.getPluginManager().getPlugin("LuckPerms").getDescription().getFullName(); Component permVersion = TextComponent.builder("") .append(GriefDefenderPlugin.GD_TEXT) .append("Running ") .append(permissionPlugin, TextColor.GREEN) .build(); TextAdapter.sendComponent(src, TextComponent.builder("") .append(gpVersion) .append("\n") .append(bukkitVersion) .append("\n") .append(permVersion) .build()); }
Example #24
Source File: CommandClaimDeleteAllAdmin.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("deletealladmin") @Description("Deletes all administrative claims.") @Subcommand("delete alladmin") public void execute(Player player, @Optional String worldName) { World world = null; if (worldName != null) { world = Bukkit.getWorld(worldName); if (world == null) { TextAdapter.sendComponent(player, MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.COMMAND_WORLD_NOT_FOUND, ImmutableMap.of("world", worldName))); return; } } Component message = null; if (world != null) { message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.DELETE_ALL_TYPE_WARNING_WORLD, ImmutableMap.of( "type", TextComponent.of("ADMIN").color(TextColor.RED), "world", world.getName())); } else { message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.DELETE_ALL_TYPE_WARNING, ImmutableMap.of( "type", TextComponent.of("ADMIN").color(TextColor.RED))); } final Component confirmationText = TextComponent.builder("") .append(message) .append(TextComponent.builder() .append("\n[") .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) .append("]\n") .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, world), true))) .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) .build(); TextAdapter.sendComponent(player, confirmationText); }
Example #25
Source File: CommandClaimFarewell.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("claimfarewell") @Description("Sets the farewell message of your claim.") @Syntax("<message>|clear") @Subcommand("claim farewell") public void execute(Player player, String message) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); if (claim.allowEdit(player) != null) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_EDIT_CLAIM); return; } TextComponent farewell = LegacyComponentSerializer.legacy().deserialize(message, '&'); if (farewell == TextComponent.empty() || farewell.content().equals("clear")) { claim.getInternalClaimData().setFarewell(null); } else { claim.getInternalClaimData().setFarewell(farewell); } claim.getInternalClaimData().setRequiresSave(true); claim.getInternalClaimData().save(); Component resultMessage = null; if (!claim.getInternalClaimData().getFarewell().isPresent()) { resultMessage = MessageCache.getInstance().CLAIM_FAREWELL_CLEAR; } else { resultMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CLAIM_FAREWELL, ImmutableMap.of( "farewell", farewell)); } TextAdapter.sendComponent(player, resultMessage); }
Example #26
Source File: CommandRestoreNature.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("modenature") @Description("Switches the shovel tool to restoration mode.") @Subcommand("mode nature") public void execute(Player player) { if (true) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().FEATURE_NOT_AVAILABLE); return; } final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); playerData.shovelMode = ShovelTypes.RESTORE; GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().MODE_NATURE); }
Example #27
Source File: CommandTrustList.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("trustlist") @Description("Manages trust for the claim you're standing in.") @Subcommand("trust list") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component message = claim.allowGrantPermission(player); if (message != null) { GriefDefenderPlugin.sendMessage(player, message); return; } showTrustList(player, claim, playerData, TrustTypes.NONE, new ArrayList<>(), null); }
Example #28
Source File: CommandClaimSubdivision.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("modesubdivide|subdivideclaims|sc") @Description("Switches the shovel tool to subdivision mode, used to subdivide your claims.") @Subcommand("mode subdivide") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); playerData.shovelMode = ShovelTypes.SUBDIVISION; playerData.claimSubdividing = null; GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().MODE_SUBDIVISION); }
Example #29
Source File: CommandClaimBasic.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("modebasic|basicclaims|bc") @Description("Switches the shovel tool back to basic claims mode") @Subcommand("mode basic") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); playerData.shovelMode = ShovelTypes.BASIC; playerData.claimSubdividing = null; GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().MODE_BASIC); }
Example #30
Source File: CommandClaimFlagReset.java From GriefDefender with MIT License | 5 votes |
@CommandAlias("cfr") @Description("Resets a claim to flag defaults.") @Subcommand("flag reset") public void execute(Player player) { final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation()); final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_RESET_FLAGS, ImmutableMap.of( "type", claim.getType().getName())); if (claim.isWilderness()) { if (!player.hasPermission(GDPermissions.MANAGE_WILDERNESS)) { GriefDefenderPlugin.sendMessage(player, message); return; } } else if (claim.isAdminClaim()) { if (!player.getUniqueId().equals(claim.getOwnerUniqueId()) && !player.hasPermission(GDPermissions.COMMAND_ADMIN_CLAIMS)) { GriefDefenderPlugin.sendMessage(player, message); return; } } else if (!player.hasPermission(GDPermissions.COMMAND_ADMIN_CLAIMS) && (claim.isBasicClaim() || claim.isSubdivision()) && !player.getUniqueId().equals(claim.getOwnerUniqueId())) { GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_CLAIM_RESET_FLAGS_SELF); return; } final Component confirmationText = TextComponent.builder() .append(MessageCache.getInstance().FLAG_RESET_WARNING) .append(TextComponent.builder() .append("\n[") .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN)) .append("]\n") .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, claim), true))) .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build()) .build(); TextAdapter.sendComponent(player, confirmationText); }