Advertisement
Guest User

IssueCommand

a guest
Mar 28th, 2015
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. package fr.bluebird.report;
  2.  
  3. import fr.bluebird.report.Report;
  4. import fr.bluebird.report.Issue;
  5. import net.md_5.bungee.api.ChatColor;
  6. import net.md_5.bungee.api.CommandSender;
  7. import net.md_5.bungee.api.plugin.Command;
  8.  
  9.  
  10. public class IssuesCommand extends Command {
  11.  
  12.     public IssuesCommand() {
  13.         super("issues");
  14.     }
  15.  
  16.     @Override
  17.     public void execute(CommandSender sender, String[] args) {
  18.         if(!sender.hasPermission("Report.showall")) {
  19.             if(args.length <= 0) {
  20.                 Report.getChat().sendMessage(sender, "Faites: /issues <nombre>");
  21.                 Report.getChat().sendMessage(sender, "Toutes les issues:");
  22.                 for (Issue issue : Issue.getAllIsuesBy(sender.getName())) {
  23.                     Report.getChat().sendMessage(sender, ChatColor.YELLOW + "" + ChatColor.BOLD + issue.getUser() +
  24.                             ChatColor.WHITE + " - " + issue.getDescription() + " - " + issue.getStatus().getName());
  25.                 }
  26.             } else if(args.length == 1) {
  27.                 int i = 0;
  28.                 try {
  29.                     i = Integer.valueOf(args[0]);
  30.                 } catch(Exception e) {
  31.                     Report.getChat().sendMessage(sender, "Vous n'avez pas tape de nombre");
  32.                     return;
  33.                 }
  34.                 Issue issue = Issue.getAllIsuesBy(sender.getName()).get(i);
  35.                 if(issue == null) {
  36.                     Report.getChat().sendMessage(sender, "Le Report n° " + i + " n'existe pas!");
  37.                 }
  38.                 Report.getChat().sendMessage(sender, "Report n° " + i + ":");
  39.                 Report.getChat().sendMessage(sender, "Description: " + issue.getDescription());
  40.                 Report.getChat().sendMessage(sender, "Joueur: " + issue.getUser());
  41.                 Report.getChat().sendMessage(sender, "Report: " + issue.getReporter());
  42.                 Report.getChat().sendMessage(sender, "Status: " + issue.getStatus().getName());
  43.             }
  44.         }
  45.  
  46.         if(args.length <= 0) {
  47.             Report.getChat().sendMessage(sender, "Il existe toute");
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement