2024-12-08 22:04:30|Myriagame |source:minecraft skins
This tutorial is set by the author's setting without permission.
You may be an integrated package author, but you don't want your players to cheat in your integrated package, you can use CRT to control it.
Implementation effect:
If the player who logs in itself is the creative mode, you can use any instructions (using GameStage to identify);
If the player name of the login is the author name of the integrated package (or the player you want to specify), then you can use any instructions;
If the player logged in is the survival mode, no instructions are not available (even if the cheating authority is opened).
Before reading this tutorial, I define that readers have basic ZS language use functions. If you do n’t know much, you can try to read other tutorials here.
When writing code, I strongly recommend the Zen Utils module of the Youyihj.
For event applications, you can also view my tutorial.
Step 1: Guide package
Import Crafttweaker.events.ieventmanager;import crafttweaker.event.commandevent;
Import Crafttweaker.event.playerLoggedinevent;
Import crafttweaker.event.playerLogGEDEvent;
import crafttweaker.player.iplayer;
Import crafttweaker.command.icommand;
Step 2: Determine whether the player is the creative mode when logging in
Events.onPlayerLoggedin (function (event as playerLoggedinevent) {// player login event
Var Player as iPlayer = EVENT.Player; // Create an iPlayer object, use variable player to store
If (player.creative) {// Whether the player is the creative mode
Server.ComandManager.executecommand (server, "/GameStage Add"+Player.name+"Creative"); // Give the player game stage stage
}
});
Step 3: Players can use the instruction permissions and disable the player instruction
Events.OnCommand (Function (event as commandevent) {// event with instruction events
If (event.commandSender Instanceof iPlayer) {// Otherwise [Note 1]
Var Player as iPlayer = Event.commandSender; // Create an iPlayer object
If (Player.hasgamestage ("Creative") || Player.name == "BigGest_xuan") {// Decision whether the player has the game stage or integrate the author Return;
}
If (! Event.commandSender.World.remote) {// If the instruction is not issued by the server
Event.cancel (); // Cancel the event
Player.SendrichtextMessage (format.red ("Please don't use"+event.command.name+"command"); // Give the player prompt
}}
});
Note 1:
If you do not use Instanceof to determine whether it is the corresponding instance type, it will be reported
java.lang.IncomPatibleClassChangeerror: Class Crafttweaker.mc1120.Command.mCommandSender does Not Implement
The requested interface crafttweaker.api.player.iplayer
So be sure to add the corresponding judgment!
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57
The story between humans and
2025-01-28 09:16:27
Capture "Trinity 3: Artifact
2025-01-28 09:15:27
Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27
Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27
Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26
Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25
King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25
Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24
Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23
Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23
Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22
Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22
Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22