diff --git a/src/main/java/com/iridium/iridiumskyblock/commands/RegenCommand.java b/src/main/java/com/iridium/iridiumskyblock/commands/RegenCommand.java index fdedd1ce4..01a9a7f80 100644 --- a/src/main/java/com/iridium/iridiumskyblock/commands/RegenCommand.java +++ b/src/main/java/com/iridium/iridiumskyblock/commands/RegenCommand.java @@ -54,7 +54,10 @@ public void execute(User user, Island island, String[] args, IridiumTeams Bukkit.getScheduler().runTask(IridiumSkyblock.getInstance(), () -> { + if (IridiumSkyblock.getInstance().getTeamManager().teleport(player, island.getHome(), island)) { player.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().teleportingHome .replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix) diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java index 46d333e08..5b873a8ce 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java @@ -49,6 +49,8 @@ public Configuration() { public boolean obsidianBucket = true; public boolean removeIslandBlocksOnDelete = false; + public boolean clearInventoryOnRegen = false; + public boolean clearEnderChestOnRegen = false; public boolean allowPvPOnIslands = false; public int distance = 151; public int netherUnlockLevel = 10; diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index cdb7182c2..94ade66bc 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -215,7 +215,9 @@ public boolean deleteTeam(Island island, User user) { if (IridiumSkyblock.getInstance().getConfiguration().removeIslandBlocksOnDelete) { deleteIslandBlocks(island); } + IridiumSkyblock.getInstance().getDatabaseManager().getIslandTableManager().delete(island); + IridiumSkyblock.getInstance().getIslandManager().clearTeamInventory(island); getMembersOnIsland(island).forEach(member -> PlayerUtils.teleportSpawn(member.getPlayer())); @@ -592,4 +594,17 @@ public void handleBlockPlaceOutsideTerritory(BlockPlaceEvent blockEvent) { } } + public void clearTeamInventory(Island island) { + + if(IridiumSkyblock.getInstance().getConfiguration().clearInventoryOnRegen) { + IridiumSkyblock.getInstance().getIslandManager().getMembersOnIsland(island).forEach(member -> + member.getPlayer().getInventory().clear()); + } + + if(IridiumSkyblock.getInstance().getConfiguration().clearEnderChestOnRegen) { + IridiumSkyblock.getInstance().getIslandManager().getMembersOnIsland(island).forEach(member -> + member.getPlayer().getEnderChest().clear()); + } + } + }