Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 55.04 KB | None | 0 0
  1. import java.net.SocketAddress;
  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.                 if (!(Boolean)etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.BLOCK_DESTROYED, new Object[] {e, etc.getServer().getBlockAt(n, i1, i2)}))
  172.                     this.e.ad.a(n, i1, i2);
  173.             }
  174.         } else if (paramhd.e == 2) {
  175.             this.e.ad.a();
  176.         } else if (paramhd.e == 1) {
  177.             if (!etc.getInstance().canBuild(e)) {
  178.                 return;
  179.             }
  180.             if (i5 > etc.getInstance().spawnProtectionSize || bool) {
  181.                 if (!(Boolean)etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.BLOCK_DESTROYED, new Object[] {e, etc.getServer().getBlockAt(n, i1, i2)}))
  182.                     this.e.ad.a(n, i1, i2, i3);
  183.             }
  184.         } else if (paramhd.e == 3) {
  185.             double d2 = this.e.l - (n + 0.5D);
  186.             double d3 = this.e.m - (i1 + 0.5D);
  187.             double d4 = this.e.n - (i2 + 0.5D);
  188.             double d5 = d2 * d2 + d3 * d3 + d4 * d4;
  189.             if (d5 < 256.0D) {
  190.                 this.e.a.b(new et(n, i1, i2, this.d.e));
  191.             }
  192.         }
  193.         this.d.e.z = false;
  194.     }
  195.  
  196.     //Build function
  197.     public void a(fe paramfe) {
  198.         if (!etc.getInstance().canBuild(e)) {
  199.             return;
  200.         }
  201.         boolean bool = this.d.e.z = (this.d.f.g(this.e.aq) || etc.getInstance().isAdmin(e));
  202.         int m = paramfe.b;
  203.         int n = paramfe.c;
  204.         int i1 = paramfe.d;
  205.         int i2 = paramfe.e;
  206.         int i3 = (int) gj.e(m - this.d.e.n);
  207.         int i4 = (int) gj.e(i1 - this.d.e.p);
  208.         if (i3 > i4) {
  209.             i4 = i3;
  210.         }
  211.         if (i4 > etc.getInstance().spawnProtectionSize || bool) {
  212.             gp localgp = paramfe.a >= 0 ? new gp(paramfe.a) : null;
  213.  
  214.             if (localgp != null) {
  215.                 if (!(Boolean)etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.BLOCK_CREATED, new Object[] {e, new Block(localgp.c, m, n, i1)})) {
  216.                     if (!etc.getInstance().isOnItemBlacklist(localgp.c) || bool) {
  217.                         this.e.ad.a(this.e, this.d.e, localgp, m, n, i1, i2);
  218.                     }
  219.                 }
  220.             } else {
  221.                 // is this right?
  222.                 this.e.ad.a(this.e, this.d.e, localgp, m, n, i1, i2);
  223.             }
  224.         }
  225.         this.e.a.b(new et(m, n, i1, this.d.e));
  226.         this.d.e.z = false;
  227.     }
  228.  
  229.     public void a(String paramString) {
  230.         a.info(this.e.aq + " lost connection: " + paramString);
  231.         this.d.f.c(this.e);
  232.         this.c = true;
  233.     }
  234.  
  235.     public void a(hp paramhp) {
  236.         a.warning(getClass() + " wasn't prepared to deal with a " + paramhp.getClass());
  237.         c("Protocol error, unexpected packet");
  238.     }
  239.  
  240.     public void b(hp paramhp) {
  241.         this.b.a(paramhp);
  242.     }
  243.  
  244.     public void a(fv paramfv) {
  245.         int m = paramfv.b;
  246.         this.e.aj.d = (this.e.aj.a.length - 1);
  247.         if (m == 0) {
  248.             this.k = null;
  249.         } else {
  250.             this.k = new gp(m);
  251.         }
  252.         this.e.aj.a[this.e.aj.d] = this.k;
  253.         this.d.k.a(this.e, new fv(this.e.c, m));
  254.     }
  255.  
  256.     public void a(k paramk) {
  257.         double d1 = paramk.b / 32.0D;
  258.         double d2 = paramk.c / 32.0D;
  259.         double d3 = paramk.d / 32.0D;
  260.         fn localfn = new fn(this.d.e, d1, d2, d3, new gp(paramk.h, paramk.i));
  261.         localfn.o = (paramk.e / 128.0D);
  262.         localfn.p = (paramk.f / 128.0D);
  263.         localfn.q = (paramk.g / 128.0D);
  264.         localfn.ad = 10;
  265.         this.d.e.a(localfn);
  266.     }
  267.  
  268.     private String colorChange(char colour)
  269.     {
  270.         String color = "";
  271.         switch(colour)
  272.         {
  273.             case '0':
  274.                 color = Colors.Black;
  275.                 break;
  276.             case '1':
  277.                 color = Colors.Navy;
  278.                 break;
  279.             case '2':
  280.                 color = Colors.Green;
  281.                 break;
  282.             case '3':
  283.                 color = Colors.Blue;
  284.                 break;
  285.             case '4':
  286.                 color = Colors.Red;
  287.                 break;
  288.             case '5':
  289.                 color = Colors.Purple;
  290.                 break;
  291.             case '6':
  292.                 color = Colors.Gold;
  293.                 break;
  294.             case '7':
  295.                 color = Colors.LightGray;
  296.                 break;
  297.             case '8':
  298.                 color = Colors.Gray;
  299.                 break;
  300.             case '9':
  301.                 color = Colors.DarkPurple;
  302.                 break;
  303.             case 'a':
  304.                 color = Colors.LightGreen;
  305.                 break;
  306.             case 'b':
  307.                 color = Colors.LightBlue;
  308.                 break;
  309.             case 'c':
  310.                 color = Colors.Rose;
  311.                 break;
  312.             case 'd':
  313.                 color = Colors.LightPurple;
  314.                 break;
  315.             case 'e':
  316.                 color = Colors.Yellow;
  317.                 break;
  318.             case 'f':
  319.                 color = Colors.White;
  320.                 break;
  321.             case 'A':
  322.                 color = Colors.LightGreen;
  323.                 break;
  324.             case 'B':
  325.                 color = Colors.LightBlue;
  326.                 break;
  327.             case 'C':
  328.                 color = Colors.Rose;
  329.                 break;
  330.             case 'D':
  331.                 color = Colors.LightPurple;
  332.                 break;
  333.             case 'E':
  334.                 color = Colors.Yellow;
  335.                 break;
  336.             case 'F':
  337.                 color = Colors.White;
  338.                 break;
  339.             default:
  340.                 color = Colors.White;
  341.                 break;
  342.         }
  343.         return color;
  344.     }
  345.  
  346.     public void a(ba paramba) {
  347.         String str = paramba.a;
  348.         if (str.length() > 100) {
  349.             b("Chat message too long");
  350.             return;
  351.         }
  352.         str = str.trim();
  353.         for (int k = 0; k < str.length(); ++k) {
  354.             if (" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~ยฆร‡รผรฉรขรคร รฅรงรชรซรจรฏรฎรฌร„ร…ร‰รฆร†รดรถรฒรปรนรฟร–รœรธยฃร˜ร—ฦ’รกรญรณรบรฑร‘ยชยบยฟยฎยฌยฝยผยกยซยป".indexOf(str.charAt(k)) < 0) {
  355.                 b("Illegal characters in chat");
  356.                 return;
  357.             }
  358.         }
  359.  
  360.         if(str.length()>2) {
  361.             String temp = "";
  362.             for(int x = 0; x< str.length(); x++)
  363.             {
  364.                     if(str.charAt(x)=='^'&&x!=str.length()-1)
  365.                     {
  366.                             temp+=colorChange(str.charAt(x+1));
  367.                             x+=1;
  368.                     }
  369.                     else{
  370.                             temp+=str.charAt(x);
  371.                     }
  372.             }
  373.             str = temp + " ";
  374.         }
  375.     if (str.startsWith(">")) {
  376.             str = Colors.LightGreen + str;
  377.         }
  378.         if (str.startsWith("FFF")) {
  379.             str = Colors.Red + str;
  380.         }
  381.  
  382.         if (str.startsWith("/")) {
  383.             d(str);
  384.         } else {
  385.             if (etc.getInstance().isMuted(e)) {
  386.                 msg(Colors.Rose + "You are currently muted.");
  387.                 return;
  388.             }
  389.             etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.CHAT, new Object[]{e, str});
  390.  
  391.             String message = "<" + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.White + "> " + str;
  392.             a.log(Level.INFO, "<" + e.aq + "> " + str);
  393.             this.d.f.a(new ba(message));
  394.         }
  395.     }
  396.  
  397.     private ea match(String name) {
  398.         ea player = null;
  399.         boolean found = false;
  400.         if (("`" + this.d.f.c().toUpperCase() + "`").split(name.toUpperCase()).length == 2) {
  401.             for (int i = 0; i < this.d.f.b.size() && !found; ++i) {
  402.                 ea localea = (ea) this.d.f.b.get(i);
  403.                 if (("`" + localea.aq.toUpperCase() + "`").split(name.toUpperCase()).length == 2) {
  404.                     player = localea;
  405.                     found = true;
  406.                 }
  407.             }
  408.         } else if (("`" + this.d.f.c() + "`").split(name).length > 2) {
  409.             // Too many partial matches.
  410.             for (int i = 0; i < this.d.f.b.size() && !found; ++i) {
  411.                 ea localea = (ea) this.d.f.b.get(i);
  412.                 if (localea.aq.equalsIgnoreCase(name)) {
  413.                     player = localea;
  414.                     found = true;
  415.                 }
  416.             }
  417.         }
  418.         return player;
  419.     }
  420.  
  421.     public static String combineSplit(int startIndex, String[] string, String seperator) {
  422.         StringBuilder builder = new StringBuilder();
  423.         for (int i = startIndex; i < string.length; i++) {
  424.             builder.append(string[i]);
  425.             builder.append(seperator);
  426.         }
  427.         builder.deleteCharAt(builder.length() - seperator.length()); // remove the extra
  428.         // seperator
  429.         return builder.toString();
  430.     }
  431.  
  432.     public boolean hasControlOver(ea player) {
  433.         boolean isInGroup = false;
  434.  
  435.         if (etc.getInstance().getUser(player.aq) != null) {
  436.             for (String str : etc.getInstance().getUser(player.aq).Groups) {
  437.                 if (etc.getInstance().isUserInGroup(e, str)) {
  438.                     isInGroup = true;
  439.                 }
  440.             }
  441.         } else {
  442.             return true;
  443.         }
  444.  
  445.         return isInGroup;
  446.     }
  447.  
  448.     public void msg(String msg) {
  449.         b(new ba(msg));
  450.     }
  451.  
  452.     private void d(String paramString) {
  453.         try {
  454.             if (etc.getInstance().isLogging()) {
  455.                 a.info("Command used by " + e.aq + " " + paramString);
  456.             }
  457.             String[] split = paramString.split(" ");
  458.             if ((Boolean)etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.COMMAND, new Object[]{e, split})) {
  459.                 return; //No need to go on, commands were parsed.
  460.             }
  461.             if (!etc.getInstance().canUseCommand(e.aq, split[0]) && !split[0].startsWith("/#")) {
  462.                 msg(Colors.Rose + "Unknown command.");
  463.                 return;
  464.             }
  465.             if (split[0].equalsIgnoreCase("/help")) {
  466.                 //Meh, not the greatest way, but not the worst either.
  467.                 List<String> availableCommands = new ArrayList<String>();
  468.                 for (Entry<String, String> entry : etc.getInstance().commands.entrySet()) {
  469.                     if (etc.getInstance().canUseCommand(e.aq, entry.getKey())) {
  470.                         if (entry.getKey().equals("/kit") && !etc.getInstance().getDataSource().hasKits()) {
  471.                             continue;
  472.                         }
  473.                         if (entry.getKey().equals("/listwarps") && !etc.getInstance().getDataSource().hasWarps()) {
  474.                             continue;
  475.                         }
  476.  
  477.                         availableCommands.add(entry.getKey() + " " + entry.getValue());
  478.                     }
  479.                 }
  480.  
  481.                 msg(Colors.Blue + "Available commands (Page " + (split.length == 2 ? split[1] : "1") + " of " + (int) Math.ceil((double) availableCommands.size() / (double) 7) + ") [] = required <> = optional:");
  482.                 if (split.length == 2) {
  483.                     try {
  484.                         int amount = Integer.parseInt(split[1]);
  485.  
  486.                         if (amount > 0) {
  487.                             amount = (amount - 1) * 7;
  488.                         } else {
  489.                             amount = 0;
  490.                         }
  491.  
  492.                         for (int i = amount; i < amount + 7; i++) {
  493.                             if (availableCommands.size() > i) {
  494.                                 msg(Colors.Rose + availableCommands.get(i));
  495.                             }
  496.                         }
  497.                     } catch (NumberFormatException ex) {
  498.                         msg(Colors.Rose + "Not a valid page number.");
  499.                     }
  500.                 } else {
  501.                     for (int i = 0; i < 7; i++) {
  502.                         if (availableCommands.size() > i) {
  503.                             msg(Colors.Rose + availableCommands.get(i));
  504.                         }
  505.                     }
  506.                 }
  507.             } else if (split[0].equalsIgnoreCase("/reload")) {
  508.                 etc.getInstance().load();
  509.                 etc.getInstance().loadData();
  510.                 a.info("Reloaded config");
  511.                 msg("Successfuly reloaded config");
  512.                 String reloadinfoz = Colors.GMSG +  etc.getInstance().getUserColor(e.aq) + e.aq + Colors.GMSG + " has reloaded the server configuration files.";
  513.                 this.d.f.a(new ba(reloadinfoz));
  514.             } else if ((split[0].equalsIgnoreCase("/modify") || split[0].equalsIgnoreCase("/mp"))) {
  515.                 if (split.length < 4) {
  516.                     msg(Colors.Rose + "Usage is: /modify [player] [key] [value]");
  517.                     msg(Colors.Rose + "Keys:");
  518.                     msg(Colors.Rose + "prefix: only the letter the color represents");
  519.                     msg(Colors.Rose + "commands: list seperated by comma");
  520.                     msg(Colors.Rose + "groups: list seperated by comma");
  521.                     msg(Colors.Rose + "ignoresrestrictions: true or false");
  522.                     msg(Colors.Rose + "admin: true or false");
  523.                     msg(Colors.Rose + "modworld: true or false");
  524.                     return;
  525.                 }
  526.  
  527.                 ea player = match(split[1]);
  528.  
  529.                 if (player == null) {
  530.                     msg(Colors.Rose + "Player does not exist.");
  531.                     return;
  532.                 }
  533.  
  534.                 String key = split[2];
  535.                 String value = split[3];
  536.                 User user = etc.getInstance().getUser(split[1]);
  537.                 boolean newUser = false;
  538.  
  539.                 if (user == null) {
  540.                     if (!key.equalsIgnoreCase("groups") && !key.equalsIgnoreCase("g")) {
  541.                         msg(Colors.Rose + "When adding a new user, set their group(s) first.");
  542.                         return;
  543.                     }
  544.                     msg(Colors.Rose + "Adding new user.");
  545.                     newUser = true;
  546.                     user = new User();
  547.                     user.Name = split[1];
  548.                     user.Administrator = false;
  549.                     user.CanModifyWorld = true;
  550.                     user.IgnoreRestrictions = false;
  551.                     user.Commands = new String[]{""};
  552.                     user.Prefix = "";
  553.                 }
  554.  
  555.                 if (key.equalsIgnoreCase("prefix") || key.equalsIgnoreCase("p")) {
  556.                     user.Prefix = value;
  557.                 } else if (key.equalsIgnoreCase("commands") || key.equalsIgnoreCase("c")) {
  558.                     user.Commands = value.split(",");
  559.                 } else if (key.equalsIgnoreCase("groups") || key.equalsIgnoreCase("g")) {
  560.                     user.Groups = value.split(",");
  561.                 } else if (key.equalsIgnoreCase("ignoresrestrictions") || key.equalsIgnoreCase("ir")) {
  562.                     user.IgnoreRestrictions = value.equalsIgnoreCase("true") || value.equals("1");
  563.                 } else if (key.equalsIgnoreCase("admin") || key.equalsIgnoreCase("a")) {
  564.                     user.Administrator = value.equalsIgnoreCase("true") || value.equals("1");
  565.                 } else if (key.equalsIgnoreCase("modworld") || key.equalsIgnoreCase("mw")) {
  566.                     user.CanModifyWorld = value.equalsIgnoreCase("true") || value.equals("1");
  567.                 }
  568.  
  569.                 if (newUser) {
  570.                     etc.getInstance().getDataSource().addUser(user);
  571.                 } else {
  572.                     etc.getInstance().getDataSource().modifyUser(user);
  573.                 }
  574.                 msg(Colors.Rose + "Modified user.");
  575.                 String modifications = Colors.GMSG + etc.getInstance().getUserColor(e.aq) + e.aq + Colors.GMSG + " changed " + split[2] + " to " + split[3] + " for " + player.aq;
  576.         this.d.f.a(new ba(modifications));
  577.                 a.info("Modifed user " + split[1] + ". " + key + " => " + value + " by " + e.aq);
  578.             } else if (split[0].equalsIgnoreCase("/whitelist")) {
  579.                 if (split.length < 2) {
  580.                     msg(Colors.Rose + "whitelist [operation (toggle, add or remove)] <player>");
  581.                     return;
  582.                 }
  583.  
  584.                 if (split[1].equalsIgnoreCase("toggle")) {
  585.                     msg(Colors.Rose + (etc.getInstance().toggleWhitelist() ? "Whitelist enabled" : "Whitelist disabled"));
  586.                 } else if(split.length == 3) {
  587.                     if (split[1].equalsIgnoreCase("add")) {
  588.                         etc.getInstance().getDataSource().addToWhitelist(split[2]);
  589.                         msg(Colors.Rose + split[2] + " added to whitelist");
  590.                     } else if (split[1].equalsIgnoreCase("remove")) {
  591.                         etc.getInstance().getDataSource().removeFromWhitelist(split[2]);
  592.                         msg(Colors.Rose + split[2] + " removed from whitelist");
  593.                     } else {
  594.                         msg(Colors.Rose + "Invalid operation.");
  595.                     }
  596.                 } else {
  597.                     msg(Colors.Rose + "Invalid operation.");
  598.                 }
  599.             } else if (split[0].equalsIgnoreCase("/reservelist")) {
  600.                 if (split.length != 3) {
  601.                     msg(Colors.Rose + "reservelist [operation (add or remove)] [player]");
  602.                     return;
  603.                 }
  604.  
  605.                 if (split[1].equalsIgnoreCase("add")) {
  606.                     etc.getInstance().getDataSource().addToReserveList(split[2]);
  607.                     msg(Colors.Rose + split[2] + " added to reservelist");
  608.                 } else if (split[1].equalsIgnoreCase("remove")) {
  609.                     etc.getInstance().getDataSource().removeFromReserveList(split[2]);
  610.                     msg(Colors.Rose + split[2] + " removed from reservelist");
  611.                 } else {
  612.                     msg(Colors.Rose + "Invalid operation.");
  613.                 }
  614.             } else if (split[0].equalsIgnoreCase("/mute")) {
  615.                 if (split.length != 2) {
  616.                     msg(Colors.Rose + "Correct usage is: /mute [player]");
  617.                     return;
  618.                 }
  619.  
  620.                 ea player = match(split[1]);
  621.  
  622.                 if (player != null) {
  623.                     if (etc.getInstance().toggleMute(player)) {
  624.                         msg(Colors.Rose + "player was muted");
  625.                         String muteon = Colors.GMSG2 + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.GMSG2 + " has muted " + player.aq;
  626.             this.d.f.a(new ba(muteon));
  627.                     } else {
  628.                         msg(Colors.Rose + "player was unmuted");
  629.                         String muteoff = Colors.GMSG2 + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.GMSG2 + " has unmuted " + player.aq +  ", behave this time!";
  630.             this.d.f.a(new ba(muteoff));
  631.                     }
  632.                 } else {
  633.                     msg(Colors.Rose + "Can't find player " + split[1]);
  634.                 }
  635.             } else if ((split[0].equalsIgnoreCase("/msg") || split[0].equalsIgnoreCase("/tell")) || split[0].equalsIgnoreCase("/m")) {
  636.                 if (split.length < 3) {
  637.                     msg(Colors.Rose + "Correct usage is: /msg [player] [message]");
  638.                     return;
  639.                 }
  640.                 if (etc.getInstance().isMuted(e)) {
  641.                     msg(Colors.Rose + "You are currently muted.");
  642.                     return;
  643.                 }
  644.  
  645.                 ea player = match(split[1]);
  646.  
  647.                 if (player != null) {
  648.                     if (player.aq.equals(e.aq)) {
  649.                         msg(Colors.Rose + "You can't message yourself!");
  650.                         return;
  651.                     }
  652.                     String prefix = etc.getInstance().getUserColor(e.aq);
  653.  
  654.                     player.a.msg("(MSG) " + prefix + "<" + e.aq + "> " + Colors.White + combineSplit(2, split, " "));
  655.                     msg("(MSG) " + prefix + "<" + e.aq + "> " + Colors.White + combineSplit(2, split, " "));
  656.                 } else {
  657.                     msg(Colors.Rose + "Couldn't find player " + split[1]);
  658.                 }
  659.             } else if (split[0].equalsIgnoreCase("/kit") && etc.getInstance().getDataSource().hasKits()) {
  660.                 if (split.length != 2 && split.length != 3) {
  661.                     msg(Colors.Rose + "Available kits: " + Colors.White + etc.getInstance().getDataSource().getKitNames(e.aq));
  662.                     return;
  663.                 }
  664.  
  665.                 ea toGive = e;
  666.                 if (split.length > 2 && etc.getInstance().canIgnoreRestrictions(e)) {
  667.                     toGive = match(split[1]);
  668.                 }
  669.  
  670.                 Kit kit = etc.getInstance().getDataSource().getKit(split[1]);
  671.                 if (toGive != null) {
  672.                     if (kit != null) {
  673.                         if (!etc.getInstance().isUserInGroup(e, kit.Group) && !kit.Group.equals("")) {
  674.                             msg(Colors.Rose + "That kit does not exist.");
  675.                         } else if (onlyOneUseKits.contains(kit.Name)) {
  676.                             msg(Colors.Rose + "You can only get this kit once per login.");
  677.                         } else if (MinecraftServer.b.containsKey(this.e.aq + " " + kit.Name)) {
  678.                             msg(Colors.Rose + "You can't get this kit again for a while.");
  679.                         } else {
  680.                             if (!etc.getInstance().canIgnoreRestrictions(e)) {
  681.                                 if (kit.Delay >= 0) {
  682.                                     MinecraftServer.b.put(this.e.aq + " " + kit.Name, kit.Delay);
  683.                                 } else {
  684.                                     onlyOneUseKits.add(kit.Name);
  685.                                 }
  686.                             }
  687.  
  688.                             a.info(this.e.aq + " got a kit!");
  689.                             toGive.a.msg(Colors.Rose + "Enjoy this kit!");
  690.                             for (Map.Entry<String, Integer> entry : kit.IDs.entrySet()) {
  691.                                 try {
  692.                                     int itemId = 0;
  693.                                     try {
  694.                                         itemId = Integer.parseInt(entry.getKey());
  695.                                     } catch (NumberFormatException n) {
  696.                                         itemId = etc.getInstance().getDataSource().getItem(entry.getKey());
  697.                                     }
  698.  
  699.                                     int temp = kit.IDs.get(entry.getKey());
  700.                                     do {
  701.                                         if (temp - 64 >= 64) {
  702.                                             toGive.a(new gp(itemId, 64));
  703.                                         } else {
  704.                                             toGive.a(new gp(itemId, temp));
  705.                                         }
  706.                                         temp -= 64;
  707.                                     } while (temp >= 64);
  708.                                 } catch (Exception e1) {
  709.                                     a.info("Got an exception while giving out a kit (Kit name \"" + kit.Name + "\"). Are you sure all the Ids are numbers?");
  710.                                     msg(Colors.Rose + "The server encountered a problem while giving the kit :(");
  711.                                 }
  712.                             }
  713.                         }
  714.                     } else {
  715.                         msg(Colors.Rose + "That kit does not exist.");
  716.                     }
  717.                 } else {
  718.                     msg(Colors.Rose + "That user does not exist.");
  719.                 }
  720.             } else if (split[0].equalsIgnoreCase("/tp")) {
  721.                 if (split.length < 2) {
  722.                     msg(Colors.Rose + "Correct usage is: /tp [player]");
  723.                     return;
  724.                 }
  725.  
  726.                 ea player = match(split[1]);
  727.  
  728.                 if (this.e.aq.equalsIgnoreCase(split[1])) {
  729.                     msg(Colors.Rose + "You're already here!");
  730.                     return;
  731.                 }
  732.  
  733.                 if (player != null) {
  734.                     a.info(this.e.aq + " teleported to " + player.aq);
  735.                     a(player.l, player.m, player.n, player.r, player.s);
  736.                 } else {
  737.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  738.                 }
  739.             } else if ((split[0].equalsIgnoreCase("/tphere") || split[0].equalsIgnoreCase("/s"))) {
  740.                 if (split.length < 2) {
  741.                     msg(Colors.Rose + "Correct usage is: /tphere [player]");
  742.                     return;
  743.                 }
  744.  
  745.                 ea player = match(split[1]);
  746.  
  747.                 if (this.e.aq.equalsIgnoreCase(split[1])) {
  748.                     msg(Colors.Rose + "Wow look at that! You teleported yourself to yourself!");
  749.                     return;
  750.                 }
  751.  
  752.                 if (player != null) {
  753.                     a.info(this.e.aq + " teleported " + player.aq + " to their self.");
  754.                     String tpheremsg = Colors.GMSG + player.aq + " was summoned via teleportation to " + etc.getInstance().getUserColor(e.aq) + e.aq;
  755.                     this.d.f.a(new ba(tpheremsg));
  756.                     player.a.a(e.l, e.m, e.n, e.r, e.s);
  757.                 } else {
  758.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  759.                 }
  760.             } else if (split[0].equalsIgnoreCase("/playerlist") || split[0].equalsIgnoreCase("/who")) {
  761.                 msg(Colors.Rose + "Player list (" + d.f.b.size() + "/" + etc.getInstance().playerLimit + "): " + Colors.White + d.f.c());
  762.             } else if (split[0].equalsIgnoreCase("/item") || split[0].equalsIgnoreCase("/i") || split[0].equalsIgnoreCase("/give")) {
  763.                 if (split.length < 2) {
  764.                     if (etc.getInstance().canIgnoreRestrictions(e)) {
  765.                         msg(Colors.Rose + "Correct usage is: /item [itemid] <amount> <player> (optional)");
  766.                     } else {
  767.                         msg(Colors.Rose + "Correct usage is: /item [itemid] <amount>");
  768.                     }
  769.                     return;
  770.                 }
  771.  
  772.                 ea toGive = e;
  773.                 if (split.length == 4 && etc.getInstance().canIgnoreRestrictions(e)) {
  774.                     toGive = match(split[3]);
  775.                 }
  776.  
  777.                 if (toGive != null) {
  778.                     try {
  779.                         int i2 = 0;
  780.                         try {
  781.                             i2 = Integer.parseInt(split[1]);
  782.                         } catch (NumberFormatException n) {
  783.                             i2 = etc.getInstance().getDataSource().getItem(split[1]);
  784.                         }
  785.                         int i3 = 1;
  786.                         if (split.length > 2) {
  787.                             i3 = Integer.parseInt(split[2]);
  788.                         }
  789.  
  790.                         String i2str = Integer.toString(i2);
  791.                         if (i3 == -1 && etc.getInstance().isAdmin(e)) {
  792.                             i3 = 255;
  793.                         } else if (i3 <= 0) {
  794.                             i3 = 1;
  795.                         }
  796.                         if (i3 > 64 && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  797.                             i3 = 64;
  798.                         }
  799.  
  800.                         boolean allowedItem = false;
  801.                         if (!etc.getInstance().allowedItems[0].equals("") && (!etc.getInstance().canIgnoreRestrictions(this.e))) {
  802.                             for (String str : etc.getInstance().allowedItems) {
  803.                                 if (i2str.equals(str)) {
  804.                                     allowedItem = true;
  805.                                 }
  806.                             }
  807.                         } else {
  808.                             allowedItem = true;
  809.                         }
  810.                         if (!etc.getInstance().disallowedItems[0].equals("") && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  811.                             for (String str : etc.getInstance().disallowedItems) {
  812.                                 if (i2str.equals(str)) {
  813.                                     allowedItem = false;
  814.                                 }
  815.                             }
  816.                         }
  817.                         if (i2 < ez.c.length) {
  818.                             if (ez.c[i2] != null && (allowedItem || etc.getInstance().canIgnoreRestrictions(this.e))) {
  819.                                 a.log(Level.INFO, "Giving " + toGive.aq + " some " + i2);
  820.                                 if (i3 == 255) {
  821.                                     toGive.a(new gp(i2, 255));
  822.                                 } else {
  823.                                     int temp = i3;
  824.                                     if (temp >= 257) {
  825.                                         msg(Colors.Rose +"You can't spawn over 256 of an item, jerk.");
  826.                                         return;
  827.                                     }
  828.                                     do {
  829.                                         if (temp - 64 >= 64) {
  830.                                             toGive.a(new gp(i2, 64));
  831.                                         } else {
  832.                                             toGive.a(new gp(i2, temp));
  833.                                         }
  834.                                         temp -= 64;
  835.                                     } while (temp >= 64);
  836.                                 }
  837.  
  838.                                 if (toGive == this.e) {
  839.                                     msg(Colors.Rose + "There you go c:");
  840.                                 } else {
  841.                                     msg(Colors.Rose + "Gift given! :D");
  842.                                     toGive.a.msg(Colors.Rose + "Enjoy your gift! :D");
  843.                                 }
  844.                             } else if ((!allowedItem) && (ez.c[i2] != null) && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  845.                                 msg(Colors.Rose + "You are not allowed to spawn that item.");
  846.                             } else {
  847.                                 msg(Colors.Rose + "No item with ID " + split[1]);
  848.                             }
  849.                         } else {
  850.                             msg(Colors.Rose + "No item with ID " + split[1]);
  851.                         }
  852.                     } catch (NumberFormatException localNumberFormatException) {
  853.                         msg(Colors.Rose + "Improper ID and/or amount.");
  854.                     }
  855.                 } else {
  856.                     msg(Colors.Rose + "Can't find user " + split[3]);
  857.                 }
  858.             } else if (split[0].equalsIgnoreCase("/tempban")) {
  859.                 // /tempban MINUTES HOURS DAYS
  860.                 if (split.length == 1) {
  861.                     //TODO;
  862.                     return;
  863.                 }
  864.                 int minutes = 0, hours = 0, days = 0;
  865.                 if (split.length >= 2) {
  866.                     minutes = Integer.parseInt(split[1]);
  867.                 }
  868.                 if (split.length >= 3) {
  869.                     hours = Integer.parseInt(split[2]);
  870.                 }
  871.                 if (split.length >= 4) {
  872.                     days = Integer.parseInt(split[3]);
  873.                 }
  874.                 Date date = new Date();
  875.                 //date.
  876.             } else if (split[0].equalsIgnoreCase("/banlist")) {
  877.                 byte type = 0;
  878.                 if (split.length == 2) {
  879.                     if (split[1].equalsIgnoreCase("ips")) {
  880.                         type = 1;
  881.                     }
  882.                 }
  883.                 if (type == 0) { //Regular user bans
  884.                     msg(Colors.Blue + "Ban list:" + Colors.White + " " + d.f.getBans());
  885.                 } else { //IP bans
  886.                     msg(Colors.Blue + "IP Ban list:" + Colors.White + " " + d.f.getBans());
  887.                 }
  888.             } else if (split[0].equalsIgnoreCase("/banip")) {
  889.                 if (split.length < 2) {
  890.                     msg(Colors.Rose + "Correct usage is: /banip [player] <reason> (optional) NOTE: this permabans IPs.");
  891.                     return;
  892.                 }
  893.  
  894.                 ea player = match(split[1]);
  895.  
  896.                 if (player != null) {
  897.                     if (!hasControlOver(player)) {
  898.                         msg(Colors.Rose + "You can't ban that user.");
  899.                         return;
  900.                     }
  901.  
  902.                     // adds player to ban list
  903.                     this.d.f.c(player.a.b.b().toString().split(":")[0].substring(1));
  904.  
  905.                     etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.IPBAN, new Object[]{e, split.length > 2 ? split[1] : ""});
  906.  
  907.                     a.log(Level.INFO, "IP Banning " + player.aq + " (IP: " + player.a.b.b().toString() + ")");
  908.                     msg(Colors.Rose + "IP Banning " + player.aq + " (IP: " + player.a.b.b().toString() + ")");
  909.  
  910.                     if (split.length > 2) {
  911.                         player.a.c("IP Banned by " + e.aq + ": " + combineSplit(2, split, " "));
  912.                         String ipbanmessage = Colors.GMSG2 + player.aq + " was IP Banned by " + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.GMSG2 + ": ( " + combineSplit(2, split, " )");
  913.             this.d.f.a(new ba(ipbanmessage));
  914.                     } else {
  915.                         player.a.c("IP Banned by " + e.aq + ".");
  916.                         String ipbanmessage = Colors.GMSG2 + player.aq + " IP banned by " + etc.getInstance().getUserColor(e.aq) + e.aq;
  917.                         this.d.f.a(new ba(ipbanmessage));
  918.                     }
  919.                 } else {
  920.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  921.                 }
  922.             } else if (split[0].equalsIgnoreCase("/ban")) {
  923.                 if (split.length < 2) {
  924.                     msg(Colors.Rose + "Correct usage is: /ban [player] <reason> (optional)");
  925.                     return;
  926.                 }
  927.  
  928.                 ea player = match(split[1]);
  929.  
  930.                 if (player != null) {
  931.                     if (!hasControlOver(player)) {
  932.                         msg(Colors.Rose + "You can't ban that user.");
  933.                         return;
  934.                     }
  935.  
  936.                     // adds player to ban list
  937.                     this.d.f.a(player.aq);
  938.  
  939.                     etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.BAN, new Object[]{e, split.length > 2 ? split[1] : ""});
  940.  
  941.                     if (split.length > 2) {
  942.                         player.a.c("Banned by " + e.aq + ": " + combineSplit(2, split, " "));
  943.                         String banmessage = Colors.GMSG2 + player.aq + " Banned by " + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.GMSG2 + ": (" + combineSplit(2, split, " )");
  944.                         this.d.f.a(new ba(banmessage));
  945.                     } else {
  946.                         player.a.c("Banned by " + e.aq + ".");
  947.                         String banmessage = Colors.GMSG2 + player.aq + " Banned by " + etc.getInstance().getUserColor(e.aq) + this.e.aq;
  948.                         this.d.f.a(new ba(banmessage));
  949.                     }
  950.                     a.log(Level.INFO, "Banning " + player.aq);
  951.                     msg(Colors.Rose + "Banning " + player.aq);
  952.                 } else {
  953.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  954.                 }
  955.             } else if (split[0].equalsIgnoreCase("/unban")) {
  956.                 if (split.length != 2) {
  957.                     msg(Colors.Rose + "Correct usage is: /unban [player]");
  958.                     return;
  959.                 }
  960.                 this.d.f.b(split[1]);
  961.                 msg(Colors.Rose + "Unbanned " + split[1]);
  962.             } else if (split[0].equalsIgnoreCase("/unbanip")) {
  963.                 if (split.length != 2) {
  964.                     msg(Colors.Rose + "Correct usage is: /unbanip [ip]");
  965.                     return;
  966.                 }
  967.                 this.d.f.d(split[1]);
  968.                 msg(Colors.Rose + "Unbanned " + split[1]);
  969.             } else if (split[0].equalsIgnoreCase("/kick")) {
  970.                 if (split.length < 2) {
  971.                     msg(Colors.Rose + "Correct usage is: /kick [player] <reason> (optional)");
  972.                     return;
  973.                 }
  974.  
  975.                 ea player = match(split[1]);
  976.  
  977.                 if (player != null) {
  978.                     if (!hasControlOver(player)) {
  979.                         msg(Colors.Rose + "You can't kick that user.");
  980.                         return;
  981.                     }
  982.  
  983.                     etc.getInstance().getLoader().callHook(PluginLoader.HOOKS.KICK, new Object[]{e, split.length > 2 ? split[1] : ""});
  984.  
  985.                     if (split.length > 2) {
  986.                         player.a.c("Kicked by " + e.aq + ": " + combineSplit(2, split, " "));
  987.                         String globalmessage = Colors.GMSG2 + player.aq + " was kicked by " + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.GMSG2 + ": ( " + combineSplit(2, split, " )");
  988.                         this.d.f.a(new ba(globalmessage));
  989.                     } else {
  990.                         player.a.c("Kicked by " + e.aq + ".");
  991.                         String globalmessage = Colors.GMSG2 + player.aq + " was kicked by " + etc.getInstance().getUserColor(e.aq) + this.e.aq;
  992.                         this.d.f.a(new ba(globalmessage));
  993.                     }
  994.                     a.log(Level.INFO, "Kicking " + player.aq);
  995.                     msg(Colors.Rose + "Kicking " + player.aq);
  996.                 } else {
  997.                     msg(Colors.Rose + "Can't find user " + split[1] + ".");
  998.                 }
  999.             } else if (split[0].equalsIgnoreCase("/me")) {
  1000.                 if (etc.getInstance().isMuted(e)) {
  1001.                     msg(Colors.Rose + "You are currently muted.");
  1002.                     return;
  1003.                 }
  1004.                 if (split.length == 1)
  1005.                     return;
  1006.                 String prefix = etc.getInstance().getUserColor(e.aq);
  1007.                 String paramString2 = "* " + prefix + this.e.aq + Colors.White + " " + paramString.substring(paramString.indexOf(" ")).trim();
  1008.                 a.info("* " + this.e.aq + " " + paramString.substring(paramString.indexOf(" ")).trim());
  1009.                 this.d.f.a(new ba(paramString2));
  1010.             } else if (split[0].equalsIgnoreCase("/sethome")) {
  1011.                 // player.k, player.l, player.m
  1012.                 // x, y, z
  1013.                 Location loc = new Location();
  1014.                 loc.x = e.l;
  1015.                 loc.y = e.m;
  1016.                 loc.z = e.n;
  1017.                 loc.rotX = e.r;
  1018.                 loc.rotY = e.s;
  1019.                 Warp home = new Warp();
  1020.                 home.Location = loc;
  1021.                 home.Group = ""; //no group neccessary, lol.
  1022.                 home.Name = e.aq;
  1023.                 etc.getInstance().changeHome(home);
  1024.                 msg(Colors.Rose + "Your home has been set.");
  1025.             } else if (split[0].equalsIgnoreCase("/spawn")) {
  1026.                 String spawnmsg = Colors.GMSG + etc.getInstance().getUserColor(e.aq) + e.aq + Colors.GMSG + " returned to spawn.";
  1027.         this.d.f.a(new ba(spawnmsg));
  1028.                 int m = this.d.e.d(this.d.e.n, this.d.e.p);
  1029.                 a(this.d.e.n + 0.5D, m + 1.5D, this.d.e.p + 0.5D, 0.0F, 0.0F);
  1030.             } else if (split[0].equalsIgnoreCase("/setspawn")) {
  1031.                 this.d.e.n = (int) Math.ceil(e.l);
  1032.                 String spawnchangemessage = Colors.GMSG +  etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.GMSG + " has changed spawn to his current position.";
  1033.         this.d.f.a(new ba(spawnchangemessage));
  1034.                 //Too lazy to actually update this considering it's not even used anyways.
  1035.                 //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.
  1036.                 this.d.e.p = (int) Math.ceil(e.n);
  1037.                 a.info("Spawn position changed.");
  1038.                 msg(Colors.Rose + "You have set the spawn to your current position.");
  1039.             } else if (split[0].equalsIgnoreCase("/home")) {
  1040.                 Warp home = null;
  1041.                 if (split.length > 1 && etc.getInstance().isAdmin(e)) {
  1042.                     home = etc.getInstance().getDataSource().getHome(split[1]);
  1043.                 } else {
  1044.                     home = etc.getInstance().getDataSource().getHome(e.aq);
  1045.                 }
  1046.  
  1047.                 if (home != null) {
  1048.                     a(home.Location.x, home.Location.y, home.Location.z, home.Location.rotX, home.Location.rotY);
  1049.                 } else if (split.length > 1 && etc.getInstance().isAdmin(e)) {
  1050.                     msg(Colors.Rose + "That player home does not exist");
  1051.                 } else {
  1052.                     int m = this.d.e.d(this.d.e.n, this.d.e.p);
  1053.                     a(this.d.e.n + 0.5D, m + 1.5D, this.d.e.p + 0.5D, 0.0F, 0.0F);
  1054.                 }
  1055.             } else if (split[0].equalsIgnoreCase("/warp")) {
  1056.                 if (split.length < 2) {
  1057.                     msg(Colors.Rose + "Correct usage is: /warp [warpname]");
  1058.                     return;
  1059.                 }
  1060.                 ea toWarp = e;
  1061.                 Warp warp = null;
  1062.                 if (split.length == 3 && etc.getInstance().canIgnoreRestrictions(e)) {
  1063.                     warp = etc.getInstance().getDataSource().getWarp(split[1]);
  1064.                     toWarp = match(split[2]);
  1065.                 } else {
  1066.                     warp = etc.getInstance().getDataSource().getWarp(split[1]);
  1067.                 }
  1068.                 if (toWarp != null) {
  1069.                     if (warp != null) {
  1070.                         if (!etc.getInstance().isUserInGroup(e, warp.Group) && !warp.Group.equals("")) {
  1071.                             msg(Colors.Rose + "Warp not found.");
  1072.                         } else {
  1073.                             toWarp.a.a(warp.Location.x, warp.Location.y, warp.Location.z, warp.Location.rotX, warp.Location.rotY);
  1074.                             toWarp.a.msg(Colors.Rose + "Woosh!");
  1075.                         }
  1076.                     } else {
  1077.                         msg(Colors.Rose + "Warp not found");
  1078.                     }
  1079.                 } else {
  1080.                     msg(Colors.Rose + "Player not found.");
  1081.                 }
  1082.             } else if (split[0].equalsIgnoreCase("/listwarps") && etc.getInstance().getDataSource().hasWarps()) {
  1083.                 if (split.length != 2 && split.length != 3) {
  1084.                     msg(Colors.Rose + "Available warps: " + Colors.White + etc.getInstance().getDataSource().getWarpNames(e.aq));
  1085.                     return;
  1086.                 }
  1087.             } else if (split[0].equalsIgnoreCase("/setwarp")) {
  1088.                 if (split.length < 2) {
  1089.                     if (etc.getInstance().canIgnoreRestrictions(e)) {
  1090.                         msg(Colors.Rose + "Correct usage is: /setwarp [warpname] [group]");
  1091.                     } else {
  1092.                         msg(Colors.Rose + "Correct usage is: /setwarp [warpname]");
  1093.                     }
  1094.                     return;
  1095.                 }
  1096.                 Location loc = new Location();
  1097.                 loc.x = e.l;
  1098.                 loc.y = e.m;
  1099.                 loc.z = e.n;
  1100.                 loc.rotX = e.r;
  1101.                 loc.rotY = e.s;
  1102.                 Warp warp = new Warp();
  1103.                 warp.Name = split[1];
  1104.                 warp.Location = loc;
  1105.                 if (split.length == 3) {
  1106.                     warp.Group = split[2];
  1107.                 } else {
  1108.                     warp.Group = "";
  1109.                 }
  1110.                 etc.getInstance().setWarp(warp);
  1111.                 msg(Colors.Rose + "Created warp point " + split[1] + ".");
  1112.             } else if (split[0].equalsIgnoreCase("/removewarp")) {
  1113.                 if (split.length < 2) {
  1114.                     msg(Colors.Rose + "Correct usage is: /removewarp [warpname]");
  1115.                     return;
  1116.                 }
  1117.                 Warp warp = etc.getInstance().getDataSource().getWarp(split[1]);
  1118.                 if (warp != null) {
  1119.                     etc.getInstance().getDataSource().removeWarp(warp);
  1120.                     msg(Colors.Blue + "Warp removed.");
  1121.                 } else {
  1122.                     msg(Colors.Rose + "That warp does not exist");
  1123.                 }
  1124.             } else if (split[0].equalsIgnoreCase("/lighter")) {
  1125.                 if (MinecraftServer.b.containsKey(this.e.aq + " lighter")) {
  1126.                     a.info(this.e.aq + " failed to iron!");
  1127.                     msg(Colors.Rose + "You can't create another lighter again so soon");
  1128.                 } else {
  1129.                     if (!etc.getInstance().canIgnoreRestrictions(e)) {
  1130.                         MinecraftServer.b.put(this.e.aq + " lighter", Integer.valueOf(6000));
  1131.                     }
  1132.                     a.info(this.e.aq + " created a lighter!");
  1133.                     this.e.a(new gp(259, 1));
  1134.                 }
  1135.             } else if ((paramString.startsWith("/#")) && (this.d.f.g(this.e.aq))) {
  1136.                 String str = paramString.substring(2);
  1137.                 a.info(this.e.aq + " issued server command: " + str);
  1138.                 this.d.a(str, this);
  1139.             } else if (split[0].equalsIgnoreCase("/time")) {
  1140.                 if (split.length != 2) {
  1141.                     msg(Colors.Rose + "Correct usage is: /time [time|day|night]");
  1142.                     return;
  1143.                 }
  1144.  
  1145.                 if (split[1].equalsIgnoreCase("day")) {
  1146.                     String timeday = Colors.GMSG + "Daylight breaks thanks to " + etc.getInstance().getUserColor(e.aq) + e.aq;
  1147.                     this.d.f.a(new ba(timeday));
  1148.                     this.d.e.c = 0;
  1149.                 } else if (split[1].equalsIgnoreCase("night")) {
  1150.                     String timenight = Colors.GMSG + "What a terrible night to have a curse (" + etc.getInstance().getUserColor(e.aq) + e.aq + Colors.GMSG + ")";
  1151.                     this.d.f.a(new ba(timenight));
  1152.                     this.d.e.c = 13000;
  1153.                 } else {
  1154.                     try {
  1155.                         this.d.e.c = Long.parseLong(split[1]);
  1156.                     } catch (NumberFormatException e) {
  1157.                         msg(Colors.Rose + "Please enter numbers, not letters.");
  1158.                     }
  1159.                 }
  1160.             } else if (split[0].equalsIgnoreCase("/getpos")) {
  1161.                 msg("Pos X: " + e.l + " Y: " + e.m + " Z " + e.n);
  1162.                 msg("Rotation X: " + e.r + " Y: " + e.s);
  1163.  
  1164.                 double degreeRotation = ((e.r - 90) % 360);
  1165.                 if (degreeRotation < 0) {
  1166.                     degreeRotation += 360.0;
  1167.                 }
  1168.                 msg("Compass: " + etc.getCompassPointForDirection(degreeRotation) + " (" + (Math.round(degreeRotation * 10) / 10.0) + ")");
  1169.             } else if (split[0].equalsIgnoreCase("/compass")) {
  1170.                 double degreeRotation = ((e.r - 90) % 360);
  1171.                 if (degreeRotation < 0) {
  1172.                     degreeRotation += 360.0;
  1173.                 }
  1174.  
  1175.                 msg(Colors.Rose + "Compass: " + etc.getCompassPointForDirection(degreeRotation));
  1176.             } else if (split[0].equalsIgnoreCase("/motd")) {
  1177.                 for (String str : etc.getInstance().motd) {
  1178.                     msg(str);
  1179.                 }
  1180.             }
  1181.                 else if (split[0].equalsIgnoreCase("/fabulous"))
  1182.                 {
  1183.                     if (split.length == 1)
  1184.                     return;
  1185.                     String temp = "";
  1186.                     String str = "";
  1187.  
  1188.                     str = paramString.substring(paramString.indexOf(" ")).trim();
  1189.                     String temp2 = "<" + this.e.aq  + "> "+str;
  1190.                     String[] rainbow = new String[] {Colors.Red, Colors.Rose, Colors.Yellow, Colors.Green, Colors.Blue, Colors.LightPurple, Colors.Purple};
  1191.                     int counter=0;
  1192.                     if(lengthCheck(temp2))
  1193.                     {
  1194.                     for(int x=0; x<str.length(); x++)
  1195.                     {
  1196.                             temp+=rainbow[counter]+str.charAt(x);
  1197.                             counter++;
  1198.                             if(str.charAt(x)==' ') { counter--;}
  1199.                             if(counter==-1){counter = 6; }
  1200.                             if(counter==7){counter = 0; }
  1201.                     }
  1202.                     str = temp+" ";
  1203.                     String message = "<" + etc.getInstance().getUserColor(e.aq) + this.e.aq + Colors.White + "> " + str;
  1204.  
  1205.                             a.log(Level.INFO, "<" + e.aq + "> Fabulously said: " + str);
  1206.                             this.d.f.a(new ba(message));
  1207.                     } else {
  1208.                             msg(Colors.Rose+"Message is too long");
  1209.                     }
  1210.                 }
  1211.              else {
  1212.                 a.info(this.e.aq + " tried command " + paramString);
  1213.                 msg(Colors.Rose + "Unknown command");
  1214.             }
  1215.         } catch (Exception ex) {
  1216.             a.log(Level.SEVERE, "Exception in command handler (Report this to hey0 unless you did something dumb like enter letters as numbers):", ex);
  1217.             if (etc.getInstance().isAdmin(e)) {
  1218.                 msg(Colors.Rose + "Exception occured. Check the server for more info.");
  1219.             }
  1220.         }
  1221.     }
  1222.  
  1223.     private boolean lengthCheck(String str)
  1224.     {
  1225.  
  1226.         int length = 0;
  1227.         for(int x = 0; x<str.length(); x++)
  1228.         {
  1229.             if("i;,.:|!".indexOf(str.charAt(x)) != -1)
  1230.             {
  1231.                 length+=2;
  1232.             }
  1233.             else if("l'".indexOf(str.charAt(x)) != -1)
  1234.             {
  1235.                 length+=3;
  1236.             }
  1237.             else if("tI[]".indexOf(str.charAt(x)) != -1)
  1238.             {
  1239.                 length+=4;
  1240.             }
  1241.             else if("kf{}<>\"*()".indexOf(str.charAt(x)) != -1)
  1242.             {
  1243.                 length+=5;
  1244.             }
  1245.             else if("hequcbrownxjmpsvazydgTHEQUCKBROWNFXJMPSVLAZYDG1234567890#\\/?$%-=_+&".indexOf(str.charAt(x)) != -1)
  1246.             {
  1247.                 length+=6;
  1248.             }
  1249.             else if("@~".indexOf(str.charAt(x)) != -1)
  1250.             {
  1251.                 length+=7;
  1252.             }
  1253.             else if(str.charAt(x)==' ')
  1254.             {
  1255.                 length+=4;
  1256.             }
  1257.         }
  1258.  
  1259.         if(length<=316)
  1260.         {
  1261.             return true;
  1262.         } else { return false; }
  1263.  
  1264.     }
  1265.  
  1266.     public void a(o paramo) {
  1267.         if (paramo.b == 1) {
  1268.             this.e.z();
  1269.         }
  1270.     }
  1271.  
  1272.     public void a(io paramio) {
  1273.         this.b.a("Quitting");
  1274.     }
  1275.  
  1276.     public int b() {
  1277.         return this.b.d();
  1278.     }
  1279.  
  1280.     public void b(String paramString) {
  1281.         b(new ba("ยง7" + paramString));
  1282.     }
  1283.  
  1284.     public String c() {
  1285.         return this.e.aq;
  1286.     }
  1287.  
  1288.     public void a(r paramr) {
  1289.         if (paramr.a == -1) {
  1290.             this.e.aj.a = paramr.b;
  1291.         }
  1292.         if (paramr.a == -2) {
  1293.             this.e.aj.c = paramr.b;
  1294.         }
  1295.         if (paramr.a == -3) {
  1296.             this.e.aj.b = paramr.b;
  1297.         }
  1298.     }
  1299.  
  1300.     public void d() {
  1301.         this.b.a(new r(-1, this.e.aj.a));
  1302.         this.b.a(new r(-2, this.e.aj.c));
  1303.         this.b.a(new r(-3, this.e.aj.b));
  1304.     }
  1305.  
  1306.     public void a(ib paramib) {
  1307.         as localas = this.d.e.k(paramib.a, paramib.b, paramib.c);
  1308.         if (localas != null) {
  1309.             localas.a(paramib.e);
  1310.             localas.c();
  1311.         }
  1312.     }
  1313. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement