mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Merge pull request #2726 from JamieSinn/master
If sender is console, strip colours for mctop
This commit is contained in:
commit
4924391ae8
@ -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,16 +44,28 @@ 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 {
|
else {
|
||||||
|
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 +73,13 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
|||||||
// Format:
|
// Format:
|
||||||
// 01. Playername - skill value
|
// 01. Playername - skill value
|
||||||
// 12. Playername - skill value
|
// 12. Playername - skill value
|
||||||
|
if(sender instanceof Player) {
|
||||||
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, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sender.sendMessage(String.format("%2d. %s - %s", place, stat.name, stat.statVal));
|
||||||
|
}
|
||||||
|
|
||||||
place++;
|
place++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user