Add the JailReload command.

This commit is contained in:
graywolf336 2014-01-23 18:05:35 -06:00
parent 010b592fb5
commit e0dc22dfec
4 changed files with 32 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import com.graywolf336.jail.command.commands.JailCreateCommand;
import com.graywolf336.jail.command.commands.JailListCellsCommand; import com.graywolf336.jail.command.commands.JailListCellsCommand;
import com.graywolf336.jail.command.commands.JailListCommand; import com.graywolf336.jail.command.commands.JailListCommand;
import com.graywolf336.jail.command.commands.JailMuteCommand; import com.graywolf336.jail.command.commands.JailMuteCommand;
import com.graywolf336.jail.command.commands.JailReloadCommand;
import com.graywolf336.jail.command.commands.JailRemoveCellCommand; import com.graywolf336.jail.command.commands.JailRemoveCellCommand;
import com.graywolf336.jail.command.commands.JailStopCommand; import com.graywolf336.jail.command.commands.JailStopCommand;
import com.graywolf336.jail.command.commands.JailTeleInCommand; import com.graywolf336.jail.command.commands.JailTeleInCommand;
@ -160,6 +161,7 @@ public class CommandHandler {
load(JailListCellsCommand.class); load(JailListCellsCommand.class);
load(JailListCommand.class); load(JailListCommand.class);
load(JailMuteCommand.class); load(JailMuteCommand.class);
load(JailReloadCommand.class);
load(JailRemoveCellCommand.class); load(JailRemoveCellCommand.class);
load(JailStopCommand.class); load(JailStopCommand.class);
load(JailTeleInCommand.class); load(JailTeleInCommand.class);

View File

@ -0,0 +1,27 @@
package com.graywolf336.jail.command.commands;
import org.bukkit.command.CommandSender;
import com.graywolf336.jail.JailManager;
import com.graywolf336.jail.command.Command;
import com.graywolf336.jail.command.CommandInfo;
import com.graywolf336.jail.enums.LangString;
@CommandInfo(
maxArgs = 0,
minimumArgs = 0,
needsPlayer = false,
pattern = "jailreload",
permission = "jail.command.jailreload",
usage = "/jailreload"
)
public class JailReloadCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) {
jm.getPlugin().reloadConfig();
jm.getPlugin().getJailIO().loadLanguage();
jm.getPlugin().getJailIO().loadJails();
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLUGINRELOADED));
return true;
}
}

View File

@ -112,6 +112,8 @@ public enum LangString {
PLAYERCONTEXTREQUIRED ("general"), 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 to the sender when the plugin data has been reloaded. */
PLUGINRELOADED ("general"),
/** The message sent whenever the prisoners are cleared from jail(s). */ /** The message sent whenever the prisoners are cleared from jail(s). */
PRISONERSCLEARED ("general"), PRISONERSCLEARED ("general"),
/** The message sent whenever someone does a command we don't know. */ /** The message sent whenever someone does a command we don't know. */

View File

@ -19,6 +19,7 @@ language:
numberformatincorrect: '&cNumber format is incorrect.' numberformatincorrect: '&cNumber format is incorrect.'
playercontextrequired: '&cA player context is required for this.' playercontextrequired: '&cA player context is required for this.'
playernotonline: '&cThat player is not online!' playernotonline: '&cThat player is not online!'
pluginreloaded: '&9Jail data successfully reloaded.'
prisonerscleared: '&cAll the prisoners from %0% have been cleared.' prisonerscleared: '&cAll the prisoners from %0% have been cleared.'
unknowncommand: '&cNo commands registered by the name of %0%.' unknowncommand: '&cNo commands registered by the name of %0%.'
jailing: jailing: