Fix tadpoles, /npc goat, don't build unnecessary modules

This commit is contained in:
fullwall 2022-06-11 15:17:17 +08:00
parent aaf870372c
commit 53d8e96c8d
7 changed files with 16 additions and 14 deletions

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.FishHook;
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;
@ -642,14 +643,13 @@ public class EventListen implements Listener {
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);
}

View File

@ -2471,14 +2471,18 @@ public class NPCCommands {
@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)));

View File

@ -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}]].

View File

@ -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>

View File

@ -51,6 +51,7 @@ public class FrogController extends MobEntityController {
this.npc = (CitizensNPC) npc;
if (npc != null) {
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
croakAnimationState.start(1);
}
}

View File

@ -108,7 +108,6 @@ public class TadpoleController extends MobEntityController {
@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;

View File

@ -264,7 +264,7 @@ public class Commands {
@Command(
aliases = { "npc" },
usage = "frog (--variant variant)",
usage = "frog (--variant variant) (--target [target])",
desc = "Sets frog modifiers",
modifiers = { "frog" },
min = 1,
@ -294,6 +294,7 @@ public class Commands {
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")
@ -313,6 +314,8 @@ public class Commands {
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);