Permalink
Browse files

Fix trackers.

  • Loading branch information...
mkalus committed Mar 8, 2012
1 parent bb195f5 commit 59d6752ef7ef774f67d34ae60dca3311db58d265
@@ -64,7 +64,7 @@ public void executeTick() {
// get old data
BlockState oldState = block.getState();
// dissolve to air
- block.setTypeId(Material.AIR.getId(), false);
+ block.setType(Material.AIR);
// update chunk information
block.getWorld().refreshChunk(block.getChunk().getX(), block.getChunk().getZ());
nonAir.remove(location);
@@ -112,7 +112,7 @@ public boolean tick() {
// run through active spleefers and check their positions
for (Spleefer spleefer : game.getSpleefers().get()) {
- if (!spleefer.hasLost())
+ if (!spleefer.hasLost() && spleefer.getPlayer().isOnline())
updatePosition(spleefer.getPlayer());
}
@@ -132,13 +132,15 @@ private void updatePosition(Player player) {
} else {
// check player position
Block playerOnBlock = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
+
// did the player move?
- if (playerOnBlock != keeper.checkedBlock) {
+ if (playerOnBlock.getX() != keeper.checkedBlock.getX() || playerOnBlock.getY() != keeper.checkedBlock.getY()
+ || playerOnBlock.getZ() != keeper.checkedBlock.getZ()) {
degenerationList.remove(player); // remove player from list
addNewBlock(player); // new block for player
return;
}
-
+
// decrement counter and check
keeper.counter--;
if (keeper.counter <= 0) { // reset counter
@@ -151,7 +153,7 @@ private void updatePosition(Player player) {
// get original data
BlockState oldState = keeper.checkedBlock.getState();
- keeper.checkedBlock.setTypeId(Material.AIR.getId(), false); // block dissolves into thin air
+ keeper.checkedBlock.setType(Material.AIR); // block dissolves into thin air
// update chunk information
keeper.checkedBlock.getWorld().refreshChunk(keeper.checkedBlock.getChunk().getX(), keeper.checkedBlock.getChunk().getZ());

0 comments on commit 59d6752

Please sign in to comment.