Fix /npc mushroomcow, increase base player speed

This commit is contained in:
fullwall 2020-05-06 11:13:54 +08:00
parent e89cd03cce
commit e1f749236b
3 changed files with 25 additions and 27 deletions

View File

@ -210,7 +210,7 @@ public class Commands {
min = 1, min = 1,
max = 1, max = 1,
permission = "citizens.npc.mushroomcow") permission = "citizens.npc.mushroomcow")
@Requirements(selected = true, ownership = true, types = { EntityType.SHULKER }) @Requirements(selected = true, ownership = true, types = { EntityType.MUSHROOM_COW })
public void mushroomcow(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void mushroomcow(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
MushroomCowTrait trait = npc.getTrait(MushroomCowTrait.class); MushroomCowTrait trait = npc.getTrait(MushroomCowTrait.class);
boolean hasArg = false; boolean hasArg = false;
@ -375,6 +375,29 @@ public class Commands {
} }
} }
@Command(
aliases = { "npc" },
usage = "snowman (-d[erp])",
desc = "Sets snowman modifiers.",
modifiers = { "snowman" },
min = 1,
max = 1,
flags = "d",
permission = "citizens.npc.snowman")
@Requirements(selected = true, ownership = true, types = { EntityType.SNOWMAN })
public void snowman(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
SnowmanTrait trait = npc.getTrait(SnowmanTrait.class);
boolean hasArg = false;
if (args.hasFlag('d')) {
boolean isDerp = trait.toggleDerp();
Messaging.sendTr(sender, isDerp ? Messages.SNOWMAN_DERP_SET : Messages.SNOWMAN_DERP_STOPPED, npc.getName());
hasArg = true;
}
if (!hasArg) {
throw new CommandUsageException();
}
}
@Command( @Command(
aliases = { "npc" }, aliases = { "npc" },
usage = "tfish (--body color) (--pattern pattern) (--patterncolor color)", usage = "tfish (--body color) (--pattern pattern) (--patterncolor color)",
@ -464,27 +487,4 @@ public class Commands {
throw new CommandUsageException(); throw new CommandUsageException();
} }
} }
@Command(
aliases = { "npc" },
usage = "snowman (-d[erp])",
desc = "Sets snowman modifiers.",
modifiers = { "snowman" },
min = 1,
max = 1,
flags = "d",
permission = "citizens.npc.snowman")
@Requirements(selected = true, ownership = true, types = { EntityType.SNOWMAN })
public void snowman(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
SnowmanTrait trait = npc.getTrait(SnowmanTrait.class);
boolean hasArg = false;
if (args.hasFlag('d')) {
boolean isDerp = trait.toggleDerp();
Messaging.sendTr(sender, isDerp ? Messages.SNOWMAN_DERP_SET : Messages.SNOWMAN_DERP_STOPPED, npc.getName());
hasArg = true;
}
if (!hasArg) {
throw new CommandUsageException();
}
}
} }

View File

@ -249,7 +249,7 @@ public class Commands {
min = 1, min = 1,
max = 1, max = 1,
permission = "citizens.npc.mushroomcow") permission = "citizens.npc.mushroomcow")
@Requirements(selected = true, ownership = true, types = { EntityType.SHULKER }) @Requirements(selected = true, ownership = true, types = { EntityType.MUSHROOM_COW })
public void mushroomcow(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void mushroomcow(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
MushroomCowTrait trait = npc.getTrait(MushroomCowTrait.class); MushroomCowTrait trait = npc.getTrait(MushroomCowTrait.class);
boolean hasArg = false; boolean hasArg = false;

View File

@ -51,8 +51,6 @@ public class PlayerControllerMove extends ControllerMove {
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (this.a instanceof EntitySlime) { if (this.a instanceof EntitySlime) {
speed.setValue(0.3D * this.e); speed.setValue(0.3D * this.e);
} else {
speed.setValue(0.2D * this.e);
} }
float movement = (float) (this.e * speed.getValue()); float movement = (float) (this.e * speed.getValue());
this.a.o(movement); this.a.o(movement);