From 3c914dec9beaf66e21d72de58d3a55f44c0f12f7 Mon Sep 17 00:00:00 2001 From: Drakia Date: Wed, 23 Feb 2011 00:01:23 -0800 Subject: [PATCH] Built against b424jnks -- As such nothing lower is supported at the moment. Moved gate destruction code to onBlockBreak since onBlockDamage no longer handles breaking blocks. Removed long constructor. --- README | 6 ++++++ src/net/TheDgtl/Stargate/Portal.java | 2 +- src/net/TheDgtl/Stargate/Stargate.java | 28 +++++++++++++------------- src/plugin.yml | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README b/README index 0f7d0fb..504d519 100644 --- a/README +++ b/README @@ -13,6 +13,7 @@ Known Issues ============= - Vehicle implementation is nowhere near done. - Signs aren't always updating, I don't know what's causing this, I think it's a Bukkit thing. + - Minecraft bug is causing buttons to look odd, they still work though. ============= Permissions @@ -21,6 +22,7 @@ Known Issues - stargate.create - Allow this player/group to create new stargates. - stargate.destroy - Allow this player/group to destroy existing stargates. - stargate.hidden - Allow this player/group to see all hidden stargates. + - stargate.private - Allow this player/group to use all private stargates. ============= Instructions @@ -79,6 +81,10 @@ gate-folder - The folder containing your .gate files ============= Changes ============= +[Version 0.15] + - Built against b424jnks -- As such nothing lower is supported at the moment. + - Moved gate destruction code to onBlockBreak since onBlockDamage no longer handles breaking blocks. + - Removed long constructor. [Version 0.14] - Fixed infinite loop in fixed gates. - Fixed gate destination will not open when dialed into. diff --git a/src/net/TheDgtl/Stargate/Portal.java b/src/net/TheDgtl/Stargate/Portal.java index 5c98f95..72a6f5d 100644 --- a/src/net/TheDgtl/Stargate/Portal.java +++ b/src/net/TheDgtl/Stargate/Portal.java @@ -697,7 +697,7 @@ public class Portal { // No button on an always-open gate. if (!alwaysOn) { button = topleft.modRelative(buttonVector.getRight(), buttonVector.getDepth(), buttonVector.getDistance() + 1, modX, 1, modZ); - button.setType(BUTTON); + button.setType(BUTTON); } portal = new Portal(topleft, modX, modZ, rotX, id, button, destName, name, true, network, gate, player.getName(), hidden, alwaysOn, priv); diff --git a/src/net/TheDgtl/Stargate/Stargate.java b/src/net/TheDgtl/Stargate/Stargate.java index db3b634..7eba45e 100644 --- a/src/net/TheDgtl/Stargate/Stargate.java +++ b/src/net/TheDgtl/Stargate/Stargate.java @@ -15,6 +15,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Vehicle; import org.bukkit.event.Event; import org.bukkit.event.Event.Priority; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockListener; @@ -68,15 +69,6 @@ public class Stargate extends JavaPlugin { public static ConcurrentLinkedQueue openList = new ConcurrentLinkedQueue(); public static ConcurrentLinkedQueue activeList = new ConcurrentLinkedQueue(); //private HashMap vehicles = new HashMap(); - - public Stargate(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) { - super(pluginLoader, instance, desc, folder, plugin, cLoader); - log = Logger.getLogger("Minecraft"); - - // Set portalFile and gateFolder to the plugin folder as defaults. - portalFile = folder + File.separator + "stargate.db"; - gateFolder = folder + File.separator + "gates" + File.separator; - } public void onDisable() { Portal.closeAllGates(); @@ -86,6 +78,11 @@ public class Stargate extends JavaPlugin { PluginDescriptionFile pdfFile = this.getDescription(); pm = getServer().getPluginManager(); config = this.getConfiguration(); + log = Logger.getLogger("Minecraft"); + + // Set portalFile and gateFolder to the plugin folder as defaults. + portalFile = getDataFolder() + File.separator + "stargate.db"; + gateFolder = getDataFolder() + File.separator + "gates" + File.separator; log.info(pdfFile.getName() + " v." + pdfFile.getVersion() + " is enabled."); @@ -102,6 +99,7 @@ public class Stargate extends JavaPlugin { pm.registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this); + pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.VEHICLE_MOVE, vehicleListener, Priority.Normal, this); pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this); @@ -357,14 +355,16 @@ public class Stargate extends JavaPlugin { } } } - - // Drop out if we're not breaking a block - if (event.getDamageLevel() != BlockDamageLevel.BROKEN) return; - + } + + @Override + public void onBlockBreak(BlockBreakEvent event) { + Block block = event.getBlock(); + Player player = event.getPlayer(); if (block.getType() != Material.WALL_SIGN && block.getType() != Material.STONE_BUTTON && Gate.getGatesByControlBlock(block).length == 0) { return; } - + Portal portal = Portal.getByBlock(block); if (portal == null) return; diff --git a/src/plugin.yml b/src/plugin.yml index 94732a8..4ece164 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Stargate main: net.TheDgtl.Stargate.Stargate -version: 0.14 +version: 0.15 description: Stargate mod for Bukkit author: Drakia website: http://www.thedgtl.net \ No newline at end of file