From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/GameModeCommand.cpp | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Minecraft.World/GameModeCommand.cpp (limited to 'Minecraft.World/GameModeCommand.cpp') diff --git a/Minecraft.World/GameModeCommand.cpp b/Minecraft.World/GameModeCommand.cpp new file mode 100644 index 00000000..86d4c5a5 --- /dev/null +++ b/Minecraft.World/GameModeCommand.cpp @@ -0,0 +1,53 @@ +#include "stdafx.h" +#include "net.minecraft.commands.h" +#include "GameModeCommand.h" + +EGameCommand GameModeCommand::getId() +{ + return eGameCommand_GameMode; +} + +void GameModeCommand::execute(shared_ptr source, byteArray commandData) +{ + //if (args.length > 0) + //{ + // GameType newMode = getModeForString(source, args[0]); + // Player player = args.length >= 2 ? getPlayer(args[1]) : convertSourceToPlayer(source); + + // player.setGameMode(newMode); + + // String mode = I18n.get("gameMode." + newMode.getName()); + + // if (player != source) { + // logAdminAction(source, AdminLogCommand.LOGTYPE_DONT_SHOW_TO_SELF, "commands.gamemode.success.other", player.getAName(), mode); + // } else { + // logAdminAction(source, AdminLogCommand.LOGTYPE_DONT_SHOW_TO_SELF, "commands.gamemode.success.self", mode); + // } + //} +} + +GameType *GameModeCommand::getModeForString(shared_ptr source, const wstring &name) +{ + return NULL; + //if (name.equalsIgnoreCase(GameType.SURVIVAL.getName()) || name.equalsIgnoreCase("s")) { + // return GameType.SURVIVAL; + //} else if (name.equalsIgnoreCase(GameType.CREATIVE.getName()) || name.equalsIgnoreCase("c")) { + // return GameType.CREATIVE; + //} else if (name.equalsIgnoreCase(GameType.ADVENTURE.getName()) || name.equalsIgnoreCase("a")) { + // return GameType.ADVENTURE; + //} else { + // return LevelSettings.validateGameType(convertArgToInt(source, name, 0, GameType.values().length - 2)); + //} +} + +shared_ptr GameModeCommand::getPlayer(PlayerUID playerId) +{ + return nullptr; + //Player player = MinecraftServer.getInstance().getPlayers().getPlayer(name); + + //if (player == null) { + // throw new PlayerNotFoundException(); + //} else { + // return player; + //} +} \ No newline at end of file -- cgit v1.2.3