Clean up send message again to use LibsMsg.send

This commit is contained in:
libraryaddict 2020-07-04 00:44:22 +12:00
parent b5b9b432f7
commit 8a59d64702
41 changed files with 270 additions and 268 deletions

View File

@ -115,13 +115,13 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
if (command != null) { if (command != null) {
if (!command.hasPermission(sender)) { if (!command.hasPermission(sender)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
command.onCommand(sender, args); command.onCommand(sender, args);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_COMMAND_WRONG_ARG); LibsMsg.LIBS_COMMAND_WRONG_ARG.send(sender);
} }
} }

View File

@ -28,7 +28,7 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
} }
if (!(sender instanceof Entity)) { if (!(sender instanceof Entity)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
@ -81,9 +81,9 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
disguise.startDisguise(); disguise.startDisguise();
if (disguise.isDisguiseInUse()) { if (disguise.isDisguiseInUse()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISGUISED, disguise.getDisguiseName()); LibsMsg.DISGUISED.send(sender, disguise.getDisguiseName());
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.FAILED_DISGIUSE, disguise.getDisguiseName()); LibsMsg.FAILED_DISGIUSE.send(sender, disguise.getDisguiseName());
} }
return true; return true;
@ -118,22 +118,21 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) { if (allowedDisguises.isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return; return;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP1); LibsMsg.DISG_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, LibsMsg.CAN_USE_DISGS.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
if (allowedDisguises.contains("player")) { 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")) { if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP4); LibsMsg.DISG_HELP4.send(sender);
} }
} }
} }

View File

@ -28,12 +28,12 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
} }
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
if (!getPermissions(sender).hasPermissions()) { if (!getPermissions(sender).hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -65,7 +65,7 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
.addInteraction(sender.getName(), new DisguiseEntityInteraction(disguiseArgs), .addInteraction(sender.getName(), new DisguiseEntityInteraction(disguiseArgs),
DisguiseConfig.getDisguiseEntityExpire()); DisguiseConfig.getDisguiseEntityExpire());
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_CLICK, DisguiseConfig.getDisguiseEntityExpire(), LibsMsg.DISG_ENT_CLICK.send(sender, DisguiseConfig.getDisguiseEntityExpire(),
testDisguise.getDisguiseName()); testDisguise.getDisguiseName());
return true; return true;
} }
@ -93,22 +93,22 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) { if (allowedDisguises.isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return; return;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP1); LibsMsg.DISG_ENT_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, LibsMsg.CAN_USE_DISGS.send(sender,
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
if (allowedDisguises.contains("player")) { 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")) { if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP5); LibsMsg.DISG_ENT_HELP5.send(sender);
} }
} }
} }

View File

@ -34,7 +34,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
DisguisePermissions permissions = getPermissions(sender); DisguisePermissions permissions = getPermissions(sender);
if (!permissions.hasPermissions()) { if (!permissions.hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -44,7 +44,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
} }
if (args.length == 1) { if (args.length == 1) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DPLAYER_SUPPLY); LibsMsg.DPLAYER_SUPPLY.send(sender);
return true; return true;
} }
@ -61,7 +61,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
} }
if (entityTarget == null) { if (entityTarget == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]);
return true; return true;
} }
@ -92,7 +92,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
} }
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) { if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISABLED_LIVING_TO_MISC); LibsMsg.DISABLED_LIVING_TO_MISC.send(sender);
return true; return true;
} }
@ -123,11 +123,11 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
disguise.startDisguise(); disguise.startDisguise();
if (disguise.isDisguiseInUse()) { if (disguise.isDisguiseInUse()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_PLAYER_AS_DISG, LibsMsg.DISG_PLAYER_AS_DISG.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : entityTarget instanceof Player ? entityTarget.getName() :
DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName()); DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName());
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_PLAYER_AS_DISG_FAIL, LibsMsg.DISG_PLAYER_AS_DISG_FAIL.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : entityTarget instanceof Player ? entityTarget.getName() :
DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName()); DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName());
} }
@ -177,22 +177,22 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) { if (allowedDisguises.isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return; return;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP1); LibsMsg.D_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, LibsMsg.CAN_USE_DISGS.send(sender,
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
if (allowedDisguises.contains("player")) { 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")) { if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP5); LibsMsg.D_HELP5.send(sender);
} }
} }
} }

View File

@ -52,14 +52,14 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
} }
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
DisguisePermissions permissions = getPermissions(sender); DisguisePermissions permissions = getPermissions(sender);
if (!permissions.hasPermissions()) { if (!permissions.hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -78,7 +78,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
Collections.sort(classes); Collections.sort(classes);
DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_ENTITIES, LibsMsg.DRADIUS_ENTITIES.send(sender,
ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)); ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN));
return true; return true;
} }
@ -104,30 +104,34 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
} }
if (type == null) { if (type == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_UNRECOGNIZED, args[0]); LibsMsg.DMODRADIUS_UNRECOGNIZED.send(sender, args[0]);
return true; return true;
} }
} }
} }
if (args.length == starting + 1) { if (args.length == starting + 1) {
DisguiseUtilities.sendMessage(sender, if (starting == 0) {
starting == 0 ? LibsMsg.DRADIUS_NEEDOPTIONS : LibsMsg.DRADIUS_NEEDOPTIONS_ENTITY); LibsMsg.DRADIUS_NEEDOPTIONS.send(sender);
} else {
LibsMsg.DRADIUS_NEEDOPTIONS_ENTITY.send(sender);
}
return true; return true;
} else if (args.length < 2) { } else if (args.length < 2) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_NEEDOPTIONS); LibsMsg.DRADIUS_NEEDOPTIONS.send(sender);
return true; return true;
} }
if (!isInteger(args[starting])) { if (!isInteger(args[starting])) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_NUMBER, args[starting]); LibsMsg.NOT_NUMBER.send(sender, args[starting]);
return true; return true;
} }
int radius = Integer.parseInt(args[starting]); int radius = Integer.parseInt(args[starting]);
if (radius > maxRadius) { if (radius > maxRadius) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); LibsMsg.LIMITED_RADIUS.send(sender, maxRadius);
radius = maxRadius; radius = maxRadius;
} }
@ -206,13 +210,13 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
} }
if (disguisedEntitys > 0) { if (disguisedEntitys > 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISRADIUS, disguisedEntitys); LibsMsg.DISRADIUS.send(sender, disguisedEntitys);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.DISRADIUS_FAIL); LibsMsg.DISRADIUS_FAIL.send(sender);
} }
if (miscDisguises > 0) { if (miscDisguises > 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_MISCDISG, miscDisguises); LibsMsg.DRADIUS_MISCDISG.send(sender, miscDisguises);
} }
} }
catch (DisguiseParseException ex) { catch (DisguiseParseException ex) {
@ -282,24 +286,23 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) { if (allowedDisguises.isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return; return;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP1, maxRadius); LibsMsg.DRADIUS_HELP1.send(sender, maxRadius);
DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, LibsMsg.CAN_USE_DISGS.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
if (allowedDisguises.contains("player")) { 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")) { 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);
} }
} }

