aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/EffectCommand.cpp
diff options
context:
space:
mode:
authordaoge <3523206925@qq.com>2026-03-03 03:04:10 +0800
committerGitHub <noreply@github.com>2026-03-03 03:04:10 +0800
commitb3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch)
tree267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/EffectCommand.cpp
parent84c31a2331f7a0ec85b9d438992e244f60e5020f (diff)
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/EffectCommand.cpp')
-rw-r--r--Minecraft.World/EffectCommand.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/Minecraft.World/EffectCommand.cpp b/Minecraft.World/EffectCommand.cpp
new file mode 100644
index 00000000..5d708db8
--- /dev/null
+++ b/Minecraft.World/EffectCommand.cpp
@@ -0,0 +1,86 @@
+#include "stdafx.h"
+#include "net.minecraft.commands.common.h"
+#include "..\Minecraft.Client\MinecraftServer.h"
+
+EGameCommand EffectCommand::getId()
+{
+ return eGameCommand_Effect;
+}
+
+int EffectCommand::getPermissionLevel()
+{
+ return LEVEL_GAMEMASTERS;
+}
+
+wstring EffectCommand::getUsage(CommandSender *source)
+{
+ return L"commands.effect.usage";
+}
+
+void EffectCommand::execute(shared_ptr<CommandSender> source, byteArray commandData)
+{
+ //if (args.length >= 2)
+ //{
+ // Player player = convertToPlayer(source, args[0]);
+
+ // if (args[1].equals("clear")) {
+ // if (player.getActiveEffects().isEmpty()) {
+ // throw new CommandException("commands.effect.failure.notActive.all", player.getAName());
+ // } else {
+ // player.removeAllEffects();
+ // logAdminAction(source, "commands.effect.success.removed.all", player.getAName());
+ // }
+ // } else {
+ // int effectId = convertArgToInt(source, args[1], 1);
+ // int duration = SharedConstants.TICKS_PER_SECOND * 30;
+ // int seconds = 30;
+ // int amplifier = 0;
+
+ // if (effectId < 0 || effectId >= MobEffect.effects.length || MobEffect.effects[effectId] == null) {
+ // throw new InvalidNumberException("commands.effect.notFound", effectId);
+ // }
+
+ // if (args.length >= 3) {
+ // seconds = convertArgToInt(source, args[2], 0, 1000000);
+ // if (MobEffect.effects[effectId].isInstantenous()) {
+ // duration = seconds;
+ // } else {
+ // duration = seconds * SharedConstants.TICKS_PER_SECOND;
+ // }
+ // } else if (MobEffect.effects[effectId].isInstantenous()) {
+ // duration = 1;
+ // }
+
+ // if (args.length >= 4) {
+ // amplifier = convertArgToInt(source, args[3], 0, 255);
+ // }
+
+ // if (seconds == 0) {
+ // if (player.hasEffect(effectId)) {
+ // player.removeEffect(effectId);
+ // logAdminAction(source, "commands.effect.success.removed", ChatMessageComponent.forTranslation(MobEffect.effects[effectId].getDescriptionId()), player.getAName());
+ // } else {
+ // throw new CommandException("commands.effect.failure.notActive", ChatMessageComponent.forTranslation(MobEffect.effects[effectId].getDescriptionId()), player.getAName());
+ // }
+ // } else {
+ // MobEffectInstance instance = new MobEffectInstance(effectId, duration, amplifier);
+ // player.addEffect(instance);
+ // logAdminAction(source, "commands.effect.success", ChatMessageComponent.forTranslation(instance.getDescriptionId()), effectId, amplifier, player.getAName(), seconds);
+ // }
+ // }
+
+ // return;
+ //}
+
+ //throw new UsageException("commands.effect.usage");
+}
+
+wstring EffectCommand::getPlayerNames()
+{
+ return L""; //MinecraftServer::getInstance()->getPlayerNames();
+}
+
+bool EffectCommand::isValidWildcardPlayerArgument(wstring args, int argumentIndex)
+{
+ return argumentIndex == 0;
+} \ No newline at end of file