Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix illegal argument for team display name #1320

Merged
merged 1 commit into from
May 26, 2024
Merged

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented May 17, 2024

Currently the internal display name of scoreboard teams, for tributes (ffa), is set to the players' verbose name, so name + nick, which can lead to it overflowing the 32 char limit causing exceptions that break team switching an other parts of PGM.

[18:28:27] [Server thread/ERROR]: Could not pass event CompetitorAddEvent to PGM v0.16-SNAPSHOT (git-8de00f9)
org.bukkit.event.EventException: null
	[...]
	at tc.oc.pgm.match.MatchImpl.callEvent(MatchImpl.java:248) ~[?:?]
	at tc.oc.pgm.match.MatchImpl.addParty(MatchImpl.java:687) ~[?:?]
	at tc.oc.pgm.match.MatchImpl.setOrClearPlayerParty(MatchImpl.java:549) ~[?:?]
	at tc.oc.pgm.match.MatchImpl.setParty(MatchImpl.java:472) ~[?:?]
	at tc.oc.pgm.ffa.FreeForAllMatchModule.join(FreeForAllMatchModule.java:256) ~[?:?]
	at tc.oc.pgm.join.JoinMatchModule.join(JoinMatchModule.java:155) ~[?:?]
	at tc.oc.pgm.join.JoinHandler.join(JoinHandler.java:18) ~[?:?]
	at tc.oc.pgm.picker.PickerMatchModule.rightClickIcon(PickerMatchModule.java:375) ~[?:?]
	[...]
	at tc.oc.pgm.match.MatchImpl.callEvent(MatchImpl.java:248) ~[?:?]
	at tc.oc.pgm.modules.EventFilterMatchModule.callObserverInteractEvent(EventFilterMatchModule.java:210) ~[?:?]
	at tc.oc.pgm.modules.EventFilterMatchModule.onEntityInteract(EventFilterMatchModule.java:222) ~[?:?]
	[...]
	at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1496) ~[server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.a(PacketPlayInUseEntity.java:34) ~[server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at net.minecraft.server.v1_8_R3.PlayerConnection.lambda$a$0(PlayerConnection.java:1456) ~[server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at net.minecraft.server.v1_8_R3.MinecraftServer.processQueue(MinecraftServer.java:1760) [server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at net.minecraft.server.v1_8_R3.MinecraftServer.processAsapTasks(MinecraftServer.java:1754) [server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:697) [server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.IllegalArgumentException: Display name '§c❖§e§m<name removed>§r§e§o <nick removed>' is longer than the limit of 32 characters
	at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam.setDisplayName(CraftTeam.java:38) ~[server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	at tc.oc.pgm.scoreboard.ScoreboardMatchModule.updatePartyScoreboardTeam(ScoreboardMatchModule.java:77) ~[?:?]
	at tc.oc.pgm.scoreboard.ScoreboardMatchModule.createPartyScoreboardTeam(ScoreboardMatchModule.java:100) ~[?:?]
	at tc.oc.pgm.scoreboard.ScoreboardMatchModule.addPartyScoreboard(ScoreboardMatchModule.java:117) ~[?:?]
	at tc.oc.pgm.scoreboard.ScoreboardMatchModule.onPartyAdd(ScoreboardMatchModule.java:235) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor936.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[server.jar:git-SportPaper-c03663e-P.2081566-SP.aff24bb-CB.e1ebe52]
	... 101 more
``

@Pablete1234 Pablete1234 added bug Something isn't working urgent Breaks the plugin ready PR is ready to merge labels May 17, 2024
@Pablete1234 Pablete1234 requested a review from Electroid as a code owner May 17, 2024 19:06
@Electroid Electroid merged commit a9fc767 into dev May 26, 2024
2 checks passed
@Electroid Electroid deleted the fix-illegal-name-length branch May 26, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PR is ready to merge urgent Breaks the plugin
Development

Successfully merging this pull request may close these issues.

3 participants