diff --git a/changelog.md b/changelog.md index d92bc19..800152d 100644 --- a/changelog.md +++ b/changelog.md @@ -24,7 +24,7 @@ These changes will (most likely) be included in the next version. - New command `/ma addreward ` can be used to add a reward to an arena player's reward list. This can be useful for hooking into the rewards system from scripts or other plugins. - The Root Target ability now uses potion effects (slowness, slow falling, and negative jump boost) instead of repeated teleports. This should make for a smoother root experience. - Permissions for arenas and classes are now based on "slugs". It is now possible to configure permissions for arenas and classes with multi-word names (including "My Items"). Check the Permissions page on the wiki for details. -- Commands that resolve class names now consistently resolve and tab complete "slugs" instead of arbitrarily "squashed" names. This greatly improves support for multi-word names. +- Commands that resolve arena and/or class names now consistently resolve and tab complete "slugs" instead of arbitrarily "squashed" names. This greatly improves support for multi-word names. - The class signs generated by the `/ma autogenerate` command now use class names from the config-file instead of arbitrarily "squashed" names. - Leaderboards now use arena names from the config-file instead of arbitrarily "prettified" names. - Using `spectate-on-death: true` no longer forces players out to their join location/exit warp before moving them to the spectator area. This should prevent "jumpy" behavior in multi-world setups. diff --git a/src/main/java/com/garbagemule/MobArena/ArenaMasterImpl.java b/src/main/java/com/garbagemule/MobArena/ArenaMasterImpl.java index 5774a3b..a31d425 100644 --- a/src/main/java/com/garbagemule/MobArena/ArenaMasterImpl.java +++ b/src/main/java/com/garbagemule/MobArena/ArenaMasterImpl.java @@ -8,6 +8,7 @@ import com.garbagemule.MobArena.framework.ArenaMaster; import com.garbagemule.MobArena.things.InvalidThingInputString; import com.garbagemule.MobArena.things.Thing; import com.garbagemule.MobArena.util.JoinInterruptTimer; +import com.garbagemule.MobArena.util.Slugs; import com.garbagemule.MobArena.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -232,8 +233,9 @@ public class ArenaMasterImpl implements ArenaMaster } public Arena getArenaWithName(Collection arenas, String configName) { + String slug = Slugs.create(configName); for (Arena arena : arenas) - if (arena.configName().equalsIgnoreCase(configName)) + if (arena.getSlug().equalsIgnoreCase(slug)) return arena; return null; } diff --git a/src/main/java/com/garbagemule/MobArena/commands/admin/DisableCommand.java b/src/main/java/com/garbagemule/MobArena/commands/admin/DisableCommand.java index c21fb9c..030a486 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/admin/DisableCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/admin/DisableCommand.java @@ -67,8 +67,8 @@ public class DisableCommand implements Command List arenas = am.getArenas(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) - .map(Arena::configName) + .filter(arena -> arena.getSlug().startsWith(prefix)) + .map(Arena::getSlug) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/admin/EnableCommand.java b/src/main/java/com/garbagemule/MobArena/commands/admin/EnableCommand.java index b27a69c..512136d 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/admin/EnableCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/admin/EnableCommand.java @@ -67,8 +67,8 @@ public class EnableCommand implements Command List arenas = am.getArenas(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) - .map(Arena::configName) + .filter(arena -> arena.getSlug().startsWith(prefix)) + .map(Arena::getSlug) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/admin/ForceCommand.java b/src/main/java/com/garbagemule/MobArena/commands/admin/ForceCommand.java index e41a8c0..28a418e 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/admin/ForceCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/admin/ForceCommand.java @@ -117,9 +117,9 @@ public class ForceCommand implements Command List arenas = am.getArenas(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) + .filter(arena -> arena.getSlug().startsWith(prefix)) .filter(arena -> start != arena.isRunning()) - .map(Arena::configName) + .map(Arena::getSlug) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/setup/EditArenaCommand.java b/src/main/java/com/garbagemule/MobArena/commands/setup/EditArenaCommand.java index 9241817..d0d4b60 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/setup/EditArenaCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/setup/EditArenaCommand.java @@ -69,8 +69,8 @@ public class EditArenaCommand implements Command List arenas = am.getArenas(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) - .map(Arena::configName) + .filter(arena -> arena.getSlug().startsWith(prefix)) + .map(Arena::getSlug) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/setup/RemoveArenaCommand.java b/src/main/java/com/garbagemule/MobArena/commands/setup/RemoveArenaCommand.java index 9ec2434..5ce0cbe 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/setup/RemoveArenaCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/setup/RemoveArenaCommand.java @@ -51,8 +51,8 @@ public class RemoveArenaCommand implements Command List arenas = am.getArenas(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) - .map(Arena::configName) + .filter(arena -> arena.getSlug().startsWith(prefix)) + .map(Arena::getSlug) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java b/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java index 84d81b3..bb355ab 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java @@ -120,9 +120,9 @@ public class SettingCommand implements Command { String prefix = args[0].toLowerCase(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) + .filter(arena -> arena.getSlug().startsWith(prefix)) .filter(arena -> !arena.isRunning()) - .map(Arena::configName) + .map(Arena::getSlug) .collect(Collectors.toList()); } diff --git a/src/main/java/com/garbagemule/MobArena/commands/setup/SetupCommand.java b/src/main/java/com/garbagemule/MobArena/commands/setup/SetupCommand.java index 02e795f..feaca5e 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/setup/SetupCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/setup/SetupCommand.java @@ -101,8 +101,8 @@ public class SetupCommand implements Command, Listener { List arenas = am.getArenas(); return arenas.stream() - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) - .map(Arena::configName) + .filter(arena -> arena.getSlug().startsWith(prefix)) + .map(Arena::getSlug) .collect(Collectors.toList()); } diff --git a/src/main/java/com/garbagemule/MobArena/commands/user/JoinCommand.java b/src/main/java/com/garbagemule/MobArena/commands/user/JoinCommand.java index 061d005..8190934 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/user/JoinCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/user/JoinCommand.java @@ -94,9 +94,9 @@ public class JoinCommand implements Command return arenas.stream() .filter(Arena::isEnabled) - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) + .filter(arena -> arena.getSlug().startsWith(prefix)) .filter(arena -> arena.getRegion().isSetup()) - .map(Arena::configName) + .map(Arena::getSlug) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/user/SpecCommand.java b/src/main/java/com/garbagemule/MobArena/commands/user/SpecCommand.java index 5bb7875..4aeebed 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/user/SpecCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/user/SpecCommand.java @@ -88,9 +88,9 @@ public class SpecCommand implements Command return arenas.stream() .filter(Arena::isEnabled) - .filter(arena -> arena.configName().toLowerCase().startsWith(prefix)) + .filter(arena -> arena.getSlug().startsWith(prefix)) .filter(arena -> arena.getRegion().isSetup()) - .map(Arena::configName) + .map(Arena::getSlug) .collect(Collectors.toList()); } }