Skip to content

Commit

Permalink
implemented potential fix but unable to run client
Browse files Browse the repository at this point in the history
  • Loading branch information
Flooflez committed Apr 16, 2022
1 parent 955e196 commit f8f4085
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 5 additions & 8 deletions src/main/java/alujjdnd/ngrok/lan/command/LanDeopCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,20 +33,16 @@ private static int execute(CommandContext<ServerCommandSource> ctx) throws Comma
NgrokLan.LOGGER.info("/deop called"); //for debugging
Collection<ServerPlayerEntity> 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"));
}
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/alujjdnd/ngrok/lan/command/LanOpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,22 +34,17 @@ private static int execute(CommandContext<ServerCommandSource> ctx) throws Comma
NgrokLan.LOGGER.info("/op called"); //for debugging
Collection<ServerPlayerEntity> 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"));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down

0 comments on commit f8f4085

Please sign in to comment.