View File

@ -36,7 +36,7 @@ public class CopyDisguiseInteraction implements LibsEntityInteract {
DisguiseParser.parseToString(disguise), true); DisguiseParser.parseToString(disguise), true);
} }
} else { } else {
DisguiseUtilities.sendMessage(player, LibsMsg.TARGET_NOT_DISGUISED); LibsMsg.TARGET_NOT_DISGUISED.send(player);
} }
} }
} }

View File

@ -53,7 +53,7 @@ public class DisguiseEntityInteraction implements LibsEntityInteract {
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() && if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() &&
entity instanceof LivingEntity) { entity instanceof LivingEntity) {
DisguiseUtilities.sendMessage(p, LibsMsg.DISABLED_LIVING_TO_MISC); LibsMsg.DISABLED_LIVING_TO_MISC.send(p);
} else { } else {
if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() && if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() &&
!entity.hasPermission("libsdisguises.hidename")) { !entity.hasPermission("libsdisguises.hidename")) {
@ -77,37 +77,29 @@ public class DisguiseEntityInteraction implements LibsEntityInteract {
if (disguise.isDisguiseInUse()) { if (disguise.isDisguiseInUse()) {
if (disguise.isPlayerDisguise()) { if (disguise.isPlayerDisguise()) {
if (entity instanceof Player) { if (entity instanceof Player) {
DisguiseUtilities LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER.send(p, entityName, disguiseName);
.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER, entityName, disguiseName);
} else { } else {
DisguiseUtilities LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER.send(p, entityName, disguiseName);
.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER, entityName, disguiseName);
} }
} else { } else {
if (entity instanceof Player) { if (entity instanceof Player) {
DisguiseUtilities LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY.send(p, entityName, disguiseName);
.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY, entityName, disguiseName);
} else { } else {
DisguiseUtilities LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY.send(p, entityName, disguiseName);
.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY, entityName, disguiseName);
} }
} }
} else { } else {
if (disguise.isPlayerDisguise()) { if (disguise.isPlayerDisguise()) {
if (entity instanceof Player) { if (entity instanceof Player) {
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER_FAIL, entityName, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER_FAIL.send(p, entityName, disguiseName);
disguiseName);
} else { } else {
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER_FAIL, entityName, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER_FAIL.send(p, entityName, disguiseName);
disguiseName);
} }
} else { } else {
if (entity instanceof Player) { if (entity instanceof Player) {
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY_FAIL, entityName, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY_FAIL.send(p, entityName, disguiseName);
disguiseName);
} else { } else {
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL, entityName, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL.send(p, entityName, disguiseName);
disguiseName);
} }
} }
} }

View File

@ -38,7 +38,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract {
Disguise disguise = DisguiseAPI.getDisguise(p, entity); Disguise disguise = DisguiseAPI.getDisguise(p, entity);
if (disguise == null) { if (disguise == null) {
DisguiseUtilities.sendMessage(p, LibsMsg.UNDISG_PLAYER_FAIL, entityName); LibsMsg.UNDISG_PLAYER_FAIL.send(p, entityName);
return; return;
} }
@ -48,7 +48,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract {
DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); DisguisePerm disguisePerm = new DisguisePerm(disguise.getType());
if (!perms.isAllowedDisguise(disguisePerm, Arrays.asList(options))) { if (!perms.isAllowedDisguise(disguisePerm, Arrays.asList(options))) {
DisguiseUtilities.sendMessage(p, LibsMsg.DMODPLAYER_NOPERM); LibsMsg.DMODPLAYER_NOPERM.send(p);
return; return;
} }
@ -56,7 +56,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract {
DisguiseParser DisguiseParser
.callMethods(p, disguise, perms, disguisePerm, new ArrayList<>(Arrays.asList(options)), options, .callMethods(p, disguise, perms, disguisePerm, new ArrayList<>(Arrays.asList(options)), options,
"DisguiseModifyEntity"); "DisguiseModifyEntity");
DisguiseUtilities.sendMessage(p, LibsMsg.LISTENER_MODIFIED_DISG); LibsMsg.LISTENER_MODIFIED_DISG.send(p);
} }
catch (DisguiseParseException ex) { catch (DisguiseParseException ex) {
if (ex.getMessage() != null) { if (ex.getMessage() != null) {

View File

@ -26,14 +26,14 @@ public class UndisguiseEntityInteraction implements LibsEntityInteract {
DisguiseAPI.undisguiseToAll(entity); DisguiseAPI.undisguiseToAll(entity);
if (entity instanceof Player) if (entity instanceof Player)
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER, entityName); LibsMsg.LISTEN_UNDISG_PLAYER.send(p, entityName);
else else
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT, entityName); LibsMsg.LISTEN_UNDISG_ENT.send(p, entityName);
} else { } else {
if (entity instanceof Player) if (entity instanceof Player)
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER_FAIL, entityName); LibsMsg.LISTEN_UNDISG_PLAYER_FAIL.send(p, entityName);
else else
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT_FAIL, entityName); LibsMsg.LISTEN_UNDISG_ENT_FAIL.send(p, entityName);
} }
} }
} }

View File

@ -34,12 +34,12 @@ public class LDChangelog implements LDCommand {
UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker(); UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker();
if (checker.isDownloading()) { if (checker.isDownloading()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_IN_PROGRESS); LibsMsg.UPDATE_IN_PROGRESS.send(sender);
return; return;
} }
if (checker.getUpdate() == null) { if (checker.getUpdate() == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_REQUIRED); LibsMsg.UPDATE_REQUIRED.send(sender);
return; return;
} }

View File

@ -35,7 +35,7 @@ public class LDConfig implements LDCommand {
ArrayList<String> returns = DisguiseConfig.doOutput(LibsDisguises.getInstance().getConfig(), true, true); ArrayList<String> returns = DisguiseConfig.doOutput(LibsDisguises.getInstance().getConfig(), true, true);
if (returns.isEmpty()) { if (returns.isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.USING_DEFAULT_CONFIG); LibsMsg.USING_DEFAULT_CONFIG.send(sender);
return; return;
} }

View File

