Fix rank prefix-related minor formatting bugs.

* Colors were extending farther than they should.
* Fixed entire name being formatted for chat without brackets.
* Fixed period being formatted for the `/rank` command.
master
James T. Martin 2020-11-19 03:15:28 -08:00
parent 6a726ee1b1
commit 33b8862cc2
Signed by: james
GPG Key ID: 4B7F3DA9351E577C
3 changed files with 12 additions and 12 deletions

View File

@ -4,6 +4,7 @@ import java.sql.SQLException;
import java.util.Optional;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -73,7 +74,7 @@ public class CommandRank implements CommandExecutor {
Optional<EnlistedRank> rank = EnlistedRank.getRankFromKills(kills);
Optional<EnlistedRank> nextRank = EnlistedRank.getNextRank(subject);
if (rank.isPresent()) {
sender.sendMessage(playerName + is + "rank " + rank.get().formatFull() + ".");
sender.sendMessage(playerName + is + "rank " + rank.get().formatFull() + ChatColor.RESET + ".");
}
if (seeKills) {
String hasKilled = playerName + has + "killed " + kills + " " + eligibleMobsName;
@ -81,13 +82,13 @@ public class CommandRank implements CommandExecutor {
if (nextRank.isPresent()) {
int moreZombies = nextRank.get().getKills().get() - kills;
andHasToGo = " and" + need + "to kill " + moreZombies
+ " more to reach " + nextRank.get().formatFull() + ".";
+ " more to reach " + nextRank.get().formatFull() + ChatColor.RESET + ".";
} else {
andHasToGo = " and" + has + "reached maximum rank.";
}
sender.sendMessage(hasKilled + andHasToGo);
} else if (nextRank.isPresent()) {
sender.sendMessage(playerNameS + " next rank will be " + nextRank.get().formatExtended() + ".");
sender.sendMessage(playerNameS + " next rank will be " + nextRank.get().formatExtended() + ChatColor.RESET + ".");
} else {
sender.sendMessage(playerName + has + "reached maximum rank.");
}

View File

@ -29,14 +29,14 @@ public class ChatListener implements Listener {
String rankPrefix;
if (rank.isPresent()) {
rankPrefix = rank.get().formatAbbreviated();
rankPrefix = rank.get().formatAbbreviated() + ChatColor.RESET;
if (Wasteland.getInstance().getSettings().bracketChatRank())
rankPrefix = ChatColor.RESET + "[" + rankPrefix + ChatColor.RESET + "]";
rankPrefix = ChatColor.RESET + "[" + rankPrefix + "]";
rankPrefix = rankPrefix + " ";
} else {
rankPrefix = "";
}
event.setFormat(townyPrefix + rankPrefix + "%s" + ChatColor.WHITE + ": %s");
event.setFormat(townyPrefix + rankPrefix + "%s" + ChatColor.RESET + ": %s");
}
}

View File

@ -2,14 +2,14 @@ name: Wasteland
author: HuskFodder
main: me.jamestmartin.wasteland.Wasteland
version: 0.1.0
api-version: 1.15
api-version: 1.16
softdepend: [Towny]
commands:
rank:
description: View your rank and how many monsters you have killed.
usage: "Usage: /<command> [player]"
usage: "Usage: /<command> [<player>]"
permission: wasteland.view-rank
permission-message: You do not have permission to view your rank.
rankeligiblemobs:
@ -22,14 +22,14 @@ commands:
usage: "Usage: /<command>"
setkills:
description: Set another player's number of kills for debugging.
usage: "Usage: /<command> [player] kills"
usage: "Usage: /<command> [<player>] <kills>"
permission: wasteland.kills.set
permission-message: You do not have permission to set anyone's kills.
official:
description: Make an official announcement using your staff rank.
usage: "Usage: /<command> [message]"
usage: "Usage: /<command> <message>"
permission: wasteland.official
permission-message: You are not a staff member.
permission-message: You are not a staff member with an officer rank.
permissions:
wasteland.chat.officer:
@ -65,4 +65,3 @@ permissions:
wasteland.view-eligible-mobs:
description: Allows you to see the specific list of what mobs count towards promotion with /rankeligiblemobs.
default: true