mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-03 06:57:41 +01:00
Renamed PVP and Item Drop/pickup related flags
Also assigned the ItemDropPickUpListener() to the related events
This commit is contained in:
parent
5293d647c0
commit
3d7b1bc647
@ -23,7 +23,7 @@ public class ItemDropPickUpListener extends AbstractFlagListener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onVisitorDrop(PlayerDropItemEvent e) {
|
public void onVisitorDrop(PlayerDropItemEvent e) {
|
||||||
checkIsland(e, e.getItemDrop().getLocation(), Flags.VISITOR_ITEM_DROP);
|
checkIsland(e, e.getItemDrop().getLocation(), Flags.ITEM_DROP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -33,7 +33,7 @@ public class ItemDropPickUpListener extends AbstractFlagListener {
|
|||||||
public void onVisitorDrop(EntityPickupItemEvent e) {
|
public void onVisitorDrop(EntityPickupItemEvent e) {
|
||||||
if (e.getEntity() instanceof Player) {
|
if (e.getEntity() instanceof Player) {
|
||||||
setUser(User.getInstance(e.getEntity()));
|
setUser(User.getInstance(e.getEntity()));
|
||||||
checkIsland(e, e.getItem().getLocation(), Flags.VISITOR_ITEM_PICKUP);
|
checkIsland(e, e.getItem().getLocation(), Flags.ITEM_PICKUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityDamage(final EntityDamageByEntityEvent e) {
|
public void onEntityDamage(final EntityDamageByEntityEvent e) {
|
||||||
if (e.getEntity() instanceof Player) {
|
if (e.getEntity() instanceof Player) {
|
||||||
Flag flag = Flags.PVP;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
|
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
|
||||||
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
|
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
|
||||||
respond(e, e.getDamager(), flag);
|
respond(e, e.getDamager(), flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,9 +72,9 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onFishing(PlayerFishEvent e) {
|
public void onFishing(PlayerFishEvent e) {
|
||||||
if (e.getCaught() != null && e.getCaught() instanceof Player) {
|
if (e.getCaught() != null && e.getCaught() instanceof Player) {
|
||||||
Flag flag = Flags.PVP;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
|
if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
|
||||||
else if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
|
else if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
|
||||||
if (checkIsland(e, e.getCaught().getLocation(), flag)) {
|
if (checkIsland(e, e.getCaught().getLocation(), flag)) {
|
||||||
e.getHook().remove();
|
e.getHook().remove();
|
||||||
return;
|
return;
|
||||||
@ -89,9 +89,9 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
|
||||||
public void onSplashPotionSplash(final PotionSplashEvent e) {
|
public void onSplashPotionSplash(final PotionSplashEvent e) {
|
||||||
// Deduce the world
|
// Deduce the world
|
||||||
Flag flag = Flags.PVP;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
|
if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
|
||||||
else if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
|
else if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
|
||||||
|
|
||||||
// Try to get the thrower
|
// Try to get the thrower
|
||||||
Projectile projectile = (Projectile) e.getEntity();
|
Projectile projectile = (Projectile) e.getEntity();
|
||||||
@ -138,9 +138,9 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
|
|
||||||
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
|
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
|
||||||
// Deduce the world
|
// Deduce the world
|
||||||
Flag flag = Flags.PVP;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
|
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
|
||||||
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
|
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
|
||||||
|
|
||||||
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
|
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
|
||||||
// Self damage
|
// Self damage
|
||||||
|
@ -4,22 +4,7 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
import us.tastybento.bskyblock.api.flags.Flag;
|
import us.tastybento.bskyblock.api.flags.Flag;
|
||||||
import us.tastybento.bskyblock.api.flags.FlagBuilder;
|
import us.tastybento.bskyblock.api.flags.FlagBuilder;
|
||||||
import us.tastybento.bskyblock.listeners.flags.BlockInteractionListener;
|
import us.tastybento.bskyblock.listeners.flags.*;
|
||||||
import us.tastybento.bskyblock.listeners.flags.BreakBlocksListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.BreedingListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.BucketListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.EggListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.EntityInteractListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.FireListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.HurtingListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.InventoryListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.LeashListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.PVPListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.PhysicalInteractionListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.PlaceBlocksListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.PortalListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.ShearingListener;
|
|
||||||
import us.tastybento.bskyblock.listeners.flags.TeleportationListener;
|
|
||||||
|
|
||||||
public class Flags {
|
public class Flags {
|
||||||
|
|
||||||
@ -100,20 +85,21 @@ public class Flags {
|
|||||||
public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build();
|
public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build();
|
||||||
|
|
||||||
// PVP
|
// PVP
|
||||||
public static final Flag PVP = new FlagBuilder().id("PVP").icon(Material.ARROW).listener(new PVPListener()).build();
|
public static final Flag PVP_OVERWORLD = new FlagBuilder().id("PVP_OVERWORLD").icon(Material.ARROW).listener(new PVPListener()).build();
|
||||||
public static final Flag NETHER_PVP = new FlagBuilder().id("NETHER_PVP").icon(Material.IRON_AXE).build();
|
public static final Flag PVP_NETHER = new FlagBuilder().id("PVP_NETHER").icon(Material.IRON_AXE).build();
|
||||||
public static final Flag END_PVP = new FlagBuilder().id("END_PVP").icon(Material.END_CRYSTAL).build();
|
public static final Flag PVP_END = new FlagBuilder().id("PVP_END").icon(Material.END_CRYSTAL).build();
|
||||||
|
|
||||||
// Shearing
|
// Shearing
|
||||||
public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener()).build();
|
public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener()).build();
|
||||||
|
|
||||||
// Visitor item pickup or drop
|
// Item pickup or drop
|
||||||
public static final Flag VISITOR_ITEM_DROP = new FlagBuilder().id("VISITOR_ITEM_DROP").icon(Material.DIRT).build();
|
public static final Flag ITEM_DROP = new FlagBuilder().id("ITEM_DROP").icon(Material.DIRT).listener(new ItemDropPickUpListener()).build();
|
||||||
public static final Flag VISITOR_ITEM_PICKUP = new FlagBuilder().id("VISITOR_ITEM_PICKUP").icon(Material.DIRT).build();
|
public static final Flag ITEM_PICKUP = new FlagBuilder().id("ITEM_PICKUP").icon(Material.DIRT).build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Non-protection flags
|
* Non-protection flags
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).build();
|
public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).build();
|
||||||
public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).build();
|
public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).build();
|
||||||
public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).build();
|
public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).build();
|
||||||
|
Loading…
Reference in New Issue
Block a user