Fix exception on required permission

This commit is contained in:
filoghost 2020-08-16 14:58:23 +02:00
parent 33bf169adf
commit 10f62a1cfb
2 changed files with 16 additions and 7 deletions

View File

@ -52,15 +52,24 @@ public class InternalConfigurableIcon extends BaseConfigurableIcon implements Re
}
public void setClickPermission(String permission) {
this.clickPermission = new RequiredPermission(permission);
if (this.clickPermission == null) {
this.clickPermission = new RequiredPermission();
}
this.clickPermission.setPermission(permission);
}
public void setNoClickPermissionMessage(String clickNoPermissionMessage) {
clickPermission.setNoPermissionMessage(clickNoPermissionMessage);
if (this.clickPermission == null) {
this.clickPermission = new RequiredPermission();
}
this.clickPermission.setNoPermissionMessage(clickNoPermissionMessage);
}
public void setViewPermission(String viewPermission) {
this.viewPermission = new RequiredPermission(viewPermission);
if (this.viewPermission == null) {
this.viewPermission = new RequiredPermission();
}
this.viewPermission.setPermission(viewPermission);
}
public void setRequiredMoney(double requiredMoney) {

View File

@ -11,11 +11,11 @@ import org.bukkit.entity.Player;
public class RequiredPermission implements Requirement {
private final String permission;
private final boolean negated;
private String permission;
private boolean negated;
private String noPermissionMessage;
public RequiredPermission(String permission) {
public void setPermission(String permission) {
if (permission != null) {
permission = permission.trim();
}