More language strings, focused this time on the command handler.

This commit is contained in:
graywolf336 2014-01-17 14:34:12 -06:00
parent 976149743a
commit 759df05bdd
3 changed files with 16 additions and 6 deletions

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
import com.graywolf336.jail.JailMain; import com.graywolf336.jail.JailMain;
import com.graywolf336.jail.JailManager; import com.graywolf336.jail.JailManager;
import com.graywolf336.jail.command.commands.CellCreateCommand; import com.graywolf336.jail.command.commands.CellCreateCommand;
import com.graywolf336.jail.command.commands.HandCuffCommand; import com.graywolf336.jail.command.commands.HandCuffCommand;
import com.graywolf336.jail.command.commands.JailCheckCommand; 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.JailVersionCommand;
import com.graywolf336.jail.command.commands.UnHandCuffCommand; import com.graywolf336.jail.command.commands.UnHandCuffCommand;
import com.graywolf336.jail.command.commands.UnjailCommand; import com.graywolf336.jail.command.commands.UnjailCommand;
import com.graywolf336.jail.enums.LangString;
/** /**
* Where all the commands are registered at and handled, processed, at. * Where all the commands are registered at and handled, processed, at.
@ -68,7 +68,7 @@ public class CommandHandler {
List<Command> matches = getMatches(command); List<Command> matches = getMatches(command);
if(matches.size() == 0) { if(matches.size() == 0) {
sender.sendMessage("No commands registered by the name of " + command + "."); sender.sendMessage(jailmanager.getPlugin().getJailIO().getLanguageString(LangString.UNKNOWNCOMMAND, command));
return; return;
} }
@ -83,13 +83,13 @@ public class CommandHandler {
// First, let's check if the sender has permission for the command. // First, let's check if the sender has permission for the command.
if(!sender.hasPermission(i.permission())) { 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; return;
} }
// Next, let's check if we need a player and then if the sender is actually a player // Next, let's check if we need a player and then if the sender is actually a player
if(i.needsPlayer() && !(sender instanceof 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; return;
} }

View File

@ -24,8 +24,9 @@ public enum LangString {
//Handcuffing section //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"), CANTBEHANDCUFFED ("handcuffing"),
/** The message sent to the sender whenever they try to handcuff someone who is in jail. */
CURRENTLYJAILEDHANDCUFF ("handcuffing", "currentlyjailed"), CURRENTLYJAILEDHANDCUFF ("handcuffing", "currentlyjailed"),
/** The message sent to the sender when the player doesn't have any handcuffs. */ /** The message sent to the sender when the player doesn't have any handcuffs. */
NOTHANDCUFFED ("handcuffing"), NOTHANDCUFFED ("handcuffing"),
@ -40,8 +41,14 @@ public enum LangString {
//General section, used by different parts //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. */ /** 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; private String section, name;

View File

@ -1,5 +1,8 @@
language: language:
general: 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!' playernotonline: '&cThat player is not online!'
jailing: jailing:
afkkickmessage: '&cYou can not be afk while being jailed.' afkkickmessage: '&cYou can not be afk while being jailed.'