From 82e759d70878b5c7f760feaeef9d1de5b3e84b09 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 8 Apr 2017 17:00:36 +0100 Subject: [PATCH] Make sure world names are lowercase'd --- .../main/java/me/lucko/luckperms/bukkit/WorldCalculator.java | 2 +- .../me/lucko/luckperms/bungee/BackendServerCalculator.java | 2 +- .../me/lucko/luckperms/common/contexts/ContextManager.java | 3 ++- .../me/lucko/luckperms/sponge/contexts/WorldCalculator.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java index 32eedfac6..27f9f4a52 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java @@ -45,7 +45,7 @@ public class WorldCalculator implements ContextCalculator { world = plugin.getConfiguration().get(ConfigKeys.WORLD_REWRITES).getOrDefault(world, world); if (world != null) { - accumulator.add(Maps.immutableEntry(WORLD_KEY, world)); + accumulator.add(Maps.immutableEntry(WORLD_KEY, world.toLowerCase())); } return accumulator; diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/BackendServerCalculator.java b/bungee/src/main/java/me/lucko/luckperms/bungee/BackendServerCalculator.java index 37755bcda..f1425c812 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/BackendServerCalculator.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/BackendServerCalculator.java @@ -41,7 +41,7 @@ public class BackendServerCalculator implements ContextCalculator String server = getServer(subject); if (server != null) { - accumulator.add(Maps.immutableEntry(WORLD_KEY, server)); + accumulator.add(Maps.immutableEntry(WORLD_KEY, server.toLowerCase())); } return accumulator; diff --git a/common/src/main/java/me/lucko/luckperms/common/contexts/ContextManager.java b/common/src/main/java/me/lucko/luckperms/common/contexts/ContextManager.java index d95d2e3cd..0f8640bc3 100644 --- a/common/src/main/java/me/lucko/luckperms/common/contexts/ContextManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/contexts/ContextManager.java @@ -54,7 +54,8 @@ public class ContextManager { } public void registerCalculator(ContextCalculator calculator) { - calculators.add(calculator); + // calculators registered first should have priority (and be checked last.) + calculators.add(0, calculator); } public int getCalculatorsSize() { diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/contexts/WorldCalculator.java b/sponge/src/main/java/me/lucko/luckperms/sponge/contexts/WorldCalculator.java index dd1b0c45f..5b16cf81f 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/contexts/WorldCalculator.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/contexts/WorldCalculator.java @@ -43,7 +43,7 @@ public class WorldCalculator implements ContextCalculator { } Player p = ((Player) source); - accumulator.add(Context.WORLD_KEY, p.getWorld().getName()); + accumulator.add(Context.WORLD_KEY, p.getWorld().getName().toLowerCase()); return accumulator; }