summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/.classpath7
-rw-r--r--EssentialsGroupManager/.project27
-rw-r--r--EssentialsGroupManager/build.xml74
-rw-r--r--EssentialsGroupManager/nbproject/build-impl.xml1053
-rw-r--r--EssentialsGroupManager/nbproject/genfiles.properties8
-rw-r--r--EssentialsGroupManager/nbproject/project.properties87
-rw-r--r--EssentialsGroupManager/nbproject/project.xml15
-rw-r--r--EssentialsGroupManager/pom.xml14
-rw-r--r--EssentialsGroupManager/src/Changelog.txt45
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java144
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java870
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java317
12 files changed, 598 insertions, 2063 deletions
diff --git a/EssentialsGroupManager/.classpath b/EssentialsGroupManager/.classpath
deleted file mode 100644
index bc8106503..000000000
--- a/EssentialsGroupManager/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/EssentialsGroupManager/.project b/EssentialsGroupManager/.project
deleted file mode 100644
index c0e5a6f5e..000000000
--- a/EssentialsGroupManager/.project
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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>
- <buildCommand>
- <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
- <triggers>full,incremental,</triggers>
- <arguments>
- <dictionary>
- <key>LaunchConfigHandle</key>
- <value>&lt;project&gt;/.externalToolBuilders/GroupManager.launch</value>
- </dictionary>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/EssentialsGroupManager/build.xml b/EssentialsGroupManager/build.xml
deleted file mode 100644
index aeec831d5..000000000
--- a/EssentialsGroupManager/build.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See commented blocks below for -->
-<!-- some examples of how to customize the build. -->
-<!-- (If you delete it and reopen the project it will be recreated.) -->
-<!-- By default, only the Clean and Build commands use this build script. -->
-<!-- Commands such as Run, Debug, and Test only use this build script if -->
-<!-- the Compile on Save feature is turned off for the project. -->
-<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
-<!-- in the project's Project Properties dialog box.-->
-<project name="EssentialsGroupManager" default="default" basedir=".">
- <description>Builds, tests, and runs the project EssentialsGroupManager.</description>
- <import file="nbproject/build-impl.xml"/>
- <!--
-
- There exist several targets which are by default empty and which can be
- used for execution of your tasks. These targets are usually executed
- before and after some main targets. They are:
-
- -pre-init: called before initialization of project properties
- -post-init: called after initialization of project properties
- -pre-compile: called before javac compilation
- -post-compile: called after javac compilation
- -pre-compile-single: called before javac compilation of single file
- -post-compile-single: called after javac compilation of single file
- -pre-compile-test: called before javac compilation of JUnit tests
- -post-compile-test: called after javac compilation of JUnit tests
- -pre-compile-test-single: called before javac compilation of single JUnit test
- -post-compile-test-single: called after javac compilation of single JUunit test
- -pre-jar: called before JAR building
- -post-jar: called after JAR building
- -post-clean: called after cleaning build products
-
- (Targets beginning with '-' are not intended to be called on their own.)
-
- Example of inserting an obfuscator after compilation could look like this:
-
- <target name="-post-compile">
- <obfuscate>
- <fileset dir="${build.classes.dir}"/>
- </obfuscate>
- </target>
-
- For list of available properties check the imported
- nbproject/build-impl.xml file.
-
-
- Another way to customize the build is by overriding existing main targets.
- The targets of interest are:
-
- -init-macrodef-javac: defines macro for javac compilation
- -init-macrodef-junit: defines macro for junit execution
- -init-macrodef-debug: defines macro for class debugging
- -init-macrodef-java: defines macro for class execution
- -do-jar-with-manifest: JAR building (if you are using a manifest)
- -do-jar-without-manifest: JAR building (if you are not using a manifest)
- run: execution of project
- -javadoc-build: Javadoc generation
- test-report: JUnit report generation
-
- An example of overriding the target for project execution could look like this:
-
- <target name="run" depends="EssentialsGroupManager-impl.jar">
- <exec dir="bin" executable="launcher.exe">
- <arg file="${dist.jar}"/>
- </exec>
- </target>
-
- Notice that the overridden target depends on the jar target and not only on
- the compile target as the regular run target does. Again, for a list of available
- properties which you can use, check the target you are overriding in the
- nbproject/build-impl.xml file.
-
- -->
-</project>
diff --git a/EssentialsGroupManager/nbproject/build-impl.xml b/EssentialsGroupManager/nbproject/build-impl.xml
deleted file mode 100644
index 8939aa2fa..000000000
--- a/EssentialsGroupManager/nbproject/build-impl.xml
+++ /dev/null
@@ -1,1053 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT ***
-*** EDIT ../build.xml INSTEAD ***
-
-For the purpose of easier reading the script
-is divided into following sections:
-
- - initialization
- - compilation
- - jar
- - execution
- - debugging
- - javadoc
- - junit compilation
- - junit execution
- - junit debugging
- - applet
- - cleanup
-
- -->
-<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="EssentialsGroupManager-impl">
- <fail message="Please build using Ant 1.8.0 or higher.">
- <condition>
- <not>
- <antversion atleast="1.8.0"/>
- </not>
- </condition>
- </fail>
- <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
- <!--
- ======================
- INITIALIZATION SECTION
- ======================
- -->
- <target name="-pre-init">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="-pre-init" name="-init-private">
- <property file="nbproject/private/config.properties"/>
- <property file="nbproject/private/configs/${config}.properties"/>
- <property file="nbproject/private/private.properties"/>
- </target>
- <target depends="-pre-init,-init-private" name="-init-user">
- <property file="${user.properties.file}"/>
- <!-- The two properties below are usually overridden -->
- <!-- by the active platform. Just a fallback. -->
- <property name="default.javac.source" value="1.4"/>
- <property name="default.javac.target" value="1.4"/>
- </target>
- <target depends="-pre-init,-init-private,-init-user" name="-init-project">
- <property file="nbproject/configs/${config}.properties"/>
- <property file="nbproject/project.properties"/>
- </target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
- <available file="${manifest.file}" property="manifest.available"/>
- <condition property="splashscreen.available">
- <and>
- <not>
- <equals arg1="${application.splash}" arg2="" trim="true"/>
- </not>
- <available file="${application.splash}"/>
- </and>
- </condition>
- <condition property="main.class.available">
- <and>
- <isset property="main.class"/>
- <not>
- <equals arg1="${main.class}" arg2="" trim="true"/>
- </not>
- </and>
- </condition>
- <condition property="manifest.available+main.class">
- <and>
- <isset property="manifest.available"/>
- <isset property="main.class.available"/>
- </and>
- </condition>
- <condition property="do.archive">
- <not>
- <istrue value="${jar.archive.disabled}"/>
- </not>
- </condition>
- <condition property="do.mkdist">
- <and>
- <isset property="do.archive"/>
- <isset property="libs.CopyLibs.classpath"/>
- <not>
- <istrue value="${mkdist.disabled}"/>
- </not>
- </and>
- </condition>
- <condition property="manifest.available+main.class+mkdist.available">
- <and>
- <istrue value="${manifest.available+main.class}"/>
- <isset property="do.mkdist"/>
- </and>
- </condition>
- <condition property="do.archive+manifest.available">
- <and>
- <isset property="manifest.available"/>
- <istrue value="${do.archive}"/>
- </and>
- </condition>
- <condition property="do.archive+main.class.available">
- <and>
- <isset property="main.class.available"/>
- <istrue value="${do.archive}"/>
- </and>
- </condition>
- <condition property="do.archive+splashscreen.available">
- <and>
- <isset property="splashscreen.available"/>
- <istrue value="${do.archive}"/>
- </and>
- </condition>
- <condition property="do.archive+manifest.available+main.class">
- <and>
- <istrue value="${manifest.available+main.class}"/>
- <istrue value="${do.archive}"/>
- </and>
- </condition>
- <condition property="manifest.available-mkdist.available">
- <or>
- <istrue value="${manifest.available}"/>
- <isset property="do.mkdist"/>
- </or>
- </condition>
- <condition property="manifest.available+main.class-mkdist.available">
- <or>
- <istrue value="${manifest.available+main.class}"/>
- <isset property="do.mkdist"/>
- </or>
- </condition>
- <condition property="have.tests">
- <or>
- <available file="${test.src.dir}"/>
- </or>
- </condition>
- <condition property="have.sources">
- <or>
- <available file="${src.dir}"/>
- </or>
- </condition>
- <condition property="netbeans.home+have.tests">
- <and>
- <isset property="netbeans.home"/>
- <isset property="have.tests"/>
- </and>
- </condition>
- <condition property="no.javadoc.preview">
- <and>
- <isset property="javadoc.preview"/>
- <isfalse value="${javadoc.preview}"/>
- </and>
- </condition>
- <property name="run.jvmargs" value=""/>
- <property name="javac.compilerargs" value=""/>
- <property name="work.dir" value="${basedir}"/>
- <condition property="no.deps">
- <and>
- <istrue value="${no.dependencies}"/>
- </and>
- </condition>
- <property name="javac.debug" value="true"/>
- <property name="javadoc.preview" value="true"/>
- <property name="application.args" value=""/>
- <property name="source.encoding" value="${file.encoding}"/>
- <property name="runtime.encoding" value="${source.encoding}"/>
- <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
- <and>
- <isset property="javadoc.encoding"/>
- <not>
- <equals arg1="${javadoc.encoding}" arg2=""/>
- </not>
- </and>
- </condition>
- <property name="javadoc.encoding.used" value="${source.encoding}"/>
- <property name="includes" value="**"/>
- <property name="excludes" value=""/>
- <property name="do.depend" value="false"/>
- <condition property="do.depend.true">
- <istrue value="${do.depend}"/>
- </condition>
- <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
- <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
- <length length="0" string="${endorsed.classpath}" when="greater"/>
- </condition>
- <condition else="false" property="jdkBug6558476">
- <and>
- <matches pattern="1\.[56]" string="${java.specification.version}"/>
- <not>
- <os family="unix"/>
- </not>
- </and>
- </condition>
- <property name="javac.fork" value="${jdkBug6558476}"/>
- <property name="jar.index" value="false"/>
- <property name="jar.index.metainf" value="${jar.index}"/>
- <property name="copylibs.rebase" value="true"/>
- <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
- </target>
- <target name="-post-init">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
- <fail unless="src.dir">Must set src.dir</fail>
- <fail unless="test.src.dir">Must set test.src.dir</fail>
- <fail unless="build.dir">Must set build.dir</fail>
- <fail unless="dist.dir">Must set dist.dir</fail>
- <fail unless="build.classes.dir">Must set build.classes.dir</fail>
- <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
- <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
- <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
- <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
- <fail unless="dist.jar">Must set dist.jar</fail>
- </target>
- <target name="-init-macrodef-property">
- <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute name="name"/>
- <attribute name="value"/>
- <sequential>
- <property name="@{name}" value="${@{value}}"/>
- </sequential>
- </macrodef>
- </target>
- <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
- <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.dir}" name="srcdir"/>
- <attribute default="${build.classes.dir}" name="destdir"/>
- <attribute default="${javac.classpath}" name="classpath"/>
- <attribute default="${javac.processorpath}" name="processorpath"/>
- <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
- <attribute default="${includes}" name="includes"/>
- <attribute default="${excludes}" name="excludes"/>
- <attribute default="${javac.debug}" name="debug"/>
- <attribute default="${empty.dir}" name="sourcepath"/>
- <attribute default="${empty.dir}" name="gensrcdir"/>
- <element name="customize" optional="true"/>
- <sequential>
- <property location="${build.dir}/empty" name="empty.dir"/>
- <mkdir dir="${empty.dir}"/>
- <mkdir dir="@{apgeneratedsrcdir}"/>
- <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
- <src>
- <dirset dir="@{gensrcdir}" erroronmissingdir="false">
- <include name="*"/>
- </dirset>
- </src>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
- <compilerarg line="${javac.compilerargs}"/>
- <compilerarg value="-processorpath"/>
- <compilerarg path="@{processorpath}:${empty.dir}"/>
- <compilerarg line="${ap.processors.internal}"/>
- <compilerarg line="${annotation.processing.processor.options}"/>
- <compilerarg value="-s"/>
- <compilerarg path="@{apgeneratedsrcdir}"/>
- <compilerarg line="${ap.proc.none.internal}"/>
- <customize/>
- </javac>
- </sequential>
- </macrodef>
- </target>
- <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
- <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.dir}" name="srcdir"/>
- <attribute default="${build.classes.dir}" name="destdir"/>
- <attribute default="${javac.classpath}" name="classpath"/>
- <attribute default="${javac.processorpath}" name="processorpath"/>
- <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
- <attribute default="${includes}" name="includes"/>
- <attribute default="${excludes}" name="excludes"/>
- <attribute default="${javac.debug}" name="debug"/>
- <attribute default="${empty.dir}" name="sourcepath"/>
- <attribute default="${empty.dir}" name="gensrcdir"/>
- <element name="customize" optional="true"/>
- <sequential>
- <property location="${build.dir}/empty" name="empty.dir"/>
- <mkdir dir="${empty.dir}"/>
- <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
- <src>
- <dirset dir="@{gensrcdir}" erroronmissingdir="false">
- <include name="*"/>
- </dirset>
- </src>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
- <compilerarg line="${javac.compilerargs}"/>
- <customize/>
- </javac>
- </sequential>
- </macrodef>
- </target>
- <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
- <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.dir}" name="srcdir"/>
- <attribute default="${build.classes.dir}" name="destdir"/>
- <attribute default="${javac.classpath}" name="classpath"/>
- <sequential>
- <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- </depend>
- </sequential>
- </macrodef>
- <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${build.classes.dir}" name="destdir"/>
- <sequential>
- <fail unless="javac.includes">Must set javac.includes</fail>
- <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
- <path>
- <filelist dir="@{destdir}" files="${javac.includes}"/>
- </path>
- <globmapper from="*.java" to="*.class"/>
- </pathconvert>
- <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
- <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
- <delete>
- <files includesfile="${javac.includesfile.binary}"/>
- </delete>
- <delete>
- <fileset file="${javac.includesfile.binary}"/>
- </delete>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-macrodef-junit">
- <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${includes}" name="includes"/>
- <attribute default="${excludes}" name="excludes"/>
- <attribute default="**" name="testincludes"/>
- <sequential>
- <property name="junit.forkmode" value="perTest"/>
- <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
- <batchtest todir="${build.test.results.dir}">
- <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
- </batchtest>
- <classpath>
- <path path="${run.test.classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="test-sys-prop."/>
- <mapper from="test-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <formatter type="brief" usefile="false"/>
- <formatter type="xml"/>
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg value="-ea"/>
- <jvmarg line="${run.jvmargs}"/>
- </junit>
- </sequential>
- </macrodef>
- </target>
- <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
- <target name="-profile-pre-init">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target name="-profile-post-init">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target name="-profile-init-macrodef-profile">
- <macrodef name="resolve">
- <attribute name="name"/>
- <attribute name="value"/>
- <sequential>
- <property name="@{name}" value="${env.@{value}}"/>
- </sequential>
- </macrodef>
- <macrodef name="profile">
- <attribute default="${main.class}" name="classname"/>
- <element name="customize" optional="true"/>
- <sequential>
- <property environment="env"/>
- <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
- <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg value="${profiler.info.jvmargs.agent}"/>
- <jvmarg line="${profiler.info.jvmargs}"/>
- <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
- <arg line="${application.args}"/>
- <classpath>
- <path path="${run.classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="run-sys-prop."/>
- <mapper from="run-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <customize/>
- </java>
- </sequential>
- </macrodef>
- </target>
- <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
- <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
- <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
- </target>
- <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
- <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute default="${main.class}" name="name"/>
- <attribute default="${debug.classpath}" name="classpath"/>
- <attribute default="" name="stopclassname"/>
- <sequential>
- <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- </nbjpdastart>
- </sequential>
- </macrodef>
- <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute default="${build.classes.dir}" name="dir"/>
- <sequential>
- <nbjpdareload>
- <fileset dir="@{dir}" includes="${fix.classes}">
- <include name="${fix.includes}*.class"/>
- </fileset>
- </nbjpdareload>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-debug-args">
- <property name="version-output" value="java version &quot;${ant.java.version}"/>
- <condition property="have-jdk-older-than-1.4">
- <or>
- <contains string="${version-output}" substring="java version &quot;1.0"/>
- <contains string="${version-output}" substring="java version &quot;1.1"/>
- <contains string="${version-output}" substring="java version &quot;1.2"/>
- <contains string="${version-output}" substring="java version &quot;1.3"/>
- </or>
- </condition>
- <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
- <istrue value="${have-jdk-older-than-1.4}"/>
- </condition>
- <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
- <os family="windows"/>
- </condition>
- <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
- <isset property="debug.transport"/>
- </condition>
- </target>
- <target depends="-init-debug-args" name="-init-macrodef-debug">
- <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${main.class}" name="classname"/>
- <attribute default="${debug.classpath}" name="classpath"/>
- <element name="customize" optional="true"/>
- <sequential>
- <java classname="@{classname}" dir="${work.dir}" fork="true">
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg line="${debug-args-line}"/>
- <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
- <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
- <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
- <jvmarg line="${run.jvmargs}"/>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="run-sys-prop."/>
- <mapper from="run-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <customize/>
- </java>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-macrodef-java">
- <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute default="${main.class}" name="classname"/>
- <attribute default="${run.classpath}" name="classpath"/>
- <element name="customize" optional="true"/>
- <sequential>
- <java classname="@{classname}" dir="${work.dir}" fork="true">
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
- <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
- <jvmarg line="${run.jvmargs}"/>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="run-sys-prop."/>
- <mapper from="run-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <customize/>
- </java>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-macrodef-copylibs">
- <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${manifest.file}" name="manifest"/>
- <element name="customize" optional="true"/>
- <sequential>
- <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
- <pathconvert property="run.classpath.without.build.classes.dir">
- <path path="${run.classpath}"/>
- <map from="${build.classes.dir.resolved}" to=""/>
- </pathconvert>
- <pathconvert pathsep=" " property="jar.classpath">
- <path path="${run.classpath.without.build.classes.dir}"/>
- <chainedmapper>
- <flattenmapper/>
- <globmapper from="*" to="lib/*"/>
- </chainedmapper>
- </pathconvert>
- <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
- <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
- <fileset dir="${build.classes.dir}"/>
- <manifest>
- <attribute name="Class-Path" value="${jar.classpath}"/>
- <customize/>
- </manifest>
- </copylibs>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-presetdef-jar">
- <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
- <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
- <j2seproject1:fileset dir="${build.classes.dir}"/>
- </jar>
- </presetdef>
- </target>
- <target name="-init-ap-cmdline-properties">
- <property name="annotation.processing.enabled" value="true"/>
- <property name="annotation.processing.processors.list" value=""/>
- <property name="annotation.processing.processor.options" value=""/>
- <property name="annotation.processing.run.all.processors" value="true"/>
- <property name="javac.processorpath" value="${javac.classpath}"/>
- <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
- <condition property="ap.supported.internal" value="true">
- <not>
- <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
- </not>
- </condition>
- </target>
- <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
- <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
- <isfalse value="${annotation.processing.run.all.processors}"/>
- </condition>
- <condition else="" property="ap.proc.none.internal" value="-proc:none">
- <isfalse value="${annotation.processing.enabled}"/>
- </condition>
- </target>
- <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
- <property name="ap.cmd.line.internal" value=""/>
- </target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
- <!--
- ===================
- COMPILATION SECTION
- ===================
- -->
- <target name="-deps-jar-init" unless="built-jar.properties">
- <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
- <delete file="${built-jar.properties}" quiet="true"/>
- </target>
- <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
- <echo level="warn" message="Cycle detected: EssentialsGroupManager was already built"/>
- </target>
- <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
- <mkdir dir="${build.dir}"/>
- <touch file="${built-jar.properties}" verbose="false"/>
- <property file="${built-jar.properties}" prefix="already.built.jar."/>
- <antcall target="-warn-already-built-jar"/>
- <propertyfile file="${built-jar.properties}">
- <entry key="${basedir}" value=""/>
- </propertyfile>
- </target>
- <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
- <target depends="init" name="-check-automatic-build">
- <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
- </target>
- <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
- <antcall target="clean"/>
- </target>
- <target depends="init,deps-jar" name="-pre-pre-compile">
- <mkdir dir="${build.classes.dir}"/>
- </target>
- <target name="-pre-compile">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target if="do.depend.true" name="-compile-depend">
- <pathconvert property="build.generated.subdirs">
- <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
- <include name="*"/>
- </dirset>
- </pathconvert>
- <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
- </target>
- <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
- <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
- <copy todir="${build.classes.dir}">
- <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- </copy>
- </target>
- <target if="has.persistence.xml" name="-copy-persistence-xml">
- <mkdir dir="${build.classes.dir}/META-INF"/>
- <copy todir="${build.classes.dir}/META-INF">
- <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
- </copy>
- </target>
- <target name="-post-compile">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
- <target name="-pre-compile-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
- <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
- <j2seproject3:force-recompile/>
- <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
- </target>
- <target name="-post-compile-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
- <!--
- ====================
- JAR BUILDING SECTION
- ====================
- -->
- <target depends="init" name="-pre-pre-jar">
- <dirname file="${dist.jar}" property="dist.jar.dir"/>
- <mkdir dir="${dist.jar.dir}"/>
- </target>
- <target name="-pre-jar">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
- <j2seproject1:jar/>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
- <j2seproject1:jar manifest="${manifest.file}"/>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
- <j2seproject1:jar manifest="${manifest.file}">
- <j2seproject1:manifest>
- <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
- </j2seproject1:manifest>
- </j2seproject1:jar>
- <echo level="info">To run this application from the command line without Ant, try:</echo>
- <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
- <property location="${dist.jar}" name="dist.jar.resolved"/>
- <pathconvert property="run.classpath.with.dist.jar">
- <path path="${run.classpath}"/>
- <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
- </pathconvert>
- <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
- </target>
- <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
- <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
- <touch file="${tmp.manifest.file}" verbose="false"/>
- </target>
- <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
- <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
- <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
- </target>
- <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
- <manifest file="${tmp.manifest.file}" mode="update">
- <attribute name="Main-Class" value="${main.class}"/>
- </manifest>
- </target>
- <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
- <basename file="${application.splash}" property="splashscreen.basename"/>
- <mkdir dir="${build.classes.dir}/META-INF"/>
- <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
- <manifest file="${tmp.manifest.file}" mode="update">
- <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
- </manifest>
- </target>
- <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
- <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
- <echo level="info">To run this application from the command line without Ant, try:</echo>
- <property location="${dist.jar}" name="dist.jar.resolved"/>
- <echo level="info">java -jar "${dist.jar.resolved}"</echo>
- </target>
- <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
- <delete>
- <fileset file="${tmp.manifest.file}"/>
- </delete>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
- <target name="-post-jar">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
- <!--
- =================
- EXECUTION SECTION
- =================
- -->
- <target depends="init,compile" description="Run a main class." name="run">
- <j2seproject1:java>
- <customize>
- <arg line="${application.args}"/>
- </customize>
- </j2seproject1:java>
- </target>
- <target name="-do-not-recompile">
- <property name="javac.includes.binary" value=""/>
- </target>
- <target depends="init,compile-single" name="run-single">
- <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
- <j2seproject1:java classname="${run.class}"/>
- </target>
- <target depends="init,compile-test-single" name="run-test-with-main">
- <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
- <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
- </target>
- <!--
- =================
- DEBUGGING SECTION
- =================
- -->
- <target depends="init" if="netbeans.home" name="-debug-start-debugger">
- <j2seproject1:nbjpdastart name="${debug.class}"/>
- </target>
- <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
- <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
- </target>
- <target depends="init,compile" name="-debug-start-debuggee">
- <j2seproject3:debug>
- <customize>
- <arg line="${application.args}"/>
- </customize>
- </j2seproject3:debug>
- </target>
- <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
- <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
- <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
- </target>
- <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
- <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
- <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
- <j2seproject3:debug classname="${debug.class}"/>
- </target>
- <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
- <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
- <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
- <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
- </target>
- <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
- <target depends="init" name="-pre-debug-fix">
- <fail unless="fix.includes">Must set fix.includes</fail>
- <property name="javac.includes" value="${fix.includes}.java"/>
- </target>
- <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
- <j2seproject1:nbjpdareload/>
- </target>
- <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
- <!--
- =================
- PROFILING SECTION
- =================
- -->
- <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
- <nbprofiledirect>
- <classpath>
- <path path="${run.classpath}"/>
- </classpath>
- </nbprofiledirect>
- <profile/>
- </target>
- <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
- <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
- <nbprofiledirect>
- <classpath>
- <path path="${run.classpath}"/>
- </classpath>
- </nbprofiledirect>
- <profile classname="${profile.class}"/>
- </target>
- <!--
- =========================
- APPLET PROFILING SECTION
- =========================
- -->
- <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
- <nbprofiledirect>
- <classpath>
- <path path="${run.classpath}"/>
- </classpath>
- </nbprofiledirect>
- <profile classname="sun.applet.AppletViewer">
- <customize>
- <arg value="${applet.url}"/>
- </customize>
- </profile>
- </target>
- <!--
- =========================
- TESTS PROFILING SECTION
- =========================
- -->
- <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
- <nbprofiledirect>
- <classpath>
- <path path="${run.test.classpath}"/>
- </classpath>
- </nbprofiledirect>
- <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
- <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
- <jvmarg value="${profiler.info.jvmargs.agent}"/>
- <jvmarg line="${profiler.info.jvmargs}"/>
- <test name="${profile.class}"/>
- <classpath>
- <path path="${run.test.classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="test-sys-prop."/>
- <mapper from="test-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <formatter type="brief" usefile="false"/>
- <formatter type="xml"/>
- </junit>
- </target>
- <!--
- ===============
- JAVADOC SECTION
- ===============
- -->
- <target depends="init" if="have.sources" name="-javadoc-build">
- <mkdir dir="${dist.javadoc.dir}"/>
- <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
- <and>
- <isset property="endorsed.classpath.cmd.line.arg"/>
- <not>
- <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
- </not>
- </and>
- </condition>
- <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
- <classpath>
- <path path="${javac.classpath}"/>
- </classpath>
- <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
- <filename name="**/*.java"/>
- </fileset>
- <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
- <include name="**/*.java"/>
- <exclude name="*.java"/>
- </fileset>
- <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
- </javadoc>
- <copy todir="${dist.javadoc.dir}">
- <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
- <filename name="**/doc-files/**"/>
- </fileset>
- <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
- <include name="**/doc-files/**"/>
- </fileset>
- </copy>
- </target>
- <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
- <nbbrowse file="${dist.javadoc.dir}/index.html"/>
- </target>
- <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
- <!--
- =========================
- JUNIT COMPILATION SECTION
- =========================
- -->
- <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
- <mkdir dir="${build.test.classes.dir}"/>
- </target>
- <target name="-pre-compile-test">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target if="do.depend.true" name="-compile-test-depend">
- <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
- </target>
- <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
- <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
- <copy todir="${build.test.classes.dir}">
- <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- </copy>
- </target>
- <target name="-post-compile-test">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
- <target name="-pre-compile-test-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
- <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
- <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
- <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
- <copy todir="${build.test.classes.dir}">
- <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- </copy>
- </target>
- <target name="-post-compile-test-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
- <!--
- =======================
- JUNIT EXECUTION SECTION
- =======================
- -->
- <target depends="init" if="have.tests" name="-pre-test-run">
- <mkdir dir="${build.test.results.dir}"/>
- </target>
- <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
- <j2seproject3:junit testincludes="**/*Test.java"/>
- </target>
- <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
- </target>
- <target depends="init" if="have.tests" name="test-report"/>
- <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
- <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
- <target depends="init" if="have.tests" name="-pre-test-run-single">
- <mkdir dir="${build.test.results.dir}"/>
- </target>
- <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
- <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
- <j2seproject3:junit excludes="" includes="${test.includes}"/>
- </target>
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
- </target>
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
- <!--
- =======================
- JUNIT DEBUGGING SECTION
- =======================
- -->
- <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
- <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
- <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
- <delete file="${test.report.file}"/>
- <mkdir dir="${build.test.results.dir}"/>
- <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
- <customize>
- <syspropertyset>
- <propertyref prefix="test-sys-prop."/>
- <mapper from="test-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <arg value="${test.class}"/>
- <arg value="showoutput=true"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
- </customize>
- </j2seproject3:debug>
- </target>
- <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
- <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
- </target>
- <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
- <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
- <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
- </target>
- <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
- <!--
- =========================
- APPLET EXECUTION SECTION
- =========================
- -->
- <target depends="init,compile-single" name="run-applet">
- <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
- <j2seproject1:java classname="sun.applet.AppletViewer">
- <customize>
- <arg value="${applet.url}"/>
- </customize>
- </j2seproject1:java>
- </target>
- <!--
- =========================
- APPLET DEBUGGING SECTION
- =========================
- -->
- <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
- <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
- <j2seproject3:debug classname="sun.applet.AppletViewer">
- <customize>
- <arg value="${applet.url}"/>
- </customize>
- </j2seproject3:debug>
- </target>
- <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
- <!--
- ===============
- CLEANUP SECTION
- ===============
- -->
- <target name="-deps-clean-init" unless="built-clean.properties">
- <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
- <delete file="${built-clean.properties}" quiet="true"/>
- </target>
- <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
- <echo level="warn" message="Cycle detected: EssentialsGroupManager was already built"/>
- </target>
- <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
- <mkdir dir="${build.dir}"/>
- <touch file="${built-clean.properties}" verbose="false"/>
- <property file="${built-clean.properties}" prefix="already.built.clean."/>
- <antcall target="-warn-already-built-clean"/>
- <propertyfile file="${built-clean.properties}">
- <entry key="${basedir}" value=""/>
- </propertyfile>
- </target>
- <target depends="init" name="-do-clean">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
- </target>
- <target name="-post-clean">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
- <target name="-check-call-dep">
- <property file="${call.built.properties}" prefix="already.built."/>
- <condition property="should.call.dep">
- <not>
- <isset property="already.built.${call.subproject}"/>
- </not>
- </condition>
- </target>
- <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
- <ant antfile="${call.script}" inheritall="false" target="${call.target}">
- <propertyset>
- <propertyref prefix="transfer."/>
- <mapper from="transfer.*" to="*" type="glob"/>
- </propertyset>
- </ant>
- </target>
-</project>
diff --git a/EssentialsGroupManager/nbproject/genfiles.properties b/EssentialsGroupManager/nbproject/genfiles.properties
deleted file mode 100644
index d7341b85d..000000000
--- a/EssentialsGroupManager/nbproject/genfiles.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=a6709b83
-build.xml.script.CRC32=5b346364
-build.xml.stylesheet.CRC32=28e38971@1.38.2.45
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=a6709b83
-nbproject/build-impl.xml.script.CRC32=fe0fea25
-nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
diff --git a/EssentialsGroupManager/nbproject/project.properties b/EssentialsGroupManager/nbproject/project.properties
deleted file mode 100644
index 5b58a2c8c..000000000
--- a/EssentialsGroupManager/nbproject/project.properties
+++ /dev/null
@@ -1,87 +0,0 @@
-annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
-annotation.processing.run.all.processors=true
-annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=EssentialsGroupManager
-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.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.dir=${build.dir}/generated
-build.generated.sources.dir=${build.dir}/generated-sources
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-# Uncomment to specify the preferred debugger connection transport:
-#debug.transport=dt_socket
-debug.classpath=\
- ${run.classpath}
-debug.test.classpath=\
- ${run.test.classpath}
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/EssentialsGroupManager.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-endorsed.classpath=
-excludes=
-file.reference.craftbukkit.jar=../lib/craftbukkit.jar
-includes=**
-jar.compress=true
-javac.classpath=\
- ${file.reference.craftbukkit.jar}
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.processorpath=\
- ${javac.classpath}
-javac.source=1.6
-javac.target=1.6
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-javac.test.processorpath=\
- ${javac.test.classpath}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-main.class=
-manifest.file=manifest.mf
-meta.inf.dir=${src.dir}/META-INF
-mkdist.disabled=true
-platform.active=default_platform
-run.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project
-# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
-# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=
-run.test.classpath=\
- ${javac.test.classpath}:\
- ${build.test.classes.dir}
-source.encoding=UTF-8
-src.dir=src
-test.src.dir=test
diff --git a/EssentialsGroupManager/nbproject/project.xml b/EssentialsGroupManager/nbproject/project.xml
deleted file mode 100644
index 6cc53fda9..000000000
--- a/EssentialsGroupManager/nbproject/project.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
- <type>org.netbeans.modules.java.j2seproject</type>
- <configuration>
- <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
- <name>EssentialsGroupManager</name>
- <source-roots>
- <root id="src.dir"/>
- </source-roots>
- <test-roots>
- <root id="test.src.dir"/>
- </test-roots>
- </data>
- </configuration>
-</project>
diff --git a/EssentialsGroupManager/pom.xml b/EssentialsGroupManager/pom.xml
new file mode 100644
index 000000000..975483d5f
--- /dev/null
+++ b/EssentialsGroupManager/pom.xml
@@ -0,0 +1,14 @@
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>EssentialsGroupManager</artifactId>
+</project>
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 4a3c232be..6f1b2e3b4 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -34,10 +34,10 @@ v 1.3:
(for all worlds named in config.yml)
- Attempt to stop GM wiping groups/users yml's on a bad shut down.
- Added event handling to manage new world creation at runtime.
- - Added the ability to handle unknown worlds at server start.
- (GM will create the data files for any worlds it finds which are not in the config.yml)
+ - Added the ability to handle unknown worlds at server start.
+ (GM will create the data files for any worlds it finds which are not in the config.yml)
- Fix for Bukkit passing a null To location on a player Portaling
- - Fixed manudelsub not correctly selecting the group to remove.
+ - Fixed manudelsub not correctly selecting the group to remove.
- Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other
These allow players/admins to be notified when players are moved between groups.
v 1.4:
@@ -146,41 +146,4 @@ v 1.9:
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
- Prevent promoting players to, and demoting to GlobalGroups.
- - Make 'manload' reload the config correctly.
- - Minor optimization when checking bukkit permissions.
- - Better reporting when a users.yml is failing to load.
- - Expanded '/manuadd'to accept an optional variable for the world (eg '/manuadd <player> <group> <world>').
- - Removed some debug spam.
- - Don't remove an attachment on a player leaving as Bukkit never forgets it. This fixes non mirrored permissions being messed up if a player relogs.
- - Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
- - Auto rename all case sensitive world folders to lower case (if possible).
- - Update GlobalGroups.yml for new/changed Towny permission nodes.
- - Stop attempting to push empty permissions when players edit the yml's incorrectly.
- - Catch errors caused by bad indentation in yml's.
- - Force remove player attachments on disconnect, and tidyup during player join in case of any errors. Fixes a bug of losing permissions.
- - Added a new permission node 'groupmanager.op'. This will cause players with this node to be treated as op's when
- using GroupManager commands (they will still require each commands permission node to use them).
- - Prevent Null entries in group inheritance from throwing errors.
-v 2.0:
- - Fix GM reporting of permission inheritance to retain the correct order. Lower inheritance groups can no longer negate a higher groups permissions.
- - Fix an error I caused trying to modify an unmodifiable list when parsing '*' permissions.
- - Don't throw errors when attempting to remove permission attachments (bukkit will have already removed it).
- - Remove all permission attachments when performing a manload or restart.
- - Expand 'manwhois' to also list a users subgroups.
- - Fix a concurrent modification error when removing all attachments.
- - Better handling of errors in user and group yml's.
- - Added missing confirmation message on '/manload'.
- - Stop the error on shutdown if GM failed to load at startup.
- - GroupManager will now generate it's own log (in the GM folder) to keep things tidy, but also to account of those players unable to find/access their server.log.
- - Startup errors will now lock out ALL commands other than '/manload'
- - Fix 'manuadd' to use the default or selected world (via 'manselect'), if the world is not specified in the command.
- - Expand GlobalGroups.yml and groups.yml to cover the VanishNoPacket plugin. Demonstrating how to negate and add nodes when using the '*' permission with inheritance.
- - Fix silly nested throw/catch statements. Errors are now correctly generated when reading yml's.
- - Unregister the worldsHolder as a service on a reload/shutdown instead of the whole plugin.
- - Update all code formatting to use tabs for indentation.
- - Stop using our own deprecated methods as we tell others to do.
- - Finally remove all deprecated methods.
- - Re-initialize the WorldsHolder on a reload, as un-registering and re-registering a new holder means all plugins have to check for the new service on every quiery.
- - Prevent null perms getting past the GlobalGroups loader.
- - Fix forgetting sub groups on a manload.
- - Allow 'manucheckp' to notify when superperms reports false but it is really negated. \ No newline at end of file
+ - Make 'manload' reload the config correctly. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
index 0832000f2..98ff075dd 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
@@ -13,89 +13,81 @@ import org.anjocaido.groupmanager.utils.Tasks;
import org.bukkit.configuration.file.YamlConfiguration;
/**
- *
+ *
* @author gabrielcouto
*/
public class GMConfiguration {
- private GroupManager plugin;
- private File configFile;
- private YamlConfiguration GMconfig;
-
- public GMConfiguration(GroupManager plugin) {
-
- this.plugin = plugin;
- load();
- }
-
- public void load() {
-
- if (!plugin.getDataFolder().exists()) {
- plugin.getDataFolder().mkdirs();
- }
- configFile = new File(plugin.getDataFolder(), "config.yml");
-
- if (!configFile.exists()) {
- try {
- Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
- } catch (IOException ex) {
- GroupManager.logger.log(Level.SEVERE, null, ex);
- }
- }
-
- GMconfig = new YamlConfiguration();
-
- try {
- GMconfig.load(configFile);
- } catch (Exception ex) {
- throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
- }
-
- // Setup defaults
- adjustLoggerLevel();
- plugin.setValidateOnlinePlayer(isToggleValidate());
- }
-
- public boolean isOpOverride() {
-
- return GMconfig.getBoolean("settings.config.opOverrides", true);
- }
-
- public boolean isToggleValidate() {
-
- return GMconfig.getBoolean("settings.config.validate_toggle", true);
- }
-
- public Map<String, Object> getMirrorsMap() {
-
- // Try to fetch the old mirror path first
+ private GroupManager plugin;
+ private File configFile;
+ private YamlConfiguration GMconfig;
+
+ public GMConfiguration(GroupManager plugin) {
+ this.plugin = plugin;
+ load();
+ }
+
+ public void load() {
+ if (!plugin.getDataFolder().exists()) {
+ plugin.getDataFolder().mkdirs();
+ }
+ configFile = new File(plugin.getDataFolder(), "config.yml");
+
+ if (!configFile.exists()) {
+ try {
+ Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
+ } catch (IOException ex) {
+ GroupManager.logger.log(Level.SEVERE, null, ex);
+ }
+ }
+
+ GMconfig = new YamlConfiguration();
+
+ try {
+ GMconfig.load(configFile);
+ } catch (Exception ex) {
+ throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
+ }
+
+ // Setup defaults
+ adjustLoggerLevel();
+ plugin.setValidateOnlinePlayer(isToggleValidate());
+ }
+
+ public boolean isOpOverride() {
+ return GMconfig.getBoolean("settings.config.opOverrides", true);
+ }
+ public boolean isToggleValidate() {
+ return GMconfig.getBoolean("settings.config.validate_toggle", true);
+ }
+
+ public Map<String, Object> getMirrorsMap() {
+ // Try to fetch the old mirror path first
if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) {
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
- } else if (GMconfig.isConfigurationSection("settings.mirrors")) {
+ } else if (GMconfig.isConfigurationSection("settings.mirrors")){
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
}
return null;
-
- }
-
- public Integer getSaveInterval() {
-
- return GMconfig.getInt("settings.data.save.minutes", 10);
- }
-
- public Integer getBackupDuration() {
-
- return GMconfig.getInt("settings.data.save.hours", 24);
- }
-
- public void adjustLoggerLevel() {
-
- try {
- GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
- return;
- } catch (Exception e) {
- }
-
- GroupManager.logger.setLevel(Level.INFO);
- }
+
+ }
+
+ public Integer getSaveInterval() {
+ return GMconfig.getInt("settings.data.save.minutes", 10);
+ }
+
+ public Integer getBackupDuration() {
+ return GMconfig.getInt("settings.data.save.hours", 24);
+ }
+
+ public void adjustLoggerLevel() {
+
+ try {
+ GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
+ return;
+ } catch (Exception e) {
+ }
+
+ GroupManager.logger.setLevel(Level.INFO);
+ }
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 5f357641a..00c71a41e 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -12,8 +12,8 @@ import org.anjocaido.groupmanager.data.Variables;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
+import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import java.io.File;
-import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,6 +28,7 @@ import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
import org.anjocaido.groupmanager.events.GMSystemEvent;
import org.anjocaido.groupmanager.events.GMWorldListener;
import org.anjocaido.groupmanager.events.GroupManagerEventHandler;
+import org.anjocaido.groupmanager.events.GMGroupEvent.Action;
import org.anjocaido.groupmanager.utils.GMLoggerHandler;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.anjocaido.groupmanager.utils.Tasks;
@@ -38,17 +39,20 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
+@SuppressWarnings("unused")
/**
*
- * @author gabrielcouto, ElgarL
+ * @author gabrielcouto
*/
public class GroupManager extends JavaPlugin {
+ // private File configFile;
private File backupFolder;
private Runnable commiter;
private ScheduledThreadPoolExecutor scheduler;
@@ -56,7 +60,21 @@ public class GroupManager extends JavaPlugin {
private Map<CommandSender, String> selectedWorlds = new HashMap<CommandSender, String>();
private WorldsHolder worldsHolder;
private boolean validateOnlinePlayer = true;
-
+ /**
+ * @return the validateOnlinePlayer
+ */
+ public boolean isValidateOnlinePlayer() {
+ return validateOnlinePlayer;
+ }
+
+ /**
+ * @param validateOnlinePlayer the validateOnlinePlayer to set
+ */
+ public void setValidateOnlinePlayer(boolean validateOnlinePlayer) {
+ this.validateOnlinePlayer = validateOnlinePlayer;
+ }
+
+ private boolean isReady = false;
private static boolean isLoaded = false;
protected GMConfiguration config;
@@ -68,31 +86,15 @@ public class GroupManager extends JavaPlugin {
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
// PERMISSIONS FOR COMMAND BEING LOADED
- private OverloadedWorldHolder dataHolder = null;
- private AnjoPermissionsHandler permissionHandler = null;
-
- private String lastError = "";
+ OverloadedWorldHolder dataHolder = null;
+ AnjoPermissionsHandler permissionHandler = null;
@Override
public void onDisable() {
-
- onDisable(false);
- }
-
- @Override
- public void onEnable() {
-
- onEnable(false);
- }
-
- public void onDisable(boolean restarting) {
-
setLoaded(false);
-
- if (!restarting) {
- // Unregister this service if we are shutting down.
- this.getServer().getServicesManager().unregister(this.worldsHolder);
- }
+
+ // Un-register this service.
+ this.getServer().getServicesManager().unregister(this);
disableScheduler(); // Shutdown before we save, so it doesn't interfere.
if (worldsHolder != null) {
@@ -103,206 +105,79 @@ public class GroupManager extends JavaPlugin {
}
}
-
-
- // Remove all attachments before clearing
- if (BukkitPermissions != null) {
- BukkitPermissions.removeAllAttachments();
- }
-
- if (!restarting) {
-
- if (WorldEvents != null)
- WorldEvents = null;
-
- BukkitPermissions = null;
-
- }
+ WorldEvents = null;
+ BukkitPermissions = null;
- // EXAMPLE: Custom code, here we just output some info so we can check that all is well
+ // EXAMPLE: Custom code, here we just output some info so we can check
+ // all is well
PluginDescriptionFile pdfFile = this.getDescription();
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
-
- if (!restarting)
- GroupManager.logger.removeHandler(ch);
+ GroupManager.logger.removeHandler(ch);
}
-
- public void onEnable(boolean restarting) {
-
- try {
- /*
- * reset local variables.
- */
- overloadedUsers = new HashMap<String, ArrayList<User>>();
- selectedWorlds = new HashMap<CommandSender, String>();
- lastError = "";
-
- /*
- * Setup our logger if we are not restarting.
- */
- if (!restarting) {
- GroupManager.logger.setUseParentHandlers(false);
- ch = new GMLoggerHandler();
- GroupManager.logger.addHandler(ch);
- }
- logger.setLevel(Level.ALL);
-
- // Create the backup folder, if it doesn't exist.
- prepareFileFields();
- // Load the config.yml
- prepareConfig();
- // Load the global groups
- globalGroups = new GlobalGroups(this);
-
- /*
- * Configure the worlds holder.
- */
- if (!restarting)
- worldsHolder = new WorldsHolder(this);
- else
- worldsHolder.resetWorldsHolder();
-
- /*
- * This should NEVER happen. No idea why it's still here.
- */
- PluginDescriptionFile pdfFile = this.getDescription();
- if (worldsHolder == null) {
- GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!");
- this.getServer().getPluginManager().disablePlugin(this);
- throw new IllegalStateException("An error ocurred while loading GroupManager");
- }
-
- /*
- * Prevent our registered events from triggering
- * updates as we are not fully loaded.
- */
- setLoaded(false);
-
- /*
- * Initialize the world listener and bukkit permissions
- * to handle events if this is a fresh start
- *
- * else
- *
- * Reset bukkit perms.
- */
- if (!restarting) {
- WorldEvents = new GMWorldListener(this);
- BukkitPermissions = new BukkitPermissions(this);
- } else {
- BukkitPermissions.reset();
- }
-
- /*
- * Start the scheduler for data saving.
- */
- enableScheduler();
-
- /*
- * Schedule a Bukkit Permissions update for 1 tick later.
- * All plugins will be loaded by then
- */
-
- if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) {
- GroupManager.logger.severe("Could not schedule superperms Update.");
- /*
- * Flag that we are now loaded and should start processing events.
- */
- setLoaded(true);
- }
-
- System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
- // Register as a service
- if (!restarting)
- this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest);
-
- } catch (Exception ex) {
+ @Override
+ public void onEnable() {
+ GroupManager.logger.setUseParentHandlers(false);
+ ch = new GMLoggerHandler();
+ GroupManager.logger.addHandler(ch);
+ logger.setLevel(Level.ALL);
- /*
- * Store the error and write to the log.
- */
- saveErrorLog(ex);
+ // Create the backup folder, if it doesn't exist.
+ prepareFileFields();
+ // Load the config.yml
+ prepareConfig();
+ // Load the global groups
+ globalGroups = new GlobalGroups(this);
+ worldsHolder = new WorldsHolder(this);
- /*
- * Throw an error so Bukkit knows about it.
- */
- throw new IllegalArgumentException(ex.getMessage(), ex);
+ PluginDescriptionFile pdfFile = this.getDescription();
+ if (worldsHolder == null) {
+ GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!");
+ this.getServer().getPluginManager().disablePlugin(this);
+ throw new IllegalStateException("An error ocurred while loading GroupManager");
}
- }
-
- /**
- * Write an error.log
- *
- * @param ex
- */
- private void saveErrorLog(Exception ex) {
- if (!getDataFolder().exists()) {
- getDataFolder().mkdirs();
- }
+ // Set a few defaults (reloads)
+ setLoaded(false);
+
+ // Initialize the world listener and bukkit permissions to handle
+ // events.
+ WorldEvents = new GMWorldListener(this);
+ BukkitPermissions = new BukkitPermissions(this);
- lastError = ex.getMessage();
+ enableScheduler();
- GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("= ERROR REPORT START =");
- GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("=== PLEASE COPY AND PASTE THE ERROR.LOG FROM THE ==");
- GroupManager.logger.severe("= GROUPMANAGER FOLDER TO AN ESSENTIALS DEVELOPER =");
- GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe(lastError);
- GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("= ERROR REPORT ENDED =");
- GroupManager.logger.severe("===================================================");
+ /*
+ * Schedule a Bukiit Permissions update for 1 tick later. All plugins
+ * will be loaded by then
+ */
- // Append this error to the error log.
- try {
- String error = "=============================== GM ERROR LOG ===============================\n\n";
- error += Tasks.getStackTraceAsString(ex);
- error += "\n============================================================================\n";
-
- Tasks.appendStringToFile(error, (getDataFolder() + System.getProperty("file.separator") + "ERROR.LOG"));
- } catch (IOException e) {
- // Failed to write file.
- e.printStackTrace();
+ if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) {
+ GroupManager.logger.severe("Could not schedule superperms Update.");
+ setLoaded(true);
}
- }
-
- /**
- * @return the validateOnlinePlayer
- */
- public boolean isValidateOnlinePlayer() {
-
- return validateOnlinePlayer;
- }
-
- /**
- * @param validateOnlinePlayer the validateOnlinePlayer to set
- */
- public void setValidateOnlinePlayer(boolean validateOnlinePlayer) {
-
- this.validateOnlinePlayer = validateOnlinePlayer;
+ System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
+
+ // Register as a service
+ this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest);
}
public static boolean isLoaded() {
-
return isLoaded;
}
public static void setLoaded(boolean isLoaded) {
-
GroupManager.isLoaded = isLoaded;
}
public InputStream getResourceAsStream(String fileName) {
-
return this.getClassLoader().getResourceAsStream(fileName);
}
private void prepareFileFields() {
-
+ // configFile = new File(this.getDataFolder(), "config.yml");
backupFolder = new File(this.getDataFolder(), "backup");
if (!backupFolder.exists()) {
getBackupFolder().mkdirs();
@@ -310,19 +185,16 @@ public class GroupManager extends JavaPlugin {
}
private void prepareConfig() {
-
config = new GMConfiguration(this);
}
public void enableScheduler() {
-
if (worldsHolder != null) {
disableScheduler();
commiter = new Runnable() {
@Override
public void run() {
-
try {
worldsHolder.saveChanges(false);
GroupManager.logger.log(Level.INFO, " Data files refreshed.");
@@ -332,19 +204,18 @@ public class GroupManager extends JavaPlugin {
}
};
scheduler = new ScheduledThreadPoolExecutor(1);
- long minutes = (long) getGMConfig().getSaveInterval();
+ long minutes = (long)getGMConfig().getSaveInterval();
if (minutes > 0) {
- scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES);
+ scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES);
GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!");
} else
GroupManager.logger.info("Scheduled Data Saving is Disabled!");
-
+
GroupManager.logger.info("Backups will be retained for " + getGMConfig().getBackupDuration() + " hours!");
}
}
public void disableScheduler() {
-
if (scheduler != null) {
try {
scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
@@ -357,21 +228,69 @@ public class GroupManager extends JavaPlugin {
}
}
- public WorldsHolder getWorldsHolder() {
+ /**
+ * Use the WorldsHolder saveChanges directly instead Saves the data on file
+ */
+ @Deprecated
+ public void commit() {
+ if (worldsHolder != null) {
+ worldsHolder.saveChanges();
+ }
+ }
+
+ /**
+ * Use worlds holder to reload a specific world Reloads the data
+ */
+ @Deprecated
+ public void reload() {
+ worldsHolder.reloadAll();
+ }
+ public WorldsHolder getWorldsHolder() {
return worldsHolder;
}
/**
+ * The handler in the interface created by AnjoCaido
+ *
+ * @return AnjoPermissionsHandler
+ */
+ @Deprecated
+ public AnjoPermissionsHandler getPermissionHandler() {
+ return worldsHolder.getDefaultWorld().getPermissionsHandler();
+ }
+
+ /**
+ * A simple interface, for ones that don't want to mess with overloading.
+ * Yet it is affected by overloading. But seamless.
+ *
+ * @return the dataholder with all information
+ */
+ @Deprecated
+ public WorldDataHolder getData() {
+ return worldsHolder.getDefaultWorld();
+ }
+
+ /**
+ * Use this if you want to play with overloading.
+ *
+ * @return a dataholder with overloading interface
+ */
+ @Deprecated
+ public OverloadedWorldHolder getOverloadedClassData() {
+ return worldsHolder.getDefaultWorld();
+ }
+
+ /**
* Called when a command registered by this plugin is received.
*
* @param sender
* @param cmd
* @param args
*/
+ @SuppressWarnings({ "deprecation" })
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
-
boolean playerCanDo = false;
boolean isConsole = false;
Player senderPlayer = null, targetPlayer = null;
@@ -382,27 +301,15 @@ public class GroupManager extends JavaPlugin {
// DETERMINING PLAYER INFORMATION
if (sender instanceof Player) {
senderPlayer = (Player) sender;
-
- if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) {
- sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)");
- return true;
- }
-
senderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getName());
senderGroup = senderUser.getGroup();
- isOpOverride = (isOpOverride && (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager.op")));
+ isOpOverride = (isOpOverride && senderPlayer.isOp());
System.out.println("[PLAYER_COMMAND] " + senderPlayer.getName() + ": /" + commandLabel + " " + Tasks.join(args, " "));
if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) {
playerCanDo = true;
}
} else if (sender instanceof ConsoleCommandSender) {
-
- if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) {
- sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)");
- return true;
- }
-
isConsole = true;
}
@@ -442,7 +349,7 @@ public class GroupManager extends JavaPlugin {
GroupManager.logger.severe("===================================================");
GroupManager.logger.severe("= ERROR REPORT START =");
GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("= COPY AND PASTE THIS TO A GROUPMANAGER DEVELOPER =");
+ GroupManager.logger.severe("= COPY AND PASTE THIS TO GROUPMANAGER DEVELOPER =");
GroupManager.logger.severe("===================================================");
GroupManager.logger.severe(this.getDescription().getName());
GroupManager.logger.severe(this.getDescription().getVersion());
@@ -467,29 +374,20 @@ public class GroupManager extends JavaPlugin {
if (isConsole || playerCanDo) {
switch (execCmd) {
case manuadd:
-
- // Validating arguments
- if ((args.length != 2) && (args.length != 3)) {
- sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group> | optional [world])");
- return false;
- }
-
- // Select the relevant world (if specified)
- if (args.length == 3) {
- dataHolder = worldsHolder.getWorldData(args[2]);
- permissionHandler = dataHolder.getPermissionsHandler();
- }
-
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
-
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ // VALIDANDO ARGUMENTOS
+ if (args.length != 2) {
+ sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
-
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ return false;
+ }
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
@@ -505,9 +403,9 @@ public class GroupManager extends JavaPlugin {
return false;
}
- // Validating permissions
+ // VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "Can't modify a player with the same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
@@ -515,43 +413,47 @@ public class GroupManager extends JavaPlugin {
return false;
}
if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
return false;
}
- // Seems OK
+ // PARECE OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
- sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'.");
+ sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'.");
- return true;
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
+ return true;
+ // break;
case manudel:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
- // Seems OK
+ // PARECE OK
dataHolder.removeUser(auxUser.getName());
sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' to default settings.");
@@ -561,9 +463,8 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updatePermissions(targetPlayer);
return true;
-
case manuaddsub:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender)) {
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
@@ -571,15 +472,15 @@ public class GroupManager extends JavaPlugin {
return true;
}
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
@@ -590,34 +491,37 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
- // Seems OK
+ // PARECE OK
if (auxUser.addSubGroup(auxGroup))
sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getName() + "'.");
else
sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getName() + "'.");
- return true;
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
+ return true;
case manudelsub:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
@@ -629,28 +533,27 @@ public class GroupManager extends JavaPlugin {
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
- // Seems OK
+ // PARECE OK
auxUser.removeSubGroup(auxGroup);
sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getName() + "' list.");
- // targetPlayer = this.getServer().getPlayer(auxUser.getName());
- // if (targetPlayer != null)
- // BukkitPermissions.updatePermissions(targetPlayer);
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
return true;
-
case mangadd:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
@@ -660,19 +563,18 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group already exists!");
return false;
}
- // Seems OK
+ // PARECE OK
auxGroup = dataHolder.createGroup(args[0]);
sender.sendMessage(ChatColor.YELLOW + "You created a group named: " + auxGroup.getName());
return true;
-
case mangdel:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
@@ -682,45 +584,44 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group not exists!");
return false;
}
- // Seems OK
+ // PARECE OK
dataHolder.removeGroup(auxGroup.getName());
sender.sendMessage(ChatColor.YELLOW + "You deleted a group named " + auxGroup.getName() + ", it's users are default group now.");
BukkitPermissions.updateAllPlayers();
return true;
-
case manuaddp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating your permissions
+ // VALIDANDO SUA PERMISSAO
if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher.");
return false;
}
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
- sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have.");
+ sender.sendMessage(ChatColor.RED + "Can't add a permission you don't have.");
return false;
}
- // Validating permissions of user
+ // VALIDANDO PERMISSAO DO DESTINO
permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
if (args[1].startsWith("+")) {
if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
@@ -745,7 +646,7 @@ public class GroupManager extends JavaPlugin {
return false;
}
}
- // Seems OK
+ // PARECE OK
auxUser.addPermission(args[1]);
sender.sendMessage(ChatColor.YELLOW + "You added '" + args[1] + "' to player '" + auxUser.getName() + "' permissions.");
@@ -754,38 +655,38 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updatePermissions(targetPlayer);
return true;
-
+ // break;
case manudelp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating your permissions
+ // VALIDANDO SUA PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher.");
return false;
}
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
- sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have.");
+ sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have.");
return false;
}
- // Validating permissions of user
+ // VALIDANDO PERMISSAO DO DESTINO
permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
sender.sendMessage(ChatColor.RED + "The user doesn't have direct access to that permission.");
@@ -796,7 +697,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel);
return false;
}
- // Seems OK
+ // PARECE OK
auxUser.removePermission(args[1]);
sender.sendMessage(ChatColor.YELLOW + "You removed '" + args[1] + "' from player '" + auxUser.getName() + "' permissions.");
@@ -805,30 +706,30 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updatePermissions(targetPlayer);
return true;
-
+ // break;
case manulistp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if ((args.length == 0) || (args.length > 2)) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> (+))");
return false;
}
-
+
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
- // Seems OK
+ // VALIDANDO PERMISSAO
+ // PARECE OK
auxString = "";
for (String perm : auxUser.getPermissionList()) {
auxString += perm + ", ";
@@ -870,36 +771,35 @@ public class GroupManager extends JavaPlugin {
}
return true;
-
case manucheckp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
targetPlayer = this.getServer().getPlayer(auxUser.getName());
- // Validating permission
+ // VALIDANDO PERMISSAO
permissionResult = permissionHandler.checkFullGMPermission(auxUser, args[1], false);
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
- // No permissions found in GM so fall through and check Bukkit.
+ //No permissions found in GM so fall through and check Bukkit.
sender.sendMessage(ChatColor.RED + "The player doesn't have access to that permission");
-
+
} else {
// This permission was found in groupmanager.
if (permissionResult.owner instanceof User) {
@@ -921,34 +821,33 @@ public class GroupManager extends JavaPlugin {
// superperms
if (targetPlayer != null) {
- sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)": ""));
+ sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]));
}
return true;
-
case mangaddp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
- // Validating your permissions
+ // VALIDANDO SUA PERMISSAO
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
- sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have.");
+ sender.sendMessage(ChatColor.RED + "Can't add a permission you don't have.");
return false;
}
- // Validating permissions of user
+ // VALIDANDO PERMISSAO DO DESTINO
permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]);
if (args[1].startsWith("+")) {
if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
@@ -968,42 +867,41 @@ public class GroupManager extends JavaPlugin {
}
} else {
if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) {
- sender.sendMessage(ChatColor.RED + "The group already has direct access to that permission.");
+ sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
}
}
- // Seems OK
+ // PARECE OK
auxGroup.addPermission(args[1]);
sender.sendMessage(ChatColor.YELLOW + "You added '" + args[1] + "' to group '" + auxGroup.getName() + "' permissions.");
BukkitPermissions.updateAllPlayers();
return true;
-
case mangdelp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
- // Validating your permissions
+ // VALIDANDO SUA PERMISSAO
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have.");
return false;
}
- // Validating permissions of user
+ // VALIDANDO PERMISSAO DO DESTINO
permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]);
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
sender.sendMessage(ChatColor.RED + "The group doesn't have direct access to that permission.");
@@ -1014,33 +912,32 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel);
return false;
}
- // Seems OK
+ // PARECE OK
auxGroup.removePermission(args[1]);
sender.sendMessage(ChatColor.YELLOW + "You removed '" + args[1] + "' from group '" + auxGroup.getName() + "' permissions.");
BukkitPermissions.updateAllPlayers();
return true;
-
case manglistp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
- // Seems OK
+ // PARECE OK
auxString = "";
for (String perm : auxGroup.getPermissionList()) {
auxString += perm + ", ";
@@ -1070,31 +967,31 @@ public class GroupManager extends JavaPlugin {
}
return true;
-
case mangcheckp:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
permissionResult = permissionHandler.checkGroupPermissionWithInheritance(auxGroup, args[1]);
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
sender.sendMessage(ChatColor.RED + "The group doesn't have access to that permission");
return false;
}
- // Seems OK
- // auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
+ // PARECE OK
+ // auxString =
+ // permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
if (permissionResult.owner instanceof Group) {
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
sender.sendMessage(ChatColor.RED + "The group inherits the a negation permission from group: " + permissionResult.owner.getName());
@@ -1105,74 +1002,72 @@ public class GroupManager extends JavaPlugin {
}
return true;
-
case mangaddi:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "Group 1 does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group 1 does not exists!");
return false;
}
auxGroup2 = dataHolder.getGroup(args[1]);
if (auxGroup2 == null) {
- sender.sendMessage(ChatColor.RED + "Group 2 does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
return false;
}
-
- // Validating permission
- if (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) {
+
+ // VALIDANDO PERMISSAO
+ if (permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)");
return false;
}
- // Seems OK
+ // PARECE OK
auxGroup.addInherits(auxGroup2);
sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list.");
BukkitPermissions.updateAllPlayers();
return true;
-
case mangdeli:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "Group 1 does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group 1 does not exists!");
return false;
}
auxGroup2 = dataHolder.getGroup(args[1]);
if (auxGroup2 == null) {
- sender.sendMessage(ChatColor.RED + "Group 2 does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
return false;
}
-
- // Validating permission
- if (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) {
+
+ // VALIDANDO PERMISSAO
+ if (!permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + ".");
return false;
}
@@ -1180,36 +1075,35 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + " directly.");
return false;
}
- // Seems OK
+ // PARECE OK
auxGroup.removeInherits(auxGroup2.getName());
sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list.");
BukkitPermissions.updateAllPlayers();
return true;
-
case manuaddv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length < 3) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable> <value>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
- // Seems OK
+ // VALIDANDO PERMISSAO
+ // PARECE OK
auxString = "";
for (int i = 2; i < args.length; i++) {
auxString += args[i];
@@ -1219,60 +1113,56 @@ public class GroupManager extends JavaPlugin {
}
auxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString));
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getName());
-
return true;
-
case manudelv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
-
+
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!auxUser.getVariables().hasVar(args[1])) {
sender.sendMessage(ChatColor.RED + "The user doesn't have directly that variable!");
}
- // Seems OK
+ // PARECE OK
auxUser.getVariables().removeVar(args[1]);
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the user " + ChatColor.GREEN + auxUser.getName());
-
return true;
-
case manulistv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
- // Seems OK
+ // VALIDANDO PERMISSAO
+ // PARECE OK
auxString = "";
for (String varKey : auxUser.getVariables().getVarKeyList()) {
Object o = auxUser.getVariables().getVarObject(varKey);
@@ -1284,29 +1174,27 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getName() + ": ");
sender.sendMessage(auxString + ".");
sender.sendMessage(ChatColor.YELLOW + "Plus all variables from group: " + auxUser.getGroupName());
-
return true;
-
case manucheckv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
+ // VALIDANDO PERMISSAO
auxGroup = auxUser.getGroup();
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);
@@ -1315,15 +1203,14 @@ public class GroupManager extends JavaPlugin {
if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null)
for (Group subGroup : auxUser.subGroupListCopy()) {
auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]);
- if (auxGroup2 != null)
- continue;
+ if (auxGroup2 != null) continue;
}
if (auxGroup2 == null) {
sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!");
return false;
}
}
- // Seems OK
+ // PARECE OK
if (auxUser.getVariables().hasVar(auxString)) {
sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxUser.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'");
sender.sendMessage(ChatColor.YELLOW + "This user own directly the variable");
@@ -1332,31 +1219,29 @@ public class GroupManager extends JavaPlugin {
if (!auxGroup.equals(auxGroup2)) {
sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName());
}
-
return true;
-
case mangaddv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length < 3) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable> <value>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
- // Validating permission
- // Seems OK
+ // VALIDANDO PERMISSAO
+ // PARECE OK
auxString = "";
for (int i = 2; i < args.length; i++) {
auxString += args[i];
@@ -1368,59 +1253,57 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the group " + auxGroup.getName());
return true;
-
case mangdelv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!auxGroup.getVariables().hasVar(args[1])) {
sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!");
}
- // Seems OK
+ // PARECE OK
auxGroup.getVariables().removeVar(args[1]);
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the group " + ChatColor.GREEN + auxGroup.getName());
return true;
-
case manglistv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
- // Validating permission
- // Seems OK
+ // VALIDANDO PERMISSAO
+ // PARECE OK
auxString = "";
for (String varKey : auxGroup.getVariables().getVarKeyList()) {
Object o = auxGroup.getVariables().getVarObject(varKey);
@@ -1439,74 +1322,60 @@ public class GroupManager extends JavaPlugin {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "Plus all variables from groups: " + auxString);
}
-
return true;
-
case mangcheckv:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
if (auxGroup == null) {
- sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
+ sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
- // Validating permission
- auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);
+ // VALIDANDO PERMISSAO
+ auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null);
if (auxGroup2 == null) {
sender.sendMessage(ChatColor.RED + "The group doesn't have access to that variable!");
}
- // Seems OK
+ // PARECE OK
sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'");
if (!auxGroup.equals(auxGroup2)) {
sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName());
}
-
return true;
-
case manwhois:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Seems OK
+ // PARECE OK
sender.sendMessage(ChatColor.YELLOW + "Name: " + ChatColor.GREEN + auxUser.getName());
sender.sendMessage(ChatColor.YELLOW + "Group: " + ChatColor.GREEN + auxUser.getGroup().getName());
- // Compile a list of subgroups
- auxString = "";
- for (String subGroup : auxUser.subGroupListStringCopy()) {
- auxString += subGroup + ", ";
- }
- if (auxString.lastIndexOf(",") > 0) {
- auxString = auxString.substring(0, auxString.lastIndexOf(","));
- sender.sendMessage(ChatColor.YELLOW + "subgroups: " + auxString);
- }
-
sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getName()));
auxGroup = dataHolder.surpassOverload(auxUser.getName()).getGroup();
if (!auxGroup.equals(auxUser.getGroup())) {
@@ -1514,32 +1383,32 @@ public class GroupManager extends JavaPlugin {
}
// victim.permissions.add(args[1]);
return true;
-
+ // break;
case tempadd:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
- // Seems OK
+ // PARECE OK
if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
@@ -1548,32 +1417,32 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Player overloaded!");
return true;
-
+ // break;
case tempdel:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
} else {
auxUser = dataHolder.getUser(args[0]);
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
- // Seems OK
+ // PARECE OK
if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
@@ -1581,12 +1450,12 @@ public class GroupManager extends JavaPlugin {
if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) {
overloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser);
}
- sender.sendMessage(ChatColor.YELLOW + "You removed that player's overload. He's back to normal!");
+ sender.sendMessage(ChatColor.YELLOW + "You removed that player overload. He's back to normal!");
return true;
-
+ // break;
case templist:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
@@ -1604,7 +1473,7 @@ public class GroupManager extends JavaPlugin {
}
}
if (count == 0) {
- sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode.");
+ sender.sendMessage(ChatColor.YELLOW + "There is no users in overload mode");
return true;
}
auxString = auxString.substring(0, auxString.lastIndexOf(","));
@@ -1613,11 +1482,9 @@ public class GroupManager extends JavaPlugin {
}
overloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList);
sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode: " + ChatColor.WHITE + auxString);
-
return true;
-
case tempdelall:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
@@ -1632,24 +1499,23 @@ public class GroupManager extends JavaPlugin {
}
}
if (count == 0) {
- sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode.");
+ sender.sendMessage(ChatColor.YELLOW + "There is no users in overload mode");
return true;
}
if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
overloadedUsers.get(dataHolder.getName().toLowerCase()).clear();
- sender.sendMessage(ChatColor.YELLOW + " " + count + "All users in overload mode are now normal again.");
+ sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode. Now they are normal again.");
return true;
-
case mansave:
-
+
boolean forced = false;
-
+
if ((args.length == 1) && (args[0].equalsIgnoreCase("force")))
forced = true;
-
+
try {
worldsHolder.saveChanges(forced);
sender.sendMessage(ChatColor.YELLOW + " All changes were saved.");
@@ -1659,17 +1525,10 @@ public class GroupManager extends JavaPlugin {
return true;
case manload:
-
/**
* Attempt to reload a specific world
*/
if (args.length > 0) {
-
- if (!lastError.isEmpty()) {
- sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)");
- return true;
- }
-
auxString = "";
for (int i = 0; i < args.length; i++) {
auxString += args[i];
@@ -1682,7 +1541,7 @@ public class GroupManager extends JavaPlugin {
globalGroups.load();
worldsHolder.loadWorld(auxString);
-
+
sender.sendMessage("The request to reload world '" + auxString + "' was attempted.");
isLoaded = true;
@@ -1690,30 +1549,24 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
} else {
-
+
/**
* Reload all settings and data as no world was specified.
*/
-
- /*
- * Attempting a fresh load.
- */
- onDisable(true);
- onEnable(true);
-
- sender.sendMessage("All settings and worlds were reloaded!");
+ onDisable();
+ onEnable();
}
-
+
/**
* Fire an event as none will have been triggered in the reload.
*/
if (GroupManager.isLoaded())
- GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED);
+ GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED);
return true;
-
+
case listgroups:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
@@ -1730,22 +1583,20 @@ public class GroupManager extends JavaPlugin {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
}
sender.sendMessage(ChatColor.YELLOW + " Groups Available: " + ChatColor.WHITE + auxString);
-
return true;
-
case manpromote:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
@@ -1761,9 +1612,9 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
@@ -1771,37 +1622,41 @@ public class GroupManager extends JavaPlugin {
return false;
}
if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
return false;
}
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
return false;
}
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
return false;
}
- // Seems OK
+ // PARECE OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
- return true;
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
+ return true;
+ // break;
case mandemote:
- // Validating state of sender
+ // VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
- // Validating arguments
+ // VALIDANDO ARGUMENTOS
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
- return false;
+ return false;
}
if (match != null) {
auxUser = dataHolder.getUser(match.get(0));
@@ -1817,9 +1672,9 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
- // Validating permission
+ // VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
@@ -1827,24 +1682,28 @@ public class GroupManager extends JavaPlugin {
return false;
}
if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don' inherit.");
return false;
}
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
- sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line.");
+ sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
return false;
}
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
sender.sendMessage(ChatColor.RED + "The new group must be a lower rank.");
return false;
}
- // Seems OK
+ // PARECE OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
- return true;
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
+ return true;
+ // break;
case mantogglevalidate:
validateOnlinePlayer = !validateOnlinePlayer;
sender.sendMessage(ChatColor.YELLOW + "Validade if player is online, now set to: " + Boolean.toString(validateOnlinePlayer));
@@ -1875,9 +1734,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Your world now uses permissions of world name: '" + dataHolder.getName() + "' ");
}
}
-
return true;
-
case manselect:
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)");
@@ -1908,9 +1765,7 @@ public class GroupManager extends JavaPlugin {
permissionHandler = dataHolder.getPermissionsHandler();
selectedWorlds.put(sender, dataHolder.getName());
sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'.");
-
return true;
-
case manclear:
if (args.length != 0) {
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
@@ -1918,9 +1773,7 @@ public class GroupManager extends JavaPlugin {
}
selectedWorlds.remove(sender);
sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible).");
-
return true;
-
default:
break;
}
@@ -1970,7 +1823,7 @@ public class GroupManager extends JavaPlugin {
}
}
-
+
/**
* Load a List of players matching the name given. If none online, check
* Offline.
@@ -1989,7 +1842,7 @@ public class GroupManager extends JavaPlugin {
if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) {
match.add(playerName);
} else {
- // look for partial matches
+ //look for partial matches
for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) {
if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase()))
match.add(offline.getName());
@@ -2009,7 +1862,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Too many matches found! (" + match.toString() + ")");
return null;
}
-
+
return match;
}
@@ -2018,7 +1871,6 @@ public class GroupManager extends JavaPlugin {
* @return the config
*/
public GMConfiguration getGMConfig() {
-
return config;
}
@@ -2026,12 +1878,10 @@ public class GroupManager extends JavaPlugin {
* @return the backupFolder
*/
public File getBackupFolder() {
-
return backupFolder;
}
public static GlobalGroups getGlobalGroups() {
-
return globalGroups;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index 751dc8fd6..396240ec6 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -15,173 +15,160 @@ import java.util.List;
import java.util.Map;
/**
- *
+ *
* @author gabrielcouto/ElgarL
*/
public class Group extends DataUnit implements Cloneable {
- /**
- * The group it inherits DIRECTLY!
- */
- private ArrayList<String> inherits = new ArrayList<String>();
- /**
- * This one holds the fields in INFO node.
- * like prefix = 'c'
- * or build = false
- */
- private GroupVariables variables = new GroupVariables(this);
-
- /**
- * Constructor for individual World Groups.
- *
- * @param name
- */
- public Group(WorldDataHolder source, String name) {
-
- super(source, name);
- }
-
- /**
- * Constructor for Global Groups.
- *
- * @param name
- */
- public Group(String name) {
-
- super(name);
- }
-
- /**
- * Is this a GlobalGroup
- *
- * @return true if this is a global group
- */
- public boolean isGlobal() {
-
- return (getDataSource() == null);
- }
-
- /**
- * Clone this group
- *
- * @return a clone of this group
- */
- @Override
- public Group clone() {
-
- Group clone;
-
- if (isGlobal()) {
- clone = new Group(this.getName());
- } else {
- clone = new Group(getDataSource(), this.getName());
- clone.inherits = new ArrayList<String>(this.getInherits());
- }
-
- for (String perm : this.getPermissionList()) {
- clone.addPermission(perm);
- }
- clone.variables = ((GroupVariables) variables).clone(clone);
- //clone.flagAsChanged();
- return clone;
- }
-
- /**
- * Use this to deliver a group from a different dataSource to another
- *
- * @param dataSource
- * @return Null or Clone
- */
- public Group clone(WorldDataHolder dataSource) {
-
- if (dataSource.groupExists(this.getName())) {
- return null;
- }
-
- Group clone = dataSource.createGroup(this.getName());
-
- // Don't add inheritance for GlobalGroups
- if (!isGlobal()) {
- clone.inherits = new ArrayList<String>(this.getInherits());
- }
- for (String perm : this.getPermissionList()) {
- clone.addPermission(perm);
- }
- clone.variables = variables.clone(clone);
- clone.flagAsChanged(); //use this to make the new dataSource save the new group
- return clone;
- }
-
- /**
- * an unmodifiable list of inherits list
- * You can't manage the list by here
- * Lol... version 0.6 had a problem because this.
- *
- * @return the inherits
- */
- public List<String> getInherits() {
-
- return Collections.unmodifiableList(inherits);
- }
-
- /**
- * @param inherit the inherits to set
- */
- public void addInherits(Group inherit) {
-
- if (!isGlobal()) {
- if (!this.getDataSource().groupExists(inherit.getName())) {
- getDataSource().addGroup(inherit);
- }
- if (!inherits.contains(inherit.getName().toLowerCase())) {
- inherits.add(inherit.getName().toLowerCase());
- }
- flagAsChanged();
- if (GroupManager.isLoaded()) {
- GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
- }
- }
- }
-
- public boolean removeInherits(String inherit) {
-
- if (!isGlobal()) {
- if (this.inherits.contains(inherit.toLowerCase())) {
- this.inherits.remove(inherit.toLowerCase());
- flagAsChanged();
- GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return the variables
- */
- public GroupVariables getVariables() {
-
- return variables;
- }
-
- /**
- *
- * @param varList
- */
- public void setVariables(Map<String, Object> varList) {
-
- if (!isGlobal()) {
- GroupVariables temp = new GroupVariables(this, varList);
- variables.clearVars();
- for (String key : temp.getVarKeyList()) {
- variables.addVar(key, temp.getVarObject(key));
- }
- flagAsChanged();
- if (GroupManager.isLoaded()) {
- GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
- }
- }
- }
+ /**
+ * The group it inherits DIRECTLY!
+ */
+ private ArrayList<String> inherits = new ArrayList<String>();
+ /**
+ *This one holds the fields in INFO node.
+ * like prefix = 'c'
+ * or build = false
+ */
+ private GroupVariables variables = new GroupVariables(this);
+
+ /**
+ * Constructor for individual World Groups.
+ *
+ * @param name
+ */
+ public Group(WorldDataHolder source, String name) {
+ super(source, name);
+ }
+
+ /**
+ * Constructor for Global Groups.
+ *
+ * @param name
+ */
+ public Group(String name) {
+ super(name);
+ }
+
+ /**
+ * Is this a GlobalGroup
+ *
+ * @return
+ */
+ public boolean isGlobal() {
+ return (getDataSource() == null);
+ }
+
+ /**
+ * Clone this group
+ * @return a clone of this group
+ */
+ @Override
+ public Group clone() {
+ Group clone;
+
+ if (isGlobal()) {
+ clone = new Group(this.getName());
+ } else {
+ clone = new Group(getDataSource(), this.getName());
+ clone.inherits = new ArrayList<String>(this.getInherits());
+ }
+
+ for (String perm : this.getPermissionList()) {
+ clone.addPermission(perm);
+ }
+ clone.variables = ((GroupVariables) variables).clone(clone);
+ //clone.flagAsChanged();
+ return clone;
+ }
+
+ /**
+ * Use this to deliver a group from a different dataSource to another
+ * @param dataSource
+ * @return Null or Clone
+ */
+ public Group clone(WorldDataHolder dataSource) {
+ if (dataSource.groupExists(this.getName())) {
+ return null;
+ }
+
+ Group clone = dataSource.createGroup(this.getName());
+
+ // Don't add inheritance for GlobalGroups
+ if (!isGlobal()) {
+ clone.inherits = new ArrayList<String>(this.getInherits());
+ }
+ for (String perm : this.getPermissionList()) {
+ clone.addPermission(perm);
+ }
+ clone.variables = variables.clone(clone);
+ clone.flagAsChanged(); //use this to make the new dataSource save the new group
+ return clone;
+ }
+
+ /**
+ * an unmodifiable list of inherits list
+ * You can't manage the list by here
+ * Lol... version 0.6 had a problem because this.
+ * @return the inherits
+ */
+ public List<String> getInherits() {
+ return Collections.unmodifiableList(inherits);
+ }
+
+ /**
+ * @param inherit the inherits to set
+ */
+ public void addInherits(Group inherit) {
+ if (!isGlobal()) {
+ if (!this.getDataSource().groupExists(inherit.getName())) {
+ getDataSource().addGroup(inherit);
+ }
+ if (!inherits.contains(inherit.getName().toLowerCase())) {
+ inherits.add(inherit.getName().toLowerCase());
+ }
+ flagAsChanged();
+ if (GroupManager.isLoaded()) {
+ GroupManager.BukkitPermissions.updateAllPlayers();
+ GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
+ }
+ }
+ }
+
+ public boolean removeInherits(String inherit) {
+ if (!isGlobal()) {
+ if (this.inherits.contains(inherit.toLowerCase())) {
+ this.inherits.remove(inherit.toLowerCase());
+ flagAsChanged();
+ GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return the variables
+ */
+ public GroupVariables getVariables() {
+ return variables;
+ }
+
+ /**
+ *
+ * @param varList
+ */
+ public void setVariables(Map<String, Object> varList) {
+ if (!isGlobal()) {
+ GroupVariables temp = new GroupVariables(this, varList);
+ variables.clearVars();
+ for (String key : temp.getVarKeyList()) {
+ variables.addVar(key, temp.getVarObject(key));
+ }
+ flagAsChanged();
+ if (GroupManager.isLoaded()) {
+ GroupManager.BukkitPermissions.updateAllPlayers();
+ GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
+ }
+ }
+ }
}