Răsfoiți Sursa

Reworking messages for invalid inputs

RedstoneFuture 1 an în urmă
părinte
comite
ad6c648d63

+ 2 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommands.java

@@ -112,7 +112,8 @@ public class MWCommands extends BaseCommand {
 
         Missile missile = (Missile) game.getArena().getMissileConfiguration().getSchematicFromFileName(args[0]);
         if (missile == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE));
+            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE)
+                    .replace("%input%", args[0]));
             return;
         }
 

+ 4 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/Messages.java

@@ -89,12 +89,13 @@ public class Messages {
 
         SERVER_RESTART_AFTER_GAME("server.restart_after_game", "&7The server will restart after this game."),
 
-        COMMAND_ONLY_PLAYERS("command.only_players", "&cYou are not a player."),
+        COMMAND_ONLY_PLAYERS("command.only_players", "&cThe command can only be executed ingame by a player."),
         COMMAND_TO_MANY_ARGUMENTS("command.to_many_arguments", "&cToo many arguments."),
-        COMMAND_INVALID_MISSILE("command.invalid_missile", "&cThe specified missile was not found."),
+        COMMAND_INVALID_MISSILE("command.invalid_missile", "&cThe specified missile %input% was not found."),
+        COMMAND_INVALID_SHIELD("command.invalid_missile", "&cThe specified shield %input% was not found."),
         COMMAND_MISSILE_NEEDED("command.missile_needed", "&cPlease specify the missile."),
         COMMAND_INVALID_GAME("command.invalid_game", "&cThe specified game was not found."),
-        COMMAND_INVALID_MAP("command.invalid_map", "&cThe specified map was not found."),
+        COMMAND_INVALID_MAP("command.invalid_map", "&cThe specified map %input% was not found."),
         COMMAND_MAP_NEEDED("command.map_needed", "&cPlease specify the map."),
         COMMAND_INVALID_TEAM_NUMBER("command.invalid_team_number", "&cThe team number is invalid. Use \"1\" or \"2\" to specify the target team."),
         COMMAND_TEAM_NUMBER_NEEDED("command.team_number_needed", "&cPlease specify the team number."),

+ 4 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Game.java

@@ -638,7 +638,8 @@ public class Game {
         
         Missile missile = (Missile) this.arena.getMissileConfiguration().getSchematicFromDisplayName(itemMeta.getDisplayName());
         if (missile == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE));
+            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE)
+                    .replace("%input%", itemMeta.getDisplayName()));
             return;
         }
         
@@ -660,7 +661,8 @@ public class Game {
 
         Shield shield = (Shield) this.arena.getShieldConfiguration().getSchematicFromDisplayName(itemMeta.getDisplayName());
         if (shield == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MISSILE));
+            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_SHIELD)
+                    .replace("%input%", itemMeta.getDisplayName()));
             return;
         }
         

+ 2 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/MapVoting.java

@@ -66,7 +66,8 @@ public class MapVoting {
 
         Arena arena = Arenas.getFromName(arenaName);
         if (arena == null) {
-            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MAP));
+            player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_INVALID_MAP)
+                    .replace("%input%", arenaName));
             return;
         }