the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 86 lines 2.8 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.commands.common.h" 3#include "..\Minecraft.Client\MinecraftServer.h" 4 5EGameCommand EffectCommand::getId() 6{ 7 return eGameCommand_Effect; 8} 9 10int EffectCommand::getPermissionLevel() 11{ 12 return LEVEL_GAMEMASTERS; 13} 14 15wstring EffectCommand::getUsage(CommandSender *source) 16{ 17 return L"commands.effect.usage"; 18} 19 20void EffectCommand::execute(shared_ptr<CommandSender> source, byteArray commandData) 21{ 22 //if (args.length >= 2) 23 //{ 24 // Player player = convertToPlayer(source, args[0]); 25 26 // if (args[1].equals("clear")) { 27 // if (player.getActiveEffects().isEmpty()) { 28 // throw new CommandException("commands.effect.failure.notActive.all", player.getAName()); 29 // } else { 30 // player.removeAllEffects(); 31 // logAdminAction(source, "commands.effect.success.removed.all", player.getAName()); 32 // } 33 // } else { 34 // int effectId = convertArgToInt(source, args[1], 1); 35 // int duration = SharedConstants.TICKS_PER_SECOND * 30; 36 // int seconds = 30; 37 // int amplifier = 0; 38 39 // if (effectId < 0 || effectId >= MobEffect.effects.length || MobEffect.effects[effectId] == null) { 40 // throw new InvalidNumberException("commands.effect.notFound", effectId); 41 // } 42 43 // if (args.length >= 3) { 44 // seconds = convertArgToInt(source, args[2], 0, 1000000); 45 // if (MobEffect.effects[effectId].isInstantenous()) { 46 // duration = seconds; 47 // } else { 48 // duration = seconds * SharedConstants.TICKS_PER_SECOND; 49 // } 50 // } else if (MobEffect.effects[effectId].isInstantenous()) { 51 // duration = 1; 52 // } 53 54 // if (args.length >= 4) { 55 // amplifier = convertArgToInt(source, args[3], 0, 255); 56 // } 57 58 // if (seconds == 0) { 59 // if (player.hasEffect(effectId)) { 60 // player.removeEffect(effectId); 61 // logAdminAction(source, "commands.effect.success.removed", ChatMessageComponent.forTranslation(MobEffect.effects[effectId].getDescriptionId()), player.getAName()); 62 // } else { 63 // throw new CommandException("commands.effect.failure.notActive", ChatMessageComponent.forTranslation(MobEffect.effects[effectId].getDescriptionId()), player.getAName()); 64 // } 65 // } else { 66 // MobEffectInstance instance = new MobEffectInstance(effectId, duration, amplifier); 67 // player.addEffect(instance); 68 // logAdminAction(source, "commands.effect.success", ChatMessageComponent.forTranslation(instance.getDescriptionId()), effectId, amplifier, player.getAName(), seconds); 69 // } 70 // } 71 72 // return; 73 //} 74 75 //throw new UsageException("commands.effect.usage"); 76} 77 78wstring EffectCommand::getPlayerNames() 79{ 80 return L""; //MinecraftServer::getInstance()->getPlayerNames(); 81} 82 83bool EffectCommand::isValidWildcardPlayerArgument(wstring args, int argumentIndex) 84{ 85 return argumentIndex == 0; 86}