1
mirror of https://github.com/Shiewk/SModeration.git synced 2026-04-28 05:54:16 +02:00

Allow opening own ender chest

This commit is contained in:
Shy
2024-08-22 15:28:25 +02:00
parent fb785fb53a
commit 3cb3314f4c
@@ -28,16 +28,12 @@ public class EnderchestSeeCommand implements TabExecutor {
if (sender instanceof HumanEntity human){ if (sender instanceof HumanEntity human){
final Player player = PlayerUtil.findOnlinePlayer(args[0]); final Player player = PlayerUtil.findOnlinePlayer(args[0]);
if (player != null) { if (player != null) {
if (human.getUniqueId().equals(player.getUniqueId())){ human.sendMessage(CHAT_PREFIX.append(
human.sendMessage(Component.text("You can't open your own ender chest.").color(FAIL_COLOR)); Component.text("Opening ender chest of ").color(PRIMARY_COLOR)
} else { .append(Component.text(player.getName()).color(SECONDARY_COLOR))
human.sendMessage(CHAT_PREFIX.append( .append(Component.text("."))
Component.text("Opening ender chest of ").color(PRIMARY_COLOR) ));
.append(Component.text(player.getName()).color(SECONDARY_COLOR)) human.openInventory(player.getEnderChest());
.append(Component.text("."))
));
human.openInventory(player.getEnderChest());
}
} else { } else {
human.sendMessage(Component.text("This player is not online.").color(FAIL_COLOR)); human.sendMessage(Component.text("This player is not online.").color(FAIL_COLOR));
} }