Add hex color support to translations
This commit is contained in:
		
							
								
								
									
										5
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -103,6 +103,11 @@ | ||||
|             <version>1.15.2-R0.1-SNAPSHOT</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>net.md-5</groupId> | ||||
|             <artifactId>bungeecord-chat</artifactId> | ||||
|             <version>1.16-R0.1</version> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
|  | ||||
|     <repositories> | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package me.libraryaddict.disguise.commands; | ||||
| import lombok.Getter; | ||||
| import me.libraryaddict.disguise.LibsDisguises; | ||||
| import me.libraryaddict.disguise.commands.libsdisguises.*; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsPremium; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.ChatColor; | ||||
| @@ -113,13 +114,13 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter { | ||||
|  | ||||
|             if (command != null) { | ||||
|                 if (!command.hasPermission(sender)) { | ||||
|                     sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|                     return true; | ||||
|                 } | ||||
|  | ||||
|                 command.onCommand(sender, args); | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.LIBS_COMMAND_WRONG_ARG.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_COMMAND_WRONG_ARG); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -28,7 +28,7 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter | ||||
|         } | ||||
|  | ||||
|         if (!(sender instanceof Entity)) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -77,9 +77,9 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter | ||||
|         disguise.startDisguise(); | ||||
|  | ||||
|         if (disguise.isDisguiseInUse()) { | ||||
|             sender.sendMessage(LibsMsg.DISGUISED.get(disguise.getDisguiseName())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DISGUISED, disguise.getDisguiseName()); | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.FAILED_DISGIUSE.get(disguise.getDisguiseName())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.FAILED_DISGIUSE, disguise.getDisguiseName()); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
| @@ -114,22 +114,22 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         if (allowedDisguises.isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DISG_HELP1.get()); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|  | ||||
|         if (allowedDisguises.contains("player")) { | ||||
|             sender.sendMessage(LibsMsg.DISG_HELP2.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP2); | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DISG_HELP3.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP3); | ||||
|  | ||||
|         if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { | ||||
|             sender.sendMessage(LibsMsg.DISG_HELP4.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_HELP4); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -28,12 +28,12 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom | ||||
|         } | ||||
|  | ||||
|         if (!(sender instanceof Player)) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (!getPermissions(sender).hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -65,8 +65,8 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom | ||||
|                 .addInteraction(sender.getName(), new DisguiseEntityInteraction(disguiseArgs), | ||||
|                         DisguiseConfig.getDisguiseEntityExpire()); | ||||
|  | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.DISG_ENT_CLICK.get(DisguiseConfig.getDisguiseEntityExpire(), testDisguise.getDisguiseName())); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_CLICK, DisguiseConfig.getDisguiseEntityExpire(), | ||||
|                 testDisguise.getDisguiseName()); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @@ -93,22 +93,22 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         if (allowedDisguises.isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DISG_ENT_HELP1.get()); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|  | ||||
|         if (allowedDisguises.contains("player")) { | ||||
|             sender.sendMessage(LibsMsg.DISG_ENT_HELP3.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP3); | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DISG_ENT_HELP4.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP4); | ||||
|  | ||||
|         if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { | ||||
|             sender.sendMessage(LibsMsg.DISG_ENT_HELP5.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DISG_ENT_HELP5); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -34,7 +34,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom | ||||
|         DisguisePermissions permissions = getPermissions(sender); | ||||
|  | ||||
|         if (!permissions.hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -44,7 +44,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom | ||||
|         } | ||||
|  | ||||
|         if (args.length == 1) { | ||||
|             sender.sendMessage(LibsMsg.DPLAYER_SUPPLY.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DPLAYER_SUPPLY); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -92,7 +92,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom | ||||
|         } | ||||
|  | ||||
|         if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) { | ||||
|             sender.sendMessage(LibsMsg.DISABLED_LIVING_TO_MISC.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DISABLED_LIVING_TO_MISC); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -172,22 +172,22 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         if (allowedDisguises.isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.D_HELP1.get()); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|  | ||||
|         if (allowedDisguises.contains("player")) { | ||||
|             sender.sendMessage(LibsMsg.D_HELP3.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP3); | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.D_HELP4.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP4); | ||||
|  | ||||
|         if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { | ||||
|             sender.sendMessage(LibsMsg.D_HELP5.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.D_HELP5); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -52,14 +52,14 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom | ||||
|         } | ||||
|  | ||||
|         if (sender.getName().equals("CONSOLE")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         DisguisePermissions permissions = getPermissions(sender); | ||||
|  | ||||
|         if (!permissions.hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -115,7 +115,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom | ||||
|                     (starting == 0 ? LibsMsg.DRADIUS_NEEDOPTIONS : LibsMsg.DRADIUS_NEEDOPTIONS_ENTITY).get()); | ||||
|             return true; | ||||
|         } else if (args.length < 2) { | ||||
|             sender.sendMessage(LibsMsg.DRADIUS_NEEDOPTIONS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_NEEDOPTIONS); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -127,7 +127,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom | ||||
|         int radius = Integer.parseInt(args[starting]); | ||||
|  | ||||
|         if (radius > maxRadius) { | ||||
|             sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); | ||||
|             radius = maxRadius; | ||||
|         } | ||||
|  | ||||
| @@ -202,13 +202,13 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom | ||||
|             } | ||||
|  | ||||
|             if (disguisedEntitys > 0) { | ||||
|                 sender.sendMessage(LibsMsg.DISRADIUS.get(disguisedEntitys)); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.DISRADIUS, disguisedEntitys); | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.DISRADIUS_FAIL.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.DISRADIUS_FAIL); | ||||
|             } | ||||
|  | ||||
|             if (miscDisguises > 0) { | ||||
|                 sender.sendMessage(LibsMsg.DRADIUS_MISCDISG.get(miscDisguises)); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_MISCDISG, miscDisguises); | ||||
|             } | ||||
|         } | ||||
|         catch (DisguiseParseException ex) { | ||||
| @@ -278,24 +278,24 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         if (allowedDisguises.isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DRADIUS_HELP1.get(maxRadius)); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP1, maxRadius); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CAN_USE_DISGS, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|  | ||||
|         if (allowedDisguises.contains("player")) { | ||||
|             sender.sendMessage(LibsMsg.DRADIUS_HELP3.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP3); | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DRADIUS_HELP4.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP4); | ||||
|  | ||||
|         if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) { | ||||
|             sender.sendMessage(LibsMsg.DRADIUS_HELP5.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP5); | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DRADIUS_HELP6.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DRADIUS_HELP6); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.commands.utils.CopyDisguiseCommand; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsEntityInteract; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguiseParser; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| @@ -35,7 +36,7 @@ public class CopyDisguiseInteraction implements LibsEntityInteract { | ||||
|                                 DisguiseParser.parseToString(disguise), true); | ||||
|             } | ||||
|         } else { | ||||
|             player.sendMessage(LibsMsg.TARGET_NOT_DISGUISED.get()); | ||||
|             DisguiseUtilities.sendMessage(player, LibsMsg.TARGET_NOT_DISGUISED); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import me.libraryaddict.disguise.DisguiseConfig; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||
| import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsEntityInteract; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguiseParseException; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguiseParser; | ||||
| @@ -52,7 +53,7 @@ public class DisguiseEntityInteraction implements LibsEntityInteract { | ||||
|  | ||||
|         if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() && | ||||
|                 entity instanceof LivingEntity) { | ||||
|             p.sendMessage(LibsMsg.DISABLED_LIVING_TO_MISC.get()); | ||||
|             DisguiseUtilities.sendMessage(p, LibsMsg.DISABLED_LIVING_TO_MISC); | ||||
|         } else { | ||||
|             if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() && | ||||
|                     !entity.hasPermission("libsdisguises.hidename")) { | ||||
| @@ -76,29 +77,37 @@ public class DisguiseEntityInteraction implements LibsEntityInteract { | ||||
|             if (disguise.isDisguiseInUse()) { | ||||
|                 if (disguise.isPlayerDisguise()) { | ||||
|                     if (entity instanceof Player) { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities | ||||
|                                 .sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER, entityName, disguiseName); | ||||
|                     } else { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities | ||||
|                                 .sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER, entityName, disguiseName); | ||||
|                     } | ||||
|                 } else { | ||||
|                     if (entity instanceof Player) { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities | ||||
|                                 .sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY, entityName, disguiseName); | ||||
|                     } else { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities | ||||
|                                 .sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY, entityName, disguiseName); | ||||
|                     } | ||||
|                 } | ||||
|             } else { | ||||
|                 if (disguise.isPlayerDisguise()) { | ||||
|                     if (entity instanceof Player) { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER_FAIL.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_PLAYER_FAIL, entityName, | ||||
|                                 disguiseName); | ||||
|                     } else { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER_FAIL.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_PLAYER_FAIL, entityName, | ||||
|                                 disguiseName); | ||||
|                     } | ||||
|                 } else { | ||||
|                     if (entity instanceof Player) { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY_FAIL.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_PLAYER_DISG_ENTITY_FAIL, entityName, | ||||
|                                 disguiseName); | ||||
|                     } else { | ||||
|                         p.sendMessage(LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL.get(entityName, disguiseName)); | ||||
|                         DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL, entityName, | ||||
|                                 disguiseName); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsEntityInteract; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguiseParseException; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguiseParser; | ||||
| @@ -37,7 +38,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract { | ||||
|         Disguise disguise = DisguiseAPI.getDisguise(p, entity); | ||||
|  | ||||
|         if (disguise == null) { | ||||
|             p.sendMessage(LibsMsg.UNDISG_PLAYER_FAIL.get(entityName)); | ||||
|             DisguiseUtilities.sendMessage(p, LibsMsg.UNDISG_PLAYER_FAIL, entityName); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -47,7 +48,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract { | ||||
|         DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); | ||||
|  | ||||
|         if (!perms.isAllowedDisguise(disguisePerm, Arrays.asList(options))) { | ||||
|             p.sendMessage(LibsMsg.DMODPLAYER_NOPERM.get()); | ||||
|             DisguiseUtilities.sendMessage(p, LibsMsg.DMODPLAYER_NOPERM); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -55,7 +56,7 @@ public class DisguiseModifyInteraction implements LibsEntityInteract { | ||||
|             DisguiseParser | ||||
|                     .callMethods(p, disguise, perms, disguisePerm, new ArrayList<>(Arrays.asList(options)), options, | ||||
|                             "DisguiseModifyEntity"); | ||||
|             p.sendMessage(LibsMsg.LISTENER_MODIFIED_DISG.get()); | ||||
|             DisguiseUtilities.sendMessage(p, LibsMsg.LISTENER_MODIFIED_DISG); | ||||
|         } | ||||
|         catch (DisguiseParseException ex) { | ||||
|             if (ex.getMessage() != null) { | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package me.libraryaddict.disguise.commands.interactions; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsEntityInteract; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.entity.Entity; | ||||
| @@ -25,14 +26,14 @@ public class UndisguiseEntityInteraction implements LibsEntityInteract { | ||||
|             DisguiseAPI.undisguiseToAll(entity); | ||||
|  | ||||
|             if (entity instanceof Player) | ||||
|                 p.sendMessage(LibsMsg.LISTEN_UNDISG_PLAYER.get(entityName)); | ||||
|                 DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER, entityName); | ||||
|             else | ||||
|                 p.sendMessage(LibsMsg.LISTEN_UNDISG_ENT.get(entityName)); | ||||
|                 DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT, entityName); | ||||
|         } else { | ||||
|             if (entity instanceof Player) | ||||
|                 p.sendMessage(LibsMsg.LISTEN_UNDISG_PLAYER_FAIL.get(entityName)); | ||||
|                 DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER_FAIL, entityName); | ||||
|             else | ||||
|                 p.sendMessage(LibsMsg.LISTEN_UNDISG_ENT_FAIL.get(entityName)); | ||||
|                 DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT_FAIL, entityName); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.LibsDisguises; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import me.libraryaddict.disguise.utilities.updates.UpdateChecker; | ||||
| import org.bukkit.ChatColor; | ||||
| @@ -33,12 +34,12 @@ public class LDChangelog implements LDCommand { | ||||
|         UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker(); | ||||
|  | ||||
|         if (checker.isDownloading()) { | ||||
|             sender.sendMessage(LibsMsg.UPDATE_IN_PROGRESS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_IN_PROGRESS); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (checker.getUpdate() == null) { | ||||
|             sender.sendMessage(LibsMsg.UPDATE_REQUIRED.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_REQUIRED); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseConfig; | ||||
| import me.libraryaddict.disguise.LibsDisguises; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.ChatColor; | ||||
| import org.bukkit.command.CommandSender; | ||||
| @@ -34,7 +35,7 @@ public class LDConfig implements LDCommand { | ||||
|         ArrayList<String> returns = DisguiseConfig.doOutput(LibsDisguises.getInstance().getConfig(), true, true); | ||||
|  | ||||
|         if (returns.isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.USING_DEFAULT_CONFIG.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.USING_DEFAULT_CONFIG); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -35,9 +35,10 @@ public class LDCount implements LDCommand { | ||||
|         } | ||||
|  | ||||
|         if (counts.isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.NO_DISGUISES_IN_USE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_DISGUISES_IN_USE); | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.ACTIVE_DISGUISES_COUNT.get(counts.values().stream().reduce(Integer::sum).get())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.ACTIVE_DISGUISES_COUNT, | ||||
|                     counts.values().stream().reduce(Integer::sum).get()); | ||||
|  | ||||
|             ArrayList<DisguiseType> types = new ArrayList<>(counts.keySet()); | ||||
|             types.sort((d1, d2) -> String.CASE_INSENSITIVE_ORDER.compare(TranslateType.DISGUISES.get(d1.toReadable()), | ||||
| @@ -54,7 +55,7 @@ public class LDCount implements LDCommand { | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             sender.sendMessage(LibsMsg.ACTIVE_DISGUISES.get(builder.toString())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.ACTIVE_DISGUISES, builder.toString()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -29,7 +29,7 @@ public class LDDebugPlayer implements LDCommand { | ||||
|             Disguise disguise = DisguiseAPI.getDisguise(player, entity); | ||||
|  | ||||
|             if (disguise == null) { | ||||
|                 player.sendMessage(LibsMsg.TARGET_NOT_DISGUISED.get()); | ||||
|                 DisguiseUtilities.sendMessage(player, LibsMsg.TARGET_NOT_DISGUISED); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -100,7 +100,7 @@ public class LDDebugPlayer implements LDCommand { | ||||
|     @Override | ||||
|     public void onCommand(CommandSender sender, String[] args) { | ||||
|         if (!(sender instanceof Player)) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|         } | ||||
|  | ||||
|         LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new DebugInteraction(), 60); | ||||
|   | ||||
| @@ -35,7 +35,7 @@ public class LDJson implements LDCommand { | ||||
|     @Override | ||||
|     public void onCommand(CommandSender sender, String[] args) { | ||||
|         if (!(sender instanceof Player)) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.reflection.NmsVersion; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import net.md_5.bungee.api.chat.ClickEvent; | ||||
| @@ -34,7 +35,7 @@ public class LDMetaInfo implements LDCommand { | ||||
|             MetaIndex index = MetaIndex.getMetaIndexByName(args[1]); | ||||
|  | ||||
|             if (index == null) { | ||||
|                 sender.sendMessage(LibsMsg.META_NOT_FOUND.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.META_NOT_FOUND); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -68,8 +69,8 @@ public class LDMetaInfo implements LDCommand { | ||||
|  | ||||
|                 sender.spigot().sendMessage(builder.create()); | ||||
|             } else { | ||||
|                 sender.sendMessage( | ||||
|                         LibsMsg.META_VALUES_NO_CLICK.get(StringUtils.join(names, LibsMsg.META_VALUE_SEPERATOR.get()))); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.META_VALUES_NO_CLICK, | ||||
|                         StringUtils.join(names, LibsMsg.META_VALUE_SEPERATOR.get())); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.modded.ModdedManager; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.apache.commons.lang.StringUtils; | ||||
| @@ -27,7 +28,7 @@ public class LDMods implements LDCommand { | ||||
|     @Override | ||||
|     public void onCommand(CommandSender sender, String[] args) { | ||||
|         if (ModdedManager.getEntities().isEmpty()) { | ||||
|             sender.sendMessage(LibsMsg.NO_MODS_LISTENING.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_MODS_LISTENING); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -43,17 +44,17 @@ public class LDMods implements LDCommand { | ||||
|         } else if (sender instanceof Player) { | ||||
|             player = (Player) sender; | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (!player.hasMetadata("forge_mods")) { | ||||
|             sender.sendMessage(LibsMsg.NO_MODS.get(player.getName())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_MODS, player.getName()); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.MODS_LIST.get(player.getName(), | ||||
|                 StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.MODS_LIST, player.getName(), | ||||
|                 StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", ")); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.LibsDisguises; | ||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsPremium; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguisePerm; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguisePermissions; | ||||
| @@ -31,7 +32,7 @@ public class LDPermTest implements LDCommand { | ||||
|     @Override | ||||
|     public void onCommand(CommandSender sender, String[] args) { | ||||
|         if (!LibsPremium.isPremium()) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_NON_PREM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_NON_PREM); | ||||
|         } | ||||
|  | ||||
|         Permissible player; | ||||
| @@ -48,34 +49,34 @@ public class LDPermTest implements LDCommand { | ||||
|         } | ||||
|  | ||||
|         DisguisePermissions permissions = new DisguisePermissions(player, "disguise"); | ||||
|         sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_INFO_1.get()); | ||||
|         sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_INFO_2.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_INFO_1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_INFO_2); | ||||
|  | ||||
|         if (player.hasPermission("libsdisguises.disguise.pig")) { | ||||
|             sender.sendMessage(LibsMsg.NORMAL_PERM_CHECK_SUCCESS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NORMAL_PERM_CHECK_SUCCESS); | ||||
|  | ||||
|             if (permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.PIG))) { | ||||
|                 sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_SUCCESS.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_SUCCESS); | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_FAIL.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_FAIL); | ||||
|             } | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.NORMAL_PERM_CHECK_FAIL.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NORMAL_PERM_CHECK_FAIL); | ||||
|         } | ||||
|  | ||||
|         if (player.hasPermission("libsdisguises.disguise.zombie") || | ||||
|                 permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.ZOMBIE))) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_ZOMBIE_PERMISSIONS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_ZOMBIE_PERMISSIONS); | ||||
|         } | ||||
|  | ||||
|         PluginCommand command = LibsDisguises.getInstance().getCommand("disguise"); | ||||
|  | ||||
|         if (command == null) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_PERM_CHECK_COMMAND_UNREGISTERED.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_CHECK_COMMAND_UNREGISTERED); | ||||
|         } else if (player.hasPermission(command.getPermission())) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_PERM_COMMAND_SUCCESS.get(command.getPermission())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_SUCCESS, command.getPermission()); | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.LIBS_PERM_COMMAND_FAIL.get(command.getPermission())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_PERM_COMMAND_FAIL, command.getPermission()); | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.seecmd.disguise")) { | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseConfig; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.sounds.SoundManager; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.command.CommandSender; | ||||
| @@ -26,7 +27,7 @@ public class LDReload implements LDCommand { | ||||
|     public void onCommand(CommandSender sender, String[] args) { | ||||
|         DisguiseConfig.loadConfig(); | ||||
|         new SoundManager().load(); | ||||
|         sender.sendMessage(LibsMsg.RELOADED_CONFIG.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.RELOADED_CONFIG); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -109,18 +109,18 @@ public class LDScoreboard implements LDCommand { | ||||
|             } | ||||
|  | ||||
|             if (issuesFound == 0) { | ||||
|                 sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_NO_ISSUES.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_ISSUES); | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_ISSUES.get(issuesFound)); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_ISSUES, issuesFound); | ||||
|             } | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_NAMES_DISABLED.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NAMES_DISABLED); | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST); | ||||
|  | ||||
|         if (DisguiseConfig.getPushingOption() == DisguiseConfig.DisguisePushing.IGNORE_SCOREBOARD) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_DISABLED.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_DISABLED); | ||||
|         } | ||||
|  | ||||
|         Player player; | ||||
| @@ -134,18 +134,18 @@ public class LDScoreboard implements LDCommand { | ||||
|             } | ||||
|  | ||||
|             if (!DisguiseAPI.isDisguised(player)) { | ||||
|                 sender.sendMessage(LibsMsg.DMODPLAYER_NODISGUISE.get(player.getName())); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NODISGUISE, player.getName()); | ||||
|                 return; | ||||
|             } | ||||
|         } else if (sender instanceof Player) { | ||||
|             player = (Player) sender; | ||||
|  | ||||
|             if (!DisguiseAPI.isDisguised(player)) { | ||||
|                 sender.sendMessage(LibsMsg.NOT_DISGUISED.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); | ||||
|                 return; | ||||
|             } | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -154,17 +154,17 @@ public class LDScoreboard implements LDCommand { | ||||
|         Team team = board.getEntryTeam(sender.getName()); | ||||
|  | ||||
|         if (team == null) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_NO_TEAM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_TEAM); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.NEVER && | ||||
|                 team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.FOR_OTHER_TEAMS) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_NO_TEAM_PUSH.get(team.getName())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_NO_TEAM_PUSH, team.getName()); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_SUCCESS.get(team.getName())); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_SCOREBOARD_SUCCESS, team.getName()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -35,7 +35,7 @@ public class LDUpdate implements LDCommand { | ||||
|         UpdateChecker checker = LibsDisguises.getInstance().getUpdateChecker(); | ||||
|  | ||||
|         if (checker.isDownloading()) { | ||||
|             sender.sendMessage(LibsMsg.UPDATE_IN_PROGRESS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_IN_PROGRESS); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -47,7 +47,7 @@ public class LDUpdate implements LDCommand { | ||||
|             } else if (args[1].equalsIgnoreCase("release")) { | ||||
|                 releaseBuilds = true; | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.LIBS_UPDATE_UNKNOWN_BRANCH.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.LIBS_UPDATE_UNKNOWN_BRANCH); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -56,12 +56,12 @@ public class LDUpdate implements LDCommand { | ||||
|  | ||||
|         if (checker.getUpdate() != null && checker.getUpdate().isReleaseBuild() == releaseBuilds && args.length <= 1) { | ||||
|             if (checker.isServerLatestVersion()) { | ||||
|                 sender.sendMessage(LibsMsg.UPDATE_ON_LATEST.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ON_LATEST); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             if (checker.isOnLatestUpdate(true)) { | ||||
|                 sender.sendMessage(LibsMsg.UPDATE_ALREADY_DOWNLOADED.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ALREADY_DOWNLOADED); | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
| @@ -76,15 +76,15 @@ public class LDUpdate implements LDCommand { | ||||
|                 } | ||||
|  | ||||
|                 if (checker.getUpdate() == null) { | ||||
|                     sender.sendMessage(LibsMsg.UPDATE_FAILED.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_FAILED); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 if (checker.isOnLatestUpdate(true)) { | ||||
|                     if (checker.getLastDownload() != null) { | ||||
|                         sender.sendMessage(LibsMsg.UPDATE_ALREADY_DOWNLOADED.get()); | ||||
|                         DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ALREADY_DOWNLOADED); | ||||
|                     } else { | ||||
|                         sender.sendMessage(LibsMsg.UPDATE_ON_LATEST.get()); | ||||
|                         DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_ON_LATEST); | ||||
|                     } | ||||
|  | ||||
|                     return; | ||||
| @@ -105,7 +105,7 @@ public class LDUpdate implements LDCommand { | ||||
|                 PluginInformation result = checker.doUpdate(); | ||||
|  | ||||
|                 if (result == null) { | ||||
|                     sender.sendMessage(LibsMsg.UPDATE_FAILED.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.UPDATE_FAILED); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|   | ||||
| @@ -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)) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         DisguisePermissions permissions = getPermissions(sender); | ||||
|  | ||||
|         if (!permissions.hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -42,14 +42,14 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom | ||||
|         Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender); | ||||
|  | ||||
|         if (disguise == null) { | ||||
|             sender.sendMessage(LibsMsg.NOT_DISGUISED.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); | ||||
|  | ||||
|         if (!permissions.isAllowedDisguise(disguisePerm)) { | ||||
|             sender.sendMessage(LibsMsg.DMODIFY_NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -73,7 +73,7 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODIFY_MODIFIED.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_MODIFIED); | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
| @@ -106,9 +106,9 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom | ||||
|     protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODIFY_HELP3.get()); | ||||
|         sender.sendMessage(LibsMsg.DMODIFY_HELP3.get()); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.DMODIFY_HELP3.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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)) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         DisguisePermissions permissions = getPermissions(sender); | ||||
|  | ||||
|         if (!permissions.hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -44,7 +44,7 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements | ||||
|                 new DisguiseModifyInteraction(DisguiseUtilities.split(StringUtils.join(args, " "))), | ||||
|                 DisguiseConfig.getDisguiseEntityExpire()); | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODIFYENT_CLICK.get(DisguiseConfig.getDisguiseEntityExpire())); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFYENT_CLICK, DisguiseConfig.getDisguiseEntityExpire()); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @@ -78,8 +78,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements | ||||
|     protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODENT_HELP1.get()); | ||||
|         sender.sendMessage(LibsMsg.DMODIFY_HELP3 | ||||
|                 .get( StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODENT_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -28,7 +28,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements | ||||
|         DisguisePermissions permissions = getPermissions(sender); | ||||
|  | ||||
|         if (!permissions.hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -71,14 +71,14 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements | ||||
|             disguise = DisguiseAPI.getDisguise(entityTarget); | ||||
|  | ||||
|         if (disguise == null) { | ||||
|             sender.sendMessage(LibsMsg.DMODPLAYER_NODISGUISE.get(entityTarget.getName())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NODISGUISE, entityTarget.getName()); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         DisguisePerm disguisePerm = new DisguisePerm(disguise.getType()); | ||||
|  | ||||
|         if (!permissions.isAllowedDisguise(disguisePerm)) { | ||||
|             sender.sendMessage(LibsMsg.DMODPLAYER_NOPERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_NOPERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -102,7 +102,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODPLAYER_MODIFIED.get(entityTarget.getName())); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_MODIFIED, entityTarget.getName()); | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
| @@ -161,8 +161,8 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements | ||||
|     protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODPLAYER_HELP1.get()); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.DMODIFY_HELP3.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODPLAYER_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         DisguisePermissions permissions = getPermissions(sender); | ||||
|  | ||||
|         if (!permissions.hasPermissions()) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -109,7 +109,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements | ||||
|                     (starting == 0 ? LibsMsg.DMODRADIUS_NEEDOPTIONS : LibsMsg.DMODRADIUS_NEEDOPTIONS_ENTITY).get()); | ||||
|             return true; | ||||
|         } else if (args.length < 2) { | ||||
|             sender.sendMessage(LibsMsg.DMODRADIUS_NEEDOPTIONS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NEEDOPTIONS); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -121,7 +121,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements | ||||
|         int radius = Integer.parseInt(args[starting]); | ||||
|  | ||||
|         if (radius > maxRadius) { | ||||
|             sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); | ||||
|             radius = maxRadius; | ||||
|         } | ||||
|  | ||||
| @@ -188,13 +188,13 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements | ||||
|         } | ||||
|  | ||||
|         if (noPermission > 0) { | ||||
|             sender.sendMessage(LibsMsg.DMODRADIUS_NOPERM.get(noPermission)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NOPERM, noPermission); | ||||
|         } | ||||
|  | ||||
|         if (modifiedDisguises > 0) { | ||||
|             sender.sendMessage(LibsMsg.DMODRADIUS.get(modifiedDisguises)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS, modifiedDisguises); | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.DMODRADIUS_NOENTS.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_NOENTS); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
| @@ -245,7 +245,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements | ||||
|         int radius = Integer.parseInt(args[starting]); | ||||
|  | ||||
|         if (radius > maxRadius) { | ||||
|             sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); | ||||
|             radius = maxRadius; | ||||
|         } | ||||
|  | ||||
| @@ -287,11 +287,11 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements | ||||
|     protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { | ||||
|         ArrayList<String> allowedDisguises = getAllowedDisguises(permissions); | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODRADIUS_HELP1.get(maxRadius)); | ||||
|         sender.sendMessage( | ||||
|                 LibsMsg.DMODIFY_HELP3.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()))); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP1, maxRadius); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODIFY_HELP3, | ||||
|                 StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())); | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.DMODRADIUS_HELP2.get()); | ||||
|         sender.sendMessage(LibsMsg.DMODRADIUS_HELP3.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP2); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DMODRADIUS_HELP3); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.undisguise; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsPremium; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.ChatColor; | ||||
| @@ -21,19 +22,19 @@ public class UndisguiseCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (sender.getName().equals("CONSOLE")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (sender.hasPermission("libsdisguises.undisguise") && !"%%__USER__%%".equals(12345 + "")) { | ||||
|             if (DisguiseAPI.isDisguised((Entity) sender)) { | ||||
|                 DisguiseAPI.undisguiseToAll((Player) sender); | ||||
|                 sender.sendMessage(LibsMsg.UNDISG.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG); | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.NOT_DISGUISED.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); | ||||
|             } | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package me.libraryaddict.disguise.commands.undisguise; | ||||
| import me.libraryaddict.disguise.DisguiseConfig; | ||||
| import me.libraryaddict.disguise.LibsDisguises; | ||||
| import me.libraryaddict.disguise.commands.interactions.UndisguiseEntityInteraction; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsPremium; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.ChatColor; | ||||
| @@ -21,18 +22,18 @@ public class UndisguiseEntityCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (sender.getName().equals("CONSOLE")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.undisguiseentity")) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(), | ||||
|                 DisguiseConfig.getDisguiseEntityExpire()); | ||||
|         sender.sendMessage(LibsMsg.UND_ENTITY.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.UND_ENTITY); | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package me.libraryaddict.disguise.commands.undisguise; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsPremium; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.Bukkit; | ||||
| @@ -62,12 +63,12 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter { | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.undisguiseplayer")) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (args.length == 0) { | ||||
|             sender.sendMessage(LibsMsg.UNDISG_PLAYER_HELP.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISG_PLAYER_HELP); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.undisguise; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.LibsPremium; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.ChatColor; | ||||
| @@ -36,7 +37,7 @@ public class UndisguiseRadiusCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (sender.getName().equals("CONSOLE")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -49,7 +50,7 @@ public class UndisguiseRadiusCommand implements CommandExecutor { | ||||
|                 } | ||||
|                 radius = Integer.parseInt(args[0]); | ||||
|                 if (radius > maxRadius) { | ||||
|                     sender.sendMessage(LibsMsg.LIMITED_RADIUS.get(maxRadius)); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.LIMITED_RADIUS, maxRadius); | ||||
|                     radius = maxRadius; | ||||
|                 } | ||||
|             } | ||||
| @@ -65,9 +66,9 @@ public class UndisguiseRadiusCommand implements CommandExecutor { | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             sender.sendMessage(LibsMsg.UNDISRADIUS.get(disguisedEntitys)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.UNDISRADIUS, disguisedEntitys); | ||||
|         } else { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|   | ||||
| @@ -38,7 +38,7 @@ public class CopyDisguiseCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.copydisguise")) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -70,7 +70,8 @@ public class CopyDisguiseCommand implements CommandExecutor { | ||||
|                     .addInteraction(sender.getName(), new CopyDisguiseInteraction(this), | ||||
|                             DisguiseConfig.getDisguiseEntityExpire()); | ||||
|  | ||||
|             sender.sendMessage(LibsMsg.DISGUISECOPY_INTERACT.get(DisguiseConfig.getDisguiseEntityExpire())); | ||||
|             DisguiseUtilities | ||||
|                     .sendMessage(sender, LibsMsg.DISGUISECOPY_INTERACT, DisguiseConfig.getDisguiseEntityExpire()); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -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")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.disguise.disguiseclone")) { | ||||
|  | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -53,7 +53,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp | ||||
|             } else if (option.equalsIgnoreCase(LibsMsg.DCLONE_SPRINT.get())) { | ||||
|                 doSprint = true; | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.INVALID_CLONE.get(option)); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.INVALID_CLONE, option); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
| @@ -67,7 +67,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp | ||||
|                     .addInteraction(sender.getName(), new DisguiseCloneInteraction(options), | ||||
|                             DisguiseConfig.getDisguiseCloneExpire()); | ||||
|  | ||||
|             sender.sendMessage(LibsMsg.CLICK_TIMER.get(DisguiseConfig.getDisguiseCloneExpire())); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.CLICK_TIMER, DisguiseConfig.getDisguiseCloneExpire()); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
| @@ -103,8 +103,8 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp | ||||
|      */ | ||||
|     @Override | ||||
|     protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { | ||||
|         sender.sendMessage(LibsMsg.CLONE_HELP1.get()); | ||||
|         sender.sendMessage(LibsMsg.CLONE_HELP2.get()); | ||||
|         sender.sendMessage(LibsMsg.CLONE_HELP3.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP2); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.CLONE_HELP3); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.utils; | ||||
|  | ||||
| import me.libraryaddict.disguise.commands.DisguiseBaseCommand; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.params.ParamInfo; | ||||
| import me.libraryaddict.disguise.utilities.params.ParamInfoManager; | ||||
| import me.libraryaddict.disguise.utilities.parser.DisguiseParser; | ||||
| @@ -47,14 +48,16 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl | ||||
|  | ||||
|                 if (help != null) { | ||||
|                     if (help.hasValues() && help.canTranslateValues()) { | ||||
|                         sender.sendMessage(LibsMsg.DHELP_HELP4.get(help.getName(), | ||||
|                                 StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get()))); | ||||
|                         DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP4, help.getName(), | ||||
|                                 StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get())); | ||||
|                     } else { | ||||
|                         if (!help.getName().equals(help.getDescriptiveName())) { | ||||
|                             sender.sendMessage(LibsMsg.DHELP_HELP6 | ||||
|                                     .get(help.getName(), help.getDescriptiveName(), help.getDescription())); | ||||
|                             DisguiseUtilities | ||||
|                                     .sendMessage(sender, LibsMsg.DHELP_HELP6, help.getName(), help.getDescriptiveName(), | ||||
|                                             help.getDescription()); | ||||
|                         } else { | ||||
|                             sender.sendMessage(LibsMsg.DHELP_HELP5.get(help.getName(), help.getDescription())); | ||||
|                             DisguiseUtilities | ||||
|                                     .sendMessage(sender, LibsMsg.DHELP_HELP5, help.getName(), help.getDescription()); | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
| @@ -69,7 +72,7 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl | ||||
|                 } | ||||
|  | ||||
|                 if (!perms.isAllowedDisguise(type)) { | ||||
|                     sender.sendMessage(LibsMsg.NO_PERM_DISGUISE.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM_DISGUISE); | ||||
|                     return true; | ||||
|                 } | ||||
|  | ||||
| @@ -115,14 +118,14 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl | ||||
|                         StringUtils.join(methods, ChatColor.DARK_RED + ", "))); | ||||
|  | ||||
|                 if (ignored > 0) { | ||||
|                     sender.sendMessage(LibsMsg.NO_PERMS_USE_OPTIONS.get(ignored)); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERMS_USE_OPTIONS, ignored); | ||||
|                 } | ||||
|  | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @@ -158,13 +161,13 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl | ||||
|      */ | ||||
|     @Override | ||||
|     protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) { | ||||
|         sender.sendMessage(LibsMsg.DHELP_HELP1.get()); | ||||
|         sender.sendMessage(LibsMsg.DHELP_HELP2.get()); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP1); | ||||
|         DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP2); | ||||
|  | ||||
|         for (ParamInfo s : ParamInfoManager.getParamInfos()) { | ||||
|             sender.sendMessage(LibsMsg.DHELP_HELP3.get(s.getName().replaceAll(" ", "") + | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.DHELP_HELP3, s.getName().replaceAll(" ", "") + | ||||
|                             (!s.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""), | ||||
|                     s.getDescription())); | ||||
|                     s.getDescription()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.libraryaddict.disguise.commands.utils; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandExecutor; | ||||
| @@ -15,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")) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -23,10 +24,10 @@ public class DisguiseViewSelfCommand implements CommandExecutor { | ||||
|  | ||||
|         if (DisguiseAPI.isViewSelfToggled(player)) { | ||||
|             DisguiseAPI.setViewDisguiseToggled(player, false); | ||||
|             sender.sendMessage(LibsMsg.VIEW_SELF_OFF.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_SELF_OFF); | ||||
|         } else { | ||||
|             DisguiseAPI.setViewDisguiseToggled(player, true); | ||||
|             sender.sendMessage(LibsMsg.VIEW_SELF_ON.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.VIEW_SELF_ON); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|   | ||||
| @@ -33,12 +33,12 @@ public class GrabHeadCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.grabhead")) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (!(sender instanceof Player)) { | ||||
|             sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -61,7 +61,7 @@ public class GrabHeadCommand implements CommandExecutor { | ||||
|             private BukkitTask runnable = new BukkitRunnable() { | ||||
|                 @Override | ||||
|                 public void run() { | ||||
|                     sender.sendMessage(LibsMsg.PLEASE_WAIT.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); | ||||
|                 } | ||||
|             }.runTaskTimer(LibsDisguises.getInstance(), 100, 100); | ||||
|  | ||||
| @@ -101,7 +101,7 @@ public class GrabHeadCommand implements CommandExecutor { | ||||
|                         skull.setItemMeta(meta); | ||||
|  | ||||
|                         ((Player) sender).getInventory().addItem(skull); | ||||
|                         sender.sendMessage(LibsMsg.GRAB_HEAD_SUCCESS.get()); | ||||
|                         DisguiseUtilities.sendMessage(sender, LibsMsg.GRAB_HEAD_SUCCESS); | ||||
|                     } | ||||
|                 }.runTask(LibsDisguises.getInstance()); | ||||
|             } | ||||
| @@ -113,11 +113,11 @@ public class GrabHeadCommand implements CommandExecutor { | ||||
|     } | ||||
|  | ||||
|     private void sendHelp(CommandSender sender) { | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_1.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_2.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_3.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_4.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_5.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_6.get()); | ||||
|         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); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -35,7 +35,7 @@ public class GrabSkinCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.grabskin")) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -69,7 +69,7 @@ public class GrabSkinCommand implements CommandExecutor { | ||||
|             private BukkitTask runnable = new BukkitRunnable() { | ||||
|                 @Override | ||||
|                 public void run() { | ||||
|                     sender.sendMessage(LibsMsg.PLEASE_WAIT.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); | ||||
|                 } | ||||
|             }.runTaskTimer(LibsDisguises.getInstance(), 100, 100); | ||||
|  | ||||
| @@ -107,7 +107,7 @@ public class GrabSkinCommand implements CommandExecutor { | ||||
|                 } | ||||
|  | ||||
|                 DisguiseAPI.addGameProfile(nName, profile); | ||||
|                 sender.sendMessage(LibsMsg.GRABBED_SKIN.get(nName)); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.GRABBED_SKIN, 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 { | ||||
|                     sender.sendMessage(LibsMsg.SKIN_DATA.get(string)); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.SKIN_DATA, string); | ||||
|                 } | ||||
|  | ||||
|                 DisguiseUtilities.setGrabSkinCommandUsed(); | ||||
| @@ -153,11 +153,11 @@ public class GrabSkinCommand implements CommandExecutor { | ||||
|     } | ||||
|  | ||||
|     private void sendHelp(CommandSender sender) { | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_1.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_2.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_3.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_4.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_5.get()); | ||||
|         sender.sendMessage(LibsMsg.GRAB_DISG_HELP_6.get()); | ||||
|         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); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -35,7 +35,7 @@ public class SaveDisguiseCommand implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         if (!sender.hasPermission("libsdisguises.savedisguise")) { | ||||
|             sender.sendMessage(LibsMsg.NO_PERM.get()); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.NO_PERM); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -51,14 +51,14 @@ public class SaveDisguiseCommand implements CommandExecutor { | ||||
|  | ||||
|         if (args.length == 0) { | ||||
|             if (!(sender instanceof Player)) { | ||||
|                 sender.sendMessage(LibsMsg.NO_CONSOLE.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.NO_CONSOLE); | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
|             Disguise disguise = DisguiseAPI.getDisguise((Entity) sender); | ||||
|  | ||||
|             if (disguise == null) { | ||||
|                 sender.sendMessage(LibsMsg.NOT_DISGUISED.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.NOT_DISGUISED); | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
| @@ -67,13 +67,13 @@ public class SaveDisguiseCommand implements CommandExecutor { | ||||
|             try { | ||||
|                 DisguiseAPI.addCustomDisguise(name, disguiseString); | ||||
|  | ||||
|                 sender.sendMessage(LibsMsg.CUSTOM_DISGUISE_SAVED.get(name)); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.CUSTOM_DISGUISE_SAVED, name); | ||||
|             } | ||||
|             catch (DisguiseParseException e) { | ||||
|                 if (e.getMessage() != null) { | ||||
|                     sender.sendMessage(e.getMessage()); | ||||
|                 } else { | ||||
|                     sender.sendMessage(LibsMsg.PARSE_CANT_LOAD.get()); | ||||
|                     DisguiseUtilities.sendMessage(sender, LibsMsg.PARSE_CANT_LOAD); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @@ -119,7 +119,7 @@ public class SaveDisguiseCommand implements CommandExecutor { | ||||
|                     private BukkitTask runnable = new BukkitRunnable() { | ||||
|                         @Override | ||||
|                         public void run() { | ||||
|                             sender.sendMessage(LibsMsg.PLEASE_WAIT.get()); | ||||
|                             DisguiseUtilities.sendMessage(sender, LibsMsg.PLEASE_WAIT); | ||||
|                         } | ||||
|                     }.runTaskTimer(LibsDisguises.getInstance(), 100, 100); | ||||
|  | ||||
| @@ -163,7 +163,7 @@ public class SaveDisguiseCommand implements CommandExecutor { | ||||
|  | ||||
|         try { | ||||
|             DisguiseAPI.addCustomDisguise(name, disguiseString); | ||||
|             sender.sendMessage(LibsMsg.CUSTOM_DISGUISE_SAVED.get(name)); | ||||
|             DisguiseUtilities.sendMessage(sender, LibsMsg.CUSTOM_DISGUISE_SAVED, name); | ||||
|  | ||||
|             DisguiseUtilities.setSaveDisguiseCommandUsed(); | ||||
|         } | ||||
| @@ -171,17 +171,17 @@ public class SaveDisguiseCommand implements CommandExecutor { | ||||
|             if (e.getMessage() != null) { | ||||
|                 sender.sendMessage(e.getMessage()); | ||||
|             } else { | ||||
|                 sender.sendMessage(LibsMsg.PARSE_CANT_LOAD.get()); | ||||
|                 DisguiseUtilities.sendMessage(sender, LibsMsg.PARSE_CANT_LOAD); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void sendHelp(CommandSender sender) { | ||||
|         sender.sendMessage(LibsMsg.SAVE_DISG_HELP_1.get()); | ||||
|         sender.sendMessage(LibsMsg.SAVE_DISG_HELP_2.get()); | ||||
|         sender.sendMessage(LibsMsg.SAVE_DISG_HELP_3.get()); | ||||
|         sender.sendMessage(LibsMsg.SAVE_DISG_HELP_4.get()); | ||||
|         sender.sendMessage(LibsMsg.SAVE_DISG_HELP_5.get()); | ||||
|         sender.sendMessage(LibsMsg.SAVE_DISG_HELP_6.get()); | ||||
|         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); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,7 +1,13 @@ | ||||
| package me.libraryaddict.disguise.disguisetypes; | ||||
|  | ||||
| public enum RabbitType { | ||||
|     BLACK(2), BROWN(0), GOLD(4), KILLER_BUNNY(99), PATCHES(3), PEPPER(5), WHITE(1); | ||||
|     BLACK(2), | ||||
|     BROWN(0), | ||||
|     GOLD(4), | ||||
|     KILLER_BUNNY(99), | ||||
|     PATCHES(3), | ||||
|     PEPPER(5), | ||||
|     WHITE(1); | ||||
|  | ||||
|     public static RabbitType getType(int id) { | ||||
|         for (RabbitType type : values()) { | ||||
|   | ||||
| @@ -3,22 +3,17 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
|  | ||||
| public class BlazeWatcher extends InsentientWatcher | ||||
| { | ||||
|     public BlazeWatcher(Disguise disguise) | ||||
|     { | ||||
| public class BlazeWatcher extends InsentientWatcher { | ||||
|     public BlazeWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public boolean isBlazing() | ||||
|     { | ||||
|     public boolean isBlazing() { | ||||
|         return getData(MetaIndex.BLAZE_BLAZING) == 1; | ||||
|     } | ||||
|  | ||||
|     public void setBlazing(boolean isBlazing) | ||||
|     { | ||||
|     public void setBlazing(boolean isBlazing) { | ||||
|         setData(MetaIndex.BLAZE_BLAZING, (byte) (isBlazing ? 1 : 0)); | ||||
|         sendData(MetaIndex.BLAZE_BLAZING); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,34 +3,27 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
|  | ||||
| public class CreeperWatcher extends InsentientWatcher | ||||
| { | ||||
| public class CreeperWatcher extends InsentientWatcher { | ||||
|  | ||||
|     public CreeperWatcher(Disguise disguise) | ||||
|     { | ||||
|     public CreeperWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public boolean isIgnited() | ||||
|     { | ||||
|     public boolean isIgnited() { | ||||
|         return getData(MetaIndex.CREEPER_IGNITED); | ||||
|     } | ||||
|  | ||||
|     public boolean isPowered() | ||||
|     { | ||||
|     public boolean isPowered() { | ||||
|         return getData(MetaIndex.CREEPER_POWERED); | ||||
|     } | ||||
|  | ||||
|     public void setIgnited(boolean ignited) | ||||
|     { | ||||
|     public void setIgnited(boolean ignited) { | ||||
|         setData(MetaIndex.CREEPER_IGNITED, ignited); | ||||
|         sendData(MetaIndex.CREEPER_IGNITED); | ||||
|     } | ||||
|  | ||||
|     public void setPowered(boolean powered) | ||||
|     { | ||||
|     public void setPowered(boolean powered) { | ||||
|         setData(MetaIndex.CREEPER_POWERED, powered); | ||||
|         sendData(MetaIndex.CREEPER_POWERED); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -7,5 +7,4 @@ public class DonkeyWatcher extends ChestedHorseWatcher { | ||||
|     public DonkeyWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -6,21 +6,17 @@ import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
| /** | ||||
|  * @author Navid | ||||
|  */ | ||||
| public class EnderDragonWatcher extends InsentientWatcher | ||||
| { | ||||
| public class EnderDragonWatcher extends InsentientWatcher { | ||||
|  | ||||
|     public EnderDragonWatcher(Disguise disguise) | ||||
|     { | ||||
|     public EnderDragonWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public int getPhase() | ||||
|     { | ||||
|     public int getPhase() { | ||||
|         return getData(MetaIndex.ENDER_DRAGON_PHASE); | ||||
|     } | ||||
|  | ||||
|     public void setPhase(int phase) | ||||
|     { | ||||
|     public void setPhase(int phase) { | ||||
|         setData(MetaIndex.ENDER_DRAGON_PHASE, phase); | ||||
|         sendData(MetaIndex.ENDER_DRAGON_PHASE); | ||||
|     } | ||||
|   | ||||
| @@ -3,23 +3,18 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
|  | ||||
| public class GhastWatcher extends InsentientWatcher | ||||
| { | ||||
| public class GhastWatcher extends InsentientWatcher { | ||||
|  | ||||
|     public GhastWatcher(Disguise disguise) | ||||
|     { | ||||
|     public GhastWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public boolean isAggressive() | ||||
|     { | ||||
|     public boolean isAggressive() { | ||||
|         return getData(MetaIndex.GHAST_AGRESSIVE); | ||||
|     } | ||||
|  | ||||
|     public void setAggressive(boolean isAggressive) | ||||
|     { | ||||
|     public void setAggressive(boolean isAggressive) { | ||||
|         setData(MetaIndex.GHAST_AGRESSIVE, isAggressive); | ||||
|         sendData(MetaIndex.GHAST_AGRESSIVE); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -2,11 +2,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
|  | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
|  | ||||
| public class IronGolemWatcher extends InsentientWatcher | ||||
| { | ||||
|     public IronGolemWatcher(Disguise disguise) | ||||
|     { | ||||
| public class IronGolemWatcher extends InsentientWatcher { | ||||
|     public IronGolemWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -39,5 +39,4 @@ public class ItemFrameWatcher extends FlagWatcher { | ||||
|         setData(MetaIndex.ITEMFRAME_ROTATION, rotation % 4); | ||||
|         sendData(MetaIndex.ITEMFRAME_ROTATION); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -7,5 +7,4 @@ public class MuleWatcher extends ChestedHorseWatcher { | ||||
|     public MuleWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -5,38 +5,31 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import org.bukkit.Art; | ||||
|  | ||||
| public class PaintingWatcher extends FlagWatcher | ||||
| { | ||||
| public class PaintingWatcher extends FlagWatcher { | ||||
|  | ||||
|     private Art painting; | ||||
|  | ||||
|     public PaintingWatcher(Disguise disguise) | ||||
|     { | ||||
|     public PaintingWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public PaintingWatcher clone(Disguise disguise) | ||||
|     { | ||||
|     public PaintingWatcher clone(Disguise disguise) { | ||||
|         PaintingWatcher watcher = (PaintingWatcher) super.clone(disguise); | ||||
|         watcher.setArt(getArt()); | ||||
|  | ||||
|         return watcher; | ||||
|     } | ||||
|  | ||||
|     public Art getArt() | ||||
|     { | ||||
|     public Art getArt() { | ||||
|         return painting; | ||||
|     } | ||||
|  | ||||
|     public void setArt(Art newPainting) | ||||
|     { | ||||
|     public void setArt(Art newPainting) { | ||||
|         this.painting = newPainting; | ||||
|  | ||||
|         if (getDisguise().getEntity() != null && getDisguise().getWatcher() == this) | ||||
|         { | ||||
|         if (getDisguise().getEntity() != null && getDisguise().getWatcher() == this) { | ||||
|             DisguiseUtilities.refreshTrackers(getDisguise()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,21 +3,17 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
|  | ||||
| public class PolarBearWatcher extends AgeableWatcher | ||||
| { | ||||
|     public PolarBearWatcher(Disguise disguise) | ||||
|     { | ||||
| public class PolarBearWatcher extends AgeableWatcher { | ||||
|     public PolarBearWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public void setStanding(boolean standing) | ||||
|     { | ||||
|     public void setStanding(boolean standing) { | ||||
|         setData(MetaIndex.POLAR_BEAR_STANDING, standing); | ||||
|         sendData(MetaIndex.POLAR_BEAR_STANDING); | ||||
|     } | ||||
|  | ||||
|     public boolean isStanding() | ||||
|     { | ||||
|     public boolean isStanding() { | ||||
|         return getData(MetaIndex.POLAR_BEAR_STANDING); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,5 +7,4 @@ public class SkeletonHorseWatcher extends AbstractHorseWatcher { | ||||
|     public SkeletonHorseWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,21 +3,17 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
|  | ||||
| public class SpiderWatcher extends InsentientWatcher | ||||
| { | ||||
|     public SpiderWatcher(Disguise disguise) | ||||
|     { | ||||
| public class SpiderWatcher extends InsentientWatcher { | ||||
|     public SpiderWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public void setClimbing(boolean climbing) | ||||
|     { | ||||
|     public void setClimbing(boolean climbing) { | ||||
|         setData(MetaIndex.SPIDER_CLIMB, (byte) (climbing ? 1 : 0)); | ||||
|         sendData(MetaIndex.SPIDER_CLIMB); | ||||
|     } | ||||
|  | ||||
|     public boolean isClimbing() | ||||
|     { | ||||
|     public boolean isClimbing() { | ||||
|         return getData(MetaIndex.SPIDER_CLIMB) == (byte) 1; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -41,5 +41,4 @@ public class SplashPotionWatcher extends FlagWatcher { | ||||
|             DisguiseUtilities.refreshTrackers(getDisguise()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -2,10 +2,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
|  | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
|  | ||||
| public class SquidWatcher extends InsentientWatcher | ||||
| { | ||||
|     public SquidWatcher(Disguise disguise) | ||||
|     { | ||||
| public class SquidWatcher extends InsentientWatcher { | ||||
|     public SquidWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,10 +3,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.FlagWatcher; | ||||
|  | ||||
| public class TNTWatcher extends FlagWatcher | ||||
| { | ||||
|     public TNTWatcher(Disguise disguise) | ||||
|     { | ||||
| public class TNTWatcher extends FlagWatcher { | ||||
|     public TNTWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,5 +17,4 @@ public class VexWatcher extends InsentientWatcher { | ||||
|     public boolean isAngry() { | ||||
|         return getData(MetaIndex.VEX_ANGRY) == 1; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -4,23 +4,18 @@ import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.FlagWatcher; | ||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||
|  | ||||
| public class WitherSkullWatcher extends FlagWatcher | ||||
| { | ||||
| public class WitherSkullWatcher extends FlagWatcher { | ||||
|  | ||||
|     public WitherSkullWatcher(Disguise disguise) | ||||
|     { | ||||
|     public WitherSkullWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
|     public boolean isBlue() | ||||
|     { | ||||
|     public boolean isBlue() { | ||||
|         return getData(MetaIndex.WITHER_SKULL_BLUE); | ||||
|     } | ||||
|  | ||||
|     public void setBlue(boolean blue) | ||||
|     { | ||||
|     public void setBlue(boolean blue) { | ||||
|         setData(MetaIndex.WITHER_SKULL_BLUE, blue); | ||||
|         sendData(MetaIndex.WITHER_SKULL_BLUE); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -6,11 +6,9 @@ import org.bukkit.ChatColor; | ||||
|  | ||||
| import java.security.InvalidParameterException; | ||||
|  | ||||
| public class WitherWatcher extends InsentientWatcher | ||||
| { | ||||
| public class WitherWatcher extends InsentientWatcher { | ||||
|  | ||||
|     public WitherWatcher(Disguise disguise) | ||||
|     { | ||||
|     public WitherWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
| @@ -19,32 +17,25 @@ public class WitherWatcher extends InsentientWatcher | ||||
|      * | ||||
|      * @return | ||||
|      */ | ||||
|     public int getInvulnerability() | ||||
|     { | ||||
|     public int getInvulnerability() { | ||||
|         return getData(MetaIndex.WITHER_INVUL); | ||||
|     } | ||||
|  | ||||
|     public int[] getTargets() | ||||
|     { | ||||
|         return new int[] | ||||
|             { | ||||
|                     getData(MetaIndex.WITHER_TARGET_1), getData(MetaIndex.WITHER_TARGET_2), getData(MetaIndex.WITHER_TARGET_3) | ||||
|             }; | ||||
|     public int[] getTargets() { | ||||
|         return new int[]{getData(MetaIndex.WITHER_TARGET_1), getData(MetaIndex.WITHER_TARGET_2), | ||||
|                 getData(MetaIndex.WITHER_TARGET_3)}; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the amount of time this Wither is invulnerable for | ||||
|      */ | ||||
|     public void setInvulnerability(int invulnerability) | ||||
|     { | ||||
|     public void setInvulnerability(int invulnerability) { | ||||
|         setData(MetaIndex.WITHER_INVUL, invulnerability); | ||||
|         sendData(MetaIndex.WITHER_INVUL); | ||||
|     } | ||||
|  | ||||
|     public void setTargets(int... targets) | ||||
|     { | ||||
|         if (targets.length != 3) | ||||
|         { | ||||
|     public void setTargets(int... targets) { | ||||
|         if (targets.length != 3) { | ||||
|             throw new InvalidParameterException( | ||||
|                     ChatColor.RED + "Expected 3 numbers for wither setTargets. Received " + targets.length); | ||||
|         } | ||||
| @@ -53,5 +44,4 @@ public class WitherWatcher extends InsentientWatcher | ||||
|         setData(MetaIndex.WITHER_TARGET_3, targets[2]); | ||||
|         sendData(MetaIndex.WITHER_TARGET_1, MetaIndex.WITHER_TARGET_2, MetaIndex.WITHER_TARGET_3); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -7,5 +7,4 @@ public class ZombieHorseWatcher extends AbstractHorseWatcher { | ||||
|     public ZombieHorseWatcher(Disguise disguise) { | ||||
|         super(disguise); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -40,6 +40,7 @@ import org.apache.commons.lang.math.RandomUtils; | ||||
| import org.apache.logging.log4j.util.Strings; | ||||
| import org.bukkit.*; | ||||
| import org.bukkit.boss.KeyedBossBar; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.*; | ||||
| import org.bukkit.inventory.EquipmentSlot; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| @@ -280,10 +281,10 @@ public class DisguiseUtilities { | ||||
|         if (reference != null && DisguiseUtilities.addClonedDisguise(reference, disguise)) { | ||||
|             String entityName = DisguiseType.getType(toClone).toReadable(); | ||||
|  | ||||
|             player.sendMessage(LibsMsg.MADE_REF.get(entityName, reference)); | ||||
|             player.sendMessage(LibsMsg.MADE_REF_EXAMPLE.get(reference)); | ||||
|             DisguiseUtilities.sendMessage(player, LibsMsg.MADE_REF, entityName, reference); | ||||
|             DisguiseUtilities.sendMessage(player, LibsMsg.MADE_REF_EXAMPLE, reference); | ||||
|         } else { | ||||
|             player.sendMessage(LibsMsg.REF_TOO_MANY.get()); | ||||
|             DisguiseUtilities.sendMessage(player, LibsMsg.REF_TOO_MANY); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -2056,6 +2057,14 @@ public class DisguiseUtilities { | ||||
|         return Strings.isEmpty(player.getPlayerListName()) ? player.getName() : player.getPlayerListName(); | ||||
|     } | ||||
|  | ||||
|     public static void sendMessage(CommandSender sender, LibsMsg msg, Object... args) { | ||||
|         if (!NmsVersion.v1_16.isSupported()) { | ||||
|             sender.sendMessage(msg.get(args)); | ||||
|         } else { | ||||
|             sender.spigot().sendMessage(msg.getChat(args)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static Logger getLogger() { | ||||
|         return LibsDisguises.getInstance().getLogger(); | ||||
|     } | ||||
|   | ||||
| @@ -9,7 +9,8 @@ import java.lang.reflect.Type; | ||||
| /** | ||||
|  * Created by libraryaddict on 1/06/2017. | ||||
|  */ | ||||
| public class SerializerWrappedBlockData implements JsonSerializer<WrappedBlockData>, JsonDeserializer<WrappedBlockData> { | ||||
| public class SerializerWrappedBlockData implements JsonSerializer<WrappedBlockData>, | ||||
|         JsonDeserializer<WrappedBlockData> { | ||||
|  | ||||
|     @Override | ||||
|     public JsonElement serialize(WrappedBlockData src, Type typeOfSrc, JsonSerializationContext context) { | ||||
|   | ||||
| @@ -18,7 +18,7 @@ import me.libraryaddict.disguise.events.DisguiseInteractEvent; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.entity.*; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.EquipmentSlot; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
|   | ||||
| @@ -54,10 +54,8 @@ public class PacketListenerTabList extends PacketAdapter { | ||||
|  | ||||
|         if (list.isEmpty()) { | ||||
|             event.setCancelled(true); | ||||
|         } | ||||
|         else { | ||||
|         } else { | ||||
|             event.getPacket().getPlayerInfoDataLists().write(0, list); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -23,5 +23,4 @@ public class FakeBoundingBox { | ||||
|     public double getZ() { | ||||
|         return zMod / 2; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -5,5 +5,4 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile; | ||||
| public interface LibsProfileLookup { | ||||
|  | ||||
|     void onLookup(WrappedGameProfile gameProfile); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -20,5 +20,4 @@ public class LibsProfileLookupCaller implements ProfileLookupCallback { | ||||
|     public void onProfileLookupSucceeded(GameProfile profile) { | ||||
|         gameProfile = WrappedGameProfile.fromHandle(profile); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -9,7 +9,9 @@ import java.util.Map; | ||||
|  * Created by libraryaddict on 17/02/2020. | ||||
|  */ | ||||
| public interface IAsm { | ||||
|     Class<?> createClassWithoutMethods(String className, ArrayList<Map.Entry<String, String>> illegalMethods) throws IOException, InvocationTargetException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException; | ||||
|     Class<?> createClassWithoutMethods(String className, | ||||
|             ArrayList<Map.Entry<String, String>> illegalMethods) throws IOException, InvocationTargetException, | ||||
|             IllegalAccessException, NoSuchMethodException, NoSuchFieldException; | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,15 @@ | ||||
| package me.libraryaddict.disguise.utilities.translations; | ||||
|  | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.reflection.NmsVersion; | ||||
| import net.md_5.bungee.api.chat.BaseComponent; | ||||
| import net.md_5.bungee.api.chat.ComponentBuilder; | ||||
| import org.apache.commons.lang.StringUtils; | ||||
| import org.bukkit.ChatColor; | ||||
|  | ||||
| import java.util.regex.Matcher; | ||||
| import java.util.regex.Pattern; | ||||
|  | ||||
| /** | ||||
|  * Created by libraryaddict on 15/06/2017. | ||||
|  */ | ||||
| @@ -351,6 +357,15 @@ public enum LibsMsg { | ||||
|     SELF_DISGUISE_HIDDEN(ChatColor.GREEN + "Self disguise hidden as it's too tall.."); | ||||
|  | ||||
|     private final String string; | ||||
|     private static final Pattern hexColor; | ||||
|  | ||||
|     static { | ||||
|         if (NmsVersion.v1_16.isSupported()) { | ||||
|             hexColor = Pattern.compile("<#[0-9a-fA-F]{6}>"); | ||||
|         } else { | ||||
|             hexColor = null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     LibsMsg(String string) { | ||||
|         this.string = string; | ||||
| @@ -360,6 +375,35 @@ public enum LibsMsg { | ||||
|         return string; | ||||
|     } | ||||
|  | ||||
|     public BaseComponent[] getChat(Object... strings) { | ||||
|         String string = get(strings); | ||||
|  | ||||
|         if (hexColor == null) { | ||||
|             return new ComponentBuilder().appendLegacy(string).create(); | ||||
|         } | ||||
|  | ||||
|         Matcher match = hexColor.matcher(string); | ||||
|  | ||||
|         ComponentBuilder builder = new ComponentBuilder(); | ||||
|         int lastMatch = 0; | ||||
|  | ||||
|         while (match.find()) { | ||||
|             if (match.start() > lastMatch) { | ||||
|                 builder.appendLegacy(string.substring(lastMatch, match.start())); | ||||
|             } | ||||
|  | ||||
|             lastMatch = match.end(); | ||||
|  | ||||
|             builder.color(net.md_5.bungee.api.ChatColor.of(match.group().substring(1, 8))); | ||||
|         } | ||||
|  | ||||
|         if (lastMatch < string.length()) { | ||||
|             builder.appendLegacy(string.substring(lastMatch)); | ||||
|         } | ||||
|  | ||||
|         return builder.create(); | ||||
|     } | ||||
|  | ||||
|     public String get(Object... strings) { | ||||
|         if (StringUtils.countMatches(getRaw(), "%s") != strings.length) { | ||||
|             DisguiseUtilities.getLogger().severe("Mismatch in messages, incorrect parameters supplied for " + name() + | ||||
|   | ||||
| @@ -80,7 +80,7 @@ public enum TranslateType { | ||||
|         } | ||||
|  | ||||
|         if (!getFile().exists()) { | ||||
|             DisguiseUtilities.getLogger().info("Translations for " + name() + " missing! Skipping..."); | ||||
|             DisguiseUtilities.getLogger().info("Translations for " + name() + " missing! Saving.."); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -182,6 +182,7 @@ public enum TranslateType { | ||||
|                     writer.write( | ||||
|                             "# To translate, follow this example 'Original Message': 'My New Message'\n# The Original" + | ||||
|                                     " Message is used as a yaml config key to get your new message!"); | ||||
|                     writer.write("\n# To use hex color codes, use <#hexcolor> where hexcolor is the 6 char code"); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -16,8 +16,10 @@ public class DisguiseUtilitiesTest { | ||||
|         Assert.assertArrayEquals(new String[]{"Name 1\\", "Name 2"}, | ||||
|                 DisguiseUtilities.splitNewLine("Name 1\\\nName 2")); | ||||
|         Assert.assertArrayEquals(new String[]{"Name 1\\nName 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\nName 2")); | ||||
|         Assert.assertArrayEquals(new String[]{"Name 1\\","Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\\\nName 2")); | ||||
|         Assert.assertArrayEquals(new String[]{"Name 1\\\\nName 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\\\\\nName 2")); | ||||
|         Assert.assertArrayEquals(new String[]{"Name 1\\", "Name 2"}, | ||||
|                 DisguiseUtilities.splitNewLine("Name 1\\\\\\nName 2")); | ||||
|         Assert.assertArrayEquals(new String[]{"Name 1\\\\nName 2"}, | ||||
|                 DisguiseUtilities.splitNewLine("Name 1\\\\\\\\nName 2")); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
|   | ||||
		Reference in New Issue
	
	Block a user