xezard / xglow Goto Github PK
View Code? Open in Web Editor NEWSimple ProtocolLib based API for Spigot to create glow on your entities.
License: Apache License 2.0
Simple ProtocolLib based API for Spigot to create glow on your entities.
License: Apache License 2.0
When trying to shade XGlow, registration of the packet listener for protocollib does not occur.
I found a bug.
When a holder(a player who is glowing) pulls a bow, sometimes it stops to glow for some viewers(not everyone).
It also happens when crounching/swimming/sneeking etc. I think it is related to motion/amimation change
I find that the changes introduced by this commit (v1.0.4) completely break the fixes introduced in this commit (v1.0.3).
Another issue I noticed is that 1.0.3 only partly fixes glow reset on metadata changes.
Perhaps the intended fixes for 1.0.4 would work in combination with the fixes in 1.0.3? I don't know - haven't tested it myself.
Even if I fill in the dependencies in pom.xml, I get an error and cannot use them.
Here is my current code.
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Xezard.XGlow</groupId>
<artifactId>XGlow</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
"Global" glow objects for all players on server.
Error Message:
ru.xezard:XGlow:pom:${revision} was not found
My pom.xml (relevant parts only):
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.Xezard</groupId>
<artifactId>XGlow</artifactId>
<version>1.0.9</version>
</dependency>
Do you planned to do a 1.20.2 version ?
How to check if a player is already glowing?
It would be convenient to get an already existing Glow object using GlowAPI (instead of storing it yourself in your plugin)
UPD: Found a way to do this with GlowsManager.getInstance().getGlowByEntity()
Perhaps it is worth adding a description of this manager to the plugin pages on SpigotMCs (ru/org)?
When I run an inspection Maven gives the following error: Dependency com.github.Xezard:XGlow:{latest_version} not found. How do I solve this?
I was recently trying to use XGlow in 1.19.3, but it was crashing when the client received a packet due to a cast exception.
The solution seems to be to change the setMetadata() in WrapperPlayServerEntityMetadata to this
public void setMetadata(List<WrappedWatchableObject> value) {
final List<WrappedDataValue> wrappedDataValueList = new ArrayList<>();
value.stream().filter(Objects::nonNull).forEach(entry -> {
final WrappedDataWatcher.WrappedDataWatcherObject dataWatcherObject = entry.getWatcherObject();
wrappedDataValueList.add(new WrappedDataValue(dataWatcherObject.getIndex(), dataWatcherObject.getSerializer(), entry.getRawValue()));
});
handle.getDataValueCollectionModifier().write(0, wrappedDataValueList);
}
And the onPacketSending in GlowAPI to this
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
Entity entity = packet.getEntityModifier(event).read(0);
GlowsManager.getInstance().getGlowByEntity(entity).ifPresent((glow) -> {
final List<WrappedDataValue> wrappedDataValueList = new ArrayList<>();
GlowProcessor.getInstance().createDataWatcher(entity, glow.sees(event.getPlayer()))
.getWatchableObjects().stream().filter(Objects::nonNull).forEach(entry -> {
final WrappedDataWatcher.WrappedDataWatcherObject dataWatcherObject = entry.getWatcherObject();
wrappedDataValueList.add(new WrappedDataValue(dataWatcherObject.getIndex(), dataWatcherObject.getSerializer(), entry.getRawValue()));
});
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
event.setPacket(packet);
});
}
I was having trouble getting a pull request/fork to work (and this solution is quite messy), so in the meantime, I'll just post this here so that if anyone needs to fix it they can.
XGlow Version: 1.0.8 (latest)
ProtocolLib Version: 4.8.0 (latest)
Minecraft Server Version: Paper 1.18.1-160
JDK Version: 16.0.2
Description
While applying the glow effect on multiple entities (one glow effect per entities) with different colors and then restrict the viewer to only one player, other players can sometimes see the glowing effect on those entities, without the colors applied (The glow effect shows in white)
How to reproduce
Here is a pseudo code of what I did if it can help:
for(Object obj: ObjectList)) {
LivingEntity entity = (LivingEntity) someWorld.spawnEntity(someLocation, Entity.someEntity);
entity.setAI(false); entity.setSilent(true); entity.setPersistent(true); entity.setInvulnerable(true); entity.setInvisible(true);
Glow glow = null; //I also tried creating a placeholder Glow object with the builder or by creating a new Glow Instance (the result remains the same)
if(stuff) glow = Glow.builder().color(Color).name(String.valueOf(entity.getEnitityId()).build();
else if(stuff) glow = Glow.builder().color(Color).name(String.valueOf(entity.getEnitityId()).build();
//I also tried creating a new Glow instance instead of using the builder (the result remains the same)
else if(stuff) [...]
//at the end of all those conditions, there is no way that the glow variable should be null anyway
glow.addHolders(entity);
glow.hideFromEveryone()
glow.display(theIntendedPlayer)
}
What is happening
With this code, what is intended to happen works perfectly: theIntendedPlayer
can see the glow effect on entity
with the right color applied on it.
However, other players that are unintended viewers can see the glow effect on some spawned entities but the effect only appears white.
Hope you'll see what's wrong, thank you for your time and support ! :)
Steps to Resolve:
.m2
(local repo) on machineError: Could not find artifact com.github.Xezard.XGlow:XGlow:jar:1.1.0
<dependency>
<groupId>com.github.Xezard.XGlow</groupId>
<artifactId>XGlow</artifactId>
<version>1.1.0</version>
</dependency>
Ref: #23
Paper Version
: git-Paper-386 (MC: 1.19.3)
Plugin Version
: XGlow version 1.1.0
ProtocolLib Version
: 5.0.0-SNAPSHOT-b612
Console error message
: https://gist.github.com/Chronoken/fd5e1739671b5961eb14328575661b31
Steps to reproduce:
When the entity metadata changes, it can overwrite the packet sent to the player.
In this case, the glow with the entity is reset.
Steps to reproduce:
Actual on the following versions of Paper:
This issue does NOT related to #14, because the correct method is called with the "/glow disable" command:
this.glow.removeHolders(this.entity)
So this problem seems to be in the API, not in example plugin
When i try to use the command it throws an error, on the line that i set the hidefrom and display
i have this set for the teams
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getMainScoreboard();
Team RedTeam = board.getTeam("Red");
String RedPlayers = String.valueOf(RedTeam.getEntries());
Team BlueTeam = board.getTeam("Blue");
String BluePlayers = String.valueOf(BlueTeam.getEntries());
I have made it a string but have tried both making it a player, a set (which it normally is i think) and an entity and it still doesn't work
this is what i have for the glow effect
glow.addHolders((Entity) sender);
glow.hideFrom(UUID.fromString(BluePlayers));
glow.display(UUID.fromString(RedPlayers));
Hi, I'm having a reflection issue using XGlow on a Purpur 1.17.1 Server. Any Ideas?
No field with type net.minecraft.EnumChatFormat exists in class PacketPlayOutScoreboardTeam.
Seems to suggest that the packet has been re-worked recently?
[23:55:09 WARN]: java.lang.reflect.InvocationTargetException
[23:55:09 WARN]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[23:55:09 WARN]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[23:55:09 WARN]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[23:55:09 WARN]: at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[23:55:09 WARN]: at McKingsCore-0.1.jar//me.fredthedoggy.mckingscore.mf.base.CommandHandler.executeCommand(CommandHandler.java:288)
[23:55:09 WARN]: at McKingsCore-0.1.jar//me.fredthedoggy.mckingscore.mf.base.CommandHandler.execute(CommandHandler.java:203)
[23:55:09 WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:172)
[23:55:09 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869)
[23:55:09 WARN]: at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:2344)
[23:55:09 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2155)
[23:55:09 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2136)
[23:55:09 WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46)
[23:55:09 WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:6)
[23:55:09 WARN]: at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$ensureRunningOnSameThread$1(PlayerConnectionUtils.java:56)
[23:55:09 WARN]: at net.minecraft.server.TickTask.run(TickTask.java:18)
[23:55:09 WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:149)
[23:55:09 WARN]: at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(IAsyncTaskHandlerReentrant.java:23)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:1448)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192)
[23:55:09 WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:122)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1426)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1419)
[23:55:09 WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:132)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1397)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1308)
[23:55:09 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322)
[23:55:09 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[23:55:09 WARN]: Caused by: FieldAccessException: No field with type net.minecraft.EnumChatFormat exists in class PacketPlayOutScoreboardTeam.
[23:55:09 WARN]: at ProtocolLib.jar//com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:365)
[23:55:09 WARN]: at ProtocolLib.jar//com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:345)
[23:55:09 WARN]: at XGlow-1.0.5.jar//ru.xezard.glow.packets.WrapperPlayServerScoreboardTeam.setColor(WrapperPlayServerScoreboardTeam.java:118)
[23:55:09 WARN]: at XGlow-1.0.5.jar//ru.xezard.glow.data.glow.Glow.createTeamPacket(Glow.java:99)
[23:55:09 WARN]: at XGlow-1.0.5.jar//ru.xezard.glow.data.glow.Glow.processHolder(Glow.java:149)
[23:55:09 WARN]: at XGlow-1.0.5.jar//ru.xezard.glow.data.glow.Glow.addHolders(Glow.java:121)
[23:55:09 WARN]: at McKingsCore-0.1.jar//me.fredthedoggy.mckingscore.team.Team.addPlayer(Team.java:40)
[23:55:09 WARN]: at McKingsCore-0.1.jar//me.fredthedoggy.mckingscore.team.TeamCommand.getTeam(TeamCommand.java:72)
[23:55:09 WARN]: ... 27 more
The Installation page on the wiki says that to include the API as a dependency, you must add implementation 'ru.xezard:XGlowAPI:{latest_version}'
to your build.gradle
. However, the actual dependency string should be implementation 'com.github.Xezard.XGlow:XGlowAPI:{latest_version}'
, according to jitpack
.
After using "/glow enable" and "/glow disable" i've got the same messages:
The test entity is now glowing for all viewers of the glow object.
Server startup warning: Legacy plugin XGlow v1.0.7 does not specify an api-version.
I suggest specifying api-version: 1.13
to hide this
The error I get: https://pastebin.com/BWF8pNxp
build.gradle file: https://pastebin.com/ce9MJhCp
adding entity id in glow holders
Currently api not thread-safe.
Hello. I'm looking for a Glow API that works with version 1.12.2 as well. I found and used the XGlow, but I get the following error:
com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.server.v1_12_R1.EnumChatFormat exists in class PacketPlayOutScoreboardTeam. at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:365) ~[?:?] at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:345) ~[?:?] at ru.xezard.glow.packets.WrapperPlayServerScoreboardTeam.setColor(WrapperPlayServerScoreboardTeam.java:118) ~[?:?] at ru.xezard.glow.data.glow.Glow.createTeamPacket(Glow.java:99) ~[?:?] at ru.xezard.glow.data.glow.Glow.processHolder(Glow.java:149) ~[?:?] at ru.xezard.glow.data.glow.Glow.removeHolders(Glow.java:127) ~[?:?] at ru.xezard.glow.data.glow.manager.GlowsManager.lambda$removeGlowFrom$1(GlowsManager.java:77) ~[?:?] at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] at ru.xezard.glow.data.glow.manager.GlowsManager.removeGlowFrom(GlowsManager.java:77) ~[?:?] at kr.jeong3954.gzone.Main.lambda$onEnable$0(Main.java:47) ~[?:?] at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:64) ~[patched_1.12.2.jar:git-Paper-1618] at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:423) ~[patched_1.12.2.jar:git-Paper-1618] at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:840) ~[patched_1.12.2.jar:git-Paper-1618] at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[patched_1.12.2.jar:git-Paper-1618] at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774) ~[patched_1.12.2.jar:git-Paper-1618] at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666) ~[patched_1.12.2.jar:git-Paper-1618] at java.lang.Thread.run(Thread.java:831) [?:?]
Can you support 1.12.2 as well?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.