Fix some of the commands not working, let's hope this doesn't mess up.

This commit is contained in:
graywolf336 2014-01-30 14:29:26 -06:00
parent f4e735eda4
commit bfebd6e944
3 changed files with 20 additions and 20 deletions

View File

@ -18,19 +18,19 @@ import com.graywolf336.jail.enums.LangString;
public class JailMuteCommand implements Command { public class JailMuteCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
//Let's check if the player they're sending us is jailed //Let's check if the player they're sending us is jailed
if(jm.isPlayerJailed(args[0])) { if(jm.isPlayerJailed(args[1])) {
//They are, so let's toggle whether they are muted or not //They are, so let's toggle whether they are muted or not
boolean muted = !jm.getPrisoner(args[0]).isMuted(); boolean muted = !jm.getPrisoner(args[1]).isMuted();
jm.getPrisoner(args[0]).setMuted(muted); jm.getPrisoner(args[1]).setMuted(muted);
//Send the message to the sender based upon whether they are muted or unmuted //Send the message to the sender based upon whether they are muted or unmuted
if(muted) if(muted)
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWMUTED, args[0])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWMUTED, args[1]));
else else
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWUNMUTED, args[0])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWUNMUTED, args[1]));
}else { }else {
//The player provided is not jailed, so let's tell the sender that //The player provided is not jailed, so let's tell the sender that
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOTJAILED, args[0])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOTJAILED, args[1]));
} }
return true; return true;

View File

@ -19,30 +19,30 @@ import com.graywolf336.jail.enums.LangString;
) )
public class JailTeleInCommand implements Command { public class JailTeleInCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
Jail j = jm.getJail(args[0]); Jail j = jm.getJail(args[1]);
//The jail doesn't exist //The jail doesn't exist
if(j == null) { if(j == null) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[0])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[1]));
}else { }else {
//The jail does exist //The jail does exist
//now let's check the size of the command //now let's check the size of the command
//if it has two args then someone is sending someone else in //if it has two args then someone is sending someone else in
//otherwise it is just the sender going in //otherwise it is just the sender going in
if(args.length == 2) { if(args.length == 3) {
Player p = jm.getPlugin().getServer().getPlayer(args[1]); Player p = jm.getPlugin().getServer().getPlayer(args[2]);
//If the player they're trying to send is offline, don't do anything //If the player they're trying to send is offline, don't do anything
if(p == null) { if(p == null) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE, args[1])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE, args[2]));
}else { }else {
p.teleport(j.getTeleportIn()); p.teleport(j.getTeleportIn());
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEIN, new String[] { args[1], args[0] })); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEIN, new String[] { args[2], args[1] }));
} }
}else { }else {
if(sender instanceof Player) { if(sender instanceof Player) {
((Player) sender).teleport(j.getTeleportIn()); ((Player) sender).teleport(j.getTeleportIn());
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEIN, new String[] { sender.getName(), args[0] })); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEIN, new String[] { sender.getName(), args[1] }));
}else { }else {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED)); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED));
} }

View File

@ -19,30 +19,30 @@ import com.graywolf336.jail.enums.LangString;
) )
public class JailTeleOutCommand implements Command { public class JailTeleOutCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
Jail j = jm.getJail(args[0]); Jail j = jm.getJail(args[1]);
//The jail doesn't exist //The jail doesn't exist
if(j == null) { if(j == null) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[0])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[1]));
}else { }else {
//The jail does exist //The jail does exist
//now let's check the size of the command //now let's check the size of the command
//if it has two args then someone is sending someone else in //if it has two args then someone is sending someone else in
//otherwise it is just the sender going in //otherwise it is just the sender going in
if(args.length == 2) { if(args.length == 3) {
Player p = jm.getPlugin().getServer().getPlayer(args[1]); Player p = jm.getPlugin().getServer().getPlayer(args[2]);
//If the player they're trying to send is offline, don't do anything //If the player they're trying to send is offline, don't do anything
if(p == null) { if(p == null) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE, args[1])); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE, args[2]));
}else { }else {
p.teleport(j.getTeleportFree()); p.teleport(j.getTeleportFree());
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEOUT, new String[] { args[1], args[0] })); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEOUT, new String[] { args[2], args[1] }));
} }
}else { }else {
if(sender instanceof Player) { if(sender instanceof Player) {
((Player) sender).teleport(j.getTeleportFree()); ((Player) sender).teleport(j.getTeleportFree());
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEOUT, new String[] { sender.getName(), args[0] })); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEOUT, new String[] { sender.getName(), args[1] }));
}else { }else {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED)); sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED));
} }