From 8a59d64702dbbc5d3d2fc19e9693e86d5c258eb7 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 4 Jul 2020 00:44:22 +1200 Subject: [PATCH] Clean up send message again to use LibsMsg.send --- .../commands/LibsDisguisesCommand.java | 4 +- .../commands/disguise/DisguiseCommand.java | 19 ++++---- .../disguise/DisguiseEntityCommand.java | 18 ++++---- .../disguise/DisguisePlayerCommand.java | 24 +++++------ .../disguise/DisguiseRadiusCommand.java | 43 ++++++++++--------- .../interactions/CopyDisguiseInteraction.java | 2 +- .../DisguiseEntityInteraction.java | 26 ++++------- .../DisguiseModifyInteraction.java | 6 +-- .../UndisguiseEntityInteraction.java | 8 ++-- .../commands/libsdisguises/LDChangelog.java | 4 +- .../commands/libsdisguises/LDConfig.java | 2 +- .../commands/libsdisguises/LDCount.java | 6 +-- .../commands/libsdisguises/LDDebugPlayer.java | 4 +- .../commands/libsdisguises/LDHelp.java | 2 +- .../commands/libsdisguises/LDJson.java | 4 +- .../commands/libsdisguises/LDMetaInfo.java | 4 +- .../commands/libsdisguises/LDMods.java | 10 ++--- .../commands/libsdisguises/LDPermTest.java | 28 ++++++------ .../commands/libsdisguises/LDReload.java | 2 +- .../commands/libsdisguises/LDScoreboard.java | 24 +++++------ .../commands/libsdisguises/LDUpdate.java | 18 ++++---- .../modify/DisguiseModifyCommand.java | 16 +++---- .../modify/DisguiseModifyEntityCommand.java | 10 ++--- .../modify/DisguiseModifyPlayerCommand.java | 14 +++--- .../modify/DisguiseModifyRadiusCommand.java | 39 +++++++++-------- .../undisguise/UndisguiseCommand.java | 8 ++-- .../undisguise/UndisguiseEntityCommand.java | 6 +-- .../undisguise/UndisguisePlayerCommand.java | 10 ++--- .../undisguise/UndisguiseRadiusCommand.java | 10 ++--- .../commands/utils/CopyDisguiseCommand.java | 9 ++-- .../commands/utils/DisguiseCloneCommand.java | 14 +++--- .../commands/utils/DisguiseHelpCommand.java | 26 ++++++----- .../utils/DisguiseViewBarCommand.java | 6 +-- .../utils/DisguiseViewSelfCommand.java | 6 +-- .../commands/utils/GrabHeadCommand.java | 24 +++++------ .../commands/utils/GrabSkinCommand.java | 24 +++++------ .../commands/utils/SaveDisguiseCommand.java | 32 +++++++------- .../disguise/disguisetypes/Disguise.java | 2 +- .../disguise/utilities/DisguiseUtilities.java | 7 +-- .../utilities/listeners/DisguiseListener.java | 10 ++--- .../utilities/translations/LibsMsg.java | 7 +++ 41 files changed, 270 insertions(+), 268 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java b/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java index ab51280b..1da59d8a 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java @@ -115,13 +115,13 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter { if (command != null) { if (!command.hasPermission(sender)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } command.onCommand(sender, args); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_COMMAND_WRONG_ARG); + LibsMsg.LIBS_COMMAND_WRONG_ARG.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseCommand.java index 87a49cea..75db0fb5 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseCommand.java @@ -28,7 +28,7 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter } if (!(sender instanceof Entity)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } @@ -81,9 +81,9 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter disguise.startDisguise(); if (disguise.isDisguiseInUse()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISGUISED, disguise.getDisguiseName()); + LibsMsg.DISGUISED.send(sender, disguise.getDisguiseName()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.FAILED_DISGIUSE, disguise.getDisguiseName()); + LibsMsg.FAILED_DISGIUSE.send(sender, disguise.getDisguiseName()); } return true; @@ -118,22 +118,21 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter ArrayList allowedDisguises = getAllowedDisguises(permissions); if (allowedDisguises.isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return; } - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, - StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); + LibsMsg.DISG_HELP1.send(sender); + LibsMsg.CAN_USE_DISGS.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); if (allowedDisguises.contains("player")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP2); + LibsMsg.DISG_HELP2.send(sender); } - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP3); + LibsMsg.DISG_HELP3.send(sender); if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP4); + LibsMsg.DISG_HELP4.send(sender); } } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseEntityCommand.java index 783b5062..b333b510 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseEntityCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseEntityCommand.java @@ -28,12 +28,12 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom } if (!(sender instanceof Player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } if (!getPermissions(sender).hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -65,7 +65,7 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom .addInteraction(sender.getName(), new DisguiseEntityInteraction(disguiseArgs), DisguiseConfig.getDisguiseEntityExpire()); - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_CLICK, DisguiseConfig.getDisguiseEntityExpire(), + LibsMsg.DISG_ENT_CLICK.send(sender, DisguiseConfig.getDisguiseEntityExpire(), testDisguise.getDisguiseName()); return true; } @@ -93,22 +93,22 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom ArrayList allowedDisguises = getAllowedDisguises(permissions); if (allowedDisguises.isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return; } - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, + LibsMsg.DISG_ENT_HELP1.send(sender); + LibsMsg.CAN_USE_DISGS.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); if (allowedDisguises.contains("player")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP3); + LibsMsg.DISG_ENT_HELP3.send(sender); } - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP4); + LibsMsg.DISG_ENT_HELP4.send(sender); if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP5); + LibsMsg.DISG_ENT_HELP5.send(sender); } } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguisePlayerCommand.java b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguisePlayerCommand.java index 5aa766bc..10f759a3 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguisePlayerCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguisePlayerCommand.java @@ -34,7 +34,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom DisguisePermissions permissions = getPermissions(sender); if (!permissions.hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -44,7 +44,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom } if (args.length == 1) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DPLAYER_SUPPLY); + LibsMsg.DPLAYER_SUPPLY.send(sender); return true; } @@ -61,7 +61,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom } if (entityTarget == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]); return true; } @@ -92,7 +92,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom } if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISABLED_LIVING_TO_MISC); + LibsMsg.DISABLED_LIVING_TO_MISC.send(sender); return true; } @@ -123,11 +123,11 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom disguise.startDisguise(); if (disguise.isDisguiseInUse()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_PLAYER_AS_DISG, + LibsMsg.DISG_PLAYER_AS_DISG.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_PLAYER_AS_DISG_FAIL, + LibsMsg.DISG_PLAYER_AS_DISG_FAIL.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName()); } @@ -177,22 +177,22 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom ArrayList allowedDisguises = getAllowedDisguises(permissions); if (allowedDisguises.isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return; } - DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, + LibsMsg.D_HELP1.send(sender); + LibsMsg.CAN_USE_DISGS.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); if (allowedDisguises.contains("player")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP3); + LibsMsg.D_HELP3.send(sender); } - DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP4); + LibsMsg.D_HELP4.send(sender); if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP5); + LibsMsg.D_HELP5.send(sender); } } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseRadiusCommand.java b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseRadiusCommand.java index dc53ac33..2270f8fb 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseRadiusCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/disguise/DisguiseRadiusCommand.java @@ -52,14 +52,14 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom } if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } DisguisePermissions permissions = getPermissions(sender); if (!permissions.hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -78,7 +78,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom Collections.sort(classes); - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_ENTITIES, + LibsMsg.DRADIUS_ENTITIES.send(sender, ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)); return true; } @@ -104,30 +104,34 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom } if (type == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_UNRECOGNIZED, args[0]); + LibsMsg.DMODRADIUS_UNRECOGNIZED.send(sender, args[0]); return true; } } } if (args.length == starting + 1) { - DisguiseUtilities.sendMessage(sender, - starting == 0 ? LibsMsg.DRADIUS_NEEDOPTIONS : LibsMsg.DRADIUS_NEEDOPTIONS_ENTITY); + if (starting == 0) { + LibsMsg.DRADIUS_NEEDOPTIONS.send(sender); + } else { + LibsMsg.DRADIUS_NEEDOPTIONS_ENTITY.send(sender); + } + return true; } else if (args.length < 2) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_NEEDOPTIONS); + LibsMsg.DRADIUS_NEEDOPTIONS.send(sender); return true; } if (!isInteger(args[starting])) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_NUMBER, args[starting]); + LibsMsg.NOT_NUMBER.send(sender, args[starting]); return true; } int radius = Integer.parseInt(args[starting]); if (radius > maxRadius) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); + LibsMsg.LIMITED_RADIUS.send(sender, maxRadius); radius = maxRadius; } @@ -206,13 +210,13 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom } if (disguisedEntitys > 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISRADIUS, disguisedEntitys); + LibsMsg.DISRADIUS.send(sender, disguisedEntitys); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.DISRADIUS_FAIL); + LibsMsg.DISRADIUS_FAIL.send(sender); } if (miscDisguises > 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_MISCDISG, miscDisguises); + LibsMsg.DRADIUS_MISCDISG.send(sender, miscDisguises); } } catch (DisguiseParseException ex) { @@ -282,24 +286,23 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom ArrayList allowedDisguises = getAllowedDisguises(permissions); if (allowedDisguises.isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return; } - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP1, maxRadius); - DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, - StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); + LibsMsg.DRADIUS_HELP1.send(sender, maxRadius); + LibsMsg.CAN_USE_DISGS.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); if (allowedDisguises.contains("player")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP3); + LibsMsg.DRADIUS_HELP3.send(sender); } - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP4); + LibsMsg.DRADIUS_HELP4.send(sender); if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP5); + LibsMsg.DRADIUS_HELP5.send(sender); } - DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP6); + LibsMsg.DRADIUS_HELP6.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/interactions/CopyDisguiseInteraction.java b/src/main/java/me/libraryaddict/disguise/commands/interactions/CopyDisguiseInteraction.java index 1f4bc933..94e345d8 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/interactions/CopyDisguiseInteraction.java +++ b/src/main/java/me/libraryaddict/disguise/commands/interactions/CopyDisguiseInteraction.java @@ -36,7 +36,7 @@ public class CopyDisguiseInteraction implements LibsEntityInteract { DisguiseParser.parseToString(disguise), true); } } else { - DisguiseUtilities.sendMessage(player, LibsMsg.TARGET_NOT_DISGUISED); + LibsMsg.TARGET_NOT_DISGUISED.send(player); } } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseEntityInteraction.java b/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseEntityInteraction.java index 502dd628..1ddf45a6 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseEntityInteraction.java +++ b/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseEntityInteraction.java @@ -53,7 +53,7 @@ public class DisguiseEntityInteraction implements LibsEntityInteract { if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() && entity instanceof LivingEntity) { - DisguiseUtilities.sendMessage(p, LibsMsg.DISABLED_LIVING_TO_MISC); + LibsMsg.DISABLED_LIVING_TO_MISC.send(p); } else { if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() && !entity.hasPermission("libsdisguises.hidename")) { @@ -77,37 +77,29 @@ public class DisguiseEntityInteraction implements LibsEntityInteract { if (disguise.isDisguiseInUse()) { if (disguise.isPlayerDisguise()) { if (entity instanceof Player) { - DisguiseUtilities - .sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER, entityName, disguiseName); + LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER.send(p, entityName, disguiseName); } else { - DisguiseUtilities - .sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER, entityName, disguiseName); + LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER.send(p, entityName, disguiseName); } } else { if (entity instanceof Player) { - DisguiseUtilities - .sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY, entityName, disguiseName); + LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY.send(p, entityName, disguiseName); } else { - DisguiseUtilities - .sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY, entityName, disguiseName); + LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY.send(p, entityName, disguiseName); } } } else { if (disguise.isPlayerDisguise()) { if (entity instanceof Player) { - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER_FAIL, entityName, - disguiseName); + LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER_FAIL.send(p, entityName, disguiseName); } else { - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER_FAIL, entityName, - disguiseName); + LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER_FAIL.send(p, entityName, disguiseName); } } else { if (entity instanceof Player) { - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY_FAIL, entityName, - disguiseName); + LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY_FAIL.send(p, entityName, disguiseName); } else { - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL, entityName, - disguiseName); + LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL.send(p, entityName, disguiseName); } } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseModifyInteraction.java b/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseModifyInteraction.java index b29da67d..cfc25361 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseModifyInteraction.java +++ b/src/main/java/me/libraryaddict/disguise/commands/interactions/DisguiseModifyInteraction.java @@ -38,7 +38,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract { Disguise disguise = DisguiseAPI.getDisguise(p, entity); if (disguise == null) { - DisguiseUtilities.sendMessage(p, LibsMsg.UNDISG_PLAYER_FAIL, entityName); + LibsMsg.UNDISG_PLAYER_FAIL.send(p, entityName); return; } @@ -48,7 +48,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract { DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); if (!perms.isAllowedDisguise(disguisePerm, Arrays.asList(options))) { - DisguiseUtilities.sendMessage(p, LibsMsg.DMODPLAYER_NOPERM); + LibsMsg.DMODPLAYER_NOPERM.send(p); return; } @@ -56,7 +56,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract { DisguiseParser .callMethods(p, disguise, perms, disguisePerm, new ArrayList<>(Arrays.asList(options)), options, "DisguiseModifyEntity"); - DisguiseUtilities.sendMessage(p, LibsMsg.LISTENER_MODIFIED_DISG); + LibsMsg.LISTENER_MODIFIED_DISG.send(p); } catch (DisguiseParseException ex) { if (ex.getMessage() != null) { diff --git a/src/main/java/me/libraryaddict/disguise/commands/interactions/UndisguiseEntityInteraction.java b/src/main/java/me/libraryaddict/disguise/commands/interactions/UndisguiseEntityInteraction.java index 437460b7..ccc90cf5 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/interactions/UndisguiseEntityInteraction.java +++ b/src/main/java/me/libraryaddict/disguise/commands/interactions/UndisguiseEntityInteraction.java @@ -26,14 +26,14 @@ public class UndisguiseEntityInteraction implements LibsEntityInteract { DisguiseAPI.undisguiseToAll(entity); if (entity instanceof Player) - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER, entityName); + LibsMsg.LISTEN_UNDISG_PLAYER.send(p, entityName); else - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT, entityName); + LibsMsg.LISTEN_UNDISG_ENT.send(p, entityName); } else { if (entity instanceof Player) - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER_FAIL, entityName); + LibsMsg.LISTEN_UNDISG_PLAYER_FAIL.send(p, entityName); else - DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT_FAIL, entityName); + LibsMsg.LISTEN_UNDISG_ENT_FAIL.send(p, entityName); } } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDChangelog.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDChangelog.java index 2d3255bb..4ae31541 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDChangelog.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDChangelog.java @@ -34,12 +34,12 @@ public class LDChangelog implements LDCommand { UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker(); if (checker.isDownloading()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_IN_PROGRESS); + LibsMsg.UPDATE_IN_PROGRESS.send(sender); return; } if (checker.getUpdate() == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_REQUIRED); + LibsMsg.UPDATE_REQUIRED.send(sender); return; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDConfig.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDConfig.java index da310c66..8ee1f065 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDConfig.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDConfig.java @@ -35,7 +35,7 @@ public class LDConfig implements LDCommand { ArrayList returns = DisguiseConfig.doOutput(LibsDisguises.getInstance().getConfig(), true, true); if (returns.isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.USING_DEFAULT_CONFIG); + LibsMsg.USING_DEFAULT_CONFIG.send(sender); return; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDCount.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDCount.java index 51f23518..1bad5c94 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDCount.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDCount.java @@ -35,9 +35,9 @@ public class LDCount implements LDCommand { } if (counts.isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_DISGUISES_IN_USE); + LibsMsg.NO_DISGUISES_IN_USE.send(sender); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.ACTIVE_DISGUISES_COUNT, + LibsMsg.ACTIVE_DISGUISES_COUNT.send(sender, counts.values().stream().reduce(Integer::sum).get()); ArrayList types = new ArrayList<>(counts.keySet()); @@ -55,7 +55,7 @@ public class LDCount implements LDCommand { } } - DisguiseUtilities.sendMessage(sender, LibsMsg.ACTIVE_DISGUISES, builder.toString()); + LibsMsg.ACTIVE_DISGUISES.send(sender, builder.toString()); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDDebugPlayer.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDDebugPlayer.java index eaff506a..d866264c 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDDebugPlayer.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDDebugPlayer.java @@ -29,7 +29,7 @@ public class LDDebugPlayer implements LDCommand { Disguise disguise = DisguiseAPI.getDisguise(player, entity); if (disguise == null) { - DisguiseUtilities.sendMessage(player, LibsMsg.TARGET_NOT_DISGUISED); + LibsMsg.TARGET_NOT_DISGUISED.send(player); return; } @@ -100,7 +100,7 @@ public class LDDebugPlayer implements LDCommand { @Override public void onCommand(CommandSender sender, String[] args) { if (!(sender instanceof Player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); } LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new DebugInteraction(), 60); diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDHelp.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDHelp.java index 5f1f0376..a266a3eb 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDHelp.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDHelp.java @@ -40,7 +40,7 @@ public class LDHelp implements LDCommand { continue; } - DisguiseUtilities.sendMessage(sender, cmd.getHelp()); + cmd.getHelp().send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java index bb8b4cb7..0f7cd205 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java @@ -35,7 +35,7 @@ public class LDJson implements LDCommand { @Override public void onCommand(CommandSender sender, String[] args) { if (!(sender instanceof Player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return; } @@ -88,7 +88,7 @@ public class LDJson implements LDCommand { private void sendMessage(CommandSender sender, LibsMsg prefix, LibsMsg oldVer, String string) { if (!NmsVersion.v1_13.isSupported()) { - DisguiseUtilities.sendMessage(sender, oldVer, string); + oldVer.send(sender, string); return; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java index faac7440..40b074e7 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java @@ -35,7 +35,7 @@ public class LDMetaInfo implements LDCommand { MetaIndex index = MetaIndex.getMetaIndexByName(args[1]); if (index == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.META_NOT_FOUND); + LibsMsg.META_NOT_FOUND.send(sender); return; } @@ -69,7 +69,7 @@ public class LDMetaInfo implements LDCommand { sender.spigot().sendMessage(builder.create()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.META_VALUES_NO_CLICK, + LibsMsg.META_VALUES_NO_CLICK.send(sender, StringUtils.join(names, LibsMsg.META_VALUE_SEPERATOR.get())); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMods.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMods.java index 879ece8f..e5029169 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMods.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMods.java @@ -28,7 +28,7 @@ public class LDMods implements LDCommand { @Override public void onCommand(CommandSender sender, String[] args) { if (ModdedManager.getEntities().isEmpty()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_MODS_LISTENING); + LibsMsg.NO_MODS_LISTENING.send(sender); return; } @@ -38,22 +38,22 @@ public class LDMods implements LDCommand { player = Bukkit.getPlayer(args[1]); if (player == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[1]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[1]); return; } } else if (sender instanceof Player) { player = (Player) sender; } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return; } if (!player.hasMetadata("forge_mods")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_MODS, player.getName()); + LibsMsg.NO_MODS.send(sender, player.getName()); return; } - DisguiseUtilities.sendMessage(sender, LibsMsg.MODS_LIST, player.getName(), + LibsMsg.MODS_LIST.send(sender, player.getName(), StringUtils.join((List) player.getMetadata("forge_mods").get(0).value(), ", ")); } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDPermTest.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDPermTest.java index 707b8cd8..c4ea8bc0 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDPermTest.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDPermTest.java @@ -32,7 +32,7 @@ public class LDPermTest implements LDCommand { @Override public void onCommand(CommandSender sender, String[] args) { if (!LibsPremium.isPremium()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_NON_PREM); + LibsMsg.LIBS_PERM_CHECK_NON_PREM.send(sender); } Permissible player; @@ -41,7 +41,7 @@ public class LDPermTest implements LDCommand { player = Bukkit.getPlayer(args[1]); if (player == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[1]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[1]); return; } } else { @@ -49,40 +49,40 @@ public class LDPermTest implements LDCommand { } DisguisePermissions permissions = new DisguisePermissions(player, "disguise"); - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_INFO_1); - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_INFO_2); + LibsMsg.LIBS_PERM_CHECK_INFO_1.send(sender); + LibsMsg.LIBS_PERM_CHECK_INFO_2.send(sender); if (player.hasPermission("libsdisguises.disguise.pig")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NORMAL_PERM_CHECK_SUCCESS); + LibsMsg.NORMAL_PERM_CHECK_SUCCESS.send(sender); if (permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.PIG))) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_SUCCESS); + LibsMsg.LIBS_PERM_CHECK_SUCCESS.send(sender); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_FAIL); + LibsMsg.LIBS_PERM_CHECK_FAIL.send(sender); } } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.NORMAL_PERM_CHECK_FAIL); + LibsMsg.NORMAL_PERM_CHECK_FAIL.send(sender); } if (player.hasPermission("libsdisguises.disguise.zombie") || permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.ZOMBIE))) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_ZOMBIE_PERMISSIONS); + LibsMsg.LIBS_PERM_CHECK_ZOMBIE_PERMISSIONS.send(sender); } PluginCommand command = LibsDisguises.getInstance().getCommand("disguise"); if (command == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_COMMAND_UNREGISTERED); + LibsMsg.LIBS_PERM_CHECK_COMMAND_UNREGISTERED.send(sender); } else if (player.hasPermission(command.getPermission())) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_SUCCESS, command.getPermission()); + LibsMsg.LIBS_PERM_COMMAND_SUCCESS.send(sender, command.getPermission()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_FAIL, command.getPermission()); + LibsMsg.LIBS_PERM_COMMAND_FAIL.send(sender, command.getPermission()); } if (!sender.hasPermission("libsdisguises.seecmd.disguise")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_FAIL, "libsdisguises.seecmd.disguise"); + LibsMsg.LIBS_PERM_COMMAND_FAIL.send(sender, "libsdisguises.seecmd.disguise"); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_SUCCESS, "libsdisguises.seecmd.disguise"); + LibsMsg.LIBS_PERM_COMMAND_SUCCESS.send(sender, "libsdisguises.seecmd.disguise"); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDReload.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDReload.java index 67cf6046..88dd06c5 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDReload.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDReload.java @@ -27,7 +27,7 @@ public class LDReload implements LDCommand { public void onCommand(CommandSender sender, String[] args) { DisguiseConfig.loadConfig(); new SoundManager().load(); - DisguiseUtilities.sendMessage(sender, LibsMsg.RELOADED_CONFIG); + LibsMsg.RELOADED_CONFIG.send(sender); } @Override diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDScoreboard.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDScoreboard.java index f8d671d2..247a4487 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDScoreboard.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDScoreboard.java @@ -109,18 +109,18 @@ public class LDScoreboard implements LDCommand { } if (issuesFound == 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_ISSUES); + LibsMsg.LIBS_SCOREBOARD_NO_ISSUES.send(sender); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_ISSUES, issuesFound); + LibsMsg.LIBS_SCOREBOARD_ISSUES.send(sender, issuesFound); } } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NAMES_DISABLED); + LibsMsg.LIBS_SCOREBOARD_NAMES_DISABLED.send(sender); } - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST); + LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.send(sender); if (DisguiseConfig.getPushingOption() == DisguiseConfig.DisguisePushing.IGNORE_SCOREBOARD) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_DISABLED); + LibsMsg.LIBS_SCOREBOARD_DISABLED.send(sender); } Player player; @@ -129,23 +129,23 @@ public class LDScoreboard implements LDCommand { player = Bukkit.getPlayer(args[1]); if (player == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[1]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[1]); return; } if (!DisguiseAPI.isDisguised(player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NODISGUISE, player.getName()); + LibsMsg.DMODPLAYER_NODISGUISE.send(sender, player.getName()); return; } } else if (sender instanceof Player) { player = (Player) sender; if (!DisguiseAPI.isDisguised(player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); + LibsMsg.NOT_DISGUISED.send(sender); return; } } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return; } @@ -154,17 +154,17 @@ public class LDScoreboard implements LDCommand { Team team = board.getEntryTeam(sender.getName()); if (team == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_TEAM); + LibsMsg.LIBS_SCOREBOARD_NO_TEAM.send(sender); return; } if (team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.NEVER && team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.FOR_OTHER_TEAMS) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_TEAM_PUSH, team.getName()); + LibsMsg.LIBS_SCOREBOARD_NO_TEAM_PUSH.send(sender, team.getName()); return; } - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_SUCCESS, team.getName()); + LibsMsg.LIBS_SCOREBOARD_SUCCESS.send(sender, team.getName()); } @Override diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUpdate.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUpdate.java index d6488e14..fcbe202b 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUpdate.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUpdate.java @@ -35,7 +35,7 @@ public class LDUpdate implements LDCommand { UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker(); if (checker.isDownloading()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_IN_PROGRESS); + LibsMsg.UPDATE_IN_PROGRESS.send(sender); return; } @@ -49,7 +49,7 @@ public class LDUpdate implements LDCommand { } else if (args[1].equalsIgnoreCase("release")) { releaseBuilds = true; } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_UPDATE_UNKNOWN_BRANCH); + LibsMsg.LIBS_UPDATE_UNKNOWN_BRANCH.send(sender); return; } @@ -59,12 +59,12 @@ public class LDUpdate implements LDCommand { if (checker.getUpdate() != null && checker.getUpdate().isReleaseBuild() == releaseBuilds && args.length <= 1 && !forceCheck) { if (checker.isServerLatestVersion()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ON_LATEST); + LibsMsg.UPDATE_ON_LATEST.send(sender); return; } if (checker.isOnLatestUpdate(true)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ALREADY_DOWNLOADED); + LibsMsg.UPDATE_ALREADY_DOWNLOADED.send(sender); return; } } @@ -79,15 +79,15 @@ public class LDUpdate implements LDCommand { } if (checker.getUpdate() == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_FAILED); + LibsMsg.UPDATE_FAILED.send(sender); return; } if (checker.isOnLatestUpdate(true)) { if (checker.getLastDownload() != null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ALREADY_DOWNLOADED); + LibsMsg.UPDATE_ALREADY_DOWNLOADED.send(sender); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ON_LATEST); + LibsMsg.UPDATE_ON_LATEST.send(sender); } return; @@ -95,7 +95,7 @@ public class LDUpdate implements LDCommand { if (!forceUpdate) { if (updateResult != null) { - DisguiseUtilities.sendMessage(sender, updateResult); + updateResult.send(sender); } else { for (String msg : checker.getUpdateMessage()) { DisguiseUtilities.sendMessage(sender, msg); @@ -108,7 +108,7 @@ public class LDUpdate implements LDCommand { PluginInformation result = checker.doUpdate(); if (result == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_FAILED); + LibsMsg.UPDATE_FAILED.send(sender); return; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyCommand.java b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyCommand.java index 0f95f8e8..3ff2fab9 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyCommand.java @@ -23,14 +23,14 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Entity)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } DisguisePermissions permissions = getPermissions(sender); if (!permissions.hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -42,14 +42,14 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender); if (disguise == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); + LibsMsg.NOT_DISGUISED.send(sender); return true; } DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); if (!permissions.isAllowedDisguise(disguisePerm)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_NO_PERM); + LibsMsg.DMODIFY_NO_PERM.send(sender); return true; } @@ -73,7 +73,7 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom return true; } - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_MODIFIED); + LibsMsg.DMODIFY_MODIFIED.send(sender); return true; } @@ -106,9 +106,9 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { ArrayList allowedDisguises = getAllowedDisguises(permissions); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, + LibsMsg.DMODIFY_HELP3.send(sender); + LibsMsg.DMODIFY_HELP3.send(sender); + LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyEntityCommand.java index f8abd83c..4f430529 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyEntityCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyEntityCommand.java @@ -22,14 +22,14 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } DisguisePermissions permissions = getPermissions(sender); if (!permissions.hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -44,7 +44,7 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements new DisguiseModifyInteraction(DisguiseUtilities.split(StringUtils.join(args, " "))), DisguiseConfig.getDisguiseEntityExpire()); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFYENT_CLICK, DisguiseConfig.getDisguiseEntityExpire()); + LibsMsg.DMODIFYENT_CLICK.send(sender, DisguiseConfig.getDisguiseEntityExpire()); return true; } @@ -78,8 +78,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { ArrayList allowedDisguises = getAllowedDisguises(permissions); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODENT_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, + LibsMsg.DMODENT_HELP1.send(sender); + LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyPlayerCommand.java b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyPlayerCommand.java index 7f1000d2..666a9a56 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyPlayerCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyPlayerCommand.java @@ -28,7 +28,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements DisguisePermissions permissions = getPermissions(sender); if (!permissions.hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -50,7 +50,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements } if (entityTarget == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]); return true; } @@ -71,14 +71,14 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements disguise = DisguiseAPI.getDisguise(entityTarget); if (disguise == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NODISGUISE, entityTarget.getName()); + LibsMsg.DMODPLAYER_NODISGUISE.send(sender, entityTarget.getName()); return true; } DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); if (!permissions.isAllowedDisguise(disguisePerm)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NOPERM); + LibsMsg.DMODPLAYER_NOPERM.send(sender); return true; } @@ -102,7 +102,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements return true; } - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_MODIFIED, entityTarget.getName()); + LibsMsg.DMODPLAYER_MODIFIED.send(sender, entityTarget.getName()); return true; } @@ -161,8 +161,8 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { ArrayList allowedDisguises = getAllowedDisguises(permissions); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, + LibsMsg.DMODPLAYER_HELP1.send(sender); + LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyRadiusCommand.java b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyRadiusCommand.java index 2644719e..853c7c1b 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyRadiusCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/modify/DisguiseModifyRadiusCommand.java @@ -47,14 +47,14 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } DisguisePermissions permissions = getPermissions(sender); if (!permissions.hasPermissions()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -77,7 +77,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements Collections.sort(classes); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_USABLE, + LibsMsg.DMODRADIUS_USABLE.send(sender, ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)); return true; } @@ -99,29 +99,33 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements } if (baseType == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_UNRECOGNIZED, args[0]); + LibsMsg.DMODRADIUS_UNRECOGNIZED.send(sender, args[0]); return true; } } if (args.length == starting + 1) { - DisguiseUtilities.sendMessage(sender, - starting == 0 ? LibsMsg.DMODRADIUS_NEEDOPTIONS : LibsMsg.DMODRADIUS_NEEDOPTIONS_ENTITY); + if (starting == 0) { + LibsMsg.DMODRADIUS_NEEDOPTIONS.send(sender); + } else { + LibsMsg.DMODRADIUS_NEEDOPTIONS_ENTITY.send(sender); + } + return true; } else if (args.length < 2) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NEEDOPTIONS); + LibsMsg.DMODRADIUS_NEEDOPTIONS.send(sender); return true; } if (!isInteger(args[starting])) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_NUMBER, args[starting]); + LibsMsg.NOT_NUMBER.send(sender, args[starting]); return true; } int radius = Integer.parseInt(args[starting]); if (radius > maxRadius) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); + LibsMsg.LIMITED_RADIUS.send(sender, maxRadius); radius = maxRadius; } @@ -188,13 +192,13 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements } if (noPermission > 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NOPERM, noPermission); + LibsMsg.DMODRADIUS_NOPERM.send(sender, noPermission); } if (modifiedDisguises > 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS, modifiedDisguises); + LibsMsg.DMODRADIUS.send(sender, modifiedDisguises); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NOENTS); + LibsMsg.DMODRADIUS_NOENTS.send(sender); } return true; @@ -245,7 +249,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements int radius = Integer.parseInt(args[starting]); if (radius > maxRadius) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); + LibsMsg.LIMITED_RADIUS.send(sender, maxRadius); radius = maxRadius; } @@ -287,11 +291,10 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { ArrayList allowedDisguises = getAllowedDisguises(permissions); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP1, maxRadius); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, - StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); + LibsMsg.DMODRADIUS_HELP1.send(sender, maxRadius); + LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP2); - DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP3); + LibsMsg.DMODRADIUS_HELP2.send(sender); + LibsMsg.DMODRADIUS_HELP3.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseCommand.java index df6303b1..5fefbf40 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseCommand.java @@ -22,19 +22,19 @@ public class UndisguiseCommand implements CommandExecutor { } if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } if (sender.hasPermission("libsdisguises.undisguise") && !"%%__USER__%%".equals(12345 + "")) { if (DisguiseAPI.isDisguised((Entity) sender)) { DisguiseAPI.undisguiseToAll((Player) sender); - DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG); + LibsMsg.UNDISG.send(sender); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); + LibsMsg.NOT_DISGUISED.send(sender); } } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); } return true; diff --git a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseEntityCommand.java index 9700596f..0aa1c286 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseEntityCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseEntityCommand.java @@ -22,18 +22,18 @@ public class UndisguiseEntityCommand implements CommandExecutor { } if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } if (!sender.hasPermission("libsdisguises.undisguiseentity")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(), DisguiseConfig.getDisguiseEntityExpire()); - DisguiseUtilities.sendMessage(sender, LibsMsg.UND_ENTITY); + LibsMsg.UND_ENTITY.send(sender); return true; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguisePlayerCommand.java b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguisePlayerCommand.java index 69f4cea0..c3cec8da 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguisePlayerCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguisePlayerCommand.java @@ -63,12 +63,12 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter { } if (!sender.hasPermission("libsdisguises.undisguiseplayer")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } if (args.length == 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER_HELP); + LibsMsg.UNDISG_PLAYER_HELP.send(sender); return true; } @@ -85,17 +85,17 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter { } if (entityTarget == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]); return true; } if (DisguiseAPI.isDisguised(entityTarget)) { DisguiseAPI.undisguiseToAll(entityTarget); - DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER, + LibsMsg.UNDISG_PLAYER.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER_FAIL, + LibsMsg.UNDISG_PLAYER_FAIL.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable()); } diff --git a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseRadiusCommand.java b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseRadiusCommand.java index b25075d8..8ea63faf 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseRadiusCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/undisguise/UndisguiseRadiusCommand.java @@ -37,7 +37,7 @@ public class UndisguiseRadiusCommand implements CommandExecutor { } if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } @@ -45,12 +45,12 @@ public class UndisguiseRadiusCommand implements CommandExecutor { int radius = maxRadius; if (args.length > 0) { if (!isNumeric(args[0])) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_NUMBER, args[0]); + LibsMsg.NOT_NUMBER.send(sender, args[0]); return true; } radius = Integer.parseInt(args[0]); if (radius > maxRadius) { - DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); + LibsMsg.LIMITED_RADIUS.send(sender, maxRadius); radius = maxRadius; } } @@ -66,9 +66,9 @@ public class UndisguiseRadiusCommand implements CommandExecutor { } } - DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISRADIUS, disguisedEntitys); + LibsMsg.UNDISRADIUS.send(sender, disguisedEntitys); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); } return true; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java index dde8ec27..31705d33 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java @@ -38,7 +38,7 @@ public class CopyDisguiseCommand implements CommandExecutor { } if (!sender.hasPermission("libsdisguises.copydisguise")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -58,7 +58,7 @@ public class CopyDisguiseCommand implements CommandExecutor { } if (target == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); + LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]); return true; } } @@ -70,8 +70,7 @@ public class CopyDisguiseCommand implements CommandExecutor { .addInteraction(sender.getName(), new CopyDisguiseInteraction(this), DisguiseConfig.getDisguiseEntityExpire()); - DisguiseUtilities - .sendMessage(sender, LibsMsg.DISGUISECOPY_INTERACT, DisguiseConfig.getDisguiseEntityExpire()); + LibsMsg.DISGUISECOPY_INTERACT.send(sender, DisguiseConfig.getDisguiseEntityExpire()); return true; } @@ -91,7 +90,7 @@ public class CopyDisguiseCommand implements CommandExecutor { public void sendMessage(CommandSender sender, LibsMsg msg, LibsMsg oldVer, String string, boolean forceAbbrev) { if (!NmsVersion.v1_13.isSupported()) { - DisguiseUtilities.sendMessage(sender, oldVer, string); + oldVer.send(sender, string); return; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseCloneCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseCloneCommand.java index 3d6ad3b2..45658590 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseCloneCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseCloneCommand.java @@ -22,13 +22,13 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } if (!sender.hasPermission("libsdisguises.disguise.disguiseclone")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -53,7 +53,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp } else if (option.equalsIgnoreCase(LibsMsg.DCLONE_SPRINT.get())) { doSprint = true; } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.INVALID_CLONE, option); + LibsMsg.INVALID_CLONE.send(sender, option); return true; } } @@ -67,7 +67,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp .addInteraction(sender.getName(), new DisguiseCloneInteraction(options), DisguiseConfig.getDisguiseCloneExpire()); - DisguiseUtilities.sendMessage(sender, LibsMsg.CLICK_TIMER, DisguiseConfig.getDisguiseCloneExpire()); + LibsMsg.CLICK_TIMER.send(sender, DisguiseConfig.getDisguiseCloneExpire()); } return true; @@ -103,8 +103,8 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp */ @Override protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { - DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP2); - DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP3); + LibsMsg.CLONE_HELP1.send(sender); + LibsMsg.CLONE_HELP2.send(sender); + LibsMsg.CLONE_HELP3.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseHelpCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseHelpCommand.java index 079976f6..5ea7731d 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseHelpCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseHelpCommand.java @@ -48,16 +48,14 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl if (help != null) { if (help.hasValues() && help.canTranslateValues()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP4, help.getName(), + LibsMsg.DHELP_HELP4.send(sender, help.getName(), StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get())); } else { if (!help.getName().equals(help.getDescriptiveName())) { - DisguiseUtilities - .sendMessage(sender, LibsMsg.DHELP_HELP6, help.getName(), help.getDescriptiveName(), - help.getDescription()); + LibsMsg.DHELP_HELP6 + .send(sender, help.getName(), help.getDescriptiveName(), help.getDescription()); } else { - DisguiseUtilities - .sendMessage(sender, LibsMsg.DHELP_HELP5, help.getName(), help.getDescription()); + LibsMsg.DHELP_HELP5.send(sender, help.getName(), help.getDescription()); } } @@ -67,12 +65,12 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl DisguisePerm type = DisguiseParser.getDisguisePerm(args[0]); if (type == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_CANTFIND, args[0]); + LibsMsg.DHELP_CANTFIND.send(sender, args[0]); return true; } if (!perms.isAllowedDisguise(type)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM_DISGUISE); + LibsMsg.NO_PERM_DISGUISE.send(sender); return true; } @@ -114,18 +112,18 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl methods.add(LibsMsg.DHELP_NO_OPTIONS.get()); } - DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_OPTIONS, ChatColor.DARK_RED + type.toReadable(), + LibsMsg.DHELP_OPTIONS.send(sender, ChatColor.DARK_RED + type.toReadable(), StringUtils.join(methods, ChatColor.DARK_RED + ", ")); if (ignored > 0) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERMS_USE_OPTIONS, ignored); + LibsMsg.NO_PERMS_USE_OPTIONS.send(sender, ignored); } return true; } } - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -161,11 +159,11 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl */ @Override protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP1); - DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP2); + LibsMsg.DHELP_HELP1.send(sender); + LibsMsg.DHELP_HELP2.send(sender); for (ParamInfo s : ParamInfoManager.getParamInfos()) { - DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP3, s.getName().replaceAll(" ", "") + + LibsMsg.DHELP_HELP3.send(sender, s.getName().replaceAll(" ", "") + (!s.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""), s.getDescription()); } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewBarCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewBarCommand.java index f7c2a0b4..1461c27e 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewBarCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewBarCommand.java @@ -15,7 +15,7 @@ public class DisguiseViewBarCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } @@ -23,10 +23,10 @@ public class DisguiseViewBarCommand implements CommandExecutor { if (DisguiseAPI.isActionBarShown(player)) { DisguiseAPI.setActionBarShown(player, false); - DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_BAR_OFF); + LibsMsg.VIEW_BAR_OFF.send(sender); } else { DisguiseAPI.setActionBarShown(player, true); - DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_BAR_ON); + LibsMsg.VIEW_BAR_ON.send(sender); } return true; diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java index 47a9ecb8..f35beac0 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java @@ -16,7 +16,7 @@ public class DisguiseViewSelfCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender.getName().equals("CONSOLE")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } @@ -24,10 +24,10 @@ public class DisguiseViewSelfCommand implements CommandExecutor { if (DisguiseAPI.isViewSelfToggled(player)) { DisguiseAPI.setViewDisguiseToggled(player, false); - DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_SELF_OFF); + LibsMsg.VIEW_SELF_OFF.send(sender); } else { DisguiseAPI.setViewDisguiseToggled(player, true); - DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_SELF_ON); + LibsMsg.VIEW_SELF_ON.send(sender); } return true; diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/GrabHeadCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/GrabHeadCommand.java index 50cd42a9..5f827bcc 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/GrabHeadCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/GrabHeadCommand.java @@ -33,12 +33,12 @@ public class GrabHeadCommand implements CommandExecutor { } if (!sender.hasPermission("libsdisguises.grabhead")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } if (!(sender instanceof Player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } @@ -61,20 +61,20 @@ public class GrabHeadCommand implements CommandExecutor { private BukkitTask runnable = new BukkitRunnable() { @Override public void run() { - DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); + LibsMsg.PLEASE_WAIT.send(sender); } }.runTaskTimer(LibsDisguises.getInstance(), 100, 100); @Override public void onError(LibsMsg msg, Object... args) { - DisguiseUtilities.sendMessage(sender, msg, args); + msg.send(sender, args); runnable.cancel(); } @Override public void onInfo(LibsMsg msg, Object... args) { - DisguiseUtilities.sendMessage(sender, msg, args); + msg.send(sender, args); } @Override @@ -101,7 +101,7 @@ public class GrabHeadCommand implements CommandExecutor { skull.setItemMeta(meta); ((Player) sender).getInventory().addItem(skull); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_HEAD_SUCCESS); + LibsMsg.GRAB_HEAD_SUCCESS.send(sender); } }.runTask(LibsDisguises.getInstance()); } @@ -113,11 +113,11 @@ public class GrabHeadCommand implements CommandExecutor { } private void sendHelp(CommandSender sender) { - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_1); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_2); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_3); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_4); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_5); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_6); + LibsMsg.GRAB_DISG_HELP_1.send(sender); + LibsMsg.GRAB_DISG_HELP_2.send(sender); + LibsMsg.GRAB_DISG_HELP_3.send(sender); + LibsMsg.GRAB_DISG_HELP_4.send(sender); + LibsMsg.GRAB_DISG_HELP_5.send(sender); + LibsMsg.GRAB_DISG_HELP_6.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java index 849e194a..13f72729 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java @@ -35,7 +35,7 @@ public class GrabSkinCommand implements CommandExecutor { } if (!sender.hasPermission("libsdisguises.grabskin")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -69,20 +69,20 @@ public class GrabSkinCommand implements CommandExecutor { private BukkitTask runnable = new BukkitRunnable() { @Override public void run() { - DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); + LibsMsg.PLEASE_WAIT.send(sender); } }.runTaskTimer(LibsDisguises.getInstance(), 100, 100); @Override public void onError(LibsMsg msg, Object... args) { - DisguiseUtilities.sendMessage(sender, msg, args); + msg.send(sender, args); runnable.cancel(); } @Override public void onInfo(LibsMsg msg, Object... args) { - DisguiseUtilities.sendMessage(sender, msg, args); + msg.send(sender, args); } @Override @@ -107,7 +107,7 @@ public class GrabSkinCommand implements CommandExecutor { } DisguiseAPI.addGameProfile(nName, profile); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRABBED_SKIN, nName); + LibsMsg.GRABBED_SKIN.send(sender, nName); String string = DisguiseUtilities.getGson().toJson(profile); int start = 0; @@ -140,7 +140,7 @@ public class GrabSkinCommand implements CommandExecutor { sender.spigot().sendMessage(builder.create()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.SKIN_DATA, string); + LibsMsg.SKIN_DATA.send(sender, string); } DisguiseUtilities.setGrabSkinCommandUsed(); @@ -153,11 +153,11 @@ public class GrabSkinCommand implements CommandExecutor { } private void sendHelp(CommandSender sender) { - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_1); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_2); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_3); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_4); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_5); - DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_6); + LibsMsg.GRAB_DISG_HELP_1.send(sender); + LibsMsg.GRAB_DISG_HELP_2.send(sender); + LibsMsg.GRAB_DISG_HELP_3.send(sender); + LibsMsg.GRAB_DISG_HELP_4.send(sender); + LibsMsg.GRAB_DISG_HELP_5.send(sender); + LibsMsg.GRAB_DISG_HELP_6.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/SaveDisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/SaveDisguiseCommand.java index 26f0149e..399200db 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/SaveDisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/SaveDisguiseCommand.java @@ -35,7 +35,7 @@ public class SaveDisguiseCommand implements CommandExecutor { } if (!sender.hasPermission("libsdisguises.savedisguise")) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); + LibsMsg.NO_PERM.send(sender); return true; } @@ -51,14 +51,14 @@ public class SaveDisguiseCommand implements CommandExecutor { if (args.length == 0) { if (!(sender instanceof Player)) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); + LibsMsg.NO_CONSOLE.send(sender); return true; } Disguise disguise = DisguiseAPI.getDisguise((Entity) sender); if (disguise == null) { - DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); + LibsMsg.NOT_DISGUISED.send(sender); return true; } @@ -67,13 +67,13 @@ public class SaveDisguiseCommand implements CommandExecutor { try { DisguiseAPI.addCustomDisguise(name, disguiseString); - DisguiseUtilities.sendMessage(sender, LibsMsg.CUSTOM_DISGUISE_SAVED, name); + LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name); } catch (DisguiseParseException e) { if (e.getMessage() != null) { DisguiseUtilities.sendMessage(sender, e.getMessage()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.PARSE_CANT_LOAD); + LibsMsg.PARSE_CANT_LOAD.send(sender); } } @@ -119,7 +119,7 @@ public class SaveDisguiseCommand implements CommandExecutor { private BukkitTask runnable = new BukkitRunnable() { @Override public void run() { - DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); + LibsMsg.PLEASE_WAIT.send(sender); } }.runTaskTimer(LibsDisguises.getInstance(), 100, 100); @@ -127,12 +127,12 @@ public class SaveDisguiseCommand implements CommandExecutor { public void onError(LibsMsg msg, Object... args) { runnable.cancel(); - DisguiseUtilities.sendMessage(sender, msg, args); + msg.send(sender, args); } @Override public void onInfo(LibsMsg msg, Object... args) { - DisguiseUtilities.sendMessage(sender, msg, args); + msg.send(sender, args); } @Override @@ -163,7 +163,7 @@ public class SaveDisguiseCommand implements CommandExecutor { try { DisguiseAPI.addCustomDisguise(name, disguiseString); - DisguiseUtilities.sendMessage(sender, LibsMsg.CUSTOM_DISGUISE_SAVED, name); + LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name); DisguiseUtilities.setSaveDisguiseCommandUsed(); } @@ -171,17 +171,17 @@ public class SaveDisguiseCommand implements CommandExecutor { if (e.getMessage() != null) { DisguiseUtilities.sendMessage(sender, e.getMessage()); } else { - DisguiseUtilities.sendMessage(sender, LibsMsg.PARSE_CANT_LOAD); + LibsMsg.PARSE_CANT_LOAD.send(sender); } } } private void sendHelp(CommandSender sender) { - DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_1); - DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_2); - DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_3); - DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_4); - DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_5); - DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_6); + LibsMsg.SAVE_DISG_HELP_1.send(sender); + LibsMsg.SAVE_DISG_HELP_2.send(sender); + LibsMsg.SAVE_DISG_HELP_3.send(sender); + LibsMsg.SAVE_DISG_HELP_4.send(sender); + LibsMsg.SAVE_DISG_HELP_5.send(sender); + LibsMsg.SAVE_DISG_HELP_6.send(sender); } } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index 2c416609..503dbe5c 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -431,7 +431,7 @@ public abstract class Disguise { removeDisguise(); if (getEntity() instanceof Player) { - DisguiseUtilities.sendMessage(getEntity(), LibsMsg.EXPIRED_DISGUISE); + LibsMsg.EXPIRED_DISGUISE.send(getEntity()); } return; diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 8a05840a..749f33c2 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -383,10 +383,10 @@ public class DisguiseUtilities { if (reference != null && DisguiseUtilities.addClonedDisguise(reference, disguise)) { String entityName = DisguiseType.getType(toClone).toReadable(); - DisguiseUtilities.sendMessage(player, LibsMsg.MADE_REF, entityName, reference); - DisguiseUtilities.sendMessage(player, LibsMsg.MADE_REF_EXAMPLE, reference); + LibsMsg.MADE_REF.send(player, entityName, reference); + LibsMsg.MADE_REF_EXAMPLE.send(player, reference); } else { - DisguiseUtilities.sendMessage(player, LibsMsg.REF_TOO_MANY); + LibsMsg.REF_TOO_MANY.send(player); } } @@ -2170,6 +2170,7 @@ public class DisguiseUtilities { } } + @Deprecated public static void sendMessage(CommandSender sender, LibsMsg msg, Object... args) { if (!NmsVersion.v1_16.isSupported()) { String message = msg.get(args); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java b/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java index fc4f746e..5755a0d5 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java @@ -125,7 +125,7 @@ public class DisguiseListener implements Listener { if (disguises.length > 0) { DisguiseAPI.undisguiseToAll(player); - DisguiseUtilities.sendMessage(player, LibsMsg.BLOWN_DISGUISE); + LibsMsg.BLOWN_DISGUISE.send(player); } } @@ -198,14 +198,14 @@ public class DisguiseListener implements Listener { if (disguises.length > 0) { event.setCancelled(true); - DisguiseUtilities.sendMessage(attacker, LibsMsg.CANT_ATTACK_DISGUISED); + LibsMsg.CANT_ATTACK_DISGUISED.send(attacker); } else if (DisguiseConfig.getPvPTimer() > 0 && attacker.hasMetadata("LastDisguise")) { long lastDisguised = attacker.getMetadata("LastDisguise").get(0).asLong(); if (lastDisguised + DisguiseConfig.getPvPTimer() * 1000 > System.currentTimeMillis()) { event.setCancelled(true); - DisguiseUtilities.sendMessage(attacker, LibsMsg.CANT_ATTACK_DISGUISED_RECENTLY); + LibsMsg.CANT_ATTACK_DISGUISED_RECENTLY.send(attacker); } } } @@ -551,7 +551,7 @@ public class DisguiseListener implements Listener { disguise.removeDisguise(); } - DisguiseUtilities.sendMessage(event.getPlayer(), LibsMsg.SWITCH_WORLD_DISGUISE_REMOVED); + LibsMsg.SWITCH_WORLD_DISGUISE_REMOVED.send(event.getPlayer()); } } @@ -646,7 +646,7 @@ public class DisguiseListener implements Listener { disguise.removeDisguise(); } - DisguiseUtilities.sendMessage(event.getPlayer(), LibsMsg.SWITCH_WORLD_DISGUISE_REMOVED); + LibsMsg.SWITCH_WORLD_DISGUISE_REMOVED.send(event.getPlayer()); } } else { // Stupid hack to fix worldswitch invisibility bug & paper packet bug diff --git a/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java b/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java index 5c9f0d4a..5e26e9de 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java @@ -4,6 +4,8 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities; import net.md_5.bungee.api.chat.BaseComponent; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; /** * Created by libraryaddict on 15/06/2017. @@ -371,6 +373,11 @@ public enum LibsMsg { return DisguiseUtilities.getColoredChat(string); } + public void send(CommandSender player, Object... strings) { + DisguiseUtilities.sendMessage(player, this, strings); + } + + @Deprecated public String get(Object... strings) { int matches = StringUtils.countMatches(getRaw(), "%s");