Attribute Command Fix and Conditional Enabling

This commit is contained in:
Kam committed 2025-02-27 15:25:05 -05:00
1 parent baf06e7162
commit a328a635d7
2 files changed
+8 -6

No files matched your search

@@ -108,13 +108,13 @@ public class AttributeCommand extends CommandKamkeelBase {
// Check if this is a magic attribute.
if(def.getValueType() == AttributeValueType.MAGIC) {
if(args.length < 3){
sendError(sender, "Usage for magic attribute: apply <attribute> <magicID> <value>");
sendError(sender, "Usage for magic attribute: apply <attribute> <value> <magicID>");
return;
}
int magicId;
double value;
float value;
try {
value = Double.parseDouble(args[1]);
value = Float.parseFloat(args[1]);
magicId = Integer.parseInt(args[2]);
} catch(NumberFormatException e) {
sendError(sender, "Invalid number format for magicID or value.");
@@ -133,9 +133,9 @@ public class AttributeCommand extends CommandKamkeelBase {
sendError(sender, "Usage: <attribute> <value>");
return;
}
double value;
float value;
try {
value = Double.parseDouble(args[1]);
value = Float.parseFloat(args[1]);
} catch(NumberFormatException e) {
sendError(sender, "Invalid number format for value.");
return;
@@ -8,6 +8,7 @@ import net.minecraft.server.MinecraftServer;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.attribute.AttributeController;
import noppes.npcs.attribute.AttributeDefinition;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.scripted.CustomNPCsException;
import java.lang.reflect.Method;
@@ -35,7 +36,8 @@ public class CommandKamkeel extends CommandBase{
registerCommand(new OverlayCommand());
registerCommand(new CommandCommand());
registerCommand(new EffectCommand());
registerCommand(new AttributeCommand());
if(ConfigMain.AttributesEnabled)
registerCommand(new AttributeCommand());
}
public void registerCommand(CommandKamkeelBase command){