@ -35,9 +35,9 @@ public class LDCount implements LDCommand {
} }
if (counts.isEmpty()) { if (counts.isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_DISGUISES_IN_USE); LibsMsg.NO_DISGUISES_IN_USE.send(sender);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.ACTIVE_DISGUISES_COUNT, LibsMsg.ACTIVE_DISGUISES_COUNT.send(sender,
counts.values().stream().reduce(Integer::sum).get()); counts.values().stream().reduce(Integer::sum).get());
ArrayList<DisguiseType> types = new ArrayList<>(counts.keySet()); ArrayList<DisguiseType> 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());
} }
} }

View File

@ -29,7 +29,7 @@ public class LDDebugPlayer implements LDCommand {
Disguise disguise = DisguiseAPI.getDisguise(player, entity); Disguise disguise = DisguiseAPI.getDisguise(player, entity);
if (disguise == null) { if (disguise == null) {
DisguiseUtilities.sendMessage(player, LibsMsg.TARGET_NOT_DISGUISED); LibsMsg.TARGET_NOT_DISGUISED.send(player);
return; return;
} }
@ -100,7 +100,7 @@ public class LDDebugPlayer implements LDCommand {
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
} }
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new DebugInteraction(), 60); LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new DebugInteraction(), 60);

View File

@ -40,7 +40,7 @@ public class LDHelp implements LDCommand {
continue; continue;
} }
DisguiseUtilities.sendMessage(sender, cmd.getHelp()); cmd.getHelp().send(sender);
} }
} }

View File

@ -35,7 +35,7 @@ public class LDJson implements LDCommand {
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return; return;
} }
@ -88,7 +88,7 @@ public class LDJson implements LDCommand {
private void sendMessage(CommandSender sender, LibsMsg prefix, LibsMsg oldVer, String string) { private void sendMessage(CommandSender sender, LibsMsg prefix, LibsMsg oldVer, String string) {
if (!NmsVersion.v1_13.isSupported()) { if (!NmsVersion.v1_13.isSupported()) {
DisguiseUtilities.sendMessage(sender, oldVer, string); oldVer.send(sender, string);
return; return;
} }

View File

@ -35,7 +35,7 @@ public class LDMetaInfo implements LDCommand {
MetaIndex index = MetaIndex.getMetaIndexByName(args[1]); MetaIndex index = MetaIndex.getMetaIndexByName(args[1]);
if (index == null) { if (index == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.META_NOT_FOUND); LibsMsg.META_NOT_FOUND.send(sender);
return; return;
} }
@ -69,7 +69,7 @@ public class LDMetaInfo implements LDCommand {
sender.spigot().sendMessage(builder.create()); sender.spigot().sendMessage(builder.create());
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.META_VALUES_NO_CLICK, LibsMsg.META_VALUES_NO_CLICK.send(sender,
StringUtils.join(names, LibsMsg.META_VALUE_SEPERATOR.get())); StringUtils.join(names, LibsMsg.META_VALUE_SEPERATOR.get()));
} }
} }

View File

@ -28,7 +28,7 @@ public class LDMods implements LDCommand {
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (ModdedManager.getEntities().isEmpty()) { if (ModdedManager.getEntities().isEmpty()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_MODS_LISTENING); LibsMsg.NO_MODS_LISTENING.send(sender);
return; return;
} }
@ -38,22 +38,22 @@ public class LDMods implements LDCommand {
player = Bukkit.getPlayer(args[1]); player = Bukkit.getPlayer(args[1]);
if (player == null) { if (player == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[1]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[1]);
return; return;
} }
} else if (sender instanceof Player) { } else if (sender instanceof Player) {
player = (Player) sender; player = (Player) sender;
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return; return;
} }
if (!player.hasMetadata("forge_mods")) { if (!player.hasMetadata("forge_mods")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_MODS, player.getName()); LibsMsg.NO_MODS.send(sender, player.getName());
return; return;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.MODS_LIST, player.getName(), LibsMsg.MODS_LIST.send(sender, player.getName(),
StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", ")); StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "));
} }

View File

@ -32,7 +32,7 @@ public class LDPermTest implements LDCommand {
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (!LibsPremium.isPremium()) { if (!LibsPremium.isPremium()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_NON_PREM); LibsMsg.LIBS_PERM_CHECK_NON_PREM.send(sender);
} }
Permissible player; Permissible player;
@ -41,7 +41,7 @@ public class LDPermTest implements LDCommand {
player = Bukkit.getPlayer(args[1]); player = Bukkit.getPlayer(args[1]);
if (player == null) { if (player == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[1]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[1]);
return; return;
} }
} else { } else {
@ -49,40 +49,40 @@ public class LDPermTest implements LDCommand {
} }
DisguisePermissions permissions = new DisguisePermissions(player, "disguise"); DisguisePermissions permissions = new DisguisePermissions(player, "disguise");
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_INFO_1); LibsMsg.LIBS_PERM_CHECK_INFO_1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_INFO_2); LibsMsg.LIBS_PERM_CHECK_INFO_2.send(sender);
if (player.hasPermission("libsdisguises.disguise.pig")) { 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))) { if (permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.PIG))) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_SUCCESS); LibsMsg.LIBS_PERM_CHECK_SUCCESS.send(sender);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_FAIL); LibsMsg.LIBS_PERM_CHECK_FAIL.send(sender);
} }
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.NORMAL_PERM_CHECK_FAIL); LibsMsg.NORMAL_PERM_CHECK_FAIL.send(sender);
} }
if (player.hasPermission("libsdisguises.disguise.zombie") || if (player.hasPermission("libsdisguises.disguise.zombie") ||
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.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"); PluginCommand command = LibsDisguises.getInstance().getCommand("disguise");
if (command == null) { 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())) { } 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 { } 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")) { 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 { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_SUCCESS, "libsdisguises.seecmd.disguise"); LibsMsg.LIBS_PERM_COMMAND_SUCCESS.send(sender, "libsdisguises.seecmd.disguise");
} }
} }

View File

@ -27,7 +27,7 @@ public class LDReload implements LDCommand {
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
DisguiseConfig.loadConfig(); DisguiseConfig.loadConfig();
new SoundManager().load(); new SoundManager().load();
DisguiseUtilities.sendMessage(sender, LibsMsg.RELOADED_CONFIG); LibsMsg.RELOADED_CONFIG.send(sender);
} }
@Override @Override

View File

