mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 12:33:03 +00:00
Config file permissions cleanup
Removed deprecated 'restricted-commands' section. Deprecated 'superperms' toggle. Remove op override on essentials permissions. Give op's all permissions by default via superperms.
This commit is contained in:
parent
b9195a561f
commit
f701090c89
7 changed files with 21 additions and 71 deletions
|
@ -92,10 +92,6 @@ public interface ISettings extends IConf
|
||||||
|
|
||||||
boolean isCommandOverridden(String name);
|
boolean isCommandOverridden(String name);
|
||||||
|
|
||||||
boolean isCommandRestricted(IEssentialsCommand cmd);
|
|
||||||
|
|
||||||
boolean isCommandRestricted(String label);
|
|
||||||
|
|
||||||
boolean isDebug();
|
boolean isDebug();
|
||||||
|
|
||||||
boolean isEcoDisabled();
|
boolean isEcoDisabled();
|
||||||
|
|
|
@ -146,26 +146,6 @@ public class Settings implements ISettings
|
||||||
return disCommands;
|
return disCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCommandRestricted(IEssentialsCommand cmd)
|
|
||||||
{
|
|
||||||
return isCommandRestricted(cmd.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCommandRestricted(String label)
|
|
||||||
{
|
|
||||||
for (String c : config.getStringList("restricted-commands"))
|
|
||||||
{
|
|
||||||
if (!c.equalsIgnoreCase(label))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPlayerCommand(String label)
|
public boolean isPlayerCommand(String label)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,20 +63,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
@Override
|
@Override
|
||||||
public boolean isAuthorized(final String node)
|
public boolean isAuthorized(final String node)
|
||||||
{
|
{
|
||||||
|
final boolean result = isAuthorizedCheck(node);
|
||||||
if (ess.getSettings().isDebug())
|
if (ess.getSettings().isDebug())
|
||||||
{
|
{
|
||||||
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node);
|
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node + " - " + result);
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAuthorizedCheck(final String node)
|
||||||
|
{
|
||||||
|
|
||||||
if (base instanceof OfflinePlayer)
|
if (base instanceof OfflinePlayer)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOp())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isJailed())
|
if (isJailed())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class ConfigPermissionsHandler implements IPermissionsHandler
|
public class ConfigPermissionsHandler extends SuperpermsHandler
|
||||||
{
|
{
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
|
@ -15,47 +15,17 @@ public class ConfigPermissionsHandler implements IPermissionsHandler
|
||||||
this.ess = (IEssentials)ess;
|
this.ess = (IEssentials)ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getGroup(final Player base)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getGroups(final Player base)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBuild(final Player base, final String group)
|
public boolean canBuild(final Player base, final String group)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inGroup(final Player base, final String group)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(final Player base, final String node)
|
public boolean hasPermission(final Player base, final String node)
|
||||||
{
|
{
|
||||||
final String[] cmds = node.split("\\.", 2);
|
final String[] cmds = node.split("\\.", 2);
|
||||||
return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1])
|
return ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]) || super.hasPermission(base, node);
|
||||||
&& ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPrefix(final Player base)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSuffix(final Player base)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,8 @@ public class PermissionsHandler implements IPermissionsHandler
|
||||||
{
|
{
|
||||||
if (!(handler instanceof ConfigPermissionsHandler))
|
if (!(handler instanceof ConfigPermissionsHandler))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.INFO, "Essentials: Using config based permissions. Enable superperms in config.");
|
LOGGER.log(Level.INFO, "Essentials: Using config file enhanced permissions.");
|
||||||
|
LOGGER.log(Level.INFO, "Permissions listed in as player-commands will be given to all users.");
|
||||||
handler = new ConfigPermissionsHandler(plugin);
|
handler = new ConfigPermissionsHandler(plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,10 +96,10 @@ overridden-commands:
|
||||||
disabled-commands:
|
disabled-commands:
|
||||||
# - nick
|
# - nick
|
||||||
|
|
||||||
# Restricted commands have been removed.
|
# If you do not wish to use a permission system, you can define a list of 'player perms' below.
|
||||||
# Now we have a whitelist, all commands not on this list are only available to ops.
|
# This list has no effect if your using a supported permissions system.
|
||||||
# These will have NO EFFECT if you have Permissions installed!
|
# If your using an unsupported permissions system simply delete this section.
|
||||||
# They are here only if you want something simpler than Permissions.
|
# Whitelist the commands and permissions you wish to give players by default (everything else is op only).
|
||||||
# These are the permissions without the "essentials." part.
|
# These are the permissions without the "essentials." part.
|
||||||
player-commands:
|
player-commands:
|
||||||
- afk
|
- afk
|
||||||
|
@ -260,10 +260,6 @@ debug: false
|
||||||
# Turn off god mode when people exit
|
# Turn off god mode when people exit
|
||||||
remove-god-on-disconnect: false
|
remove-god-on-disconnect: false
|
||||||
|
|
||||||
# Use the permission system of bukkit
|
|
||||||
# This only works if no other permission plugins are installed
|
|
||||||
use-bukkit-permissions: false
|
|
||||||
|
|
||||||
# Auto-AFK
|
# Auto-AFK
|
||||||
# After this timeout in seconds, the user will be set as afk.
|
# After this timeout in seconds, the user will be set as afk.
|
||||||
# Set to -1 for no timeout.
|
# Set to -1 for no timeout.
|
||||||
|
|
|
@ -450,3 +450,8 @@ commands:
|
||||||
description: Calculates the worth of items in hand or as specified.
|
description: Calculates the worth of items in hand or as specified.
|
||||||
usage: /<command> [item] [amount]
|
usage: /<command> [item] [amount]
|
||||||
aliases: [eworth,price,eprice]
|
aliases: [eworth,price,eprice]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
essentials.*:
|
||||||
|
default: op
|
||||||
|
description: Give op's everything by default
|
Loading…
Add table
Add a link
Reference in a new issue