Merge branch 'feature/top-elo' of github.com:Mineplex-LLC/Minecraft-PC into alex-compvanilla
This commit is contained in:
commit
2e4bae6915
@ -1,5 +1,6 @@
|
||||
package mineplex.core.elo;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -10,12 +11,16 @@ import mineplex.core.slack.SlackMessage;
|
||||
import mineplex.core.slack.SlackTeam;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generates a list of top elos
|
||||
*/
|
||||
public class TopEloCommand extends CommandBase<EloManager>
|
||||
{
|
||||
|
||||
private static final List<String> NAMES = Lists.newArrayList("Relyh", "TadahTech");
|
||||
|
||||
public TopEloCommand(EloManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "gettopelo", "topelo", "getelo");
|
||||
@ -28,7 +33,11 @@ public class TopEloCommand extends CommandBase<EloManager>
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(args.length != 1)
|
||||
if (!NAMES.contains(caller.getName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (args.length != 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -52,18 +61,18 @@ public class TopEloCommand extends CommandBase<EloManager>
|
||||
caller.sendMessage(C.cWhite + "Top Elo Data");
|
||||
caller.sendMessage(" ");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(int i = 0; i < data.size(); i++){
|
||||
for (int i = 0; i < data.size(); i++)
|
||||
{
|
||||
StringBuilder messageBuilder = new StringBuilder("#");
|
||||
TopEloData topEloData = data.get(i);
|
||||
builder.append((i + 1)).append(": ").append(topEloData.getName())
|
||||
.append(" ").append(EloDivision.getDivision(topEloData.getElo())).append("").append("\n");
|
||||
messageBuilder.append((i + 1)).append(": ").append(topEloData.getName())
|
||||
.append(" ").append(EloDivision.getDivision(topEloData.getElo())).append("");
|
||||
SlackMessage slackMessage = new SlackMessage(builder.toString());
|
||||
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#top-elo", slackMessage, false);
|
||||
caller.sendMessage(C.cYellow + messageBuilder.toString());
|
||||
}
|
||||
|
||||
SlackMessage slackMessage = new SlackMessage(builder.toString());
|
||||
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#top-elo", slackMessage, false);
|
||||
caller.sendMessage(" ");
|
||||
caller.sendMessage(C.cAquaB + C.Strike + "=============================================");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user