mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +01:00
Use new Bukkt API for Skeleton types
This commit is contained in:
parent
c8c5ef1eb0
commit
3c5f17022f
@ -33,9 +33,9 @@ import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.trait.Gravity;
|
||||
import net.citizensnpcs.trait.LookClose;
|
||||
import net.citizensnpcs.trait.NPCSkeletonType;
|
||||
import net.citizensnpcs.trait.Poses;
|
||||
import net.citizensnpcs.trait.Powered;
|
||||
import net.citizensnpcs.trait.SkeletonType;
|
||||
import net.citizensnpcs.trait.SlimeSize;
|
||||
import net.citizensnpcs.trait.VillagerProfession;
|
||||
import net.citizensnpcs.util.Anchor;
|
||||
@ -56,6 +56,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
@ -881,9 +882,12 @@ public class NPCCommands {
|
||||
max = 2,
|
||||
permission = "npc.skeletontype")
|
||||
@Requirements(selected = true, ownership = true, types = EntityType.SKELETON)
|
||||
public void skeletonType(CommandContext args, CommandSender sender, NPC npc) {
|
||||
int type = args.getInteger(1);
|
||||
npc.getTrait(SkeletonType.class).setType(type);
|
||||
public void skeletonType(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
SkeletonType type = (type = SkeletonType.getType(args.getInteger(1))) == null ? SkeletonType
|
||||
.valueOf(args.getString(1)) : type;
|
||||
if (type == null)
|
||||
throw new CommandException(Messages.INVALID_SKELETON_TYPE);
|
||||
npc.getTrait(NPCSkeletonType.class).setType(type);
|
||||
Messaging.sendTr(sender, Messages.SKELETON_TYPE_SET, npc.getName(), type);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import net.citizensnpcs.trait.Poses;
|
||||
import net.citizensnpcs.trait.Powered;
|
||||
import net.citizensnpcs.trait.Saddle;
|
||||
import net.citizensnpcs.trait.Sheared;
|
||||
import net.citizensnpcs.trait.SkeletonType;
|
||||
import net.citizensnpcs.trait.NPCSkeletonType;
|
||||
import net.citizensnpcs.trait.SlimeSize;
|
||||
import net.citizensnpcs.trait.VillagerProfession;
|
||||
import net.citizensnpcs.trait.WoolColor;
|
||||
@ -56,7 +56,7 @@ public class CitizensTraitFactory implements TraitFactory {
|
||||
registerTrait(TraitInfo.create(VillagerProfession.class).withName("profession"));
|
||||
registerTrait(TraitInfo.create(Saddle.class).withName("saddle"));
|
||||
registerTrait(TraitInfo.create(Sheared.class).withName("sheared"));
|
||||
registerTrait(TraitInfo.create(SkeletonType.class).withName("skeletontype"));
|
||||
registerTrait(TraitInfo.create(NPCSkeletonType.class).withName("skeletontype"));
|
||||
registerTrait(TraitInfo.create(SlimeSize.class).withName("slimesize"));
|
||||
registerTrait(TraitInfo.create(Spawned.class).withName("spawned"));
|
||||
registerTrait(TraitInfo.create(Text.class).withName("text"));
|
||||
|
31
src/main/java/net/citizensnpcs/trait/NPCSkeletonType.java
Normal file
31
src/main/java/net/citizensnpcs/trait/NPCSkeletonType.java
Normal file
@ -0,0 +1,31 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
||||
public class NPCSkeletonType extends Trait {
|
||||
private boolean skeleton;
|
||||
@Persist
|
||||
private org.bukkit.entity.Skeleton.SkeletonType type = org.bukkit.entity.Skeleton.SkeletonType.NORMAL;
|
||||
|
||||
public NPCSkeletonType() {
|
||||
super("skeletontype");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
skeleton = npc.getBukkitEntity() instanceof Skeleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (skeleton)
|
||||
((Skeleton) npc.getBukkitEntity()).setSkeletonType(type);
|
||||
}
|
||||
|
||||
public void setType(org.bukkit.entity.Skeleton.SkeletonType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -211,4 +211,5 @@ public class Messages {
|
||||
public static final String WAYPOINT_TRIGGER_TELEPORT_PROMPT = "citizens.editors.waypoints.triggers.teleport.prompt";
|
||||
public static final String WORLD_NOT_FOUND = "citizens.commands.errors.missing-world";
|
||||
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
||||
public static final String INVALID_SKELETON_TYPE = "citizens.commands.npc.skeletontype.invalid-type";
|
||||
}
|
||||
|
@ -55,9 +55,7 @@ public class NMS {
|
||||
private static Field PERSISTENT_FIELD;
|
||||
private static Set<Integer> SLAB_MATERIALS = Sets.newHashSet();
|
||||
private static Field SPEED_FIELD;
|
||||
|
||||
private static Set<Integer> STAIR_MATERIALS = Sets.newHashSet();
|
||||
|
||||
private static Field THREAD_STOPPER;
|
||||
|
||||
public static void addOrRemoveFromPlayerList(LivingEntity bukkitEntity, boolean remove) {
|
||||
@ -261,7 +259,7 @@ public class NMS {
|
||||
entity.getNavigation().e();
|
||||
entity.getControllerMove().c();
|
||||
entity.getControllerLook().a();
|
||||
entity.getControllerJump().b();
|
||||
entity.getControllerJump().b();
|
||||
}
|
||||
|
||||
public static void updateNavigationWorld(org.bukkit.entity.Entity entity, org.bukkit.World world) {
|
||||
|
@ -32,6 +32,18 @@ public enum PlayerAnimation {
|
||||
sendPacketNearby(packet, player, radius);
|
||||
}
|
||||
},
|
||||
SIT {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
player.mount(player);
|
||||
}
|
||||
},
|
||||
STOP_SITTING {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
player.mount(null);
|
||||
}
|
||||
},
|
||||
SNEAK {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
|
@ -153,7 +153,7 @@ citizens.notifications.metrics-started=Metrics gestartet.
|
||||
citizens.notifications.missing-translations=Fehlende \u00dcbersetzung f\u00fcr {0}. Wechsel zur\u00fcck zu Englisch.
|
||||
citizens.notifications.npc-name-not-found=Konnte keinen Namen f\u00fcr ID {0} finden.
|
||||
citizens.notifications.npc-not-found=Es wurden keine NPCs gefunden.
|
||||
citizens.notifications.npcs-loaded={0} NPCs geladen ({1} erstellt).
|
||||
citizens.notifications.npcs-loaded={0} NPCs geladen.
|
||||
citizens.notifications.reloaded=Citizens wurde neu geladen.
|
||||
citizens.notifications.reloading=Lade Citizens neu...
|
||||
citizens.notifications.save-method-set=Speichermethode gesetzt zu {0}.
|
||||
|
@ -69,6 +69,7 @@ citizens.commands.npc.select.already-selected=You already have that NPC selected
|
||||
citizens.commands.npc.size.description={0}''s size is [[{1}]].
|
||||
citizens.commands.npc.size.set={0}''s size set to [[{1}]].
|
||||
citizens.commands.npc.skeletontype.set={0}''s skeleton type set to [[{1}]].
|
||||
citizens.commands.npc.skeletontype.invalid-type=Invalid skeleton type.
|
||||
citizens.commands.npc.spawn.already-spawned={0} is already spawned at another location. Use ''/npc tphere'' to teleport the NPC to your location.
|
||||
citizens.commands.npc.spawn.missing-npc-id=No NPC with the ID {0} exists.
|
||||
citizens.commands.npc.spawn.no-location=No stored location available - command must be used ingame.
|
||||
@ -189,7 +190,7 @@ citizens.notifications.metrics-started=Metrics started.
|
||||
citizens.notifications.missing-translations=Missing translations file for locale {0}. Defaulting to en locale.
|
||||
citizens.notifications.npc-name-not-found=Could not find a name for ID {0}.
|
||||
citizens.notifications.npc-not-found=No NPC could be found.
|
||||
citizens.notifications.npcs-loaded=Loaded {0} NPCs ({1} spawned).
|
||||
citizens.notifications.npcs-loaded=Loaded {0} NPCs.
|
||||
citizens.notifications.reloaded=Citizens reloaded.
|
||||
citizens.notifications.reloading=Reloading Citizens...
|
||||
citizens.notifications.save-method-set=Save method set to {0}.
|
||||
|
@ -143,7 +143,7 @@ citizens.notifications.metrics-started=Metrics d\u00e9marr\u00e9.
|
||||
citizens.notifications.missing-translations=Fichier de traductions manquant pour la langue {0}. R\u00e9trograde en anglais.
|
||||
citizens.notifications.npc-name-not-found=Pas de nom trouv\u00e9 pour le PNJ ID {0}.
|
||||
citizens.notifications.npc-not-found=Aucun PNJ trouv\u00e9.
|
||||
citizens.notifications.npcs-loaded={0} PNJs charg\u00e9(s) ({1} invoqu\u00e9(s)).
|
||||
citizens.notifications.npcs-loaded={0} PNJs charg\u00e9(s).
|
||||
citizens.notifications.reloaded=Citizens recharg\u00e9.
|
||||
citizens.notifications.reloading=Rechargement de Citizens\u2026
|
||||
citizens.notifications.save-method-set=M\u00e9thode d'enregistrement {0}.
|
||||
|
@ -153,7 +153,7 @@ citizens.notifications.metrics-started=Statistieken gestart
|
||||
citizens.notifications.missing-translations=Vertalings bestand {0} mist. Normale engelse taal wordt gebruikt.
|
||||
citizens.notifications.npc-name-not-found=Geen naam kom worden gevonden voor ID {0}.
|
||||
citizens.notifications.npc-not-found=Geen NPC kon gevonden worden.
|
||||
citizens.notifications.npcs-loaded={0} NPCs geladen ({1} gespawned).
|
||||
citizens.notifications.npcs-loaded={0} NPCs geladen.
|
||||
citizens.notifications.reloaded=Citizens opnieuw geladen.
|
||||
citizens.notifications.reloading=Opnieuw laden van Citizens...
|
||||
citizens.notifications.save-method-set=Opslaan methode is nu {0}.
|
||||
|
Loading…
Reference in New Issue
Block a user