fixes
All checks were successful
/ Auto-Build-App (push) Successful in 1m41s

This commit is contained in:
pietru 2024-11-08 11:55:28 +01:00
parent 21b06d2975
commit 3b80b5bf8c
2 changed files with 8 additions and 7 deletions

View file

@ -224,7 +224,7 @@ public class TextCommands {
if (created){ if (created){
try { try {
set_server_property("zones",zones); set_server_property("zones",zones.toString());
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -235,21 +235,22 @@ public class TextCommands {
}); });
commands.put("send",(args, networkIdentity, channelHandlerContext) -> { commands.put("send",(args, networkIdentity, channelHandlerContext) -> {
Account account = ServerSingletons.getAccount(networkIdentity);
Player player = ServerSingletons.getPlayer(networkIdentity); Player player = ServerSingletons.getPlayer(networkIdentity);
String txt = "[Server] Could not send plr to zone..."; String txt = "[Server] Could not send plr to zone...";
if (args.length>=2){ if (args.length>=2){
String zoneId = args[1]; String zoneId = args[1];
Zone zone = GameSingletons.world.getZoneIfExists(zoneId); Zone zone = GameSingletons.world.getZoneIfExists(zoneId);
if (args.length>=3){ if (args.length>=3 && has_perm(account.getUniqueId(), "send.other")){
player = parseAsPlayer(args[2]); player = parseAsPlayer(args[2]);
} }
if (player!=null && zone!=null){ if (player!=null && zone!=null){
txt="[server] Sended "+player.getAccount().getDisplayName()+" to zone "+zoneId; txt="[server] Sended "+player.getAccount().getDisplayName()+" to zone "+zoneId;
player.getZone().removePlayer(player);
player.respawn(zone);
zone.addPlayer(player); zone.addPlayer(player);
player.respawn(zone);
player.getZone().removePlayer(player);
} }
} }

View file

@ -21,9 +21,9 @@ public class NettyServerMixin {
try { try {
ArrayList<String> zones = get_server_property_array("zones","[]"); ArrayList<String> zones = get_server_property_array("zones","[]");
for (String zoneId : zones){ for (String zoneId : zones){
Zone z = GameSingletons.world.getZoneIfExists(zoneId); Zone z = GameSingletons.world.getZoneIfExists(zoneId.replace(" ",""));
if (z == null && GameSingletons.isHost) { if (!zoneId.isEmpty() && z == null && GameSingletons.isHost) {
z = Zone.loadZone(GameSingletons.world, zoneId); z = Zone.loadZone(GameSingletons.world, zoneId.replace(" ",""));
GameSingletons.world.addZone(z); GameSingletons.world.addZone(z);
} }
} }