diff --git a/changelog.txt b/changelog.txt index 1c6eab52..b7252b69 100644 --- a/changelog.txt +++ b/changelog.txt @@ -401,6 +401,13 @@ Bug Fixes: Features: - Added Mexican Spanish translations (es_mx) (#222) +Improvements: +- Fixed a typo in messages.yml + +Bug Fixes: + +- Fixed a bug causing /team title to not work (#221) + TODO (any TODO which is not specifically code), mainly used for reminders to update documentation Headings: diff --git a/messages.yml b/messages.yml index 7d7b0c44..df8c78a3 100644 --- a/messages.yml +++ b/messages.yml @@ -10,7 +10,7 @@ notTeam: '&6&4That team does not exist try &b/team create ' needSameTeam: '&6You are not in the same team as that person' noPerm: '&4You do not have permission to do that' prefixSyntax: '&7[%s&7] &r%s' -bannedChar: '&4A character you tried to use is banned"' +bannedChar: '&4A character you tried to use is banned' noTeam: '&4That team does not exist' loading: '&6Loading' cooldown.wait: '&4You need to wait another %s seconds before running that!' diff --git a/src/com/booksaw/betterTeams/commands/team/TitleCommand.java b/src/com/booksaw/betterTeams/commands/team/TitleCommand.java index 8e338129..42c1dcaa 100644 --- a/src/com/booksaw/betterTeams/commands/team/TitleCommand.java +++ b/src/com/booksaw/betterTeams/commands/team/TitleCommand.java @@ -29,17 +29,20 @@ public CommandResponse onCommand(TeamPlayer player, String label, String[] args, args = new String[] { "me", args[0] }; } - Player toTitlePlayer = Bukkit.getPlayer(args[0]); + Player toTitlePlayer; + + if (args[0].equals("me")) { + // player is online so this should not cause any issues + toTitlePlayer = player.getPlayer().getPlayer(); + } else { + toTitlePlayer = Bukkit.getPlayer(args[0]); + } if (toTitlePlayer == null) { return new CommandResponse("noPlayer"); } - if (args[0].equals("me")) { - toTitle = player; - } else { - toTitle = team.getTeamPlayer(toTitlePlayer); - } + toTitle = team.getTeamPlayer(toTitlePlayer); if (toTitle == null) { return new CommandResponse("noPlayer"); @@ -54,7 +57,7 @@ public CommandResponse onCommand(TeamPlayer player, String label, String[] args, return new CommandResponse("title.tooLong"); } - if (Team.isValidTeamName(args[1])) { + if (!Team.isValidTeamName(args[1])) { return new CommandResponse("bannedChar"); } diff --git a/src/com/booksaw/betterTeams/commands/teama/TitleTeama.java b/src/com/booksaw/betterTeams/commands/teama/TitleTeama.java index 265622de..9af1aa69 100644 --- a/src/com/booksaw/betterTeams/commands/teama/TitleTeama.java +++ b/src/com/booksaw/betterTeams/commands/teama/TitleTeama.java @@ -40,10 +40,8 @@ public CommandResponse onCommand(CommandSender sender, String label, String[] ar return new CommandResponse("title.tooLong"); } - for (char bannedChar : bannedChars) { - if (args[1].contains(bannedChar + "")) { - return new CommandResponse("bannedChar"); - } + if (!Team.isValidTeamName(args[1])) { + return new CommandResponse("bannedChar"); } args[1] = ChatColor.translateAlternateColorCodes('&', args[1]);