@ -109,18 +109,18 @@ public class LDScoreboard implements LDCommand {
} }
if (issuesFound == 0) { if (issuesFound == 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_ISSUES); LibsMsg.LIBS_SCOREBOARD_NO_ISSUES.send(sender);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_ISSUES, issuesFound); LibsMsg.LIBS_SCOREBOARD_ISSUES.send(sender, issuesFound);
} }
} else { } 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) { if (DisguiseConfig.getPushingOption() == DisguiseConfig.DisguisePushing.IGNORE_SCOREBOARD) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_DISABLED); LibsMsg.LIBS_SCOREBOARD_DISABLED.send(sender);
} }
Player player; Player player;
@ -129,23 +129,23 @@ public class LDScoreboard implements LDCommand {
player = Bukkit.getPlayer(args[1]); player = Bukkit.getPlayer(args[1]);
if (player == null) { if (player == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[1]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[1]);
return; return;
} }
if (!DisguiseAPI.isDisguised(player)) { if (!DisguiseAPI.isDisguised(player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NODISGUISE, player.getName()); LibsMsg.DMODPLAYER_NODISGUISE.send(sender, player.getName());
return; return;
} }
} else if (sender instanceof Player) { } else if (sender instanceof Player) {
player = (Player) sender; player = (Player) sender;
if (!DisguiseAPI.isDisguised(player)) { if (!DisguiseAPI.isDisguised(player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); LibsMsg.NOT_DISGUISED.send(sender);
return; return;
} }
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return; return;
} }
@ -154,17 +154,17 @@ public class LDScoreboard implements LDCommand {
Team team = board.getEntryTeam(sender.getName()); Team team = board.getEntryTeam(sender.getName());
if (team == null) { if (team == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_TEAM); LibsMsg.LIBS_SCOREBOARD_NO_TEAM.send(sender);
return; return;
} }
if (team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.NEVER && if (team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.NEVER &&
team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.FOR_OTHER_TEAMS) { 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; return;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_SUCCESS, team.getName()); LibsMsg.LIBS_SCOREBOARD_SUCCESS.send(sender, team.getName());
} }
@Override @Override

View File

@ -35,7 +35,7 @@ public class LDUpdate implements LDCommand {
UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker(); UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker();
if (checker.isDownloading()) { if (checker.isDownloading()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_IN_PROGRESS); LibsMsg.UPDATE_IN_PROGRESS.send(sender);
return; return;
} }
@ -49,7 +49,7 @@ public class LDUpdate implements LDCommand {
} else if (args[1].equalsIgnoreCase("release")) { } else if (args[1].equalsIgnoreCase("release")) {
releaseBuilds = true; releaseBuilds = true;
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_UPDATE_UNKNOWN_BRANCH); LibsMsg.LIBS_UPDATE_UNKNOWN_BRANCH.send(sender);
return; return;
} }
@ -59,12 +59,12 @@ public class LDUpdate implements LDCommand {
if (checker.getUpdate() != null && checker.getUpdate().isReleaseBuild() == releaseBuilds && args.length <= 1 && if (checker.getUpdate() != null && checker.getUpdate().isReleaseBuild() == releaseBuilds && args.length <= 1 &&
!forceCheck) { !forceCheck) {
if (checker.isServerLatestVersion()) { if (checker.isServerLatestVersion()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ON_LATEST); LibsMsg.UPDATE_ON_LATEST.send(sender);
return; return;
} }
if (checker.isOnLatestUpdate(true)) { if (checker.isOnLatestUpdate(true)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ALREADY_DOWNLOADED); LibsMsg.UPDATE_ALREADY_DOWNLOADED.send(sender);
return; return;
} }
} }
@ -79,15 +79,15 @@ public class LDUpdate implements LDCommand {
} }
if (checker.getUpdate() == null) { if (checker.getUpdate() == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_FAILED); LibsMsg.UPDATE_FAILED.send(sender);
return; return;
} }
if (checker.isOnLatestUpdate(true)) { if (checker.isOnLatestUpdate(true)) {
if (checker.getLastDownload() != null) { if (checker.getLastDownload() != null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ALREADY_DOWNLOADED); LibsMsg.UPDATE_ALREADY_DOWNLOADED.send(sender);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ON_LATEST); LibsMsg.UPDATE_ON_LATEST.send(sender);
} }
return; return;
@ -95,7 +95,7 @@ public class LDUpdate implements LDCommand {
if (!forceUpdate) { if (!forceUpdate) {
if (updateResult != null) { if (updateResult != null) {
DisguiseUtilities.sendMessage(sender, updateResult); updateResult.send(sender);
} else { } else {
for (String msg : checker.getUpdateMessage()) { for (String msg : checker.getUpdateMessage()) {
DisguiseUtilities.sendMessage(sender, msg); DisguiseUtilities.sendMessage(sender, msg);
@ -108,7 +108,7 @@ public class LDUpdate implements LDCommand {
PluginInformation result = checker.doUpdate(); PluginInformation result = checker.doUpdate();
if (result == null) { if (result == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_FAILED); LibsMsg.UPDATE_FAILED.send(sender);
return; return;
} }

View File

@ -23,14 +23,14 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Entity)) { if (!(sender instanceof Entity)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
DisguisePermissions permissions = getPermissions(sender); DisguisePermissions permissions = getPermissions(sender);
if (!permissions.hasPermissions()) { if (!permissions.hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -42,14 +42,14 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender); Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender);
if (disguise == null) { if (disguise == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); LibsMsg.NOT_DISGUISED.send(sender);
return true; return true;
} }
DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); DisguisePerm disguisePerm = new DisguisePerm(disguise.getType());
if (!permissions.isAllowedDisguise(disguisePerm)) { if (!permissions.isAllowedDisguise(disguisePerm)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_NO_PERM); LibsMsg.DMODIFY_NO_PERM.send(sender);
return true; return true;
} }
@ -73,7 +73,7 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
return true; return true;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_MODIFIED); LibsMsg.DMODIFY_MODIFIED.send(sender);
return true; return true;
} }
@ -106,9 +106,9 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3); LibsMsg.DMODIFY_HELP3.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3); LibsMsg.DMODIFY_HELP3.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, LibsMsg.DMODIFY_HELP3.send(sender,
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
} }
} }

View File

@ -22,14 +22,14 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
DisguisePermissions permissions = getPermissions(sender); DisguisePermissions permissions = getPermissions(sender);
if (!permissions.hasPermissions()) { if (!permissions.hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -44,7 +44,7 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
new DisguiseModifyInteraction(DisguiseUtilities.split(StringUtils.join(args, " "))), new DisguiseModifyInteraction(DisguiseUtilities.split(StringUtils.join(args, " "))),
DisguiseConfig.getDisguiseEntityExpire()); DisguiseConfig.getDisguiseEntityExpire());
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFYENT_CLICK, DisguiseConfig.getDisguiseEntityExpire()); LibsMsg.DMODIFYENT_CLICK.send(sender, DisguiseConfig.getDisguiseEntityExpire());
return true; return true;
} }
@ -78,8 +78,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODENT_HELP1); LibsMsg.DMODENT_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, LibsMsg.DMODIFY_HELP3.send(sender,
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
} }
} }

View File

