Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachesMLG committed Sep 23, 2023
2 parents 1f55928 + d9a5445 commit 82dee3e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public boolean execute(User user, Island island, String[] args, IridiumTeams<Isl
.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)
)));

IridiumSkyblock.getInstance().getIslandManager().clearTeamInventory(island);

IridiumSkyblock.getInstance().getIslandManager().generateIsland(island, schematicConfig).thenRun(() -> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down Expand Up @@ -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());
}
}

}

0 comments on commit 82dee3e

Please sign in to comment.