Allow containers to be named playernames to have them be accessed by that player

This commit is contained in:
Len 2023-10-31 21:23:05 +01:00
parent 543820ab71
commit d26c6a8082

View File

@ -1141,7 +1141,8 @@ class PlayerEventHandler implements Listener
if(block.getState() instanceof InventoryHolder) {
if (block.getState() instanceof Nameable nameable) {
if (nameable.getCustomName() != null) {
if (ChatColor.stripColor(nameable.getCustomName()).equalsIgnoreCase("public")) {
String customName = ChatColor.stripColor(nameable.getCustomName());
if (customName.equalsIgnoreCase("public") || customName.equalsIgnoreCase(player.getName())) {
return;
}
}