@ -28,7 +28,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
DisguisePermissions permissions = getPermissions(sender); DisguisePermissions permissions = getPermissions(sender);
if (!permissions.hasPermissions()) { if (!permissions.hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -50,7 +50,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
} }
if (entityTarget == null) { if (entityTarget == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]);
return true; return true;
} }
@ -71,14 +71,14 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
disguise = DisguiseAPI.getDisguise(entityTarget); disguise = DisguiseAPI.getDisguise(entityTarget);
if (disguise == null) { if (disguise == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NODISGUISE, entityTarget.getName()); LibsMsg.DMODPLAYER_NODISGUISE.send(sender, entityTarget.getName());
return true; return true;
} }
DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); DisguisePerm disguisePerm = new DisguisePerm(disguise.getType());
if (!permissions.isAllowedDisguise(disguisePerm)) { if (!permissions.isAllowedDisguise(disguisePerm)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NOPERM); LibsMsg.DMODPLAYER_NOPERM.send(sender);
return true; return true;
} }
@ -102,7 +102,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
return true; return true;
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_MODIFIED, entityTarget.getName()); LibsMsg.DMODPLAYER_MODIFIED.send(sender, entityTarget.getName());
return true; return true;
} }
@ -161,8 +161,8 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_HELP1); LibsMsg.DMODPLAYER_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, LibsMsg.DMODIFY_HELP3.send(sender,
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
} }
} }

View File

@ -47,14 +47,14 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
DisguisePermissions permissions = getPermissions(sender); DisguisePermissions permissions = getPermissions(sender);
if (!permissions.hasPermissions()) { if (!permissions.hasPermissions()) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -77,7 +77,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
Collections.sort(classes); Collections.sort(classes);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_USABLE, LibsMsg.DMODRADIUS_USABLE.send(sender,
ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN)); ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN));
return true; return true;
} }
@ -99,29 +99,33 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
} }
if (baseType == null) { if (baseType == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_UNRECOGNIZED, args[0]); LibsMsg.DMODRADIUS_UNRECOGNIZED.send(sender, args[0]);
return true; return true;
} }
} }
if (args.length == starting + 1) { if (args.length == starting + 1) {
DisguiseUtilities.sendMessage(sender, if (starting == 0) {
starting == 0 ? LibsMsg.DMODRADIUS_NEEDOPTIONS : LibsMsg.DMODRADIUS_NEEDOPTIONS_ENTITY); LibsMsg.DMODRADIUS_NEEDOPTIONS.send(sender);
} else {
LibsMsg.DMODRADIUS_NEEDOPTIONS_ENTITY.send(sender);
}
return true; return true;
} else if (args.length < 2) { } else if (args.length < 2) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NEEDOPTIONS); LibsMsg.DMODRADIUS_NEEDOPTIONS.send(sender);
return true; return true;
} }
if (!isInteger(args[starting])) { if (!isInteger(args[starting])) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_NUMBER, args[starting]); LibsMsg.NOT_NUMBER.send(sender, args[starting]);
return true; return true;
} }
int radius = Integer.parseInt(args[starting]); int radius = Integer.parseInt(args[starting]);
if (radius > maxRadius) { if (radius > maxRadius) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); LibsMsg.LIMITED_RADIUS.send(sender, maxRadius);
radius = maxRadius; radius = maxRadius;
} }
@ -188,13 +192,13 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
} }
if (noPermission > 0) { if (noPermission > 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NOPERM, noPermission); LibsMsg.DMODRADIUS_NOPERM.send(sender, noPermission);
} }
if (modifiedDisguises > 0) { if (modifiedDisguises > 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS, modifiedDisguises); LibsMsg.DMODRADIUS.send(sender, modifiedDisguises);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NOENTS); LibsMsg.DMODRADIUS_NOENTS.send(sender);
} }
return true; return true;
@ -245,7 +249,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
int radius = Integer.parseInt(args[starting]); int radius = Integer.parseInt(args[starting]);
if (radius > maxRadius) { if (radius > maxRadius) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); LibsMsg.LIMITED_RADIUS.send(sender, maxRadius);
radius = maxRadius; radius = maxRadius;
} }
@ -287,11 +291,10 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP1, maxRadius); LibsMsg.DMODRADIUS_HELP1.send(sender, maxRadius);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP2); LibsMsg.DMODRADIUS_HELP2.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP3); LibsMsg.DMODRADIUS_HELP3.send(sender);
} }
} }

View File

@ -22,19 +22,19 @@ public class UndisguiseCommand implements CommandExecutor {
} }
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
if (sender.hasPermission("libsdisguises.undisguise") && !"%%__USER__%%".equals(12345 + "")) { if (sender.hasPermission("libsdisguises.undisguise") && !"%%__USER__%%".equals(12345 + "")) {
if (DisguiseAPI.isDisguised((Entity) sender)) { if (DisguiseAPI.isDisguised((Entity) sender)) {
DisguiseAPI.undisguiseToAll((Player) sender); DisguiseAPI.undisguiseToAll((Player) sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG); LibsMsg.UNDISG.send(sender);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); LibsMsg.NOT_DISGUISED.send(sender);
} }
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
} }
return true; return true;

View File

@ -22,18 +22,18 @@ public class UndisguiseEntityCommand implements CommandExecutor {
} }
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
if (!sender.hasPermission("libsdisguises.undisguiseentity")) { if (!sender.hasPermission("libsdisguises.undisguiseentity")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(), LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(),
DisguiseConfig.getDisguiseEntityExpire()); DisguiseConfig.getDisguiseEntityExpire());
DisguiseUtilities.sendMessage(sender, LibsMsg.UND_ENTITY); LibsMsg.UND_ENTITY.send(sender);
return true; return true;
} }

View File

@ -63,12 +63,12 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
} }
if (!sender.hasPermission("libsdisguises.undisguiseplayer")) { if (!sender.hasPermission("libsdisguises.undisguiseplayer")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
if (args.length == 0) { if (args.length == 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER_HELP); LibsMsg.UNDISG_PLAYER_HELP.send(sender);
return true; return true;
} }
@ -85,17 +85,17 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
} }
if (entityTarget == null) { if (entityTarget == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]);
return true; return true;
} }
if (DisguiseAPI.isDisguised(entityTarget)) { if (DisguiseAPI.isDisguised(entityTarget)) {
DisguiseAPI.undisguiseToAll(entityTarget); DisguiseAPI.undisguiseToAll(entityTarget);
DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER, LibsMsg.UNDISG_PLAYER.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : entityTarget instanceof Player ? entityTarget.getName() :
DisguiseType.getType(entityTarget).toReadable()); DisguiseType.getType(entityTarget).toReadable());
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER_FAIL, LibsMsg.UNDISG_PLAYER_FAIL.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : entityTarget instanceof Player ? entityTarget.getName() :
DisguiseType.getType(entityTarget).toReadable()); DisguiseType.getType(entityTarget).toReadable());
} }

