mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Fix /npc name in 1.8.8
This commit is contained in:
parent
188c65f203
commit
9f3841c3ec
@ -206,9 +206,10 @@ public class CommandTrait extends Trait {
|
|||||||
|
|
||||||
public boolean canUse(Player player, NPCCommand command) {
|
public boolean canUse(Player player, NPCCommand command) {
|
||||||
for (String perm : command.perms) {
|
for (String perm : command.perms) {
|
||||||
if (!player.hasPermission(perm))
|
if (!player.hasPermission(perm)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
long currentTimeSec = System.currentTimeMillis() / 1000;
|
long currentTimeSec = System.currentTimeMillis() / 1000;
|
||||||
if (lastUsed.containsKey(command.command)) {
|
if (lastUsed.containsKey(command.command)) {
|
||||||
if (currentTimeSec < lastUsed.get(command.command) + command.cooldown) {
|
if (currentTimeSec < lastUsed.get(command.command) + command.cooldown) {
|
||||||
|
@ -13,6 +13,7 @@ import net.citizensnpcs.api.npc.NPC;
|
|||||||
import net.citizensnpcs.api.persistence.Persist;
|
import net.citizensnpcs.api.persistence.Persist;
|
||||||
import net.citizensnpcs.api.trait.Trait;
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
import net.citizensnpcs.api.trait.TraitName;
|
import net.citizensnpcs.api.trait.TraitName;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
|
|
||||||
@TraitName("scoreboardtrait")
|
@TraitName("scoreboardtrait")
|
||||||
public class ScoreboardTrait extends Trait {
|
public class ScoreboardTrait extends Trait {
|
||||||
@ -57,6 +58,9 @@ public class ScoreboardTrait extends Trait {
|
|||||||
SUPPORT_TEAM_SETOPTION = false;
|
SUPPORT_TEAM_SETOPTION = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!SUPPORT_TEAM_SETOPTION) {
|
||||||
|
NMS.setTeamNameTagVisible(team, nameVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
if (npc.data().has(NPC.GLOWING_COLOR_METADATA)) {
|
if (npc.data().has(NPC.GLOWING_COLOR_METADATA)) {
|
||||||
color = ChatColor.valueOf(npc.data().get(NPC.GLOWING_COLOR_METADATA));
|
color = ChatColor.valueOf(npc.data().get(NPC.GLOWING_COLOR_METADATA));
|
||||||
|
@ -19,6 +19,7 @@ import org.bukkit.entity.Tameable;
|
|||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
@ -417,6 +418,10 @@ public class NMS {
|
|||||||
BRIDGE.setStepHeight(entity, height);
|
BRIDGE.setStepHeight(entity, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
BRIDGE.setTeamNameTagVisible(team, visible);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public static void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
BRIDGE.setVerticalMovement(bukkitEntity, d);
|
BRIDGE.setVerticalMovement(bukkitEntity, d);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.entity.Tameable;
|
|||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
@ -142,6 +143,8 @@ public interface NMSBridge {
|
|||||||
|
|
||||||
public void setStepHeight(Entity entity, float height);
|
public void setStepHeight(Entity entity, float height);
|
||||||
|
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible);
|
||||||
|
|
||||||
public void setVerticalMovement(Entity bukkitEntity, double d);
|
public void setVerticalMovement(Entity bukkitEntity, double d);
|
||||||
|
|
||||||
public void setWitherCharged(Wither wither, boolean charged);
|
public void setWitherCharged(Wither wither, boolean charged);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.citizensnpcs.nms.v1_10_R1.util;
|
package net.citizensnpcs.nms.v1_10_R1.util;
|
||||||
|
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
@ -40,6 +41,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -193,6 +195,8 @@ import net.minecraft.server.v1_10_R1.PathEntity;
|
|||||||
import net.minecraft.server.v1_10_R1.PathPoint;
|
import net.minecraft.server.v1_10_R1.PathPoint;
|
||||||
import net.minecraft.server.v1_10_R1.PathfinderGoalSelector;
|
import net.minecraft.server.v1_10_R1.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_10_R1.ReportedException;
|
import net.minecraft.server.v1_10_R1.ReportedException;
|
||||||
|
import net.minecraft.server.v1_10_R1.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_10_R1.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_10_R1.SoundEffect;
|
import net.minecraft.server.v1_10_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_10_R1.Vec3D;
|
import net.minecraft.server.v1_10_R1.Vec3D;
|
||||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
import net.minecraft.server.v1_10_R1.WorldServer;
|
||||||
@ -940,6 +944,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).P = height;
|
NMSImpl.getHandle(entity).P = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1456,6 +1474,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
||||||
EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.MAGMA_CUBE,
|
EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.MAGMA_CUBE,
|
||||||
EntityType.HORSE, EntityType.GHAST);
|
EntityType.HORSE, EntityType.GHAST);
|
||||||
|
|
||||||
private static final Field CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getField(CraftBossBar.class, "handle");
|
private static final Field CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getField(CraftBossBar.class, "handle");
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
private static final Field ENDERDRAGON_BATTLE_BAR_FIELD = NMS.getField(EnderDragonBattle.class, "c");
|
private static final Field ENDERDRAGON_BATTLE_BAR_FIELD = NMS.getField(EnderDragonBattle.class, "c");
|
||||||
@ -1473,6 +1492,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bx");
|
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bx");
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
private static MethodHandle TEAM_FIELD;
|
||||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||||
|
|
||||||
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bG");
|
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bG");
|
||||||
|
@ -40,6 +40,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -213,6 +214,8 @@ import net.minecraft.server.v1_11_R1.PathPoint;
|
|||||||
import net.minecraft.server.v1_11_R1.PathfinderGoalSelector;
|
import net.minecraft.server.v1_11_R1.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_11_R1.RegistryMaterials;
|
import net.minecraft.server.v1_11_R1.RegistryMaterials;
|
||||||
import net.minecraft.server.v1_11_R1.ReportedException;
|
import net.minecraft.server.v1_11_R1.ReportedException;
|
||||||
|
import net.minecraft.server.v1_11_R1.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_11_R1.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_11_R1.SoundEffect;
|
import net.minecraft.server.v1_11_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_11_R1.Vec3D;
|
import net.minecraft.server.v1_11_R1.Vec3D;
|
||||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||||
@ -998,6 +1001,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).P = height;
|
NMSImpl.getHandle(entity).P = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1520,6 +1537,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
||||||
EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.MAGMA_CUBE,
|
EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.MAGMA_CUBE,
|
||||||
EntityType.HORSE, EntityType.GHAST);
|
EntityType.HORSE, EntityType.GHAST);
|
||||||
|
|
||||||
private static final Field CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getField(CraftBossBar.class, "handle");
|
private static final Field CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getField(CraftBossBar.class, "handle");
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
private static final Field ENDERDRAGON_BATTLE_BAR_FIELD = NMS.getField(EnderDragonBattle.class, "c");
|
private static final Field ENDERDRAGON_BATTLE_BAR_FIELD = NMS.getField(EnderDragonBattle.class, "c");
|
||||||
@ -1535,9 +1553,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "f");
|
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "f");
|
||||||
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bw");
|
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bw");
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
|
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
|
||||||
|
private static MethodHandle TEAM_FIELD;
|
||||||
|
|
||||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||||
|
|
||||||
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bF");
|
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bF");
|
||||||
|
@ -40,6 +40,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -217,6 +218,8 @@ import net.minecraft.server.v1_12_R1.PathPoint;
|
|||||||
import net.minecraft.server.v1_12_R1.PathfinderGoalSelector;
|
import net.minecraft.server.v1_12_R1.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_12_R1.RegistryMaterials;
|
import net.minecraft.server.v1_12_R1.RegistryMaterials;
|
||||||
import net.minecraft.server.v1_12_R1.ReportedException;
|
import net.minecraft.server.v1_12_R1.ReportedException;
|
||||||
|
import net.minecraft.server.v1_12_R1.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_12_R1.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_12_R1.SoundEffect;
|
import net.minecraft.server.v1_12_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_12_R1.SoundEffects;
|
import net.minecraft.server.v1_12_R1.SoundEffects;
|
||||||
import net.minecraft.server.v1_12_R1.Vec3D;
|
import net.minecraft.server.v1_12_R1.Vec3D;
|
||||||
@ -1011,6 +1014,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).P = height;
|
NMSImpl.getHandle(entity).P = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1507,11 +1524,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
|
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
|
||||||
entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
|
entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
public static void stopNavigation(NavigationAbstract navigation) {
|
public static void stopNavigation(NavigationAbstract navigation) {
|
||||||
navigation.p();
|
navigation.p();
|
||||||
}
|
};
|
||||||
|
|
||||||
public static void updateAI(EntityLiving entity) {
|
public static void updateAI(EntityLiving entity) {
|
||||||
if (entity instanceof EntityInsentient) {
|
if (entity instanceof EntityInsentient) {
|
||||||
@ -1531,6 +1548,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class, "bY");
|
private static MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class, "bY");
|
||||||
|
|
||||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
||||||
EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME,
|
EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME,
|
||||||
EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST);
|
EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST);
|
||||||
@ -1549,9 +1567,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "i");
|
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "i");
|
||||||
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bx");
|
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bx");
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
|
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
|
||||||
|
private static MethodHandle TEAM_FIELD;
|
||||||
|
|
||||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||||
|
|
||||||
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bG");
|
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bG");
|
||||||
|
@ -41,6 +41,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -232,6 +233,8 @@ import net.minecraft.server.v1_13_R2.PathPoint;
|
|||||||
import net.minecraft.server.v1_13_R2.PathfinderGoalSelector;
|
import net.minecraft.server.v1_13_R2.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_13_R2.RegistryMaterials;
|
import net.minecraft.server.v1_13_R2.RegistryMaterials;
|
||||||
import net.minecraft.server.v1_13_R2.ReportedException;
|
import net.minecraft.server.v1_13_R2.ReportedException;
|
||||||
|
import net.minecraft.server.v1_13_R2.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_13_R2.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||||
import net.minecraft.server.v1_13_R2.SoundEffects;
|
import net.minecraft.server.v1_13_R2.SoundEffects;
|
||||||
import net.minecraft.server.v1_13_R2.Vec3D;
|
import net.minecraft.server.v1_13_R2.Vec3D;
|
||||||
@ -1046,6 +1049,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).Q = height;
|
NMSImpl.getHandle(entity).Q = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1639,6 +1656,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class, "cf");
|
private static MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class, "cf");
|
||||||
|
|
||||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
||||||
EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME,
|
EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME,
|
||||||
EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST, EntityType.SHULKER,
|
EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST, EntityType.SHULKER,
|
||||||
@ -1663,6 +1681,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bC");
|
private static final Field RABBIT_FIELD = NMS.getField(EntityRabbit.class, "bC");
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
private static MethodHandle TEAM_FIELD;
|
||||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||||
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bL", false);
|
private static final Field WITHER_BOSS_BAR_FIELD = NMS.getField(EntityWither.class, "bL", false);
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -254,6 +255,8 @@ import net.minecraft.server.v1_14_R1.PlayerChunkMap;
|
|||||||
import net.minecraft.server.v1_14_R1.PlayerChunkMap.EntityTracker;
|
import net.minecraft.server.v1_14_R1.PlayerChunkMap.EntityTracker;
|
||||||
import net.minecraft.server.v1_14_R1.RegistryBlocks;
|
import net.minecraft.server.v1_14_R1.RegistryBlocks;
|
||||||
import net.minecraft.server.v1_14_R1.ReportedException;
|
import net.minecraft.server.v1_14_R1.ReportedException;
|
||||||
|
import net.minecraft.server.v1_14_R1.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_14_R1.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_14_R1.Vec3D;
|
import net.minecraft.server.v1_14_R1.Vec3D;
|
||||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||||
@ -1093,6 +1096,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).K = height;
|
NMSImpl.getHandle(entity).K = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1722,6 +1739,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
private static final MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class,
|
private static final MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class,
|
||||||
"advancementDataPlayer");
|
"advancementDataPlayer");
|
||||||
|
|
||||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.SILVERFISH,
|
||||||
EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME,
|
EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME,
|
||||||
EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST, EntityType.SHULKER,
|
EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST, EntityType.SHULKER,
|
||||||
@ -1764,6 +1782,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle SIZE_FIELD_GETTER = NMS.getGetter(Entity.class, "size");
|
private static final MethodHandle SIZE_FIELD_GETTER = NMS.getGetter(Entity.class, "size");
|
||||||
private static final MethodHandle SIZE_FIELD_SETTER = NMS.getSetter(Entity.class, "size");
|
private static final MethodHandle SIZE_FIELD_SETTER = NMS.getSetter(Entity.class, "size");
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
private static MethodHandle TEAM_FIELD;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -76,7 +76,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
if (args.hasFlag('n')) {
|
if (args.hasFlag('n')) {
|
||||||
trait.setNectar(!trait.hasNectar());
|
trait.setNectar(!trait.hasNectar());
|
||||||
output += ' ' + (trait.hasNectar() ? Messaging.tr(Messages.BEE_HAS_NECTAR, npc.getName())
|
output += ' ' + (trait.hasStung() ? Messaging.tr(Messages.BEE_HAS_NECTAR, npc.getName())
|
||||||
: Messaging.tr(Messages.BEE_NO_NECTAR, npc.getName()));
|
: Messaging.tr(Messages.BEE_NO_NECTAR, npc.getName()));
|
||||||
}
|
}
|
||||||
if (!output.isEmpty()) {
|
if (!output.isEmpty()) {
|
||||||
|
@ -43,6 +43,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -255,6 +256,8 @@ import net.minecraft.server.v1_15_R1.PlayerChunkMap;
|
|||||||
import net.minecraft.server.v1_15_R1.PlayerChunkMap.EntityTracker;
|
import net.minecraft.server.v1_15_R1.PlayerChunkMap.EntityTracker;
|
||||||
import net.minecraft.server.v1_15_R1.RegistryBlocks;
|
import net.minecraft.server.v1_15_R1.RegistryBlocks;
|
||||||
import net.minecraft.server.v1_15_R1.ReportedException;
|
import net.minecraft.server.v1_15_R1.ReportedException;
|
||||||
|
import net.minecraft.server.v1_15_R1.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_15_R1.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||||
@ -1097,6 +1100,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).H = height;
|
NMSImpl.getHandle(entity).H = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getGetter(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1712,6 +1729,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
private static final MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class,
|
private static final MethodHandle ADVANCEMENT_PLAYER_FIELD = NMS.getFinalSetter(EntityPlayer.class,
|
||||||
"advancementDataPlayer");
|
"advancementDataPlayer");
|
||||||
|
|
||||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.BEE,
|
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.BEE,
|
||||||
EntityType.SILVERFISH, EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT,
|
EntityType.SILVERFISH, EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT,
|
||||||
EntityType.SLIME, EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST,
|
EntityType.SLIME, EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST,
|
||||||
@ -1752,6 +1770,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle SIZE_FIELD_GETTER = NMS.getGetter(Entity.class, "size");
|
private static final MethodHandle SIZE_FIELD_GETTER = NMS.getGetter(Entity.class, "size");
|
||||||
private static final MethodHandle SIZE_FIELD_SETTER = NMS.getSetter(Entity.class, "size");
|
private static final MethodHandle SIZE_FIELD_SETTER = NMS.getSetter(Entity.class, "size");
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
private static MethodHandle TEAM_FIELD;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -36,6 +36,7 @@ import org.bukkit.entity.Wither;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.plugin.PluginLoadOrder;
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@ -167,6 +168,8 @@ import net.minecraft.server.v1_8_R3.PathEntity;
|
|||||||
import net.minecraft.server.v1_8_R3.PathPoint;
|
import net.minecraft.server.v1_8_R3.PathPoint;
|
||||||
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_8_R3.ReportedException;
|
import net.minecraft.server.v1_8_R3.ReportedException;
|
||||||
|
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.v1_8_R3.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -883,6 +886,20 @@ public class NMSImpl implements NMSBridge {
|
|||||||
NMSImpl.getHandle(entity).S = height;
|
NMSImpl.getHandle(entity).S = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTeamNameTagVisible(Team team, boolean visible) {
|
||||||
|
if (TEAM_FIELD == null) {
|
||||||
|
TEAM_FIELD = NMS.getField(team.getClass(), "team");
|
||||||
|
}
|
||||||
|
ScoreboardTeam nmsTeam;
|
||||||
|
try {
|
||||||
|
nmsTeam = (ScoreboardTeam) TEAM_FIELD.get(team);
|
||||||
|
nmsTeam.setNameTagVisibility(visible ? EnumNameTagVisibility.ALWAYS : EnumNameTagVisibility.NEVER);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
|
||||||
if (!bukkitEntity.getType().isAlive())
|
if (!bukkitEntity.getType().isAlive())
|
||||||
@ -1340,6 +1357,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "a");
|
private static Field PATHFINDING_RANGE = NMS.getField(NavigationAbstract.class, "a");
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static Field SKULL_PROFILE_FIELD;
|
private static Field SKULL_PROFILE_FIELD;
|
||||||
|
private static Field TEAM_FIELD;
|
||||||
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -1360,4 +1378,5 @@ public class NMSImpl implements NMSBridge {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user