File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -59,17 +59,25 @@ public boolean hasPermission(String permission) {
5959 public Optional <Vector3d > getPosition () {
6060 if (delegate .getSender () instanceof ConsoleCommandSender ) return Optional .empty ();
6161
62- Location location = delegate .getLocation ();
63- return Optional .of (new Vector3d (location .getX (), location .getY (), location .getZ ()));
62+ try {
63+ Location location = delegate .getLocation ();
64+ return Optional .of (new Vector3d (location .getX (), location .getY (), location .getZ ()));
65+ } catch (NullPointerException ex ) { // workaround for a paper-bug: https://github.com/PaperMC/Paper/issues/13387
66+ return Optional .empty ();
67+ }
6468 }
6569
6670 @ Override
6771 public Optional <ServerWorld > getWorld () {
6872 if (delegate .getSender () instanceof ConsoleCommandSender ) return Optional .empty ();
6973
70- World world = delegate .getLocation ().getWorld ();
71- if (world == null ) return Optional .empty ();
72- return Optional .of (BukkitPlugin .getInstance ().getServerWorld (world ));
74+ try {
75+ World world = delegate .getLocation ().getWorld ();
76+ if (world == null ) return Optional .empty ();
77+ return Optional .of (BukkitPlugin .getInstance ().getServerWorld (world ));
78+ } catch (NullPointerException ex ) { // workaround for a paper-bug: https://github.com/PaperMC/Paper/issues/13387
79+ return Optional .empty ();
80+ }
7381 }
7482
7583}
You can’t perform that action at this time.
0 commit comments