Advertisement
Guest User

more

a guest
Mar 15th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.34 KB | None | 0 0
  1.    @EventHandler(priority=EventPriority.MONITOR)
  2.    public void onDamage(EntityDamageByEntityEvent evnt)
  3.    {
  4.      if ((evnt.getDamager().equals(EntityType.PLAYER)) && (evnt.getEntity().equals(EntityType.PLAYER))) {
  5.        getLogger().warning("trying event");
  6.        Player p = (Player)evnt.getEntity();
  7.        Player pdI = (Player)evnt.getDamager();
  8.        Player pdII = DiaPlayer.getLastDia(p, pdI);
  9.        if (Dia.isDia(pdI)) {
  10.          getLogger().warning("trying event");
  11.          DiaPlayer.setPlayerHit(pdI, p);
  12.          if (!pdII.equals(pdI)) {
  13.           getLogger().warning("/===================/ ADT-II Event: DiaTeam Confirmed /===================/");
  14.           Player[] Staff = Dia.getStaff();
  15.           for (int k = 0; k < Staff.length; k++) {
  16.              JSONMESSAGES.sendJSONMessage(Staff[k], prefix + suffix + "{text:\" §6Players " + pdII.getName() + " and " + pdI.getName() + " Dia-Teamed agianst " + p.getName() + "\",hoverEvent:{action:show_text,value:{text:\"§b" + pdI.getName() + " = " + pdI.getCustomName() + "\n§b" + pdI.getName() + " = " + pdI.getCustomName() + "\"}}}");
  17.            }
  18.            if (Event.setEvent(pdI, pdII)) {
  19.              getLogger().warning("/===================/ New ADT Record Created /===================/");
  20.            }
  21.            else {
  22.              getLogger().warning("/===================/ ADT Record Exists, Updating /===================/");
  23.              Event.addNumRec(Event.getNumEvent(pdI, pdII));
  24.              getLogger().warning("/===================/ ADT Record Updated /===================/");
  25.            }
  26.          }
  27.        }
  28.      }
  29.    }
  30.    
  31.    public void onDisable() { getLogger().info("/===================/ AntiDiaTeam II Disabled /===================/"); }
  32.  
  33.    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  34.    {
  35.      if (cmd.getName().equalsIgnoreCase("adtp")) {
  36.        if (!sender.hasPermission("ADTII.P.Admin")) {
  37.          JSONMESSAGES.sendJSONMessage((Player)sender, prefix + "{text:" + "\"§6 There are currently §b" + Dia.NumDia() + " §6people out in diamond armor\",hoverEvent:{action:show_text,value:{text:\"§c<You dont have permission to see who is in Dia>}}}");
  38.       }
  39.       else {
  40.          JSONMESSAGES.sendJSONMessage((Player)sender, prefix + "{text:" + "\"§6 There are currently §b" + Dia.NumDia() + " §6people out in diamond armor\",hoverEvent:{action:show_text,value:{text:\"§c" + Dia.getDiaPlayers(N).toString() + "}}}");
  41.          JSONMESSAGES.sendJSONMessage((Player)sender, "{text:\"§8[§4X§8]\",hoverEvent:{action:show_text,value:{text:\"§cRemove Record\"}},clickEvent:{action:run_command,value:\"/ADTRemove 1\"}},{text:\"§8[§2B§8]\",hoverEvent:{action:show_text,value:{text:\"§cBan Record\"}},clickEvent:{action:run_command,value:\"/ADTban 1\"}},{text:\"r1§6, §c2§6, §c3§6, §c4§6, §c5\"}");
  42.        }
  43.     }
  44.      if ((cmd.getName().equalsIgnoreCase("adtlist")) &&
  45.        (sender.hasPermission("ADT.List")) &&
  46.        (args.length == 0)) {
  47.        int a = Integer.parseInt(args[0]);
  48.        String[][] b = Event.getRecords(a);
  49.        for (int k = 0; k < b.length ; k++) {
  50.          JSONMESSAGES.sendJSONMessage((Player)sender, "{text:\"§8[§4X§8]\",hoverEvent:{action:show_text,value:{text:\"§cRemove Record\"}},clickEvent:{action:run_command,value:\"/ADTRemove" + k + "\"}},{text:\"§8[§2B§8]\",hoverEvent:{action:show_text,value:{text:\"§cBan Record\"}},clickEvent:{action:run_command,value:\"/ADTban" + k + "\"}},{text:\"r" + b[k][0] + "§6, §c" + b[k][1] + "§6, §c" + b[k][2] + "§6, §c" + b[k][3] + "§6, §c" + b[k][4] + "\"}");
  51.        }
  52.      }
  53.      
  54.  
  55.      if ((cmd.getName().equalsIgnoreCase("adtban")) &&
  56.        (sender.hasPermission(STAFFPERM))) {
  57.        if (args.length >= 1) {
  58.         int a = Integer.parseInt(args[0]);
  59.                     //int a = Integer.parseInt(arg[0]);
  60.         if (Event.recordExists(a)) {
  61.           Player P = Bukkit.getPlayer("");
  62.            Player P2 = Bukkit.getPlayer("");
  63.            Date date = new Date();
  64.            date.setDate(date.getDate() + 3);
  65.            getServer().getBanList(BanList.Type.NAME).addBan(P.getName(), FormPre + FormSuf + "§4You are §lBANNED§4 for Diamond Teaming (record #" + args[0] + ")", date, "~Gary_S_Modd & Odiegaming staff(" + sender.getName() + ")");
  66.            getServer().getBanList(BanList.Type.NAME).addBan(P2.getName(), FormPre + FormSuf + "§4You are §lBANNED§4 for Diamond Teaming (record #" + args[0] + ")", date, "~Gary_S_Modd & Odiegaming staff (" + sender.getName() + ")");
  67.            P.kickPlayer(FormPre + FormSuf + "§4You are §lBANNED§4 for Diamond Teaming (record #" + args[0] + ")");
  68.            P2.kickPlayer(FormPre + FormSuf + "§4You are §lBANNED§4 for Diamond Teaming (record #" + args[0] + ")");
  69.            JSONMESSAGES.broadcastJson(prefix + "{text:\"§c Players §4" + P.getName() + "§c and §4" + P2.getName() + "§c were banned for diamond Teaming for 3 Days\"}");
  70.            return true;
  71.          }
  72.       }
  73.        JSONMESSAGES.sendJSONMessage((Player)sender, prefix + "{text:\"§6You dont have enough arguments!\",hoverEvent:{action:show_text,value:{text:\"§cYou must have at least one(1) argument for this command\n §7usage:§b /adtBan <Record Number>\"}}}");
  74.     }
  75.      
  76.      return false;
  77.    }
  78.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement