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.
This commit is contained in:
Drakia 2011-02-23 00:01:23 -08:00
parent 94d5a3b0a3
commit 3c914dec9b
4 changed files with 22 additions and 16 deletions

6
README
View File

@ -13,6 +13,7 @@ Known Issues
============= =============
- Vehicle implementation is nowhere near done. - 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. - 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 Permissions
@ -21,6 +22,7 @@ Known Issues
- stargate.create - Allow this player/group to create new stargates. - stargate.create - Allow this player/group to create new stargates.
- stargate.destroy - Allow this player/group to destroy existing stargates. - stargate.destroy - Allow this player/group to destroy existing stargates.
- stargate.hidden - Allow this player/group to see all hidden stargates. - stargate.hidden - Allow this player/group to see all hidden stargates.
- stargate.private - Allow this player/group to use all private stargates.
============= =============
Instructions Instructions
@ -79,6 +81,10 @@ gate-folder - The folder containing your .gate files
============= =============
Changes 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] [Version 0.14]
- Fixed infinite loop in fixed gates. - Fixed infinite loop in fixed gates.
- Fixed gate destination will not open when dialed into. - Fixed gate destination will not open when dialed into.

View File

@ -697,7 +697,7 @@ public class Portal {
// No button on an always-open gate. // No button on an always-open gate.
if (!alwaysOn) { if (!alwaysOn) {
button = topleft.modRelative(buttonVector.getRight(), buttonVector.getDepth(), buttonVector.getDistance() + 1, modX, 1, modZ); 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); portal = new Portal(topleft, modX, modZ, rotX, id, button, destName, name, true, network, gate, player.getName(), hidden, alwaysOn, priv);

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockListener;
@ -69,15 +70,6 @@ public class Stargate extends JavaPlugin {
public static ConcurrentLinkedQueue<Portal> activeList = new ConcurrentLinkedQueue<Portal>(); public static ConcurrentLinkedQueue<Portal> activeList = new ConcurrentLinkedQueue<Portal>();
//private HashMap<Integer, Location> vehicles = new HashMap<Integer, Location>(); //private HashMap<Integer, Location> vehicles = new HashMap<Integer, Location>();
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() { public void onDisable() {
Portal.closeAllGates(); Portal.closeAllGates();
} }
@ -86,6 +78,11 @@ public class Stargate extends JavaPlugin {
PluginDescriptionFile pdfFile = this.getDescription(); PluginDescriptionFile pdfFile = this.getDescription();
pm = getServer().getPluginManager(); pm = getServer().getPluginManager();
config = this.getConfiguration(); 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."); 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_RIGHTCLICKED, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PLACED, 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_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.VEHICLE_MOVE, vehicleListener, Priority.Normal, this);
pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this);
@ -357,10 +355,12 @@ public class Stargate extends JavaPlugin {
} }
} }
} }
}
// Drop out if we're not breaking a block @Override
if (event.getDamageLevel() != BlockDamageLevel.BROKEN) return; 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) { if (block.getType() != Material.WALL_SIGN && block.getType() != Material.STONE_BUTTON && Gate.getGatesByControlBlock(block).length == 0) {
return; return;
} }

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.TheDgtl.Stargate.Stargate main: net.TheDgtl.Stargate.Stargate
version: 0.14 version: 0.15
description: Stargate mod for Bukkit description: Stargate mod for Bukkit
author: Drakia author: Drakia
website: http://www.thedgtl.net website: http://www.thedgtl.net