Hallo,
ich habe folgendes Programmiert, und komme nun nicht weiter:
Ich will, das dass Event nur ausgeführt werden darf wenn ein bestimmter Befehl ausgeführt wird. Ich habe gehört das soll mit dem playerCommandPreprocessEvent gehen, ich habe allerdings keine Ahnung wie ich das Anstellen soll.
LG
Dominik
ich habe folgendes Programmiert, und komme nun nicht weiter:
Code:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
final Player p = e.getPlayer();
if (p.getInventory().getItemInHand().getType() == Material.STICK) {
if (e.getAction() == Action.RIGHT_CLICK_AIR) {
if (p.hasPermission("troll.lightning")) {
World world = p.getWorld();
world.strikeLightning(p.getTargetBlock(null, 1000).getLocation());
}
} else {
if (!p.hasPermission("troll.explosion")) {
p.sendMessage(ChatColor.RED + "Keine Rechte!");
} else {
if (e.getAction() == Action.LEFT_CLICK_AIR) {
World world = p.getWorld();
world.createExplosion(p.getTargetBlock(null, 500).getLocation(), 30F);
}
}
}
}
}
LG
Dominik