diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index adc264b4d..599f05a3b 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -185,7 +185,7 @@ public class vMinecraftCommands{ public static int prefix(Player player, String[] args){ //if the player can prefix others - if(player.canUseCommand("/prefixother")){ + if(player.canUseCommand("/prefixother") && vMinecraftSettings.getInstance().prefix()){ //Check if there are enough arguments if(args.length < 2){ @@ -236,7 +236,7 @@ public class vMinecraftCommands{ return EXIT_SUCCESS; } //If the player can set their prefix - if(!player.canUseCommand("/prefix")){ + if(!player.canUseCommand("/prefix")&& vMinecraftSettings.getInstance().prefix()){ return EXIT_FAIL; } @@ -277,7 +277,7 @@ public class vMinecraftCommands{ public static int removeTag(Player player, String[] args){ //if the player can suffix others - if(player.canUseCommand("/prefixother")){ + if(player.canUseCommand("/prefixother")&& vMinecraftSettings.getInstance().prefix()){ if(args.length < 1){ vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /rprefix [Player]"); @@ -308,7 +308,7 @@ public class vMinecraftCommands{ } //Check if the player can set their own prefix. - if(!player.canUseCommand("/prefix")){ + if(!player.canUseCommand("/prefix")&& vMinecraftSettings.getInstance().prefix()){ return EXIT_FAIL; } if(args.length < 1){ @@ -332,7 +332,7 @@ public class vMinecraftCommands{ public static int nickName(Player player, String[] args){ //if the player can nickname others - if(player.canUseCommand("/nickother")){ + if(player.canUseCommand("/nickother") && vMinecraftSettings.getInstance().nick()){ if(args.length < 2){ vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /nick [Player] [Name]"); @@ -404,7 +404,7 @@ public class vMinecraftCommands{ public static int removeNick(Player player, String[] args){ //if the player can nick others - if(player.canUseCommand("/nickother")){ + if(player.canUseCommand("/nickother")&& vMinecraftSettings.getInstance().nick()){ if(args.length < 1){ vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /rnick [Player]"); @@ -435,7 +435,7 @@ public class vMinecraftCommands{ } //Check if the player can set their own nick. - if(!player.canUseCommand("/nick")){ + if(!player.canUseCommand("/nick")&& vMinecraftSettings.getInstance().nick()){ return EXIT_FAIL; } if(args.length < 1){ @@ -459,7 +459,7 @@ public class vMinecraftCommands{ public static int suffix(Player player, String[] args){ //if the player can suffix others - if(player.canUseCommand("/suffixother")){ + if(player.canUseCommand("/suffixother")&& vMinecraftSettings.getInstance().suffix()){ if(args.length < 2){ vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /suffix [Player] [Name]"); @@ -497,7 +497,7 @@ public class vMinecraftCommands{ } //Check if the player can set their own suffix. - if(!player.canUseCommand("/suffix")){ + if(!player.canUseCommand("/suffix")&& vMinecraftSettings.getInstance().suffix()){ return EXIT_FAIL; } if(args.length < 1){ @@ -529,7 +529,7 @@ public class vMinecraftCommands{ public static int removeSuffix(Player player, String[] args){ //if the player can suffix others - if(player.canUseCommand("/suffixother")){ + if(player.canUseCommand("/suffixother")&& vMinecraftSettings.getInstance().suffix()){ if(args.length < 1){ vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /rsuffix [Player]"); @@ -559,7 +559,7 @@ public class vMinecraftCommands{ } //Check if the player can set their own suffix. - if(!player.canUseCommand("/suffix")){ + if(!player.canUseCommand("/suffix")&& vMinecraftSettings.getInstance().suffix()){ return EXIT_FAIL; } if(args.length < 1){ @@ -580,7 +580,7 @@ public class vMinecraftCommands{ //Use: Displays a list of all colors and color codes //===================================================================== public static int colors(Player player, String[] args){ - if(args.length > 0) + if(args.length > 0&& vMinecraftSettings.getInstance().colors()) { vMinecraftUsers.getProfile(player).setColor(args[0]); vMinecraftChat.sendMessage(player, player, "^" + args[0].charAt(0) @@ -732,7 +732,7 @@ public class vMinecraftCommands{ public static int addIgnored(Player player, String[] args) { //Make sure the player gave you a user to ignore - if(args.length < 1) + if(args.length < 1 && vMinecraftSettings.getInstance().ignore()) { vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage: /ignore [Player]"); @@ -741,14 +741,14 @@ public class vMinecraftCommands{ //Find the player and make sure they exist Player ignore = etc.getServer().matchPlayer(args[0]); - if(ignore == null) + if(ignore == null&& vMinecraftSettings.getInstance().ignore()) { vMinecraftChat.sendMessage(player, player, Colors.Rose + "The person you tried to ignore is not logged in."); return EXIT_SUCCESS; } - if(!player.hasControlOver(ignore)) + if(!player.hasControlOver(ignore)&& vMinecraftSettings.getInstance().ignore()) { vMinecraftChat.sendMessage(player, player, Colors.Rose + "You can't ignore someone a higher rank than you."); @@ -785,7 +785,7 @@ public class vMinecraftCommands{ public static int removeIgnored(Player player, String[] args) { //Make sure the player gave you a user to ignore - if(args.length < 1) + if(args.length < 1&& vMinecraftSettings.getInstance().ignore()) { vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage: /unignore [Player]"); @@ -794,7 +794,7 @@ public class vMinecraftCommands{ //Find the player and make sure they exist Player ignore = etc.getServer().matchPlayer(args[0]); - if(ignore == null) + if(ignore == null&& vMinecraftSettings.getInstance().ignore()) { vMinecraftChat.sendMessage(player, player, Colors.Rose + "The person you tried to unignore is not logged in."); @@ -822,6 +822,7 @@ public class vMinecraftCommands{ //===================================================================== public static int ignoreList(Player player, String[] args) { + if (vMinecraftSettings.getInstance().ignore()){ //Get the ignore list String[] list = vMinecraftUsers.getProfile(player).listIgnore(); @@ -847,6 +848,8 @@ public class vMinecraftCommands{ Colors.Rose + list[i+ (page * 5)]); return EXIT_SUCCESS; + } + return EXIT_FAIL; } //===================================================================== diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index 1fb7a28a9..baeeebb7b 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -19,6 +19,11 @@ public class vMinecraftSettings { greentext = false, FFF = false, quakeColors = false, + prefix = false, + suffix = false, + ignore = false, + colors = false, + nick = false, cmdFabulous = false, cmdPromote = false, cmdDemote = false, @@ -87,7 +92,12 @@ public class vMinecraftSettings { writer.write("#Server Settings\r\n"); writer.write("#Enables or Disables the following commands, give groups/users permissions to use these commands for them to work\r\n"); writer.write("/fabulous=true\r\n"); + writer.write("/prefix=true\r\n"); + writer.write("/suffix=true\r\n"); + writer.write("/ignore=true\r\n"); + writer.write("/colors=true\r\n"); writer.write("/whois=true\r\n"); + writer.write("/nick=true\r\n"); writer.write("/who=true\r\n"); writer.write("/promote=true\r\n"); writer.write("/demote=true\r\n"); @@ -132,6 +142,11 @@ public class vMinecraftSettings { greentext = properties.getBoolean("QuotesAreGreen",true); FFF = properties.getBoolean("FFF",true); quakeColors = properties.getBoolean("ColoredChat",true); + prefix = properties.getBoolean("prefix",true); + suffix = properties.getBoolean("suffix",true); + ignore = properties.getBoolean("ignore",true); + colors = properties.getBoolean("colors",true); + nick = properties.getBoolean("nick",true); cmdFabulous = properties.getBoolean("/fabulous",true); cmdPromote = properties.getBoolean("/promote",true); cmdDemote = properties.getBoolean("/demote",true); @@ -179,6 +194,11 @@ public class vMinecraftSettings { public boolean greentext() {return greentext;} public boolean FFF() {return FFF;} public boolean quakeColors() {return quakeColors;} + public boolean prefix() {return prefix;} + public boolean suffix() {return suffix;} + public boolean ignore() {return ignore;} + public boolean colors() {return colors;} + public boolean nick() {return nick;} public boolean cmdFabulous() {return cmdFabulous;} public boolean cmdPromote() {return cmdPromote;} public boolean cmdDemote() {return cmdDemote;}