From 15b5198dbbcff4842c487aaface08cfb9d463de9 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Thu, 14 Jul 2016 19:25:53 +0100 Subject: [PATCH] Ensure words are fully capitalised Previously only the first word was capitalised. --- .../src/mineplex/core/report/ReportCategory.java | 10 +++++----- .../src/mineplex/core/report/ReportResultType.java | 4 ++-- .../core/report/task/ReportHandlerMessageTask.java | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java index fad14aada..d7a8f7a4d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java @@ -1,6 +1,6 @@ package mineplex.core.report; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; /** * Contains the reasons a player can be reported for. @@ -23,12 +23,12 @@ public enum ReportCategory CHAT_ABUSE(2); private final int _id; - private final String _humanName; + private final String _name; ReportCategory(int id) { _id = id; - _humanName = StringUtils.capitalize(name().toLowerCase().replace("_", " ")); + _name = WordUtils.capitalizeFully(name().replace('_', ' ')); } /** @@ -41,9 +41,9 @@ public enum ReportCategory return _id; } - public String getHumanName() + public String getName() { - return _humanName; + return _name; } public static ReportCategory getById(int id) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportResultType.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportResultType.java index 4fa67dec0..af2cb3e8b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportResultType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportResultType.java @@ -1,6 +1,6 @@ package mineplex.core.report; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; /** * Contains all possible outcomes for a report. @@ -20,7 +20,7 @@ public enum ReportResultType { _id = id; _globalStat = globalStat; - _name = StringUtils.capitalize(name().toLowerCase().replace('_', ' ')); + _name = WordUtils.capitalizeFully(name().replace('_', ' ')); } public int getId() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java b/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java index 2c9d886cb..37e8850ef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java @@ -4,7 +4,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.stream.Collectors; -import org.bukkit.ChatColor; import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.chatsnap.SnapshotRepository; @@ -53,7 +52,7 @@ public class ReportHandlerMessageTask extends BukkitRunnable .add("\n") .add(prefix + C.cAqua + "Suspect - " + C.cGold + suspectName) .add("\n") - .add(prefix + C.cAqua + "Type - " + C.cGold + _report.getCategory().getHumanName()) + .add(prefix + C.cAqua + "Type - " + C.cGold + _report.getCategory().getName()) .add("\n" + prefix + "\n") .add(prefix + C.cGold + _report.getMessages().size() + C.cAqua + " total reports") .add("\n")