Introduce setGlowColor and no longer have a self disguise scoreboard, instead all non-player disguises have their own uuid which is added to a scoreboard team. Downside is you can now tell if someone isn't disguised cos they can be pushed around. Might be worth doing both?

This commit is contained in:
libraryaddict 2021-04-24 12:34:24 +12:00
parent dfda600445
commit ee2224e68f
11 changed files with 100 additions and 212 deletions

View File

@ -37,9 +37,6 @@ import java.util.Map.Entry;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class DisguiseConfig { public class DisguiseConfig {
@Getter
@Setter
private static DisguisePushing pushingOption = DisguisePushing.MODIFY_SCOREBOARD;
@Getter @Getter
@Setter @Setter
private static HashMap<DisguisePerm, String> customDisguises = new HashMap<>(); private static HashMap<DisguisePerm, String> customDisguises = new HashMap<>();
@ -675,19 +672,6 @@ public class DisguiseConfig {
DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch"); DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch");
} }
try {
String option = config.getString("SelfDisguisesScoreboard", DisguisePushing.MODIFY_SCOREBOARD.name()).toUpperCase(Locale.ENGLISH);
if (!option.endsWith("_SCOREBOARD")) {
option += "_SCOREBOARD";
}
pushingOption = DisguisePushing.valueOf(option);
} catch (Exception ex) {
DisguiseUtilities.getLogger()
.warning("Cannot parse '" + config.getString("SelfDisguisesScoreboard") + "' to a valid option for SelfDisguisesScoreboard");
}
PermissionDefault commandVisibility = PermissionDefault.getByName(config.getString("Permissions.SeeCommands")); PermissionDefault commandVisibility = PermissionDefault.getByName(config.getString("Permissions.SeeCommands"));
if (commandVisibility == null) { if (commandVisibility == null) {

View File

@ -121,11 +121,11 @@ public class LDScoreboard implements LDCommand {
} }
List<PacketListener> listeners = ProtocolLibrary.getProtocolManager().getPacketListeners().stream() List<PacketListener> listeners = ProtocolLibrary.getProtocolManager().getPacketListeners().stream()
.filter(listener -> listener.getPlugin() != LibsDisguises.getInstance() && listener.getSendingWhitelist().getTypes().contains(PacketType.Play.Server.SCOREBOARD_TEAM)).collect(Collectors.toList()); .filter(listener -> listener.getPlugin() != LibsDisguises.getInstance() &&
listener.getSendingWhitelist().getTypes().contains(PacketType.Play.Server.SCOREBOARD_TEAM)).collect(Collectors.toList());
if (!listeners.isEmpty()) { if (!listeners.isEmpty()) {
ComponentBuilder builder = ComponentBuilder builder = new ComponentBuilder("");
new ComponentBuilder("");
builder.append("The following plugins are listening for scoreboard teams using ProtocolLib, and could be modifying collisions: "); builder.append("The following plugins are listening for scoreboard teams using ProtocolLib, and could be modifying collisions: ");
builder.color(net.md_5.bungee.api.ChatColor.BLUE); builder.color(net.md_5.bungee.api.ChatColor.BLUE);
@ -160,9 +160,8 @@ public class LDScoreboard implements LDCommand {
LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.send(sender); LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.send(sender);
if (DisguiseConfig.getPushingOption() == DisguiseConfig.DisguisePushing.IGNORE_SCOREBOARD) { sender.sendMessage(ChatColor.RED +
LibsMsg.LIBS_SCOREBOARD_DISABLED.send(sender); "This command is somewhat outdated and needs to be changed, pushing is now disabled on the entities themselves and not players");
}
Player player; Player player;
@ -200,18 +199,7 @@ public class LDScoreboard implements LDCommand {
return; return;
} }
if (team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.NEVER &&
team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.FOR_OTHER_TEAMS) {
LibsMsg.LIBS_SCOREBOARD_NO_TEAM_PUSH.send(sender, team.getName());
return;
}
LibsMsg.LIBS_SCOREBOARD_SUCCESS.send(sender, team.getName()); LibsMsg.LIBS_SCOREBOARD_SUCCESS.send(sender, team.getName());
if (Bukkit.getPluginManager().getPlugin("TAB") != null) {
LibsMsg.PLUGIN_TAB_DETECTED.send(sender);
}
} }
@Override @Override

View File

@ -96,12 +96,22 @@ public abstract class Disguise {
@Getter @Getter
@Setter @Setter
private String soundGroup; private String soundGroup;
private UUID uuid = ReflectionManager.getRandomUUID();
public Disguise(DisguiseType disguiseType) { public Disguise(DisguiseType disguiseType) {
this.disguiseType = disguiseType; this.disguiseType = disguiseType;
this.disguiseName = disguiseType.toReadable(); this.disguiseName = disguiseType.toReadable();
} }
public UUID getUUID() {
// Partial fix for disguises serialized in older versions
if (this.uuid == null) {
this.uuid = ReflectionManager.getRandomUUID();
}
return uuid;
}
public int getMultiNameLength() { public int getMultiNameLength() {
return multiName.length; return multiName.length;
} }
@ -939,6 +949,10 @@ public abstract class Disguise {
} }
} }
if (!isPlayerDisguise()) {
DisguiseUtilities.setGlowColor(this, null);
}
// If this disguise is active // If this disguise is active
// Remove the disguise from the current disguises. // Remove the disguise from the current disguises.
if (DisguiseUtilities.removeDisguise((TargetedDisguise) this) && !disguiseBeingReplaced) { if (DisguiseUtilities.removeDisguise((TargetedDisguise) this) && !disguiseBeingReplaced) {
@ -1163,6 +1177,10 @@ public abstract class Disguise {
// Stick the disguise in the disguises bin // Stick the disguise in the disguises bin
DisguiseUtilities.addDisguise(entity.getEntityId(), (TargetedDisguise) this); DisguiseUtilities.addDisguise(entity.getEntityId(), (TargetedDisguise) this);
if (!isPlayerDisguise()) {
DisguiseUtilities.setGlowColor(this, getWatcher().getGlowColor());
}
if (isSelfDisguiseVisible() && getEntity() instanceof Player) { if (isSelfDisguiseVisible() && getEntity() instanceof Player) {
DisguiseUtilities.removeSelfDisguise(this); DisguiseUtilities.removeSelfDisguise(this);
} }

View File

@ -59,7 +59,7 @@ public class FlagWatcher {
private transient boolean previouslySneaking; private transient boolean previouslySneaking;
@Getter @Getter
private boolean upsideDown; private boolean upsideDown;
private ChatColor glowColor; private ChatColor glowColor = ChatColor.WHITE;
@Getter @Getter
private Float pitchLock; private Float pitchLock;
@Getter @Getter
@ -708,7 +708,7 @@ public class FlagWatcher {
} }
public void setGlowColor(ChatColor glowColor) { public void setGlowColor(ChatColor glowColor) {
if (getGlowColor() == glowColor) { if (getGlowColor() == glowColor || glowColor == null || !glowColor.isColor()) {
return; return;
} }
@ -721,7 +721,7 @@ public class FlagWatcher {
if (getDisguise().isPlayerDisguise()) { if (getDisguise().isPlayerDisguise()) {
DisguiseUtilities.updateExtendedName((PlayerDisguise) getDisguise()); DisguiseUtilities.updateExtendedName((PlayerDisguise) getDisguise());
} else { } else {
// TODO DisguiseUtilities.setGlowColor(getDisguise(), getGlowColor());
} }
} }

View File

@ -31,7 +31,6 @@ public class PlayerDisguise extends TargetedDisguise {
* Has someone set name visible explicitly? * Has someone set name visible explicitly?
*/ */
private boolean explicitNameVisible = false; private boolean explicitNameVisible = false;
private final UUID uuid = ReflectionManager.getRandomUUID();
private transient DisguiseUtilities.DScoreTeam scoreboardName; private transient DisguiseUtilities.DScoreTeam scoreboardName;
@Getter @Getter
private boolean deadmau5Ears; private boolean deadmau5Ears;
@ -77,7 +76,7 @@ public class PlayerDisguise extends TargetedDisguise {
setName(gameProfile.getName()); setName(gameProfile.getName());
this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, gameProfile.getName(), gameProfile); this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), gameProfile.getName(), gameProfile);
createDisguise(); createDisguise();
} }
@ -87,7 +86,7 @@ public class PlayerDisguise extends TargetedDisguise {
setName(gameProfile.getName()); setName(gameProfile.getName());
this.gameProfile = ReflectionManager.getGameProfile(uuid, gameProfile.getName()); this.gameProfile = ReflectionManager.getGameProfile(getUUID(), gameProfile.getName());
setSkin(skinToUse); setSkin(skinToUse);
@ -152,9 +151,6 @@ public class PlayerDisguise extends TargetedDisguise {
isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName(); isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName();
} }
public UUID getUUID() {
return uuid;
}
public boolean isNameVisible() { public boolean isNameVisible() {
return nameVisible; return nameVisible;
@ -250,7 +246,7 @@ public class PlayerDisguise extends TargetedDisguise {
if (currentLookup == null && gameProfile != null) { if (currentLookup == null && gameProfile != null) {
disguise.skinToUse = getSkin(); disguise.skinToUse = getSkin();
disguise.gameProfile = ReflectionManager.getGameProfileWithThisSkin(disguise.uuid, getGameProfile().getName(), getGameProfile()); disguise.gameProfile = ReflectionManager.getGameProfileWithThisSkin(disguise.getUUID(), getGameProfile().getName(), getGameProfile());
} else { } else {
disguise.setSkin(getSkin()); disguise.setSkin(getSkin());
} }
@ -269,9 +265,9 @@ public class PlayerDisguise extends TargetedDisguise {
public WrappedGameProfile getGameProfile() { public WrappedGameProfile getGameProfile() {
if (gameProfile == null) { if (gameProfile == null) {
if (getSkin() != null) { if (getSkin() != null) {
gameProfile = ReflectionManager.getGameProfile(uuid, getProfileName()); gameProfile = ReflectionManager.getGameProfile(getUUID(), getProfileName());
} else { } else {
gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getProfileName(), DisguiseUtilities.getProfileFromMojang(this)); gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), getProfileName(), DisguiseUtilities.getProfileFromMojang(this));
} }
} }
@ -279,7 +275,7 @@ public class PlayerDisguise extends TargetedDisguise {
} }
public void setGameProfile(WrappedGameProfile gameProfile) { public void setGameProfile(WrappedGameProfile gameProfile) {
this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, gameProfile.getName(), gameProfile); this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), gameProfile.getName(), gameProfile);
} }
public String getName() { public String getName() {
@ -390,7 +386,7 @@ public class PlayerDisguise extends TargetedDisguise {
playerName = name; playerName = name;
if (gameProfile != null) { if (gameProfile != null) {
gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getProfileName(), getGameProfile()); gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), getProfileName(), getGameProfile());
} }
} }
} }
@ -410,7 +406,7 @@ public class PlayerDisguise extends TargetedDisguise {
} }
if (gameProfile != null) { if (gameProfile != null) {
gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getProfileName(), getGameProfile()); gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), getProfileName(), getGameProfile());
} }
if (!startDisguise()) { if (!startDisguise()) {
@ -500,7 +496,7 @@ public class PlayerDisguise extends TargetedDisguise {
currentLookup = null; currentLookup = null;
this.skinToUse = gameProfile.getName(); this.skinToUse = gameProfile.getName();
this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getProfileName(), gameProfile); this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), getProfileName(), gameProfile);
refreshDisguise(); refreshDisguise();

