Improved the cake processing mix to be less bitter.

This commit is contained in:
sk89q 2011-04-02 13:48:40 -07:00
parent bd2393342f
commit 896c7fc467
2 changed files with 3 additions and 35 deletions

View File

@ -57,14 +57,11 @@ public void registerEvents() {
PluginManager pm = plugin.getServer().getPluginManager(); 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_BREAK, this, Priority.High, plugin);
pm.registerEvent(Event.Type.BLOCK_FROMTO, this, Priority.Normal, 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_IGNITE, this, Priority.High, plugin);
pm.registerEvent(Event.Type.BLOCK_PHYSICS, this, Priority.Normal, 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_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.BLOCK_BURN, this, Priority.High, plugin);
pm.registerEvent(Event.Type.REDSTONE_CHANGE, 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()); 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. * Called when a block is broken.
*/ */

View File

@ -198,13 +198,9 @@ public void handleBlockRightClick(PlayerInteractEvent event) {
if (wcfg.useRegions && type == Material.CAKE_BLOCK) { if (wcfg.useRegions && type == Material.CAKE_BLOCK) {
if (!set.canBuild(localPlayer)) { if (!set.canBuild(localPlayer)) {
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area."); player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!");
byte newData = (byte) (block.getData() - 1); event.setCancelled(true);
newData = newData < 0 ? 0 : newData;
block.setData(newData);
player.setHealth(player.getHealth() - 3);
return; return;
} }
} }