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

[API] GroupPlayerJoinEvent#getPlayer only returns a player when a new group is created #901

Closed
Malfrador opened this issue Oct 15, 2020 · 1 comment
Labels

Comments

@Malfrador
Copy link
Member

Malfrador commented Oct 15, 2020

Description

Its not possible to get players who join the group via the GroupJoinEvent. Only the first player (the one that creates the group) works, getPlayer for all other players returns null.

  • DXL 0.18-1020 (from the build server, not spigot)

Reproduce

  1. Create a new dungeon with /dxl create
  2. Place a Group sign for the dungeon
  3. Create a simple test plugin that uses the DXL-API, for example with the code below.
  4. Use the sign. First player works just fine and both messages are displayed.
  5. Use the sign again with another account. Event is triggered, but there is no player and the second message produces an NPE.

Test code

public void joinEvent(GroupPlayerJoinEvent event) {
        Bukkit.broadcastMessage("Join event");
        Bukkit.broadcastMessage(event.getPlayer().toString());
    }

Log output

[01:43:43 INFO]: Join event //first player uses the sign and creates the group
[01:43:43 INFO]: DGlobalPlayer{player=CraftPlayer{name=Malfrador}} // Works fine
[01:43:46 INFO]: Join event // other player uses the sign, error
[01:43:46 ERROR]: Could not pass event GroupPlayerJoinEvent to DRE-DXL v1.0-SNAPSHOT // Error
java.lang.NullPointerException: null
        at de.erethon.dredxl.DreDxl.joinEvent(DreDxl.java:25) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor151.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.3.jar:git-Paper-211]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.3.jar:git-Paper-211]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.3.jar:git-Paper-211]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.3.jar:git-Paper-211]
        at de.erethon.dungeonsxl.player.DGroup.addMember(DGroup.java:220) ~[?:?]
        at de.erethon.dungeonsxl.api.player.PlayerGroup.addMember(PlayerGroup.java:227) ~[?:?]
        at de.erethon.dungeonsxl.global.GroupSign.onPlayerInteract(GroupSign.java:162) ~[?:?]
        at de.erethon.dungeonsxl.global.GlobalProtectionListener.onInteract(GlobalProtectionListener.java:242) ~[?:?]
@Malfrador Malfrador changed the title [API] GroupPlayerJoinEvent#getPlayer always returns null [API] GroupPlayerJoinEvent#getPlayer always returns null for players that are not creating a group Oct 15, 2020
@Malfrador Malfrador changed the title [API] GroupPlayerJoinEvent#getPlayer always returns null for players that are not creating a group [API] GroupPlayerJoinEvent#getPlayer only returns a player when a new group is created Oct 15, 2020
@Sataniel98 Sataniel98 added the BUG label Oct 16, 2020
@Sataniel98
Copy link
Member

Ich glaube, der Commit hat den falschen Issue geschlossen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants