Fix the error when either of the command handlers are null, fixes #40
These errors only happen when the plugin didn't load successfully, you'll need to check further up in the console/server log to see what actually caused this error.
This commit is contained in:
parent
f57e500e70
commit
db46e7c036
@ -11,6 +11,7 @@ import com.graywolf336.jail.beans.Jail;
|
|||||||
import com.graywolf336.jail.beans.Prisoner;
|
import com.graywolf336.jail.beans.Prisoner;
|
||||||
import com.graywolf336.jail.command.CommandHandler;
|
import com.graywolf336.jail.command.CommandHandler;
|
||||||
import com.graywolf336.jail.command.JailHandler;
|
import com.graywolf336.jail.command.JailHandler;
|
||||||
|
import com.graywolf336.jail.enums.Lang;
|
||||||
import com.graywolf336.jail.enums.Settings;
|
import com.graywolf336.jail.enums.Settings;
|
||||||
import com.graywolf336.jail.legacy.LegacyManager;
|
import com.graywolf336.jail.legacy.LegacyManager;
|
||||||
import com.graywolf336.jail.listeners.BlockListener;
|
import com.graywolf336.jail.listeners.BlockListener;
|
||||||
@ -171,11 +172,16 @@ public class JailMain extends JavaPlugin {
|
|||||||
* Send the command off to the CommandHandler class, that way this main class doesn't get clogged up.
|
* Send the command off to the CommandHandler class, that way this main class doesn't get clogged up.
|
||||||
*/
|
*/
|
||||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||||
|
if(jh == null || cmdHand == null) {
|
||||||
|
sender.sendMessage(Lang.PLUGINNOTLOADED.get());
|
||||||
|
getServer().getConsoleSender().sendMessage(Lang.PLUGINNOTLOADED.get());
|
||||||
|
}else {
|
||||||
if(commandLabel.equalsIgnoreCase("jail") || commandLabel.equalsIgnoreCase("j")) {
|
if(commandLabel.equalsIgnoreCase("jail") || commandLabel.equalsIgnoreCase("j")) {
|
||||||
jh.parseCommand(jm, sender, args);
|
jh.parseCommand(jm, sender, args);
|
||||||
}else {
|
}else {
|
||||||
cmdHand.handleCommand(jm, sender, command.getName().toLowerCase(), args);
|
cmdHand.handleCommand(jm, sender, command.getName().toLowerCase(), args);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;//Always return true here, that way we can handle the help and command usage ourself.
|
return true;//Always return true here, that way we can handle the help and command usage ourself.
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,8 @@ public enum Lang {
|
|||||||
PLAYERNOTONLINE("general"),
|
PLAYERNOTONLINE("general"),
|
||||||
/** The message sent to the sender when the plugin data has been reloaded. */
|
/** The message sent to the sender when the plugin data has been reloaded. */
|
||||||
PLUGINRELOADED("general"),
|
PLUGINRELOADED("general"),
|
||||||
|
/** The message sent to the sender of a command when the plugin didn't start correct. */
|
||||||
|
PLUGINNOTLOADED("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 format we should use when entering a record into flatfile or showing it. */
|
/** The format we should use when entering a record into flatfile or showing it. */
|
||||||
|
@ -32,6 +32,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!'
|
||||||
|
pluginnotloaded: '&cThe plugin did not load correctly, tell the administrator to check the console for errors.'
|
||||||
pluginreloaded: '&9Jail data successfully reloaded.'
|
pluginreloaded: '&9Jail data successfully reloaded.'
|
||||||
prisonerscleared: '&cAll the prisoners from %0% have been cleared.'
|
prisonerscleared: '&cAll the prisoners from %0% have been cleared.'
|
||||||
recordentry: '&7[%0%]: &9%1% &fjailed by &9%2% &ffor &9%3% &fminutes with a reason of &9%4%&f. [%5%]'
|
recordentry: '&7[%0%]: &9%1% &fjailed by &9%2% &ffor &9%3% &fminutes with a reason of &9%4%&f. [%5%]'
|
||||||
|
Loading…
Reference in New Issue
Block a user