'/manselect' will no longer list duplicate worlds.

This commit is contained in:
ElgarL 2013-02-22 11:46:59 +00:00
parent 7f972801bf
commit 13e07f64ec
2 changed files with 17 additions and 7 deletions

View file

@ -214,3 +214,4 @@ v 2.0:
- Added '/mancheckw <world>' to inspect which permission files a world is referencing. - Added '/mancheckw <world>' to inspect which permission files a world is referencing.
- Add config potion to set if GM commands should be allowed on CommnandBlocks. - Add config potion to set if GM commands should be allowed on CommnandBlocks.
- Catch the error when using an out of date config for 'allow_commandblocks' So it doesn't kill the whole config. - Catch the error when using an out of date config for 'allow_commandblocks' So it doesn't kill the whole config.
- '/manselect' will no longer list duplicate worlds.

View file

@ -699,16 +699,21 @@ public class WorldsHolder {
} }
/** /**
* Returns all physically loaded worlds which have at least * Returns all physically loaded worlds which have at least one of their own
* one of their own data sets for users or groups which isn't an identical mirror. * data sets for users or groups which isn't an identical mirror.
* *
* @return ArrayList<OverloadedWorldHolder> of all loaded worlds * @return ArrayList<OverloadedWorldHolder> of all loaded worlds
*/ */
public ArrayList<OverloadedWorldHolder> allWorldsDataList() { public ArrayList<OverloadedWorldHolder> allWorldsDataList() {
ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>(); ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>();
for (OverloadedWorldHolder data : worldsData.values()) {
if ((!list.contains(data))) { // && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) { for (String world : worldsData.keySet()) {
// Fetch the relevant world object
OverloadedWorldHolder data = getWorldData(world);
if (!list.contains(data)) {
String worldNameLowered = data.getName().toLowerCase(); String worldNameLowered = data.getName().toLowerCase();
String usersMirror = mirrorsUser.get(worldNameLowered); String usersMirror = mirrorsUser.get(worldNameLowered);
@ -722,8 +727,12 @@ public class WorldsHolder {
// if the data sources are the same, return the parent // if the data sources are the same, return the parent
if (usersMirror == groupsMirror) { if (usersMirror == groupsMirror) {
if (!list.contains(usersMirror.toLowerCase())) data = getWorldData(usersMirror.toLowerCase());
list.add(worldsData.get(usersMirror.toLowerCase()));
// Only add the parent if it's not already listed.
if (!list.contains(data))
list.add(data);
continue; continue;
} }
// Both data sources are mirrors, but they are from different parents // Both data sources are mirrors, but they are from different parents