diff --git a/gradle.properties b/gradle.properties index e9c16c5..b25ed98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.13.3 # Mod Properties - mod_version = 1.4.0 + mod_version = 1.4.1 maven_group = alujjdnd.ngrok.lan archives_base_name = ngrok-lan-expose-mod diff --git a/src/main/java/alujjdnd/ngrok/lan/command/LanDeopCommand.java b/src/main/java/alujjdnd/ngrok/lan/command/LanDeopCommand.java index 0bd1b51..83c33c0 100644 --- a/src/main/java/alujjdnd/ngrok/lan/command/LanDeopCommand.java +++ b/src/main/java/alujjdnd/ngrok/lan/command/LanDeopCommand.java @@ -10,6 +10,7 @@ import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.server.OperatorEntry; import net.minecraft.server.OperatorList; +import net.minecraft.server.PlayerManager; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; @@ -32,20 +33,16 @@ private static int execute(CommandContext ctx) throws Comma NgrokLan.LOGGER.info("/deop called"); //for debugging Collection targets = EntityArgumentType.getPlayers(ctx, "players"); - OperatorList ops = ctx.getSource().getServer().getPlayerManager().getOpList(); + PlayerManager playerManager = ctx.getSource().getServer().getPlayerManager(); for (ServerPlayerEntity playerToOp : targets) { GameProfile gameProfile = playerToOp.getGameProfile(); - if (ops.get(gameProfile) != null) { - ops.remove(gameProfile); - //bypassPlayerLimit -> allow player to join when server is full (not sure if it kicks people) + if (playerManager.isOperator(gameProfile)) { + playerManager.removeFromOperators(gameProfile); - TranslatableText message = new TranslatableText("commands.deop.success", gameProfile.getName()); - - ctx.getSource().sendFeedback(message, true); - mc.inGameHud.getChatHud().addMessage(message); + ctx.getSource().sendFeedback(new TranslatableText("commands.deop.success", gameProfile.getName()), true); } else { mc.inGameHud.getChatHud().addMessage(new TranslatableText("commands.deop.failed")); } diff --git a/src/main/java/alujjdnd/ngrok/lan/command/LanOpCommand.java b/src/main/java/alujjdnd/ngrok/lan/command/LanOpCommand.java index f5a9c71..b9b2fab 100644 --- a/src/main/java/alujjdnd/ngrok/lan/command/LanOpCommand.java +++ b/src/main/java/alujjdnd/ngrok/lan/command/LanOpCommand.java @@ -10,6 +10,7 @@ import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.server.OperatorEntry; import net.minecraft.server.OperatorList; +import net.minecraft.server.PlayerManager; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; @@ -33,22 +34,17 @@ private static int execute(CommandContext ctx) throws Comma NgrokLan.LOGGER.info("/op called"); //for debugging Collection targets = EntityArgumentType.getPlayers(ctx, "players"); - OperatorList ops = ctx.getSource().getServer().getPlayerManager().getOpList(); + PlayerManager playerManager = ctx.getSource().getServer().getPlayerManager(); for(ServerPlayerEntity playerToOp: targets){ GameProfile gameProfile = playerToOp.getGameProfile(); + if(!playerManager.isOperator(gameProfile)){ + playerManager.addToOperators(gameProfile); - if(ops.get(gameProfile) == null){ - ops.add(new OperatorEntry(gameProfile, 3, false) ); - //bypassPlayerLimit -> allow player to join when server is full (not sure if it kicks people) + ctx.getSource().sendFeedback(new TranslatableText("commands.op.success", gameProfile.getName()), true); - TranslatableText message = new TranslatableText("commands.op.success", gameProfile.getName()); - - ctx.getSource().sendFeedback(message, true); - - mc.inGameHud.getChatHud().addMessage(message); } else{ mc.inGameHud.getChatHud().addMessage(new TranslatableText("commands.op.fail")); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a85fd71..7d1f6ef 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "ngroklan", - "version": "${version}", + "version": "1.4.1", "name": "Ngrok LAN", "description": "Exposes your local LAN server to the internet with Ngrok.",