Guest User

Untitled

a guest
Jun 15th, 2017
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. public void a(hd paramhd) {
  134. this.e.aj.a[this.e.aj.d] = this.k;
  135. boolean bool = this.d.e.z = (this.d.f.g(this.e.aq) || etc.getInstance().isAdmin(e));
  136. int m = 0;
  137. if (paramhd.e == 0) {
  138. m = 1;
  139. }
  140. if (paramhd.e == 1) {
  141. m = 1;
  142. }
  143.  
  144. if (m != 0) {
  145. double d1 = this.e.m;
  146. this.e.m = this.e.ai;
  147. fr localfr = this.e.a(4.0D, 1.0F);
  148. this.e.m = d1;
  149. if (localfr == null) {
  150. return;
  151. }
  152. if ((localfr.b != paramhd.a) || (localfr.c != paramhd.b) || (localfr.d != paramhd.c) || (localfr.e != paramhd.d)) {
  153. return;
  154. }
  155. }
  156. int n = paramhd.a;
  157. int i1 = paramhd.b;
  158. int i2 = paramhd.c;
  159. int i3 = paramhd.d;
  160. int i4 = (int) gj.e(n - this.d.e.n);
  161. int i5 = (int) gj.e(i2 - this.d.e.p);
  162. if (i4 > i5) {
  163. i5 = i4;
  164. }
  165. if (paramhd.e == 0) {
  166. if (!etc.getInstance().canBuild(e)) {
  167. return;
  168. }
  169. if (i5 > etc.getInstance().spawnProtectionSize || bool) {
  170. this.e.ad.a(n, i1, i2);
  171. }
  172. } else if (paramhd.e == 2) {
  173. this.e.ad.a();
  174. } else if (paramhd.e == 1) {
  175. if (!etc.getInstance().canBuild(e)) {
  176. return;
  177. }
  178. if (i5 > etc.getInstance().spawnProtectionSize || bool) {
  179. this.e.ad.a(n, i1, i2, i3);
  180. }
  181. } else if (paramhd.e == 3) {
  182. double d2 = this.e.l - (n + 0.5D);
  183. double d3 = this.e.m - (i1 + 0.5D);
  184. double d4 = this.e.n - (i2 + 0.5D);
  185. double d5 = d2 * d2 + d3 * d3 + d4 * d4;
  186. if (d5 < 256.0D) {
  187. this.e.a.b(new et(n, i1, i2, this.d.e));
  188. }
  189. }
  190. this.d.e.z = false;
  191. }
  192.  
  193. public void a(fe paramfe) {
  194. if (!etc.getInstance().canBuild(e)) {
  195. return;
  196. }
  197. boolean bool = this.d.e.z = (this.d.f.g(this.e.aq) || etc.getInstance().isAdmin(e));
  198. int m = paramfe.b;
  199. int n = paramfe.c;
  200. int i1 = paramfe.d;
  201. int i2 = paramfe.e;
  202. int i3 = (int) gj.e(m - this.d.e.n);
  203. int i4 = (int) gj.e(i1 - this.d.e.p);
  204. if (i3 > i4) {
  205. i4 = i3;
  206. }
  207. if (i4 > etc.getInstance().spawnProtectionSize || bool) {
  208. gp localgp = paramfe.a >= 0 ? new gp(paramfe.a) : null;
  209.  
  210. if (localgp != null) {
  211. if (!etc.getInstance().isOnItemBlacklist(localgp.c) || bool) {
  212. this.e.ad.a(this.e, this.d.e, localgp, m, n, i1, i2);
  213. }
  214. } else {
  215. // is this right?
  216. this.e.ad.a(this.e, this.d.e, localgp, m, n, i1, i2);
  217. }
  218. }
  219. this.e.a.b(new et(m, n, i1, this.d.e));
  220. this.d.e.z = false;
  221. }
  222.  
  223. public void a(String paramString) {
  224. a.info(this.e.aq + " lost connection: " + paramString);
  225. this.d.f.c(this.e);
  226. this.c = true;
  227. }
  228.  
  229. public void a(hp paramhp) {
  230. a.warning(getClass() + " wasn't prepared to deal with a " + paramhp.getClass());
  231. c("Protocol error, unexpected packet");
  232. }
  233.  
  234. public void b(hp paramhp) {
  235. this.b.a(paramhp);
  236. }
  237.  
  238. public void a(fv paramfv) {
  239. int m = paramfv.b;
  240. this.e.aj.d = (this.e.aj.a.length - 1);
  241. if (m == 0) {
  242. this.k = null;
  243. } else {
  244. this.k = new gp(m);
  245. }
  246. this.e.aj.a[this.e.aj.d] = this.k;
  247. this.d.k.a(this.e, new fv(this.e.c, m));
  248. }
  249.  
  250. public void a(k paramk) {
  251. double d1 = paramk.b / 32.0D;
  252. double d2 = paramk.c / 32.0D;
  253. double d3 = paramk.d / 32.0D;
  254. fn localfn = new fn(this.d.e, d1, d2, d3, new gp(paramk.h, paramk.i));
  255. localfn.o = (paramk.e / 128.0D);
  256. localfn.p = (paramk.f / 128.0D);
  257. localfn.q = (paramk.g / 128.0D);
  258. localfn.ad = 10;
  259. this.d.e.a(localfn);
  260. }
  261.  
  262. public void a(ba paramba) {
  263. String str = paramba.a;
  264. if (str.length() > 100) {
  265. b("Chat message too long");
  266. return;
  267. }
  268. str = str.trim();
  269. for (int k = 0; k < str.length(); ++k) {
  270. if (" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~¦ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»".indexOf(str.charAt(k)) < 0) {
  271. b("Illegal characters in chat");
  272. return;
  273. }
  274. }
  275. if (str.startsWith(">")) {
  276. str = Colors.LightGreen + str;
  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. String reloadinfoz = Colors.Gold + e.aq + " has reloaded the server configuration files.";
  402. this.d.f.a(new ba(reloadinfoz));
  403. } else if ((split[0].equalsIgnoreCase("/modify") || split[0].equalsIgnoreCase("/mp"))) {
  404. if (split.length < 4) {
  405. msg(Colors.Rose + "Usage is: /modify [player] [key] [value]");
  406. msg(Colors.Rose + "Keys:");
  407. msg(Colors.Rose + "prefix: only the letter the color represents");
  408. msg(Colors.Rose + "commands: list seperated by comma");
  409. msg(Colors.Rose + "groups: list seperated by comma");
  410. msg(Colors.Rose + "ignoresrestrictions: true or false");
  411. msg(Colors.Rose + "admin: true or false");
  412. msg(Colors.Rose + "modworld: true or false");
  413. return;
  414. }
  415.  
  416. ea player = match(split[1]);
  417.  
  418. if (player == null) {
  419. msg(Colors.Rose + "Player does not exist.");
  420. return;
  421. }
  422.  
  423. String key = split[2];
  424. String value = split[3];
  425. User user = etc.getInstance().getUser(split[1]);
  426. boolean newUser = false;
  427.  
  428. if (user == null) {
  429. if (!key.equalsIgnoreCase("groups") && !key.equalsIgnoreCase("g")) {
  430. msg(Colors.Rose + "When adding a new user, set their group(s) first.");
  431. return;
  432. }
  433. msg(Colors.Rose + "Adding new user.");
  434. newUser = true;
  435. user = new User();
  436. user.Name = split[1];
  437. user.Administrator = false;
  438. user.CanModifyWorld = true;
  439. user.IgnoreRestrictions = false;
  440. user.Commands = new String[]{""};
  441. user.Prefix = "";
  442. }
  443.  
  444. if (key.equalsIgnoreCase("prefix") || key.equalsIgnoreCase("p")) {
  445. user.Prefix = value;
  446. } else if (key.equalsIgnoreCase("commands") || key.equalsIgnoreCase("c")) {
  447. user.Commands = value.split(",");
  448. } else if (key.equalsIgnoreCase("groups") || key.equalsIgnoreCase("g")) {
  449. user.Groups = value.split(",");
  450. } else if (key.equalsIgnoreCase("ignoresrestrictions") || key.equalsIgnoreCase("ir")) {
  451. user.IgnoreRestrictions = value.equalsIgnoreCase("true") || value.equals("1");
  452. } else if (key.equalsIgnoreCase("admin") || key.equalsIgnoreCase("a")) {
  453. user.Administrator = value.equalsIgnoreCase("true") || value.equals("1");
  454. } else if (key.equalsIgnoreCase("modworld") || key.equalsIgnoreCase("mw")) {
  455. user.CanModifyWorld = value.equalsIgnoreCase("true") || value.equals("1");
  456. }
  457.  
  458. if (newUser) {
  459. etc.getInstance().getDataSource().addUser(user);
  460. } else {
  461. etc.getInstance().getDataSource().modifyUser(user);
  462. }
  463. msg(Colors.Rose + "Modified user.");
  464. String modifications = Colors.Gold + e.aq + " changed " + split[2] + " to " + split[3] + " for " + player.aq;
  465. this.d.f.a(new ba(modifications));
  466. a.info("Modifed user " + split[1] + ". " + key + " => " + value + " by " + e.aq);
  467. } else if (split[0].equalsIgnoreCase("/whitelist")) {
  468. if (split.length != 3) {
  469. msg(Colors.Rose + "whitelist [operation (add or remove)] [player]");
  470. return;
  471. }
  472.  
  473. if (split[1].equalsIgnoreCase("add")) {
  474. etc.getInstance().getDataSource().addToWhitelist(split[2]);
  475. msg(Colors.Rose + split[2] + " added to whitelist");
  476. } else if (split[1].equalsIgnoreCase("remove")) {
  477. etc.getInstance().getDataSource().removeFromWhitelist(split[2]);
  478. msg(Colors.Rose + split[2] + " removed from whitelist");
  479. } else {
  480. msg(Colors.Rose + "Invalid operation.");
  481. }
  482. } else if (split[0].equalsIgnoreCase("/reservelist")) {
  483. if (split.length != 3) {
  484. msg(Colors.Rose + "reservelist [operation (add or remove)] [player]");
  485. return;
  486. }
  487.  
  488. if (split[1].equalsIgnoreCase("add")) {
  489. etc.getInstance().getDataSource().addToReserveList(split[2]);
  490. msg(Colors.Rose + split[2] + " added to reservelist");
  491. } else if (split[1].equalsIgnoreCase("remove")) {
  492. etc.getInstance().getDataSource().removeFromReserveList(split[2]);
  493. msg(Colors.Rose + split[2] + " removed from reservelist");
  494. } else {
  495. msg(Colors.Rose + "Invalid operation.");
  496. }
  497. } else if (split[0].equalsIgnoreCase("/mute")) {
  498. if (split.length != 2) {
  499. msg(Colors.Rose + "Correct usage is: /mute [player]");
  500. return;
  501. }
  502.  
  503. ea player = match(split[1]);
  504.  
  505. if (player != null) {
  506. if (etc.getInstance().toggleMute(player)) {
  507. msg(Colors.Rose + "player was muted");
  508. } else {
  509. msg(Colors.Rose + "player was unmuted");
  510. }
  511. } else {
  512. msg(Colors.Rose + "Can't find player " + split[1]);
  513. }
  514. } else if ((split[0].equalsIgnoreCase("/msg") || split[0].equalsIgnoreCase("/tell")) || split[0].equalsIgnoreCase("/m")) {
  515. if (split.length < 3) {
  516. msg(Colors.Rose + "Correct usage is: /msg [player] [message]");
  517. return;
  518. }
  519. if (etc.getInstance().isMuted(e)) {
  520. msg(Colors.Rose + "You are currently muted.");
  521. return;
  522. }
  523.  
  524. ea player = match(split[1]);
  525.  
  526. if (player != null) {
  527. if (player.aq.equals(e.aq)) {
  528. msg(Colors.Rose + "You can't message yourself!");
  529. return;
  530. }
  531. String prefix = etc.getInstance().getUserColor(e.aq);
  532.  
  533. player.a.msg("(MSG) " + prefix + "<" + e.aq + "> " + Colors.White + combineSplit(2, split, " "));
  534. msg("(MSG) " + prefix + "<" + e.aq + "> " + Colors.White + combineSplit(2, split, " "));
  535. } else {
  536. msg(Colors.Rose + "Couldn't find player " + split[1]);
  537. }
  538. } else if (split[0].equalsIgnoreCase("/kit") && etc.getInstance().getDataSource().hasKits()) {
  539. if (split.length != 2 && split.length != 3) {
  540. msg(Colors.Rose + "Available kits: " + Colors.White + etc.getInstance().getDataSource().getKitNames(e.aq));
  541. return;
  542. }
  543.  
  544. ea toGive = e;
  545. if (split.length > 2 && etc.getInstance().canIgnoreRestrictions(e)) {
  546. toGive = match(split[1]);
  547. }
  548.  
  549. Kit kit = etc.getInstance().getDataSource().getKit(split[1]);
  550. if (toGive != null) {
  551. if (kit != null) {
  552. if (!etc.getInstance().isUserInGroup(e, kit.Group) && !kit.Group.equals("")) {
  553. msg(Colors.Rose + "That kit does not exist.");
  554. } else if (onlyOneUseKits.contains(kit.Name)) {
  555. msg(Colors.Rose + "You can only get this kit once per login.");
  556. } else if (MinecraftServer.b.containsKey(this.e.aq + " " + kit.Name)) {
  557. msg(Colors.Rose + "You can't get this kit again for a while.");
  558. } else {
  559. if (!etc.getInstance().canIgnoreRestrictions(e)) {
  560. if (kit.Delay >= 0) {
  561. MinecraftServer.b.put(this.e.aq + " " + kit.Name, kit.Delay);
  562. } else {
  563. onlyOneUseKits.add(kit.Name);
  564. }
  565. }
  566.  
  567. a.info(this.e.aq + " got a kit!");
  568. toGive.a.msg(Colors.Rose + "Enjoy this kit!");
  569. for (Map.Entry<String, Integer> entry : kit.IDs.entrySet()) {
  570. try {
  571. int itemId = 0;
  572. try {
  573. itemId = Integer.parseInt(entry.getKey());
  574. } catch (NumberFormatException n) {
  575. itemId = etc.getInstance().getDataSource().getItem(entry.getKey());
  576. }
  577.  
  578. int temp = kit.IDs.get(entry.getKey());
  579. do {
  580. if (temp - 64 >= 64) {
  581. toGive.a(new gp(itemId, 64));
  582. } else {
  583. toGive.a(new gp(itemId, temp));
  584. }
  585. temp -= 64;
  586. } while (temp >= 64);
  587. } catch (Exception e1) {
  588. a.info("Got an exception while giving out a kit (Kit name \"" + kit.Name + "\"). Are you sure all the Ids are numbers?");
  589. msg(Colors.Rose + "The server encountered a problem while giving the kit :(");
  590. }
  591. }
  592. }
  593. } else {
  594. msg(Colors.Rose + "That kit does not exist.");
  595. }
  596. } else {
  597. msg(Colors.Rose + "That user does not exist.");
  598. }
  599. } else if (split[0].equalsIgnoreCase("/tp")) {
  600. if (split.length < 2) {
  601. msg(Colors.Rose + "Correct usage is: /tp [player]");
  602. return;
  603. }
  604.  
  605. ea player = match(split[1]);
  606.  
  607. if (this.e.aq.equalsIgnoreCase(split[1])) {
  608. msg(Colors.Rose + "You're already here!");
  609. return;
  610. }
  611.  
  612. if (player != null) {
  613. a.info(this.e.aq + " teleported to " + player.aq);
  614. a(player.l, player.m, player.n, player.r, player.s);
  615. } else {
  616. msg(Colors.Rose + "Can't find user " + split[1] + ".");
  617. }
  618. } else if ((split[0].equalsIgnoreCase("/tphere") || split[0].equalsIgnoreCase("/s"))) {
  619. if (split.length < 2) {
  620. msg(Colors.Rose + "Correct usage is: /tphere [player]");
  621. return;
  622. }
  623.  
  624. ea player = match(split[1]);
  625.  
  626. if (this.e.aq.equalsIgnoreCase(split[1])) {
  627. msg(Colors.Rose + "Wow look at that! You teleported yourself to yourself!");
  628. return;
  629. }
  630.  
  631. if (player != null) {
  632. a.info(this.e.aq + " teleported " + player.aq + " to their self.");
  633. String tpheremsg = Colors.Gold + player.aq + " was summoned via teleportation to " + e.aq;
  634. this.d.f.a(new ba(tpheremsg));
  635. player.a.a(e.l, e.m, e.n, e.r, e.s);
  636. } else {
  637. msg(Colors.Rose + "Can't find user " + split[1] + ".");
  638. }
  639. } else if (split[0].equalsIgnoreCase("/playerlist") || split[0].equalsIgnoreCase("/who")) {
  640. msg(Colors.Rose + "Player list (" + d.f.b.size() + "/" + etc.getInstance().playerLimit + "): " + Colors.White + d.f.c());
  641. } else if (split[0].equalsIgnoreCase("/item") || split[0].equalsIgnoreCase("/i") || split[0].equalsIgnoreCase("/give")) {
  642. if (split.length < 2) {
  643. if (etc.getInstance().canIgnoreRestrictions(e)) {
  644. msg(Colors.Rose + "Correct usage is: /item [itemid] <amount> <player> (optional)");
  645. } else {
  646. msg(Colors.Rose + "Correct usage is: /item [itemid] <amount>");
  647. }
  648. return;
  649. }
  650.  
  651. ea toGive = e;
  652. if (split.length == 4 && etc.getInstance().canIgnoreRestrictions(e)) {
  653. toGive = match(split[3]);
  654. }
  655.  
  656. if (toGive != null) {
  657. try {
  658. int i2 = 0;
  659. try {
  660. i2 = Integer.parseInt(split[1]);
  661. } catch (NumberFormatException n) {
  662. i2 = etc.getInstance().getDataSource().getItem(split[1]);
  663. }
  664. int i3 = 1;
  665. if (split.length > 2) {
  666. i3 = Integer.parseInt(split[2]);
  667. }
  668.  
  669. String i2str = Integer.toString(i2);
  670. if (i3 == -1 && etc.getInstance().isAdmin(e)) {
  671. i3 = 255;
  672. } else if (i3 <= 0) {
  673. i3 = 1;
  674. }
  675. if (i3 > 64 && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  676. i3 = 64;
  677. }
  678.  
  679. boolean allowedItem = false;
  680. if (!etc.getInstance().allowedItems[0].equals("") && (!etc.getInstance().canIgnoreRestrictions(this.e))) {
  681. for (String str : etc.getInstance().allowedItems) {
  682. if (i2str.equals(str)) {
  683. allowedItem = true;
  684. }
  685. }
  686. } else {
  687. allowedItem = true;
  688. }
  689. if (!etc.getInstance().disallowedItems[0].equals("") && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  690. for (String str : etc.getInstance().disallowedItems) {
  691. if (i2str.equals(str)) {
  692. allowedItem = false;
  693. }
  694. }
  695. }
  696. if (i2 < ez.c.length) {
  697. if (ez.c[i2] != null && (allowedItem || etc.getInstance().canIgnoreRestrictions(this.e))) {
  698. a.log(Level.INFO, "Giving " + toGive.aq + " some " + i2);
  699. if (i3 == 255) {
  700. toGive.a(new gp(i2, 255));
  701. } else {
  702. int temp = i3;
  703.  
  704. do {
  705. if (temp - 64 >= 64) {
  706. toGive.a(new gp(i2, 64));
  707. } else {
  708. toGive.a(new gp(i2, temp));
  709. }
  710. temp -= 64;
  711. } while (temp >= 64);
  712. }
  713.  
  714. if (toGive == this.e) {
  715. msg(Colors.Rose + "There you go c:");
  716. } else {
  717. msg(Colors.Rose + "Gift given! :D");
  718. toGive.a.msg(Colors.Rose + "Enjoy your gift! :D");
  719. }
  720. } else if ((!allowedItem) && (ez.c[i2] != null) && !etc.getInstance().canIgnoreRestrictions(this.e)) {
  721. msg(Colors.Rose + "You are not allowed to spawn that item.");
  722. } else {
  723. msg(Colors.Rose + "No item with ID " + split[1]);
  724. }
  725. } else {
  726. msg(Colors.Rose + "No item with ID " + split[1]);
  727. }
  728. } catch (NumberFormatException localNumberFormatException) {
  729. msg(Colors.Rose + "Improper ID and/or amount.");
  730. }
  731. } else {
  732. msg(Colors.Rose + "Can't find user " + split[3]);
  733. }
  734. } else if (split[0].equalsIgnoreCase("/tempban")) {
  735. // /tempban MINUTES HOURS DAYS
  736. if (split.length == 1) {
  737. //TODO;
  738. return;
  739. }
  740. int minutes = 0, hours = 0, days = 0;
  741. if (split.length >= 2) {
  742. minutes = Integer.parseInt(split[1]);
  743. }
  744. if (split.length >= 3) {
  745. hours = Integer.parseInt(split[2]);
  746. }
  747. if (split.length >= 4) {
  748. days = Integer.parseInt(split[3]);
  749. }
  750. Date date = new Date();
  751. //date.
  752. } else if (split[0].equalsIgnoreCase("/banlist")) {
  753. byte type = 0;
  754. if (split.length == 2) {
  755. if (split[1].equalsIgnoreCase("ips")) {
  756. type = 1;
  757. }
  758. }
  759. if (type == 0) { //Regular user bans
  760. msg(Colors.Blue + "Ban list:" + Colors.White + " " + d.f.getBans());
  761. } else { //IP bans
  762. msg(Colors.Blue + "IP Ban list:" + Colors.White + " " + d.f.getBans());
  763. }
  764. } else if (split[0].equalsIgnoreCase("/banip")) {
  765. if (split.length < 2) {
  766. msg(Colors.Rose + "Correct usage is: /banip [player] <reason> (optional) NOTE: this permabans IPs.");
  767. return;
  768. }
  769.  
  770. ea player = match(split[1]);
  771.  
  772. if (player != null) {
  773. if (!hasControlOver(player)) {
  774. msg(Colors.Rose + "You can't ban that user.");
  775. return;
  776. }
  777.  
  778. // adds player to ban list
  779. this.d.f.c(player.a.b.b().toString());
  780.  
  781. a.log(Level.INFO, "IP Banning " + player.aq + " (IP: " + player.a.b.b().toString() + ")");
  782. msg(Colors.Rose + "IP Banning " + player.aq + " (IP: " + player.a.b.b().toString() + ")");
  783.  
  784. if (split.length > 2) {
  785. player.a.c("IP Banned by " + e.aq + ": " + combineSplit(2, split, " "));
  786. String ipbanmessage = Colors.Gold + player.aq + " IP banned by " + e.aq;
  787. this.d.f.a(new ba(ipbanmessage));
  788. } else {
  789. String ipbanmessage = Colors.Gold + player.aq + " IP banned by " + e.aq;
  790. this.d.f.a(new ba(ipbanmessage));
  791. player.a.c("IP Banned by " + e.aq + ".");
  792. }
  793. } else {
  794. msg(Colors.Rose + "Can't find user " + split[1] + ".");
  795. }
  796. } else if (split[0].equalsIgnoreCase("/ban")) {
  797. if (split.length < 2) {
  798. msg(Colors.Rose + "Correct usage is: /ban [player] <reason> (optional)");
  799. return;
  800. }
  801.  
  802. ea player = match(split[1]);
  803.  
  804. if (player != null) {
  805. if (!hasControlOver(player)) {
  806. msg(Colors.Rose + "You can't ban that user.");
  807. return;
  808. }
  809.  
  810. // adds player to ban list
  811. this.d.f.a(player.aq);
  812.  
  813. if (split.length > 2) {
  814. player.a.c("Banned by " + e.aq + ": " + combineSplit(2, split, " "));
  815. String banmessage = Colors.Red + player.aq + " banned by " + e.aq;
  816. this.d.f.a(new ba(banmessage));
  817. } else {
  818. player.a.c("Banned by " + e.aq + ".");
  819. String banmessage = Colors.Red + player.aq + " banned by " + e.aq;
  820. this.d.f.a(new ba(banmessage));
  821. }
  822. a.log(Level.INFO, "Banning " + player.aq);
  823. msg(Colors.Rose + "Banning " + player.aq);
  824. } else {
  825. msg(Colors.Rose + "Can't find user " + split[1] + ".");
  826. }
  827. } else if (split[0].equalsIgnoreCase("/unban")) {
  828. if (split.length != 2) {
  829. msg(Colors.Rose + "Correct usage is: /unban [player]");
  830. return;
  831. }
  832. this.d.f.b(split[1]);
  833. msg(Colors.Rose + "Unbanned " + split[1]);
  834. String unbanmessage = Colors.Gold + split[1] + " unbanned by " + e.aq;
  835. this.d.f.a(new ba(unbanmessage));
  836. } else if (split[0].equalsIgnoreCase("/unbanip")) {
  837. if (split.length != 2) {
  838. msg(Colors.Rose + "Correct usage is: /unbanip [ip]");
  839. return;
  840. }
  841. this.d.f.d(split[1]);
  842. msg(Colors.Rose + "Unbanned " + split[1]);
  843. String unipbanmessage = Colors.Gold + split[1] + " unbanned by " + e.aq;
  844. this.d.f.a(new ba(unipbanmessage));
  845. } else if (split[0].equalsIgnoreCase("/kick")) {
  846. if (split.length < 2) {
  847. msg(Colors.Rose + "Correct usage is: /kick [player] <reason> (optional)");
  848. return;
  849. }
  850.  
  851. ea player = match(split[1]);
  852.  
  853. if (player != null) {
  854. if (!hasControlOver(player)) {
  855. msg(Colors.Rose + "You can't kick that user.");
  856. return;
  857. }
  858.  
  859. if (split.length > 2) {
  860. String globalmessage = Colors.Gold + player.aq + " was kicked by " + this.e.aq + ": " + combineSplit(2, split, " ");
  861. player.a.c("Kicked by " + e.aq + ": " + combineSplit(2, split, " "));
  862. this.d.f.a(new ba(globalmessage));
  863. } else {
  864. String globalmessage = Colors.Gold + player.aq + " was kicked by " + this.e.aq;
  865. player.a.c("Kicked by " + e.aq + ".");
  866. this.d.f.a(new ba(globalmessage));
  867. }
  868. a.log(Level.INFO, "Kicking " + player.aq);
  869. a.info(this.e.aq + " has Kicked " +player.aq);
  870. msg(Colors.Rose + "Kicking " + player.aq);
  871. } else {
  872. msg(Colors.Rose + "Can't find user " + split[1] + ".");
  873. }
  874. } else if (split[0].equalsIgnoreCase("/me")) {
  875. if (etc.getInstance().isMuted(e)) {
  876. msg(Colors.Rose + "You are currently muted.");
  877. return;
  878. }
  879. String prefix = etc.getInstance().getUserColor(e.aq);
  880. String paramString2 = "* " + prefix + this.e.aq + Colors.White + " " + paramString.substring(paramString.indexOf(" ")).trim();
  881. a.info("* " + this.e.aq + " " + paramString.substring(paramString.indexOf(" ")).trim());
  882. this.d.f.a(new ba(paramString2));
  883. } else if (split[0].equalsIgnoreCase("/sethome")) {
  884. // player.k, player.l, player.m
  885. // x, y, z
  886. Location loc = new Location();
  887. loc.x = e.l;
  888. loc.y = e.m;
  889. loc.z = e.n;
  890. loc.rotX = e.r;
  891. loc.rotY = e.s;
  892. Warp home = new Warp();
  893. home.Location = loc;
  894. home.Group = ""; //no group neccessary, lol.
  895. home.Name = e.aq;
  896. etc.getInstance().changeHome(home);
  897. msg(Colors.Rose + "Your home has been set.");
  898. //String sethome = Colors.Gold + player.aq + " set a new home.";
  899. //this.d.f.a(new ba(sethome));
  900. } else if (split[0].equalsIgnoreCase("/spawn")) {
  901. int m = this.d.e.d(this.d.e.n, this.d.e.p);
  902. String spawnmsg = Colors.Gold + e.aq + " returned to spawn.";
  903. this.d.f.a(new ba(spawnmsg));
  904. a(this.d.e.n + 0.5D, m + 1.5D, this.d.e.p + 0.5D, 0.0F, 0.0F);
  905. } else if (split[0].equalsIgnoreCase("/setspawn")) {
  906. this.d.e.n = (int) Math.ceil(e.l);
  907. //Too lazy to actually update this considering it's not even used anyways.
  908. //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.
  909. this.d.e.p = (int) Math.ceil(e.n);
  910. a.info("Spawn position changed.");
  911. msg(Colors.Rose + "You have set the spawn to your current position.");
  912. } else if (split[0].equalsIgnoreCase("/home")) {
  913. a.info(this.e.aq + " returned home");
  914. Warp home = etc.getInstance().getDataSource().getHome(e.aq);
  915. if (home != null) {
  916. a(home.Location.x, home.Location.y, home.Location.z, home.Location.rotX, home.Location.rotY);
  917. } else {
  918. int m = this.d.e.d(this.d.e.n, this.d.e.p);
  919. a(this.d.e.n + 0.5D, m + 1.5D, this.d.e.p + 0.5D, 0.0F, 0.0F);
  920. }
  921. } else if (split[0].equalsIgnoreCase("/warp")) {
  922. if (split.length < 2) {
  923. msg(Colors.Rose + "Correct usage is: /warp [warpname]");
  924. return;
  925. }
  926. ea toWarp = e;
  927. Warp warp = null;
  928. if (split.length == 3 && etc.getInstance().canIgnoreRestrictions(e)) {
  929. warp = etc.getInstance().getDataSource().getWarp(split[1]);
  930. toWarp = match(split[2]);
  931. } else {
  932. warp = etc.getInstance().getDataSource().getWarp(split[1]);
  933. }
  934. if (toWarp != null) {
  935. if (warp != null) {
  936. if (!etc.getInstance().isUserInGroup(e, warp.Group) && !warp.Group.equals("")) {
  937. msg(Colors.Rose + "Warp not found.");
  938. } else {
  939. toWarp.a.a(warp.Location.x, warp.Location.y, warp.Location.z, warp.Location.rotX, warp.Location.rotY);
  940. toWarp.a.msg(Colors.Rose + "Woosh!");
  941. }
  942. } else {
  943. msg(Colors.Rose + "Warp not found");
  944. }
  945. } else {
  946. msg(Colors.Rose + "Player not found.");
  947. }
  948. } else if (split[0].equalsIgnoreCase("/listwarps") && etc.getInstance().getDataSource().hasWarps()) {
  949. if (split.length != 2 && split.length != 3) {
  950. msg(Colors.Rose + "Available warps: " + Colors.White + etc.getInstance().getDataSource().getWarpNames(e.aq));
  951. return;
  952. }
  953. } else if (split[0].equalsIgnoreCase("/setwarp")) {
  954. if (split.length < 2) {
  955. if (etc.getInstance().canIgnoreRestrictions(e)) {
  956. msg(Colors.Rose + "Correct usage is: /setwarp [warpname] [group]");
  957. } else {
  958. msg(Colors.Rose + "Correct usage is: /setwarp [warpname]");
  959. }
  960. return;
  961. }
  962. Location loc = new Location();
  963. loc.x = e.l;
  964. loc.y = e.m;
  965. loc.z = e.n;
  966. loc.rotX = e.r;
  967. loc.rotY = e.s;
  968. Warp warp = new Warp();
  969. warp.Name = split[1];
  970. warp.Location = loc;
  971. if (split.length == 3) {
  972. warp.Group = split[2];
  973. } else {
  974. warp.Group = "";
  975. }
  976. etc.getInstance().setWarp(warp);
  977. msg(Colors.Rose + "Created warp point " + split[1] + ".");
  978. } else if (split[0].equalsIgnoreCase("/lighter")) {
  979. if (MinecraftServer.b.containsKey(this.e.aq + " lighter")) {
  980. a.info(this.e.aq + " failed to iron!");
  981. msg(Colors.Rose + "You can't create another lighter again so soon");
  982. } else {
  983. if (!etc.getInstance().canIgnoreRestrictions(e)) {
  984. MinecraftServer.b.put(this.e.aq + " lighter", Integer.valueOf(6000));
  985. }
  986. a.info(this.e.aq + " created a lighter!");
  987. this.e.a(new gp(259, 1));
  988. }
  989. } else if ((paramString.startsWith("/#")) && (this.d.f.g(this.e.aq))) {
  990. String str = paramString.substring(2);
  991. a.info(this.e.aq + " issued server command: " + str);
  992. this.d.a(str, this);
  993. } else if (split[0].equalsIgnoreCase("/time")) {
  994. if (split.length != 2) {
  995. msg(Colors.Rose + "Correct usage is: /time [time|day|night]");
  996. return;
  997. }
  998.  
  999. if (split[1].equalsIgnoreCase("day")) {
  1000. this.d.e.c = 0;
  1001. String timeday = Colors.Gold + "Daylight breaks thanks to " + e.aq;
  1002. this.d.f.a(new ba(timeday));
  1003. } else if (split[1].equalsIgnoreCase("night")) {
  1004. this.d.e.c = 13000;
  1005. String timenight = Colors.Gold + "What a terrible night to have a curse (" + e.aq + ")";
  1006. this.d.f.a(new ba(timenight));
  1007. } else {
  1008. try {
  1009. this.d.e.c = Long.parseLong(split[1]);
  1010. } catch (NumberFormatException e) {
  1011. msg(Colors.Rose + "Please enter numbers, not letters.");
  1012. }
  1013. }
  1014. } else if (split[0].equalsIgnoreCase("/getpos")) {
  1015. msg("Pos X: " + e.l + " Y: " + e.m + " Z " + e.n);
  1016. msg("Rotation X: " + e.r + " Y: " + e.s);
  1017.  
  1018. double degreeRotation = ((e.r - 90) % 360);
  1019. if (degreeRotation < 0) {
  1020. degreeRotation += 360.0;
  1021. }
  1022. msg("Compass: " + etc.getCompassPointForDirection(degreeRotation) + " (" + (Math.round(degreeRotation * 10) / 10.0) + ")");
  1023. } else if (split[0].equalsIgnoreCase("/compass")) {
  1024. double degreeRotation = ((e.r - 90) % 360);
  1025. if (degreeRotation < 0) {
  1026. degreeRotation += 360.0;
  1027. }
  1028.  
  1029. msg(Colors.Rose + "Compass: " + etc.getCompassPointForDirection(degreeRotation));
  1030. } else if (split[0].equalsIgnoreCase("/motd")) {
  1031. for (String str : etc.getInstance().motd) {
  1032. msg(str);
  1033. }
  1034. } else {
  1035. a.info(this.e.aq + " tried command " + paramString);
  1036. msg(Colors.Rose + "Unknown command");
  1037. }
  1038. } catch (Exception ex) {
  1039. a.log(Level.SEVERE, "Exception in command handler (Report this to hey0 unless you did something dumb like enter letters as numbers):", ex);
  1040. if (etc.getInstance().isAdmin(e)) {
  1041. msg(Colors.Rose + "Exception occured. Check the server for more info.");
  1042. }
  1043. }
  1044. }
  1045.  
  1046. public void a(o paramo) {
  1047. if (paramo.b == 1) {
  1048. this.e.y();
  1049. }
  1050. }
  1051.  
  1052. public void a(io paramio) {
  1053. this.b.a("Quitting");
  1054. }
  1055.  
  1056. public int b() {
  1057. return this.b.d();
  1058. }
  1059.  
  1060. public void b(String paramString) {
  1061. b(new ba("§7" + paramString));
  1062. }
  1063.  
  1064. public String c() {
  1065. return this.e.aq;
  1066. }
  1067.  
  1068. public void a(r paramr) {
  1069. if (paramr.a == -1) {
  1070. this.e.aj.a = paramr.b;
  1071. }
  1072. if (paramr.a == -2) {
  1073. this.e.aj.c = paramr.b;
  1074. }
  1075. if (paramr.a == -3) {
  1076. this.e.aj.b = paramr.b;
  1077. }
  1078. }
  1079.  
  1080. public void d() {
  1081. this.b.a(new r(-1, this.e.aj.a));
  1082. this.b.a(new r(-2, this.e.aj.c));
  1083. this.b.a(new r(-3, this.e.aj.b));
  1084. }
  1085.  
  1086. public void a(ib paramib) {
  1087. as localas = this.d.e.k(paramib.a, paramib.b, paramib.c);
  1088. if (localas != null) {
  1089. localas.a(paramib.e);
  1090. localas.c();
  1091. }
  1092. }
  1093. }
RAW Paste Data