mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-20 18:32:49 +00:00
GroupManager 1.1
Merge branch 'groupmanager' Conflicts: EssentialsGroupManager/src/plugin.yml EssentialsGroupManager/src/users.yml
This commit is contained in:
commit
1df79bc9f4
8
.classpath
Normal file
8
.classpath
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="lib" path="lib/bukkit-0.0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/Permissions3.jar"/>
|
||||||
|
</classpath>
|
17
.project
Normal file
17
.project
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Essentials</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
10
EssentialsGroupBridge/.classpath
Normal file
10
EssentialsGroupBridge/.classpath
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="lib" path="../lib/bukkit-0.0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="../lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/EssentialsGroupManager"/>
|
||||||
|
<classpathentry kind="lib" path="../lib/Permissions3.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
17
EssentialsGroupBridge/.project
Normal file
17
EssentialsGroupBridge/.project
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>EssentialsGroupBridge</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -4,6 +4,19 @@ annotation.processing.run.all.processors=true
|
||||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
application.title=EssentialsGroupBridge
|
application.title=EssentialsGroupBridge
|
||||||
application.vendor=gabrielcouto
|
application.vendor=gabrielcouto
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=true
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width=120
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap=none
|
||||||
build.classes.dir=${build.dir}/classes
|
build.classes.dir=${build.dir}/classes
|
||||||
build.classes.excludes=**/*.java,**/*.form
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
|
@ -26,16 +39,16 @@ dist.jar=${dist.dir}/EssentialsGroupBridge.jar
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
endorsed.classpath=
|
endorsed.classpath=
|
||||||
excludes=
|
excludes=
|
||||||
file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
|
file.reference.bukkit-0.0.1-SNAPSHOT.jar=../lib/bukkit-0.0.1-SNAPSHOT.jar
|
||||||
file.reference.Permissions.jar=..\\lib\\Permissions.jar
|
file.reference.Permissions3.jar=../lib/Permissions3.jar
|
||||||
includes=**
|
includes=**
|
||||||
jar.archive.disabled=${jnlp.enabled}
|
jar.archive.disabled=${jnlp.enabled}
|
||||||
jar.compress=true
|
jar.compress=true
|
||||||
jar.index=${jnlp.enabled}
|
jar.index=${jnlp.enabled}
|
||||||
javac.classpath=\
|
javac.classpath=\
|
||||||
${reference.EssentialsGroupManager.jar}:\
|
${reference.EssentialsGroupManager.jar}:\
|
||||||
${file.reference.craftbukkit-0.0.1-SNAPSHOT.jar}:\
|
${file.reference.Permissions3.jar}:\
|
||||||
${file.reference.Permissions.jar}
|
${file.reference.bukkit-0.0.1-SNAPSHOT.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,16 +1,11 @@
|
||||||
package com.nijikokun.bukkit.Permissions;
|
package com.nijikokun.bukkit.Permissions;
|
||||||
|
|
||||||
import com.nijiko.Misc;
|
|
||||||
import com.nijiko.configuration.DefaultConfiguration;
|
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.anjocaido.groupmanager.GroupManager;
|
//import org.anjocaido.groupmanager.GroupManager;
|
||||||
import org.anjocaido.groupmanager.permissions.NijikoPermissionsProxy;
|
import org.anjocaido.groupmanager.permissions.NijikoPermissionsProxy;
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.event.Event.Type;
|
import org.bukkit.event.Event.Type;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
import org.bukkit.event.server.ServerListener;
|
import org.bukkit.event.server.ServerListener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@ -19,110 +14,69 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class Permissions extends JavaPlugin {
|
public class Permissions extends JavaPlugin {
|
||||||
|
|
||||||
private class Listener extends PlayerListener {
|
|
||||||
|
|
||||||
private Permissions plugin;
|
|
||||||
|
|
||||||
public Listener(Permissions plugin) {
|
|
||||||
//compiled code
|
|
||||||
throw new RuntimeException("Compiled Code");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPlayerCommand(PlayerChatEvent event) {
|
|
||||||
//compiled code
|
|
||||||
throw new RuntimeException("Compiled Code");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static final Logger log = Logger.getLogger("Fake Permissions");
|
public static final Logger log = Logger.getLogger("Fake Permissions");
|
||||||
public static String name = "Permissions";
|
public static String name = "Permissions";
|
||||||
public static String codename = "Hacked Permissions by AnjoCaido";
|
public static String codename = "Hacked Permissions by AnjoCaido";
|
||||||
public static String version = "2.0";
|
public static String version = "2.0";
|
||||||
public static PermissionHandler Security = null;
|
public static PermissionHandler Security = null;
|
||||||
public static Misc Misc = new Misc();
|
|
||||||
public static Server Server;
|
|
||||||
private Listener Listener = null;
|
|
||||||
private DefaultConfiguration config = null;
|
|
||||||
private GroupManager groupManager;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
//compiled code
|
|
||||||
//throw new RuntimeException("Compiled Code");
|
|
||||||
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
|
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Server = this.getServer();
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
|
||||||
if (Security == null) {//make sure we have only one instance
|
if (Security == null) {
|
||||||
Security = new NijikoPermissionsProxy(null);
|
//make sure we have only one instance
|
||||||
}
|
Security = new NijikoPermissionsProxy(null);
|
||||||
|
}
|
||||||
Plugin p = (this.getServer() == null) ? null : this.getServer().getPluginManager().getPlugin("GroupManager");
|
|
||||||
if (p != null) {
|
|
||||||
if (p.isEnabled()) {
|
|
||||||
setGM(p);
|
|
||||||
} else {
|
|
||||||
if (this.getServer() != null) {
|
|
||||||
this.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, new ServerListener() {
|
|
||||||
|
|
||||||
@Override
|
Plugin p = (this.getServer() == null) ? null : this.getServer().getPluginManager().getPlugin("GroupManager");
|
||||||
public void onPluginEnable(PluginEnableEvent event)
|
if (p != null) {
|
||||||
{
|
if (p.isEnabled()) {
|
||||||
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
|
setGM(p);
|
||||||
Permissions.this.setGM(event.getPlugin());
|
} else {
|
||||||
}
|
if (this.getServer() != null) {
|
||||||
}
|
this.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, new ServerListener() {
|
||||||
|
|
||||||
}, Priority.Normal, this);
|
@Override
|
||||||
}
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
}
|
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
|
||||||
} else {
|
Permissions.this.setGM(event.getPlugin());
|
||||||
System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
|
}
|
||||||
this.getPluginLoader().disablePlugin(this);
|
}
|
||||||
}
|
}, Priority.Normal, this);
|
||||||
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
}
|
||||||
if (pdfFile != null)
|
}
|
||||||
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
} else {
|
||||||
|
System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
|
||||||
|
this.getPluginLoader().disablePlugin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pdfFile != null) {
|
||||||
|
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEvents() {
|
private void setGM(final Plugin p) {
|
||||||
//compiled code
|
//GroupManager groupManager = (GroupManager) p;
|
||||||
//throw new RuntimeException("Compiled Code");
|
((NijikoPermissionsProxy) Security).setGM(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGM(Plugin p) {
|
|
||||||
groupManager = (GroupManager)p;
|
|
||||||
((NijikoPermissionsProxy)Security).setGM(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PermissionHandler getHandler() {
|
public PermissionHandler getHandler() {
|
||||||
//compiled code
|
if (Security == null) {
|
||||||
//throw new RuntimeException("Compiled Code");
|
Security = new NijikoPermissionsProxy(null);
|
||||||
//System.out.println("Alguem chamou o handler");
|
}
|
||||||
if (Security == null)
|
|
||||||
{
|
|
||||||
Security = new NijikoPermissionsProxy(null);
|
|
||||||
}
|
|
||||||
//checkEnable();
|
|
||||||
return Security;
|
return Security;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupPermissions() {
|
public void setupPermissions() {
|
||||||
if (Security == null)
|
if (Security == null) {
|
||||||
{
|
Security = new NijikoPermissionsProxy(null);
|
||||||
Security = new NijikoPermissionsProxy(null);
|
|
||||||
}
|
|
||||||
//checkEnable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkEnable() {
|
|
||||||
if (!this.isEnabled() && Security == null && this.getServer() != null) {
|
|
||||||
this.getServer().getPluginManager().enablePlugin(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,26 +4,34 @@
|
||||||
*/
|
*/
|
||||||
package org.anjocaido.groupmanager.permissions;
|
package org.anjocaido.groupmanager.permissions;
|
||||||
|
|
||||||
import com.nijiko.permissions.Control;
|
import com.nijiko.permissions.Group;
|
||||||
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
|
import com.nijiko.permissions.User;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.anjocaido.groupmanager.GroupManager;
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.util.config.Configuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Everything here maintains the model created by Nijikokun
|
* Everything here maintains the model created by Nijikokun
|
||||||
*
|
*
|
||||||
* But implemented to use GroupManager system. Which provides instant changes,
|
* But implemented to use GroupManager system. Which provides instant changes,
|
||||||
* without file access.
|
* without file access.
|
||||||
*
|
*
|
||||||
* @author gabrielcouto
|
* @author gabrielcouto
|
||||||
*/
|
*/
|
||||||
public class NijikoPermissionsProxy extends Control {
|
public class NijikoPermissionsProxy extends PermissionHandler {
|
||||||
|
|
||||||
GroupManager plugin;
|
GroupManager plugin;
|
||||||
public NijikoPermissionsProxy(GroupManager plugin){
|
|
||||||
super(null);
|
public NijikoPermissionsProxy(GroupManager plugin) {
|
||||||
|
super();
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +47,12 @@ public class NijikoPermissionsProxy extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGroupInfo(String world, String group, String node, Object data) {
|
public void addGroupInfo(String world, String group, String node, Object data) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().addGroupInfo(group, node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroupInfo(String world, String group, String node) {
|
public void removeGroupInfo(String world, String group, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeGroupInfo(group, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,62 +67,62 @@ public class NijikoPermissionsProxy extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addUserInfo(String world, String user, String node, Object data) {
|
public void addUserInfo(String world, String user, String node, Object data) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().addUserInfo(user, node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUserInfo(String world, String user, String node) {
|
public void removeUserInfo(String world, String user, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeUserInfo(user, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void removeUserInfo(String user, String node) {
|
public void removeUserInfo(String user, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeUserInfo(user, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void addGroupPermission(String group, String node) {
|
public void addGroupPermission(String group, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void removeGroupPermission(String group, String node) {
|
public void removeGroupPermission(String group, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void addGroupInfo(String group, String node, Object data) {
|
public void addGroupInfo(String group, String node, Object data) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addGroupInfo(group, node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void removeGroupInfo(String group, String node) {
|
public void removeGroupInfo(String group, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeGroupInfo(group, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void addUserPermission(String user, String node) {
|
public void addUserPermission(String user, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void removeUserPermission(String user, String node) {
|
public void removeUserPermission(String user, String node) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void addUserInfo(String user, String node, Object data) {
|
public void addUserInfo(String user, String node, Object data) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addUserInfo(user, node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultWorld(String world) {
|
public void setDefaultWorld(String world) {
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void setDirectory(File directory) {
|
public void setDirectory(File directory) {
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,7 +132,7 @@ public class NijikoPermissionsProxy extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forceLoadWorld(String world) {
|
public void forceLoadWorld(String world) {
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,91 +142,21 @@ public class NijikoPermissionsProxy extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(String world, Configuration config) {
|
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reload() {
|
public void reload() {
|
||||||
plugin.getWorldsHolder().reloadAll();
|
GroupManager.getWorldsHolder().reloadAll();
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
//throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean reload(String world) {
|
public boolean reload(String world) {
|
||||||
plugin.getWorldsHolder().reloadWorld(world);
|
GroupManager.getWorldsHolder().reloadWorld(world);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCache(Map<String, Boolean> Cache) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCache(String world, Map<String, Boolean> Cache) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCacheItem(String player, String permission, boolean data) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCacheItem(String world, String player, String permission, boolean data) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Boolean> getCache() {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Boolean> getCache(String world) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getCacheItem(String player, String permission) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getCacheItem(String world, String player, String permission) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeCachedItem(String player, String permission) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeCachedItem(String world, String player, String permission) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearCache() {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearCache(String world) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearAllCache() {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(Player player, String permission) {
|
public boolean has(Player player, String permission) {
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
//throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
@ -228,207 +166,423 @@ public class NijikoPermissionsProxy extends Control {
|
||||||
@Override
|
@Override
|
||||||
public boolean permission(Player player, String permission) {
|
public boolean permission(Player player, String permission) {
|
||||||
//throw new UnsupportedOperationException("Not supported yet.");
|
//throw new UnsupportedOperationException("Not supported yet.");
|
||||||
if(permission==null || permission.equals("")){
|
if (permission == null || permission.equals("")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(player==null){
|
if (player == null) {
|
||||||
GroupManager.logger.severe("A plugin is asking permission '"+permission+"' for a null player... Which plugin does that? Bastards!");
|
GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(player.getWorld()==null){
|
if (player.getWorld() == null) {
|
||||||
GroupManager.logger.warning("The player "+player.getName()+" has a null world? Treating as default world!");
|
GroupManager.logger.warning("The player " + player.getName() + " has a null world? Treating as default world!");
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().has(player, permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().has(player, permission);
|
||||||
}
|
}
|
||||||
return plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getPermissionsHandler().has(player, permission);
|
return GroupManager.getWorldsHolder().getWorldData(player.getWorld().getName()).getPermissionsHandler().has(player, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroup(String world, String name) {
|
public String getGroupRawPrefix(String world, String group) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(name);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGroupRawSuffix(String world, String group) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUserPrefix(String world, String user) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPrefix(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUserSuffix(String world, String user) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserSuffix(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGroup(String world, String user) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPrimaryGroup(String world, String user) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUserBuild(String world, String user) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().canUserBuild(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
|
||||||
public String getGroup(String name) {
|
public String getGroup(String name) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroup(name);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getGroups(String world, String name) {
|
public String[] getGroups(String world, String name) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroups(name);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroups(name);
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public String[] getGroups(String name) {
|
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroups(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inGroup(String world, String name, String group) {
|
public boolean inGroup(String world, String name, String group) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(name,group);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(name, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
|
||||||
public boolean inGroup(String name, String group) {
|
public boolean inGroup(String name, String group) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().inGroup(name,group);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().inGroup(name, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroupPrefix(String world, String group) {
|
public String getGroupPrefix(String world, String group) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public String getGroupPrefix(String group) {
|
public String getGroupPrefix(String group) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPrefix(group);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPrefix(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroupSuffix(String world, String group) {
|
public String getGroupSuffix(String world, String group) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public String getGroupSuffix(String group) {
|
public String getGroupSuffix(String group) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupSuffix(group);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupSuffix(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canGroupBuild(String world, String group) {
|
public boolean canGroupBuild(String world, String group) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
|
||||||
public boolean canGroupBuild(String group) {
|
public boolean canGroupBuild(String group) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().canGroupBuild(group);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().canGroupBuild(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroupPermissionString(String world, String group, String permission) {
|
public String getGroupPermissionString(String world, String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionString(group,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionString(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public String getGroupPermissionString(String group, String permission) {
|
public String getGroupPermissionString(String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionString(group,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionString(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getGroupPermissionInteger(String world, String group, String permission) {
|
public int getGroupPermissionInteger(String world, String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionInteger(group,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionInteger(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public int getGroupPermissionInteger(String group, String permission) {
|
public int getGroupPermissionInteger(String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionInteger(group,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionInteger(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getGroupPermissionBoolean(String world, String group, String permission) {
|
public boolean getGroupPermissionBoolean(String world, String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionBoolean(group,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionBoolean(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public boolean getGroupPermissionBoolean(String group, String permission) {
|
public boolean getGroupPermissionBoolean(String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionBoolean(group,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionBoolean(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getGroupPermissionDouble(String world, String group, String permission) {
|
public double getGroupPermissionDouble(String world, String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionDouble(group,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionDouble(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public double getGroupPermissionDouble(String group, String permission) {
|
public double getGroupPermissionDouble(String group, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionDouble(group,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionDouble(group, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUserPermissionString(String world, String name, String permission) {
|
public String getUserPermissionString(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionString(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionString(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public String getUserPermissionString(String name, String permission) {
|
public String getUserPermissionString(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionString(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionString(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getUserPermissionInteger(String world, String name, String permission) {
|
public int getUserPermissionInteger(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionInteger(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionInteger(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public int getUserPermissionInteger(String name, String permission) {
|
public int getUserPermissionInteger(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionInteger(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionInteger(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getUserPermissionBoolean(String world, String name, String permission) {
|
public boolean getUserPermissionBoolean(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionBoolean(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionBoolean(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public boolean getUserPermissionBoolean(String name, String permission) {
|
public boolean getUserPermissionBoolean(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionBoolean(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionBoolean(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getUserPermissionDouble(String world, String name, String permission) {
|
public double getUserPermissionDouble(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionDouble(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionDouble(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public double getUserPermissionDouble(String name, String permission) {
|
public double getUserPermissionDouble(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionDouble(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionDouble(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPermissionString(String world, String name, String permission) {
|
public String getPermissionString(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionString(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionString(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public String getPermissionString(String name, String permission) {
|
public String getPermissionString(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionString(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionString(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPermissionInteger(String world, String name, String permission) {
|
public int getPermissionInteger(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionInteger(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionInteger(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public int getPermissionInteger(String name, String permission) {
|
public int getPermissionInteger(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionInteger(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionInteger(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getPermissionBoolean(String world, String name, String permission) {
|
public boolean getPermissionBoolean(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionBoolean(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionBoolean(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public boolean getPermissionBoolean(String name, String permission) {
|
public boolean getPermissionBoolean(String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionBoolean(name,permission);
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionBoolean(name, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getPermissionDouble(String world, String name, String permission) {
|
public double getPermissionDouble(String world, String name, String permission) {
|
||||||
return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionDouble(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionDouble(name, permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public double getPermissionDouble(String name, String permission) {
|
||||||
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name, permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGM(Plugin p) {
|
||||||
|
this.plugin = (GroupManager) p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getPermissionDouble(String name, String permission) {
|
public boolean canGroupRawBuild(String world, String group) {
|
||||||
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name,permission);
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGM(Plugin p)
|
@Override
|
||||||
{
|
public void closeAll() {
|
||||||
this.plugin = (GroupManager)p;
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareWeights(String firstWorld, String first, String secondWorld, String second) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareWeights(String world, String first, String second) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Set<String>> getAllGroups(String world, String name) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getDefaultGroup(String world) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroupObject(String world, String group) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGroupProperName(String world, String group) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getInfoBoolean(String world, String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoBoolean(entryName, path, isGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getInfoBoolean(String world, String entryName, String path,
|
||||||
|
boolean isGroup, Comparator<Boolean> comparator) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Double getInfoDouble(String world, String entryName, String path, boolean isGroup) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoDouble(entryName, path, isGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Double getInfoDouble(String world, String entryName, String path,
|
||||||
|
boolean isGroup, Comparator<Double> comparator) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getInfoInteger(String world, String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoInteger(entryName, path, isGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getInfoInteger(String world, String entryName, String path,
|
||||||
|
boolean isGroup, Comparator<Integer> comparator) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInfoString(String world, String entryName, String path, boolean isGroup) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoString(entryName, path, isGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInfoString(String world, String entryName, String path,
|
||||||
|
boolean isGroup, Comparator<String> comparator) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getRawInfoBoolean(String world, String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Double getRawInfoDouble(String world, String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getRawInfoInteger(String world, String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRawInfoString(String world, String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getTracks(String world) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User getUserObject(String world, String name) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<User> getUsers(String world) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getWorlds() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean has(String world, String playerName, String permission) {
|
||||||
|
if (permission == null || permission.equals("")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (playerName == null || playerName == "") {
|
||||||
|
GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (world == null) {
|
||||||
|
GroupManager.logger.warning("The player " + playerName + " has a null world? Treating as default world!");
|
||||||
|
return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().permission(playerName, permission);
|
||||||
|
}
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().permission(playerName, permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inGroup(String world, String user, String groupWorld, String group) {
|
||||||
|
return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(user, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inSingleGroup(String world, String user, String group) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inSingleGroup(String world, String user, String groupWorld, String group) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean permission(String world, String name, String node) {
|
||||||
|
return has(world, name, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group safeGetGroup(String world, String name) throws Exception {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User safeGetUser(String world, String name) throws Exception {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(String world) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAll() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Group> getGroups(String world) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
public Group getPrimaryGroupObject(String arg0, String arg1) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: Permissions
|
name: Permissions
|
||||||
version: 2.7.2
|
version: 3.1.6
|
||||||
main: com.nijikokun.bukkit.Permissions.Permissions
|
main: com.nijikokun.bukkit.Permissions.Permissions
|
||||||
depend: [GroupManager]
|
depend: [GroupManager]
|
7
EssentialsGroupManager/.classpath
Normal file
7
EssentialsGroupManager/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="lib" path="../lib/bukkit-0.0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="../lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
|
||||||
|
</classpath>
|
17
EssentialsGroupManager/.project
Normal file
17
EssentialsGroupManager/.project
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>EssentialsGroupManager</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -4,6 +4,19 @@ annotation.processing.run.all.processors=true
|
||||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
application.title=EssentialsGroupManager
|
application.title=EssentialsGroupManager
|
||||||
application.vendor=gabrielcouto
|
application.vendor=gabrielcouto
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=true
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width=120
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap=none
|
||||||
build.classes.dir=${build.dir}/classes
|
build.classes.dir=${build.dir}/classes
|
||||||
build.classes.excludes=**/*.java,**/*.form
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
|
|
13
EssentialsGroupManager/src/Changelog.txt
Normal file
13
EssentialsGroupManager/src/Changelog.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Changelog
|
||||||
|
|
||||||
|
v 1.1:
|
||||||
|
- Fixed users being able to use 'manuadd' to add users to higher groups than their own.
|
||||||
|
- Added SuperPerms support so GM will update and provide the permissions to plugins which only support Bukkit Perms.
|
||||||
|
- Added more helpful output to errors on argument lengths.
|
||||||
|
- GroupManager will now attempt to select the default world when using commands instead of failing and telling you to use '/manselect <world>'.
|
||||||
|
- Invalid groups assigned to players in users.yml will no longer cause a crash. GM will now set them to the default group instead.
|
||||||
|
- Fix for Users.yml containing only 'users:' causing a crash.
|
||||||
|
- GroupManager will now generate a fresh Users and Groups yml if either file is empty.
|
||||||
|
- Fix for an infinite loop bug with the new Bukkit Perms during a new user creation.
|
||||||
|
v 1.2:
|
||||||
|
- Fixed BukkitPerms population. Wasn't correctly setting superperms.
|
|
@ -7,7 +7,8 @@ settings:
|
||||||
permission:
|
permission:
|
||||||
world:
|
world:
|
||||||
mirror:
|
mirror:
|
||||||
world1:
|
world:
|
||||||
|
- world_nether
|
||||||
- world2
|
- world2
|
||||||
- world3
|
- world3
|
||||||
world4:
|
world4:
|
||||||
|
|
2
EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
Normal file → Executable file
2
EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
Normal file → Executable file
|
@ -117,4 +117,4 @@ public class GMConfiguration {
|
||||||
}
|
}
|
||||||
GroupManager.logger.setLevel(Level.INFO);
|
GroupManager.logger.setLevel(Level.INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
package org.anjocaido.groupmanager;
|
package org.anjocaido.groupmanager;
|
||||||
|
|
||||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||||
|
import org.anjocaido.groupmanager.permissions.BukkitPermissions;
|
||||||
import org.anjocaido.groupmanager.utils.GroupManagerPermissions;
|
import org.anjocaido.groupmanager.utils.GroupManagerPermissions;
|
||||||
import org.anjocaido.groupmanager.data.Variables;
|
import org.anjocaido.groupmanager.data.Variables;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
|
@ -32,6 +33,7 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author gabrielcouto
|
* @author gabrielcouto
|
||||||
|
@ -44,15 +46,23 @@ public class GroupManager extends JavaPlugin {
|
||||||
private ScheduledThreadPoolExecutor scheduler;
|
private ScheduledThreadPoolExecutor scheduler;
|
||||||
private Map<String, ArrayList<User>> overloadedUsers = new HashMap<String, ArrayList<User>>();
|
private Map<String, ArrayList<User>> overloadedUsers = new HashMap<String, ArrayList<User>>();
|
||||||
private Map<CommandSender, String> selectedWorlds = new HashMap<CommandSender, String>();
|
private Map<CommandSender, String> selectedWorlds = new HashMap<CommandSender, String>();
|
||||||
private WorldsHolder worldsHolder;
|
private static WorldsHolder worldsHolder;
|
||||||
private boolean validateOnlinePlayer = true;
|
private boolean validateOnlinePlayer = true;
|
||||||
private boolean isReady = false;
|
private boolean isReady = false;
|
||||||
|
public static boolean isLoaded = false;
|
||||||
private GMConfiguration config;
|
private GMConfiguration config;
|
||||||
private GMLoggerHandler ch;
|
private GMLoggerHandler ch;
|
||||||
|
public static BukkitPermissions BukkitPermissions;
|
||||||
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
|
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
|
||||||
|
|
||||||
|
//PERMISSIONS FOR COMMAND BEING LOADED
|
||||||
|
OverloadedWorldHolder dataHolder = null;
|
||||||
|
AnjoPermissionsHandler permissionHandler = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
isLoaded = false;
|
||||||
|
|
||||||
if (worldsHolder != null) {
|
if (worldsHolder != null) {
|
||||||
worldsHolder.saveChanges();
|
worldsHolder.saveChanges();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +70,7 @@ public class GroupManager extends JavaPlugin {
|
||||||
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
|
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
|
||||||
GroupManager.logger.removeHandler(ch);
|
GroupManager.logger.removeHandler(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,8 +91,11 @@ public class GroupManager extends JavaPlugin {
|
||||||
this.getServer().getPluginManager().disablePlugin(this);
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
throw new IllegalStateException("An error ocurred while loading GroupManager");
|
throw new IllegalStateException("An error ocurred while loading GroupManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BukkitPermissions = new BukkitPermissions(this);
|
||||||
|
|
||||||
enableScheduler();
|
enableScheduler();
|
||||||
|
isLoaded = true;
|
||||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +122,7 @@ public class GroupManager extends JavaPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GroupManager.this.worldsHolder.saveChanges();
|
GroupManager.worldsHolder.saveChanges();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
scheduler = new ScheduledThreadPoolExecutor(1);
|
scheduler = new ScheduledThreadPoolExecutor(1);
|
||||||
|
@ -152,7 +165,7 @@ public class GroupManager extends JavaPlugin {
|
||||||
worldsHolder.reloadAll();
|
worldsHolder.reloadAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldsHolder getWorldsHolder() {
|
public static WorldsHolder getWorldsHolder() {
|
||||||
return worldsHolder;
|
return worldsHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +179,7 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple interface, for ones that don't want to mess with overloading.
|
* A simple interface, for ones that don't want to mess with overloading.
|
||||||
* Yet it is affected by overloading. But seamless.
|
* Yet it is affected by overloading. But seamless.
|
||||||
* @return the dataholder with all information
|
* @return the dataholder with all information
|
||||||
*/
|
*/
|
||||||
|
@ -176,8 +189,8 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this if you want to play with overloading.
|
* Use this if you want to play with overloading.
|
||||||
* @return a dataholder with overloading interface
|
* @return a dataholder with overloading interface
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public OverloadedWorldHolder getOverloadedClassData() {
|
public OverloadedWorldHolder getOverloadedClassData() {
|
||||||
|
@ -186,10 +199,11 @@ public class GroupManager extends JavaPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a command registered by this plugin is received.
|
* Called when a command registered by this plugin is received.
|
||||||
* @param sender
|
* @param sender
|
||||||
* @param cmd
|
* @param cmd
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"null", "deprecation"})
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||||
boolean playerCanDo = false;
|
boolean playerCanDo = false;
|
||||||
|
@ -212,8 +226,8 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
//PERMISSIONS FOR COMMAND BEING LOADED
|
//PERMISSIONS FOR COMMAND BEING LOADED
|
||||||
OverloadedWorldHolder dataHolder = null;
|
dataHolder = null;
|
||||||
AnjoPermissionsHandler permissionHandler = null;
|
permissionHandler = null;
|
||||||
|
|
||||||
if (senderPlayer != null) {
|
if (senderPlayer != null) {
|
||||||
dataHolder = worldsHolder.getWorldData(senderPlayer);
|
dataHolder = worldsHolder.getWorldData(senderPlayer);
|
||||||
|
@ -246,9 +260,9 @@ public class GroupManager extends JavaPlugin {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//this error happened once with someone. now im prepared... i think
|
//this error happened once with someone. now im prepared... i think
|
||||||
GroupManager.logger.severe("===================================================");
|
GroupManager.logger.severe("===================================================");
|
||||||
GroupManager.logger.severe("= ERROR REPORT START =");
|
GroupManager.logger.severe("= ERROR REPORT START =");
|
||||||
GroupManager.logger.severe("===================================================");
|
GroupManager.logger.severe("===================================================");
|
||||||
GroupManager.logger.severe("= COPY AND PASTE THIS TO GROUPMANAGER DEVELOPER =");
|
GroupManager.logger.severe("= COPY AND PASTE THIS TO GROUPMANAGER DEVELOPER =");
|
||||||
GroupManager.logger.severe("===================================================");
|
GroupManager.logger.severe("===================================================");
|
||||||
GroupManager.logger.severe(this.getDescription().getName());
|
GroupManager.logger.severe(this.getDescription().getName());
|
||||||
GroupManager.logger.severe(this.getDescription().getVersion());
|
GroupManager.logger.severe(this.getDescription().getVersion());
|
||||||
|
@ -265,7 +279,7 @@ public class GroupManager extends JavaPlugin {
|
||||||
GroupManager.logger.severe(val.name());
|
GroupManager.logger.severe(val.name());
|
||||||
}
|
}
|
||||||
GroupManager.logger.severe("===================================================");
|
GroupManager.logger.severe("===================================================");
|
||||||
GroupManager.logger.severe("= ERROR REPORT ENDED =");
|
GroupManager.logger.severe("= ERROR REPORT ENDED =");
|
||||||
GroupManager.logger.severe("===================================================");
|
GroupManager.logger.severe("===================================================");
|
||||||
sender.sendMessage("An error occurred. Ask the admin to take a look at the console.");
|
sender.sendMessage("An error occurred. Ask the admin to take a look at the console.");
|
||||||
}
|
}
|
||||||
|
@ -275,13 +289,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manuadd:
|
case manuadd:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -301,11 +314,29 @@ public class GroupManager extends JavaPlugin {
|
||||||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!isConsole && !senderPlayer.isOp() && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//PARECE OK
|
//PARECE OK
|
||||||
auxUser.setGroup(auxGroup);
|
auxUser.setGroup(auxGroup);
|
||||||
sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'.");
|
sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'.");
|
||||||
|
@ -315,13 +346,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manudel:
|
case manudel:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -349,13 +379,15 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manuaddsub:
|
case manuaddsub:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender)) {
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
||||||
return true;
|
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -388,13 +420,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manudelsub:
|
case manudelsub:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -422,13 +453,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangadd:
|
case mangadd:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -444,13 +474,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangdel:
|
case mangdel:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -466,13 +495,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manuaddp:
|
case manuaddp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -531,13 +559,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manudelp:
|
case manudelp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -583,13 +610,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manulistp:
|
case manulistp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -638,13 +664,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manucheckp:
|
case manucheckp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -686,13 +711,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangaddp:
|
case mangaddp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -740,12 +764,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangdelp:
|
case mangdelp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -779,13 +803,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manglistp:
|
case manglistp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -828,13 +851,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangcheckp:
|
case mangcheckp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -863,13 +885,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangaddi:
|
case mangaddi:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -889,19 +910,18 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
//PARECE OK
|
//PARECE OK
|
||||||
auxGroup.addInherits(auxGroup2);
|
auxGroup.addInherits(auxGroup2);
|
||||||
sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list.");
|
sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case mangdeli:
|
case mangdeli:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -925,19 +945,18 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
//PARECE OK
|
//PARECE OK
|
||||||
auxGroup.removeInherits(auxGroup2.getName());
|
auxGroup.removeInherits(auxGroup2.getName());
|
||||||
sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list.");
|
sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case manuaddv:
|
case manuaddv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable> <value>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -967,13 +986,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manudelv:
|
case manudelv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -999,13 +1017,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manulistv:
|
case manulistv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1037,13 +1054,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manucheckv:
|
case manucheckv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1080,13 +1096,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangaddv:
|
case mangaddv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable> <value>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -1110,13 +1125,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangdelv:
|
case mangdelv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -1136,13 +1150,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manglistv:
|
case manglistv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -1174,13 +1187,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mangcheckv:
|
case mangcheckv:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auxGroup = dataHolder.getGroup(args[0]);
|
auxGroup = dataHolder.getGroup(args[0]);
|
||||||
|
@ -1202,13 +1214,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manwhois:
|
case manwhois:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1237,13 +1248,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case tempadd:
|
case tempadd:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1276,13 +1286,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case tempdel:
|
case tempdel:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1317,9 +1326,8 @@ public class GroupManager extends JavaPlugin {
|
||||||
case templist:
|
case templist:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//WORKING
|
//WORKING
|
||||||
auxString = "";
|
auxString = "";
|
||||||
|
@ -1347,9 +1355,8 @@ public class GroupManager extends JavaPlugin {
|
||||||
case tempdelall:
|
case tempdelall:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//WORKING
|
//WORKING
|
||||||
removeList = new ArrayList<User>();
|
removeList = new ArrayList<User>();
|
||||||
|
@ -1391,9 +1398,8 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//WORKING
|
//WORKING
|
||||||
config.load();
|
config.load();
|
||||||
|
@ -1416,9 +1422,8 @@ public class GroupManager extends JavaPlugin {
|
||||||
case listgroups:
|
case listgroups:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//WORKING
|
//WORKING
|
||||||
auxString = "";
|
auxString = "";
|
||||||
|
@ -1433,13 +1438,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case manpromote:
|
case manpromote:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1489,13 +1493,12 @@ public class GroupManager extends JavaPlugin {
|
||||||
case mandemote:
|
case mandemote:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
if (dataHolder == null || permissionHandler == null) {
|
if (dataHolder == null || permissionHandler == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
if (!setDefaultWorldHandler(sender))
|
||||||
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
|
@ -1575,7 +1578,7 @@ public class GroupManager extends JavaPlugin {
|
||||||
return true;
|
return true;
|
||||||
case manselect:
|
case manselect:
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)");
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Worlds available: ");
|
sender.sendMessage(ChatColor.YELLOW + "Worlds available: ");
|
||||||
ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();
|
ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();
|
||||||
auxString = "";
|
auxString = "";
|
||||||
|
@ -1619,6 +1622,26 @@ public class GroupManager extends JavaPlugin {
|
||||||
sender.sendMessage(ChatColor.RED + "You are not allowed to use that command.");
|
sender.sendMessage(ChatColor.RED + "You are not allowed to use that command.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the default world for use.
|
||||||
|
*/
|
||||||
|
private boolean setDefaultWorldHandler(CommandSender sender) {
|
||||||
|
|
||||||
|
dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName());
|
||||||
|
permissionHandler = dataHolder.getPermissionsHandler();
|
||||||
|
selectedWorlds.put(sender, dataHolder.getName());
|
||||||
|
|
||||||
|
if ((dataHolder != null) && (permissionHandler != null)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. Default world '" + worldsHolder.getDefaultWorld().getName() + "' selected.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
|
||||||
|
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the config
|
* @return the config
|
||||||
|
@ -1633,4 +1656,4 @@ public class GroupManager extends JavaPlugin {
|
||||||
public File getBackupFolder() {
|
public File getBackupFolder() {
|
||||||
return backupFolder;
|
return backupFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
19
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
Normal file → Executable file
19
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
Normal file → Executable file
|
@ -27,7 +27,7 @@ public abstract class DataUnit {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Every group is matched only by their names and DataSources names.
|
* Every group is matched only by their names and DataSources names.
|
||||||
* @param o
|
* @param o
|
||||||
* @return true if they are equal. false if not.
|
* @return true if they are equal. false if not.
|
||||||
*/
|
*/
|
||||||
|
@ -49,9 +49,6 @@ public abstract class DataUnit {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the dataSource
|
* @return the dataSource
|
||||||
*/
|
*/
|
||||||
|
@ -67,10 +64,10 @@ public abstract class DataUnit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flagAsChanged() {
|
public void flagAsChanged() {
|
||||||
GroupManager.logger.finest("DataSource: "+getDataSource().getName()+" - DataUnit: "+getName()+" flagged as changed!");
|
GroupManager.logger.finest("DataSource: " + getDataSource().getName() + " - DataUnit: " + getName() + " flagged as changed!");
|
||||||
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
|
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
|
||||||
// GroupManager.logger.finest(st.toString());
|
// GroupManager.logger.finest(st.toString());
|
||||||
// }
|
// }
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +76,7 @@ public abstract class DataUnit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flagAsSaved() {
|
public void flagAsSaved() {
|
||||||
GroupManager.logger.finest("DataSource: "+getDataSource().getName()+" - DataUnit: "+getName()+" flagged as saved!");
|
GroupManager.logger.finest("DataSource: " + getDataSource().getName() + " - DataUnit: " + getName() + " flagged as saved!");
|
||||||
changed = false;
|
changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +105,7 @@ public abstract class DataUnit {
|
||||||
return (ArrayList<String>) permissions.clone();
|
return (ArrayList<String>) permissions.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortPermissions(){
|
public void sortPermissions() {
|
||||||
Collections.sort(permissions, StringPermissionComparator.getInstance());
|
Collections.sort(permissions, StringPermissionComparator.getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.anjocaido.groupmanager.data;
|
package org.anjocaido.groupmanager.data;
|
||||||
|
|
||||||
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -30,18 +31,18 @@ public class Group extends DataUnit implements Cloneable {
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public Group(WorldDataHolder source, String name) {
|
public Group(WorldDataHolder source, String name) {
|
||||||
super(source,name);
|
super(source, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone this group
|
* Clone this group
|
||||||
* @return a clone of this group
|
* @return a clone of this group
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Group clone() {
|
public Group clone() {
|
||||||
Group clone = new Group(getDataSource(), this.getName());
|
Group clone = new Group(getDataSource(), this.getName());
|
||||||
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
|
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
|
||||||
for(String perm: this.getPermissionList()){
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
clone.variables = ((GroupVariables) variables).clone(clone);
|
clone.variables = ((GroupVariables) variables).clone(clone);
|
||||||
|
@ -52,7 +53,7 @@ public class Group extends DataUnit implements Cloneable {
|
||||||
/**
|
/**
|
||||||
* Use this to deliver a group from a different dataSource to another
|
* Use this to deliver a group from a different dataSource to another
|
||||||
* @param dataSource
|
* @param dataSource
|
||||||
* @return
|
* @return Null or Clone
|
||||||
*/
|
*/
|
||||||
public Group clone(WorldDataHolder dataSource) {
|
public Group clone(WorldDataHolder dataSource) {
|
||||||
if (dataSource.groupExists(this.getName())) {
|
if (dataSource.groupExists(this.getName())) {
|
||||||
|
@ -60,7 +61,7 @@ public class Group extends DataUnit implements Cloneable {
|
||||||
}
|
}
|
||||||
Group clone = getDataSource().createGroup(this.getName());
|
Group clone = getDataSource().createGroup(this.getName());
|
||||||
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
|
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
|
||||||
for(String perm: this.getPermissionList()){
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
clone.variables = variables.clone(clone);
|
clone.variables = variables.clone(clone);
|
||||||
|
@ -79,7 +80,7 @@ public class Group extends DataUnit implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param inherits the inherits to set
|
* @param inherit the inherits to set
|
||||||
*/
|
*/
|
||||||
public void addInherits(Group inherit) {
|
public void addInherits(Group inherit) {
|
||||||
if (!this.getDataSource().groupExists(inherit.getName())) {
|
if (!this.getDataSource().groupExists(inherit.getName())) {
|
||||||
|
@ -89,6 +90,8 @@ public class Group extends DataUnit implements Cloneable {
|
||||||
inherits.add(inherit.getName().toLowerCase());
|
inherits.add(inherit.getName().toLowerCase());
|
||||||
}
|
}
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if (GroupManager.isLoaded)
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeInherits(String inherit) {
|
public boolean removeInherits(String inherit) {
|
||||||
|
@ -108,15 +111,17 @@ public class Group extends DataUnit implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param varList
|
* @param varList
|
||||||
*/
|
*/
|
||||||
public void setVariables(Map<String, Object> varList) {
|
public void setVariables(Map<String, Object> varList) {
|
||||||
GroupVariables temp = new GroupVariables(this, varList);
|
GroupVariables temp = new GroupVariables(this, varList);
|
||||||
variables.clearVars();
|
variables.clearVars();
|
||||||
for(String key: temp.getVarKeyList()){
|
for (String key : temp.getVarKeyList()) {
|
||||||
variables.addVar(key, temp.getVarObject(key));
|
variables.addVar(key, temp.getVarObject(key));
|
||||||
}
|
}
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if (GroupManager.isLoaded)
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
Normal file → Executable file
2
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
Normal file → Executable file
|
@ -45,7 +45,7 @@ public class GroupVariables extends Variables implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A clone of all vars here.
|
* A clone of all vars here.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected GroupVariables clone(Group newOwner) {
|
protected GroupVariables clone(Group newOwner) {
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
*/
|
*/
|
||||||
package org.anjocaido.groupmanager.data;
|
package org.anjocaido.groupmanager.data;
|
||||||
|
|
||||||
import com.sun.org.apache.bcel.internal.generic.AALOAD;
|
//import com.sun.org.apache.bcel.internal.generic.AALOAD;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -27,13 +29,12 @@ public class User extends DataUnit implements Cloneable {
|
||||||
*/
|
*/
|
||||||
private UserVariables variables = new UserVariables(this);
|
private UserVariables variables = new UserVariables(this);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public User(WorldDataHolder source, String name) {
|
public User(WorldDataHolder source, String name) {
|
||||||
super(source,name);
|
super(source, name);
|
||||||
this.group = source.getDefaultGroup().getName();
|
this.group = source.getDefaultGroup().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ public class User extends DataUnit implements Cloneable {
|
||||||
public User clone() {
|
public User clone() {
|
||||||
User clone = new User(getDataSource(), this.getName());
|
User clone = new User(getDataSource(), this.getName());
|
||||||
clone.group = this.group;
|
clone.group = this.group;
|
||||||
for(String perm: this.getPermissionList()){
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
//clone.variables = this.variables.clone();
|
//clone.variables = this.variables.clone();
|
||||||
|
@ -68,7 +69,7 @@ public class User extends DataUnit implements Cloneable {
|
||||||
} else {
|
} else {
|
||||||
clone.setGroup(this.getGroupName());
|
clone.setGroup(this.getGroupName());
|
||||||
}
|
}
|
||||||
for(String perm: this.getPermissionList()){
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
//clone.variables = this.variables.clone();
|
//clone.variables = this.variables.clone();
|
||||||
|
@ -103,6 +104,8 @@ public class User extends DataUnit implements Cloneable {
|
||||||
public void setGroup(String group) {
|
public void setGroup(String group) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if ((GroupManager.isLoaded) && (GroupManager.BukkitPermissions.player_join = false))
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,45 +118,55 @@ public class User extends DataUnit implements Cloneable {
|
||||||
group = getDataSource().getGroup(group.getName());
|
group = getDataSource().getGroup(group.getName());
|
||||||
this.group = group.getName();
|
this.group = group.getName();
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if ((GroupManager.isLoaded) && (GroupManager.BukkitPermissions.player_join = false))
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSubGroup(Group subGroup){
|
public void addSubGroup(Group subGroup) {
|
||||||
if(this.group.equalsIgnoreCase(subGroup.getName())){
|
if (this.group.equalsIgnoreCase(subGroup.getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.getDataSource().groupExists(subGroup.getName())) {
|
if (!this.getDataSource().groupExists(subGroup.getName())) {
|
||||||
getDataSource().addGroup(subGroup);
|
getDataSource().addGroup(subGroup);
|
||||||
}
|
}
|
||||||
subGroup = getDataSource().getGroup(subGroup.getName());
|
subGroup = getDataSource().getGroup(subGroup.getName());
|
||||||
removeSubGroup(subGroup);
|
removeSubGroup(subGroup);
|
||||||
subGroups.add(subGroup.getName());
|
subGroups.add(subGroup.getName());
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if ((GroupManager.isLoaded) && (GroupManager.BukkitPermissions.player_join = false))
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
}
|
}
|
||||||
public int subGroupsSize(){
|
|
||||||
|
public int subGroupsSize() {
|
||||||
return subGroups.size();
|
return subGroups.size();
|
||||||
}
|
}
|
||||||
public boolean isSubGroupsEmpty(){
|
|
||||||
|
public boolean isSubGroupsEmpty() {
|
||||||
return subGroups.isEmpty();
|
return subGroups.isEmpty();
|
||||||
}
|
}
|
||||||
public boolean containsSubGroup(Group subGroup){
|
|
||||||
|
public boolean containsSubGroup(Group subGroup) {
|
||||||
return subGroups.contains(subGroup.getName());
|
return subGroups.contains(subGroup.getName());
|
||||||
}
|
}
|
||||||
public boolean removeSubGroup(Group subGroup){
|
|
||||||
try{
|
public boolean removeSubGroup(Group subGroup) {
|
||||||
if(subGroups.remove(subGroup.getName())){
|
try {
|
||||||
|
if (subGroups.remove(subGroup.getName())) {
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if ((GroupManager.isLoaded) && (GroupManager.BukkitPermissions.player_join = false))
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public ArrayList<Group> subGroupListCopy(){
|
|
||||||
|
public ArrayList<Group> subGroupListCopy() {
|
||||||
ArrayList<Group> val = new ArrayList<Group>();
|
ArrayList<Group> val = new ArrayList<Group>();
|
||||||
for(String gstr: subGroups){
|
for (String gstr : subGroups) {
|
||||||
Group g = getDataSource().getGroup(gstr);
|
Group g = getDataSource().getGroup(gstr);
|
||||||
if(g==null){
|
if (g == null) {
|
||||||
removeSubGroup(g);
|
removeSubGroup(g);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +174,8 @@ public class User extends DataUnit implements Cloneable {
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
public ArrayList<String> subGroupListStringCopy(){
|
|
||||||
|
public ArrayList<String> subGroupListStringCopy() {
|
||||||
return (ArrayList<String>) subGroups.clone();
|
return (ArrayList<String>) subGroups.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,9 +193,11 @@ public class User extends DataUnit implements Cloneable {
|
||||||
public void setVariables(Map<String, Object> varList) {
|
public void setVariables(Map<String, Object> varList) {
|
||||||
UserVariables temp = new UserVariables(this, varList);
|
UserVariables temp = new UserVariables(this, varList);
|
||||||
variables.clearVars();
|
variables.clearVars();
|
||||||
for(String key: temp.getVarKeyList()){
|
for (String key : temp.getVarKeyList()) {
|
||||||
variables.addVar(key, temp.getVarObject(key));
|
variables.addVar(key, temp.getVarObject(key));
|
||||||
}
|
}
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
|
if ((GroupManager.isLoaded) && (GroupManager.BukkitPermissions.player_join = false))
|
||||||
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
Normal file → Executable file
13
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
Normal file → Executable file
|
@ -2,7 +2,6 @@
|
||||||
* To change this template, choose Tools | Templates
|
* To change this template, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.anjocaido.groupmanager.data;
|
package org.anjocaido.groupmanager.data;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -11,19 +10,23 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author gabrielcouto
|
* @author gabrielcouto
|
||||||
*/
|
*/
|
||||||
public class UserVariables extends Variables{
|
public class UserVariables extends Variables {
|
||||||
|
|
||||||
private User owner;
|
private User owner;
|
||||||
public UserVariables(User owner){
|
|
||||||
|
public UserVariables(User owner) {
|
||||||
super(owner);
|
super(owner);
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserVariables(User owner, Map<String, Object> varList) {
|
public UserVariables(User owner, Map<String, Object> varList) {
|
||||||
super(owner);
|
super(owner);
|
||||||
this.variables = varList;
|
this.variables = varList;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A clone of all vars here.
|
* A clone of all vars here.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected UserVariables clone(User newOwner) {
|
protected UserVariables clone(User newOwner) {
|
||||||
|
@ -34,6 +37,7 @@ public class UserVariables extends Variables{
|
||||||
newOwner.flagAsChanged();
|
newOwner.flagAsChanged();
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the owner
|
* @return the owner
|
||||||
*/
|
*/
|
||||||
|
@ -41,5 +45,4 @@ public class UserVariables extends Variables{
|
||||||
public User getOwner() {
|
public User getOwner() {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
14
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
Normal file → Executable file
14
EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
Normal file → Executable file
|
@ -19,12 +19,14 @@ import java.util.Set;
|
||||||
* @author gabrielcouto
|
* @author gabrielcouto
|
||||||
*/
|
*/
|
||||||
public abstract class Variables implements Cloneable {
|
public abstract class Variables implements Cloneable {
|
||||||
|
|
||||||
private DataUnit owner;
|
private DataUnit owner;
|
||||||
protected Map<String, Object> variables = new HashMap<String, Object>();
|
protected Map<String, Object> variables = new HashMap<String, Object>();
|
||||||
|
|
||||||
public Variables(DataUnit owner){
|
public Variables(DataUnit owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add var to the the INFO node.
|
* Add var to the the INFO node.
|
||||||
* examples:
|
* examples:
|
||||||
|
@ -45,7 +47,7 @@ public abstract class Variables implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the object inside the var
|
* Returns the object inside the var
|
||||||
* @param name
|
* @param name
|
||||||
* @return a Object if exists. null if doesn't exists
|
* @return a Object if exists. null if doesn't exists
|
||||||
*/
|
*/
|
||||||
|
@ -112,7 +114,7 @@ public abstract class Variables implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All variable keys this is holding
|
* All variable keys this is holding
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<String> getVarKeyList() {
|
public Set<String> getVarKeyList() {
|
||||||
|
@ -122,7 +124,7 @@ public abstract class Variables implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* verify is a var exists
|
* verify is a var exists
|
||||||
* @param name the key name of the var
|
* @param name the key name of the var
|
||||||
* @return true if that var exists
|
* @return true if that var exists
|
||||||
*/
|
*/
|
||||||
|
@ -174,7 +176,7 @@ public abstract class Variables implements Cloneable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearVars(){
|
public void clearVars() {
|
||||||
variables.clear();
|
variables.clear();
|
||||||
owner.flagAsChanged();
|
owner.flagAsChanged();
|
||||||
}
|
}
|
||||||
|
@ -186,7 +188,7 @@ public abstract class Variables implements Cloneable {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty(){
|
public boolean isEmpty() {
|
||||||
return variables.isEmpty();
|
return variables.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
Normal file → Executable file
7
EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
Normal file → Executable file
|
@ -25,6 +25,7 @@ public class OverloadedWorldHolder extends WorldDataHolder {
|
||||||
*
|
*
|
||||||
* @param ph
|
* @param ph
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public OverloadedWorldHolder(WorldDataHolder ph) {
|
public OverloadedWorldHolder(WorldDataHolder ph) {
|
||||||
super(ph.getName());
|
super(ph.getName());
|
||||||
this.f = ph.f;
|
this.f = ph.f;
|
||||||
|
@ -135,7 +136,7 @@ public class OverloadedWorldHolder extends WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -185,7 +186,7 @@ public class OverloadedWorldHolder extends WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user in normal state. Surpassing the overload state.
|
* Gets the user in normal state. Surpassing the overload state.
|
||||||
* It doesn't affect permissions. But it enables plugins change the
|
* It doesn't affect permissions. But it enables plugins change the
|
||||||
* actual user permissions even in overload mode.
|
* actual user permissions even in overload mode.
|
||||||
* @param userName
|
* @param userName
|
||||||
|
@ -201,4 +202,4 @@ public class OverloadedWorldHolder extends WorldDataHolder {
|
||||||
User newUser = createUser(userName);
|
User newUser = createUser(userName);
|
||||||
return newUser;
|
return newUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,7 +42,7 @@ public class WorldDataHolder {
|
||||||
*/
|
*/
|
||||||
protected String name;
|
protected String name;
|
||||||
/**
|
/**
|
||||||
* The actual groups holder
|
* The actual groups holder
|
||||||
*/
|
*/
|
||||||
protected Map<String, Group> groups = new HashMap<String, Group>();
|
protected Map<String, Group> groups = new HashMap<String, Group>();
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +50,7 @@ public class WorldDataHolder {
|
||||||
*/
|
*/
|
||||||
protected Map<String, User> users = new HashMap<String, User>();
|
protected Map<String, User> users = new HashMap<String, User>();
|
||||||
/**
|
/**
|
||||||
* Points to the default group
|
* Points to the default group
|
||||||
*/
|
*/
|
||||||
protected Group defaultGroup = null;
|
protected Group defaultGroup = null;
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ public class WorldDataHolder {
|
||||||
protected boolean haveGroupsChanged = false;
|
protected boolean haveGroupsChanged = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent direct instantiation
|
* Prevent direct instantiation
|
||||||
* @param worldName
|
* @param worldName
|
||||||
*/
|
*/
|
||||||
protected WorldDataHolder(String worldName) {
|
protected WorldDataHolder(String worldName) {
|
||||||
|
@ -90,7 +90,7 @@ public class WorldDataHolder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main constructor for a new WorldDataHolder
|
* The main constructor for a new WorldDataHolder
|
||||||
* Please don't set the default group as null
|
* Please don't set the default group as null
|
||||||
* @param worldName
|
* @param worldName
|
||||||
* @param defaultGroup the default group. its good to start with one
|
* @param defaultGroup the default group. its good to start with one
|
||||||
*/
|
*/
|
||||||
|
@ -116,7 +116,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a user to the list. If it already exists, overwrite the old.
|
* Add a user to the list. If it already exists, overwrite the old.
|
||||||
* @param theUser the user you want to add to the permission list
|
* @param theUser the user you want to add to the permission list
|
||||||
*/
|
*/
|
||||||
public void addUser(User theUser) {
|
public void addUser(User theUser) {
|
||||||
|
@ -158,7 +158,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the default group of the file.
|
* Change the default group of the file.
|
||||||
* @param group the group you want make default.
|
* @param group the group you want make default.
|
||||||
*/
|
*/
|
||||||
public void setDefaultGroup(Group group) {
|
public void setDefaultGroup(Group group) {
|
||||||
|
@ -170,7 +170,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default group of the file
|
* Returns the default group of the file
|
||||||
* @return the default group
|
* @return the default group
|
||||||
*/
|
*/
|
||||||
public Group getDefaultGroup() {
|
public Group getDefaultGroup() {
|
||||||
|
@ -178,7 +178,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a group of the given name
|
* Returns a group of the given name
|
||||||
* @param groupName the name of the group
|
* @param groupName the name of the group
|
||||||
* @return a group if it is found. null if not found.
|
* @return a group if it is found. null if not found.
|
||||||
*/
|
*/
|
||||||
|
@ -187,7 +187,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a group exists.
|
* Check if a group exists.
|
||||||
* Its the same of getGroup, but check if it is null.
|
* Its the same of getGroup, but check if it is null.
|
||||||
* @param groupName the name of the group
|
* @param groupName the name of the group
|
||||||
* @return true if exists. false if not.
|
* @return true if exists. false if not.
|
||||||
|
@ -210,7 +210,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the group to the list
|
* Remove the group to the list
|
||||||
* @param groupName
|
* @param groupName
|
||||||
* @return true if had something to remove. false the group was default or non-existant
|
* @return true if had something to remove. false the group was default or non-existant
|
||||||
*/
|
*/
|
||||||
|
@ -277,7 +277,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads the file again
|
* reads the file again
|
||||||
*/
|
*/
|
||||||
public void reload() {
|
public void reload() {
|
||||||
try {
|
try {
|
||||||
|
@ -301,13 +301,14 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a data holder for the given file
|
* Returns a data holder for the given file
|
||||||
* @param worldName
|
* @param worldName
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static WorldDataHolder load(String worldName, File file) throws Exception {
|
public static WorldDataHolder load(String worldName, File file) throws Exception {
|
||||||
WorldDataHolder ph = new WorldDataHolder(worldName);
|
WorldDataHolder ph = new WorldDataHolder(worldName);
|
||||||
|
@ -387,7 +388,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
throw new Exception("Your Permissions config file is invalid. See console for details.");
|
throw new Exception("Your Permissions config file is invalid. See console for details.");
|
||||||
}
|
}
|
||||||
if (ph.defaultGroup == null) {
|
if (ph.defaultGroup == null) {
|
||||||
throw new IllegalArgumentException("There was no Default Group declared.");
|
throw new IllegalArgumentException("There was no Default Group declared.");
|
||||||
|
@ -409,7 +410,7 @@ public class WorldDataHolder {
|
||||||
User thisUser = ph.createUser(usersKey);
|
User thisUser = ph.createUser(usersKey);
|
||||||
if (thisUser == null) {
|
if (thisUser == null) {
|
||||||
GroupManager.logger.warning("I think this user was declared more than once: " + usersKey);
|
GroupManager.logger.warning("I think this user was declared more than once: " + usersKey);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (thisUserNode.get("permissions") == null) {
|
if (thisUserNode.get("permissions") == null) {
|
||||||
thisUserNode.put("permissions", new ArrayList<String>());
|
thisUserNode.put("permissions", new ArrayList<String>());
|
||||||
|
@ -436,8 +437,8 @@ public class WorldDataHolder {
|
||||||
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
|
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
|
||||||
if (hisGroup == null) {
|
if (hisGroup == null) {
|
||||||
GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName());
|
GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName());
|
||||||
thisUser.setGroup(ph.defaultGroup);
|
thisUser.setGroup(ph.defaultGroup);
|
||||||
}
|
}
|
||||||
thisUser.setGroup(hisGroup);
|
thisUser.setGroup(hisGroup);
|
||||||
} else {
|
} else {
|
||||||
thisUser.setGroup(ph.defaultGroup);
|
thisUser.setGroup(ph.defaultGroup);
|
||||||
|
@ -447,7 +448,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a data holder for the given file
|
* Returns a data holder for the given file
|
||||||
* @param worldName
|
* @param worldName
|
||||||
* @param groupsFile
|
* @param groupsFile
|
||||||
* @param usersFile
|
* @param usersFile
|
||||||
|
@ -455,6 +456,7 @@ public class WorldDataHolder {
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException {
|
public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException {
|
||||||
WorldDataHolder ph = new WorldDataHolder(worldName);
|
WorldDataHolder ph = new WorldDataHolder(worldName);
|
||||||
ph.groupsFile = groupsFile;
|
ph.groupsFile = groupsFile;
|
||||||
|
@ -539,7 +541,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
|
throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
|
||||||
}
|
}
|
||||||
if (ph.defaultGroup == null) {
|
if (ph.defaultGroup == null) {
|
||||||
throw new IllegalArgumentException("There was no Default Group declared.");
|
throw new IllegalArgumentException("There was no Default Group declared.");
|
||||||
|
@ -576,6 +578,11 @@ public class WorldDataHolder {
|
||||||
|
|
||||||
// PROCESS USERS FILE
|
// PROCESS USERS FILE
|
||||||
Map<String, Object> allUsersNode = (Map<String, Object>) usersRootDataNode.get("users");
|
Map<String, Object> allUsersNode = (Map<String, Object>) usersRootDataNode.get("users");
|
||||||
|
|
||||||
|
// Stop loading if the file is empty
|
||||||
|
if (allUsersNode == null)
|
||||||
|
return ph;
|
||||||
|
|
||||||
for (String usersKey : allUsersNode.keySet()) {
|
for (String usersKey : allUsersNode.keySet()) {
|
||||||
Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
|
Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
|
||||||
User thisUser = ph.createUser(usersKey);
|
User thisUser = ph.createUser(usersKey);
|
||||||
|
@ -628,7 +635,9 @@ public class WorldDataHolder {
|
||||||
if (thisUserNode.get("group") != null) {
|
if (thisUserNode.get("group") != null) {
|
||||||
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
|
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
|
||||||
if (hisGroup == null) {
|
if (hisGroup == null) {
|
||||||
throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName());
|
GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "'.");
|
||||||
|
hisGroup = ph.defaultGroup;
|
||||||
|
//throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName());
|
||||||
}
|
}
|
||||||
thisUser.setGroup(hisGroup);
|
thisUser.setGroup(hisGroup);
|
||||||
} else {
|
} else {
|
||||||
|
@ -639,7 +648,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a dataHolder in a specified file
|
* Write a dataHolder in a specified file
|
||||||
* @param ph
|
* @param ph
|
||||||
* @param file
|
* @param file
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
@ -726,7 +735,7 @@ public class WorldDataHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a dataHolder in a specified file
|
* Write a dataHolder in a specified file
|
||||||
* @param ph
|
* @param ph
|
||||||
* @param groupsFile
|
* @param groupsFile
|
||||||
*/
|
*/
|
||||||
|
@ -761,28 +770,28 @@ public class WorldDataHolder {
|
||||||
DumperOptions opt = new DumperOptions();
|
DumperOptions opt = new DumperOptions();
|
||||||
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||||
final Yaml yaml = new Yaml(opt);
|
final Yaml yaml = new Yaml(opt);
|
||||||
try {
|
try {
|
||||||
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
|
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
|
||||||
} catch (UnsupportedEncodingException ex) {
|
} catch (UnsupportedEncodingException ex) {
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*FileWriter tx = null;
|
/*FileWriter tx = null;
|
||||||
try {
|
try {
|
||||||
tx = new FileWriter(groupsFile, false);
|
tx = new FileWriter(groupsFile, false);
|
||||||
tx.write(yaml.dump(root));
|
tx.write(yaml.dump(root));
|
||||||
tx.flush();
|
tx.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
tx.close();
|
tx.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a dataHolder in a specified file
|
* Write a dataHolder in a specified file
|
||||||
* @param ph
|
* @param ph
|
||||||
* @param usersFile
|
* @param usersFile
|
||||||
*/
|
*/
|
||||||
|
@ -823,22 +832,22 @@ public class WorldDataHolder {
|
||||||
DumperOptions opt = new DumperOptions();
|
DumperOptions opt = new DumperOptions();
|
||||||
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||||
final Yaml yaml = new Yaml(opt);
|
final Yaml yaml = new Yaml(opt);
|
||||||
try {
|
try {
|
||||||
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
|
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
|
||||||
} catch (UnsupportedEncodingException ex) {
|
} catch (UnsupportedEncodingException ex) {
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
}
|
}
|
||||||
/*FileWriter tx = null;
|
/*FileWriter tx = null;
|
||||||
try {
|
try {
|
||||||
tx = new FileWriter(usersFile, false);
|
tx = new FileWriter(usersFile, false);
|
||||||
tx.write(yaml.dump(root));
|
tx.write(yaml.dump(root));
|
||||||
tx.flush();
|
tx.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
tx.close();
|
tx.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class WorldsHolder {
|
||||||
* Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName>
|
* Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName>
|
||||||
* The key is the mirror.
|
* The key is the mirror.
|
||||||
* The object is the mirrored.
|
* The object is the mirrored.
|
||||||
*
|
*
|
||||||
* Mirror shows the same data of mirrored.
|
* Mirror shows the same data of mirrored.
|
||||||
*/
|
*/
|
||||||
private Map<String, String> mirrors = new HashMap<String, String>();
|
private Map<String, String> mirrors = new HashMap<String, String>();
|
||||||
|
@ -63,7 +63,8 @@ public class WorldsHolder {
|
||||||
initialWorldLoading();
|
initialWorldLoading();
|
||||||
mirrorSetUp();
|
mirrorSetUp();
|
||||||
}
|
}
|
||||||
private void initialWorldLoading(){
|
|
||||||
|
private void initialWorldLoading() {
|
||||||
//LOAD EVERY WORLD POSSIBLE
|
//LOAD EVERY WORLD POSSIBLE
|
||||||
loadWorld(serverDefaultWorldName);
|
loadWorld(serverDefaultWorldName);
|
||||||
defaultWorld = worldsData.get(serverDefaultWorldName);
|
defaultWorld = worldsData.get(serverDefaultWorldName);
|
||||||
|
@ -77,7 +78,9 @@ public class WorldsHolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void mirrorSetUp(){
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public void mirrorSetUp() {
|
||||||
mirrors.clear();
|
mirrors.clear();
|
||||||
Map<String, Object> mirrorsMap = plugin.getConfig().getMirrorsMap();
|
Map<String, Object> mirrorsMap = plugin.getConfig().getMirrorsMap();
|
||||||
if (mirrorsMap != null) {
|
if (mirrorsMap != null) {
|
||||||
|
@ -122,7 +125,7 @@ public class WorldsHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void saveChanges() {
|
public void saveChanges() {
|
||||||
ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>();
|
ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>();
|
||||||
|
@ -136,7 +139,7 @@ public class WorldsHolder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (w.haveGroupsChanged()) {
|
if (w.haveGroupsChanged()) {
|
||||||
String groupsFolderName = w.getGroupsFile().getParentFile().getName();
|
//String groupsFolderName = w.getGroupsFile().getParentFile().getName();
|
||||||
File backupGroups = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + "_g_" + Tasks.getDateString() + ".yml");
|
File backupGroups = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + "_g_" + Tasks.getDateString() + ".yml");
|
||||||
try {
|
try {
|
||||||
Tasks.copy(w.getGroupsFile(), backupGroups);
|
Tasks.copy(w.getGroupsFile(), backupGroups);
|
||||||
|
@ -262,7 +265,7 @@ public class WorldsHolder {
|
||||||
File groupsFile = new File(defaultWorldFolder, "groups.yml");
|
File groupsFile = new File(defaultWorldFolder, "groups.yml");
|
||||||
File usersFile = new File(defaultWorldFolder, "users.yml");
|
File usersFile = new File(defaultWorldFolder, "users.yml");
|
||||||
File oldDataFile = new File(plugin.getDataFolder(), "data.yml");
|
File oldDataFile = new File(plugin.getDataFolder(), "data.yml");
|
||||||
if (!groupsFile.exists()) {
|
if (!groupsFile.exists() || groupsFile.length() == 0) {
|
||||||
if (oldDataFile.exists()) {
|
if (oldDataFile.exists()) {
|
||||||
try {
|
try {
|
||||||
Tasks.copy(oldDataFile, groupsFile);
|
Tasks.copy(oldDataFile, groupsFile);
|
||||||
|
@ -278,7 +281,7 @@ public class WorldsHolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!usersFile.exists()) {
|
if (!usersFile.exists() || usersFile.length() == 0) {
|
||||||
if (oldDataFile.exists()) {
|
if (oldDataFile.exists()) {
|
||||||
try {
|
try {
|
||||||
Tasks.copy(oldDataFile, usersFile);
|
Tasks.copy(oldDataFile, usersFile);
|
||||||
|
@ -368,7 +371,7 @@ public class WorldsHolder {
|
||||||
GroupManager.logger.log(Level.SEVERE, null, ex);
|
GroupManager.logger.log(Level.SEVERE, null, ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GroupManager.logger.severe("Failed to load world " + worldName + "...");
|
//GroupManager.logger.severe("Failed to load world " + worldName + "...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +379,7 @@ public class WorldsHolder {
|
||||||
* Tells if the such world has been mapped.
|
* Tells if the such world has been mapped.
|
||||||
*
|
*
|
||||||
* It will return true if world is a mirror.
|
* It will return true if world is a mirror.
|
||||||
*
|
*
|
||||||
* @param worldName
|
* @param worldName
|
||||||
* @return true if world is loaded or mirrored. false if not listed
|
* @return true if world is loaded or mirrored. false if not listed
|
||||||
*/
|
*/
|
||||||
|
|
204
EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
Normal file → Executable file
204
EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
Normal file → Executable file
|
@ -13,10 +13,11 @@ import org.anjocaido.groupmanager.data.Group;
|
||||||
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
||||||
|
import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Everything here maintains the model created by Nijikokun
|
* Everything here maintains the model created by Nijikokun
|
||||||
*
|
*
|
||||||
* But implemented to use GroupManager system. Which provides instant changes,
|
* But implemented to use GroupManager system. Which provides instant changes,
|
||||||
* without file access.
|
* without file access.
|
||||||
|
@ -49,7 +50,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a player can use that permission node.
|
* Checks if a player can use that permission node.
|
||||||
* @param player
|
* @param player
|
||||||
* @param permission
|
* @param permission
|
||||||
* @return
|
* @return
|
||||||
|
@ -59,6 +60,16 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
return checkUserPermission(ph.getUser(player.getName()), permission);
|
return checkUserPermission(ph.getUser(player.getName()), permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a player can use that permission node.
|
||||||
|
* @param playerName
|
||||||
|
* @param permission
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean permission(String playerName, String permission) {
|
||||||
|
return checkUserPermission(ph.getUser(playerName), permission);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the group of that player name.
|
* Returns the name of the group of that player name.
|
||||||
* @param userName
|
* @param userName
|
||||||
|
@ -70,7 +81,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if player is in suck group.
|
* Verify if player is in suck group.
|
||||||
* It will check it's groups inheritance.
|
* It will check it's groups inheritance.
|
||||||
*
|
*
|
||||||
* So if you have a group Admin > Moderator
|
* So if you have a group Admin > Moderator
|
||||||
|
@ -98,6 +109,75 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the appropriate prefix for the user.
|
||||||
|
* This method is a utility method for chat plugins to get the user's prefix
|
||||||
|
* without having to look at every one of the user's ancestors.
|
||||||
|
* Returns an empty string if user has no parent groups.
|
||||||
|
* @param user Player's name
|
||||||
|
* @return Player's prefix
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getUserPrefix(String user) {
|
||||||
|
|
||||||
|
String prefix = ph.getUser(user).getVariables().getVarString("prefix");
|
||||||
|
if (prefix.length() != 0) {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getGroupPrefix(getGroup(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the appropriate prefix for the user.
|
||||||
|
* This method is a utility method for chat plugins to get the user's prefix
|
||||||
|
* without having to look at every one of the user's ancestors.
|
||||||
|
* Returns an empty string if user has no parent groups.
|
||||||
|
* @param user Player's name
|
||||||
|
* @return Player's prefix
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getUserSuffix(String user) {
|
||||||
|
|
||||||
|
String suffix = ph.getUser(user).getVariables().getVarString("suffix");
|
||||||
|
if (suffix.length() != 0) {
|
||||||
|
return suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getGroupSuffix(getGroup(user));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets name of the primary group of the user.
|
||||||
|
* Returns the name of the default group if user has no parent groups,
|
||||||
|
* or "Default" if there is no default group for that world.
|
||||||
|
* @param user Player's name
|
||||||
|
* @return Name of player's primary group
|
||||||
|
*/
|
||||||
|
public String getPrimaryGroup(String user) {
|
||||||
|
|
||||||
|
return getGroup(user);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if user can build.
|
||||||
|
* @param world Player's world
|
||||||
|
* @param user Player's name
|
||||||
|
* @return Whether the user can build
|
||||||
|
*/
|
||||||
|
public boolean canUserBuild(String user) {
|
||||||
|
boolean test = ph.getUser(user).getVariables().getVarBoolean("build");
|
||||||
|
|
||||||
|
if (test) {
|
||||||
|
return test;
|
||||||
|
}
|
||||||
|
|
||||||
|
return canGroupBuild(getGroup(user));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the String prefix for the given group
|
* Returns the String prefix for the given group
|
||||||
* @param groupName
|
* @param groupName
|
||||||
|
@ -107,7 +187,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
public String getGroupPrefix(String groupName) {
|
public String getGroupPrefix(String groupName) {
|
||||||
Group g = ph.getGroup(groupName);
|
Group g = ph.getGroup(groupName);
|
||||||
if (g == null) {
|
if (g == null) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
return g.getVariables().getVarString("prefix");
|
return g.getVariables().getVarString("prefix");
|
||||||
}
|
}
|
||||||
|
@ -121,7 +201,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
public String getGroupSuffix(String groupName) {
|
public String getGroupSuffix(String groupName) {
|
||||||
Group g = ph.getGroup(groupName);
|
Group g = ph.getGroup(groupName);
|
||||||
if (g == null) {
|
if (g == null) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
return g.getVariables().getVarString("suffix");
|
return g.getVariables().getVarString("suffix");
|
||||||
}
|
}
|
||||||
|
@ -161,7 +241,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It returns a Integer variable value
|
* It returns a Integer variable value
|
||||||
* It will harvest inheritance for value.
|
* It will harvest inheritance for value.
|
||||||
* @param groupName
|
* @param groupName
|
||||||
* @param variable
|
* @param variable
|
||||||
|
@ -619,8 +699,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean checkGroupPermissionWithInheritance(Group start, String permission, List<Group> alreadyChecked) {
|
public boolean checkGroupPermissionWithInheritance(Group start, String permission, List<Group> alreadyChecked) {
|
||||||
PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission);
|
PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission);
|
||||||
if (result.resultType.equals(result.resultType.EXCEPTION)
|
if (result.resultType.equals(Type.EXCEPTION)
|
||||||
|| result.resultType.equals(result.resultType.FOUND)) {
|
|| result.resultType.equals(Type.FOUND)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -682,8 +762,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Group nextGroupWithPermission(Group start, String permission, List<Group> alreadyChecked) {
|
public Group nextGroupWithPermission(Group start, String permission, List<Group> alreadyChecked) {
|
||||||
PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission);
|
PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission);
|
||||||
if (result.resultType.equals(result.resultType.EXCEPTION)
|
if (result.resultType.equals(Type.EXCEPTION)
|
||||||
|| result.resultType.equals(result.resultType.FOUND)) {
|
|| result.resultType.equals(Type.FOUND)) {
|
||||||
return (Group) checkGroupPermissionWithInheritance(start, permission).owner;
|
return (Group) checkGroupPermissionWithInheritance(start, permission).owner;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -699,7 +779,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
* @param start
|
* @param start
|
||||||
* @param alreadyChecked
|
* @param alreadyChecked
|
||||||
* @return the group that passed on test. null if no group passed.
|
* @return the group that passed on test. null if no group passed.
|
||||||
* @deprecated use the other method with same name, instead
|
* @deprecated use the other method with same name, instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ArrayList<String> listAllGroupsInherited(Group start, ArrayList<String> alreadyChecked) {
|
public ArrayList<String> listAllGroupsInherited(Group start, ArrayList<String> alreadyChecked) {
|
||||||
|
@ -807,9 +887,10 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
* @param userName
|
* @param userName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getGroups(String userName) {
|
public String[] getGroups(String userName) {
|
||||||
ArrayList<String> allGroups = listAllGroupsInherited(ph.getUser(userName).getGroup());
|
ArrayList<String> allGroups = listAllGroupsInherited(ph.getUser(userName).getGroup());
|
||||||
for(Group subg: ph.getUser(userName).subGroupListCopy()){
|
for (Group subg : ph.getUser(userName).subGroupListCopy()) {
|
||||||
allGroups.addAll(listAllGroupsInherited(subg));
|
allGroups.addAll(listAllGroupsInherited(subg));
|
||||||
}
|
}
|
||||||
String[] arr = new String[allGroups.size()];
|
String[] arr = new String[allGroups.size()];
|
||||||
|
@ -825,6 +906,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
* @param targerPermission
|
* @param targerPermission
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private Group breadthFirstSearch(Group start, String targerPermission) {
|
private Group breadthFirstSearch(Group start, String targerPermission) {
|
||||||
if (start == null || targerPermission == null) {
|
if (start == null || targerPermission == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -853,4 +935,102 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getDefaultGroup() {
|
||||||
|
return ph.getDefaultGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInfoString(String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
if (isGroup) {
|
||||||
|
Group data = ph.getGroup(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarString(path);
|
||||||
|
} else {
|
||||||
|
User data = ph.getUser(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarString(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInfoInteger(String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
if (isGroup) {
|
||||||
|
Group data = ph.getGroup(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarInteger(path);
|
||||||
|
} else {
|
||||||
|
User data = ph.getUser(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarInteger(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getInfoDouble(String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
if (isGroup) {
|
||||||
|
Group data = ph.getGroup(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarDouble(path);
|
||||||
|
} else {
|
||||||
|
User data = ph.getUser(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarDouble(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getInfoBoolean(String entryName, String path,
|
||||||
|
boolean isGroup) {
|
||||||
|
if (isGroup) {
|
||||||
|
Group data = ph.getGroup(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarBoolean(path);
|
||||||
|
} else {
|
||||||
|
User data = ph.getUser(entryName);
|
||||||
|
if (data == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return data.getVariables().getVarBoolean(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addUserInfo(String name, String path, Object data) {
|
||||||
|
ph.getUser(name).getVariables().addVar(path, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeUserInfo(String name, String path) {
|
||||||
|
ph.getUser(name).getVariables().removeVar(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addGroupInfo(String name, String path, Object data) {
|
||||||
|
ph.getGroup(name).getVariables().addVar(path, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeGroupInfo(String name, String path) {
|
||||||
|
ph.getGroup(name).getVariables().removeVar(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,227 @@
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.anjocaido.groupmanager.permissions;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
|
import org.anjocaido.groupmanager.data.User;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
import org.bukkit.event.server.PluginDisableEvent;
|
||||||
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
import org.bukkit.event.server.ServerListener;
|
||||||
|
import org.bukkit.permissions.Permission;
|
||||||
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* BukkitPermissions overrides to force GM reponses to Superperms
|
||||||
|
*
|
||||||
|
* @author ElgarL, based upon PermissionsEX implementation
|
||||||
|
*/
|
||||||
|
public class BukkitPermissions {
|
||||||
|
|
||||||
|
protected Map<Player, PermissionAttachment> attachments = new HashMap<Player, PermissionAttachment>();
|
||||||
|
protected Set<Permission> registeredPermissions = new HashSet<Permission>();
|
||||||
|
protected Plugin plugin;
|
||||||
|
protected boolean dumpAllPermissions = true;
|
||||||
|
protected boolean dumpMatchedPermissions = true;
|
||||||
|
public boolean player_join = false;
|
||||||
|
|
||||||
|
public BukkitPermissions(Plugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
|
||||||
|
this.collectPermissions();
|
||||||
|
this.registerEvents();
|
||||||
|
|
||||||
|
this.updateAllPlayers();
|
||||||
|
|
||||||
|
GroupManager.logger.info("Superperms support enabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerEvents() {
|
||||||
|
PluginManager manager = plugin.getServer().getPluginManager();
|
||||||
|
|
||||||
|
PlayerEvents playerEventListener = new PlayerEvents();
|
||||||
|
|
||||||
|
manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Normal, plugin);
|
||||||
|
manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Normal, plugin);
|
||||||
|
manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Normal, plugin);
|
||||||
|
|
||||||
|
manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Normal, plugin);
|
||||||
|
manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Normal, plugin);
|
||||||
|
manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Normal, plugin);
|
||||||
|
|
||||||
|
ServerListener serverListener = new BukkitEvents();
|
||||||
|
|
||||||
|
manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin);
|
||||||
|
manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void collectPermissions() {
|
||||||
|
registeredPermissions.clear();
|
||||||
|
for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) {
|
||||||
|
registeredPermissions.addAll(bukkitPlugin.getDescription().getPermissions());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePermissions(Player player){
|
||||||
|
this.updatePermissions(player, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePermissions(Player player, String world) {
|
||||||
|
if (player == null || !this.plugin.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.attachments.containsKey(player)) {
|
||||||
|
this.attachments.put(player, player.addAttachment(plugin));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(world == null){
|
||||||
|
world = player.getWorld().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
PermissionAttachment attachment = this.attachments.get(player);
|
||||||
|
|
||||||
|
User user = GroupManager.getWorldsHolder().getWorldData(world).getUser(player.getName());
|
||||||
|
List<String> permissions = user.getGroup().getPermissionList();
|
||||||
|
|
||||||
|
// clear permissions
|
||||||
|
for (String permission : attachment.getPermissions().keySet()) {
|
||||||
|
attachment.unsetPermission(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
// find matching permissions
|
||||||
|
for (Permission permission : registeredPermissions) {
|
||||||
|
boolean permissionValue = user.getGroup().hasSamePermissionNode(permission.getName());
|
||||||
|
attachment.setPermission(permission, permissionValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// all permissions
|
||||||
|
for (String permission : permissions) {
|
||||||
|
Boolean value = true;
|
||||||
|
if (permission.startsWith("-")) {
|
||||||
|
permission = permission.substring(1); // cut off -
|
||||||
|
value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!attachment.getPermissions().containsKey(permission)) {
|
||||||
|
attachment.setPermission(permission, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.recalculatePermissions();
|
||||||
|
/*
|
||||||
|
// List perms for this player
|
||||||
|
GroupManager.logger.info("Attachment Permissions:");
|
||||||
|
for(Map.Entry<String, Boolean> entry : attachment.getPermissions().entrySet()){
|
||||||
|
GroupManager.logger.info(" " + entry.getKey() + " = " + entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupManager.logger.info("Effective Permissions:");
|
||||||
|
for(PermissionAttachmentInfo info : player.getEffectivePermissions()){
|
||||||
|
GroupManager.logger.info(" " + info.getPermission() + " = " + info.getValue());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAllPlayers() {
|
||||||
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
updatePermissions(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class PlayerEvents extends PlayerListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
player_join = true;
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
//force GM to create the player if they are not already listed.
|
||||||
|
if (GroupManager.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
|
||||||
|
player_join = false;
|
||||||
|
updatePermissions(event.getPlayer());
|
||||||
|
} else
|
||||||
|
player_join = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
|
||||||
|
if(event.getPlayer().getWorld().equals(event.getTo().getWorld())){ // only if world actually changed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
|
||||||
|
updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
|
||||||
|
if (!event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
|
||||||
|
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
attachments.remove(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerKick(PlayerKickEvent event) {
|
||||||
|
attachments.remove(event.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class BukkitEvents extends ServerListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
|
collectPermissions();
|
||||||
|
updateAllPlayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginDisable(PluginDisableEvent event) {
|
||||||
|
collectPermissions();
|
||||||
|
updateAllPlayers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
77
EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
Normal file → Executable file
77
EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
Normal file → Executable file
|
@ -1,10 +1,15 @@
|
||||||
package org.anjocaido.groupmanager.permissions;
|
package org.anjocaido.groupmanager.permissions;
|
||||||
|
|
||||||
|
//import java.util.Collection;
|
||||||
|
//import java.util.Map;
|
||||||
|
//import java.util.Set;
|
||||||
|
import org.anjocaido.groupmanager.data.Group;
|
||||||
|
//import org.anjocaido.groupmanager.data.User;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Made by Nijikokun. Changed by Gabriel Couto
|
* Made by Nijikokun. Changed by Gabriel Couto
|
||||||
*
|
*
|
||||||
* This class is intended to *read* permissions from a single world.
|
* This class is intended to *read* permissions from a single world.
|
||||||
*
|
*
|
||||||
* @author Nijikokun
|
* @author Nijikokun
|
||||||
|
@ -12,7 +17,6 @@ import org.bukkit.entity.Player;
|
||||||
*/
|
*/
|
||||||
public abstract class PermissionsReaderInterface {
|
public abstract class PermissionsReaderInterface {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
|
@ -90,7 +94,7 @@ public abstract class PermissionsReaderInterface {
|
||||||
public abstract boolean getGroupPermissionBoolean(String string, String string1);
|
public abstract boolean getGroupPermissionBoolean(String string, String string1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
* @param string1
|
* @param string1
|
||||||
* @return
|
* @return
|
||||||
|
@ -160,4 +164,69 @@ public abstract class PermissionsReaderInterface {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract double getPermissionDouble(String string, String string1);
|
public abstract double getPermissionDouble(String string, String string1);
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
/**
|
||||||
|
* Gets the appropriate prefix for the user.
|
||||||
|
* This method is a utility method for chat plugins to get the user's prefix
|
||||||
|
* without having to look at every one of the user's ancestors.
|
||||||
|
* Returns an empty string if user has no parent groups.
|
||||||
|
* @param world Player's world
|
||||||
|
* @param user Player's name
|
||||||
|
* @return Player's prefix
|
||||||
|
*/
|
||||||
|
public abstract String getUserPrefix(String user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the appropriate suffix for the user.
|
||||||
|
* This method is a utility method for chat plugins to get the user's suffix
|
||||||
|
* without having to look at every one of the user's ancestors.
|
||||||
|
* Returns an empty string if user has no parent groups.
|
||||||
|
* @param world Player's world
|
||||||
|
* @param user Player's name
|
||||||
|
* @return Player's suffix
|
||||||
|
*/
|
||||||
|
public abstract String getUserSuffix(String user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the group object representing the default group of the given world.
|
||||||
|
* This method will return null if the object does not exist or the world has no default group.
|
||||||
|
* @return Group object representing default world, or null if it doesn't exist or is not defined.
|
||||||
|
*/
|
||||||
|
public abstract Group getDefaultGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a array of the names of all parent groups in the same world.
|
||||||
|
* @param name Target user's name
|
||||||
|
* @return An array containing the names of all parent groups (including ancestors) that are in the same world
|
||||||
|
*/
|
||||||
|
public abstract String[] getGroups(String name);
|
||||||
|
|
||||||
|
public abstract String getInfoString(String entryName, String path, boolean isGroup);
|
||||||
|
//public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator);
|
||||||
|
|
||||||
|
public abstract int getInfoInteger(String entryName, String path, boolean isGroup);
|
||||||
|
//public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a double from the Info node without inheritance.
|
||||||
|
* @param entryName
|
||||||
|
* @param path
|
||||||
|
* @param isGroup
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public abstract double getInfoDouble(String entryName, String path, boolean isGroup);
|
||||||
|
//public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator);
|
||||||
|
|
||||||
|
public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup);
|
||||||
|
//public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator);
|
||||||
|
|
||||||
|
public abstract void addUserInfo(String name, String path, Object data);
|
||||||
|
|
||||||
|
public abstract void removeUserInfo(String name, String path);
|
||||||
|
|
||||||
|
public abstract void addGroupInfo(String name, String path, Object data);
|
||||||
|
|
||||||
|
public abstract void removeGroupInfo(String name, String path);
|
||||||
|
//////////////////////////////
|
||||||
}
|
}
|
||||||
|
|
0
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
Normal file → Executable file
0
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
Normal file → Executable file
1
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
Normal file → Executable file
1
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
Normal file → Executable file
|
@ -9,6 +9,7 @@ package org.anjocaido.groupmanager.utils;
|
||||||
* @author gabrielcouto
|
* @author gabrielcouto
|
||||||
*/
|
*/
|
||||||
public enum GroupManagerPermissions {
|
public enum GroupManagerPermissions {
|
||||||
|
|
||||||
manuadd,
|
manuadd,
|
||||||
manudel,
|
manudel,
|
||||||
manuaddsub,
|
manuaddsub,
|
||||||
|
|
1
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
Normal file → Executable file
1
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
Normal file → Executable file
|
@ -11,6 +11,7 @@ import org.anjocaido.groupmanager.data.DataUnit;
|
||||||
* @author gabrielcouto
|
* @author gabrielcouto
|
||||||
*/
|
*/
|
||||||
public class PermissionCheckResult {
|
public class PermissionCheckResult {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It should be the owner of the access level found.
|
* It should be the owner of the access level found.
|
||||||
*
|
*
|
||||||
|
|
19
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
Normal file → Executable file
19
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
Normal file → Executable file
|
@ -2,7 +2,6 @@
|
||||||
* To change this template, choose Tools | Templates
|
* To change this template, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.anjocaido.groupmanager.utils;
|
package org.anjocaido.groupmanager.utils;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -19,32 +18,32 @@ public class StringPermissionComparator implements Comparator<String> {
|
||||||
boolean bp = permB.startsWith("+");
|
boolean bp = permB.startsWith("+");
|
||||||
boolean am = permA.startsWith("-");
|
boolean am = permA.startsWith("-");
|
||||||
boolean bm = permB.startsWith("-");
|
boolean bm = permB.startsWith("-");
|
||||||
if(ap&&bp){
|
if (ap && bp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(ap&&!bp){
|
if (ap && !bp) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!ap&&bp){
|
if (!ap && bp) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(am&&bm){
|
if (am && bm) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(am&&!bm){
|
if (am && !bm) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!am&&bm){
|
if (!am && bm) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return permA.compareToIgnoreCase(permB);
|
return permA.compareToIgnoreCase(permB);
|
||||||
}
|
}
|
||||||
private static StringPermissionComparator instance;
|
private static StringPermissionComparator instance;
|
||||||
public static StringPermissionComparator getInstance(){
|
|
||||||
if(instance==null){
|
public static StringPermissionComparator getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
instance = new StringPermissionComparator();
|
instance = new StringPermissionComparator();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
53
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
Normal file → Executable file
53
EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
Normal file → Executable file
|
@ -10,7 +10,7 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.anjocaido.groupmanager.data.Group;
|
import org.anjocaido.groupmanager.data.Group;
|
||||||
|
@ -62,48 +62,51 @@ public abstract class Tasks {
|
||||||
public static String getDateString() {
|
public static String getDateString() {
|
||||||
GregorianCalendar now = new GregorianCalendar();
|
GregorianCalendar now = new GregorianCalendar();
|
||||||
String date = "";
|
String date = "";
|
||||||
date += now.get(GregorianCalendar.DAY_OF_MONTH);
|
date += now.get(Calendar.DAY_OF_MONTH);
|
||||||
date += "-";
|
date += "-";
|
||||||
date += now.get(GregorianCalendar.HOUR);
|
date += now.get(Calendar.HOUR);
|
||||||
date += "-";
|
date += "-";
|
||||||
date += now.get(GregorianCalendar.MINUTE);
|
date += now.get(Calendar.MINUTE);
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
public static String getStringListInString(List<String> list){
|
|
||||||
if(list==null){
|
public static String getStringListInString(List<String> list) {
|
||||||
|
if (list == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String result="";
|
String result = "";
|
||||||
for(int i=0;i<list.size();i++){
|
for (int i = 0; i < list.size(); i++) {
|
||||||
result+=list.get(i);
|
result += list.get(i);
|
||||||
if(i<list.size()-1){
|
if (i < list.size() - 1) {
|
||||||
result+=", ";
|
result += ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public static String getStringArrayInString(String[] list){
|
|
||||||
if(list==null){
|
public static String getStringArrayInString(String[] list) {
|
||||||
|
if (list == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String result="";
|
String result = "";
|
||||||
for(int i=0;i<list.length;i++){
|
for (int i = 0; i < list.length; i++) {
|
||||||
result+=list[i];
|
result += list[i];
|
||||||
if(i<((list.length)-1)){
|
if (i < ((list.length) - 1)) {
|
||||||
result+=", ";
|
result += ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public static String getGroupListInString(List<Group> list){
|
|
||||||
if(list==null){
|
public static String getGroupListInString(List<Group> list) {
|
||||||
|
if (list == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String result="";
|
String result = "";
|
||||||
for(int i=0;i<list.size();i++){
|
for (int i = 0; i < list.size(); i++) {
|
||||||
result+=list.get(i).getName();
|
result += list.get(i).getName();
|
||||||
if(i<list.size()-1){
|
if (i < list.size() - 1) {
|
||||||
result+=", ";
|
result += ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
name: GroupManager
|
name: GroupManager
|
||||||
version: "1.0(alpha-5) [Zombie-Version]"
|
version: "1.1 (Phoenix)"
|
||||||
main: org.anjocaido.groupmanager.GroupManager
|
main: org.anjocaido.groupmanager.GroupManager
|
||||||
website: http://www.anjocaido.info/
|
website: http://www.anjocaido.info/
|
||||||
description: Provides on-the-fly system for Permission system created by Nijikokun. But all in memory, and with flat-file saving schedule.
|
description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule.
|
||||||
authors:
|
authors:
|
||||||
- AnjoCaido
|
- AnjoCaido
|
||||||
- Gabriel Couto
|
- Gabriel Couto
|
||||||
|
@ -10,156 +10,156 @@ commands:
|
||||||
manuadd:
|
manuadd:
|
||||||
description: Move a player to desired group.(Adds to the file if not exists)
|
description: Move a player to desired group.(Adds to the file if not exists)
|
||||||
usage: /<command> <player> <group>
|
usage: /<command> <player> <group>
|
||||||
permission: groupmanager.manuadd
|
permissions: groupmanager.manuadd
|
||||||
manudel:
|
manudel:
|
||||||
description: Remove any user specific configuration. Make him default group.
|
description: Remove any user specific configuration. Make him default group.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
permission: groupmanager.manudel
|
permissions: groupmanager.manudel
|
||||||
manuaddsub:
|
manuaddsub:
|
||||||
description: Add a group to a player's subgroup list.
|
description: Add a group to a player's subgroup list.
|
||||||
usage: /<command> <player> <group>
|
usage: /<command> <player> <group>
|
||||||
permission: groupmanager.manuaddsub
|
permissions: groupmanager.manuaddsub
|
||||||
manudelsub:
|
manudelsub:
|
||||||
description: Remove a group to a player's subgroup list.
|
description: Remove a group to a player's subgroup list.
|
||||||
usage: /<command> <player> <group>
|
usage: /<command> <player> <group>
|
||||||
permission: groupmanager.manudelsub
|
permissions: groupmanager.manudelsub
|
||||||
mangadd:
|
mangadd:
|
||||||
description: Add group to the system.
|
description: Add group to the system.
|
||||||
usage: /<command> <group>
|
usage: /<command> <group>
|
||||||
permission: groupmanager.mangadd
|
permissions: groupmanager.mangadd
|
||||||
mangdel:
|
mangdel:
|
||||||
description: Removes group from the system(all it's users become default)
|
description: Removes group from the system(all it's users become default)
|
||||||
usage: /<command> <group>
|
usage: /<command> <group>
|
||||||
permission: groupmanager.mangdel
|
permissions: groupmanager.mangdel
|
||||||
manuaddp:
|
manuaddp:
|
||||||
description: Add permission diretly to the player.
|
description: Add permissions diretly to the player.
|
||||||
usage: /<command> <player> <permission>
|
usage: /<command> <player> <permissions>
|
||||||
permission: groupmanager.manuaddp
|
permissions: groupmanager.manuaddp
|
||||||
manudelp:
|
manudelp:
|
||||||
description: Removes permission diretly from the player.
|
description: Removes permissions diretly from the player.
|
||||||
usage: /<command> <player> <permission>
|
usage: /<command> <player> <permissions>
|
||||||
permission: groupmanager.manudelp
|
permissions: groupmanager.manudelp
|
||||||
manulistp:
|
manulistp:
|
||||||
description: List all permissions from a player.
|
description: List all permissionss from a player.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
permission: groupmanager.manulistp
|
permissions: groupmanager.manulistp
|
||||||
manucheckp:
|
manucheckp:
|
||||||
description: Verify if user has a permission, and where it comes from.
|
description: Verify if user has a permissions, and where it comes from.
|
||||||
usage: /<command> <player> <permission>
|
usage: /<command> <player> <permissions>
|
||||||
permission: groupmanager.manucheckp
|
permissions: groupmanager.manucheckp
|
||||||
mangaddp:
|
mangaddp:
|
||||||
description: Add permission to a group.
|
description: Add permissions to a group.
|
||||||
usage: /<command> <group> <permission>
|
usage: /<command> <group> <permissions>
|
||||||
permission: groupmanager.mangaddp
|
permissions: groupmanager.mangaddp
|
||||||
mangdelp:
|
mangdelp:
|
||||||
description: Removes permission from a group.
|
description: Removes permissions from a group.
|
||||||
usage: /<command> <group> <permission>
|
usage: /<command> <group> <permissions>
|
||||||
permission: groupmanager.mangdelp
|
permissions: groupmanager.mangdelp
|
||||||
manglistp:
|
manglistp:
|
||||||
description: Lists all permissions from a group.
|
description: Lists all permissionss from a group.
|
||||||
usage: /<command> <group>
|
usage: /<command> <group>
|
||||||
permission: groupmanager.manglistp
|
permissions: groupmanager.manglistp
|
||||||
mangcheckp:
|
mangcheckp:
|
||||||
description: Check if group has a permission, and where it comes from.
|
description: Check if group has a permissions, and where it comes from.
|
||||||
usage: /<command> <group> <permission>
|
usage: /<command> <group> <permissions>
|
||||||
permission: groupmanager.mangcheckp
|
permissions: groupmanager.mangcheckp
|
||||||
mangaddi:
|
mangaddi:
|
||||||
description: Add a group to another group inheritance list.
|
description: Add a group to another group inheritance list.
|
||||||
usage: /<command> <group1> <group2>
|
usage: /<command> <group1> <group2>
|
||||||
permission: groupmanager.mangaddi
|
permissions: groupmanager.mangaddi
|
||||||
mangdeli:
|
mangdeli:
|
||||||
description: Remove a group from another group inheritance list.
|
description: Remove a group from another group inheritance list.
|
||||||
usage: /<command> <group1> <group2>
|
usage: /<command> <group1> <group2>
|
||||||
permission: groupmanager.mangdeli
|
permissions: groupmanager.mangdeli
|
||||||
manuaddv:
|
manuaddv:
|
||||||
description: Add, or replaces, a variable to a user (like prefix or suffix).
|
description: Add, or replaces, a variable to a user (like prefix or suffix).
|
||||||
usage: /<command> <user> <variable> <value>
|
usage: /<command> <user> <variable> <value>
|
||||||
permission: groupmanager.manuaddv
|
permissions: groupmanager.manuaddv
|
||||||
manudelv:
|
manudelv:
|
||||||
description: Remove a variable from a user.
|
description: Remove a variable from a user.
|
||||||
usage: /<command> <user> <variable>
|
usage: /<command> <user> <variable>
|
||||||
permission: groupmanager.manudelv
|
permissions: groupmanager.manudelv
|
||||||
manulistv:
|
manulistv:
|
||||||
description: List variables a user has (like prefix or suffix).
|
description: List variables a user has (like prefix or suffix).
|
||||||
usage: /<command> <user>
|
usage: /<command> <user>
|
||||||
permission: groupmanager.manulistv
|
permissions: groupmanager.manulistv
|
||||||
manucheckv:
|
manucheckv:
|
||||||
description: Verify a value of a variable of user, and where it comes from.
|
description: Verify a value of a variable of user, and where it comes from.
|
||||||
usage: /<command> <user> <variable>
|
usage: /<command> <user> <variable>
|
||||||
permission: groupmanager.manucheckv
|
permissions: groupmanager.manucheckv
|
||||||
mangaddv:
|
mangaddv:
|
||||||
description: Add, or replaces, a variable to a group (like prefix or suffix).
|
description: Add, or replaces, a variable to a group (like prefix or suffix).
|
||||||
usage: /<command> <group> <variable> <value>
|
usage: /<command> <group> <variable> <value>
|
||||||
permission: groupmanager.mangaddv
|
permissions: groupmanager.mangaddv
|
||||||
mangdelv:
|
mangdelv:
|
||||||
description: Remove a variable from a group.
|
description: Remove a variable from a group.
|
||||||
usage: /<command> <group> <variable>
|
usage: /<command> <group> <variable>
|
||||||
permission: groupmanager.mangdelv
|
permissions: groupmanager.mangdelv
|
||||||
manglistv:
|
manglistv:
|
||||||
description: List variables a group has (like prefix or suffix).
|
description: List variables a group has (like prefix or suffix).
|
||||||
usage: /<command> <group>
|
usage: /<command> <group>
|
||||||
permission: groupmanager.manglistv
|
permissions: groupmanager.manglistv
|
||||||
mangcheckv:
|
mangcheckv:
|
||||||
description: Verify a value of a variable of group, and where it comes from.
|
description: Verify a value of a variable of group, and where it comes from.
|
||||||
usage: /<command> <group> <variable>
|
usage: /<command> <group> <variable>
|
||||||
permission: groupmanager.mangckeckv
|
permissions: groupmanager.mangckeckv
|
||||||
manwhois:
|
manwhois:
|
||||||
description: Tell the group that user belongs.
|
description: Tell the group that user belongs.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
permission: groupmanager.manwhois
|
permissions: groupmanager.manwhois
|
||||||
tempadd:
|
tempadd:
|
||||||
description: Creates a temporary permission copy for that user.
|
description: Creates a temporary permissions copy for that user.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
permission: groupmanager.tempadd
|
permissions: groupmanager.tempadd
|
||||||
tempdel:
|
tempdel:
|
||||||
description: Remove the temporary permission copy for player.
|
description: Remove the temporary permissions copy for player.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
permission: groupmanager.tempdel
|
permissions: groupmanager.tempdel
|
||||||
templist:
|
templist:
|
||||||
description: List players in overload-permissions mode made by /tempadd.
|
description: List players in overload-permissionss mode made by /tempadd.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.templist
|
permissions: groupmanager.templist
|
||||||
tempdelall:
|
tempdelall:
|
||||||
description: Remove all overrides made by command /tempadd.
|
description: Remove all overrides made by command /tempadd.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.tempdelall
|
permissions: groupmanager.tempdelall
|
||||||
mansave:
|
mansave:
|
||||||
description: Save all permissions on file.
|
description: Save all permissionss on file.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.mansave
|
permissions: groupmanager.mansave
|
||||||
manload:
|
manload:
|
||||||
description: Reload current world and config.yml. Or load given world.
|
description: Reload current world and config.yml. Or load given world.
|
||||||
usage: /<command> [world]
|
usage: /<command> [world]
|
||||||
permission: groupmanager.manload
|
permissions: groupmanager.manload
|
||||||
listgroups:
|
listgroups:
|
||||||
description: List the groups available.
|
description: List the groups available.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.listgroups
|
permissions: groupmanager.listgroups
|
||||||
manpromote:
|
manpromote:
|
||||||
description: Promote a player in the same heritage line to a higher rank.
|
description: Promote a player in the same heritage line to a higher rank.
|
||||||
usage: /<command> <player> <group>
|
usage: /<command> <player> <group>
|
||||||
permission: groupmanager.manpromote
|
permissions: groupmanager.manpromote
|
||||||
mandemote:
|
mandemote:
|
||||||
description: Demote a player in the same heritage line to a lower rank.
|
description: Demote a player in the same heritage line to a lower rank.
|
||||||
usage: /<command> <player> <group>
|
usage: /<command> <player> <group>
|
||||||
permission: groupmanager.mandemote
|
permissions: groupmanager.mandemote
|
||||||
mantogglevalidate:
|
mantogglevalidate:
|
||||||
description: Toggle on/off the validating if player is online.
|
description: Toggle on/off the validating if player is online.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.mantogglevalidate
|
permissions: groupmanager.mantogglevalidate
|
||||||
mantogglesave:
|
mantogglesave:
|
||||||
description: Toggle on/ff the autosave.
|
description: Toggle on/ff the autosave.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.mantogglesave
|
permissions: groupmanager.mantogglesave
|
||||||
manworld:
|
manworld:
|
||||||
description: Prints the selected world name
|
description: Prints the selected world name
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.manworld
|
permissions: groupmanager.manworld
|
||||||
manselect:
|
manselect:
|
||||||
description: Select a world to work with next commands.
|
description: Select a world to work with next commands.
|
||||||
usage: /<command> <world>
|
usage: /<command> <world>
|
||||||
permission: groupmanager.manselect
|
permissions: groupmanager.manselect
|
||||||
manclear:
|
manclear:
|
||||||
description: Clear world selection. Next commands will work on your world.
|
description: Clear world selection. Next commands will work on your world.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: groupmanager.manclear
|
permissions: groupmanager.manclear
|
|
@ -1,11 +1,14 @@
|
||||||
# "For a more advanced configuration example utilizing the advanced features of GroupManager, see http://pastebin.com/a8ZA0j5G"
|
# "For a more advanced configuration example utilizing the advanced features of GroupManager, see http://pastebin.com/a8ZA0j5G"
|
||||||
# "You will want to remove these users and replace them with your own"
|
|
||||||
users:
|
users:
|
||||||
snowleo:
|
snowleo:
|
||||||
subgroups: []
|
subgroups: []
|
||||||
permissions: []
|
permissions: []
|
||||||
group: Admin
|
group: Admin
|
||||||
khobbits:
|
mudzereli:
|
||||||
|
subgroups: []
|
||||||
|
permissions: []
|
||||||
|
group: Builder
|
||||||
|
ElgarL:
|
||||||
subgroups: []
|
subgroups: []
|
||||||
permissions: []
|
permissions: []
|
||||||
group: Admin
|
group: Admin
|
||||||
|
|
Loading…
Reference in a new issue