org.bukkit.entity.Trident Java Examples
The following examples show how to use
org.bukkit.entity.Trident.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TridentListener.java From MineTinker with GNU General Public License v3.0 | 6 votes |
@EventHandler(ignoreCancelled = true) public void onTridentLaunch(ProjectileLaunchEvent event) { if (!(event.getEntity().getShooter() instanceof Player)) { return; } if (!(event.getEntity() instanceof Trident)) { return; } Player player = (Player) event.getEntity().getShooter(); ItemStack trident = player.getInventory().getItemInMainHand().clone(); if (!ModManager.instance().isToolViable(trident)) { return; } ModManager.instance().addExp(player, trident, -20000); //trident is a item clone and only for triggering modifier effects //this makes sure that the item duplicate does not get any level ups TridentToItemStack.put((Trident) event.getEntity(), trident); }
Example #2
Source File: EntityListener.java From MineTinker with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onArrowHit(ProjectileHitEvent event) { if (!(event.getEntity().getShooter() instanceof Player)) { return; } Player player = (Player) event.getEntity().getShooter(); ItemStack tool = player.getInventory().getItemInMainHand(); if (event.getHitBlock() == null && !ToolType.FISHINGROD.contains(tool.getType())) { return; } if (event.getEntity() instanceof Trident) { Trident trident = (Trident) event.getEntity(); // Intellij gets confused if this isn't assigned to a variable tool = TridentListener.TridentToItemStack.get(trident); TridentListener.TridentToItemStack.remove(trident); if (tool == null) { return; } } if (!modManager.isToolViable(tool)) { return; } MTProjectileHitEvent projectileHitEvent = new MTProjectileHitEvent(player, tool, event); Bukkit.getPluginManager().callEvent(projectileHitEvent); }