andrei1058 / sidebarlib Goto Github PK
View Code? Open in Web Editor NEWA minecraft packet-based sidebar library.
License: GNU Lesser General Public License v3.0
A minecraft packet-based sidebar library.
License: GNU Lesser General Public License v3.0
Can you add support for version 1.20.2? Some code has changed
Group players on the same team if wanted. Will give a ordered tab on games like bedwars
Because of this placeholders in title are not being parsed and replaced.
When you join a server with a scoreboard the papi placeholders take a second to load in and will first show the full string.
The placeholder shown in the video is %vault_eco_balance_formatted% but it will happen with any placeholder.
Text in front stops the placeholders from loading completly.
After going into an arena and leaving again it does work:
Bedwars version: 23.2.2-BETA3 (up untill commit 52f4e63ed196cac0b940b6f9cd4c4d81466ffe27 )
Server version 1.8.8
Some variables are not initialized throwing a NPE
[13:00:58 ERROR]: Could not pass event PlayerJoinEvent to BedWars1058 v23.10.1-SNAPSHOT
java.lang.NullPointerException: Cannot invoke "net.minecraft.network.chat.ChatComponentText.h()" because "this.displayNameComp" is null
at com.andrei1058.bedwars.libs.sidebar.v1_18_R2.SidebarImpl$NarniaSidebarObjective.refreshTitle(SidebarImpl.java:86) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.libs.sidebar.WrappedSidebar.<init>(WrappedSidebar.java:47) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.libs.sidebar.v1_18_R2.SidebarImpl.<init>(SidebarImpl.java:30) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.libs.sidebar.v1_18_R2.ProviderImpl.createSidebar(ProviderImpl.java:27) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.libs.sidebar.SidebarManager.createSidebar(SidebarManager.java:91) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.sidebar.BwSidebar.setContent(BwSidebar.java:93) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.sidebar.SidebarService.giveSidebar(SidebarService.java:222) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.andrei1058.bedwars.listeners.joinhandler.JoinListenerMultiArena.onJoin(JoinListenerMultiArena.java:91) ~[bedwars-plugin-23.10.1-SNAPSHOT.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor101.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-379]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:669) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.players.PlayerList.postChunkLoadJoin(PlayerList.java:363) ~[paper-1.18.2.jar:git-Paper-379]
at net.minecraft.server.players.PlayerList.lambda$placeNewPlayer$1(PlayerList.java:305) ~[paper-1.18.2.jar:git-Paper-379]
at net.minecraft.server.network.ServerGamePacketListenerImpl.tick(ServerGamePacketListenerImpl.java:305) ~[?:?]
at net.minecraft.network.Connection.tick(Connection.java:567) ~[?:?]
at net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:231) ~[?:?]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1623) ~[paper-1.18.2.jar:git-Paper-379]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:483) ~[paper-1.18.2.jar:git-Paper-379]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1456) ~[paper-1.18.2.jar:git-Paper-379]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1226) ~[paper-1.18.2.jar:git-Paper-379]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.18.2.jar:git-Paper-379]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Newly implemented placeholders in title causes a concurrent exception:
[12:47:23 WARN]: Exception in thread "Craft Scheduler Thread - 79"
[12:47:23 WARN]: org.apache.commons.lang.UnhandledException: Plugin BedWars1058 v23.10-SNAPSHOT generated an exception while executing task 17
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at org.github.paperspigot.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:23)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.util.ConcurrentModificationException
at java.base/java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:977)
at java.base/java.util.LinkedList$ListItr.next(LinkedList.java:899)
at com.andrei1058.bedwars.libs.sidebar.WrappedSidebar.applyLinePlaceholders(WrappedSidebar.java:135)
at com.andrei1058.bedwars.libs.sidebar.WrappedSidebar.parsePlaceholders(WrappedSidebar.java:162)
at com.andrei1058.bedwars.libs.sidebar.v1_8_R3.SidebarImpl$NarniaSidebarObjective.getDisplayName(SidebarImpl.java:82)
at net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardObjective.<init>(SourceFile:25)
at com.andrei1058.bedwars.libs.sidebar.v1_8_R3.SidebarImpl$NarniaSidebarObjective.sendUpdate(SidebarImpl.java:96)
at com.andrei1058.bedwars.libs.sidebar.WrappedSidebar.refreshTitle(WrappedSidebar.java:178)
at com.andrei1058.bedwars.sidebar.SidebarService.lambda$refreshTitles$0(SidebarService.java:165)
at java.base/java.util.HashMap.forEach(HashMap.java:1429)
at com.andrei1058.bedwars.sidebar.SidebarService.refreshTitles(SidebarService.java:165)
at com.andrei1058.bedwars.sidebar.thread.RefreshTitleTask.run(RefreshTitleTask.java:28)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 4 more
With MC 1.20.3 implementation we have added a experimental implementation of SidebarLine.
#getPrefix and #getSuffix can be improved since it is clonned code so make an util or smth with string limit in input and that should be it.
(may happen on 1.17 as well)
Hello, i noticed in our server there was alot of cpu-time going to sending scoreboard (in Bedwars1058) so which at time i thought it was normal.
I looked into the source and i saw that the plugin sends alot of unnessecary packets, i fixed it by checking prefix and suffix before and after setting content
which is already a huge improvement as for my case the only thing changing from packet to packet is Sidebar.suffix
and Sidebar.prefix
.
Although this change worked nicely for my case, It needs a look from you as developers that uses your library may implement their own ScoreLine
which will cause unexpected behavior if we are just checking for prefix and suffix.
My Patch:
public void refreshPlaceholders() {
for (ScoreLine str : this.lines) {
if (str.text.isHasPlaceholders()) {
// Some code here in parsing content
String oldSuffix = str.suffix;
String oldPrefix = str.prefix;
str.setContent(content);
// ignore Intellij Idea warning if present
if (!oldSuffix.equals(str.suffix) || !oldPrefix.equals(str.prefix)) {
str.sendUpdate();
}
}
}
}
This is old version of bw1058, But its equivilant to https://github.com/andrei1058/SiderbarLib/blob/6731c0aca53cf0390b14a08f9e55966bdf1faee1/sidebar-base/src/main/java/com/andrei1058/spigot/sidebar/WrappedSidebar.java#L138-L145
Use a new line '\n' to get multiple lines within the same header and footer.
To create FaNcY headers and footers
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.