View File

@ -119,13 +119,9 @@ public class DisguiseUtilities {
team.setOption(Option.NAME_TAG_VISIBILITY, nameVisible ? OptionStatus.ALWAYS : OptionStatus.NEVER); team.setOption(Option.NAME_TAG_VISIBILITY, nameVisible ? OptionStatus.ALWAYS : OptionStatus.NEVER);
} }
ChatColor color = disguise.getWatcher().getGlowColor(); team.setOption(Option.COLLISION_RULE, OptionStatus.NEVER);
if (color == null) { team.setColor(disguise.getWatcher().getGlowColor());
color = ChatColor.WHITE;
}
team.setColor(color);
if (NmsVersion.v1_13.isSupported()) { if (NmsVersion.v1_13.isSupported()) {
team.setPrefix("Colorize"); team.setPrefix("Colorize");
@ -164,8 +160,6 @@ public class DisguiseUtilities {
private static final HashMap<String, ArrayList<Object>> runnables = new HashMap<>(); private static final HashMap<String, ArrayList<Object>> runnables = new HashMap<>();
@Getter @Getter
private static final HashSet<UUID> selfDisguised = new HashSet<>(); private static final HashSet<UUID> selfDisguised = new HashSet<>();
private static final HashMap<UUID, String> preDisguiseTeam = new HashMap<>();
private static final HashMap<UUID, String> disguiseTeam = new HashMap<>();
private static final File profileCache = new File("plugins/LibsDisguises/SavedSkins"); private static final File profileCache = new File("plugins/LibsDisguises/SavedSkins");
private static final File savedDisguises = new File("plugins/LibsDisguises/SavedDisguises"); private static final File savedDisguises = new File("plugins/LibsDisguises/SavedDisguises");
@Getter @Getter
@ -1321,6 +1315,7 @@ public class DisguiseUtilities {
registerAllExtendedNames(board); registerAllExtendedNames(board);
registerNoName(board); registerNoName(board);
registerColors(board);
} }
if (NmsVersion.v1_13.isSupported()) { if (NmsVersion.v1_13.isSupported()) {
@ -1708,8 +1703,6 @@ public class DisguiseUtilities {
ex.printStackTrace(); ex.printStackTrace();
} }
removeSelfDisguiseScoreboard(player);
// player.spigot().setCollidesWithEntities(true); // player.spigot().setCollidesWithEntities(true);
// Finish up // Finish up
// Remove the fake entity ID from the disguise bin // Remove the fake entity ID from the disguise bin
@ -1878,6 +1871,61 @@ public class DisguiseUtilities {
} }
} }
public static void setGlowColor(UUID uuid, ChatColor color) {
String name = color == null ? "" : getTeamName(color);
for (Scoreboard scoreboard : getAllScoreboards()) {
Team team = scoreboard.getEntryTeam(uuid.toString());
if (team != null) {
if (!team.getName().startsWith("LD_Color_") || name.equals(team.getName())) {
continue;
}
team.removeEntry(uuid.toString());
}
if (color == null) {
continue;
}
team = scoreboard.getTeam(name);
if (team == null) {
continue;
}
team.addEntry(uuid.toString());
}
}
public static void setGlowColor(Disguise disguise, ChatColor color) {
setGlowColor(disguise.getUUID(), color);
}
public static String getTeamName(ChatColor color) {
return "LD_Color_" + color.getChar();
}
public static void registerColors(Scoreboard scoreboard) {
for (ChatColor color : ChatColor.values()) {
if (!color.isColor()) {
continue;
}
String name = getTeamName(color);
Team team = scoreboard.getTeam(name);
if (team == null) {
team = scoreboard.registerNewTeam(name);
}
team.setColor(color);
team.setOption(Option.COLLISION_RULE, OptionStatus.NEVER);
}
}
public static String[] getExtendedNameSplit(String playerName, String name) { public static String[] getExtendedNameSplit(String playerName, String name) {
if (name.length() <= 16 && !DisguiseConfig.isScoreboardNames()) { if (name.length() <= 16 && !DisguiseConfig.isScoreboardNames()) {
throw new IllegalStateException("This can only be used for names longer than 16 characters!"); throw new IllegalStateException("This can only be used for names longer than 16 characters!");
@ -2017,144 +2065,6 @@ public class DisguiseUtilities {
return board.getEntryTeam(name) == null && Bukkit.getPlayerExact(name) == null; return board.getEntryTeam(name) == null && Bukkit.getPlayerExact(name) == null;
} }
public static void removeSelfDisguiseScoreboard(Player player) {
String originalTeam = preDisguiseTeam.remove(player.getUniqueId());
String teamDisguise = disguiseTeam.remove(player.getUniqueId());
if (teamDisguise == null || DisguiseConfig.getPushingOption() == DisguisePushing.IGNORE_SCOREBOARD) {
return;
}
// Code replace them back onto their original scoreboard team
Scoreboard scoreboard = player.getScoreboard();
Team team = originalTeam == null ? null : scoreboard.getTeam(originalTeam);
Team ldTeam = null;
for (Team t : scoreboard.getTeams()) {
if (!t.hasEntry(player.getName())) {
continue;
}
ldTeam = t;
break;
}
if (DisguiseConfig.isWarnScoreboardConflict()) {
if (ldTeam == null || !ldTeam.getName().equals(teamDisguise)) {
getLogger().warning("Scoreboard conflict, the self disguise player was not on the expected team!");
} else {
OptionStatus collisions = ldTeam.getOption(Option.COLLISION_RULE);
if (collisions != OptionStatus.NEVER && collisions != OptionStatus.FOR_OTHER_TEAMS) {
getLogger().warning("Scoreboard conflict, the collisions for a self disguise player team has been " + "unexpectedly modifed!");
}
}
}
if (ldTeam != null) {
if (!ldTeam.getName().equals("LD_Pushing") && !ldTeam.getName().endsWith("_LDP")) {
// Its not a team assigned by Lib's Disguises
ldTeam = null;
}
}
if (team != null) {
team.addEntry(player.getName());
} else if (ldTeam != null) {
ldTeam.removeEntry(player.getName());
}
if (ldTeam != null && ldTeam.getEntries().isEmpty()) {
ldTeam.unregister();
}
}
public static void setupSelfDisguiseScoreboard(Player player) {
// They're already in a disguise team
if (disguiseTeam.containsKey(player.getUniqueId())) {
return;
}
if ((LibsPremium.getPluginInformation() != null && LibsPremium.getPluginInformation().isPremium() && !LibsPremium.getPluginInformation().isLegit()) ||
(LibsPremium.getPaidInformation() != null && !LibsPremium.getPaidInformation().isLegit())) {
return;
}
DisguisePushing pOption = DisguiseConfig.getPushingOption();
if (pOption == DisguisePushing.IGNORE_SCOREBOARD) {
return;
}
// Code to stop player pushing
Scoreboard scoreboard = player.getScoreboard();
Team prevTeam = null;
Team ldTeam = null;
String ldTeamName = "LD_Pushing";
for (Team t : scoreboard.getTeams()) {
if (!t.hasEntry(player.getName())) {
continue;
}
prevTeam = t;
break;
}
// If the player is in a team already and the team isn't one controlled by Lib's Disguises
if (prevTeam != null && !(prevTeam.getName().equals("LD_Pushing") || prevTeam.getName().endsWith("_LDP"))) {
// If we're creating a scoreboard
if (pOption == DisguisePushing.CREATE_SCOREBOARD) {
// Remember his old team so we can give him it back later
preDisguiseTeam.put(player.getUniqueId(), prevTeam.getName());
} else {
// We're modifying the scoreboard
ldTeam = prevTeam;
}
} else {
prevTeam = null;
}
// If we are creating a new scoreboard because the current one must not be modified
if (pOption == DisguisePushing.CREATE_SCOREBOARD) {
// If they have a team, we'll reuse that name. Otherwise go for another name
ldTeamName = (prevTeam == null ? "NoTeam" : prevTeam.getName());
// Give the teamname a custom name
ldTeamName = ldTeamName.substring(0, Math.min(12, ldTeamName.length())) + "_LDP";
}
if (ldTeam == null && (ldTeam = scoreboard.getTeam(ldTeamName)) == null) {
ldTeam = scoreboard.registerNewTeam(ldTeamName);
}
disguiseTeam.put(player.getUniqueId(), ldTeam.getName());
if (!ldTeam.hasEntry(player.getName())) {
ldTeam.addEntry(player.getName());
}
if (pOption == DisguisePushing.CREATE_SCOREBOARD && prevTeam != null) {
ldTeam.setAllowFriendlyFire(prevTeam.allowFriendlyFire());
ldTeam.setCanSeeFriendlyInvisibles(prevTeam.canSeeFriendlyInvisibles());
ldTeam.setDisplayName(prevTeam.getDisplayName());
ldTeam.setPrefix(prevTeam.getPrefix());
ldTeam.setSuffix(prevTeam.getSuffix());
for (Option option : Team.Option.values()) {
ldTeam.setOption(option, prevTeam.getOption(option));
}
}
if (ldTeam.getOption(Option.COLLISION_RULE) != OptionStatus.NEVER && DisguiseConfig.isModifyCollisions()) {
ldTeam.setOption(Option.COLLISION_RULE, OptionStatus.NEVER);
}
if (ldTeam.canSeeFriendlyInvisibles() && DisguiseConfig.isDisableFriendlyInvisibles()) {
ldTeam.setCanSeeFriendlyInvisibles(false);
}
}
/** /**
* Splits a string while respecting quotes. * Splits a string while respecting quotes.
* <p> * <p>
@ -2357,8 +2267,6 @@ public class DisguiseUtilities {
return; return;
} }
setupSelfDisguiseScoreboard(player);
// Check for code differences in PaperSpigot vs Spigot // Check for code differences in PaperSpigot vs Spigot
if (!runningPaper) { if (!runningPaper) {
// Add himself to his own entity tracker // Add himself to his own entity tracker

View File

@ -404,6 +404,7 @@ public class DisguiseListener implements Listener {
if (p.getScoreboard() != Bukkit.getScoreboardManager().getMainScoreboard()) { if (p.getScoreboard() != Bukkit.getScoreboardManager().getMainScoreboard()) {
DisguiseUtilities.registerAllExtendedNames(p.getScoreboard()); DisguiseUtilities.registerAllExtendedNames(p.getScoreboard());
DisguiseUtilities.registerColors(p.getScoreboard());
} }
if (!p.hasMetadata("forge_mods")) { if (!p.hasMetadata("forge_mods")) {
@ -486,8 +487,6 @@ public class DisguiseListener implements Listener {
public void onQuit(PlayerQuitEvent event) { public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
DisguiseUtilities.removeSelfDisguiseScoreboard(player);
// Removed as its not compatible with scoreboard teams // Removed as its not compatible with scoreboard teams
/*if (player.hasPermission("libsdisguises.seethrough")) { /*if (player.hasPermission("libsdisguises.seethrough")) {
for (Set<TargetedDisguise> disguises : DisguiseUtilities.getDisguises().values()) { for (Set<TargetedDisguise> disguises : DisguiseUtilities.getDisguises().values()) {

View File

@ -139,7 +139,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
StructureModifier<Object> mods = spawnPainting.getModifier(); StructureModifier<Object> mods = spawnPainting.getModifier();
mods.write(0, disguisedEntity.getEntityId()); mods.write(0, disguisedEntity.getEntityId());
mods.write(1, disguisedEntity.getUniqueId()); mods.write(1, disguise.getUUID());
mods.write(2, ReflectionManager.getBlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); mods.write(2, ReflectionManager.getBlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
mods.write(3, ReflectionManager.getEnumDirection(((int) loc.getYaw()) % 4)); mods.write(3, ReflectionManager.getEnumDirection(((int) loc.getYaw()) % 4));
@ -257,7 +257,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
StructureModifier<Object> mods = spawnEntity.getModifier(); StructureModifier<Object> mods = spawnEntity.getModifier();
mods.write(0, disguisedEntity.getEntityId()); mods.write(0, disguisedEntity.getEntityId());
mods.write(1, disguisedEntity.getUniqueId()); mods.write(1, disguise.getUUID());
if (!disguise.getType().isCustom()) { if (!disguise.getType().isCustom()) {
mods.write(2, disguise.getType().getTypeId()); mods.write(2, disguise.getType().getTypeId());
@ -357,7 +357,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
} }
Object[] params = Object[] params =
new Object[]{disguisedEntity.getEntityId(), disguisedEntity.getUniqueId(), x, y, z, loc.getPitch(), loc.getYaw(), entityType, data, new Object[]{disguisedEntity.getEntityId(), disguise.getUUID(), x, y, z, loc.getPitch(), loc.getYaw(), entityType, data,
ReflectionManager.getVec3D(disguisedEntity.getVelocity())}; ReflectionManager.getVec3D(disguisedEntity.getVelocity())};
spawnEntity = ProtocolLibrary.getProtocolManager().createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, params).createPacket(params); spawnEntity = ProtocolLibrary.getProtocolManager().createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, params).createPacket(params);

View File

@ -24,7 +24,7 @@ public class PacketListenerScoreboardTeam extends PacketAdapter {
PacketContainer packet = event.getPacket(); PacketContainer packet = event.getPacket();
String name = packet.getStrings().read(0); String name = packet.getStrings().read(0);
if (name == null || !name.startsWith("LD_") || name.equals("LD_NoName") || name.equals("LD_Pushing")) { if (name == null || !name.startsWith("LD_") || name.equals("LD_NoName")) {
return; return;
} }

View File

@ -128,6 +128,8 @@ public class ParamInfoTypes {
"Set how long the disguise lasts, <Num><Time><Num>... where <Time> is (s/sec)(m/min)(h/hour)(d/day) " + "Set how long the disguise lasts, <Num><Time><Num>... where <Time> is (s/sec)(m/min)(h/hour)(d/day) " +
"etc. 30m20secs = 30 minutes, 20 seconds")); "etc. 30m20secs = 30 minutes, 20 seconds"));
paramInfos.add(new ParamInfoEnum(ChatColor.class, "ChatColor", "A chat color"));
// Register base types // Register base types
Map<String, Object> booleanMap = new HashMap<>(); Map<String, Object> booleanMap = new HashMap<>();
booleanMap.put("true", true); booleanMap.put("true", true);

View File

@ -310,19 +310,12 @@ public enum LibsMsg {
ITEM_SERIALIZED_MC_LD_NO_COPY(ChatColor.GOLD + "MC Serialized for LD: " + ChatColor.YELLOW + "%s"), ITEM_SERIALIZED_MC_LD_NO_COPY(ChatColor.GOLD + "MC Serialized for LD: " + ChatColor.YELLOW + "%s"),
ITEM_SIMPLE_STRING_NO_COPY(ChatColor.GOLD + "Simple: " + ChatColor.YELLOW + "%s"), ITEM_SIMPLE_STRING_NO_COPY(ChatColor.GOLD + "Simple: " + ChatColor.YELLOW + "%s"),
LIBS_SCOREBOARD_NO_TEAM(ChatColor.RED + "Not on a scoreboard team!"), LIBS_SCOREBOARD_NO_TEAM(ChatColor.RED + "Not on a scoreboard team!"),
LIBS_SCOREBOARD_NO_TEAM_PUSH(ChatColor.RED + "On scoreboard team '%s' and pushing is enabled! (That's bad)"),
PLUGIN_TAB_DETECTED(ChatColor.RED + "TAB has been detected! This is a huge culprit! Check the TAB config and set " +
ChatColor.GREEN + "enable-collision: true" + ChatColor.RED + " to " + ChatColor.DARK_GREEN +
"enable-collision: false"),
LIBS_SCOREBOARD_SUCCESS(ChatColor.GOLD + LIBS_SCOREBOARD_SUCCESS(ChatColor.GOLD +
"On scoreboard team '%s' with pushing disabled! If you're still having issues and you are disguised right" + "On scoreboard team '%s' with pushing disabled! If you're still having issues and you are disguised right" +
" now, then " + " now, then " +
"you have a plugin modifying scoreboard through packets. Example of this is a plugin that modifies your " + "you have a plugin modifying scoreboard through packets. Example of this is a plugin that modifies your " +
"name above head, or the tablist. Check their configs for pushing disabling options\nSay 'I read to the " + "name above head, or the tablist. Check their configs for pushing disabling options\nSay 'I read to the " +
"end' if you " + "still need help with this, or we'll assume you can't read."), "end' if you " + "still need help with this, or we'll assume you can't read."),
LIBS_SCOREBOARD_DISABLED(
"The scoreboard modification has been disabled in config, will continue the debug incase this is intended" +
"."),
LIBS_SCOREBOARD_NAMES_DISABLED(ChatColor.RED + LIBS_SCOREBOARD_NAMES_DISABLED(ChatColor.RED +
"Scoreboard names has been disabled, the test for player disguises has failed before it started"), "Scoreboard names has been disabled, the test for player disguises has failed before it started"),
LIBS_SCOREBOARD_IGNORE_TEST( LIBS_SCOREBOARD_IGNORE_TEST(