From a2027ec9914ac241f4c45d978113ba8fda2af180 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 7 Dec 2010 23:57:32 -0800 Subject: [PATCH] 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)