Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 44.75 KB | None | 0 0
  1.  
  2. import java.util.ArrayList;
  3. import java.util.Calendar;
  4. import java.util.Date;
  5. import java.util.HashMap;
  6. import java.util.List;
  7. import java.util.Map;
  8. import java.util.Map.Entry;
  9. import java.util.logging.Level;
  10. import java.util.logging.Logger;
  11. import net.minecraft.server.MinecraftServer;
  12.  
  13. public class id extends ej
  14.         implements ef {
  15.  
  16.     public static Logger a = Logger.getLogger("Minecraft");
  17.     public bb b;
  18.     public boolean c = false;
  19.     private MinecraftServer d;
  20.     private ea e;
  21.     private int f = 0;
  22.     private double g;
  23.     private double h;
  24.     private double i;
  25.     private boolean j = true;
  26.     private gp k = null;
  27.     private List<String> onlyOneUseKits = new ArrayList<String>();
  28.  
  29.     public id(MinecraftServer paramMinecraftServer, bb parambb, ea paramea) {
  30.         this.d = paramMinecraftServer;
  31.         this.b = parambb;
  32.         parambb.a(this);
  33.         this.e = paramea;
  34.         paramea.a = this;
  35.     }
  36.  
  37.     public void a() {
  38.         this.b.a();
  39.         if (this.f++ % 20 == 0) {
  40.             this.b.a(new iz());
  41.         }
  42.     }
  43.  
  44.     public void c(String paramString) {
  45.         this.b.a(new io(paramString));
  46.         this.b.c();
  47.         this.d.f.c(this.e);
  48.         this.c = true;
  49.     }
  50.  
  51.     public void a(gf paramgf) {
  52.         double d1;
  53.         if (!this.j) {
  54.             d1 = paramgf.b - this.h;
  55.             if ((paramgf.a == this.g) && (d1 * d1 < 0.01D) && (paramgf.c == this.i)) {
  56.                 this.j = true;
  57.             }
  58.         }
  59.         if (this.j) {
  60.             this.g = this.e.l;
  61.             this.h = this.e.m;
  62.             this.i = this.e.n;
  63.  
  64.             d1 = this.e.l;
  65.             double d2 = this.e.m;
  66.             double d3 = this.e.n;
  67.  
  68.             float f1 = this.e.r;
  69.             float f2 = this.e.s;
  70.  
  71.             if (paramgf.h) {
  72.                 d1 = paramgf.a;
  73.                 d2 = paramgf.b;
  74.                 d3 = paramgf.c;
  75.                 double d4 = paramgf.d - paramgf.b;
  76.                 if ((d4 > 1.65D) || (d4 < 0.1D)) {
  77.                     c("Illegal stance");
  78.                     a.warning(this.e.aq + " had an illegal stance: " + d4);
  79.                 }
  80.                 this.e.ai = paramgf.d;
  81.             }
  82.             if (paramgf.i) {
  83.                 f1 = paramgf.e;
  84.                 f2 = paramgf.f;
  85.             }
  86.  
  87.             this.e.i();
  88.             this.e.M = 0.0F;
  89.             this.e.b(this.g, this.h, this.i, f1, f2);
  90.  
  91.             double d4 = d1 - this.e.l;
  92.             double d5 = d2 - this.e.m;
  93.             double d6 = d3 - this.e.n;
  94.  
  95.             float f3 = 0.0625F;
  96.             int m = this.d.e.a(this.e, this.e.v.b().e(f3, f3, f3)).size() == 0 ? 1 : 0;
  97.  
  98.             this.e.c(d4, d5, d6);
  99.             d4 = d1 - this.e.l;
  100.             d5 = d2 - this.e.m;
  101.             if ((d5 > -0.5D) || (d5 < 0.5D)) {
  102.                 d5 = 0.0D;
  103.             }
  104.             d6 = d3 - this.e.n;
  105.             double d7 = d4 * d4 + d5 * d5 + d6 * d6;
  106.             int n = 0;
  107.             if (d7 > 0.0625D) {
  108.                 n = 1;
  109.                 a.warning(this.e.aq + " moved wrongly!");
  110.             }
  111.             this.e.b(d1, d2, d3, f1, f2);
  112.  
  113.             int i1 = this.d.e.a(this.e, this.e.v.b().e(f3, f3, f3)).size() == 0 ? 1 : 0;
  114.             if ((m != 0) && ((n != 0) || (i1 == 0))) {
  115.                 a(this.g, this.h, this.i, f1, f2);
  116.                 return;
  117.             }
  118.  
  119.             this.e.w = paramgf.g;
  120.             this.d.f.b(this.e);
  121.         }
  122.     }
  123.  
  124.     public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) {
  125.         this.j = false;
  126.         this.g = paramDouble1;
  127.         this.h = paramDouble2;
  128.         this.i = paramDouble3;
  129.         this.e.b(paramDouble1, paramDouble2, paramDouble3, paramFloat1, paramFloat2);
  130.         this.e.a.b(new dq(paramDouble1, paramDouble2 + 1.620000004768372D, paramDouble2, paramDouble3, paramFloat1, paramFloat2, false));
  131.     }
  132.  
  133.     //Destroy function
  134.     public void a(hd paramhd) {
  135.         this.e.aj.a[this.e.aj.d] = this.k;
  136.         boolean bool = this.d.e.z = (this.d.f.g(this.e.aq) || etc.getInstance().isAdmin(e));
  137.         int m = 0;
  138.         if (paramhd.e == 0) {
  139.             m = 1;
  140.         }
  141.         if (paramhd.e == 1) {
  142.             m = 1;
  143.         }
  144.  
  145.         if (m != 0) {
  146.             double d1 = this.e.m;
  147.             this.e.m = this.e.ai;
  148.             fr localfr = this.e.a(4.0D, 1.0F);
  149.             this.e.m = d1;
  150.             if (localfr == null) {
  151.                 return;
  152.             }
  153.             if ((localfr.b != paramhd.a) || (localfr.c != paramhd.b) || (localfr.d != paramhd.c) || (localfr.e != paramhd.d)) {
  154.                 return;
  155.             }
  156.         }
  157.         int n = paramhd.a;
  158.         int i1 = paramhd.b;
  159.         int i2 = paramhd.c;
  160.         int i3 = paramhd.d;
  161.         int i4 = (int) gj.e(n - this.d.e.n);
  162.         int i5 = (int) gj.e(i2 - this.d.e.p);
  163.         if (i4 > i5) {
  164.             i5 = i4;
  165.         }
  166.         if (paramhd.e == 0) {
  167.             if (!etc.getInstance().canBuild(e)) {
  168.                 return;
  169.             }
  170.             if (i5 > etc.getInstance().spawnProtectionSize || bool) {
  171.                 this.e.ad.a(n, i1, i2);
  172.             }
  173.         } else if (paramhd.e == 2) {
  174.             this.e.ad.a();
  175.         } else if (paramhd.e == 1) {
  176.             if (!etc.getInstance().canBuild(e)) {
  177.                 return;
  178.             }
  179.             if (i5 > etc.getInstance().spawnProtectionSize || bool) {
  180.                 this.e.ad.a(n, i1, i2, i3);
  181.             }
  182.         } else if (paramhd.e == 3) {
  183.             double d2 = this.e.l - (n + 0.5D);
  184.             double d3 = this.e.m - (i1 + 0.5D);
  185.             double d4 = this.e.n - (i2 + 0.5D);
  186.             double d5 = d2 * d2 + d3 * d3 + d4 * d4;
  187.             if (d5 < 256.0D) {
  188.                 this.e.a.b(new et(n, i1, i2, this.d.e));
  189.             }
  190.         }
  191.         this.d.e.z = false;
  192.     }
  193.  
  194.     //Build function
  195.     public void a(fe paramfe) {
  196.         if (!etc.getInstance().canBuild(e)) {
  197.             return;
  198.         }
  199.         boolean bool = this.d.e.z = (this.d.f.g(this.e.aq) || etc.getInstance().isAdmin(e));
  200.         int m = paramfe.b;
  201.         int n = paramfe.c;
  202.         int i1 = paramfe.d;
  203.         int i2 = paramfe.e;
  204.         int i3 = (int) gj.e(m - this.d.e.n);
  205.         int i4 = (int) gj.e(i1 - this.d.e.p);
  206.         if (i3 > i4) {
  207.             i4 = i3;
  208.         }
  209.         if (i4 > etc.getInstance().spawnProtectionSize || bool) {
  210.             gp localgp = paramfe.a >= 0 ? new gp(paramfe.a) : null;
  211.  
  212.             if (localgp != null) {
  213.                 if (!etc.getInstance().isOnItemBlacklist(localgp.c) || bool) {
  214.                     this.e.ad.a(this.e, this.d.e, localgp, m, n, i1, i2);
  215.                 }
  216.             } else {
  217.                 // is this right?
  218.                 this.e.ad.a(this.e, this.d.e, localgp, m, n, i1, i2);
  219.             }
  220.         }
  221.         this.e.a.b(new et(m, n, i1, this.d.e));
  222.         this.d.e.z = false;
  223.     }
  224.  
  225.     public void a(String paramString) {
  226.         a.info(this.e.aq + " lost connection: " + paramString);
  227.         this.d.f.c(this.e);
  228.         this.c = true;
  229.     }
  230.  
  231.     public void a(hp paramhp) {
  232.         a.warning(getClass() + " wasn't prepared to deal with a " + paramhp.getClass());
  233.         c("Protocol error, unexpected packet");
  234.     }
  235.  
  236.     public void b(hp paramhp) {
  237.         this.b.a(paramhp);
  238.     }
  239.  
  240.     public void a(fv paramfv) {
  241.         int m = paramfv.b;
  242.         this.e.aj.d = (this.e.aj.a.length - 1);
  243.         if (m == 0) {
  244.             this.k = null;
  245.         } else {
  246.             this.k = new gp(m);
  247.         }
  248.         this.e.aj.a[this.e.aj.d] = this.k;
  249.         this.d.k.a(this.e, new fv(this.e.c, m));
  250.     }
  251.  
  252.     public void a(k paramk) {
  253.         double d1 = paramk.b / 32.0D;
  254.         double d2 = paramk.c / 32.0D;
  255.         double d3 = paramk.d / 32.0D;
  256.         fn localfn = new fn(this.d.e, d1, d2, d3, new gp(paramk.h, paramk.i));
  257.         localfn.o = (paramk.e / 128.0D);
  258.         localfn.p = (paramk.f / 128.0D);
  259.         localfn.q = (paramk.g / 128.0D);
  260.         localfn.ad = 10;
  261.         this.d.e.a(localfn);
  262.     }
  263.  
  264.     public void a(ba paramba) {
  265.         String str = paramba.a;
  266.         if (str.length() > 100) {
  267.             b("Chat message too long");
  268.             return;
  269.         }
  270.         str = str.trim();
  271.         for (int k = 0; k < str.length(); ++k) {
  272.             if (" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~ยฆร‡รผรฉรขรคร รฅรงรชรซรจรฏรฎรฌร„ร…ร‰รฆร†รดรถรฒรปรนรฟร–รœรธยฃร˜ร—ฦ’รกรญรณรบรฑร‘ยชยบยฟยฎยฌยฝยผยกยซยป".indexOf(str.charAt(k)) < 0) {
  273.                 b("Illegal characters in chat");
  274.                 return;
  275.             }
  276.         }
  277.  
  278.         if (str.startsWith("/")) {
  279.             d(str);
  280.         } else {
  281.             if (etc.getInstance().isMuted(e)) {
  282.                 msg(Colors.Rose + "You are currently muted.");
  283.                 return;
  284.             }
  285.  
  286.             String message = "<" + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.White + "> " + str;
  287.             a.log(Level.INFO, "<" + e.aq + "> " + str);
  288.             this.d.f.a(new ba(message));
  289.         }
  290.     }
  291.  
  292.     private ea match(String name) {
  293.         ea player = null;
  294.         boolean found = false;
  295.         if (("`" + this.d.f.c().toUpperCase() + "`").split(name.toUpperCase()).length == 2) {
  296.             for (int i = 0; i < this.d.f.b.size() && !found; ++i) {
  297.                 ea localea = (ea) this.d.f.b.get(i);
  298.                 if (("`" + localea.aq.toUpperCase() + "`").split(name.toUpperCase()).length == 2) {
  299.                     player = localea;
  300.                     found = true;
  301.                 }
  302.             }
  303.         } else if (("`" + this.d.f.c() + "`").split(name).length > 2) {
  304.             // Too many partial matches.
  305.             for (int i = 0; i < this.d.f.b.size() && !found; ++i) {
  306.                 ea localea = (ea) this.d.f.b.get(i);
  307.                 if (localea.aq.equalsIgnoreCase(name)) {
  308.                     player = localea;
  309.                     found = true;
  310.                 }
  311.             }
  312.         }
  313.         return player;
  314.     }
  315.  
  316.     public static String combineSplit(int startIndex, String[] string, String seperator) {
  317.         StringBuilder builder = new StringBuilder();
  318.         for (int i = startIndex; i < string.length; i++) {
  319.             builder.append(string[i]);
  320.             builder.append(seperator);
  321.         }
  322.         builder.deleteCharAt(builder.length() - seperator.length()); // remove the extra
  323.         // seperator
  324.         return builder.toString();
  325.     }
  326.  
  327.     public boolean hasControlOver(ea player) {
  328.         boolean isInGroup = false;
  329.  
  330.         if (etc.getInstance().getUser(player.aq) != null) {
  331.             for (String str : etc.getInstance().getUser(player.aq).Groups) {
  332.                 if (etc.getInstance().isUserInGroup(e, str)) {
  333.                     isInGroup = true;
  334.                 }
  335.             }
  336.         } else {
  337.             return true;
  338.         }
  339.  
  340.         return isInGroup;
  341.     }
  342.  
  343.     public void msg(String msg) {
  344.         b(new ba(msg));
  345.     }
  346.  
  347.     private void d(String paramString) {
  348.         try {
  349.             String[] split = paramString.split(" ");
  350.             if (!etc.getInstance().canUseCommand(e.aq, split[0]) && !split[0].startsWith("/#")) {
  351.                 msg(Colors.Rose + "Unknown command.");
  352.                 return;
  353.             }
  354.             if (split[0].equalsIgnoreCase("/help")) {
  355.                 //Meh, not the greatest way, but not the worst either.
  356.                 List<String> availableCommands = new ArrayList<String>();
  357.                 for (Entry<String, String> entry : etc.getInstance().commands.entrySet()) {
  358.                     if (etc.getInstance().canUseCommand(e.aq, entry.getKey())) {
  359.                         if (entry.getKey().equals("/kit") && !etc.getInstance().getDataSource().hasKits()) {
  360.                             continue;
  361.                         }
  362.                         if (entry.getKey().equals("/listwarps") && !etc.getInstance().getDataSource().hasWarps()) {
  363.                             continue;
  364.                         }
  365.  
  366.                         availableCommands.add(entry.getKey() + " " + entry.getValue());
  367.                     }
  368.                 }
  369.  
  370.                 msg(Colors.Blue + "Available commands (Page " + (split.length == 2 ? split[1] : "1") + " of " + (int) Math.ceil((double) availableCommands.size() / (double) 7) + ") [] = required <> = optional:");
  371.                 if (split.length == 2) {
  372.                     try {
  373.                         int amount = Integer.parseInt(split[1]);
  374.  
  375.                         if (amount > 0) {
  376.                             amount = (amount - 1) * 7;
  377.                         } else {
  378.                             amount = 0;
  379.                         }
  380.  
  381.                         for (int i = amount; i < amount + 7; i++) {
  382.                             if (availableCommands.size() > i) {
  383.                                 msg(Colors.Rose + availableCommands.get(i));
  384.                             }
  385.                         }
  386.                     } catch (NumberFormatException ex) {
  387.                         msg(Colors.Rose + "Not a valid page number.");
  388.                     }
  389.                 } else {
  390.                     for (int i = 0; i < 7; i++) {
  391.                         if (availableCommands.size() > i) {
  392.                             msg(Colors.Rose + availableCommands.get(i));
  393.                         }
  394.                     }
  395.                 }
  396.             } else if (split[0].equalsIgnoreCase("/reload")) {
  397.                 etc.getInstance().load();
  398.                 etc.getInstance().loadData();
  399.                 a.info("Reloaded config");
  400.                 msg("Successfuly reloaded config");
  401.             } else if ((split[0].equalsIgnoreCase("/modify") || split[0].equalsIgnoreCase("/mp"))) {
  402.                 if (split.length < 4) {
  403.                     msg(Colors.Rose + "Usage is: /modify [player] [key] [value]");
  404.                     msg(Colors.Rose + "Keys:");
  405.                     msg(Colors.Rose + "prefix: only the letter the color represents");
  406.                     msg(Colors.Rose + "commands: list seperated by comma");
  407.                     msg(Colors.Rose + "groups: list seperated by comma");
  408.                     msg(Colors.Rose + "ignoresrestrictions: true or false");
  409.                     msg(Colors.Rose + "admin: true or false");
  410.                     msg(Colors.Rose + "modworld: true or false");
  411.                     return;
  412.                 }
  413.  
  414.                 ea player = match(split[1]);
  415.  
  416.                 if (player == null) {
  417.                     msg(Colors.Rose + "Player does not exist.");
  418.                     return;
  419.                 }
  420.  
  421.                 String key = split[2];
  422.                 String value = split[3];
  423.                 User user = etc.getInstance().getUser(split[1]);
  424.                 boolean newUser = false;
  425.  
  426.                 if (user == null) {
  427.                     if (!key.equalsIgnoreCase("groups") && !key.equalsIgnoreCase("g")) {
  428.                         msg(Colors.Rose + "When adding a new user, set their group(s) first.");
  429.                         return;
  430.                     }
  431.                     msg(Colors.Rose + "Adding new user.");
  432.                     newUser = true;
  433.                     user = new User();
  434.                     user.Name = split[1];
  435.                     user.Administrator = false;
  436.                     user.CanModifyWorld = true;
  437.                     user.IgnoreRestrictions = false;
  438.                     user.Commands = new String[]{""};
  439.                     user.Prefix = "";
  440.                 }
  441.  
  442.                 if (key.equalsIgnoreCase("prefix") || key.equalsIgnoreCase("p")) {
  443.                     user.Prefix = value;
  444.                 } else if (key.equalsIgnoreCase("commands") || key.equalsIgnoreCase("c")) {
  445.                     user.Commands = value.split(",");
  446.                 } else if (key.equalsIgnoreCase("groups") || key.equalsIgnoreCase("g")) {
  447.                     user.Groups = value.split(",");
  448.                 } else if (key.equalsIgnoreCase("ignoresrestrictions") || key.equalsIgnoreCase("ir")) {
  449.                     user.IgnoreRestrictions = value.equalsIgnoreCase("true") || value.equals("1");
  450.                 } else if (key.equalsIgnoreCase("admin") || key.equalsIgnoreCase("a")) {
  451.                     user.Administrator = value.equalsIgnoreCase("true") || value.equals("1");
  452.                 } else if (key.equalsIgnoreCase("modworld") || key.equalsIgnoreCase("mw")) {
  453.                     user.CanModifyWorld = value.equalsIgnoreCase("true") || value.equals("1");
  454.                 }
  455.  
  456.                 if (newUser) {
  457.                     etc.getInstance().getDataSource().addUser(user);
  458.                 } else {
  459.                     etc.getInstance().getDataSource().modifyUser(user);
  460.                 }
  461.                 msg(Colors.Rose + "Modified user.");
  462.                 a.info("Modifed user " + split[1] + ". " + key + " => " + value + " by " + e.aq);
  463.             } else if (split[0].equalsIgnoreCase("/whitelist")) {
  464.                 if (split.length != 3) {
  465.                     msg(Colors.Rose + "whitelist [operation (add or remove)] [player]");
  466.                     return;
  467.                 }
  468.  
  469.                 if (split[1].equalsIgnoreCase("add")) {
  470.                     etc.getInstance().getDataSource().addToWhitelist(split[2]);
  471.                     msg(Colors.Rose + split[2] + " added to whitelist");
  472.                 } else if (split[1].equalsIgnoreCase("remove")) {
  473.                     etc.getInstance().getDataSource().removeFromWhitelist(split[2]);
  474.                     msg(Colors.Rose + split[2] + " removed from whitelist");
  475.                 } else {
  476.                     msg(Colors.Rose + "Invalid operation.");
  477.                 }
  478.             } else if (split[0].equalsIgnoreCase("/reservelist")) {
  479.                 if (split.length != 3) {
  480.                     msg(Colors.Rose + "reservelist [operation (add or remove)] [player]");
  481.                     return;
  482.                 }
  483.  
  484.                 if (split[1].equalsIgnoreCase("add")) {
  485.                     etc.getInstance().getDataSource().addToReserveList(split[2]);
  486.                     msg(Colors.Rose + split[2] + " added to reservelist");
  487.                 } else if (split[1].equalsIgnoreCase("remove")) {
  488.                     etc.getInstance().getDataSource().removeFromReserveList(split[2]);
  489.                     msg(Colors.Rose + split[2] + " removed from reservelist");
  490.                 } else {
  491.                     msg(Colors.Rose + "Invalid operation.");
  492.                 }
  493.             } else if (split[0].equalsIgnoreCase("/mute")) {
  494.                 if (split.length != 2) {
  495.                     msg(Colors.Rose + "Correct usage is: /mute [player]");
  496.                     return;
  497.                 }
  498.  
  499.                 ea player = match(split[1]);
  500.  
  501.                 if (player != null) {
  502.                     if (etc.getInstance().toggleMute(player)) {
  503.                         msg(Colors.Rose + "player was muted");
  504.                     } else {
  505.                         msg(Colors.Rose + "player was unmuted");
  506.                     }
  507.                 } else {
  508.                     msg(Colors.Rose + "Can't find player " + split[1]);
  509.                 }
  510.             } else if ((split[0].equalsIgnoreCase("/msg") || split[0].equalsIgnoreCase("/tell")) || split[0].equalsIgnoreCase("/m")) {
  511.                 if (split.length < 3) {
  512.                     msg(Colors.Rose + "Correct usage is: /msg [player] [message]");
  513.                     return;
  514.                 }
  515.                 if (etc.getInstance().isMuted(e)) {
  516.                     msg(Colors.Rose + "You are currently muted.");
  517.                     return;
  518.                 }
  519.  
  520.                 ea player = match(split[1]);
  521.  
  522.                 if (player != null) {
  523.                     if (player.aq.equals(e.aq)) {
  524.                         msg(Colors.Rose + "You can't message yourself!");
  525.                         return;
  526.                     }
  527.                     String prefix = etc.getInstance().getUserColor(e.aq);
  528.  
  529.                     player.a.msg("(MSG) " + prefix + "<" + e.aq + "> " + Colors.White + combineSplit(2, split, " "));
  530.                     msg("(MSG) " + prefix + "<" + e.aq + "> " + Colors.White + combineSplit(2, split, " "));
  531.                 } else {
  532.                     msg(Colors.Rose + "Couldn't find player " + split[1]);
  533.                 }
  534.             } else if (split[0].equalsIgnoreCase("/kit") && etc.getInstance().getDataSource().hasKits()) {
  535.                 if (split.length != 2 && split.length != 3) {
  536.                     msg(Colors.Rose + "Available kits: " + Colors.White + etc.getInstance().getDataSource().getKitNames(e.aq));
  537.                     return;
  538.                 }
  539.  
  540.                 ea toGive = e;
  541.                 if (split.length > 2 && etc.getInstance().canIgnoreRestrictions(e)) {
  542.                     toGive = match(split[1]);
  543.                 }
  544.  
  545.                 Kit kit = etc.getInstance().getDataSource().getKit(split[1]);
  546.                 if (toGive != null) {
  547.                     if (kit != null) {
  548.                         if (!etc.getInstance().isUserInGroup(e, kit.Group) && !kit.Group.equals("")) {
  549.                             msg(Colors.Rose + "That kit does not exist.");
  550.                         } else if (onlyOneUseKits.contains(kit.Name)) {
  551.                             msg(Colors.Rose + "You can only get this kit once per login.");
  552.                         } else if (MinecraftServer.b.containsKey(this.e.aq + " " + kit.Name)) {
  553.                             msg(Colors.Rose + "You can't get this kit again for a while.");
  554.                         } else {
  555.                             if (!etc.getInstance().canIgnoreRestrictions(e)) {
  556.                                 if (kit.Delay >= 0) {
  557.                                     MinecraftServer.b.put(this.e.aq + " " + kit.Name, kit.Delay);
  558.                                 } else {
  559.                                     onlyOneUseKits.add(kit.Name);
  560.                                 }
  561.                             }
  562.  
  563.                             a.info(this.e.aq + " got a kit!");
  564.                             toGive.a.msg(Colors.Rose + "Enjoy this kit!");
  565.                             for (Map.Entry<String, Integer> entry : kit.IDs.entrySet()) {
  566.                                 try {
  567.                                     int itemId = 0;
  568.                                     try {
  569.                                         itemId = Integer.parseInt(entry.getKey());
  570.                                     } catch (NumberFormatException n) {
  571.                                         itemId = etc.getInstance().getDataSource().getItem(entry.getKey());
  572.                                     }
  573.  
  574.                                     int temp = kit.IDs.get(entry.getKey());
  575.                                     do {
  576.                                         if (temp - 64 >= 64) {
  577.                                             toGive.a(new gp(itemId, 64));
  578.                                         } else {
  579.                                             toGive.a(new gp(itemId, temp));
  580.                                         }
  581.                                         temp -= 64;
  582.                                     } while (temp >= 64);
  583.                                 } catch (Exception e1) {
  584.                                     a.info("Got an exception while giving out a kit (Kit name \"" + kit.Name + "\"). Are you sure all the Ids are numbers?");
  585.                                     msg(Colors.Rose + "The server encountered a problem while giving the kit :(");
  586.                                 }
  587.                             }
  588.                         }
  589.                     } else {
  590.                         msg(Colors.Rose + "That kit does not exist.");
  591.                     }
  592.                 } else {
  593.                     msg(Colors.Rose + "That user does not exist.");
  594.                 }
  595.             } else if (split[0].equalsIgnoreCase("/tp")) {
  596.                 if (split.length < 2) {
  597.                     msg(Colors.Rose + "Correct usage is: /tp [player]");
  598.                     return;
  599.                 }
  600.  
  601.                 ea player = match(split[1]);
  602.  
  603.                 if (this.e.aq.equalsIgnoreCase(split[1])) {
  604.                     msg(Colors.Rose + "You're already here!");
  605.                     return;
  606.                 }
  607.  
  608.                 if (player != null) {
  609.                     a.info(this.e.aq + " teleported to " + player.aq);
  610.                     a(player.l, player.m, player.n, player.r, player.s);
  611.                 } else {
  612.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  613.                 }
  614.             } else if ((split[0].equalsIgnoreCase("/tphere") || split[0].equalsIgnoreCase("/s"))) {
  615.                 if (split.length < 2) {
  616.                     msg(Colors.Rose + "Correct usage is: /tphere [player]");
  617.                     return;
  618.                 }
  619.  
  620.                 ea player = match(split[1]);
  621.  
  622.                 if (this.e.aq.equalsIgnoreCase(split[1])) {
  623.                     msg(Colors.Rose + "Wow look at that! You teleported yourself to yourself!");
  624.                     return;
  625.                 }
  626.  
  627.                 if (player != null) {
  628.                     a.info(this.e.aq + " teleported " + player.aq + " to their self.");
  629.                     player.a.a(e.l, e.m, e.n, e.r, e.s);
  630.                 } else {
  631.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  632.                 }
  633.             } else if (split[0].equalsIgnoreCase("/playerlist") || split[0].equalsIgnoreCase("/who")) {
  634.                 msg(Colors.Rose + "Player list (" + d.f.b.size() + "/" + etc.getInstance().playerLimit + "): " + Colors.White + d.f.c());
  635.             } else if (split[0].equalsIgnoreCase("/item") || split[0].equalsIgnoreCase("/i") || split[0].equalsIgnoreCase("/give")) {
  636.                 if (split.length < 2) {
  637.                     if (etc.getInstance().canIgnoreRestrictions(e)) {
  638.                         msg(Colors.Rose + "Correct usage is: /item [itemid] <amount> <player> (optional)");
  639.                     } else {
  640.                         msg(Colors.Rose + "Correct usage is: /item [itemid] <amount>");
  641.                     }
  642.                     return;
  643.                 }
  644.  
  645.                 ea toGive = e;
  646.                 if (split.length == 4 && etc.getInstance().canIgnoreRestrictions(e)) {
  647.                     toGive = match(split[3]);
  648.                 }
  649.  
  650.                 if (toGive != null) {
  651.                     try {
  652.                         int i2 = 0;
  653.                         try {
  654.                             i2 = Integer.parseInt(split[1]);
  655.                         } catch (NumberFormatException n) {
  656.                             i2 = etc.getInstance().getDataSource().getItem(split[1]);
  657.                         }
  658.                         int i3 = 1;
  659.                         if (split.length > 2) {
  660.                             i3 = Integer.parseInt(split[2]);
  661.                         }
  662.  
  663.                         String i2str = Integer.toString(i2);
  664.                         if (i3 == -1 && etc.getInstance().isAdmin(e)) {
  665.                             i3 = 255;
  666.                         } else if (i3 <= 0) {
  667.                             i3 = 1;
  668.                         }
  669.                         if (i3 > 64 && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  670.                             i3 = 64;
  671.                         }
  672.  
  673.                         boolean allowedItem = false;
  674.                         if (!etc.getInstance().allowedItems[0].equals("") && (!etc.getInstance().canIgnoreRestrictions(this.e))) {
  675.                             for (String str : etc.getInstance().allowedItems) {
  676.                                 if (i2str.equals(str)) {
  677.                                     allowedItem = true;
  678.                                 }
  679.                             }
  680.                         } else {
  681.                             allowedItem = true;
  682.                         }
  683.                         if (!etc.getInstance().disallowedItems[0].equals("") && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  684.                             for (String str : etc.getInstance().disallowedItems) {
  685.                                 if (i2str.equals(str)) {
  686.                                     allowedItem = false;
  687.                                 }
  688.                             }
  689.                         }
  690.                         if (i2 < ez.c.length) {
  691.                             if (ez.c[i2] != null && (allowedItem || etc.getInstance().canIgnoreRestrictions(this.e))) {
  692.                                 a.log(Level.INFO, "Giving " + toGive.aq + " some " + i2);
  693.                                 if (i3 == 255) {
  694.                                     toGive.a(new gp(i2, 255));
  695.                                 } else {
  696.                                     int temp = i3;
  697.  
  698.                                     do {
  699.                                         if (temp - 64 >= 64) {
  700.                                             toGive.a(new gp(i2, 64));
  701.                                         } else {
  702.                                             toGive.a(new gp(i2, temp));
  703.                                         }
  704.                                         temp -= 64;
  705.                                     } while (temp >= 64);
  706.                                 }
  707.  
  708.                                 if (toGive == this.e) {
  709.                                     msg(Colors.Rose + "There you go c:");
  710.                                 } else {
  711.                                     msg(Colors.Rose + "Gift given! :D");
  712.                                     toGive.a.msg(Colors.Rose + "Enjoy your gift! :D");
  713.                                 }
  714.                             } else if ((!allowedItem) && (ez.c[i2] != null) && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  715.                                 msg(Colors.Rose + "You are not allowed to spawn that item.");
  716.                             } else {
  717.                                 msg(Colors.Rose + "No item with ID " + split[1]);
  718.                             }
  719.                         } else {
  720.                             msg(Colors.Rose + "No item with ID " + split[1]);
  721.                         }
  722.                     } catch (NumberFormatException localNumberFormatException) {
  723.                         msg(Colors.Rose + "Improper ID and/or amount.");
  724.                     }
  725.                 } else {
  726.                     msg(Colors.Rose + "Can't find user " + split[3]);
  727.                 }
  728.             } else if (split[0].equalsIgnoreCase("/tempban")) {
  729.                 // /tempban MINUTES HOURS DAYS
  730.                 if (split.length == 1) {
  731.                     //TODO;
  732.                     return;
  733.                 }
  734.                 int minutes = 0, hours = 0, days = 0;
  735.                 if (split.length >= 2) {
  736.                     minutes = Integer.parseInt(split[1]);
  737.                 }
  738.                 if (split.length >= 3) {
  739.                     hours = Integer.parseInt(split[2]);
  740.                 }
  741.                 if (split.length >= 4) {
  742.                     days = Integer.parseInt(split[3]);
  743.                 }
  744.                 Date date = new Date();
  745.                 //date.
  746.             } else if (split[0].equalsIgnoreCase("/banlist")) {
  747.                 byte type = 0;
  748.                 if (split.length == 2) {
  749.                     if (split[1].equalsIgnoreCase("ips")) {
  750.                         type = 1;
  751.                     }
  752.                 }
  753.                 if (type == 0) { //Regular user bans
  754.                     msg(Colors.Blue + "Ban list:" + Colors.White + " " + d.f.getBans());
  755.                 } else { //IP bans
  756.                     msg(Colors.Blue + "IP Ban list:" + Colors.White + " " + d.f.getBans());
  757.                 }
  758.             } else if (split[0].equalsIgnoreCase("/banip")) {
  759.                 if (split.length < 2) {
  760.                     msg(Colors.Rose + "Correct usage is: /banip [player] <reason> (optional) NOTE: this permabans IPs.");
  761.                     return;
  762.                 }
  763.  
  764.                 ea player = match(split[1]);
  765.  
  766.                 if (player != null) {
  767.                     if (!hasControlOver(player)) {
  768.                         msg(Colors.Rose + "You can't ban that user.");
  769.                         return;
  770.                     }
  771.  
  772.                     // adds player to ban list
  773.                     this.d.f.c(player.a.b.b().toString());
  774.  
  775.                     a.log(Level.INFO, "IP Banning " + player.aq + " (IP: " + player.a.b.b().toString() + ")");
  776.                     msg(Colors.Rose + "IP Banning " + player.aq + " (IP: " + player.a.b.b().toString() + ")");
  777.  
  778.                     if (split.length > 2) {
  779.                         player.a.c("IP Banned by " + e.aq + ": " + combineSplit(2, split, " "));
  780.                     } else {
  781.                         player.a.c("IP Banned by " + e.aq + ".");
  782.                     }
  783.                 } else {
  784.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  785.                 }
  786.             } else if (split[0].equalsIgnoreCase("/ban")) {
  787.                 if (split.length < 2) {
  788.                     msg(Colors.Rose + "Correct usage is: /ban [player] <reason> (optional)");
  789.                     return;
  790.                 }
  791.  
  792.                 ea player = match(split[1]);
  793.  
  794.                 if (player != null) {
  795.                     if (!hasControlOver(player)) {
  796.                         msg(Colors.Rose + "You can't ban that user.");
  797.                         return;
  798.                     }
  799.  
  800.                     // adds player to ban list
  801.                     this.d.f.a(player.aq);
  802.  
  803.                     if (split.length > 2) {
  804.                         player.a.c("Banned by " + e.aq + ": " + combineSplit(2, split, " "));
  805.                     } else {
  806.                         player.a.c("Banned by " + e.aq + ".");
  807.                     }
  808.                     a.log(Level.INFO, "Banning " + player.aq);
  809.                     msg(Colors.Rose + "Banning " + player.aq);
  810.                 } else {
  811.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  812.                 }
  813.             } else if (split[0].equalsIgnoreCase("/unban")) {
  814.                 if (split.length != 2) {
  815.                     msg(Colors.Rose + "Correct usage is: /unban [player]");
  816.                     return;
  817.                 }
  818.                 this.d.f.b(split[1]);
  819.                 msg(Colors.Rose + "Unbanned " + split[1]);
  820.             } else if (split[0].equalsIgnoreCase("/unbanip")) {
  821.                 if (split.length != 2) {
  822.                     msg(Colors.Rose + "Correct usage is: /unbanip [ip]");
  823.                     return;
  824.                 }
  825.                 this.d.f.d(split[1]);
  826.                 msg(Colors.Rose + "Unbanned " + split[1]);
  827.             } else if (split[0].equalsIgnoreCase("/kick")) {
  828.                 if (split.length < 2) {
  829.                     msg(Colors.Rose + "Correct usage is: /kick [player] <reason> (optional)");
  830.                     return;
  831.                 }
  832.  
  833.                 ea player = match(split[1]);
  834.  
  835.                 if (player != null) {
  836.                     if (!hasControlOver(player)) {
  837.                         msg(Colors.Rose + "You can't kick that user.");
  838.                         return;
  839.                     }
  840.  
  841.                     if (split.length > 2) {
  842.                         player.a.c("Kicked by " + e.aq + ": " + combineSplit(2, split, " "));
  843.                     } else {
  844.                         player.a.c("Kicked by " + e.aq + ".");
  845.                     }
  846.                     a.log(Level.INFO, "Kicking " + player.aq);
  847.                     msg(Colors.Rose + "Kicking " + player.aq);
  848.                 } else {
  849.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  850.                 }
  851.             } else if (split[0].equalsIgnoreCase("/me")) {
  852.                 if (etc.getInstance().isMuted(e)) {
  853.                     msg(Colors.Rose + "You are currently muted.");
  854.                     return;
  855.                 }
  856.                 String prefix = etc.getInstance().getUserColor(e.aq);
  857.                 String paramString2 = "* " + prefix + this.e.aq + Colors.White + " " + paramString.substring(paramString.indexOf(" ")).trim();
  858.                 a.info("* " + this.e.aq + " " + paramString.substring(paramString.indexOf(" ")).trim());
  859.                 this.d.f.a(new ba(paramString2));
  860.             } else if (split[0].equalsIgnoreCase("/sethome")) {
  861.                 // player.k, player.l, player.m
  862.                 // x, y, z
  863.                 Location loc = new Location();
  864.                 loc.x = e.l;
  865.                 loc.y = e.m;
  866.                 loc.z = e.n;
  867.                 loc.rotX = e.r;
  868.                 loc.rotY = e.s;
  869.                 Warp home = new Warp();
  870.                 home.Location = loc;
  871.                 home.Group = ""; //no group neccessary, lol.
  872.                 home.Name = e.aq;
  873.                 etc.getInstance().changeHome(home);
  874.                 msg(Colors.Rose + "Your home has been set.");
  875.             } else if (split[0].equalsIgnoreCase("/spawn")) {
  876.                 int m = this.d.e.d(this.d.e.n, this.d.e.p);
  877.                 a(this.d.e.n + 0.5D, m + 1.5D, this.d.e.p + 0.5D, 0.0F, 0.0F);
  878.             } else if (split[0].equalsIgnoreCase("/setspawn")) {
  879.                 this.d.e.n = (int) Math.ceil(e.l);
  880.                 //Too lazy to actually update this considering it's not even used anyways.
  881.                 //this.d.e.n = (int) Math.ceil(e.m); //Not that the Y axis really matters since it tries to get the highest point iirc.
  882.                 this.d.e.p = (int) Math.ceil(e.n);
  883.                 a.info("Spawn position changed.");
  884.                 msg(Colors.Rose + "You have set the spawn to your current position.");
  885.             } else if (split[0].equalsIgnoreCase("/home")) {
  886.                 a.info(this.e.aq + " returned home");
  887.                 Warp home = etc.getInstance().getDataSource().getHome(e.aq);
  888.                 if (home != null) {
  889.                     a(home.Location.x, home.Location.y, home.Location.z, home.Location.rotX, home.Location.rotY);
  890.                 } else {
  891.                     int m = this.d.e.d(this.d.e.n, this.d.e.p);
  892.                     a(this.d.e.n + 0.5D, m + 1.5D, this.d.e.p + 0.5D, 0.0F, 0.0F);
  893.                 }
  894.             } else if (split[0].equalsIgnoreCase("/warp")) {
  895.                 if (split.length < 2) {
  896.                     msg(Colors.Rose + "Correct usage is: /warp [warpname]");
  897.                     return;
  898.                 }
  899.                 ea toWarp = e;
  900.                 Warp warp = null;
  901.                 if (split.length == 3 && etc.getInstance().canIgnoreRestrictions(e)) {
  902.                     warp = etc.getInstance().getDataSource().getWarp(split[1]);
  903.                     toWarp = match(split[2]);
  904.                 } else {
  905.                     warp = etc.getInstance().getDataSource().getWarp(split[1]);
  906.                 }
  907.                 if (toWarp != null) {
  908.                     if (warp != null) {
  909.                         if (!etc.getInstance().isUserInGroup(e, warp.Group) && !warp.Group.equals("")) {
  910.                             msg(Colors.Rose + "Warp not found.");
  911.                         } else {
  912.                             toWarp.a.a(warp.Location.x, warp.Location.y, warp.Location.z, warp.Location.rotX, warp.Location.rotY);
  913.                             toWarp.a.msg(Colors.Rose + "Woosh!");
  914.                         }
  915.                     } else {
  916.                         msg(Colors.Rose + "Warp not found");
  917.                     }
  918.                 } else {
  919.                     msg(Colors.Rose + "Player not found.");
  920.                 }
  921.             } else if (split[0].equalsIgnoreCase("/listwarps") && etc.getInstance().getDataSource().hasWarps()) {
  922.                 if (split.length != 2 && split.length != 3) {
  923.                     msg(Colors.Rose + "Available warps: " + Colors.White + etc.getInstance().getDataSource().getWarpNames(e.aq));
  924.                     return;
  925.                 }
  926.             } else if (split[0].equalsIgnoreCase("/setwarp")) {
  927.                 if (split.length < 2) {
  928.                     if (etc.getInstance().canIgnoreRestrictions(e)) {
  929.                         msg(Colors.Rose + "Correct usage is: /setwarp [warpname] [group]");
  930.                     } else {
  931.                         msg(Colors.Rose + "Correct usage is: /setwarp [warpname]");
  932.                     }
  933.                     return;
  934.                 }
  935.                 Location loc = new Location();
  936.                 loc.x = e.l;
  937.                 loc.y = e.m;
  938.                 loc.z = e.n;
  939.                 loc.rotX = e.r;
  940.                 loc.rotY = e.s;
  941.                 Warp warp = new Warp();
  942.                 warp.Name = split[1];
  943.                 warp.Location = loc;
  944.                 if (split.length == 3) {
  945.                     warp.Group = split[2];
  946.                 } else {
  947.                     warp.Group = "";
  948.                 }
  949.                 etc.getInstance().setWarp(warp);
  950.                 msg(Colors.Rose + "Created warp point " + split[1] + ".");
  951.             } else if (split[0].equalsIgnoreCase("/lighter")) {
  952.                 if (MinecraftServer.b.containsKey(this.e.aq + " lighter")) {
  953.                     a.info(this.e.aq + " failed to iron!");
  954.                     msg(Colors.Rose + "You can't create another lighter again so soon");
  955.                 } else {
  956.                     if (!etc.getInstance().canIgnoreRestrictions(e)) {
  957.                         MinecraftServer.b.put(this.e.aq + " lighter", Integer.valueOf(6000));
  958.                     }
  959.                     a.info(this.e.aq + " created a lighter!");
  960.                     this.e.a(new gp(259, 1));
  961.                 }
  962.             } else if ((paramString.startsWith("/#")) && (this.d.f.g(this.e.aq))) {
  963.                 String str = paramString.substring(2);
  964.                 a.info(this.e.aq + " issued server command: " + str);
  965.                 this.d.a(str, this);
  966.             } else if (split[0].equalsIgnoreCase("/time")) {
  967.                 if (split.length != 2) {
  968.                     msg(Colors.Rose + "Correct usage is: /time [time|day|night]");
  969.                     return;
  970.                 }
  971.  
  972.                 if (split[1].equalsIgnoreCase("day")) {
  973.                     this.d.e.c = 0;
  974.                 } else if (split[1].equalsIgnoreCase("night")) {
  975.                     this.d.e.c = 13000;
  976.                 } else {
  977.                     try {
  978.                         this.d.e.c = Long.parseLong(split[1]);
  979.                     } catch (NumberFormatException e) {
  980.                         msg(Colors.Rose + "Please enter numbers, not letters.");
  981.                     }
  982.                 }
  983.             } else if (split[0].equalsIgnoreCase("/getpos")) {
  984.                 msg("Pos X: " + e.l + " Y: " + e.m + " Z " + e.n);
  985.                 msg("Rotation X: " + e.r + " Y: " + e.s);
  986.  
  987.                 double degreeRotation = ((e.r - 90) % 360);
  988.                 if (degreeRotation < 0) {
  989.                     degreeRotation += 360.0;
  990.                 }
  991.                 msg("Compass: " + etc.getCompassPointForDirection(degreeRotation) + " (" + (Math.round(degreeRotation * 10) / 10.0) + ")");
  992.             } else if (split[0].equalsIgnoreCase("/compass")) {
  993.                 double degreeRotation = ((e.r - 90) % 360);
  994.                 if (degreeRotation < 0) {
  995.                     degreeRotation += 360.0;
  996.                 }
  997.  
  998.                 msg(Colors.Rose + "Compass: " + etc.getCompassPointForDirection(degreeRotation));
  999.             } else if (split[0].equalsIgnoreCase("/motd")) {
  1000.                 for (String str : etc.getInstance().motd) {
  1001.                     msg(str);
  1002.                 }
  1003.             } else {
  1004.                 a.info(this.e.aq + " tried command " + paramString);
  1005.                 msg(Colors.Rose + "Unknown command");
  1006.             }
  1007.         } catch (Exception ex) {
  1008.             a.log(Level.SEVERE, "Exception in command handler (Report this to hey0 unless you did something dumb like enter letters as numbers):", ex);
  1009.             if (etc.getInstance().isAdmin(e)) {
  1010.                 msg(Colors.Rose + "Exception occured. Check the server for more info.");
  1011.             }
  1012.         }
  1013.     }
  1014.  
  1015.     public void a(o paramo) {
  1016.         if (paramo.b == 1) {
  1017.             this.e.y();
  1018.         }
  1019.     }
  1020.  
  1021.     public void a(io paramio) {
  1022.         this.b.a("Quitting");
  1023.     }
  1024.  
  1025.     public int b() {
  1026.         return this.b.d();
  1027.     }
  1028.  
  1029.     public void b(String paramString) {
  1030.         b(new ba("ยง7" + paramString));
  1031.     }
  1032.  
  1033.     public String c() {
  1034.         return this.e.aq;
  1035.     }
  1036.  
  1037.     public void a(r paramr) {
  1038.         if (paramr.a == -1) {
  1039.             this.e.aj.a = paramr.b;
  1040.         }
  1041.         if (paramr.a == -2) {
  1042.             this.e.aj.c = paramr.b;
  1043.         }
  1044.         if (paramr.a == -3) {
  1045.             this.e.aj.b = paramr.b;
  1046.         }
  1047.     }
  1048.  
  1049.     public void d() {
  1050.         this.b.a(new r(-1, this.e.aj.a));
  1051.         this.b.a(new r(-2, this.e.aj.c));
  1052.         this.b.a(new r(-3, this.e.aj.b));
  1053.     }
  1054.  
  1055.     public void a(ib paramib) {
  1056.         as localas = this.d.e.k(paramib.a, paramib.b, paramib.c);
  1057.         if (localas != null) {
  1058.             localas.a(paramib.e);
  1059.             localas.c();
  1060.         }
  1061.     }
  1062. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement