Added in toggles for prefix, suffix, ignore, nicknames, and colors.

This commit is contained in:
nossr50 2010-12-13 13:02:12 -08:00
parent ac31addf50
commit 3c052e0f3f
2 changed files with 40 additions and 17 deletions

View File

@ -185,7 +185,7 @@ public class vMinecraftCommands{
public static int prefix(Player player, String[] args){ public static int prefix(Player player, String[] args){
//if the player can prefix others //if the player can prefix others
if(player.canUseCommand("/prefixother")){ if(player.canUseCommand("/prefixother") && vMinecraftSettings.getInstance().prefix()){
//Check if there are enough arguments //Check if there are enough arguments
if(args.length < 2){ if(args.length < 2){
@ -236,7 +236,7 @@ public class vMinecraftCommands{
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
//If the player can set their prefix //If the player can set their prefix
if(!player.canUseCommand("/prefix")){ if(!player.canUseCommand("/prefix")&& vMinecraftSettings.getInstance().prefix()){
return EXIT_FAIL; return EXIT_FAIL;
} }
@ -277,7 +277,7 @@ public class vMinecraftCommands{
public static int removeTag(Player player, String[] args){ public static int removeTag(Player player, String[] args){
//if the player can suffix others //if the player can suffix others
if(player.canUseCommand("/prefixother")){ if(player.canUseCommand("/prefixother")&& vMinecraftSettings.getInstance().prefix()){
if(args.length < 1){ if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rprefix [Player]"); + "Usage is /rprefix [Player]");
@ -308,7 +308,7 @@ public class vMinecraftCommands{
} }
//Check if the player can set their own prefix. //Check if the player can set their own prefix.
if(!player.canUseCommand("/prefix")){ if(!player.canUseCommand("/prefix")&& vMinecraftSettings.getInstance().prefix()){
return EXIT_FAIL; return EXIT_FAIL;
} }
if(args.length < 1){ if(args.length < 1){
@ -332,7 +332,7 @@ public class vMinecraftCommands{
public static int nickName(Player player, String[] args){ public static int nickName(Player player, String[] args){
//if the player can nickname others //if the player can nickname others
if(player.canUseCommand("/nickother")){ if(player.canUseCommand("/nickother") && vMinecraftSettings.getInstance().nick()){
if(args.length < 2){ if(args.length < 2){
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /nick [Player] [Name]"); + "Usage is /nick [Player] [Name]");
@ -404,7 +404,7 @@ public class vMinecraftCommands{
public static int removeNick(Player player, String[] args){ public static int removeNick(Player player, String[] args){
//if the player can nick others //if the player can nick others
if(player.canUseCommand("/nickother")){ if(player.canUseCommand("/nickother")&& vMinecraftSettings.getInstance().nick()){
if(args.length < 1){ if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rnick [Player]"); + "Usage is /rnick [Player]");
@ -435,7 +435,7 @@ public class vMinecraftCommands{
} }
//Check if the player can set their own nick. //Check if the player can set their own nick.
if(!player.canUseCommand("/nick")){ if(!player.canUseCommand("/nick")&& vMinecraftSettings.getInstance().nick()){
return EXIT_FAIL; return EXIT_FAIL;
} }
if(args.length < 1){ if(args.length < 1){
@ -459,7 +459,7 @@ public class vMinecraftCommands{
public static int suffix(Player player, String[] args){ public static int suffix(Player player, String[] args){
//if the player can suffix others //if the player can suffix others
if(player.canUseCommand("/suffixother")){ if(player.canUseCommand("/suffixother")&& vMinecraftSettings.getInstance().suffix()){
if(args.length < 2){ if(args.length < 2){
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /suffix [Player] [Name]"); + "Usage is /suffix [Player] [Name]");
@ -497,7 +497,7 @@ public class vMinecraftCommands{
} }
//Check if the player can set their own suffix. //Check if the player can set their own suffix.
if(!player.canUseCommand("/suffix")){ if(!player.canUseCommand("/suffix")&& vMinecraftSettings.getInstance().suffix()){
return EXIT_FAIL; return EXIT_FAIL;
} }
if(args.length < 1){ if(args.length < 1){
@ -529,7 +529,7 @@ public class vMinecraftCommands{
public static int removeSuffix(Player player, String[] args){ public static int removeSuffix(Player player, String[] args){
//if the player can suffix others //if the player can suffix others
if(player.canUseCommand("/suffixother")){ if(player.canUseCommand("/suffixother")&& vMinecraftSettings.getInstance().suffix()){
if(args.length < 1){ if(args.length < 1){
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "Usage is /rsuffix [Player]"); + "Usage is /rsuffix [Player]");
@ -559,7 +559,7 @@ public class vMinecraftCommands{
} }
//Check if the player can set their own suffix. //Check if the player can set their own suffix.
if(!player.canUseCommand("/suffix")){ if(!player.canUseCommand("/suffix")&& vMinecraftSettings.getInstance().suffix()){
return EXIT_FAIL; return EXIT_FAIL;
} }
if(args.length < 1){ if(args.length < 1){
@ -580,7 +580,7 @@ public class vMinecraftCommands{
//Use: Displays a list of all colors and color codes //Use: Displays a list of all colors and color codes
//===================================================================== //=====================================================================
public static int colors(Player player, String[] args){ 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]); vMinecraftUsers.getProfile(player).setColor(args[0]);
vMinecraftChat.sendMessage(player, player, "^" + args[0].charAt(0) vMinecraftChat.sendMessage(player, player, "^" + args[0].charAt(0)
@ -732,7 +732,7 @@ public class vMinecraftCommands{
public static int addIgnored(Player player, String[] args) public static int addIgnored(Player player, String[] args)
{ {
//Make sure the player gave you a user to ignore //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, vMinecraftChat.sendMessage(player, player,
Colors.Rose + "Usage: /ignore [Player]"); Colors.Rose + "Usage: /ignore [Player]");
@ -741,14 +741,14 @@ public class vMinecraftCommands{
//Find the player and make sure they exist //Find the player and make sure they exist
Player ignore = etc.getServer().matchPlayer(args[0]); Player ignore = etc.getServer().matchPlayer(args[0]);
if(ignore == null) if(ignore == null&& vMinecraftSettings.getInstance().ignore())
{ {
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "The person you tried to ignore is not logged in."); + "The person you tried to ignore is not logged in.");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if(!player.hasControlOver(ignore)) if(!player.hasControlOver(ignore)&& vMinecraftSettings.getInstance().ignore())
{ {
vMinecraftChat.sendMessage(player, player, Colors.Rose vMinecraftChat.sendMessage(player, player, Colors.Rose
+ "You can't ignore someone a higher rank than you."); + "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) public static int removeIgnored(Player player, String[] args)
{ {
//Make sure the player gave you a user to ignore //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, vMinecraftChat.sendMessage(player, player,
Colors.Rose + "Usage: /unignore [Player]"); Colors.Rose + "Usage: /unignore [Player]");
@ -794,7 +794,7 @@ public class vMinecraftCommands{
//Find the player and make sure they exist //Find the player and make sure they exist
Player ignore = etc.getServer().matchPlayer(args[0]); Player ignore = etc.getServer().matchPlayer(args[0]);
if(ignore == null) if(ignore == null&& vMinecraftSettings.getInstance().ignore())
{ {
vMinecraftChat.sendMessage(player, player, vMinecraftChat.sendMessage(player, player,
Colors.Rose + "The person you tried to unignore is not logged in."); 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) public static int ignoreList(Player player, String[] args)
{ {
if (vMinecraftSettings.getInstance().ignore()){
//Get the ignore list //Get the ignore list
String[] list = vMinecraftUsers.getProfile(player).listIgnore(); String[] list = vMinecraftUsers.getProfile(player).listIgnore();
@ -847,6 +848,8 @@ public class vMinecraftCommands{
Colors.Rose + list[i+ (page * 5)]); Colors.Rose + list[i+ (page * 5)]);
return EXIT_SUCCESS; return EXIT_SUCCESS;
}
return EXIT_FAIL;
} }
//===================================================================== //=====================================================================

View File

@ -19,6 +19,11 @@ public class vMinecraftSettings {
greentext = false, greentext = false,
FFF = false, FFF = false,
quakeColors = false, quakeColors = false,
prefix = false,
suffix = false,
ignore = false,
colors = false,
nick = false,
cmdFabulous = false, cmdFabulous = false,
cmdPromote = false, cmdPromote = false,
cmdDemote = false, cmdDemote = false,
@ -87,7 +92,12 @@ public class vMinecraftSettings {
writer.write("#Server Settings\r\n"); 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("#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("/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("/whois=true\r\n");
writer.write("/nick=true\r\n");
writer.write("/who=true\r\n"); writer.write("/who=true\r\n");
writer.write("/promote=true\r\n"); writer.write("/promote=true\r\n");
writer.write("/demote=true\r\n"); writer.write("/demote=true\r\n");
@ -132,6 +142,11 @@ public class vMinecraftSettings {
greentext = properties.getBoolean("QuotesAreGreen",true); greentext = properties.getBoolean("QuotesAreGreen",true);
FFF = properties.getBoolean("FFF",true); FFF = properties.getBoolean("FFF",true);
quakeColors = properties.getBoolean("ColoredChat",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); cmdFabulous = properties.getBoolean("/fabulous",true);
cmdPromote = properties.getBoolean("/promote",true); cmdPromote = properties.getBoolean("/promote",true);
cmdDemote = properties.getBoolean("/demote",true); cmdDemote = properties.getBoolean("/demote",true);
@ -179,6 +194,11 @@ public class vMinecraftSettings {
public boolean greentext() {return greentext;} public boolean greentext() {return greentext;}
public boolean FFF() {return FFF;} public boolean FFF() {return FFF;}
public boolean quakeColors() {return quakeColors;} 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 cmdFabulous() {return cmdFabulous;}
public boolean cmdPromote() {return cmdPromote;} public boolean cmdPromote() {return cmdPromote;}
public boolean cmdDemote() {return cmdDemote;} public boolean cmdDemote() {return cmdDemote;}