Made the fire antigrief more complex, now you can specify which blocks fire will not spread to as well as toggling lava being able to spread fire or not.

This commit is contained in:
nossr50 2010-12-26 16:13:46 -08:00
parent f15e00bdc7
commit 4577fdb159
2 changed files with 65 additions and 17 deletions

View File

@ -119,11 +119,38 @@ public class vMinecraftListener extends PluginListener {
} }
public boolean onIgnite(Block block, Player player) { public boolean onIgnite(Block block, Player player) {
if(vMinecraftSettings.stopFire){ if(vMinecraftSettings.getInstance().stopFire()){
if(block.getStatus() == 3 || block.getStatus() == 1){ //There are 3 ways fire can spread
//1 = lava, 2 = lighter, 3 = spread (other fire blocks)
//Stop lava from spreading
if(block.getStatus() == 1 && vMinecraftSettings.getInstance().lavaSpread()){
return true; return true;
} }
if(block.getStatus() == 2 && !player.isAdmin()){ //Stop fire from spreading fire
if (block.getStatus() == 3 && vMinecraftSettings.getInstance().stopFire()){
return true;
}
//Checking to see if any of the blocks fire is trying to spread to is on the "fireblockan" list
if (block.getStatus() == 3){
int x,
y,
z,
g;
x = block.getX();
y = block.getY();
z = block.getZ();
//Finding out the blockid of the current blocks fire is trying to spread to
int blockid = etc.getServer().getBlockIdAt(x, y, z);
//Check to see the blockid doesn't match anything on the list
for(x = 0; x >= vMinecraftSettings.fireblockan.size(); x++){
if (vMinecraftSettings.fireblockan.get(x) == blockid){
return true;
}
}
}
//Stop players without permission from being able to set fires
if(block.getStatus() == 2 && !player.canUseCommand("/flint")){
return true; return true;
} }
} }

View File

@ -24,8 +24,10 @@ public class vMinecraftSettings {
ignore = false, ignore = false,
colors = false, colors = false,
nick = false, nick = false,
playerspawn = false, playerspawn = false,
freeze = false, freeze = false,
lavaspread = false,
colorsrequirepermission = false,
cmdFabulous = false, cmdFabulous = false,
cmdPromote = false, cmdPromote = false,
cmdDemote = false, cmdDemote = false,
@ -50,15 +52,15 @@ public class vMinecraftSettings {
//An array of players currently toggled for admin chat //An array of players currently toggled for admin chat
static ArrayList<String> adminChatList = new ArrayList<String>(); static ArrayList<String> adminChatList = new ArrayList<String>();
//An array of blocks that won't catch on fire //An array of blocks that won't catch on fire
static public ArrayList<Integer> fireblockan;
private PropertiesFile properties;
String file = "vminecraft.properties";
private PropertiesFile properties; public String rules[] = new String[0];
String file = "vminecraft.properties";
public String rules[] = new String[0];
public static String deathMessages[] = new String[0]; public static String deathMessages[] = new String[0];
public static String ranks[] = new String[0]; public static String ranks[] = new String[0];
//===================================================================== //=====================================================================
//Function: loadSettings //Function: loadSettings
//Input: None //Input: None
@ -80,12 +82,16 @@ public class vMinecraftSettings {
writer.write("#Chat Options\r\n"); writer.write("#Chat Options\r\n");
writer.write("#Allows the use of color codes following ^ symbol\r\n"); writer.write("#Allows the use of color codes following ^ symbol\r\n");
writer.write("ColoredChat=true\r\n"); writer.write("ColoredChat=true\r\n");
writer.write("#Require per player permission for quakecolors");
writer.write("colorsrequirepermissions=false\r\n");
writer.write("#use /coloruse to give players permission if this is enabled");
writer.write("#Text following a > will be colored green to mimic quoting of popular internet message boards\r\n"); writer.write("#Text following a > will be colored green to mimic quoting of popular internet message boards\r\n");
writer.write("QuotesAreGreen=true\r\n"); writer.write("QuotesAreGreen=true\r\n");
writer.write("#Turns any chat message starting with FFF automagically blood red\r\n"); writer.write("#Turns any chat message starting with FFF automagically blood red\r\n");
writer.write("FFF=true\r\n"); writer.write("FFF=true\r\n");
writer.write("\r\n"); writer.write("\r\n");
writer.write("#Admin Settings\r\n"); writer.write("#Admin Settings\r\n");
writer.write("#Enables or disables players spawning to their home location"); writer.write("#Enables or disables players spawning to their home location");
writer.write("playerspawn=true\r\n"); writer.write("playerspawn=true\r\n");
writer.write("#Enables or disables the admin only chat\r\n"); writer.write("#Enables or disables the admin only chat\r\n");
@ -123,6 +129,10 @@ public class vMinecraftSettings {
writer.write("ezModo=\r\n"); writer.write("ezModo=\r\n");
writer.write("#Stop fire from spreading\r\n"); writer.write("#Stop fire from spreading\r\n");
writer.write("stopFire=false\r\n"); writer.write("stopFire=false\r\n");
writer.write("#Stop lava from spreading fire");
writer.write("lavaspread=false");
writer.write("#Blocks disabled from fire");
writer.write("fireblocks=");
writer.write("\r\n"); writer.write("\r\n");
writer.write("#Organize your player ranks from lowest to highest.\r\n"); writer.write("#Organize your player ranks from lowest to highest.\r\n");
writer.write("ranks=default,trusted,mods,admins,superadmins\r\n"); writer.write("ranks=default,trusted,mods,admins,superadmins\r\n");
@ -157,12 +167,13 @@ 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); colorsrequirepermission = properties.getBoolean("colorsrequirepermission",true);
suffix = properties.getBoolean("suffix",true); prefix = properties.getBoolean("prefix",true);
ignore = properties.getBoolean("ignore",true); suffix = properties.getBoolean("suffix",true);
colors = properties.getBoolean("colors",true); ignore = properties.getBoolean("ignore",true);
nick = properties.getBoolean("nick",true); colors = properties.getBoolean("colors",true);
freeze = properties.getBoolean("/freeze",true); nick = properties.getBoolean("nick",true);
freeze = properties.getBoolean("/freeze",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,9 +190,17 @@ public class vMinecraftSettings {
cmdSay = properties.getBoolean("/say",true); cmdSay = properties.getBoolean("/say",true);
cmdEzModo = properties.getBoolean("/ezmodo",true); cmdEzModo = properties.getBoolean("/ezmodo",true);
stopFire = properties.getBoolean("stopFire",true); stopFire = properties.getBoolean("stopFire",true);
lavaspread = properties.getBoolean("lavaspread",true);
rules = properties.getString("rules", "").split("@"); rules = properties.getString("rules", "").split("@");
deathMessages = properties.getString("deathmessages", "").split(","); deathMessages = properties.getString("deathmessages", "").split(",");
String[] tempEz = properties.getString("ezModo").split(","); String[] tempEz = properties.getString("ezModo").split(",");
String[] fireblocks = properties.getString("fireblocks").split(",");
fireblockan = new ArrayList<Integer>();
for(int x = 0;x <= fireblocks.length; x++)
{
fireblockan.add(Integer.parseInt(fireblocks[x]));
x++;
}
ezModo = new ArrayList<String>(); ezModo = new ArrayList<String>();
for(String ezName : tempEz) for(String ezName : tempEz)
ezModo.add(ezName); ezModo.add(ezName);
@ -218,6 +237,7 @@ public class vMinecraftSettings {
public boolean colors() {return colors;} public boolean colors() {return colors;}
public boolean nick() {return nick;} public boolean nick() {return nick;}
public boolean playerspawn() {return playerspawn;} public boolean playerspawn() {return playerspawn;}
public boolean colorsreq() {return colorsrequirepermission;}
public boolean freeze() {return freeze;} public boolean freeze() {return freeze;}
public boolean cmdFabulous() {return cmdFabulous;} public boolean cmdFabulous() {return cmdFabulous;}
public boolean cmdPromote() {return cmdPromote;} public boolean cmdPromote() {return cmdPromote;}
@ -231,10 +251,11 @@ public class vMinecraftSettings {
public boolean cmdMasstp() {return cmdMasstp;} public boolean cmdMasstp() {return cmdMasstp;}
public boolean cmdWho() {return cmdWho;} public boolean cmdWho() {return cmdWho;}
public boolean stopFire() {return stopFire;} public boolean stopFire() {return stopFire;}
public boolean lavaSpread() {return lavaspread;}
public boolean stopTnt() {return stopTnt;} public boolean stopTnt() {return stopTnt;}
public boolean cmdSuicide() {return cmdSuicide;} public boolean cmdSuicide() {return cmdSuicide;}
public boolean cmdHeal() {return cmdHeal;} public boolean cmdHeal() {return cmdHeal;}
public ArrayList<Integer> getFireBlockIds() {return fireblockan;}
public String[] getRanks() {return ranks;} public String[] getRanks() {return ranks;}
//EzModo methods //EzModo methods