From 4f6a0ca5d3fb9f45c6e41ddad975055a1e7a2584 Mon Sep 17 00:00:00 2001 From: Jerome van der Sar Date: Sun, 23 Jun 2013 15:17:12 +0200 Subject: [PATCH] Blocked TNT Minecarts from being placed --- appinfo.properties | 8 ++--- buildnumber.properties | 4 +-- src/config.yml | 3 +- .../Listener/TFM_BlockListener.java | 1 - .../Listener/TFM_EntityListener.java | 2 +- .../Listener/TFM_PlayerListener.java | 31 +++++++++++++------ .../TotalFreedomMod/TotalFreedomMod.java | 4 ++- src/plugin.yml | 2 +- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/appinfo.properties b/appinfo.properties index 7181f3a5..50899aee 100644 --- a/appinfo.properties +++ b/appinfo.properties @@ -1,5 +1,5 @@ -#Sat, 22 Jun 2013 19:56:29 +0200 +#Sun, 23 Jun 2013 15:16:34 +0200 -program.VERSION=2.18 -program.BUILDNUM=218 -program.BUILDDATE=06/22/2013 07\:56 PM +program.VERSION=2.19 +program.BUILDNUM=221 +program.BUILDDATE=06/23/2013 03\:16 PM diff --git a/buildnumber.properties b/buildnumber.properties index 4dc32275..c0569d82 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sat Jun 22 19:56:29 CEST 2013 -build.number=219 +#Sun Jun 23 15:16:34 CEST 2013 +build.number=222 diff --git a/src/config.yml b/src/config.yml index a9a2ce17..dce71ce7 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,4 +1,4 @@ -# TotalFreedomMod v2.18 Configuration +# TotalFreedomMod v2.19 Configuration # by Madgeek1450 and DarthSalamon # Block placement prevention: @@ -8,6 +8,7 @@ allow_lava_damage: false allow_lava_place: false allow_water_place: false allow_fluid_spread: false +allow_tnt_minecarts: false # Explosion management: allow_explosions: false diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java index 87e88eb8..3914024c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java @@ -11,7 +11,6 @@ import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_EntityListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_EntityListener.java index 26a6224e..d8e909a9 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_EntityListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_EntityListener.java @@ -36,7 +36,7 @@ public class TFM_EntityListener implements Listener @EventHandler(priority = EventPriority.HIGH) public void onEntityCombust(EntityCombustEvent event) { - if (!TotalFreedomMod.allowFireSpread) + if (!TotalFreedomMod.allowExplosions) { event.setCancelled(true); } diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java index 3ed1b4bd..e8c02a27 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java @@ -45,20 +45,34 @@ public class TFM_PlayerListener implements Listener { case WATER_BUCKET: { - player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); - player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled."); - event.setCancelled(true); - return; + if (!TotalFreedomMod.allowWaterPlace) + { + player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); + player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled."); + event.setCancelled(true); + return; + } } case LAVA_BUCKET: { - player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); - player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled."); - event.setCancelled(true); + if (!TotalFreedomMod.allowLavaPlace) + { + player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); + player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled."); + event.setCancelled(true); + return; + } } - case POTION: + case EXPLOSIVE_MINECART: { + if (!TotalFreedomMod.allowTntMinecarts) + { + player.getInventory().clear(player.getInventory().getHeldItemSlot()); + player.sendMessage(ChatColor.GRAY + "TNT minecarts are currently disabled."); + event.setCancelled(true); + } } + } break; } @@ -98,7 +112,6 @@ public class TFM_PlayerListener implements Listener } event.setCancelled(true); - return; } break; } diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 35bd1d27..82b196c8 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -201,6 +201,8 @@ public class TotalFreedomMod extends JavaPlugin public static boolean allowLavaPlace = false; public static boolean allowWaterPlace = false; public static Boolean allowExplosions = false; + public static boolean allowFliudSpread = false; + public static boolean allowTntMinecarts = false; public static double explosiveRadius = 4.0D; public static boolean autoEntityWipe = true; public static boolean nukeMonitor = true; @@ -222,7 +224,6 @@ public class TotalFreedomMod extends JavaPlugin public static boolean tossmobEnabled = false; public static boolean generateFlatlands = true; public static String flatlandsGenerationParams = "16,stone,32,dirt,1,grass"; - public static boolean allowFliudSpread = false; public static boolean adminOnlyMode = false; public static boolean protectedAreasEnabled = true; public static boolean autoProtectSpawnpoints = true; @@ -245,6 +246,7 @@ public class TotalFreedomMod extends JavaPlugin allowLavaPlace = config.getBoolean("allow_lava_place", allowLavaPlace); allowWaterPlace = config.getBoolean("allow_water_place", allowWaterPlace); allowExplosions = config.getBoolean("allow_explosions", allowExplosions); + allowTntMinecarts = config.getBoolean("allow_tnt_minecarts", allowTntMinecarts); explosiveRadius = config.getDouble("explosiveRadius", explosiveRadius); autoEntityWipe = config.getBoolean("auto_wipe", autoEntityWipe); nukeMonitor = config.getBoolean("nuke_monitor", nukeMonitor); diff --git a/src/plugin.yml b/src/plugin.yml index db4e3e52..c35eed75 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TotalFreedomMod main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod -version: 2.18 +version: 2.19 description: Plugin for the Total Freedom server. authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]