Move sit method

This commit is contained in:
Shevchik 2013-09-01 16:59:58 +04:00
parent ad3e1b7991
commit c4386ab262
2 changed files with 186 additions and 178 deletions

View File

@ -87,8 +87,16 @@ public class EventListener implements Listener {
return; return;
} }
if (event.hasBlock() && event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.hasBlock() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
sitPlayer(player, event.getClickedBlock());
Block block = event.getClickedBlock(); if (sit) {
event.setCancelled(true);
sit = false;
}
}
}
private boolean sit = false;
protected void sitPlayer(Player player, Block block)
{
Stairs stairs = null; Stairs stairs = null;
Step step = null; Step step = null;
WoodenStep wStep = null; WoodenStep wStep = null;
@ -274,11 +282,11 @@ public class EventListener implements Listener {
plugin.sit.put(player.getName(), arrow); plugin.sit.put(player.getName(), arrow);
plugin.sitblock.put(block, player.getName()); plugin.sitblock.put(block, player.getName());
plugin.sitblockbr.put(player.getName(), block); plugin.sitblockbr.put(player.getName(), block);
event.setCancelled(true); sit = true;
}
} }
} }
// https://github.com/sk89q/craftbook/blob/master/src/main/java/com/sk89q/craftbook/util/BlockUtil.java // https://github.com/sk89q/craftbook/blob/master/src/main/java/com/sk89q/craftbook/util/BlockUtil.java
public static Location getBlockCentre(Block block) { public static Location getBlockCentre(Block block) {
return block.getLocation().add(0.5, 0.5, 0.5); return block.getLocation().add(0.5, 0.5, 0.5);

Binary file not shown.