View File

@ -37,7 +37,7 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
} }
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
@ -45,12 +45,12 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
int radius = maxRadius; int radius = maxRadius;
if (args.length > 0) { if (args.length > 0) {
if (!isNumeric(args[0])) { if (!isNumeric(args[0])) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_NUMBER, args[0]); LibsMsg.NOT_NUMBER.send(sender, args[0]);
return true; return true;
} }
radius = Integer.parseInt(args[0]); radius = Integer.parseInt(args[0]);
if (radius > maxRadius) { if (radius > maxRadius) {
DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); LibsMsg.LIMITED_RADIUS.send(sender, maxRadius);
radius = maxRadius; radius = maxRadius;
} }
} }
@ -66,9 +66,9 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
} }
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISRADIUS, disguisedEntitys); LibsMsg.UNDISRADIUS.send(sender, disguisedEntitys);
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
} }
return true; return true;
} }

View File

@ -38,7 +38,7 @@ public class CopyDisguiseCommand implements CommandExecutor {
} }
if (!sender.hasPermission("libsdisguises.copydisguise")) { if (!sender.hasPermission("libsdisguises.copydisguise")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -58,7 +58,7 @@ public class CopyDisguiseCommand implements CommandExecutor {
} }
if (target == null) { if (target == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CANNOT_FIND_PLAYER, args[0]); LibsMsg.CANNOT_FIND_PLAYER.send(sender, args[0]);
return true; return true;
} }
} }
@ -70,8 +70,7 @@ public class CopyDisguiseCommand implements CommandExecutor {
.addInteraction(sender.getName(), new CopyDisguiseInteraction(this), .addInteraction(sender.getName(), new CopyDisguiseInteraction(this),
DisguiseConfig.getDisguiseEntityExpire()); DisguiseConfig.getDisguiseEntityExpire());
DisguiseUtilities LibsMsg.DISGUISECOPY_INTERACT.send(sender, DisguiseConfig.getDisguiseEntityExpire());
.sendMessage(sender, LibsMsg.DISGUISECOPY_INTERACT, DisguiseConfig.getDisguiseEntityExpire());
return true; return true;
} }
@ -91,7 +90,7 @@ public class CopyDisguiseCommand implements CommandExecutor {
public void sendMessage(CommandSender sender, LibsMsg msg, LibsMsg oldVer, String string, boolean forceAbbrev) { public void sendMessage(CommandSender sender, LibsMsg msg, LibsMsg oldVer, String string, boolean forceAbbrev) {
if (!NmsVersion.v1_13.isSupported()) { if (!NmsVersion.v1_13.isSupported()) {
DisguiseUtilities.sendMessage(sender, oldVer, string); oldVer.send(sender, string);
return; return;
} }

View File

@ -22,13 +22,13 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
if (!sender.hasPermission("libsdisguises.disguise.disguiseclone")) { if (!sender.hasPermission("libsdisguises.disguise.disguiseclone")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -53,7 +53,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
} else if (option.equalsIgnoreCase(LibsMsg.DCLONE_SPRINT.get())) { } else if (option.equalsIgnoreCase(LibsMsg.DCLONE_SPRINT.get())) {
doSprint = true; doSprint = true;
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.INVALID_CLONE, option); LibsMsg.INVALID_CLONE.send(sender, option);
return true; return true;
} }
} }
@ -67,7 +67,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
.addInteraction(sender.getName(), new DisguiseCloneInteraction(options), .addInteraction(sender.getName(), new DisguiseCloneInteraction(options),
DisguiseConfig.getDisguiseCloneExpire()); DisguiseConfig.getDisguiseCloneExpire());
DisguiseUtilities.sendMessage(sender, LibsMsg.CLICK_TIMER, DisguiseConfig.getDisguiseCloneExpire()); LibsMsg.CLICK_TIMER.send(sender, DisguiseConfig.getDisguiseCloneExpire());
} }
return true; return true;
@ -103,8 +103,8 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
*/ */
@Override @Override
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP1); LibsMsg.CLONE_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP2); LibsMsg.CLONE_HELP2.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP3); LibsMsg.CLONE_HELP3.send(sender);
} }
} }

View File

@ -48,16 +48,14 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
if (help != null) { if (help != null) {
if (help.hasValues() && help.canTranslateValues()) { 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())); StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get()));
} else { } else {
if (!help.getName().equals(help.getDescriptiveName())) { if (!help.getName().equals(help.getDescriptiveName())) {
DisguiseUtilities LibsMsg.DHELP_HELP6
.sendMessage(sender, LibsMsg.DHELP_HELP6, help.getName(), help.getDescriptiveName(), .send(sender, help.getName(), help.getDescriptiveName(), help.getDescription());
help.getDescription());
} else { } else {
DisguiseUtilities LibsMsg.DHELP_HELP5.send(sender, help.getName(), help.getDescription());
.sendMessage(sender, LibsMsg.DHELP_HELP5, help.getName(), help.getDescription());
} }
} }
@ -67,12 +65,12 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
DisguisePerm type = DisguiseParser.getDisguisePerm(args[0]); DisguisePerm type = DisguiseParser.getDisguisePerm(args[0]);
if (type == null) { if (type == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_CANTFIND, args[0]); LibsMsg.DHELP_CANTFIND.send(sender, args[0]);
return true; return true;
} }
if (!perms.isAllowedDisguise(type)) { if (!perms.isAllowedDisguise(type)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM_DISGUISE); LibsMsg.NO_PERM_DISGUISE.send(sender);
return true; return true;
} }
@ -114,18 +112,18 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
methods.add(LibsMsg.DHELP_NO_OPTIONS.get()); 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 + ", ")); StringUtils.join(methods, ChatColor.DARK_RED + ", "));
if (ignored > 0) { if (ignored > 0) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERMS_USE_OPTIONS, ignored); LibsMsg.NO_PERMS_USE_OPTIONS.send(sender, ignored);
} }
return true; return true;
} }
} }
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -161,11 +159,11 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
*/ */
@Override @Override
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP1); LibsMsg.DHELP_HELP1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP2); LibsMsg.DHELP_HELP2.send(sender);
for (ParamInfo s : ParamInfoManager.getParamInfos()) { 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.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""),
s.getDescription()); s.getDescription());
} }

View File

@ -15,7 +15,7 @@ public class DisguiseViewBarCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
@ -23,10 +23,10 @@ public class DisguiseViewBarCommand implements CommandExecutor {
if (DisguiseAPI.isActionBarShown(player)) { if (DisguiseAPI.isActionBarShown(player)) {
DisguiseAPI.setActionBarShown(player, false); DisguiseAPI.setActionBarShown(player, false);
DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_BAR_OFF); LibsMsg.VIEW_BAR_OFF.send(sender);
} else { } else {
DisguiseAPI.setActionBarShown(player, true); DisguiseAPI.setActionBarShown(player, true);
DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_BAR_ON); LibsMsg.VIEW_BAR_ON.send(sender);
} }
return true; return true;

