Add possibility to load schems with non-lowercase names.

This commit is contained in:
barpec12 2019-01-28 11:11:07 +01:00
parent 8cddb1e69f
commit c6b4a10634

View File

@ -3,10 +3,7 @@ package world.bentobox.bentobox.managers;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.jar.JarFile;
import org.bukkit.World;
@ -74,7 +71,7 @@ public class SchemsManager {
* @return map of schems for this world or an empty map if there are none registered
*/
public Map<String, Clipboard> get(World world) {
return islandSchems.getOrDefault(world, new HashMap<>());
return islandSchems.getOrDefault(world, new TreeMap<>(String.CASE_INSENSITIVE_ORDER));
}
/**
@ -107,7 +104,7 @@ public class SchemsManager {
private boolean loadSchem(World world, File schems, String name) {
plugin.log("Loading " + name + ".schem for " + world.getName());
Map<String, Clipboard> schemList = islandSchems.getOrDefault(world, new HashMap<>());
Map<String, Clipboard> schemList = islandSchems.getOrDefault(world, new TreeMap<>(String.CASE_INSENSITIVE_ORDER));
try {
Clipboard cb = new Clipboard(plugin, schems);
cb.load(name);