summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-08-14 21:56:40 +0200
committersnowleo <schneeleo@gmail.com>2011-08-14 21:56:40 +0200
commita2fa666fd5b1cd3f6fac82da1063268589fd967a (patch)
tree13ad9b3787832f0ced78de98e01ff035a58885af /EssentialsGroupManager/src/org
parent76eb00575bcd855f74c1cf284a09a9c58f928f7d (diff)
downloadEssentials-a2fa666fd5b1cd3f6fac82da1063268589fd967a.tar
Essentials-a2fa666fd5b1cd3f6fac82da1063268589fd967a.tar.gz
Essentials-a2fa666fd5b1cd3f6fac82da1063268589fd967a.tar.lz
Essentials-a2fa666fd5b1cd3f6fac82da1063268589fd967a.tar.xz
Essentials-a2fa666fd5b1cd3f6fac82da1063268589fd967a.zip
GroupManager update to Permissions 3.1.6 API done by ElgarL
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java2
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java28
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java19
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java12
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java2
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java46
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java13
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java14
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java7
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java92
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java17
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java204
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java77
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java0
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java1
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java1
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java19
-rwxr-xr-x[-rw-r--r--]EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java53
18 files changed, 437 insertions, 170 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
index 68253eccc..153221ed9 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
@@ -117,4 +117,4 @@ public class GMConfiguration {
}
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 890af718b..7f6e0fb85 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -32,6 +32,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
+@SuppressWarnings("unused")
/**
*
* @author gabrielcouto
@@ -48,7 +49,7 @@ public class GroupManager extends JavaPlugin {
private boolean validateOnlinePlayer = true;
private boolean isReady = false;
private GMConfiguration config;
- private GMLoggerHandler ch;
+ private GMLoggerHandler ch;
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
@Override
@@ -60,7 +61,7 @@ public class GroupManager extends JavaPlugin {
// 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!");
- GroupManager.logger.removeHandler(ch);
+ GroupManager.logger.removeHandler(ch);
}
@Override
@@ -166,7 +167,7 @@ public class GroupManager extends JavaPlugin {
}
/**
- * A simple interface, for ones that don't want to mess with overloading.
+ * A simple interface, for ones that don't want to mess with overloading.
* Yet it is affected by overloading. But seamless.
* @return the dataholder with all information
*/
@@ -176,8 +177,8 @@ public class GroupManager extends JavaPlugin {
}
/**
- * Use this if you want to play with overloading.
- * @return a dataholder with overloading interface
+ * Use this if you want to play with overloading.
+ * @return a dataholder with overloading interface
*/
@Deprecated
public OverloadedWorldHolder getOverloadedClassData() {
@@ -186,10 +187,11 @@ public class GroupManager extends JavaPlugin {
/**
* Called when a command registered by this plugin is received.
- * @param sender
- * @param cmd
+ * @param sender
+ * @param cmd
* @param args
*/
+ @SuppressWarnings({"null", "deprecation"})
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
boolean playerCanDo = false;
@@ -246,9 +248,9 @@ public class GroupManager extends JavaPlugin {
} catch (Exception e) {
//this error happened once with someone. now im prepared... i think
GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("= ERROR REPORT START =");
+ GroupManager.logger.severe("= ERROR REPORT START =");
GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("= COPY AND PASTE THIS TO GROUPMANAGER DEVELOPER =");
+ GroupManager.logger.severe("= COPY AND PASTE THIS TO GROUPMANAGER DEVELOPER =");
GroupManager.logger.severe("===================================================");
GroupManager.logger.severe(this.getDescription().getName());
GroupManager.logger.severe(this.getDescription().getVersion());
@@ -265,7 +267,7 @@ public class GroupManager extends JavaPlugin {
GroupManager.logger.severe(val.name());
}
GroupManager.logger.severe("===================================================");
- GroupManager.logger.severe("= ERROR REPORT ENDED =");
+ GroupManager.logger.severe("= ERROR REPORT ENDED =");
GroupManager.logger.severe("===================================================");
sender.sendMessage("An error occurred. Ask the admin to take a look at the console.");
}
@@ -889,7 +891,7 @@ public class GroupManager extends JavaPlugin {
}
//PARECE OK
auxGroup.addInherits(auxGroup2);
- sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list.");
+ sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list.");
return true;
case mangdeli:
@@ -925,7 +927,7 @@ public class GroupManager extends JavaPlugin {
}
//PARECE OK
auxGroup.removeInherits(auxGroup2.getName());
- sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list.");
+ sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list.");
return true;
case manuaddv:
@@ -1633,4 +1635,4 @@ public class GroupManager extends JavaPlugin {
public File getBackupFolder() {
return backupFolder;
}
-}
+} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
index 3eb7491dd..f17d8b21e 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
@@ -27,7 +27,7 @@ public abstract class DataUnit {
}
/**
- * Every group is matched only by their names and DataSources names.
+ * Every group is matched only by their names and DataSources names.
* @param o
* @return true if they are equal. false if not.
*/
@@ -49,9 +49,6 @@ public abstract class DataUnit {
return hash;
}
-
-
-
/**
* @return the dataSource
*/
@@ -67,10 +64,10 @@ public abstract class DataUnit {
}
public void flagAsChanged() {
- GroupManager.logger.finest("DataSource: "+getDataSource().getName()+" - DataUnit: "+getName()+" flagged as changed!");
-// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
-// GroupManager.logger.finest(st.toString());
-// }
+ GroupManager.logger.finest("DataSource: " + getDataSource().getName() + " - DataUnit: " + getName() + " flagged as changed!");
+// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
+// GroupManager.logger.finest(st.toString());
+// }
changed = true;
}
@@ -79,7 +76,7 @@ public abstract class DataUnit {
}
public void flagAsSaved() {
- GroupManager.logger.finest("DataSource: "+getDataSource().getName()+" - DataUnit: "+getName()+" flagged as saved!");
+ GroupManager.logger.finest("DataSource: " + getDataSource().getName() + " - DataUnit: " + getName() + " flagged as saved!");
changed = false;
}
@@ -108,7 +105,7 @@ public abstract class DataUnit {
return (ArrayList<String>) permissions.clone();
}
- public void sortPermissions(){
+ public void sortPermissions() {
Collections.sort(permissions, StringPermissionComparator.getInstance());
}
-}
+} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index c734b208e..4af5449fc 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -30,18 +30,18 @@ public class Group extends DataUnit implements Cloneable {
* @param name
*/
public Group(WorldDataHolder source, String name) {
- super(source,name);
+ super(source, name);
}
/**
- * Clone this group
+ * Clone this group
* @return a clone of this group
*/
@Override
public Group clone() {
Group clone = new Group(getDataSource(), this.getName());
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
- for(String perm: this.getPermissionList()){
+ for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
clone.variables = ((GroupVariables) variables).clone(clone);
@@ -60,7 +60,7 @@ public class Group extends DataUnit implements Cloneable {
}
Group clone = getDataSource().createGroup(this.getName());
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
- for(String perm: this.getPermissionList()){
+ for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
clone.variables = variables.clone(clone);
@@ -108,13 +108,13 @@ public class Group extends DataUnit implements Cloneable {
}
/**
- *
+ *
* @param varList
*/
public void setVariables(Map<String, Object> varList) {
GroupVariables temp = new GroupVariables(this, varList);
variables.clearVars();
- for(String key: temp.getVarKeyList()){
+ for (String key : temp.getVarKeyList()) {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
index 87c34de2b..4775eac1f 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
@@ -45,7 +45,7 @@ public class GroupVariables extends Variables implements Cloneable {
}
/**
- * A clone of all vars here.
+ * A clone of all vars here.
* @return
*/
protected GroupVariables clone(Group newOwner) {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index ceecbfa21..b90cf4ff1 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -4,7 +4,7 @@
*/
package org.anjocaido.groupmanager.data;
-import com.sun.org.apache.bcel.internal.generic.AALOAD;
+//import com.sun.org.apache.bcel.internal.generic.AALOAD;
import java.util.ArrayList;
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import java.util.Map;
@@ -27,13 +27,12 @@ public class User extends DataUnit implements Cloneable {
*/
private UserVariables variables = new UserVariables(this);
-
/**
*
* @param name
*/
public User(WorldDataHolder source, String name) {
- super(source,name);
+ super(source, name);
this.group = source.getDefaultGroup().getName();
}
@@ -45,7 +44,7 @@ public class User extends DataUnit implements Cloneable {
public User clone() {
User clone = new User(getDataSource(), this.getName());
clone.group = this.group;
- for(String perm: this.getPermissionList()){
+ for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
//clone.variables = this.variables.clone();
@@ -68,7 +67,7 @@ public class User extends DataUnit implements Cloneable {
} else {
clone.setGroup(this.getGroupName());
}
- for(String perm: this.getPermissionList()){
+ for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
//clone.variables = this.variables.clone();
@@ -117,43 +116,47 @@ public class User extends DataUnit implements Cloneable {
flagAsChanged();
}
- public void addSubGroup(Group subGroup){
- if(this.group.equalsIgnoreCase(subGroup.getName())){
+ public void addSubGroup(Group subGroup) {
+ if (this.group.equalsIgnoreCase(subGroup.getName())) {
return;
}
if (!this.getDataSource().groupExists(subGroup.getName())) {
getDataSource().addGroup(subGroup);
- }
+ }
subGroup = getDataSource().getGroup(subGroup.getName());
removeSubGroup(subGroup);
subGroups.add(subGroup.getName());
flagAsChanged();
}
- public int subGroupsSize(){
+
+ public int subGroupsSize() {
return subGroups.size();
}
- public boolean isSubGroupsEmpty(){
+
+ public boolean isSubGroupsEmpty() {
return subGroups.isEmpty();
}
- public boolean containsSubGroup(Group subGroup){
+
+ public boolean containsSubGroup(Group subGroup) {
return subGroups.contains(subGroup.getName());
}
- public boolean removeSubGroup(Group subGroup){
- try{
- if(subGroups.remove(subGroup.getName())){
+
+ public boolean removeSubGroup(Group subGroup) {
+ try {
+ if (subGroups.remove(subGroup.getName())) {
flagAsChanged();
return true;
}
- } catch (Exception e){
-
+ } catch (Exception e) {
}
return false;
}
- public ArrayList<Group> subGroupListCopy(){
+
+ public ArrayList<Group> subGroupListCopy() {
ArrayList<Group> val = new ArrayList<Group>();
- for(String gstr: subGroups){
+ for (String gstr : subGroups) {
Group g = getDataSource().getGroup(gstr);
- if(g==null){
+ if (g == null) {
removeSubGroup(g);
continue;
}
@@ -161,7 +164,8 @@ public class User extends DataUnit implements Cloneable {
}
return val;
}
- public ArrayList<String> subGroupListStringCopy(){
+
+ public ArrayList<String> subGroupListStringCopy() {
return (ArrayList<String>) subGroups.clone();
}
@@ -179,7 +183,7 @@ public class User extends DataUnit implements Cloneable {
public void setVariables(Map<String, Object> varList) {
UserVariables temp = new UserVariables(this, varList);
variables.clearVars();
- for(String key: temp.getVarKeyList()){
+ for (String key : temp.getVarKeyList()) {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
index 45dfc31e7..3f3a6c374 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
@@ -2,7 +2,6 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
-
package org.anjocaido.groupmanager.data;
import java.util.Map;
@@ -11,19 +10,23 @@ import java.util.Map;
*
* @author gabrielcouto
*/
-public class UserVariables extends Variables{
+public class UserVariables extends Variables {
+
private User owner;
- public UserVariables(User owner){
+
+ public UserVariables(User owner) {
super(owner);
this.owner = owner;
}
+
public UserVariables(User owner, Map<String, Object> varList) {
super(owner);
this.variables = varList;
this.owner = owner;
}
+
/**
- * A clone of all vars here.
+ * A clone of all vars here.
* @return
*/
protected UserVariables clone(User newOwner) {
@@ -34,6 +37,7 @@ public class UserVariables extends Variables{
newOwner.flagAsChanged();
return clone;
}
+
/**
* @return the owner
*/
@@ -41,5 +45,4 @@ public class UserVariables extends Variables{
public User getOwner() {
return owner;
}
-
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
index 31ed0d795..547e6266d 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
@@ -19,12 +19,14 @@ import java.util.Set;
* @author gabrielcouto
*/
public abstract class Variables implements Cloneable {
+
private DataUnit owner;
protected Map<String, Object> variables = new HashMap<String, Object>();
- public Variables(DataUnit owner){
+ public Variables(DataUnit owner) {
this.owner = owner;
}
+
/**
* Add var to the the INFO node.
* examples:
@@ -45,7 +47,7 @@ public abstract class Variables implements Cloneable {
}
/**
- * Returns the object inside the var
+ * Returns the object inside the var
* @param name
* @return a Object if exists. null if doesn't exists
*/
@@ -112,7 +114,7 @@ public abstract class Variables implements Cloneable {
}
/**
- * All variable keys this is holding
+ * All variable keys this is holding
* @return
*/
public Set<String> getVarKeyList() {
@@ -122,7 +124,7 @@ public abstract class Variables implements Cloneable {
}
/**
- * verify is a var exists
+ * verify is a var exists
* @param name the key name of the var
* @return true if that var exists
*/
@@ -174,7 +176,7 @@ public abstract class Variables implements Cloneable {
}
- public void clearVars(){
+ public void clearVars() {
variables.clear();
owner.flagAsChanged();
}
@@ -186,7 +188,7 @@ public abstract class Variables implements Cloneable {
return owner;
}
- public boolean isEmpty(){
+ public boolean isEmpty() {
return variables.isEmpty();
}
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
index f735ff5e6..42c78cccf 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
@@ -25,6 +25,7 @@ public class OverloadedWorldHolder extends WorldDataHolder {
*
* @param ph
*/
+ @SuppressWarnings("deprecation")
public OverloadedWorldHolder(WorldDataHolder ph) {
super(ph.getName());
this.f = ph.f;
@@ -135,7 +136,7 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @return
*/
@Override
@@ -185,7 +186,7 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- * Gets the user in normal state. Surpassing the overload state.
+ * Gets the user in normal state. Surpassing the overload state.
* It doesn't affect permissions. But it enables plugins change the
* actual user permissions even in overload mode.
* @param userName
@@ -201,4 +202,4 @@ public class OverloadedWorldHolder extends WorldDataHolder {
User newUser = createUser(userName);
return newUser;
}
-}
+} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index ac26138c4..1331a92ad 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -42,7 +42,7 @@ public class WorldDataHolder {
*/
protected String name;
/**
- * The actual groups holder
+ * The actual groups holder
*/
protected Map<String, Group> groups = new HashMap<String, Group>();
/**
@@ -50,7 +50,7 @@ public class WorldDataHolder {
*/
protected Map<String, User> users = new HashMap<String, User>();
/**
- * Points to the default group
+ * Points to the default group
*/
protected Group defaultGroup = null;
/**
@@ -81,7 +81,7 @@ public class WorldDataHolder {
protected boolean haveGroupsChanged = false;
/**
- * Prevent direct instantiation
+ * Prevent direct instantiation
* @param worldName
*/
protected WorldDataHolder(String worldName) {
@@ -90,7 +90,7 @@ public class WorldDataHolder {
/**
* The main constructor for a new WorldDataHolder
- * Please don't set the default group as null
+ * Please don't set the default group as null
* @param worldName
* @param defaultGroup the default group. its good to start with one
*/
@@ -116,7 +116,7 @@ public class WorldDataHolder {
}
/**
- * Add a user to the list. If it already exists, overwrite the old.
+ * Add a user to the list. If it already exists, overwrite the old.
* @param theUser the user you want to add to the permission list
*/
public void addUser(User theUser) {
@@ -158,7 +158,7 @@ public class WorldDataHolder {
}
/**
- * Change the default group of the file.
+ * Change the default group of the file.
* @param group the group you want make default.
*/
public void setDefaultGroup(Group group) {
@@ -170,7 +170,7 @@ public class WorldDataHolder {
}
/**
- * Returns the default group of the file
+ * Returns the default group of the file
* @return the default group
*/
public Group getDefaultGroup() {
@@ -178,7 +178,7 @@ public class WorldDataHolder {
}
/**
- * Returns a group of the given name
+ * Returns a group of the given name
* @param groupName the name of the group
* @return a group if it is found. null if not found.
*/
@@ -187,7 +187,7 @@ public class WorldDataHolder {
}
/**
- * Check if a group exists.
+ * Check if a group exists.
* Its the same of getGroup, but check if it is null.
* @param groupName the name of the group
* @return true if exists. false if not.
@@ -210,7 +210,7 @@ public class WorldDataHolder {
}
/**
- * Remove the group to the list
+ * Remove the group to the list
* @param groupName
* @return true if had something to remove. false the group was default or non-existant
*/
@@ -277,7 +277,7 @@ public class WorldDataHolder {
}
/**
- * reads the file again
+ * reads the file again
*/
public void reload() {
try {
@@ -301,13 +301,14 @@ public class WorldDataHolder {
}
/**
- * Returns a data holder for the given file
+ * Returns a data holder for the given file
* @param worldName
* @param file
* @return
* @throws Exception
* @deprecated
*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
@Deprecated
public static WorldDataHolder load(String worldName, File file) throws Exception {
WorldDataHolder ph = new WorldDataHolder(worldName);
@@ -387,7 +388,7 @@ public class WorldDataHolder {
}
} catch (Exception ex) {
ex.printStackTrace();
- throw new Exception("Your Permissions config file is invalid. See console for details.");
+ throw new Exception("Your Permissions config file is invalid. See console for details.");
}
if (ph.defaultGroup == null) {
throw new IllegalArgumentException("There was no Default Group declared.");
@@ -409,7 +410,7 @@ public class WorldDataHolder {
User thisUser = ph.createUser(usersKey);
if (thisUser == null) {
GroupManager.logger.warning("I think this user was declared more than once: " + usersKey);
- continue;
+ continue;
}
if (thisUserNode.get("permissions") == null) {
thisUserNode.put("permissions", new ArrayList<String>());
@@ -436,8 +437,8 @@ public class WorldDataHolder {
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
if (hisGroup == null) {
GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName());
- thisUser.setGroup(ph.defaultGroup);
- }
+ thisUser.setGroup(ph.defaultGroup);
+ }
thisUser.setGroup(hisGroup);
} else {
thisUser.setGroup(ph.defaultGroup);
@@ -447,7 +448,7 @@ public class WorldDataHolder {
}
/**
- * Returns a data holder for the given file
+ * Returns a data holder for the given file
* @param worldName
* @param groupsFile
* @param usersFile
@@ -455,6 +456,7 @@ public class WorldDataHolder {
* @throws FileNotFoundException
* @throws IOException
*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException {
WorldDataHolder ph = new WorldDataHolder(worldName);
ph.groupsFile = groupsFile;
@@ -539,7 +541,7 @@ public class WorldDataHolder {
}
} catch (Exception ex) {
ex.printStackTrace();
- throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
+ throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
}
if (ph.defaultGroup == null) {
throw new IllegalArgumentException("There was no Default Group declared.");
@@ -639,7 +641,7 @@ public class WorldDataHolder {
}
/**
- * Write a dataHolder in a specified file
+ * Write a dataHolder in a specified file
* @param ph
* @param file
* @deprecated
@@ -726,7 +728,7 @@ public class WorldDataHolder {
}
/**
- * Write a dataHolder in a specified file
+ * Write a dataHolder in a specified file
* @param ph
* @param groupsFile
*/
@@ -761,28 +763,28 @@ public class WorldDataHolder {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
final Yaml yaml = new Yaml(opt);
- try {
- yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
- }
+ try {
+ yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ } catch (FileNotFoundException ex) {
+ }
/*FileWriter tx = null;
try {
- tx = new FileWriter(groupsFile, false);
- tx.write(yaml.dump(root));
- tx.flush();
+ tx = new FileWriter(groupsFile, false);
+ tx.write(yaml.dump(root));
+ tx.flush();
} catch (Exception e) {
} finally {
- try {
- tx.close();
- } catch (IOException ex) {
- }
+ try {
+ tx.close();
+ } catch (IOException ex) {
+ }
}*/
}
/**
- * Write a dataHolder in a specified file
+ * Write a dataHolder in a specified file
* @param ph
* @param usersFile
*/
@@ -823,22 +825,22 @@ public class WorldDataHolder {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
final Yaml yaml = new Yaml(opt);
- try {
- yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
- }
+ try {
+ yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ } catch (FileNotFoundException ex) {
+ }
/*FileWriter tx = null;
try {
- tx = new FileWriter(usersFile, false);
- tx.write(yaml.dump(root));
- tx.flush();
+ tx = new FileWriter(usersFile, false);
+ tx.write(yaml.dump(root));
+ tx.flush();
} catch (Exception e) {
} finally {
- try {
- tx.close();
- } catch (IOException ex) {
- }
+ try {
+ tx.close();
+ } catch (IOException ex) {
+ }
}*/
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index 83073c10b..b4d50b431 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -37,7 +37,7 @@ public class WorldsHolder {
* Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName>
* The key is the mirror.
* The object is the mirrored.
- *
+ *
* Mirror shows the same data of mirrored.
*/
private Map<String, String> mirrors = new HashMap<String, String>();
@@ -63,7 +63,8 @@ public class WorldsHolder {
initialWorldLoading();
mirrorSetUp();
}
- private void initialWorldLoading(){
+
+ private void initialWorldLoading() {
//LOAD EVERY WORLD POSSIBLE
loadWorld(serverDefaultWorldName);
defaultWorld = worldsData.get(serverDefaultWorldName);
@@ -77,7 +78,9 @@ public class WorldsHolder {
}
}
}
- public void mirrorSetUp(){
+
+ @SuppressWarnings("rawtypes")
+ public void mirrorSetUp() {
mirrors.clear();
Map<String, Object> mirrorsMap = plugin.getConfig().getMirrorsMap();
if (mirrorsMap != null) {
@@ -122,7 +125,7 @@ public class WorldsHolder {
}
/**
- *
+ *
*/
public void saveChanges() {
ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>();
@@ -136,7 +139,7 @@ public class WorldsHolder {
continue;
}
if (w.haveGroupsChanged()) {
- String groupsFolderName = w.getGroupsFile().getParentFile().getName();
+ //String groupsFolderName = w.getGroupsFile().getParentFile().getName();
File backupGroups = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + "_g_" + Tasks.getDateString() + ".yml");
try {
Tasks.copy(w.getGroupsFile(), backupGroups);
@@ -368,7 +371,7 @@ public class WorldsHolder {
GroupManager.logger.log(Level.SEVERE, null, ex);
return;
}
- GroupManager.logger.severe("Failed to load world " + worldName + "...");
+ //GroupManager.logger.severe("Failed to load world " + worldName + "...");
}
}
@@ -376,7 +379,7 @@ public class WorldsHolder {
* Tells if the such world has been mapped.
*
* It will return true if world is a mirror.
- *
+ *
* @param worldName
* @return true if world is loaded or mirrored. false if not listed
*/
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
index ca223da81..b892e653e 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
@@ -13,10 +13,11 @@ import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
+import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type;
import org.bukkit.entity.Player;
/**
- * Everything here maintains the model created by Nijikokun
+ * Everything here maintains the model created by Nijikokun
*
* But implemented to use GroupManager system. Which provides instant changes,
* without file access.
@@ -49,7 +50,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Checks if a player can use that permission node.
+ * Checks if a player can use that permission node.
* @param player
* @param permission
* @return
@@ -60,6 +61,16 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
+ * Checks if a player can use that permission node.
+ * @param playerName
+ * @param permission
+ * @return
+ */
+ public boolean permission(String playerName, String permission) {
+ return checkUserPermission(ph.getUser(playerName), permission);
+ }
+
+ /**
* Returns the name of the group of that player name.
* @param userName
* @return
@@ -70,7 +81,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Verify if player is in suck group.
+ * Verify if player is in suck group.
* It will check it's groups inheritance.
*
* So if you have a group Admin > Moderator
@@ -99,6 +110,75 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
+ * Gets the appropriate prefix for the user.
+ * This method is a utility method for chat plugins to get the user's prefix
+ * without having to look at every one of the user's ancestors.
+ * Returns an empty string if user has no parent groups.
+ * @param user Player's name
+ * @return Player's prefix
+ */
+ @Override
+ public String getUserPrefix(String user) {
+
+ String prefix = ph.getUser(user).getVariables().getVarString("prefix");
+ if (prefix.length() != 0) {
+ return prefix;
+ }
+
+ return getGroupPrefix(getGroup(user));
+ }
+
+ /**
+ * Gets the appropriate prefix for the user.
+ * This method is a utility method for chat plugins to get the user's prefix
+ * without having to look at every one of the user's ancestors.
+ * Returns an empty string if user has no parent groups.
+ * @param user Player's name
+ * @return Player's prefix
+ */
+ @Override
+ public String getUserSuffix(String user) {
+
+ String suffix = ph.getUser(user).getVariables().getVarString("suffix");
+ if (suffix.length() != 0) {
+ return suffix;
+ }
+
+ return getGroupSuffix(getGroup(user));
+
+ }
+
+ /**
+ * Gets name of the primary group of the user.
+ * Returns the name of the default group if user has no parent groups,
+ * or "Default" if there is no default group for that world.
+ * @param user Player's name
+ * @return Name of player's primary group
+ */
+ public String getPrimaryGroup(String user) {
+
+ return getGroup(user);
+
+ }
+
+ /**
+ * Check if user can build.
+ * @param world Player's world
+ * @param user Player's name
+ * @return Whether the user can build
+ */
+ public boolean canUserBuild(String user) {
+ boolean test = ph.getUser(user).getVariables().getVarBoolean("build");
+
+ if (test) {
+ return test;
+ }
+
+ return canGroupBuild(getGroup(user));
+
+ }
+
+ /**
* Returns the String prefix for the given group
* @param groupName
* @return empty string if found none.
@@ -107,7 +187,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
public String getGroupPrefix(String groupName) {
Group g = ph.getGroup(groupName);
if (g == null) {
- return null;
+ return "";
}
return g.getVariables().getVarString("prefix");
}
@@ -121,7 +201,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
public String getGroupSuffix(String groupName) {
Group g = ph.getGroup(groupName);
if (g == null) {
- return null;
+ return "";
}
return g.getVariables().getVarString("suffix");
}
@@ -161,7 +241,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * It returns a Integer variable value
+ * It returns a Integer variable value
* It will harvest inheritance for value.
* @param groupName
* @param variable
@@ -619,8 +699,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
@Deprecated
public boolean checkGroupPermissionWithInheritance(Group start, String permission, List<Group> alreadyChecked) {
PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission);
- if (result.resultType.equals(result.resultType.EXCEPTION)
- || result.resultType.equals(result.resultType.FOUND)) {
+ if (result.resultType.equals(Type.EXCEPTION)
+ || result.resultType.equals(Type.FOUND)) {
return true;
}
return false;
@@ -682,8 +762,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
@Deprecated
public Group nextGroupWithPermission(Group start, String permission, List<Group> alreadyChecked) {
PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission);
- if (result.resultType.equals(result.resultType.EXCEPTION)
- || result.resultType.equals(result.resultType.FOUND)) {
+ if (result.resultType.equals(Type.EXCEPTION)
+ || result.resultType.equals(Type.FOUND)) {
return (Group) checkGroupPermissionWithInheritance(start, permission).owner;
}
return null;
@@ -699,7 +779,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
* @param start
* @param alreadyChecked
* @return the group that passed on test. null if no group passed.
- * @deprecated use the other method with same name, instead
+ * @deprecated use the other method with same name, instead
*/
@Deprecated
public ArrayList<String> listAllGroupsInherited(Group start, ArrayList<String> alreadyChecked) {
@@ -807,9 +887,10 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
* @param userName
* @return
*/
+ @Override
public String[] getGroups(String userName) {
ArrayList<String> allGroups = listAllGroupsInherited(ph.getUser(userName).getGroup());
- for(Group subg: ph.getUser(userName).subGroupListCopy()){
+ for (Group subg : ph.getUser(userName).subGroupListCopy()) {
allGroups.addAll(listAllGroupsInherited(subg));
}
String[] arr = new String[allGroups.size()];
@@ -825,6 +906,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
* @param targerPermission
* @return
*/
+ @SuppressWarnings("unused")
private Group breadthFirstSearch(Group start, String targerPermission) {
if (start == null || targerPermission == null) {
return null;
@@ -853,4 +935,102 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
return null;
}
+
+ @Override
+ public Group getDefaultGroup() {
+ return ph.getDefaultGroup();
+ }
+
+ @Override
+ public String getInfoString(String entryName, String path,
+ boolean isGroup) {
+ if (isGroup) {
+ Group data = ph.getGroup(entryName);
+ if (data == null) {
+ return null;
+ }
+ return data.getVariables().getVarString(path);
+ } else {
+ User data = ph.getUser(entryName);
+ if (data == null) {
+ return null;
+ }
+ return data.getVariables().getVarString(path);
+ }
+ }
+
+ @Override
+ public int getInfoInteger(String entryName, String path,
+ boolean isGroup) {
+ if (isGroup) {
+ Group data = ph.getGroup(entryName);
+ if (data == null) {
+ return -1;
+ }
+ return data.getVariables().getVarInteger(path);
+ } else {
+ User data = ph.getUser(entryName);
+ if (data == null) {
+ return -1;
+ }
+ return data.getVariables().getVarInteger(path);
+ }
+ }
+
+ @Override
+ public double getInfoDouble(String entryName, String path,
+ boolean isGroup) {
+ if (isGroup) {
+ Group data = ph.getGroup(entryName);
+ if (data == null) {
+ return -1;
+ }
+ return data.getVariables().getVarDouble(path);
+ } else {
+ User data = ph.getUser(entryName);
+ if (data == null) {
+ return -1;
+ }
+ return data.getVariables().getVarDouble(path);
+ }
+
+ }
+
+ @Override
+ public boolean getInfoBoolean(String entryName, String path,
+ boolean isGroup) {
+ if (isGroup) {
+ Group data = ph.getGroup(entryName);
+ if (data == null) {
+ return false;
+ }
+ return data.getVariables().getVarBoolean(path);
+ } else {
+ User data = ph.getUser(entryName);
+ if (data == null) {
+ return false;
+ }
+ return data.getVariables().getVarBoolean(path);
+ }
+ }
+
+ @Override
+ public void addUserInfo(String name, String path, Object data) {
+ ph.getUser(name).getVariables().addVar(path, data);
+ }
+
+ @Override
+ public void removeUserInfo(String name, String path) {
+ ph.getUser(name).getVariables().removeVar(path);
+ }
+
+ @Override
+ public void addGroupInfo(String name, String path, Object data) {
+ ph.getGroup(name).getVariables().addVar(path, data);
+ }
+
+ @Override
+ public void removeGroupInfo(String name, String path) {
+ ph.getGroup(name).getVariables().removeVar(path);
+ }
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
index 90194cddd..ede097ea4 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
@@ -1,10 +1,15 @@
package org.anjocaido.groupmanager.permissions;
+//import java.util.Collection;
+//import java.util.Map;
+//import java.util.Set;
+import org.anjocaido.groupmanager.data.Group;
+//import org.anjocaido.groupmanager.data.User;
import org.bukkit.entity.Player;
/**
- * Made by Nijikokun. Changed by Gabriel Couto
- *
+ * Made by Nijikokun. Changed by Gabriel Couto
+ *
* This class is intended to *read* permissions from a single world.
*
* @author Nijikokun
@@ -12,7 +17,6 @@ import org.bukkit.entity.Player;
*/
public abstract class PermissionsReaderInterface {
-
/**
*
* @param player
@@ -90,7 +94,7 @@ public abstract class PermissionsReaderInterface {
public abstract boolean getGroupPermissionBoolean(String string, String string1);
/**
- *
+ *
* @param string
* @param string1
* @return
@@ -160,4 +164,69 @@ public abstract class PermissionsReaderInterface {
* @return
*/
public abstract double getPermissionDouble(String string, String string1);
+
+/////////////////////////////
+ /**
+ * Gets the appropriate prefix for the user.
+ * This method is a utility method for chat plugins to get the user's prefix
+ * without having to look at every one of the user's ancestors.
+ * Returns an empty string if user has no parent groups.
+ * @param world Player's world
+ * @param user Player's name
+ * @return Player's prefix
+ */
+ public abstract String getUserPrefix(String user);
+
+ /**
+ * Gets the appropriate suffix for the user.
+ * This method is a utility method for chat plugins to get the user's suffix
+ * without having to look at every one of the user's ancestors.
+ * Returns an empty string if user has no parent groups.
+ * @param world Player's world
+ * @param user Player's name
+ * @return Player's suffix
+ */
+ public abstract String getUserSuffix(String user);
+
+ /**
+ * Returns the group object representing the default group of the given world.
+ * This method will return null if the object does not exist or the world has no default group.
+ * @return Group object representing default world, or null if it doesn't exist or is not defined.
+ */
+ public abstract Group getDefaultGroup();
+
+ /**
+ * Gets a array of the names of all parent groups in the same world.
+ * @param name Target user's name
+ * @return An array containing the names of all parent groups (including ancestors) that are in the same world
+ */
+ public abstract String[] getGroups(String name);
+
+ public abstract String getInfoString(String entryName, String path, boolean isGroup);
+ //public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator);
+
+ public abstract int getInfoInteger(String entryName, String path, boolean isGroup);
+ //public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator);
+
+ /**
+ * Gets a double from the Info node without inheritance.
+ * @param entryName
+ * @param path
+ * @param isGroup
+ * @return
+ */
+ public abstract double getInfoDouble(String entryName, String path, boolean isGroup);
+ //public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator);
+
+ public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup);
+ //public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator);
+
+ public abstract void addUserInfo(String name, String path, Object data);
+
+ public abstract void removeUserInfo(String name, String path);
+
+ public abstract void addGroupInfo(String name, String path, Object data);
+
+ public abstract void removeGroupInfo(String name, String path);
+//////////////////////////////
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
index 87b6806ab..87b6806ab 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
index 781f2753c..0262bb33e 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
@@ -9,6 +9,7 @@ package org.anjocaido.groupmanager.utils;
* @author gabrielcouto
*/
public enum GroupManagerPermissions {
+
manuadd,
manudel,
manuaddsub,
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
index 3ee6fdf30..88ac48427 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
@@ -11,6 +11,7 @@ import org.anjocaido.groupmanager.data.DataUnit;
* @author gabrielcouto
*/
public class PermissionCheckResult {
+
/**
* It should be the owner of the access level found.
*
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
index 2e192118d..ab2fd605b 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
@@ -2,7 +2,6 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
-
package org.anjocaido.groupmanager.utils;
import java.util.Comparator;
@@ -19,32 +18,32 @@ public class StringPermissionComparator implements Comparator<String> {
boolean bp = permB.startsWith("+");
boolean am = permA.startsWith("-");
boolean bm = permB.startsWith("-");
- if(ap&&bp){
+ if (ap && bp) {
return 0;
}
- if(ap&&!bp){
+ if (ap && !bp) {
return -1;
}
- if(!ap&&bp){
+ if (!ap && bp) {
return 1;
}
- if(am&&bm){
+ if (am && bm) {
return 0;
}
- if(am&&!bm){
+ if (am && !bm) {
return -1;
}
- if(!am&&bm){
+ if (!am && bm) {
return 1;
}
return permA.compareToIgnoreCase(permB);
}
private static StringPermissionComparator instance;
- public static StringPermissionComparator getInstance(){
- if(instance==null){
+
+ public static StringPermissionComparator getInstance() {
+ if (instance == null) {
instance = new StringPermissionComparator();
}
return instance;
}
-
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
index 64bdb6209..579ee72a6 100644..100755
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
@@ -10,7 +10,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.ArrayList;
+import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import org.anjocaido.groupmanager.data.Group;
@@ -62,48 +62,51 @@ public abstract class Tasks {
public static String getDateString() {
GregorianCalendar now = new GregorianCalendar();
String date = "";
- date += now.get(GregorianCalendar.DAY_OF_MONTH);
+ date += now.get(Calendar.DAY_OF_MONTH);
date += "-";
- date += now.get(GregorianCalendar.HOUR);
+ date += now.get(Calendar.HOUR);
date += "-";
- date += now.get(GregorianCalendar.MINUTE);
+ date += now.get(Calendar.MINUTE);
return date;
}
- public static String getStringListInString(List<String> list){
- if(list==null){
+
+ public static String getStringListInString(List<String> list) {
+ if (list == null) {
return "";
}
- String result="";
- for(int i=0;i<list.size();i++){
- result+=list.get(i);
- if(i<list.size()-1){
- result+=", ";
+ String result = "";
+ for (int i = 0; i < list.size(); i++) {
+ result += list.get(i);
+ if (i < list.size() - 1) {
+ result += ", ";
}
}
return result;
}
- public static String getStringArrayInString(String[] list){
- if(list==null){
+
+ public static String getStringArrayInString(String[] list) {
+ if (list == null) {
return "";
}
- String result="";
- for(int i=0;i<list.length;i++){
- result+=list[i];
- if(i<((list.length)-1)){
- result+=", ";
+ String result = "";
+ for (int i = 0; i < list.length; i++) {
+ result += list[i];
+ if (i < ((list.length) - 1)) {
+ result += ", ";
}
}
return result;
}
- public static String getGroupListInString(List<Group> list){
- if(list==null){
+
+ public static String getGroupListInString(List<Group> list) {
+ if (list == null) {
return "";
}
- String result="";
- for(int i=0;i<list.size();i++){
- result+=list.get(i).getName();
- if(i<list.size()-1){
- result+=", ";
+ String result = "";
+ for (int i = 0; i < list.size(); i++) {
+ result += list.get(i).getName();
+ if (i < list.size() - 1) {
+ result += ", ";
}
}
return result;