Fixed /whois, instead of if/else statements for groups it will actually return the groups as a string.

Made a few of the new commands get added to /help
Moved return true to a better spot for /whois
This commit is contained in:
nossr50 2010-10-08 22:21:38 -07:00
parent 0cd2bce459
commit 153e677faf

View File

@ -174,6 +174,7 @@ public class vminecraft extends Plugin {
} }
//Rules //Rules
if(settings.getInstance().cmdRules() && split[0].equalsIgnoreCase("/rules")) { if(settings.getInstance().cmdRules() && split[0].equalsIgnoreCase("/rules")) {
etc.getInstance().addCommand("/rules", "Displays the rules");
for (String str : settings.getInstance().getRules()) { for (String str : settings.getInstance().getRules()) {
player.sendMessage(Colors.Blue+str); player.sendMessage(Colors.Blue+str);
} }
@ -181,6 +182,7 @@ public class vminecraft extends Plugin {
} }
//Fabulous //Fabulous
if(split[0].equalsIgnoreCase("/fabulous") && settings.getInstance().cmdFabulous()) { if(split[0].equalsIgnoreCase("/fabulous") && settings.getInstance().cmdFabulous()) {
etc.getInstance().addCommand("/fabulous", "makes text SUUUPER");
if (split.length == 1) {return false;} if (split.length == 1) {return false;}
String temp = ""; String temp = "";
String str = ""; String str = "";
@ -313,11 +315,11 @@ public class vminecraft extends Plugin {
} }
//Whois will display info about a player //Whois will display info about a player
if (settings.getInstance().cmdWhoIs() && split[0].equalsIgnoreCase("/whois")) { if (settings.getInstance().cmdWhoIs() && split[0].equalsIgnoreCase("/whois")) {
etc.getInstance().addCommand("/whois", "/whois [user]");
if (split.length < 2) { if (split.length < 2) {
player.sendMessage(Colors.Rose + "Usage is /whois [player]"); player.sendMessage(Colors.Rose + "Usage is /whois [player]");
} }
String admin =""; String admin ="";
String group ="";
String ignore =""; String ignore ="";
String IP = ""; String IP = "";
Player playerTarget = null; Player playerTarget = null;
@ -329,7 +331,7 @@ public class vminecraft extends Plugin {
} }
} }
if (playerTarget != null){ if (playerTarget != null){
etc.getInstance().addCommand("/whois", "/whois [user]");
IP = playerTarget.getIP(); IP = playerTarget.getIP();
if (playerTarget.canIgnoreRestrictions()) { if (playerTarget.canIgnoreRestrictions()) {
ignore = "True"; ignore = "True";
@ -341,31 +343,26 @@ public class vminecraft extends Plugin {
} else { } else {
admin = "False"; admin = "False";
} }
if (playerTarget.isInGroup("superadmins")){
group = "superadmins";
}else if(playerTarget.isInGroup("admins")){
group = "admins";
}else if(player.isInGroup("mods")){
group = "mods";
}else if(player.isInGroup("trusted")){
group = "trusted";
}else{
group = "Default";
}
//Displaying the information //Displaying the information
player.sendMessage(Colors.Blue + "Whois results for "+split[1]+"."); player.sendMessage(Colors.Blue + "Whois results for "+split[1]+".");
//Group //Group
player.sendMessage(Colors.Blue + "Group: "+group); for (String group : playerTarget.getGroups()) {
player.sendMessage(Colors.Blue + "Groups: "+group);
}
//Admin //Admin
player.sendMessage(Colors.Blue+"Admin: "+admin); player.sendMessage(Colors.Blue+"Admin: "+admin);
//IP //IP
player.sendMessage(Colors.Blue+"IP: "+IP); player.sendMessage(Colors.Blue+"IP: "+IP);
//Restrictions //Restrictions
player.sendMessage(Colors.Blue+"Can ignore restrictions: "+ignore); player.sendMessage(Colors.Blue+"Can ignore restrictions: "+ignore);
return true;
} else { } else {
player.sendMessage(Colors.Rose+"Player not found."); player.sendMessage(Colors.Rose+"Player not found.");
} }
return true;
} }
//Say //Say
if (settings.getInstance().cmdSay() && (split[0].equalsIgnoreCase("/say"))) { if (settings.getInstance().cmdSay() && (split[0].equalsIgnoreCase("/say"))) {