Animated-TabList

Animated-TabList

65.2k Downloads

Glow plugin support

MrGraycat opened this issue · 10 comments

commented

Description

Hello

I'm the developer of eGlow and am receiving more and more reports of white glows caused by your plugin.
I'm sure we can find a way around this though!

The easiest for me would be to get and set the teamprefixes. So I can set the teamprefix to the existing prefix + glowcolor. This or a way to configure the teamprefix? I checked the configs but didn't notice any settings related to it (correct me if I'm wrong)

The wierd thing is that your plugin is able to bypass my packet modifier for some reason did you do something special to prevent other plugins their teams?

Anyways I hope to hear from you soon!
If it's easier to communicate using discord or something else then tell me

MrGraycat developer of eGlow.

commented

Well, users who have this problem use tablist groups, which was created with a packet due to several older problems as well. This is why a packet must be used to handle prefix and suffix.

The source of the current problem
TabList also uses scoreboard teams to set prefix and suffix, as well as player list sorting and other things. In this code, I use PlayerInfoData to set prefixes converted to a component. Each invocation creates an instance of this class with the appropriate parameters to change the player team name and sends this instance using sendPacket. You can also see it in the code

String name = groupPlayer.getTabNameWithPrefixSuffix();
if (ServerVersion.isCurrentLower(ServerVersion.v1_16_R1)) {
name = Util.colorMsg(name);
}
Object nameComponent = ReflectionUtils.getAsIChatBaseComponent(name);
Constructor<?> playerInfoDataConstr = ClazzContainer.getPlayerInfoDataConstructor();
Object gameMode = ClazzContainer.getPlayerInfoDataGameMode().get(infoData);
int ping = (int) ClazzContainer.getPlayerInfoDataPing().get(infoData);
if (playerInfoDataConstr.getParameterCount() == 5) {
infoPacket = playerInfoDataConstr.newInstance(packetPlayOutPlayerInfo, profile, ping, gameMode,
nameComponent);
} else if (ServerVersion.isCurrentEqualOrHigher(ServerVersion.v1_17_R1)) {
infoPacket = playerInfoDataConstr.newInstance(profile, ping, gameMode, nameComponent);
} else {
infoPacket = playerInfoDataConstr.newInstance(profile, ping, gameMode, nameComponent);
}
break;
}
if (infoPacket == null || packetPlayOutPlayerInfo == null) {
return; // Somehow the 2nd condition is null sometimes
}
ClazzContainer.getInfoList().set(packetPlayOutPlayerInfo, Collections.singletonList(infoPacket));
for (TabListUser user : tl.getUsers()) {
Player player = user.getPlayer();
if (player != null) {
ReflectionUtils.sendPacket(player, packetPlayOutPlayerInfo);
ReflectionUtils.sendPacket(player, infoPacket);
}
}

There was a problem recently that the player name tag was not visible or overwritten, but this has already been fixed in the latest versions (this is not part of this issue).

Short summary

This is probably due to the packet sending mentioned above. To tell you the truth, I don’t have much idea how to fix this, as I haven’t dealt with glow yet, I’ve only seen a few resources.

You can find me on discord, see README

Edit: Sorry, if this text is too long.

commented

Hello

After getting more and more reports of some different plugins also causing this problem I did check my packet blocker code again and seems I had one line to high causing it to set a value each loop instead of once when the loop was done. This resolved the issue for me as it's now able to properly block your plugins teampacket.

NOTE: This doesn't mean it's compatible with other glow plugins as they probably don't have this advanced packet handling stuff so you might still want to add an option to let them hook in your plugin to set the teamprefix/teamcolor.

Thanks
MrGraycat

commented

Hello

Reopened this since it's happening again and would like to add proper support instead.
Through the API since it is already possible by disabling features in eGlow and configuring TabList properly.

Thanks
MrGraycat

commented

I don't really know still what would be the solution, but if you need to use TabList's API, you can get from jitpack with the repository name.

If you want to retrieve team prefix/suffix from TabList from each of existing team:

// You can also cache TabListAPI#getPlugin to a variable if you use this multiple times
for (TeamHandler team : TabListAPI.getPlugin().getGroups().getGroupsList()) {
    String prefix = team.prefix.getPlainText();
    String suffix = team.suffix.getPlainText();
    // your code...
}

Or from a specific player:

TabListAPI.getPlugin().getUser(player).ifPresent(user -> {
    TeamHandler team = user.getGroupPlayer().getGroup();

    if (team != null) {
        String prefix = team.prefix.getPlainText();
        // ...
    }
});
commented

Hello

Great to see the API has expanded since then, however am unable to properly add it as a dependency for gradle.
looking at jitpack it's unable to build properly here's the log (that's for v5.6.4) it seems it hasn't been setup properly to work with jitpack?

Thanks
MrGraycat

commented

After some trying I managed to fix jitpack building issue, so now it is working. You only need to use master-SNAPSHOT tag for versioning.

commented

Sorry for the delayed response
This does work and have one more question.
Is it safe to do all this async or is TabList not made to be accessed async?

Thanks
MrGraycat

commented

Most of the methods is safe to call in asynchronous thread. The methods in this resource isn't documented, because I thought no one will use the API from this plugin. So developers like you don't know what does that method will perform if executed. So I am sorry if something not understandable. But it also depends on the Bukkit API if those methods supports asynchronous calls.

commented

Hello

me again I noticed a lot of the latest commits/releases are not able to build anymore (which means I cannot access the newer dependencies of your plugin). Could you have a look at this and resolve it?
jitpack page
log

Thanks
MrGraycat

commented

I am aware of this issue, but this is most likely Jitpack's issue

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jitpack/build/buildSrc/build.gradle.kts' line: 10

* What went wrong:
Script compilation errors:

  Line 10: apply plugin: 'maven-publish'
                       ^ Expecting an element

  Line 12: def ver = version
                   ^ Expecting an element

... and more

As you can see from this error this is coming from Jitpack's building process which I don't know if I can fix it or not or it is even Jitpack's issue. So currently I have no idea how to solve this.