Add option to lookup mvworlds without checking for aliases.
This commit is contained in:
parent
e3f56f6498
commit
24295025ef
|
@ -174,6 +174,16 @@ public interface MVWorldManager {
|
||||||
*/
|
*/
|
||||||
MultiverseWorld getMVWorld(String name);
|
MultiverseWorld getMVWorld(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a {@link MultiverseWorld} if the world with name given exists, and null if it does not.
|
||||||
|
* This will search optionally for alias names.
|
||||||
|
*
|
||||||
|
* @param name The name or optionally the alias of the world to get.
|
||||||
|
* @param checkAliases Indicates whether to check for world alias name.
|
||||||
|
* @return A {@link MultiverseWorld} or null.
|
||||||
|
*/
|
||||||
|
MultiverseWorld getMVWorld(String name, boolean checkAliases);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
|
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
|
||||||
*
|
*
|
||||||
|
@ -183,13 +193,24 @@ public interface MVWorldManager {
|
||||||
MultiverseWorld getMVWorld(World world);
|
MultiverseWorld getMVWorld(World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if the given name is a valid {@link MultiverseWorld}.
|
* Checks to see if the given name is a valid {@link MultiverseWorld}
|
||||||
|
* Searches based on world name AND alias.
|
||||||
*
|
*
|
||||||
* @param name The name or alias of the world to check.
|
* @param name The name or alias of the world to check.
|
||||||
* @return True if the world exists, false if not.
|
* @return True if the world exists, false if not.
|
||||||
*/
|
*/
|
||||||
boolean isMVWorld(String name);
|
boolean isMVWorld(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see if the given name is a valid {@link MultiverseWorld}.
|
||||||
|
* Optionally searches by alias is specified.
|
||||||
|
*
|
||||||
|
* @param name The name or alias of the world to check.
|
||||||
|
* @param checkAliases Indicates whether to check for world alias name.
|
||||||
|
* @return True if the world exists, false if not.
|
||||||
|
*/
|
||||||
|
boolean isMVWorld(String name, boolean checkAliases);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if the given world is a valid {@link MultiverseWorld}.
|
* Checks to see if the given world is a valid {@link MultiverseWorld}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -617,6 +617,14 @@ public class WorldManager implements MVWorldManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MultiverseWorld getMVWorld(String name) {
|
public MultiverseWorld getMVWorld(String name) {
|
||||||
|
return this.getMVWorld(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MultiverseWorld getMVWorld(String name, boolean checkAliases) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -624,7 +632,7 @@ public class WorldManager implements MVWorldManager {
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
return this.getMVWorldByAlias(name);
|
return (checkAliases) ? this.getMVWorldByAlias(name) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -633,7 +641,7 @@ public class WorldManager implements MVWorldManager {
|
||||||
@Override
|
@Override
|
||||||
public MultiverseWorld getMVWorld(World world) {
|
public MultiverseWorld getMVWorld(World world) {
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
return this.getMVWorld(world.getName());
|
return this.getMVWorld(world.getName(), false);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -658,7 +666,15 @@ public class WorldManager implements MVWorldManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isMVWorld(final String name) {
|
public boolean isMVWorld(final String name) {
|
||||||
return (this.worlds.containsKey(name) || isMVWorldAlias(name));
|
return this.isMVWorld(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isMVWorld(final String name, boolean checkAliases) {
|
||||||
|
return this.worlds.containsKey(name) || (checkAliases && this.isMVWorldAlias(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue