mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-21 04:49:51 +08:00
Bug fixes
This commit is contained in:
parent
6b3f19f857
commit
c38a6b0677
@ -53,7 +53,7 @@ public String[] getGroups(String name) {
|
|||||||
List<String> groupNames = new ArrayList<String>();
|
List<String> groupNames = new ArrayList<String>();
|
||||||
for (PermissionAttachmentInfo permAttach : player.getEffectivePermissions()) {
|
for (PermissionAttachmentInfo permAttach : player.getEffectivePermissions()) {
|
||||||
String perm = permAttach.getPermission();
|
String perm = permAttach.getPermission();
|
||||||
if (!(perm.startsWith(GROUP_PREFIX) || permAttach.getValue()))
|
if (!(perm.startsWith(GROUP_PREFIX) && permAttach.getValue()))
|
||||||
continue;
|
continue;
|
||||||
groupNames.add(perm.substring(GROUP_PREFIX.length(), perm.length()));
|
groupNames.add(perm.substring(GROUP_PREFIX.length(), perm.length()));
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
|
|
||||||
private Server server;
|
private Server server;
|
||||||
private PermissionsResolver perms;
|
private PermissionsResolver perms;
|
||||||
|
private PermissionsResolverServerListener listener;
|
||||||
private Configuration permsConfig;
|
private Configuration permsConfig;
|
||||||
private String name;
|
private String name;
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
@ -72,7 +73,7 @@ public PermissionsResolverManager(Plugin plugin, String name, Logger logger) {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
new PermissionsResolverServerListener(this, plugin);
|
new PermissionsResolverServerListener(this, plugin);
|
||||||
loadConfig(new File("wepif.yml")); // TODO: config migration, maybe
|
loadConfig(new File("wepif.yml"));
|
||||||
findResolver();
|
findResolver();
|
||||||
}
|
}
|
||||||
public void findResolver() {
|
public void findResolver() {
|
||||||
@ -205,6 +206,14 @@ private boolean loadConfig(File file) {
|
|||||||
}
|
}
|
||||||
return isUpdated;
|
return isUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean hasServerListener() {
|
||||||
|
return listener != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setServerListener(PermissionsResolverServerListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
public static class MissingPluginException extends Exception {
|
public static class MissingPluginException extends Exception {
|
||||||
private static final long serialVersionUID = 7044832912491608706L;
|
private static final long serialVersionUID = 7044832912491608706L;
|
||||||
|
@ -36,7 +36,9 @@ public PermissionsResolverServerListener(PermissionsResolverManager manager) {
|
|||||||
|
|
||||||
public PermissionsResolverServerListener(PermissionsResolverManager manager, Plugin plugin) {
|
public PermissionsResolverServerListener(PermissionsResolverManager manager, Plugin plugin) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
register(plugin);
|
if (!manager.hasServerListener()) {
|
||||||
|
register(plugin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,5 +84,6 @@ public void register(Plugin plugin) {
|
|||||||
this, Priority.Normal, plugin);
|
this, Priority.Normal, plugin);
|
||||||
plugin.getServer().getPluginManager().registerEvent(Event.Type.PLUGIN_DISABLE,
|
plugin.getServer().getPluginManager().registerEvent(Event.Type.PLUGIN_DISABLE,
|
||||||
this, Priority.Normal, plugin);
|
this, Priority.Normal, plugin);
|
||||||
|
manager.setServerListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,9 +135,6 @@ protected void loadConfiguration() {
|
|||||||
protected void registerEvents() {
|
protected void registerEvents() {
|
||||||
new WorldEditPlayerListener(this);
|
new WorldEditPlayerListener(this);
|
||||||
new WorldEditCriticalPlayerListener(this);
|
new WorldEditCriticalPlayerListener(this);
|
||||||
|
|
||||||
// The permissions resolver has some hooks of its own
|
|
||||||
new PermissionsResolverServerListener(perms, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user