diff --git a/src/main/java/com/graywolf336/jail/command/CommandHandler.java b/src/main/java/com/graywolf336/jail/command/CommandHandler.java index 520c55a..cd74b41 100644 --- a/src/main/java/com/graywolf336/jail/command/CommandHandler.java +++ b/src/main/java/com/graywolf336/jail/command/CommandHandler.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; import com.graywolf336.jail.JailMain; import com.graywolf336.jail.JailManager; - import com.graywolf336.jail.command.commands.CellCreateCommand; import com.graywolf336.jail.command.commands.HandCuffCommand; import com.graywolf336.jail.command.commands.JailCheckCommand; @@ -24,6 +23,7 @@ import com.graywolf336.jail.command.commands.JailStopCommand; import com.graywolf336.jail.command.commands.JailVersionCommand; import com.graywolf336.jail.command.commands.UnHandCuffCommand; import com.graywolf336.jail.command.commands.UnjailCommand; +import com.graywolf336.jail.enums.LangString; /** * Where all the commands are registered at and handled, processed, at. @@ -68,7 +68,7 @@ public class CommandHandler { List matches = getMatches(command); if(matches.size() == 0) { - sender.sendMessage("No commands registered by the name of " + command + "."); + sender.sendMessage(jailmanager.getPlugin().getJailIO().getLanguageString(LangString.UNKNOWNCOMMAND, command)); return; } @@ -83,13 +83,13 @@ public class CommandHandler { // First, let's check if the sender has permission for the command. if(!sender.hasPermission(i.permission())) { - sender.sendMessage("No permission to use that command.");//TODO: Make this configurable + sender.sendMessage(jailmanager.getPlugin().getJailIO().getLanguageString(LangString.NOPERMISSION)); return; } // Next, let's check if we need a player and then if the sender is actually a player if(i.needsPlayer() && !(sender instanceof Player)) { - sender.sendMessage("A player context is required for this command."); + sender.sendMessage(jailmanager.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED)); return; } diff --git a/src/main/java/com/graywolf336/jail/enums/LangString.java b/src/main/java/com/graywolf336/jail/enums/LangString.java index f9e9185..ab75046 100644 --- a/src/main/java/com/graywolf336/jail/enums/LangString.java +++ b/src/main/java/com/graywolf336/jail/enums/LangString.java @@ -24,8 +24,9 @@ public enum LangString { //Handcuffing section - /** The message setnt to the sender when trying to handcuff someone who can't be. */ + /** The message sent to the sender when trying to handcuff someone who can't be. */ CANTBEHANDCUFFED ("handcuffing"), + /** The message sent to the sender whenever they try to handcuff someone who is in jail. */ CURRENTLYJAILEDHANDCUFF ("handcuffing", "currentlyjailed"), /** The message sent to the sender when the player doesn't have any handcuffs. */ NOTHANDCUFFED ("handcuffing"), @@ -40,8 +41,14 @@ public enum LangString { //General section, used by different parts + /** The message sent whenever the sender/player doesn't have permission. */ + NOPERMISSION ("general"), + /** The message sent whenever something is done that needs a player but doesn't have it. */ + PLAYERCONTEXTREQUIRED ("general"), /** The message sent whenever an online player is required but not found. */ - PLAYERNOTONLINE ("general"); + PLAYERNOTONLINE ("general"), + /** The message sent whenever someone does a command we don't know. */ + UNKNOWNCOMMAND ("general"); private String section, name; diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index effd768..7721e49 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -1,5 +1,8 @@ language: general: + unknowncommand: '&cNo commands registered by the name of %0%.' + nopermission: '&cInsufficient permission.' + playercontextrequired: '&cA player context is required for this.' playernotonline: '&cThat player is not online!' jailing: afkkickmessage: '&cYou can not be afk while being jailed.'