Committed block lag fix.
This commit is contained in:
parent
787e2bcd97
commit
6d56273682
|
@ -100,6 +100,9 @@ WorldProtect on your server. You can either restart your server or use
|
|||
to disable this feature. Enabling disable-all-fire-spread will
|
||||
override this function.
|
||||
|
||||
- block-lag-fix (def. false)
|
||||
Attempts to fix block lag.
|
||||
|
||||
Blacklists
|
||||
----------
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Manifest-Version: 1.0
|
||||
WorldProtect-Version: 1.0
|
||||
WorldProtect-Version: 1.1
|
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.io.*;
|
||||
import com.sk89q.worldprotect.*;
|
||||
import java.util.logging.FileHandler;
|
||||
|
@ -45,6 +46,10 @@ public class WorldProtectListener extends PluginListener {
|
|||
* Properties file for CraftBook.
|
||||
*/
|
||||
private PropertiesFile properties = new PropertiesFile("worldprotect.properties");
|
||||
/**
|
||||
* Random number generator.
|
||||
*/
|
||||
private static Random rand = new Random();
|
||||
|
||||
private boolean enforceOneSession;
|
||||
private boolean blockCreepers;
|
||||
|
@ -53,6 +58,7 @@ public class WorldProtectListener extends PluginListener {
|
|||
private boolean preventLavaFire;
|
||||
private boolean disableAllFire;
|
||||
private boolean simulateSponge;
|
||||
private boolean blockLagFix;
|
||||
private Set<Integer> fireNoSpreadBlocks;
|
||||
private Set<Integer> allowedLavaSpreadOver;
|
||||
private boolean classicWater;
|
||||
|
@ -105,6 +111,7 @@ public class WorldProtectListener extends PluginListener {
|
|||
allowedLavaSpreadOver = toBlockIDSet(properties.getString("allowed-lava-spread-blocks", ""));
|
||||
classicWater = properties.getBoolean("classic-water", false);
|
||||
simulateSponge = properties.getBoolean("simulate-sponge", false);
|
||||
blockLagFix = properties.getBoolean("block-lag-fix", false);
|
||||
|
||||
try {
|
||||
blacklist = loadBlacklist(new File("worldprotect-blacklist.txt"));
|
||||
|
@ -196,6 +203,8 @@ public class WorldProtectListener extends PluginListener {
|
|||
* @return
|
||||
*/
|
||||
public boolean onBlockDestroy(Player player, Block block) {
|
||||
int type = block.getType();
|
||||
|
||||
if (blacklist != null) {
|
||||
BlacklistEntry entry = blacklist.get(player.getItemInHand());
|
||||
if (entry != null) {
|
||||
|
@ -211,6 +220,73 @@ public class WorldProtectListener extends PluginListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (blockLagFix
|
||||
&& type != 64 // Wooden door
|
||||
&& type != 71 // Iron door
|
||||
&& type != 77 // Stone button
|
||||
&& type != 69 // Lever
|
||||
&& type != 7 // Bedrock
|
||||
&& type != 51 // Fire
|
||||
&& type != 46 // TNT
|
||||
&& type != 59 // Crops
|
||||
&& type != 62 // Burning furnace
|
||||
&& type != 50 // Torch
|
||||
&& type != 75 // Redstone torch
|
||||
&& type != 76 // Redstone torch
|
||||
) {
|
||||
|
||||
if (block.getStatus() == 3) {
|
||||
int dropped = type;
|
||||
int count = 1;
|
||||
|
||||
if (type == 1) { dropped = 4; } // Stone
|
||||
else if (type == 2) { dropped = 3; } // Grass
|
||||
else if (type == 16) { dropped = 263; } // Coal ore
|
||||
else if (type == 18) { // Leaves
|
||||
if (rand.nextDouble() > 0.95) {
|
||||
dropped = 6;
|
||||
} else {
|
||||
dropped = 0;
|
||||
}
|
||||
}
|
||||
else if (type == 47) { dropped = 0; } // Bookshelves
|
||||
else if (type == 52) { dropped = 0; } // Mob spawner
|
||||
else if (type == 53) { dropped = 5; } // Wooden stairs
|
||||
else if (type == 55) { dropped = 5; } // Redstone wire
|
||||
else if (type == 56) { dropped = 264; } // Diamond ore
|
||||
else if (type == 60) { dropped = 3; } // Soil
|
||||
else if (type == 63) { dropped = 323; } // Sign post
|
||||
else if (type == 67) { dropped = 4; } // Cobblestone stairs
|
||||
else if (type == 68) { dropped = 323; } // Wall sign
|
||||
else if (type == 73) { dropped = 331; count = 4; } // Redstone ore
|
||||
else if (type == 74) { dropped = 331; count = 4; } // Glowing redstone ore
|
||||
else if (type == 75) { dropped = 76; count = 4; } // Redstone torch
|
||||
else if (type == 79) { dropped = 0; count = 4; } // Ice
|
||||
else if (type == 82) { dropped = 337; count = 4; } // Clay
|
||||
else if (type == 83) { dropped = 338; count = 4; } // Reed
|
||||
else if (type == 89) { dropped = 348; } // Lightstone
|
||||
|
||||
if (dropped > 0) {
|
||||
etc.getServer().setBlockAt(0, block.getX(), block.getY(), block.getZ());
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
etc.getServer().dropItem(block.getX(), block.getY(), block.getZ(),
|
||||
dropped, i);
|
||||
}
|
||||
|
||||
// Drop flint with gravel
|
||||
if (type == 13) {
|
||||
if (rand.nextDouble() > 0.95) {
|
||||
etc.getServer().dropItem(block.getX(), block.getY(), block.getZ(),
|
||||
318, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue