Fixed CompositeCommand not handling correctly null permission prefixes

Added nullability annotations
This commit is contained in:
Florian CUNY 2019-06-12 13:25:10 +02:00
parent e7f90bbd21
commit 3e6fe52f95

View File

@ -86,6 +86,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/** /**
* The prefix to be used in this command * The prefix to be used in this command
*/ */
@Nullable
private String permissionPrefix; private String permissionPrefix;
/** /**
@ -540,7 +541,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
*/ */
@Override @Override
public void setPermission(String permission) { public void setPermission(String permission) {
this.permission = permissionPrefix + permission; this.permission = ((permissionPrefix != null && !permissionPrefix.isEmpty()) ? permissionPrefix : "") + permission;
} }
/** /**
@ -634,6 +635,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* If the permission prefix has been set, will return the prefix plus a trailing dot. * If the permission prefix has been set, will return the prefix plus a trailing dot.
* @return the permissionPrefix * @return the permissionPrefix
*/ */
@Nullable
public String getPermissionPrefix() { public String getPermissionPrefix() {
return permissionPrefix; return permissionPrefix;
} }