View File

@ -16,7 +16,7 @@ public class DisguiseViewSelfCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) { if (sender.getName().equals("CONSOLE")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
@ -24,10 +24,10 @@ public class DisguiseViewSelfCommand implements CommandExecutor {
if (DisguiseAPI.isViewSelfToggled(player)) { if (DisguiseAPI.isViewSelfToggled(player)) {
DisguiseAPI.setViewDisguiseToggled(player, false); DisguiseAPI.setViewDisguiseToggled(player, false);
DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_SELF_OFF); LibsMsg.VIEW_SELF_OFF.send(sender);
} else { } else {
DisguiseAPI.setViewDisguiseToggled(player, true); DisguiseAPI.setViewDisguiseToggled(player, true);
DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_SELF_ON); LibsMsg.VIEW_SELF_ON.send(sender);
} }
return true; return true;

View File

@ -33,12 +33,12 @@ public class GrabHeadCommand implements CommandExecutor {
} }
if (!sender.hasPermission("libsdisguises.grabhead")) { if (!sender.hasPermission("libsdisguises.grabhead")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
@ -61,20 +61,20 @@ public class GrabHeadCommand implements CommandExecutor {
private BukkitTask runnable = new BukkitRunnable() { private BukkitTask runnable = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); LibsMsg.PLEASE_WAIT.send(sender);
} }
}.runTaskTimer(LibsDisguises.getInstance(), 100, 100); }.runTaskTimer(LibsDisguises.getInstance(), 100, 100);
@Override @Override
public void onError(LibsMsg msg, Object... args) { public void onError(LibsMsg msg, Object... args) {
DisguiseUtilities.sendMessage(sender, msg, args); msg.send(sender, args);
runnable.cancel(); runnable.cancel();
} }
@Override @Override
public void onInfo(LibsMsg msg, Object... args) { public void onInfo(LibsMsg msg, Object... args) {
DisguiseUtilities.sendMessage(sender, msg, args); msg.send(sender, args);
} }
@Override @Override
@ -101,7 +101,7 @@ public class GrabHeadCommand implements CommandExecutor {
skull.setItemMeta(meta); skull.setItemMeta(meta);
((Player) sender).getInventory().addItem(skull); ((Player) sender).getInventory().addItem(skull);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_HEAD_SUCCESS); LibsMsg.GRAB_HEAD_SUCCESS.send(sender);
} }
}.runTask(LibsDisguises.getInstance()); }.runTask(LibsDisguises.getInstance());
} }
@ -113,11 +113,11 @@ public class GrabHeadCommand implements CommandExecutor {
} }
private void sendHelp(CommandSender sender) { private void sendHelp(CommandSender sender) {
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_1); LibsMsg.GRAB_DISG_HELP_1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_2); LibsMsg.GRAB_DISG_HELP_2.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_3); LibsMsg.GRAB_DISG_HELP_3.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_4); LibsMsg.GRAB_DISG_HELP_4.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_5); LibsMsg.GRAB_DISG_HELP_5.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_6); LibsMsg.GRAB_DISG_HELP_6.send(sender);
} }
} }

View File

@ -35,7 +35,7 @@ public class GrabSkinCommand implements CommandExecutor {
} }
if (!sender.hasPermission("libsdisguises.grabskin")) { if (!sender.hasPermission("libsdisguises.grabskin")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -69,20 +69,20 @@ public class GrabSkinCommand implements CommandExecutor {
private BukkitTask runnable = new BukkitRunnable() { private BukkitTask runnable = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); LibsMsg.PLEASE_WAIT.send(sender);
} }
}.runTaskTimer(LibsDisguises.getInstance(), 100, 100); }.runTaskTimer(LibsDisguises.getInstance(), 100, 100);
@Override @Override
public void onError(LibsMsg msg, Object... args) { public void onError(LibsMsg msg, Object... args) {
DisguiseUtilities.sendMessage(sender, msg, args); msg.send(sender, args);
runnable.cancel(); runnable.cancel();
} }
@Override @Override
public void onInfo(LibsMsg msg, Object... args) { public void onInfo(LibsMsg msg, Object... args) {
DisguiseUtilities.sendMessage(sender, msg, args); msg.send(sender, args);
} }
@Override @Override
@ -107,7 +107,7 @@ public class GrabSkinCommand implements CommandExecutor {
} }
DisguiseAPI.addGameProfile(nName, profile); DisguiseAPI.addGameProfile(nName, profile);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRABBED_SKIN, nName); LibsMsg.GRABBED_SKIN.send(sender, nName);
String string = DisguiseUtilities.getGson().toJson(profile); String string = DisguiseUtilities.getGson().toJson(profile);
int start = 0; int start = 0;
@ -140,7 +140,7 @@ public class GrabSkinCommand implements CommandExecutor {
sender.spigot().sendMessage(builder.create()); sender.spigot().sendMessage(builder.create());
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.SKIN_DATA, string); LibsMsg.SKIN_DATA.send(sender, string);
} }
DisguiseUtilities.setGrabSkinCommandUsed(); DisguiseUtilities.setGrabSkinCommandUsed();
@ -153,11 +153,11 @@ public class GrabSkinCommand implements CommandExecutor {
} }
private void sendHelp(CommandSender sender) { private void sendHelp(CommandSender sender) {
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_1); LibsMsg.GRAB_DISG_HELP_1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_2); LibsMsg.GRAB_DISG_HELP_2.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_3); LibsMsg.GRAB_DISG_HELP_3.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_4); LibsMsg.GRAB_DISG_HELP_4.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_5); LibsMsg.GRAB_DISG_HELP_5.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_DISG_HELP_6); LibsMsg.GRAB_DISG_HELP_6.send(sender);
} }
} }

View File

