Add /npc llama -c/b

This commit is contained in:
fullwall 2022-01-02 01:33:19 +08:00
parent 5fffa23e94
commit bf3bf6f776
10 changed files with 70 additions and 2 deletions

View File

@ -923,10 +923,10 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
usage = "horse|llama|donkey|mule (--color color) (--type type) (--style style) (-cb)",
usage = "horse|donkey|mule (--color color) (--type type) (--style style) (-cb)",
desc = "Sets horse and horse-like entity modifiers",
help = "Use the -c flag to make the NPC have a chest, or the -b flag to stop them from having a chest.",
modifiers = { "horse", "llama", "donkey", "mule" },
modifiers = { "horse", "donkey", "mule" },
min = 1,
max = 1,
flags = "cb",
@ -939,6 +939,7 @@ public class NPCCommands {
}
HorseModifiers horse = npc.getOrAddTrait(HorseModifiers.class);
String output = "";
if (args.hasFlag('c')) {
horse.setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";

View File

@ -111,6 +111,8 @@ public class HorseModifiers extends Trait {
horse.getInventory().setArmor(armor);
horse.getInventory().setSaddle(saddle);
}
if (CARRYING_CHEST_METHOD == null)
return;
EntityType type = npc.getEntity().getType();
if (type.name().equals("LLAMA") || type.name().equals("TRADER_LLAMA") || type.name().equals("DONKEY")
|| type.name().equals("MULE")) {

View File

@ -21,6 +21,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.LlamaTrait;
import net.citizensnpcs.trait.versioned.PolarBearTrait;
@ -96,6 +97,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -22,6 +22,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.LlamaTrait;
import net.citizensnpcs.trait.versioned.ParrotTrait;
@ -98,6 +99,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -23,6 +23,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.LlamaTrait;
import net.citizensnpcs.trait.versioned.ParrotTrait;
@ -102,6 +103,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -30,6 +30,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.CatTrait;
@ -206,6 +207,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -30,6 +30,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
@ -245,6 +246,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -30,6 +30,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
@ -245,6 +246,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -31,6 +31,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
@ -281,6 +282,13 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}

View File

@ -31,6 +31,7 @@ import net.citizensnpcs.api.command.exception.CommandUsageException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.trait.HorseModifiers;
import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
@ -281,6 +282,14 @@ public class Commands {
trait.setStrength(Math.max(1, Math.min(5, args.getFlagInteger("strength"))));
output += Messaging.tr(Messages.LLAMA_STRENGTH_SET, args.getFlagInteger("strength"));
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(true);
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
} else if (args.hasFlag('b')) {
npc.getOrAddTrait(HorseModifiers.class).setCarryingChest(false);
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
}
if (!output.isEmpty()) {
Messaging.send(sender, output);
}