mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 07:19:56 +03:00
28 lines
1.5 KiB
Diff
28 lines
1.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/command/CommandGameMode.java
|
|
+++ ../src-work/minecraft/net/minecraft/command/CommandGameMode.java
|
|
@@ -4,9 +4,11 @@
|
|
import java.util.List;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
+import net.minecraft.entity.player.EntityPlayerMP;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
+import net.minecraft.util.text.TextComponentString;
|
|
import net.minecraft.util.text.TextComponentTranslation;
|
|
import net.minecraft.world.GameType;
|
|
import net.minecraft.world.WorldSettings;
|
|
@@ -39,6 +41,12 @@
|
|
GameType gametype = this.getGameModeFromCommand(sender, args[0]);
|
|
EntityPlayer entityplayer = args.length >= 2 ? getPlayer(server, sender, args[1]) : getCommandSenderAsPlayer(sender);
|
|
entityplayer.setGameType(gametype);
|
|
+ // CraftBukkit start - handle event cancelling the change
|
|
+ if (((EntityPlayerMP) entityplayer).interactionManager.getGameType() != gametype) {
|
|
+ sender.sendMessage(new TextComponentString("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
ITextComponent itextcomponent = new TextComponentTranslation("gameMode." + gametype.getName(), new Object[0]);
|
|
|
|
if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback"))
|