Send message to player to tell he cannot change the island settings as he's not owner

#638
This commit is contained in:
Florian CUNY 2019-05-04 23:27:53 +02:00
parent a3a50c1961
commit 4f84f37461
3 changed files with 4 additions and 6 deletions

View File

@ -2,7 +2,6 @@ package world.bentobox.bentobox.api.flags.clicklisteners;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.localization.TextVariables; import world.bentobox.bentobox.api.localization.TextVariables;
@ -109,6 +108,8 @@ public class CycleClick implements PanelItem.ClickHandler {
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user, invisible).getItem()); panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user, invisible).getItem());
}); });
} else { } else {
// Player is not the owner of the island.
user.getPlayer().sendMessage("general.errors.not-owner");
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F); user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
} }
return true; return true;

View File

@ -1,6 +1,3 @@
/**
*
*/
package world.bentobox.bentobox.api.flags.clicklisteners; package world.bentobox.bentobox.api.flags.clicklisteners;
import world.bentobox.bentobox.api.events.island.IslandEvent; import world.bentobox.bentobox.api.events.island.IslandEvent;

View File

@ -2,7 +2,6 @@ package world.bentobox.bentobox.api.flags.clicklisteners;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.localization.TextVariables; import world.bentobox.bentobox.api.localization.TextVariables;
@ -69,9 +68,10 @@ public class IslandToggleClick implements ClickHandler {
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user, invisible).getItem()); panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user, invisible).getItem());
}); });
} else { } else {
// Player is not the owner of the island.
user.getPlayer().sendMessage("general.errors.not-owner");
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F); user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
} }
return true; return true;
} }
} }