Advertisement
morganm

MineCart Mania sign issue gitdiff

Jun 12th, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. diff --git a/src/com/afforess/minecartmaniacore/utils/SignUtils.java b/src/com/afforess/minecartmaniacore/utils/SignUtils.java
  2. index 284bd57..4768f84 100644
  3. --- a/src/com/afforess/minecartmaniacore/utils/SignUtils.java
  4. +++ b/src/com/afforess/minecartmaniacore/utils/SignUtils.java
  5. @@ -8,13 +8,19 @@ import java.util.List;
  6. import org.bukkit.Location;
  7. import org.bukkit.World;
  8. import org.bukkit.block.Block;
  9. +import org.bukkit.block.BlockState;
  10. import org.bukkit.block.Sign;
  11.  
  12. +import sun.util.logging.resources.logging;
  13. +
  14. import com.afforess.minecartmaniacore.config.MinecartManiaConfiguration;
  15. +import com.afforess.minecartmaniacore.debug.MinecartManiaLogger;
  16. import com.afforess.minecartmaniacore.minecart.MinecartManiaMinecart;
  17. import com.afforess.minecartmaniacore.signs.SignManager;
  18.  
  19. public class SignUtils {
  20. + private static MinecartManiaLogger log = MinecartManiaLogger.getInstance();
  21. +
  22. public static boolean signMatches(Sign s1, Sign s2) {
  23. return s1.getBlock().getLocation().equals(s2.getBlock().getLocation());
  24. }
  25. @@ -31,10 +37,15 @@ public class SignUtils {
  26. switch(w.getBlockTypeIdAt(x, y, z)) {
  27. case 63:
  28. case 68:
  29. - return (Sign)w.getBlockAt(x, y, z).getState();
  30. - default:
  31. - return null;
  32. + BlockState bs = w.getBlockAt(x, y, z).getState();
  33. + int typeId = bs.getTypeId();
  34. + if( typeId == 63 || typeId == 68 )
  35. + return (Sign)bs;
  36. + else
  37. + log.info("Avoided catastrophic server crash at block: x="+x+", y="+y+", z="+z+"; typeId="+typeId);
  38. }
  39. +
  40. + return null;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement