Add NPE protection

This commit is contained in:
tastybento 2024-09-19 21:54:05 -07:00
parent 6b9262efc7
commit f08c45822d

View File

@ -210,13 +210,13 @@ public class Limits extends Addon {
if (is == null) { if (is == null) {
return LIMIT_NOT_SET; return LIMIT_NOT_SET;
} }
// Check the permissions of the user and update if (user != null) {
this.getJoinListener().checkPerms(user.getPlayer(), gm.getPermissionPrefix() + "island.limit.", // Check the permissions of the user and update
is.getUniqueId(), gm.getDescription().getName()); this.getJoinListener().checkPerms(user.getPlayer(), gm.getPermissionPrefix() + "island.limit.",
is.getUniqueId(), gm.getDescription().getName());
}
int limit = this.getBlockLimitListener(). int limit = this.getBlockLimitListener().
getMaterialLimits(is.getWorld(), is.getUniqueId()). getMaterialLimits(is.getWorld(), is.getUniqueId()).getOrDefault(m, -1);
getOrDefault(m, -1);
return limit == -1 ? LIMIT_NOT_SET : String.valueOf(limit); return limit == -1 ? LIMIT_NOT_SET : String.valueOf(limit);
} }