From a2027ec9914ac241f4c45d978113ba8fda2af180 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 7 Dec 2010 23:57:32 -0800 Subject: [PATCH 1/4] Antigriefs should be working now, it will check the sorrounding blocks to see if any of them are blocks that fire is not allowed to spread to. Also commented out if statement on announcements to see if it was bugged or not. Added in /colors command so players can see all the colors they can use. --- vMinecraftAnnouncements.java | 6 +++--- vMinecraftCommands.java | 14 +++++++++++++- vMinecraftListener.java | 13 ++++++++++++- vMinecraftSettings.java | 10 +++++----- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/vMinecraftAnnouncements.java b/vMinecraftAnnouncements.java index ccaca4bf4..2a51a1026 100644 --- a/vMinecraftAnnouncements.java +++ b/vMinecraftAnnouncements.java @@ -20,8 +20,8 @@ public class vMinecraftAnnouncements extends vMinecraftCommands{ return false; } //Only run if the global message feature is enabled - if(vMinecraftSettings.getInstance().globalmessages()) - { + //if(vMinecraftSettings.getInstance().globalmessages()) + //{ //Global messages that should only parse when a command can be successful if(split[0].equalsIgnoreCase("/kick")) { Player playerTarget = etc.getServer().matchPlayer(split[1]); @@ -52,7 +52,7 @@ public class vMinecraftAnnouncements extends vMinecraftCommands{ vMinecraftChat.gmsg(player, player.getName() + Colors.Blue+" has teleported to " + etc.getServer().getPlayer(split[1]).getName()); } } - } + //} return true; } diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index b496223bb..216e97274 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -29,6 +29,7 @@ public class vMinecraftCommands{ public static void loadCommands(){ //If we had commands we would add them here. cl.register("/tp", "teleport"); + cl.register("/colors", "colors"); cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); cl.register("/reload", "reload"); cl.register("/rules", "rules", "Displays the rules"); @@ -52,7 +53,18 @@ public class vMinecraftCommands{ cl.registerAlias("/wrists", "/suicide"); cl.registerAlias("/ci", "/clearinventory"); } - + + //===================================================================== + //Function: colors (/colors) + //Input: Player player: The player using the command + //Output: int: Exit Code + //Use: Displays a list of all colors and color codes + //===================================================================== + public static int colors(Player player, String[] args){ + vMinecraftChat.sendMessage(player, player, Colors.Black + "0" + Colors.Navy + "1" + Colors.Green+ "2" + Colors.Blue + "3" + Colors.Red + "4" + Colors.Purple + "5" + Colors.Gold + "6" + Colors.LightGray + "7" + Colors.Gray + "8" + Colors.DarkPurple + "9" + Colors.LightGreen + "a" + Colors.LightBlue + "b" + Colors.Rose + "c" + Colors.LightPurple + "d" + Colors.White + "f"); + return EXIT_SUCCESS; + } + //===================================================================== //Function: me (/me) //Input: Player player: The player using the command diff --git a/vMinecraftListener.java b/vMinecraftListener.java index 4643b04c5..0a59d0ae2 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -1,5 +1,6 @@ import java.util.logging.Level; import java.util.logging.Logger; +import java.util.Set; //===================================================================== //Class: vMinecraftListener //Use: The listener to catch incoming chat and commands @@ -93,7 +94,17 @@ public class vMinecraftListener extends PluginListener { public boolean onIgnite(Block block, Player player) { if(vMinecraftSettings.stopFire){ - if (vMinecraftSettings.fireNoSpread.contains(block)){ + int x = block.getX(); + int y = block.getY(); + int z = block.getZ(); + if (vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x + 1, y, z)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x - 1, y, z)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y + 1, z)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y - 1, z)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y, z + 1)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y, z - 1)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x + 1, y + 1, z + 1)) + || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x - 1, y - 1, z - 1))) { return true; } } diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index ccc60d003..521aa2040 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -1,6 +1,7 @@ import java.io.*; import java.util.ArrayList; import java.util.logging.Level; +import java.util.Set; import java.util.logging.Logger; //===================================================================== //Class: vminecraftSettings @@ -10,7 +11,9 @@ import java.util.logging.Logger; public class vMinecraftSettings { //private final static Object syncLock = new Object(); protected static final Logger log = Logger.getLogger("Minecraft"); - private static volatile vMinecraftSettings instance; + private static volatile vMinecraftSettings instance; + //The block IDs fire won't spread to will be stored here + public static Set fireNoSpread; //The feature settings @@ -41,7 +44,7 @@ public class vMinecraftSettings { //An array of players currently toggled for admin chat static ArrayList adminChatList = new ArrayList(); //An array of blocks that won't catch on fire - static ArrayList fireNoSpread = new ArrayList(); + private PropertiesFile properties; @@ -87,8 +90,6 @@ public class vMinecraftSettings { writer.write("cmdEzModo=true\r\n"); writer.write("#Adding player names to this list will have them start off in ezmodo\r\n"); writer.write("ezModo=\r\n"); - writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n"); - writer.write("ezHealth=30\r\n"); writer.write("stopFire=false\r\n"); writer.write("#Flame Immune blocks will never have fire spread to them, seperate with comma. Needs stopFire to be true\r\n"); writer.write("fireNoSpread=5,17,18"); @@ -141,7 +142,6 @@ public class vMinecraftSettings { stopTnt = properties.getBoolean("stopTNT",true); rules = properties.getString("rules", "").split("@"); deathMessages = properties.getString("deathmessages", "").split(","); - fireNoSpread.add(properties.getString("fireNoSpread", "").split(",").toString()); String[] tempEz = properties.getString("ezModo").split(","); ezModo = new ArrayList(); for(String ezName : tempEz) From 891b7d0f43fc45e15c4fd2a36b8e50126d10cf30 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 8 Dec 2010 00:21:01 -0800 Subject: [PATCH 2/4] Made fire stopping simpler and functional. --- vMinecraftListener.java | 16 ++++------------ vMinecraftSettings.java | 5 ----- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/vMinecraftListener.java b/vMinecraftListener.java index 0a59d0ae2..c44a0e6b4 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -1,6 +1,5 @@ import java.util.logging.Level; import java.util.logging.Logger; -import java.util.Set; //===================================================================== //Class: vMinecraftListener //Use: The listener to catch incoming chat and commands @@ -94,17 +93,10 @@ public class vMinecraftListener extends PluginListener { public boolean onIgnite(Block block, Player player) { if(vMinecraftSettings.stopFire){ - int x = block.getX(); - int y = block.getY(); - int z = block.getZ(); - if (vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x + 1, y, z)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x - 1, y, z)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y + 1, z)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y - 1, z)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y, z + 1)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x, y, z - 1)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x + 1, y + 1, z + 1)) - || vMinecraftSettings.fireNoSpread.contains(etc.getServer().getBlockIdAt(x - 1, y - 1, z - 1))) { + if(block.getStatus() == 3 || block.getStatus() == 1){ + return true; + } + if(block.getStatus() == 2 && !player.isAdmin()){ return true; } } diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index 521aa2040..24c384e50 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -1,7 +1,6 @@ import java.io.*; import java.util.ArrayList; import java.util.logging.Level; -import java.util.Set; import java.util.logging.Logger; //===================================================================== //Class: vminecraftSettings @@ -12,8 +11,6 @@ public class vMinecraftSettings { //private final static Object syncLock = new Object(); protected static final Logger log = Logger.getLogger("Minecraft"); private static volatile vMinecraftSettings instance; - //The block IDs fire won't spread to will be stored here - public static Set fireNoSpread; //The feature settings @@ -91,8 +88,6 @@ public class vMinecraftSettings { writer.write("#Adding player names to this list will have them start off in ezmodo\r\n"); writer.write("ezModo=\r\n"); writer.write("stopFire=false\r\n"); - writer.write("#Flame Immune blocks will never have fire spread to them, seperate with comma. Needs stopFire to be true\r\n"); - writer.write("fireNoSpread=5,17,18"); writer.write("stopTnt=false\r\n"); writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n"); writer.write("#Death messages, seperate them by comma. All death messages start with the player name and a space.\r\n"); From 95086435977e667c4d01a2b7957ab84bac747ac2 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 8 Dec 2010 00:51:36 -0800 Subject: [PATCH 3/4] Added basic version of vminecrafthelp, still need to add tips to it. --- vMinecraftCommands.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 216e97274..4a66f4f74 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -29,6 +29,8 @@ public class vMinecraftCommands{ public static void loadCommands(){ //If we had commands we would add them here. cl.register("/tp", "teleport"); + cl.register("/vminecraft", "vminecrafthelp"); + cl.register("/vhelp", "vminecrafthelp"); cl.register("/colors", "colors"); cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); cl.register("/reload", "reload"); @@ -53,6 +55,36 @@ public class vMinecraftCommands{ cl.registerAlias("/wrists", "/suicide"); cl.registerAlias("/ci", "/clearinventory"); } + //===================================================================== + //Function: vminecrafthelp (/vhelp or /vminecraft) + //Input: Player player: The player using the command + //Output: int: Exit Code + //Use: Displays the current status of most vMinecraft settings + // and provides some useful tips. + //===================================================================== + public static int vminecrafthelp(Player player, String[] args){ + vMinecraftChat.sendMessage(player, player, Colors.Yellow + "Chat Settings"); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Admin Chat: " + vMinecraftSettings.getInstance().adminchat()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "FFF turns red: " + vMinecraftSettings.getInstance().FFF()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Greentext After >: " + vMinecraftSettings.getInstance().greentext()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Quake Color Script: " + vMinecraftSettings.getInstance().quakeColors()); + vMinecraftChat.sendMessage(player, player, Colors.Yellow + "Enabled Commands are TRUE, disabled are FALSE"); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /ezmodo: " + vMinecraftSettings.getInstance().cmdEzModo()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /fabulous: " + vMinecraftSettings.getInstance().cmdFabulous()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /rules: " + vMinecraftSettings.getInstance().cmdRules()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /heal: " + vMinecraftSettings.getInstance().cmdHeal()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /masstp: " + vMinecraftSettings.getInstance().cmdMasstp()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /say: " + vMinecraftSettings.getInstance().cmdSay()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /suicide: " + vMinecraftSettings.getInstance().cmdSuicide()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /whois: " + vMinecraftSettings.getInstance().cmdWhoIs()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /tp won't work on higher ranked players: " + vMinecraftSettings.getInstance().cmdTp()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /tphere won't work on higher ranked players: " + vMinecraftSettings.getInstance().cmdTphere()); + vMinecraftChat.sendMessage(player, player, Colors.Yellow + "Other Settings"); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /who: " + vMinecraftSettings.getInstance().cmdWho()); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "COLORED PLAYER LIST IS DEPENDENT ON /who BEING TRUE!"); + vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Global Messages: " + vMinecraftSettings.getInstance().globalmessages()); + return EXIT_SUCCESS; + } //===================================================================== //Function: colors (/colors) From 2c2c212bf1b1130db3e447acf002600aa6a3853b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 8 Dec 2010 01:38:33 -0800 Subject: [PATCH 4/4] Changing how vhelp works --- vMinecraftCommands.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 4a66f4f74..a728078b8 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -30,7 +30,7 @@ public class vMinecraftCommands{ //If we had commands we would add them here. cl.register("/tp", "teleport"); cl.register("/vminecraft", "vminecrafthelp"); - cl.register("/vhelp", "vminecrafthelp"); + cl.registerAlias("/vhelp", "/vminecraft"); cl.register("/colors", "colors"); cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); cl.register("/reload", "reload");