Make areaeffectcloud the default hologram renderer over armorstand, add /npc areaeffectcloud

This commit is contained in:
fullwall 2024-10-13 01:07:28 +08:00
parent a7078b2c6d
commit 46f3c31832
18 changed files with 505 additions and 287 deletions

View File

@ -114,10 +114,10 @@ public class Settings {
"The default MOVEMENT distance in blocks where the NPC will move to before considering a path finished<br>Note: this is different from the PATHFINDING distance which is specified by path-distance-margin",
"npc.pathfinding.default-distance-margin", 1),
DEFAULT_HOLOGRAM_BACKGROUND_COLOR(
"The default background color for holograms, specified as an RGB or RGBA value<br>For example 0,255,123,0 would be green",
"The default background color for holograms, specified as an RGB or RGBA value<br>For example 0,255,123 would be green and 255,255,255,255 would be transparent",
"npc.hologram.default-background-color", ""),
DEFAULT_HOLOGRAM_RENDERER(
"The default renderer for holograms, must be one of the following:<br>interaction - matches inbuilt nametags most closely<br>display - allows for different colored backgrounds<br>display_vehicle - mounts the display on the NPC<br>armorstand - the safest option, very very small hit to client FPS compared to other options<br>armorstand_vehicle - mounts the armorstand on the NPC",
"The default renderer for holograms, must be one of the following:<br>interaction - requires 1.19+, matches nametags more closely than display<br>display - allows for different colored backgrounds<br>display_vehicle - mounts the display on the NPC<br>areaeffectcloud - the safest option<br>armorstand - the second safest option, has a hitbox clientside<br>armorstand_vehicle - mounts the armorstand on the NPC, only useful for nameplates",
"npc.hologram.default-renderer", "display"),
DEFAULT_LOOK_CLOSE("Enable look close by default", "npc.default.look-close.enabled", false),
DEFAULT_LOOK_CLOSE_RANGE("Default look close range in blocks", "npc.default.look-close.range", 10),
@ -386,14 +386,17 @@ public class Settings {
protected void setComments(DataKey root) {
if (!SUPPORTS_SET_COMMENTS || !root.keyExists(path))
return;
try {
((MemoryDataKey) root).getSection("").setComments(path,
comments == null ? null : Arrays.asList(comments.split("<br>")));
} catch (Throwable t) {
SUPPORTS_SET_COMMENTS = false;
}
}
}
private static boolean SUPPORTS_SET_COMMENTS = true;
static {
try {
ConfigurationSection.class.getMethod("getInlineComments", String.class);
} catch (NoSuchMethodException | SecurityException e) {
SUPPORTS_SET_COMMENTS = false;
}
}
}

View File

