- Updated for Bukkits new YamlConfiguration.
	- Cleared remaining Cast errors cause by object cloning.
This commit is contained in:
ElgarL 2011-10-11 22:05:21 +01:00
parent 1bb3eb0d07
commit 1543bfd550
7 changed files with 17 additions and 14 deletions

View file

@ -39,4 +39,7 @@ v 1.3:
- Fix for Bukkit passing a null To location on a player Portaling
- 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.
These allow players/admins to be notified when players are moved between groups.
v 1.4:
- Updated for Bukkits new YamlConfiguration.
- Cleared remaining Cast errors cause by object cloning.

View file

@ -10,7 +10,7 @@ import java.util.Map;
import java.util.logging.Level;
import org.anjocaido.groupmanager.utils.Tasks;
import org.bukkit.util.config.Configuration;
import org.bukkit.configuration.file.YamlConfiguration;
/**
*
@ -20,7 +20,7 @@ public class GMConfiguration {
private GroupManager plugin;
private File configFile;
private Configuration GMconfig;
private YamlConfiguration GMconfig;
public GMConfiguration(GroupManager plugin) {
this.plugin = plugin;
@ -41,10 +41,10 @@ public class GMConfiguration {
}
}
GMconfig = new Configuration(configFile);
GMconfig = new YamlConfiguration();
try {
GMconfig.load();
GMconfig.load(configFile);
} catch (Exception ex) {
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
}
@ -57,7 +57,7 @@ public class GMConfiguration {
@SuppressWarnings("unchecked")
public Map<String, Object> getMirrorsMap() {
return (Map<String, Object>) GMconfig.getProperty("settings.permission.world.mirror");
return (Map<String, Object>) GMconfig.getList("settings.permission.world.mirror");
}
public Integer getSaveInterval() {

View file

@ -1770,10 +1770,10 @@ public class GroupManager extends JavaPlugin {
for(Player test: Bukkit.getServer().getOnlinePlayers()) {
if (!test.equals(player)){
if (test.hasPermission("groupmanager.notify.other"))
test.sendMessage(ChatColor.YELLOW + name +" was " + msg);
test.sendMessage(ChatColor.YELLOW + name +" was" + msg);
} else
if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other"))))
player.sendMessage(ChatColor.YELLOW + "You we're " + msg);
player.sendMessage(ChatColor.YELLOW + "You we're" + msg);
}
}

View file

@ -102,7 +102,7 @@ public abstract class DataUnit {
* @return a copy of the permission list
*/
public ArrayList<String> getPermissionList() {
return (ArrayList<String>) permissions.clone();
return new ArrayList<String>(permissions);
}
public void sortPermissions() {

View file

@ -41,7 +41,7 @@ public class Group extends DataUnit implements Cloneable {
@Override
public Group clone() {
Group clone = new Group(getDataSource(), this.getName());
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
clone.inherits = new ArrayList<String>(this.getInherits());
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
@ -60,7 +60,7 @@ public class Group extends DataUnit implements Cloneable {
return null;
}
Group clone = getDataSource().createGroup(this.getName());
clone.inherits = ((ArrayList<String>) this.getInherits().clone());
clone.inherits = new ArrayList<String>(this.getInherits());
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
@ -76,7 +76,7 @@ public class Group extends DataUnit implements Cloneable {
* @return the inherits
*/
public ArrayList<String> getInherits() {
return (ArrayList<String>) inherits.clone();
return new ArrayList<String>(inherits);
}
/**

View file

@ -183,7 +183,7 @@ public class User extends DataUnit implements Cloneable {
}
public ArrayList<String> subGroupListStringCopy() {
return (ArrayList<String>) subGroups.clone();
return new ArrayList<String>(subGroups);
}
/**

View file

@ -1,5 +1,5 @@
name: GroupManager
version: "1.3 (Phoenix)"
version: "1.4 (Phoenix)"
main: org.anjocaido.groupmanager.GroupManager
website: http://www.anjocaido.info/
description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule.