mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-06 04:08:03 +02:00
Improved the cake processing mix to be less bitter.
This commit is contained in:
parent
bd2393342f
commit
896c7fc467
@ -57,14 +57,11 @@ public void registerEvents() {
|
||||
|
||||
PluginManager pm = plugin.getServer().getPluginManager();
|
||||
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGE, this, Priority.High, plugin);
|
||||
pm.registerEvent(Event.Type.BLOCK_BREAK, this, Priority.High, plugin);
|
||||
pm.registerEvent(Event.Type.BLOCK_FROMTO, this, Priority.Normal, plugin);
|
||||
pm.registerEvent(Event.Type.BLOCK_IGNITE, this, Priority.High, plugin);
|
||||
pm.registerEvent(Event.Type.BLOCK_PHYSICS, this, Priority.Normal, plugin);
|
||||
//pm.registerEvent(Event.Type.BLOCK_INTERACT, this, Priority.High, plugin);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACE, this, Priority.High, plugin);
|
||||
//pm.registerEvent(Event.Type.BLOCK_RIGHTCLICK, this, Priority.High, plugin);
|
||||
pm.registerEvent(Event.Type.BLOCK_BURN, this, Priority.High, plugin);
|
||||
pm.registerEvent(Event.Type.REDSTONE_CHANGE, this, Priority.High, plugin);
|
||||
}
|
||||
@ -77,31 +74,6 @@ protected WorldConfiguration getWorldConfig(Player player) {
|
||||
return plugin.getGlobalConfiguration().get(player.getWorld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is damaged.
|
||||
*/
|
||||
@Override
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block blockDamaged = event.getBlock();
|
||||
|
||||
// Cake are damaged and not broken when they are eaten, so we must
|
||||
// handle them a bit separately
|
||||
if (blockDamaged.getType() == Material.CAKE_BLOCK) {
|
||||
if (!plugin.getGlobalRegionManager().canBuild(player, blockDamaged)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is broken.
|
||||
*/
|
||||
|
@ -198,13 +198,9 @@ public void handleBlockRightClick(PlayerInteractEvent event) {
|
||||
|
||||
if (wcfg.useRegions && type == Material.CAKE_BLOCK) {
|
||||
if (!set.canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
|
||||
byte newData = (byte) (block.getData() - 1);
|
||||
newData = newData < 0 ? 0 : newData;
|
||||
block.setData(newData);
|
||||
player.setHealth(player.getHealth() - 3);
|
||||
|
||||
player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!");
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user