mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 03:25:24 +01:00
Merge branch 'master' of http://github.com/sk89q/worldguard
This commit is contained in:
commit
d4a3e04622
@ -39,6 +39,11 @@ public class WorldGuard extends Plugin {
|
||||
*/
|
||||
private static final WorldGuardListener listener =
|
||||
new WorldGuardListener();
|
||||
/**
|
||||
* Low priority version.
|
||||
*/
|
||||
private static final WorldGuardListener.LowPriorityListener lowPriorityListener =
|
||||
listener.getLowPriorityListener();
|
||||
|
||||
/**
|
||||
* Initializes the plugin.
|
||||
@ -59,6 +64,8 @@ public void initialize() {
|
||||
PluginListener.Priority.HIGH);
|
||||
loader.addListener(PluginLoader.Hook.BLOCK_DESTROYED, listener, this,
|
||||
PluginListener.Priority.HIGH);
|
||||
loader.addListener(PluginLoader.Hook.BLOCK_DESTROYED, lowPriorityListener, this,
|
||||
PluginListener.Priority.LOW);
|
||||
loader.addListener(PluginLoader.Hook.DISCONNECT, listener, this,
|
||||
PluginListener.Priority.HIGH);
|
||||
loader.addListener(PluginLoader.Hook.ITEM_DROP , listener, this,
|
||||
|
@ -255,73 +255,6 @@ public boolean onBlockDestroy(Player player, Block block) {
|
||||
}
|
||||
}
|
||||
|
||||
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 = 331; } // 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
|
||||
|
||||
etc.getServer().setBlockAt(0, block.getX(), block.getY(), block.getZ());
|
||||
|
||||
if (dropped > 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -541,4 +474,98 @@ public Map<Integer,BlacklistEntry> loadBlacklist(File file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the low priority listener.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LowPriorityListener getLowPriorityListener() {
|
||||
return new LowPriorityListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Low priority listener.
|
||||
*/
|
||||
public class LowPriorityListener extends PluginListener {
|
||||
/**
|
||||
* Called when a person left clicks a block.
|
||||
*
|
||||
* @param player
|
||||
* @param block
|
||||
* @return
|
||||
*/
|
||||
public boolean onBlockDestroy(Player player, Block block) {
|
||||
int type = block.getType();
|
||||
|
||||
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 = 331; } // 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
|
||||
|
||||
etc.getServer().setBlockAt(0, block.getX(), block.getY(), block.getZ());
|
||||
|
||||
if (dropped > 0) {
|
||||
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
Block a user