forked from Upstream/CommandPanels
Fix for null players inside hasperm. Returns false on null.
This commit is contained in:
parent
deab494c45
commit
6551246c7a
@ -12,6 +12,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
public class HasSections {
|
||||
CommandPanels plugin;
|
||||
@ -119,7 +120,11 @@ public class HasSections {
|
||||
//the current has section with all the functions implemented inside it
|
||||
if(setName.startsWith("has")) {
|
||||
if(value.endsWith(" HASPERM")) {
|
||||
return Bukkit.getPlayer(value.substring(0, value.length()-8)).hasPermission(compare) == outputValue;
|
||||
String playername = value.substring(0, value.length()-8);
|
||||
Player player = Bukkit.getPlayerExact(playername);
|
||||
if(player != null){
|
||||
return player.hasPermission(compare) == outputValue;
|
||||
}
|
||||
}else if(value.endsWith(" ISGREATER")) {
|
||||
return (new BigDecimal(compare).compareTo(new BigDecimal(value.substring(0, value.length()-10).replace(",",""))) <= 0 == outputValue);
|
||||
}else{
|
||||
|
Loading…
Reference in New Issue
Block a user