@ -35,7 +35,7 @@ public class SaveDisguiseCommand implements CommandExecutor {
} }
if (!sender.hasPermission("libsdisguises.savedisguise")) { if (!sender.hasPermission("libsdisguises.savedisguise")) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); LibsMsg.NO_PERM.send(sender);
return true; return true;
} }
@ -51,14 +51,14 @@ public class SaveDisguiseCommand implements CommandExecutor {
if (args.length == 0) { if (args.length == 0) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); LibsMsg.NO_CONSOLE.send(sender);
return true; return true;
} }
Disguise disguise = DisguiseAPI.getDisguise((Entity) sender); Disguise disguise = DisguiseAPI.getDisguise((Entity) sender);
if (disguise == null) { if (disguise == null) {
DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); LibsMsg.NOT_DISGUISED.send(sender);
return true; return true;
} }
@ -67,13 +67,13 @@ public class SaveDisguiseCommand implements CommandExecutor {
try { try {
DisguiseAPI.addCustomDisguise(name, disguiseString); DisguiseAPI.addCustomDisguise(name, disguiseString);
DisguiseUtilities.sendMessage(sender, LibsMsg.CUSTOM_DISGUISE_SAVED, name); LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name);
} }
catch (DisguiseParseException e) { catch (DisguiseParseException e) {
if (e.getMessage() != null) { if (e.getMessage() != null) {
DisguiseUtilities.sendMessage(sender, e.getMessage()); DisguiseUtilities.sendMessage(sender, e.getMessage());
} else { } 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() { private BukkitTask runnable = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); LibsMsg.PLEASE_WAIT.send(sender);
} }
}.runTaskTimer(LibsDisguises.getInstance(), 100, 100); }.runTaskTimer(LibsDisguises.getInstance(), 100, 100);
@ -127,12 +127,12 @@ public class SaveDisguiseCommand implements CommandExecutor {
public void onError(LibsMsg msg, Object... args) { public void onError(LibsMsg msg, Object... args) {
runnable.cancel(); runnable.cancel();
DisguiseUtilities.sendMessage(sender, msg, args); msg.send(sender, args);
} }
@Override @Override
public void onInfo(LibsMsg msg, Object... args) { public void onInfo(LibsMsg msg, Object... args) {
DisguiseUtilities.sendMessage(sender, msg, args); msg.send(sender, args);
} }
@Override @Override
@ -163,7 +163,7 @@ public class SaveDisguiseCommand implements CommandExecutor {
try { try {
DisguiseAPI.addCustomDisguise(name, disguiseString); DisguiseAPI.addCustomDisguise(name, disguiseString);
DisguiseUtilities.sendMessage(sender, LibsMsg.CUSTOM_DISGUISE_SAVED, name); LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name);
DisguiseUtilities.setSaveDisguiseCommandUsed(); DisguiseUtilities.setSaveDisguiseCommandUsed();
} }
@ -171,17 +171,17 @@ public class SaveDisguiseCommand implements CommandExecutor {
if (e.getMessage() != null) { if (e.getMessage() != null) {
DisguiseUtilities.sendMessage(sender, e.getMessage()); DisguiseUtilities.sendMessage(sender, e.getMessage());
} else { } else {
DisguiseUtilities.sendMessage(sender, LibsMsg.PARSE_CANT_LOAD); LibsMsg.PARSE_CANT_LOAD.send(sender);
} }
} }
} }
private void sendHelp(CommandSender sender) { private void sendHelp(CommandSender sender) {
DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_1); LibsMsg.SAVE_DISG_HELP_1.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_2); LibsMsg.SAVE_DISG_HELP_2.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_3); LibsMsg.SAVE_DISG_HELP_3.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_4); LibsMsg.SAVE_DISG_HELP_4.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_5); LibsMsg.SAVE_DISG_HELP_5.send(sender);
DisguiseUtilities.sendMessage(sender, LibsMsg.SAVE_DISG_HELP_6); LibsMsg.SAVE_DISG_HELP_6.send(sender);
} }
} }

View File

@ -431,7 +431,7 @@ public abstract class Disguise {
removeDisguise(); removeDisguise();
if (getEntity() instanceof Player) { if (getEntity() instanceof Player) {
DisguiseUtilities.sendMessage(getEntity(), LibsMsg.EXPIRED_DISGUISE); LibsMsg.EXPIRED_DISGUISE.send(getEntity());
} }
return; return;

View File

@ -383,10 +383,10 @@ public class DisguiseUtilities {
if (reference != null && DisguiseUtilities.addClonedDisguise(reference, disguise)) { if (reference != null && DisguiseUtilities.addClonedDisguise(reference, disguise)) {
String entityName = DisguiseType.getType(toClone).toReadable(); String entityName = DisguiseType.getType(toClone).toReadable();
DisguiseUtilities.sendMessage(player, LibsMsg.MADE_REF, entityName, reference); LibsMsg.MADE_REF.send(player, entityName, reference);
DisguiseUtilities.sendMessage(player, LibsMsg.MADE_REF_EXAMPLE, reference); LibsMsg.MADE_REF_EXAMPLE.send(player, reference);
} else { } 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) { public static void sendMessage(CommandSender sender, LibsMsg msg, Object... args) {
if (!NmsVersion.v1_16.isSupported()) { if (!NmsVersion.v1_16.isSupported()) {
String message = msg.get(args); String message = msg.get(args);

View File

@ -125,7 +125,7 @@ public class DisguiseListener implements Listener {
if (disguises.length > 0) { if (disguises.length > 0) {
DisguiseAPI.undisguiseToAll(player); 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) { if (disguises.length > 0) {
event.setCancelled(true); event.setCancelled(true);
DisguiseUtilities.sendMessage(attacker, LibsMsg.CANT_ATTACK_DISGUISED); LibsMsg.CANT_ATTACK_DISGUISED.send(attacker);
} else if (DisguiseConfig.getPvPTimer() > 0 && attacker.hasMetadata("LastDisguise")) { } else if (DisguiseConfig.getPvPTimer() > 0 && attacker.hasMetadata("LastDisguise")) {
long lastDisguised = attacker.getMetadata("LastDisguise").get(0).asLong(); long lastDisguised = attacker.getMetadata("LastDisguise").get(0).asLong();
if (lastDisguised + DisguiseConfig.getPvPTimer() * 1000 > System.currentTimeMillis()) { if (lastDisguised + DisguiseConfig.getPvPTimer() * 1000 > System.currentTimeMillis()) {
event.setCancelled(true); 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(); 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(); disguise.removeDisguise();
} }
DisguiseUtilities.sendMessage(event.getPlayer(), LibsMsg.SWITCH_WORLD_DISGUISE_REMOVED); LibsMsg.SWITCH_WORLD_DISGUISE_REMOVED.send(event.getPlayer());
} }
} else { } else {
// Stupid hack to fix worldswitch invisibility bug & paper packet bug // Stupid hack to fix worldswitch invisibility bug & paper packet bug

View File

@ -4,6 +4,8 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/** /**
* Created by libraryaddict on 15/06/2017. * Created by libraryaddict on 15/06/2017.
@ -371,6 +373,11 @@ public enum LibsMsg {
return DisguiseUtilities.getColoredChat(string); return DisguiseUtilities.getColoredChat(string);
} }
public void send(CommandSender player, Object... strings) {
DisguiseUtilities.sendMessage(player, this, strings);
}
@Deprecated
public String get(Object... strings) { public String get(Object... strings) {
int matches = StringUtils.countMatches(getRaw(), "%s"); int matches = StringUtils.countMatches(getRaw(), "%s");