mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-09 20:21:07 +00:00
BentoBox integration fixes
This commit is contained in:
parent
0002055e5f
commit
0e25e4933d
@ -45,7 +45,7 @@ public class BentoBoxListener extends FlagListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleForLocation(Player player, Location loc, Cancellable e) {
|
private boolean handleForLocation(Player player, Location loc, Cancellable e) {
|
||||||
boolean allowed = checkIsland((Event) e, player, loc, BentoBoxShopFlag.SHOP_FLAG, true);
|
boolean allowed = checkIsland((Event) e, player, loc, BentoBoxShopFlag.SHOP_FLAG);
|
||||||
if (!allowed) {
|
if (!allowed) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
plugin.debug("Cancel Reason: BentoBox");
|
plugin.debug("Cancel Reason: BentoBox");
|
||||||
|
@ -15,9 +15,11 @@ import de.epiceric.shopchest.shop.Shop;
|
|||||||
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandBanEvent;
|
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandBanEvent;
|
||||||
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeleteChunksEvent;
|
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeleteChunksEvent;
|
||||||
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeletedEvent;
|
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeletedEvent;
|
||||||
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandExpelEvent;
|
|
||||||
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandResettedEvent;
|
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandResettedEvent;
|
||||||
|
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamKickEvent;
|
||||||
|
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamLeaveEvent;
|
||||||
import world.bentobox.bentobox.database.objects.Island;
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
|
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||||
|
|
||||||
public class BentoBoxListener implements Listener {
|
public class BentoBoxListener implements Listener {
|
||||||
private ShopChest plugin;
|
private ShopChest plugin;
|
||||||
@ -28,7 +30,17 @@ public class BentoBoxListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onIslandDeleted(IslandDeletedEvent e) {
|
public void onIslandDeleted(IslandDeletedEvent e) {
|
||||||
deleteShops(e.getIsland().getWorld(), e.getDeletedIslandInfo().getBox());
|
deleteShops(e.getDeletedIslandInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onIslandDeleteChunks(IslandDeleteChunksEvent e) {
|
||||||
|
deleteShops(e.getDeletedIslandInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onIslandResetted(IslandResettedEvent e) {
|
||||||
|
deleteShops(e.getIsland(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
@ -36,35 +48,24 @@ public class BentoBoxListener implements Listener {
|
|||||||
deleteShops(e.getIsland(), e.getPlayerUUID());
|
deleteShops(e.getIsland(), e.getPlayerUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onIslandResetted(IslandResettedEvent e) {
|
|
||||||
deleteShops(e.getIsland());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onIslandResettead(IslandDeleteChunksEvent e) {
|
public void onTeamKick(TeamKickEvent e) {
|
||||||
deleteShops(e.getIsland().getWorld(), e.getDeletedIslandInfo().getBox());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
||||||
public void onIslandResettead(IslandExpelEvent e) {
|
|
||||||
deleteShops(e.getIsland(), e.getPlayerUUID());
|
deleteShops(e.getIsland(), e.getPlayerUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility methods
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onTeamLeave(TeamLeaveEvent e) {
|
||||||
|
deleteShops(e.getIsland(), e.getPlayerUUID());
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteShops(Island island) {
|
private void deleteShops(IslandDeletion deletedIsland) {
|
||||||
deleteShops(island.getWorld(), island.getBoundingBox(), null);
|
deleteShops(deletedIsland.getWorld(), deletedIsland.getBox(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteShops(Island island, UUID vendorUuid) {
|
private void deleteShops(Island island, UUID vendorUuid) {
|
||||||
deleteShops(island.getWorld(), island.getBoundingBox(), vendorUuid);
|
deleteShops(island.getWorld(), island.getBoundingBox(), vendorUuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteShops(World world, BoundingBox box) {
|
|
||||||
deleteShops(world, box, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteShops(World world, BoundingBox box, UUID vendorUuid) {
|
private void deleteShops(World world, BoundingBox box, UUID vendorUuid) {
|
||||||
if (!Config.enableBentoBoxIntegration)
|
if (!Config.enableBentoBoxIntegration)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user