From ab2fefd3d39d92bd7ba8982fbfcce6b3d4136a28 Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Sun, 29 Dec 2019 17:47:32 +0100 Subject: [PATCH] Use regular player name when tab completing `/ma kick` and `/ma restore`. Since the actual execution of these commands use the regular player name instead of the display name, the tab completion is useless if it doesn't also use the regular player name. Fixes #589 --- changelog.md | 1 + .../com/garbagemule/MobArena/commands/admin/KickCommand.java | 4 ++-- .../garbagemule/MobArena/commands/admin/RestoreCommand.java | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 8378dea..df1f574 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,7 @@ These changes will (most likely) be included in the next version. ## [Unreleased] - It is no longer necessary to have recurrent waves for an arena to work. MobArena automatically creates a "catch all" recurrent wave in case the arena session reaches a wave number that isn't covered by any other wave definitions. - Entities outside of the arena can no longer target players, pets, or monsters inside of the arena. +- Tab completion for `/ma kick` and `/ma restore` now uses actual player names instead of display names. ## [0.104] - 2019-08-08 - Extended and upgraded potions are now supported in the item syntax by prepending `long_` or `strong_` to the data portion of a potion item (e.g. `potion:strong_instant_heal:1` will yield a Potion of Healing II). Check the wiki for details. diff --git a/src/main/java/com/garbagemule/MobArena/commands/admin/KickCommand.java b/src/main/java/com/garbagemule/MobArena/commands/admin/KickCommand.java index 57c0511..2661a19 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/admin/KickCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/admin/KickCommand.java @@ -52,8 +52,8 @@ public class KickCommand implements Command List players = am.getAllPlayers(); return players.stream() - .filter(p -> p.getDisplayName().toLowerCase().startsWith(prefix)) - .map(Player::getDisplayName) + .filter(p -> p.getName().toLowerCase().startsWith(prefix)) + .map(Player::getName) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/garbagemule/MobArena/commands/admin/RestoreCommand.java b/src/main/java/com/garbagemule/MobArena/commands/admin/RestoreCommand.java index 46cfdac..f7f1392 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/admin/RestoreCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/admin/RestoreCommand.java @@ -55,8 +55,8 @@ public class RestoreCommand implements Command Collection players = am.getPlugin().getServer().getOnlinePlayers(); return players.stream() - .filter(p -> p.getDisplayName().toLowerCase().startsWith(prefix)) - .map(Player::getDisplayName) + .filter(p -> p.getName().toLowerCase().startsWith(prefix)) + .map(Player::getName) .collect(Collectors.toList()); } }