slipcor / pvparena_modules

2 stars 7 forks source link

Module - Temp Perms: NPE with the infect goal. #19

Open TerraPrimal opened 7 years ago

TerraPrimal commented 7 years ago

As requested by the almighty slipcor, I hereby present this ticket with an NPE. https://pastebin.com/8jNfWq59

Basically, the NPE is thrown when a player goes from the free team in the lounge to the infected team when the game starts. The player is still in the middle of the team transition when their team is trying to be checked. I solved this my end by wrapping line 157 in a null check for Team and Class as well as a 1 tick delay. I am sure there is a more elegant solution.

BukkitRunnable r = new BukkitRunnable() { @Override public void run() {
if (aPlayer.getArenaTeam() != null && aPlayer.getArenaClass() != null) { setPermissions(arena, aPlayer, getTempPerms(arena, "default"), getTempPerms(arena, aPlayer.getArenaTeam().getName())); } } }; r.runTaskLater(PVPArena.instance, 1);