From 3b80b5bf8c91f558d6d60c8da91df5e4b556c1d2 Mon Sep 17 00:00:00 2001 From: pietru Date: Fri, 8 Nov 2024 11:55:28 +0100 Subject: [PATCH] fixes --- .../java/net/pietru/cookie_utils/api/TextCommands.java | 9 +++++---- .../net/pietru/cookie_utils/mixins/NettyServerMixin.java | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pietru/cookie_utils/api/TextCommands.java b/src/main/java/net/pietru/cookie_utils/api/TextCommands.java index 0b54391..2d4f252 100644 --- a/src/main/java/net/pietru/cookie_utils/api/TextCommands.java +++ b/src/main/java/net/pietru/cookie_utils/api/TextCommands.java @@ -224,7 +224,7 @@ public class TextCommands { if (created){ try { - set_server_property("zones",zones); + set_server_property("zones",zones.toString()); } catch (IOException e) { throw new RuntimeException(e); } @@ -235,21 +235,22 @@ public class TextCommands { }); commands.put("send",(args, networkIdentity, channelHandlerContext) -> { + Account account = ServerSingletons.getAccount(networkIdentity); Player player = ServerSingletons.getPlayer(networkIdentity); String txt = "[Server] Could not send plr to zone..."; if (args.length>=2){ String zoneId = args[1]; Zone zone = GameSingletons.world.getZoneIfExists(zoneId); - if (args.length>=3){ + if (args.length>=3 && has_perm(account.getUniqueId(), "send.other")){ player = parseAsPlayer(args[2]); } if (player!=null && zone!=null){ txt="[server] Sended "+player.getAccount().getDisplayName()+" to zone "+zoneId; - player.getZone().removePlayer(player); - player.respawn(zone); zone.addPlayer(player); + player.respawn(zone); + player.getZone().removePlayer(player); } } diff --git a/src/main/java/net/pietru/cookie_utils/mixins/NettyServerMixin.java b/src/main/java/net/pietru/cookie_utils/mixins/NettyServerMixin.java index 4e9fb14..e452809 100644 --- a/src/main/java/net/pietru/cookie_utils/mixins/NettyServerMixin.java +++ b/src/main/java/net/pietru/cookie_utils/mixins/NettyServerMixin.java @@ -21,9 +21,9 @@ public class NettyServerMixin { try { ArrayList zones = get_server_property_array("zones","[]"); for (String zoneId : zones){ - Zone z = GameSingletons.world.getZoneIfExists(zoneId); - if (z == null && GameSingletons.isHost) { - z = Zone.loadZone(GameSingletons.world, zoneId); + Zone z = GameSingletons.world.getZoneIfExists(zoneId.replace(" ","")); + if (!zoneId.isEmpty() && z == null && GameSingletons.isHost) { + z = Zone.loadZone(GameSingletons.world, zoneId.replace(" ","")); GameSingletons.world.addZone(z); } }