mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 21:06:16 +00:00
refactor: improve the server has command function in ServerUtilities
This commit is contained in:
parent
3a5e4490ee
commit
11d89993b2
1 changed files with 1 additions and 9 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
package land.chipmunk.chipmunkmod.util;
|
package land.chipmunk.chipmunkmod.util;
|
||||||
|
|
||||||
import com.mojang.brigadier.tree.CommandNode;
|
|
||||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
|
|
||||||
|
|
@ -12,12 +10,6 @@ public class ServerUtilities {
|
||||||
|
|
||||||
if (networkHandler == null) return false;
|
if (networkHandler == null) return false;
|
||||||
|
|
||||||
for (CommandNode node : networkHandler.getCommandDispatcher().getRoot().getChildren()) {
|
return networkHandler.getCommandDispatcher().getRoot().getChild(name) != null;
|
||||||
if (!(node instanceof LiteralCommandNode literal)) continue;
|
|
||||||
|
|
||||||
if (literal.getLiteral().equals(name)) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue