Resolve issue with buttons not staying on Glowstone

This commit is contained in:
Steven Scott 2013-03-10 13:01:58 -07:00
parent 202c7f3d55
commit 2ee9e53fe0
2 changed files with 10 additions and 5 deletions

2
README
View File

@ -210,7 +210,7 @@ createConflict=Gate conflicts with existing gate
Unable to reproduce: Stargates teleport a user into the ground/under the ground Unable to reproduce: Stargates teleport a user into the ground/under the ground
Bukkit Issue: Stargate will randomly NPE when drawing a sign. Long-standing Bukkit Bukkit Issue: Stargate will randomly NPE when drawing a sign. Long-standing Bukkit
issue, that they just made worse by disallowing me to override the issue, that they just made worse by disallowing me to override the
sign class. sign class. This won't actually affect Stargate use.
============= =============
Changes Changes

View File

@ -31,6 +31,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; 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.Result; import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -1121,11 +1122,15 @@ public class Stargate extends JavaPlugin {
@EventHandler @EventHandler
public void onBlockPhysics(BlockPhysicsEvent event) { public void onBlockPhysics(BlockPhysicsEvent event) {
// Only check for gates if it's a portal block
Block block = event.getBlock(); Block block = event.getBlock();
if (block.getTypeId() != 90) return; Portal portal = null;
Portal portal = Portal.getByEntrance(block); // Handle keeping portal material and buttons around
if (block.getTypeId() == 90) {
portal = Portal.getByEntrance(block);
} else if (block.getTypeId() == 77) {
portal = Portal.getByControl(block);
}
if (portal != null) event.setCancelled(true); if (portal != null) event.setCancelled(true);
} }