Everything currently implemented is now toggle-able

This commit is contained in:
nossr50 2010-10-08 21:15:57 -07:00
parent 929c56b395
commit 0cd2bce459
2 changed files with 58 additions and 8 deletions

View File

@ -17,6 +17,11 @@ public class settings {
private boolean cmdPromote = false; private boolean cmdPromote = false;
private boolean cmdDemote = false; private boolean cmdDemote = false;
private boolean cmdWhoIs = false; private boolean cmdWhoIs = false;
private boolean cmdRules = false;
private boolean cmdTp = false;
private boolean cmdTphere = false;
private boolean globalmessages = false;
private boolean cmdSay = false;
private PropertiesFile properties; private PropertiesFile properties;
String file = "vminecraft.properties"; String file = "vminecraft.properties";
public String rules[] = null; public String rules[] = null;
@ -55,6 +60,46 @@ public void rules() {
} }
else adminChat = false; else adminChat = false;
} }
if(split[0].equalsIgnoreCase("cmdTp"))
{
if(split[1].equalsIgnoreCase("true"))
{
cmdTp = true;
}
else cmdTp = false;
}
if(split[0].equalsIgnoreCase("cmdTphere"))
{
if(split[1].equalsIgnoreCase("true"))
{
cmdTphere = true;
}
else cmdTphere = false;
}
if(split[0].equalsIgnoreCase("globalmessages"))
{
if(split[1].equalsIgnoreCase("true"))
{
globalmessages = true;
}
else globalmessages = false;
}
if(split[0].equalsIgnoreCase("cmdSay"))
{
if(split[1].equalsIgnoreCase("true"))
{
cmdSay = true;
}
else cmdSay = false;
}
if(split[0].equalsIgnoreCase("cmdRules"))
{
if(split[1].equalsIgnoreCase("true"))
{
cmdRules = true;
}
else cmdRules = false;
}
if(split[0].equalsIgnoreCase("Greentext")) if(split[0].equalsIgnoreCase("Greentext"))
{ {
if(split[1].equalsIgnoreCase("true")) if(split[1].equalsIgnoreCase("true"))
@ -128,6 +173,11 @@ public void rules() {
public boolean cmdPromote() {return cmdPromote;} public boolean cmdPromote() {return cmdPromote;}
public boolean cmdDemote() {return cmdDemote;} public boolean cmdDemote() {return cmdDemote;}
public boolean cmdWhoIs() {return cmdWhoIs;} public boolean cmdWhoIs() {return cmdWhoIs;}
public boolean cmdTp() {return cmdTp;}
public boolean cmdTphere() {return cmdTphere;}
public boolean cmdSay() {return cmdSay;}
public boolean cmdRules() {return cmdRules;}
public boolean globalmessages() {return globalmessages;}
public static settings getInstance() { public static settings getInstance() {
if (instance == null) { if (instance == null) {

View File

@ -93,7 +93,7 @@ public class vminecraft extends Plugin {
return false; return false;
} }
//Replacement for /tp //Replacement for /tp
if(split[0].equalsIgnoreCase("/tp")) { if(settings.getInstance().cmdTp() && split[0].equalsIgnoreCase("/tp")) {
{ {
if (split.length < 2) { if (split.length < 2) {
player.sendMessage(Colors.Rose + "Correct usage is: /tp [player]"); player.sendMessage(Colors.Rose + "Correct usage is: /tp [player]");
@ -123,7 +123,7 @@ public class vminecraft extends Plugin {
} }
} }
//Replacement for /tphere //Replacement for /tphere
if ((split[0].equalsIgnoreCase("/tphere") || split[0].equalsIgnoreCase("/s"))) { if (settings.getInstance().cmdTphere() && (split[0].equalsIgnoreCase("/tphere") || split[0].equalsIgnoreCase("/s"))) {
if (split.length < 2) { if (split.length < 2) {
player.sendMessage(Colors.Rose + "Correct usage is: /tphere [player]"); player.sendMessage(Colors.Rose + "Correct usage is: /tphere [player]");
return true; return true;
@ -148,32 +148,32 @@ public class vminecraft extends Plugin {
} }
} }
//Global messages that should only parse when a command can be successful //Global messages that should only parse when a command can be successful
if(split[0].equalsIgnoreCase("/kick")) { if(settings.getInstance().globalmessages() && split[0].equalsIgnoreCase("/kick")) {
Player playerTarget = etc.getServer().matchPlayer(split[1]); Player playerTarget = etc.getServer().matchPlayer(split[1]);
if (playerTarget != null && !playerTarget.hasControlOver(player)) { if (playerTarget != null && !playerTarget.hasControlOver(player)) {
other.gmsg(player.getColor()+player.getName()+Colors.Blue+" has kicked "+Colors.Red+playerTarget.getColor()+playerTarget.getName()); other.gmsg(player.getColor()+player.getName()+Colors.Blue+" has kicked "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
} }
} }
if(split[0].equalsIgnoreCase("/ban")) { if(settings.getInstance().globalmessages() && split[0].equalsIgnoreCase("/ban")) {
Player playerTarget = etc.getServer().matchPlayer(split[1]); Player playerTarget = etc.getServer().matchPlayer(split[1]);
if (playerTarget != null && !playerTarget.hasControlOver(player)) { if (playerTarget != null && !playerTarget.hasControlOver(player)) {
other.gmsg(player.getColor()+player.getName()+Colors.Blue+" has banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName()); other.gmsg(player.getColor()+player.getName()+Colors.Blue+" has banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
} }
} }
if(split[0].equalsIgnoreCase("/ipban")) { if(settings.getInstance().globalmessages() && split[0].equalsIgnoreCase("/ipban")) {
Player playerTarget = etc.getServer().matchPlayer(split[1]); Player playerTarget = etc.getServer().matchPlayer(split[1]);
if (playerTarget != null && !playerTarget.hasControlOver(player)) { if (playerTarget != null && !playerTarget.hasControlOver(player)) {
other.gmsg(player.getColor()+player.getName()+Colors.Blue+" has IP banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName()); other.gmsg(player.getColor()+player.getName()+Colors.Blue+" has IP banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
} }
} }
if(split[0].equalsIgnoreCase("/time")) { if(settings.getInstance().globalmessages() && split[0].equalsIgnoreCase("/time")) {
if (split.length <= 2) { if (split.length <= 2) {
other.gmsg(Colors.Blue+"Time changes thanks to "+player.getColor()+player.getName()); other.gmsg(Colors.Blue+"Time changes thanks to "+player.getColor()+player.getName());
return false; return false;
} }
} }
//Rules //Rules
if(split[0].equalsIgnoreCase("/rules")) { if(settings.getInstance().cmdRules() && split[0].equalsIgnoreCase("/rules")) {
for (String str : settings.getInstance().getRules()) { for (String str : settings.getInstance().getRules()) {
player.sendMessage(Colors.Blue+str); player.sendMessage(Colors.Blue+str);
} }
@ -368,7 +368,7 @@ public class vminecraft extends Plugin {
} }
} }
//Say //Say
if (split[0].equalsIgnoreCase("/say")) { if (settings.getInstance().cmdSay() && (split[0].equalsIgnoreCase("/say"))) {
String sayan; String sayan;
sayan = etc.combineSplit(1, split, " "); sayan = etc.combineSplit(1, split, " ");
other.gmsg(Colors.Yellow+sayan); other.gmsg(Colors.Yellow+sayan);