@ -6,10 +6,12 @@ import java.util.List;
import java.util.function.Function;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
import com.google.common.collect.Iterables;
@ -42,7 +44,6 @@ import net.citizensnpcs.npc.ai.AStarNavigationStrategy.AStarPlanner;
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.RotationTrait.PacketRotationSession;
import net.citizensnpcs.util.ChunkCoord;
import net.citizensnpcs.util.NMS;
public class CitizensNavigator implements Navigator, Runnable {
@ -51,7 +52,7 @@ public class CitizensNavigator implements Navigator, Runnable {
.range(Setting.DEFAULT_PATHFINDING_RANGE.asFloat()).debug(Setting.DEBUG_PATHFINDING.asBoolean())
.defaultAttackStrategy((attacker, target) -> {
NMS.attack(attacker, target);
return false;
return true;
}).attackRange(Setting.NPC_ATTACK_DISTANCE.asDouble())
.updatePathRate(Setting.DEFAULT_PATHFINDER_UPDATE_PATH_RATE.asTicks())
.distanceMargin(Setting.DEFAULT_DISTANCE_MARGIN.asDouble())
@ -518,32 +519,31 @@ public class CitizensNavigator implements Navigator, Runnable {
if (!SUPPORT_CHUNK_TICKETS || !CitizensAPI.hasImplementation() || !CitizensAPI.getPlugin().isEnabled())
return;
if (target != null && activeTicket != null
&& new ChunkCoord(target.getChunk()).equals(new ChunkCoord(activeTicket.getChunk()))) {
activeTicket = target.clone();
// already have a ticket on same chunk
if (target != null && activeTicket != null && target.getBlockX() >> 4 == activeTicket.getBlockX() >> 4
&& target.getBlockZ() >> 4 == activeTicket.getBlockZ() >> 4
&& target.getWorld().equals(activeTicket.getWorld()))
return;
}
// switch ticket to the new chunk
if (activeTicket != null) {
try {
activeTicket.getChunk().removePluginChunkTicket(CitizensAPI.getPlugin());
} catch (NoSuchMethodError e) {
SUPPORT_CHUNK_TICKETS = false;
activeTicket = null;
}
}
if (target == null) {
activeTicket = null;
return;
}
activeTicket = target.clone();
try {
activeTicket.getChunk().addPluginChunkTicket(CitizensAPI.getPlugin());
} catch (NoSuchMethodError e) {
SUPPORT_CHUNK_TICKETS = false;
activeTicket = null;
}
}
private static boolean SUPPORT_CHUNK_TICKETS = true;
private static int UNINITIALISED_SPEED = Integer.MIN_VALUE;
private static final int UNINITIALISED_SPEED = Integer.MIN_VALUE;
static {
try {
Chunk.class.getMethod("removePluginChunkTicket", Plugin.class);
} catch (NoSuchMethodException | SecurityException e) {
SUPPORT_CHUNK_TICKETS = false;
}
}
}

View File

@ -16,11 +16,16 @@ import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Display.Billboard;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemDisplay;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TextDisplay;
import org.bukkit.event.HandlerList;
@ -135,11 +140,7 @@ public class HologramTrait extends Trait {
HologramRenderer renderer;
String setting = Setting.DEFAULT_NAME_HOLOGRAM_RENDERER.asString();
if (setting.isEmpty()) {
if (SpigotUtil.getVersion()[1] >= 19) {
setting = "interaction";
} else {
setting = "armorstand";
}
setting = SpigotUtil.getVersion()[1] <= 8 ? "armorstand" : "areaeffectcloud";
}
renderer = createRenderer(setting);
if (HologramRendererCreateEvent.handlers.getRegisteredListeners().length > 0) {
@ -151,17 +152,20 @@ public class HologramTrait extends Trait {
}
private HologramRenderer createRenderer(String setting) {
if (!SUPPORTS_DISPLAY)
return setting.equals("armorstand_vehicle") ? new ArmorstandVehicleRenderer() : new ArmorstandRenderer();
if (!SUPPORTS_DISPLAY) {
setting = SpigotUtil.getVersion()[1] <= 8 ? "armorstand" : "areaeffectcloud";
}
switch (setting) {
case "areaeffectcloud":
return new AreaEffectCloudRenderer();
case "armorstand_vehicle":
return new ArmorstandVehicleRenderer();
case "display":
return new TextDisplayRenderer();
case "display_vehicle":
return new TextDisplayVehicleRenderer();
case "interaction":
return new InteractionVehicleRenderer();
case "armorstand_vehicle":
return new ArmorstandVehicleRenderer();
default:
return new ArmorstandRenderer();
}
@ -429,6 +433,30 @@ public class HologramTrait extends Trait {
reloadLineHolograms();
}
public static class AreaEffectCloudRenderer extends SingleEntityHologramRenderer {
private boolean rendered;
@Override
protected NPC createNPC(Entity base, String name, Vector3d offset) {
NPC npc = registry().createNPC(EntityType.AREA_EFFECT_CLOUD, name);
rendered = false;
return npc;
}
@Override
protected void render0(NPC npc, Vector3d offset) {
AreaEffectCloud cloud = (AreaEffectCloud) hologram.getEntity();
if (!rendered) {
cloud.setRadius(0);
cloud.setParticle(Particle.BLOCK, Bukkit.createBlockData(Material.AIR));
}
hologram.getEntity().teleport(
npc.getEntity().getLocation().clone().add(offset.x,
offset.y + NMS.getBoundingBoxHeight(npc.getEntity()) - 0.5, offset.z),
TeleportCause.PLUGIN);
}
}
public static class ArmorstandRenderer extends SingleEntityHologramRenderer {
@Override
protected NPC createNPC(Entity base, String name, Vector3d offset) {
@ -461,7 +489,7 @@ public class HologramTrait extends Trait {
}
class HologramLine {
Color backgroundColor = defaultBackgroundColor;
Color backgroundColor;
double mb, mt;
boolean persist;
HologramRenderer renderer;
@ -477,7 +505,7 @@ public class HologramTrait extends Trait {
this.persist = persist;
this.ticks = ticks;
this.renderer = hr;
renderer.setBackgroundColor(backgroundColor);
setBackgroundColor(defaultBackgroundColor);
if (renderer instanceof SingleEntityHologramRenderer) {
SingleEntityHologramRenderer sr = (SingleEntityHologramRenderer) renderer;
sr.setViewRange(viewRange);
@ -499,6 +527,9 @@ public class HologramTrait extends Trait {
}
public void setBackgroundColor(Color color) {
if (color != null) {
renderer = new TextDisplayRenderer();
}
this.backgroundColor = color;
renderer.setBackgroundColor(color);
}
@ -886,6 +917,14 @@ public class HologramTrait extends Trait {
if (color != null) {
disp.setBackgroundColor(color);
}
if (SpigotUtil.getVersion()[1] >= 21 && base.getEntity() instanceof LivingEntity) {
AttributeInstance inst = ((LivingEntity) base.getEntity()).getAttribute(Attribute.GENERIC_SCALE);
if (inst != null) {
Transformation tf = disp.getTransformation();
tf.getScale().set(inst.getValue());
disp.setTransformation(tf);
}
}
hologram.getEntity().teleport(
base.getEntity().getLocation().clone().add(offset.x,
offset.y + NMS.getBoundingBoxHeight(base.getEntity()) + 0.2f, offset.z),

View File

@ -0,0 +1,112 @@
package net.citizensnpcs.trait.versioned;
import org.bukkit.Color;
import org.bukkit.Particle;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionType;
import net.citizensnpcs.api.command.Command;
import net.citizensnpcs.api.command.CommandContext;
import net.citizensnpcs.api.command.Flag;
import net.citizensnpcs.api.command.Requirements;
import net.citizensnpcs.api.command.exception.CommandException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName;
import net.citizensnpcs.api.util.Messaging;
@TraitName("areaeffectcloudtrait")
public class AreaEffectCloudTrait extends Trait {
@Persist
private Color color;
@Persist
private Integer duration;
@Persist
private Particle particle;
@Persist
private Float radius;
@Persist
private PotionType type;
public AreaEffectCloudTrait() {
super("areaeffectcloudtrait");
}
@Override
public void onSpawn() {
AreaEffectCloud cloud = (AreaEffectCloud) npc.getEntity();
if (color != null) {
cloud.setColor(color);
}
if (radius != null) {
cloud.setRadius(radius);
}
if (duration != null) {
cloud.setDuration(duration);
}
if (particle != null) {
cloud.setParticle(particle);
}
if (type != null) {
cloud.setBasePotionType(type);
}
}
public void setColor(Color color) {
this.color = color;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public void setParticle(Particle particle) {
this.particle = particle;
}
public void setPotionType(PotionType type) {
this.type = type;
}
public void setRadius(Float radius) {
this.radius = radius;
}
@Command(
aliases = { "npc" },
usage = "areaeffectcloud --color [color] --duration [duration] --radius [radius] --particle [particle]",
desc = "",
modifiers = { "areaeffectcloud" },
min = 1,
max = 1,
permission = "citizens.npc.areaeffectcloud")
@Requirements(selected = true, ownership = true, types = { EntityType.AREA_EFFECT_CLOUD })
public static void areaeffectcloud(CommandContext args, CommandSender sender, NPC npc,
@Flag("duration") Integer duration, @Flag("radius") Float radius, @Flag("color") Color color,
@Flag("potiontype") PotionType type, @Flag("particle") Particle particle) throws CommandException {
AreaEffectCloudTrait trait = npc.getOrAddTrait(AreaEffectCloudTrait.class);
String output = "";
if (radius != null) {
trait.setRadius(radius);
}
if (duration != null) {
trait.setDuration(duration);
}
if (color != null) {
trait.setColor(color);
}
if (type != null) {
trait.setPotionType(type);
}
if (particle != null) {
trait.setParticle(particle);
}
trait.onSpawn();
if (!output.isEmpty()) {
Messaging.send(sender, output.trim());
}
}
}

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.util.NMS;
@TraitName("textdisplaytrait")
public class TextDisplayTrait extends Trait {
@ -29,6 +30,8 @@ public class TextDisplayTrait extends Trait {
private Boolean seeThrough;
@Persist
private Boolean shadowed;
@Persist
private String text;
public TextDisplayTrait() {
super("textdisplaytrait");
@ -37,6 +40,9 @@ public class TextDisplayTrait extends Trait {
@Override
public void onSpawn() {
TextDisplay display = (TextDisplay) npc.getEntity();
if (text != null) {
NMS.setTextDisplayComponent(display, Messaging.minecraftComponentFromRawMessage(text));
}
if (shadowed != null) {
display.setShadowed(shadowed);
}
@ -74,9 +80,13 @@ public class TextDisplayTrait extends Trait {
this.shadowed = shadowed;
}
public void setText(String text) {
this.text = text;
}
@Command(
aliases = { "npc" },
usage = "textdisplay --shadowed [true|false] --seethrough [true|false] --line_width [width]",
usage = "textdisplay --shadowed [true|false] --seethrough [true|false] --line_width [width] --text [text]",
desc = "",
modifiers = { "textdisplay" },
min = 1,
@ -84,7 +94,7 @@ public class TextDisplayTrait extends Trait {
permission = "citizens.npc.textdisplay")
@Requirements(selected = true, ownership = true, types = { EntityType.TEXT_DISPLAY })
public static void display(CommandContext args, CommandSender sender, NPC npc, @Flag("shadowed") Boolean shadowed,
@Flag("seethrough") Boolean seethrough, @Flag("line_width") Integer lineWidth,
@Flag("seethrough") Boolean seethrough, @Flag("line_width") Integer lineWidth, @Flag("text") String text,
@Flag("bgcolor") Color bgcolor, @Flag("alignment") TextAlignment alignment) throws CommandException {
TextDisplayTrait trait = npc.getOrAddTrait(TextDisplayTrait.class);
String output = "";
@ -103,6 +113,9 @@ public class TextDisplayTrait extends Trait {
if (bgcolor != null) {
trait.setBackgroundColor(bgcolor);
}
if (text != null) {
trait.setText(text);
}
trait.onSpawn();
if (!output.isEmpty()) {
Messaging.send(sender, output.trim());

View File

@ -36,10 +36,9 @@ public class ChunkCoord {
return false;
ChunkCoord other = (ChunkCoord) obj;
if (!Objects.equals(worldUUID, other.worldUUID)) {
if (!Objects.equals(worldUUID, other.worldUUID))
return false;
}
return x == other.x && z == other.z;
}
@ -50,18 +49,15 @@ public class ChunkCoord {
@Override
public int hashCode() {
final int prime = 31;
return prime * (prime * (prime + (worldUUID == null ? 0 : worldUUID.hashCode())) + x) + z;
return 31 * (31 * (31 + (worldUUID == null ? 0 : worldUUID.hashCode())) + x) + z;
}
public void setForceLoaded(boolean b) {
if (!SUPPORTS_FORCE_LOADED)
return;
Chunk chunk = getChunk();
if (chunk != null && SUPPORTS_FORCE_LOADED) {
try {
if (chunk != null) {
chunk.setForceLoaded(b);
} catch (NoSuchMethodError e) {
SUPPORTS_FORCE_LOADED = false;
}
}
}
@ -71,4 +67,11 @@ public class ChunkCoord {
}
private static boolean SUPPORTS_FORCE_LOADED = true;
static {
try {
Chunk.class.getMethod("setForceLoaded", boolean.class);
} catch (NoSuchMethodException | SecurityException e) {
SUPPORTS_FORCE_LOADED = false;
}
}
}

View File

@ -18,10 +18,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_10_R1.DedicatedPlayerList;
import net.minecraft.server.v1_10_R1.DedicatedServer;
import net.minecraft.server.v1_10_R1.OpList;
import net.minecraft.server.v1_10_R1.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -164,6 +160,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
import net.citizensnpcs.trait.versioned.PolarBearTrait;
@ -194,6 +191,8 @@ import net.minecraft.server.v1_10_R1.CrashReport;
import net.minecraft.server.v1_10_R1.CrashReportSystemDetails;
import net.minecraft.server.v1_10_R1.DamageSource;
import net.minecraft.server.v1_10_R1.DataWatcherObject;
import net.minecraft.server.v1_10_R1.DedicatedPlayerList;
import net.minecraft.server.v1_10_R1.DedicatedServer;
import net.minecraft.server.v1_10_R1.EnchantmentManager;
import net.minecraft.server.v1_10_R1.EnderDragonBattle;
import net.minecraft.server.v1_10_R1.Entity;
@ -225,6 +224,8 @@ import net.minecraft.server.v1_10_R1.Navigation;
import net.minecraft.server.v1_10_R1.NavigationAbstract;
import net.minecraft.server.v1_10_R1.NavigationSpider;
import net.minecraft.server.v1_10_R1.NetworkManager;
import net.minecraft.server.v1_10_R1.OpList;
import net.minecraft.server.v1_10_R1.OpListEntry;
import net.minecraft.server.v1_10_R1.Packet;
import net.minecraft.server.v1_10_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_10_R1.PacketPlayOutBed;
@ -721,6 +722,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
registerTraitWithCommand(manager, PolarBearTrait.class);
@ -1247,6 +1249,23 @@ public class NMSImpl implements NMSBridge {
getHandle(entity).setNoGravity(enabled);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4),
opList.b(profile)));
} else {
opList.remove(profile);
}
player.recalculatePermissions();
}
@Override
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
((EntityShulker) getHandle(shulker)).a((byte) peek);
@ -1320,21 +1339,6 @@ public class NMSImpl implements NMSBridge {
handle.g(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4), opList.b(profile)));
} else {
opList.remove(profile);
}
player.recalculatePermissions();
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -18,10 +18,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_11_R1.DedicatedPlayerList;
import net.minecraft.server.v1_11_R1.DedicatedServer;
import net.minecraft.server.v1_11_R1.OpList;
import net.minecraft.server.v1_11_R1.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -179,6 +175,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
import net.citizensnpcs.trait.versioned.LlamaTrait;
@ -211,6 +208,8 @@ import net.minecraft.server.v1_11_R1.CrashReport;
import net.minecraft.server.v1_11_R1.CrashReportSystemDetails;
import net.minecraft.server.v1_11_R1.DamageSource;
import net.minecraft.server.v1_11_R1.DataWatcherObject;
import net.minecraft.server.v1_11_R1.DedicatedPlayerList;
import net.minecraft.server.v1_11_R1.DedicatedServer;
import net.minecraft.server.v1_11_R1.EnchantmentManager;
import net.minecraft.server.v1_11_R1.Enchantments;
import net.minecraft.server.v1_11_R1.EnderDragonBattle;
@ -245,6 +244,8 @@ import net.minecraft.server.v1_11_R1.Navigation;
import net.minecraft.server.v1_11_R1.NavigationAbstract;
import net.minecraft.server.v1_11_R1.NavigationSpider;
import net.minecraft.server.v1_11_R1.NetworkManager;
import net.minecraft.server.v1_11_R1.OpList;
import net.minecraft.server.v1_11_R1.OpListEntry;
import net.minecraft.server.v1_11_R1.Packet;
import net.minecraft.server.v1_11_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_11_R1.PacketPlayOutBed;
@ -757,6 +758,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
registerTraitWithCommand(manager, LlamaTrait.class);
@ -1300,6 +1302,23 @@ public class NMSImpl implements NMSBridge {
getHandle(entity).setNoGravity(enabled);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4),
opList.b(profile)));
} else {
opList.remove(profile);
}
player.recalculatePermissions();
}
@Override
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
((EntityShulker) getHandle(shulker)).a((byte) peek);
@ -1373,21 +1392,6 @@ public class NMSImpl implements NMSBridge {
handle.g(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4), opList.b(profile)));
} else {
opList.remove(profile);
}
player.recalculatePermissions();
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -19,10 +19,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_12_R1.DedicatedPlayerList;
import net.minecraft.server.v1_12_R1.DedicatedServer;
import net.minecraft.server.v1_12_R1.OpList;
import net.minecraft.server.v1_12_R1.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -182,6 +178,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
import net.citizensnpcs.trait.versioned.LlamaTrait;
@ -215,6 +212,8 @@ import net.minecraft.server.v1_12_R1.CrashReport;
import net.minecraft.server.v1_12_R1.CrashReportSystemDetails;
import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.DataWatcherObject;
import net.minecraft.server.v1_12_R1.DedicatedPlayerList;
import net.minecraft.server.v1_12_R1.DedicatedServer;
import net.minecraft.server.v1_12_R1.EnchantmentManager;
import net.minecraft.server.v1_12_R1.Enchantments;
import net.minecraft.server.v1_12_R1.EnderDragonBattle;
@ -250,6 +249,8 @@ import net.minecraft.server.v1_12_R1.Navigation;
import net.minecraft.server.v1_12_R1.NavigationAbstract;
import net.minecraft.server.v1_12_R1.NavigationSpider;
import net.minecraft.server.v1_12_R1.NetworkManager;
import net.minecraft.server.v1_12_R1.OpList;
import net.minecraft.server.v1_12_R1.OpListEntry;
import net.minecraft.server.v1_12_R1.Packet;
import net.minecraft.server.v1_12_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_12_R1.PacketPlayOutBed;
@ -759,6 +760,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
registerTraitWithCommand(manager, LlamaTrait.class);
@ -1308,6 +1310,23 @@ public class NMSImpl implements NMSBridge {
getHandle(entity).setNoGravity(enabled);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4),
opList.b(profile)));
} else {
opList.remove(profile);
}
player.recalculatePermissions();
}
@Override
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
((EntityShulker) getHandle(shulker)).a((byte) peek);
@ -1381,21 +1400,6 @@ public class NMSImpl implements NMSBridge {
handle.g(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4), opList.b(profile)));
} else {
opList.remove(profile);
}
player.recalculatePermissions();
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -18,10 +18,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_13_R2.DedicatedPlayerList;
import net.minecraft.server.v1_13_R2.DedicatedServer;
import net.minecraft.server.v1_13_R2.OpList;
import net.minecraft.server.v1_13_R2.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -191,6 +187,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
import net.citizensnpcs.trait.versioned.LlamaTrait;
@ -227,6 +224,8 @@ import net.minecraft.server.v1_13_R2.CrashReport;
import net.minecraft.server.v1_13_R2.CrashReportSystemDetails;
import net.minecraft.server.v1_13_R2.DamageSource;
import net.minecraft.server.v1_13_R2.DataWatcherObject;
import net.minecraft.server.v1_13_R2.DedicatedPlayerList;
import net.minecraft.server.v1_13_R2.DedicatedServer;
import net.minecraft.server.v1_13_R2.EnchantmentManager;
import net.minecraft.server.v1_13_R2.Enchantments;
import net.minecraft.server.v1_13_R2.EnderDragonBattle;
@ -267,6 +266,8 @@ import net.minecraft.server.v1_13_R2.Navigation;
import net.minecraft.server.v1_13_R2.NavigationAbstract;
import net.minecraft.server.v1_13_R2.NavigationSpider;
import net.minecraft.server.v1_13_R2.NetworkManager;
import net.minecraft.server.v1_13_R2.OpList;
import net.minecraft.server.v1_13_R2.OpListEntry;
import net.minecraft.server.v1_13_R2.Packet;
import net.minecraft.server.v1_13_R2.PacketPlayOutAnimation;
import net.minecraft.server.v1_13_R2.PacketPlayOutBed;
@ -782,6 +783,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
registerTraitWithCommand(manager, LlamaTrait.class);
@ -1344,6 +1346,24 @@ public class NMSImpl implements NMSBridge {
getHandle(entity).setNoGravity(enabled);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4),
opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.f(playerHandle);
}
@Override
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
((EntityShulker) getHandle(shulker)).a((byte) peek);
@ -1417,22 +1437,6 @@ public class NMSImpl implements NMSBridge {
handle.d(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getPropertyManager().getInt("op-permission-level", 4), opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.f(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -17,10 +17,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_14_R1.DedicatedPlayerList;
import net.minecraft.server.v1_14_R1.DedicatedServer;
import net.minecraft.server.v1_14_R1.OpList;
import net.minecraft.server.v1_14_R1.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -195,6 +191,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.CatTrait;
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
@ -238,6 +235,8 @@ import net.minecraft.server.v1_14_R1.ControllerLook;
import net.minecraft.server.v1_14_R1.ControllerMove;
import net.minecraft.server.v1_14_R1.DamageSource;
import net.minecraft.server.v1_14_R1.DataWatcherObject;
import net.minecraft.server.v1_14_R1.DedicatedPlayerList;
import net.minecraft.server.v1_14_R1.DedicatedServer;
import net.minecraft.server.v1_14_R1.EnchantmentManager;
import net.minecraft.server.v1_14_R1.Enchantments;
import net.minecraft.server.v1_14_R1.EnderDragonBattle;
@ -282,6 +281,8 @@ import net.minecraft.server.v1_14_R1.Navigation;
import net.minecraft.server.v1_14_R1.NavigationAbstract;
import net.minecraft.server.v1_14_R1.NavigationSpider;
import net.minecraft.server.v1_14_R1.NetworkManager;
import net.minecraft.server.v1_14_R1.OpList;
import net.minecraft.server.v1_14_R1.OpListEntry;
import net.minecraft.server.v1_14_R1.Packet;
import net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
@ -838,6 +839,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
registerTraitWithCommand(manager, CatTrait.class);
@ -1395,6 +1397,24 @@ public class NMSImpl implements NMSBridge {
getHandle(entity).setNoGravity(enabled);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getDedicatedServerProperties().opPermissionLevel,
opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.d(playerHandle);
}
@Override
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
((EntityShulker) getHandle(shulker)).a((byte) peek);
@ -1487,22 +1507,6 @@ public class NMSImpl implements NMSBridge {
handle.r(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getDedicatedServerProperties().opPermissionLevel, opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.d(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -17,10 +17,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_15_R1.DedicatedPlayerList;
import net.minecraft.server.v1_15_R1.DedicatedServer;
import net.minecraft.server.v1_15_R1.OpList;
import net.minecraft.server.v1_15_R1.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -196,6 +192,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.CatTrait;
@ -241,6 +238,8 @@ import net.minecraft.server.v1_15_R1.ControllerMove;
import net.minecraft.server.v1_15_R1.ControllerMoveFlying;
import net.minecraft.server.v1_15_R1.DamageSource;
import net.minecraft.server.v1_15_R1.DataWatcherObject;
import net.minecraft.server.v1_15_R1.DedicatedPlayerList;
import net.minecraft.server.v1_15_R1.DedicatedServer;
import net.minecraft.server.v1_15_R1.EnchantmentManager;
import net.minecraft.server.v1_15_R1.Enchantments;
import net.minecraft.server.v1_15_R1.EnderDragonBattle;
@ -287,6 +286,8 @@ import net.minecraft.server.v1_15_R1.Navigation;
import net.minecraft.server.v1_15_R1.NavigationAbstract;
import net.minecraft.server.v1_15_R1.NavigationSpider;
import net.minecraft.server.v1_15_R1.NetworkManager;
import net.minecraft.server.v1_15_R1.OpList;
import net.minecraft.server.v1_15_R1.OpListEntry;
import net.minecraft.server.v1_15_R1.Packet;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
@ -853,6 +854,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BeeTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
@ -1432,6 +1434,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getDedicatedServerProperties().opPermissionLevel,
opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.d(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((EntityPanda) getHandle(entity)).r(sitting);
@ -1536,22 +1556,6 @@ public class NMSImpl implements NMSBridge {
handle.s(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getDedicatedServerProperties().opPermissionLevel, opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.d(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -17,10 +17,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.v1_16_R3.DedicatedPlayerList;
import net.minecraft.server.v1_16_R3.DedicatedServer;
import net.minecraft.server.v1_16_R3.OpList;
import net.minecraft.server.v1_16_R3.OpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -202,6 +198,7 @@ import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
import net.citizensnpcs.trait.versioned.CatTrait;
@ -251,6 +248,8 @@ import net.minecraft.server.v1_16_R3.ControllerMove;
import net.minecraft.server.v1_16_R3.ControllerMoveFlying;
import net.minecraft.server.v1_16_R3.DamageSource;
import net.minecraft.server.v1_16_R3.DataWatcherObject;
import net.minecraft.server.v1_16_R3.DedicatedPlayerList;
import net.minecraft.server.v1_16_R3.DedicatedServer;
import net.minecraft.server.v1_16_R3.EnchantmentManager;
import net.minecraft.server.v1_16_R3.Enchantments;
import net.minecraft.server.v1_16_R3.EnderDragonBattle;
@ -299,6 +298,8 @@ import net.minecraft.server.v1_16_R3.Navigation;
import net.minecraft.server.v1_16_R3.NavigationAbstract;
import net.minecraft.server.v1_16_R3.NavigationSpider;
import net.minecraft.server.v1_16_R3.NetworkManager;
import net.minecraft.server.v1_16_R3.OpList;
import net.minecraft.server.v1_16_R3.OpListEntry;
import net.minecraft.server.v1_16_R3.Packet;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
@ -876,6 +877,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, BeeTrait.class);
registerTraitWithCommand(manager, BossBarTrait.class);
@ -1460,6 +1462,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getDedicatedServerProperties().opPermissionLevel,
opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.d(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((EntityPanda) getHandle(entity)).t(sitting);
@ -1556,22 +1576,6 @@ public class NMSImpl implements NMSBridge {
handle.setInvul(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final EntityPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final OpList opList = playerList.getOPs();
if (op) {
opList.add(new OpListEntry(profile, server.getDedicatedServerProperties().opPermissionLevel, opList.b(profile)));
} else {
opList.remove(profile);
}
playerList.d(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof LivingEntity))

View File

@ -16,10 +16,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -203,6 +199,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.EntityPoseTrait.EntityPose;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
@ -246,6 +243,8 @@ import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ChunkMap.TrackedEntity;
import net.minecraft.server.level.ServerBossEvent;
@ -254,6 +253,8 @@ import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Mth;
@ -879,6 +880,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, AxolotlTrait.class);
registerTraitWithCommand(manager, BeeTrait.class);
@ -1455,6 +1457,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(),
opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((Panda) getHandle(entity)).sit(sitting);
@ -1553,22 +1573,6 @@ public class NMSImpl implements NMSBridge {
handle.setInvulnerableTicks(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(), opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof org.bukkit.entity.LivingEntity))

View File

@ -15,10 +15,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -204,6 +200,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.EntityPoseTrait.EntityPose;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
@ -247,6 +244,8 @@ import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ChunkMap.TrackedEntity;
import net.minecraft.server.level.ServerBossEvent;
@ -255,6 +254,8 @@ import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Mth;
@ -886,6 +887,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, AxolotlTrait.class);
registerTraitWithCommand(manager, BeeTrait.class);
@ -1465,6 +1467,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(),
opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((Panda) getHandle(entity)).sit(sitting);
@ -1563,22 +1583,6 @@ public class NMSImpl implements NMSBridge {
handle.setInvulnerableTicks(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(), opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof org.bukkit.entity.LivingEntity))

View File

@ -20,10 +20,6 @@ import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -224,6 +220,7 @@ import net.citizensnpcs.trait.EntityPoseTrait.EntityPose;
import net.citizensnpcs.trait.MirrorTrait;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AllayTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
import net.citizensnpcs.trait.versioned.BeeTrait;
import net.citizensnpcs.trait.versioned.BossBarTrait;
@ -283,6 +280,8 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ChunkMap.TrackedEntity;
import net.minecraft.server.level.ServerBossEvent;
@ -291,6 +290,8 @@ import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.FluidTags;
@ -935,6 +936,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, AllayTrait.class);
registerTraitWithCommand(manager, AxolotlTrait.class);
@ -1617,6 +1619,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(),
opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((Panda) getHandle(entity)).sit(sitting);
@ -1767,22 +1787,6 @@ public class NMSImpl implements NMSBridge {
handle.setInvulnerableTicks(ticks);
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(), opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof org.bukkit.entity.LivingEntity))

View File

@ -18,10 +18,6 @@ import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -226,6 +222,7 @@ import net.citizensnpcs.trait.EntityPoseTrait.EntityPose;
import net.citizensnpcs.trait.MirrorTrait;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AllayTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.ArmadilloTrait;
import net.citizensnpcs.trait.versioned.ArmadilloTrait.ArmadilloState;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
@ -294,6 +291,8 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ChunkMap.TrackedEntity;
import net.minecraft.server.level.ServerBossEvent;
@ -302,6 +301,8 @@ import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.FluidTags;
@ -958,6 +959,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, AllayTrait.class);
registerTraitWithCommand(manager, AxolotlTrait.class);
@ -1661,6 +1663,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(),
opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((Panda) getHandle(entity)).sit(sitting);
@ -1808,22 +1828,6 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(), opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof org.bukkit.entity.LivingEntity))

View File

@ -18,10 +18,6 @@ import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -226,6 +222,7 @@ import net.citizensnpcs.trait.EntityPoseTrait.EntityPose;
import net.citizensnpcs.trait.MirrorTrait;
import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.versioned.AllayTrait;
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
import net.citizensnpcs.trait.versioned.ArmadilloTrait;
import net.citizensnpcs.trait.versioned.ArmadilloTrait.ArmadilloState;
import net.citizensnpcs.trait.versioned.AxolotlTrait;
@ -294,6 +291,8 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedPlayerList;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ChunkMap.TrackedEntity;
import net.minecraft.server.level.ServerBossEvent;
@ -302,6 +301,8 @@ import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.server.players.ServerOpList;
import net.minecraft.server.players.ServerOpListEntry;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.FluidTags;
@ -939,6 +940,7 @@ public class NMSImpl implements NMSBridge {
@Override
public void load(CommandManager manager) {
registerTraitWithCommand(manager, EnderDragonTrait.class);
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
registerTraitWithCommand(manager, AllayTrait.class);
registerTraitWithCommand(manager, AxolotlTrait.class);
registerTraitWithCommand(manager, ArmadilloTrait.class);
@ -1625,6 +1627,24 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op)
return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(),
opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
((Panda) getHandle(entity)).sit(sitting);
@ -1772,22 +1792,6 @@ public class NMSImpl implements NMSBridge {
}
}
@Override
public void setOpWithoutSaving(Player player, boolean op) {
if (player.isOp() == op) return;
final ServerPlayer playerHandle = ((CraftPlayer) player).getHandle();
final GameProfile profile = ((CraftPlayer) player).getProfile();
final DedicatedPlayerList playerList = ((CraftServer) player.getServer()).getHandle();
final DedicatedServer server = playerList.getServer();
final ServerOpList opList = playerList.getOps();
if (op) {
opList.add(new ServerOpListEntry(profile, server.getOperatorUserPermissionLevel(), opList.canBypassPlayerLimit(profile)));
} else {
opList.remove(profile);
}
playerList.sendPlayerPermissionLevel(playerHandle);
}
@Override
public boolean shouldJump(org.bukkit.entity.Entity entity) {
if (JUMP_FIELD == null || !(entity instanceof org.bukkit.entity.LivingEntity))