org.bukkit.entity.minecart.HopperMinecart Java Examples
The following examples show how to use
org.bukkit.entity.minecart.HopperMinecart.
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: LWCPlayerListener.java From Modern-LWC with MIT License | 6 votes |
@EventHandler public void minecartBreak(VehicleDestroyEvent e) { Entity entity = e.getVehicle(); if (plugin.getLWC().isProtectable(e.getVehicle().getType())) { int A = 50000 + entity.getUniqueId().hashCode(); LWC lwc = LWC.getInstance(); Protection protection = lwc.getPhysicalDatabase().loadProtection(entity.getWorld().getName(), A, A, A); if ((((entity instanceof StorageMinecart)) || ((entity instanceof HopperMinecart))) && (protection != null)) { if (e.getAttacker() instanceof Projectile) { e.setCancelled(true); } Player p = (Player) e.getAttacker(); boolean canAccess = lwc.canAccessProtection(p, protection); if (canAccess) { protection.remove(); protection.removeAllPermissions(); protection.removeCache(); return; } e.setCancelled(true); } } }
Example #2
Source File: LWCPlayerListener.java From Modern-LWC with MIT License | 6 votes |
@EventHandler public void storageMinecraftInventoryOpen(InventoryOpenEvent event) { InventoryHolder holder = event.getInventory().getHolder(); Player player = (Player) event.getPlayer(); if ((!(holder instanceof StorageMinecart)) && (!(holder instanceof HopperMinecart))) { return; } Entity entity = (Entity) holder; if (plugin.getLWC().isProtectable(entity.getType())) { if (!plugin.getLWC().hasPermission(player, "lwc.protect") && plugin.getLWC().hasPermission(player, "lwc.deny") && !plugin.getLWC().isAdmin(player) && !plugin.getLWC().isMod(player)) { plugin.getLWC().sendLocale(player, "protection.interact.error.blocked"); event.setCancelled(true); return; } if (onPlayerEntityInteract((Player) event.getPlayer(), entity, event.isCancelled())) { event.setCancelled(true); } } }
Example #3
Source File: LWCPlayerListener.java From Modern-LWC with MIT License | 5 votes |
@EventHandler public void itemFrameItemRemoval(EntityDamageByEntityEvent e) { if (e.isCancelled()) return; Entity entity = e.getEntity(); if (plugin.getLWC().isProtectable(e.getEntity().getType())) { int A = 50000 + entity.getUniqueId().hashCode(); LWC lwc = LWC.getInstance(); Protection protection = lwc.getPhysicalDatabase().loadProtection(entity.getWorld().getName(), A, A, A); if (!(entity instanceof Player)) { if (e.getDamager() instanceof Projectile) { if (protection != null) { e.setCancelled(true); } if ((((entity instanceof StorageMinecart)) || ((entity instanceof HopperMinecart))) && (protection != null)) { e.setCancelled(true); } } if (e.getDamager() instanceof Player) { Player p = (Player) e.getDamager(); if (protection != null && !lwc.canAccessProtection(p, protection)) { e.setCancelled(true); } if (p.hasPermission("lwc.lockentity." + e.getEntityType()) || p.hasPermission("lwc.lockentity.all")) { if (onPlayerEntityInteract(p, entity, e.isCancelled())) { e.setCancelled(true); } } if ((((entity instanceof StorageMinecart)) || ((entity instanceof HopperMinecart))) && (protection != null)) { e.setCancelled(true); } } } } }
Example #4
Source File: HopperMinecartBlock.java From Modern-LWC with MIT License | 4 votes |
public HopperMinecartBlock(HopperMinecart minecart) { super(minecart); this.minecart = minecart; }
Example #5
Source File: HopperMinecartBlock.java From Modern-LWC with MIT License | 4 votes |
public HopperMinecart getMinecart() { return this.minecart; }