Remove the API component - closes #51

This commit is contained in:
Focusvity
2022-08-02 22:08:52 +10:00
parent f806470fd5
commit d6b44863aa
63 changed files with 191 additions and 492 deletions

View File

@ -155,7 +155,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!perms.permission().isEmpty() && !plugin.getPermissionHandler().hasPermission(player, perms.permission()))
if (!perms.permission().isEmpty() && !player.hasPermission(perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
@ -191,7 +191,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!perms.permission().isEmpty() && !plugin.getPermissionHandler().hasPermission(Bukkit.getOfflinePlayer(plexPlayer.getName()), perms.permission()))
if (!perms.permission().isEmpty() && !plugin.getPermissions().playerHas(null, Bukkit.getPlayer(plexPlayer.getName()), perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
@ -206,7 +206,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
try
{
Component component = this.execute(sender, isConsole(sender) ? null : (Player) sender, args);
Component component = this.execute(sender, isConsole(sender) ? null : (Player)sender, args);
if (component != null)
{
send(sender, component);
@ -292,7 +292,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
if (!isConsole(sender))
{
return checkRank((Player) sender, rank, permission);
return checkRank((Player)sender, rank, permission);
}
if (!sender.getName().equalsIgnoreCase("console"))
{
@ -310,7 +310,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!perms.permission().isEmpty() && !plugin.getPermissionHandler().hasPermission(Bukkit.getOfflinePlayer(plexPlayer.getName()), perms.permission()))
if (!perms.permission().isEmpty() && !plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getName()), perms.permission()))
{
throw new CommandFailException(PlexUtils.messageString("noPermissionNode", permission));
}
@ -348,7 +348,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!perms.permission().isEmpty() && !plugin.getPermissionHandler().hasPermission(player, permission))
if (!perms.permission().isEmpty() && !player.hasPermission(perms.permission()))
{
throw new CommandFailException(PlexUtils.messageString("noPermissionNode", permission));
}
@ -369,7 +369,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
return !perms.permission().isEmpty() && plugin.getPermissionHandler().hasPermission(player, permission);
return !perms.permission().isEmpty() && player.hasPermission(permission);
}
return false;
}
@ -387,7 +387,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
if (!isConsole(sender))
{
return checkTab((Player) sender, rank, permission);
return checkTab((Player)sender, rank, permission);
}
return true;
}
@ -410,7 +410,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
return !perms.permission().isEmpty() && plugin.getPermissionHandler().hasPermission(player, permission);
return !perms.permission().isEmpty() && player.hasPermission(permission);
}
return true;
}

View File

@ -1,9 +1,6 @@
package dev.plex.command.impl;
import com.google.common.collect.ImmutableList;
import dev.plex.api.event.AdminAddEvent;
import dev.plex.api.event.AdminRemoveEvent;
import dev.plex.api.event.AdminSetRankEvent;
import dev.plex.cache.DataUtils;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
@ -12,6 +9,9 @@ import dev.plex.command.annotation.System;
import dev.plex.command.exception.ConsoleOnlyException;
import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.event.AdminAddEvent;
import dev.plex.event.AdminRemoveEvent;
import dev.plex.event.AdminSetRankEvent;
import dev.plex.player.PlexPlayer;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;

View File

@ -45,7 +45,7 @@ public class AdminChatCMD extends PlexCommand
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (plugin.getPermissionHandler().hasPermission(player, "plex.adminchat"))
if (player.hasPermission("plex.adminchat"))
{
player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message));
}

View File

@ -1,12 +1,12 @@
package dev.plex.command.impl;
import com.google.common.collect.ImmutableList;
import dev.plex.api.event.GameModeUpdateEvent;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.event.GameModeUpdateEvent;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import java.util.List;

View File

@ -1,12 +1,12 @@
package dev.plex.command.impl;
import com.google.common.collect.ImmutableList;
import dev.plex.api.event.GameModeUpdateEvent;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.event.GameModeUpdateEvent;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import java.util.List;

View File

@ -1,11 +1,11 @@
package dev.plex.command.impl;
import dev.plex.api.event.GameModeUpdateEvent;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.event.GameModeUpdateEvent;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import java.util.Arrays;

View File

@ -17,8 +17,8 @@ import java.util.List;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.title.Title;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;

View File

@ -1,12 +1,12 @@
package dev.plex.command.impl;
import com.google.common.collect.ImmutableList;
import dev.plex.api.event.GameModeUpdateEvent;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.event.GameModeUpdateEvent;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import java.util.List;

View File

@ -1,12 +1,12 @@
package dev.plex.command.impl;
import com.google.common.collect.ImmutableList;
import dev.plex.api.event.GameModeUpdateEvent;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.event.GameModeUpdateEvent;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import java.util.List;