Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. package de.staticfx.godBot.commands;
  2.  
  3. import com.jagrosh.jdautilities.commandclient.Command;
  4. import com.jagrosh.jdautilities.commandclient.CommandEvent;
  5. import de.staticfx.godBot.DiscordBot;
  6. import net.dv8tion.jda.core.entities.Role;
  7. import net.dv8tion.jda.core.entities.TextChannel;
  8. import xyz.dodo.fortnite.Fortnite;
  9. import xyz.dodo.fortnite.entity.FortniteData;
  10. import xyz.dodo.fortnite.entity.League;
  11. import xyz.dodo.fortnite.entity.Stat;
  12.  
  13. import java.util.List;
  14. import java.util.stream.Collectors;
  15.  
  16. public class RankCommandExecuter extends Command {
  17. String platform;
  18. String Username;
  19. Fortnite fortnite = new Fortnite("8fdc1618-608d-4733-b581-d3141c189c57");
  20. FortniteData data = fortnite.getPlayerInfo(platform, Username);
  21.  
  22.  
  23. public RankCommandExecuter() {
  24. this.name = "rank";
  25. this.aliases = new String[]{"rank1"};
  26. }
  27. List<Stat> stats = data.getLeague(League.Mode.life_time).getStats().;
  28. String kdRatio = findStat(stats, "K/d");
  29. protected void execute(CommandEvent event) {
  30. Role role1 = DiscordBot.getInstance().getJda().getGuildById("556210184100249623").getRoleById("557260408575229978");
  31. Role role2 = DiscordBot.getInstance().getJda().getGuildById("556210184100249623").getRoleById("557260459858853891");
  32. Role role3 = DiscordBot.getInstance().getJda().getGuildById("556210184100249623").getRoleById("557260508462317588");
  33. Username = event.getMember().getNickname();
  34. String[] args = event.getArgs().split(" ");
  35. TextChannel textchanal = event.getGuild().getTextChannelsByName("skillgruppe-erhalten",true).get(0);
  36. if(event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("xbox")).collect(Collectors.toList()).isEmpty()) {
  37. if(event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("ps4")).collect(Collectors.toList()).isEmpty()) {
  38. if(event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("pc")).collect(Collectors.toList()).isEmpty()) {
  39. event.reply(":warning:Whoop, sieht so aus als ob du deine Plattform noch nicht registriert hast " + event.getAuthor().getAsMention() + ".");
  40. return;
  41. }
  42. }
  43. }
  44. if(!(event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("ps4")).collect(Collectors.toList()).isEmpty())) {
  45. platform = "ps4";
  46. }
  47. if(!(event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("xbox")).collect(Collectors.toList()).isEmpty())) {
  48. platform = "xbox";
  49. }
  50. if(!(event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("pc")).collect(Collectors.toList()).isEmpty())) {
  51. platform = "pc";
  52. }
  53. String statsInString = stats.toString();
  54. if (event.getMember().getRoles().stream().filter(r -> r.getName().equalsIgnoreCase("GodMember")).collect(Collectors.toList()).isEmpty()) {
  55. event.reply(":warning:Whoop, sieht so aus als ob du keine Rechte hast " + event.getAuthor().getAsMention() + ".");
  56. return;
  57. }
  58. if(!(event.getTextChannel().equals(textchanal))) {
  59. event.reply(":warning: Whoop, sieht so aus als ob du nicht im richtigen Kanal wärst " + event.getAuthor().getAsMention() + ". Bitte gehe in " + textchanal.getAsMention());
  60. return;
  61. }
  62. if (data.getResult().isOk()) {
  63. System.out.println(kdRatio);
  64. System.out.println(platform);
  65. }else{
  66. System.out.println(data.getResult());
  67. System.out.println(platform);
  68. }
  69.  
  70.  
  71. }
  72. public String findStat(List<Stat> stats, String label){
  73. for(Stat stat : stats){
  74. if(stat.label.equals(label))
  75. return stat.value;
  76. }
  77.  
  78. return "0";
  79. }
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement