If sender is console, strip colours for mctop

Ugly ugly colours.
This commit is contained in:
JamieSinn 2015-12-11 23:30:21 -05:00
parent 9718123292
commit 9677653c54

View File

@ -1,17 +1,16 @@
package com.gmail.nossr50.runnables.commands; package com.gmail.nossr50.runnables.commands;
import java.util.List; import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO; import java.util.List;
import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
/** /**
* Display the results of {@link MctopCommandAsyncTask} to the sender. * Display the results of {@link MctopCommandAsyncTask} to the sender.
@ -45,15 +44,23 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
if (sender instanceof Player) { if (sender instanceof Player) {
((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p); ((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p);
} }
if(sender instanceof Player)
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip")); sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
} }
private void displayChat() { private void displayChat() {
if (skill == null) { if (skill == null) {
if(sender instanceof Player)
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
else
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
} }
else { else {
if(sender instanceof Player)
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName())); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName()));
else
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName())));
} }
int place = (page * 10) - 9; int place = (page * 10) - 9;
@ -62,7 +69,8 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
// Format: // Format:
// 01. Playername - skill value // 01. Playername - skill value
// 12. Playername - skill value // 12. Playername - skill value
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal)); sender.sendMessage(String.format("%2d. %s%s - %s%s", place, sender instanceof Player ? ChatColor.GREEN : "",
stat.name, sender instanceof Player ? ChatColor.WHITE : "", stat.statVal));
place++; place++;
} }
} }