Check if player is previewing an island before cleaning inventory and info commands.

This commit is contained in:
Fernando Pettinelli 2020-11-30 20:14:58 -03:00 committed by Brianna
parent 0ef9296cdc
commit 83cbff38ea
3 changed files with 11 additions and 2 deletions

View File

@ -59,6 +59,13 @@ public class InformationCommand extends SubCommand {
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
if (playerData.isPreview()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Information.Previewing.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (islandOwnerUUID == null) {
if (islandManager.getIsland(player) == null) {
messageManager.sendMessage(player,

View File

@ -580,10 +580,10 @@ public class IslandManager {
}
// TODO - Find a way to delete also offline players
if (configLoad.getBoolean("Island.Deletion.ClearInventory", false)){
if (configLoad.getBoolean("Island.Deletion.ClearInventory", false) && !playerData.isPreview()) {
player.getInventory().clear();
}
if (configLoad.getBoolean("Island.Deletion.ClearEnderChest", false)){
if (configLoad.getBoolean("Island.Deletion.ClearEnderChest", false) && !playerData.isPreview()) {
player.getEnderChest().clear();
}

View File

@ -841,6 +841,8 @@ Command:
Message: '&bSkyBlock &8| &cError&8: &eYou don''t have permission to view information on other players'' Islands.'
Owner:
Message: '&bSkyBlock &8| &cError&8: &eYou are not an Island Owner.'
Previewing:
Message: '&bSkyBlock &8| &cError&8: &eYou are currently previewing an island.'
Info:
Message: '&f&oOpens the Island Information menu.'
Reset: