Allow not setting permissions

This commit is contained in:
Telesphoreo 2022-05-06 16:58:56 -05:00
parent 74faaf2d74
commit fd50589331
3 changed files with 9 additions and 10 deletions

View File

@ -151,7 +151,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission(perms.permission()))
if (!perms.permission().isEmpty() && !player.hasPermission(perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
@ -187,7 +187,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), perms.permission()))
if (!perms.permission().isEmpty() && !plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
@ -306,7 +306,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), permission))
if (!perms.permission().isEmpty() && !plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), permission))
{
throw new CommandFailException(PlexUtils.messageString("noPermissionNode", permission));
}
@ -344,7 +344,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission(permission))
if (!perms.permission().isEmpty() && !player.hasPermission(permission))
{
throw new CommandFailException(PlexUtils.messageString("noPermissionNode", permission));
}
@ -365,7 +365,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
return player.hasPermission(permission);
return !perms.permission().isEmpty() && player.hasPermission(permission);
}
return false;
}
@ -406,7 +406,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
return player.hasPermission(permission);
return !perms.permission().isEmpty() && player.hasPermission(permission);
}
return true;
}

View File

@ -22,7 +22,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@CommandPermissions(level = Rank.OP, permission = "plex.plex", source = RequiredCommandSource.ANY)
@CommandPermissions(level = Rank.IMPOSTOR, source = RequiredCommandSource.ANY)
@CommandParameters(name = "plex", usage = "/<command> [reload | redis | modules [reload]]", description = "Show information about Plex or reload it")
public class PlexCMD extends PlexCommand
{

View File

@ -16,8 +16,8 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "totalfreedommod", usage = "/<command>", description = "You can't simpy do that.", aliases = "tfm")
@CommandPermissions(level = Rank.OP, permission = "plex.tfm", source = RequiredCommandSource.ANY)
@CommandParameters(name = "totalfreedommod", description = "You can't simpy do that.", aliases = "tfm")
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
public class TFMCMD extends PlexCommand
{
@ -35,7 +35,6 @@ public class TFMCMD extends PlexCommand
pageComponents.add(PlexUtils.mmDeserialize("<rainbow>" + page + "</rainbow>"));
}
playerSender.openBook(Book.builder()
.title(Component.text("TFM License"))
.author(Component.text("Prozza"))