Skip to content

Commit

Permalink
Fix tadpoles, /npc goat, don't build unnecessary modules
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jun 11, 2022
1 parent aaf8703 commit 53d8e96
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions main/src/main/java/net/citizensnpcs/EventListen.java
Expand Up @@ -15,6 +15,7 @@
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -642,14 +643,13 @@ public void onVehicleEnter(final VehicleEnterEvent event) {
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getVehicle());
NPC rider = CitizensAPI.getNPCRegistry().getNPC(event.getEntered());
if (npc == null) {
if (rider != null && rider.isProtected()
&& (event.getVehicle().getType() == EntityType.BOAT || event.getVehicle() instanceof Minecart)) {
if (rider != null && rider.isProtected() && (event.getVehicle().getType().name().contains("BOAT")
|| event.getVehicle() instanceof Minecart)) {
event.setCancelled(true);
}
return;
}
if ((Util.isHorse(npc.getEntity().getType()) || npc.getEntity().getType() == EntityType.BOAT
|| npc.getEntity().getType() == EntityType.PIG || npc.getEntity() instanceof Minecart)
if (npc.getEntity() instanceof Vehicle
&& (!npc.hasTrait(Controllable.class) || !npc.getTraitNullable(Controllable.class).isEnabled())) {
event.setCancelled(true);
}
Expand Down
8 changes: 6 additions & 2 deletions main/src/main/java/net/citizensnpcs/commands/NPCCommands.java
Expand Up @@ -2471,14 +2471,18 @@ public void swim(CommandContext args, CommandSender sender, NPC npc) throws Comm

@Command(
aliases = { "npc" },
usage = "target [name|UUID] (-a[ggressive])",
usage = "target [name|UUID] (-a[ggressive]) (-c[ancel])",
desc = "Target a given entity",
modifiers = { "target" },
flags = "a",
flags = "ac",
min = 1,
max = 2,
permission = "citizens.npc.target")
public void target(CommandContext args, Player sender, NPC npc) {
if (args.hasFlag('c')) {
npc.getNavigator().cancelNavigation();
return;
}
Entity toTarget = args.argsLength() < 2 ? sender : Bukkit.getPlayer(args.getString(1));
if (toTarget == null) {
toTarget = Bukkit.getEntity(UUID.fromString(args.getString(1)));
Expand Down
2 changes: 1 addition & 1 deletion main/src/main/resources/messages_en.properties
Expand Up @@ -102,7 +102,7 @@ citizens.commands.npc.glowing.set=[[{0}]] is now glowing.
citizens.commands.npc.glowing.player-only=Glowing color can only be changed for player-type NPCs.
citizens.commands.npc.glowing.unset=[[{0}]] is no longer glowing.
citizens.commands.npc.glowing.color-set=[[{0}]]''s glowing color set to {1}]].
citizens.commands.npc.goat.horns-set=[[{0}]]''s horns set to left: {{1}} right: {{2}}
citizens.commands.npc.goat.horns-set=[[{0}]]''s horns set to left: [[{1}]] right: [[{2}]]
citizens.commands.npc.guardian.elder-unset=[[{0}]] is no longer an elder guardian.
citizens.commands.npc.guardian.elder-set=[[{0}]] is now an elder guardian.
citizens.commands.npc.hologram.text-set=Set hologram text line [[{0}]] to [[{1}]].
Expand Down
5 changes: 0 additions & 5 deletions pom.xml
Expand Up @@ -18,12 +18,7 @@
<modules>
<module>main</module>
<module>v1_8_R3</module>
<module>v1_10_R1</module>
<module>v1_11_R1</module>
<module>v1_12_R1</module>
<module>v1_13_R2</module>
<module>v1_14_R1</module>
<module>v1_15_R1</module>
<module>v1_16_R3</module>
<module>v1_17_R1</module>
<module>v1_18_R2</module>
Expand Down
Expand Up @@ -51,6 +51,7 @@ public EntityFrogNPC(EntityType<? extends Frog> types, Level level, NPC npc) {
this.npc = (CitizensNPC) npc;
if (npc != null) {
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
croakAnimationState.start(1);
}
}

Expand Down
Expand Up @@ -108,7 +108,6 @@ protected void checkFallDamage(double d0, boolean flag, BlockState iblockdata, B
@Override
public void customServerAiStep() {
if (npc != null) {
NMSImpl.setNotInSchool(this);
NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI() && this.moveControl != this.oldMoveController) {
this.moveControl = this.oldMoveController;
Expand Down
Expand Up @@ -264,7 +264,7 @@ public void fox(CommandContext args, CommandSender sender, NPC npc) throws Comma

@Command(
aliases = { "npc" },
usage = "frog (--variant variant)",
usage = "frog (--variant variant) (--target [target])",
desc = "Sets frog modifiers",
modifiers = { "frog" },
min = 1,
Expand Down Expand Up @@ -294,6 +294,7 @@ public void frog(CommandContext args, CommandSender sender, NPC npc) throws Comm
usage = "goat -l(eft) -r(ight) -n(either) -b(oth) horn",
desc = "Sets goat modifiers",
modifiers = { "goat" },
flags = "lrnb",
min = 1,
max = 1,
permission = "citizens.npc.goat")
Expand All @@ -313,6 +314,8 @@ public void goat(CommandContext args, CommandSender sender, NPC npc) throws Comm
if (args.hasFlag('n')) {
left = right = false;
}
trait.setLeftHorn(left);
trait.setRightHorn(right);
String output = Messaging.tr(Messages.NPC_GOAT_HORNS_SET, npc.getName(), left, right);
if (!output.isEmpty()) {
Messaging.send(sender, output);
Expand Down

0 comments on commit 53d8e96

Please sign in to comment.