PageRenderTime 78ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/mcp/temp/src/minecraft_server/net/minecraft/src/NetServerHandler.java

https://bitbucket.org/vkorolik/twoleanfour-client
Java | 818 lines | 761 code | 41 blank | 16 comment | 208 complexity | 59cceab7f0ebc48dcf893b0ae60a9096 MD5 | raw file
  1. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3) braces deadcode fieldsfirst
  4. package net.minecraft.src;
  5. import java.io.PrintStream;
  6. import java.util.*;
  7. import java.util.logging.Logger;
  8. import net.minecraft.server.MinecraftServer;
  9. // Referenced classes of package net.minecraft.src:
  10. // NetHandler, ICommandListener, IntHashMap, NetworkManager,
  11. // EntityPlayerMP, Packet0KeepAlive, Packet255KickDisconnect, Packet3Chat,
  12. // ServerConfigurationManager, Packet10Flying, Entity, WorldServer,
  13. // AxisAlignedBB, ItemInWorldManager, Packet13PlayerLookMove, Packet14BlockDig,
  14. // WorldProvider, ChunkCoordinates, MathHelper, Packet53BlockChange,
  15. // InventoryPlayer, Packet15Place, ItemStack, Container,
  16. // Packet103SetSlot, Slot, Packet16BlockItemSwitch, ChatAllowedCharacters,
  17. // DamageSource, Packet18Animation, Packet19EntityAction, Packet7UseEntity,
  18. // Packet102WindowClick, Packet106Transaction, Packet108EnchantItem, Packet107CreativeSetSlot,
  19. // Item, EntityItem, Packet130UpdateSign, TileEntitySign,
  20. // Packet202PlayerAbilities, PlayerCapabilities, Packet, Packet9Respawn,
  21. // Packet101CloseWindow
  22. public class NetServerHandler extends NetHandler
  23. implements ICommandListener
  24. {
  25. public static Logger field_20_a = Logger.getLogger("Minecraft");
  26. public NetworkManager field_19_b;
  27. public boolean field_18_c;
  28. private MinecraftServer field_17_d;
  29. private EntityPlayerMP field_16_e;
  30. private int field_35009_f;
  31. private int field_27004_h;
  32. private boolean field_22003_h;
  33. private int field_35013_i;
  34. private long field_35011_j;
  35. private static Random field_35012_k = new Random();
  36. private long field_35010_l;
  37. private int field_45001_m;
  38. private int field_48073_n;
  39. private double field_9009_g;
  40. private double field_9008_h;
  41. private double field_9007_i;
  42. private boolean field_9006_j;
  43. private IntHashMap field_10_k;
  44. public NetServerHandler(MinecraftServer p_i263_1_, NetworkManager p_i263_2_, EntityPlayerMP p_i263_3_)
  45. {
  46. field_18_c = false;
  47. field_45001_m = 0;
  48. field_48073_n = 0;
  49. field_9006_j = true;
  50. field_10_k = new IntHashMap();
  51. field_17_d = p_i263_1_;
  52. field_19_b = p_i263_2_;
  53. p_i263_2_.func_754_a(this);
  54. field_16_e = p_i263_3_;
  55. p_i263_3_.field_20908_a = this;
  56. }
  57. public void func_42_a()
  58. {
  59. field_22003_h = false;
  60. field_35009_f++;
  61. field_19_b.func_747_a();
  62. if((long)field_35009_f - field_35010_l > 20L)
  63. {
  64. field_35010_l = field_35009_f;
  65. field_35011_j = System.nanoTime() / 0xf4240L;
  66. field_35013_i = field_35012_k.nextInt();
  67. func_39_b(new Packet0KeepAlive(field_35013_i));
  68. }
  69. if(field_45001_m > 0)
  70. {
  71. field_45001_m--;
  72. }
  73. if(field_48073_n > 0)
  74. {
  75. field_48073_n--;
  76. }
  77. }
  78. public void func_43_c(String p_43_1_)
  79. {
  80. if(field_18_c)
  81. {
  82. return;
  83. } else
  84. {
  85. field_16_e.func_30002_A();
  86. func_39_b(new Packet255KickDisconnect(p_43_1_));
  87. field_19_b.func_752_c();
  88. field_17_d.field_6033_f.func_631_a(new Packet3Chat((new StringBuilder()).append("\247e").append(field_16_e.field_409_aq).append(" left the game.").toString()));
  89. field_17_d.field_6033_f.func_616_c(field_16_e);
  90. field_18_c = true;
  91. return;
  92. }
  93. }
  94. public void func_18_a(Packet10Flying p_18_1_)
  95. {
  96. WorldServer worldserver = field_17_d.func_28004_a(field_16_e.field_4110_as);
  97. field_22003_h = true;
  98. if(field_16_e.field_41032_j)
  99. {
  100. return;
  101. }
  102. if(!field_9006_j)
  103. {
  104. double d = p_18_1_.field_72_b - field_9008_h;
  105. if(p_18_1_.field_73_a == field_9009_g && d * d < 0.01D && p_18_1_.field_71_c == field_9007_i)
  106. {
  107. field_9006_j = true;
  108. }
  109. }
  110. if(field_9006_j)
  111. {
  112. if(field_16_e.field_327_g != null)
  113. {
  114. float f = field_16_e.field_316_r;
  115. float f1 = field_16_e.field_315_s;
  116. field_16_e.field_327_g.func_127_w();
  117. double d2 = field_16_e.field_322_l;
  118. double d4 = field_16_e.field_321_m;
  119. double d6 = field_16_e.field_320_n;
  120. double d8 = 0.0D;
  121. double d9 = 0.0D;
  122. if(p_18_1_.field_65_i)
  123. {
  124. f = p_18_1_.field_69_e;
  125. f1 = p_18_1_.field_68_f;
  126. }
  127. if(p_18_1_.field_66_h && p_18_1_.field_72_b == -999D && p_18_1_.field_70_d == -999D)
  128. {
  129. if(p_18_1_.field_73_a > 1.0D || p_18_1_.field_71_c > 1.0D)
  130. {
  131. System.err.println((new StringBuilder()).append(field_16_e.field_409_aq).append(" was caught trying to crash the server with an invalid position.").toString());
  132. func_43_c("Nope!");
  133. return;
  134. }
  135. d8 = p_18_1_.field_73_a;
  136. d9 = p_18_1_.field_71_c;
  137. }
  138. field_16_e.field_9086_A = p_18_1_.field_67_g;
  139. field_16_e.func_22070_a(true);
  140. field_16_e.func_88_c(d8, 0.0D, d9);
  141. field_16_e.func_6095_b(d2, d4, d6, f, f1);
  142. field_16_e.field_319_o = d8;
  143. field_16_e.field_317_q = d9;
  144. if(field_16_e.field_327_g != null)
  145. {
  146. worldserver.func_12017_b(field_16_e.field_327_g, true);
  147. }
  148. if(field_16_e.field_327_g != null)
  149. {
  150. field_16_e.field_327_g.func_127_w();
  151. }
  152. field_17_d.field_6033_f.func_613_b(field_16_e);
  153. field_9009_g = field_16_e.field_322_l;
  154. field_9008_h = field_16_e.field_321_m;
  155. field_9007_i = field_16_e.field_320_n;
  156. worldserver.func_520_e(field_16_e);
  157. return;
  158. }
  159. if(field_16_e.func_22057_E())
  160. {
  161. field_16_e.func_22070_a(true);
  162. field_16_e.func_6095_b(field_9009_g, field_9008_h, field_9007_i, field_16_e.field_316_r, field_16_e.field_315_s);
  163. worldserver.func_520_e(field_16_e);
  164. return;
  165. }
  166. double d1 = field_16_e.field_321_m;
  167. field_9009_g = field_16_e.field_322_l;
  168. field_9008_h = field_16_e.field_321_m;
  169. field_9007_i = field_16_e.field_320_n;
  170. double d3 = field_16_e.field_322_l;
  171. double d5 = field_16_e.field_321_m;
  172. double d7 = field_16_e.field_320_n;
  173. float f2 = field_16_e.field_316_r;
  174. float f3 = field_16_e.field_315_s;
  175. if(p_18_1_.field_66_h && p_18_1_.field_72_b == -999D && p_18_1_.field_70_d == -999D)
  176. {
  177. p_18_1_.field_66_h = false;
  178. }
  179. if(p_18_1_.field_66_h)
  180. {
  181. d3 = p_18_1_.field_73_a;
  182. d5 = p_18_1_.field_72_b;
  183. d7 = p_18_1_.field_71_c;
  184. double d10 = p_18_1_.field_70_d - p_18_1_.field_72_b;
  185. if(!field_16_e.func_22057_E() && (d10 > 1.6499999999999999D || d10 < 0.10000000000000001D))
  186. {
  187. func_43_c("Illegal stance");
  188. field_20_a.warning((new StringBuilder()).append(field_16_e.field_409_aq).append(" had an illegal stance: ").append(d10).toString());
  189. return;
  190. }
  191. if(Math.abs(p_18_1_.field_73_a) > 32000000D || Math.abs(p_18_1_.field_71_c) > 32000000D)
  192. {
  193. func_43_c("Illegal position");
  194. return;
  195. }
  196. }
  197. if(p_18_1_.field_65_i)
  198. {
  199. f2 = p_18_1_.field_69_e;
  200. f3 = p_18_1_.field_68_f;
  201. }
  202. field_16_e.func_22070_a(true);
  203. field_16_e.field_9068_R = 0.0F;
  204. field_16_e.func_6095_b(field_9009_g, field_9008_h, field_9007_i, f2, f3);
  205. if(!field_9006_j)
  206. {
  207. return;
  208. }
  209. double d11 = d3 - field_16_e.field_322_l;
  210. double d12 = d5 - field_16_e.field_321_m;
  211. double d13 = d7 - field_16_e.field_320_n;
  212. double d14 = d11 * d11 + d12 * d12 + d13 * d13;
  213. if(d14 > 100D)
  214. {
  215. field_20_a.warning((new StringBuilder()).append(field_16_e.field_409_aq).append(" moved too quickly!").toString());
  216. func_43_c("You moved too quickly :( (Hacking?)");
  217. return;
  218. }
  219. float f4 = 0.0625F;
  220. boolean flag = worldserver.func_481_a(field_16_e, field_16_e.field_312_v.func_711_b().func_694_e(f4, f4, f4)).size() == 0;
  221. if(field_16_e.field_9086_A && !p_18_1_.field_67_g && d12 > 0.0D)
  222. {
  223. field_16_e.func_35198_b(0.2F);
  224. }
  225. field_16_e.func_88_c(d11, d12, d13);
  226. field_16_e.field_9086_A = p_18_1_.field_67_g;
  227. field_16_e.func_25045_g(d11, d12, d13);
  228. double d15 = d12;
  229. d11 = d3 - field_16_e.field_322_l;
  230. d12 = d5 - field_16_e.field_321_m;
  231. if(d12 > -0.5D || d12 < 0.5D)
  232. {
  233. d12 = 0.0D;
  234. }
  235. d13 = d7 - field_16_e.field_320_n;
  236. d14 = d11 * d11 + d12 * d12 + d13 * d13;
  237. boolean flag1 = false;
  238. if(d14 > 0.0625D && !field_16_e.func_22057_E() && !field_16_e.field_425_ad.func_35698_b())
  239. {
  240. flag1 = true;
  241. field_20_a.warning((new StringBuilder()).append(field_16_e.field_409_aq).append(" moved wrongly!").toString());
  242. System.out.println((new StringBuilder()).append("Got position ").append(d3).append(", ").append(d5).append(", ").append(d7).toString());
  243. System.out.println((new StringBuilder()).append("Expected ").append(field_16_e.field_322_l).append(", ").append(field_16_e.field_321_m).append(", ").append(field_16_e.field_320_n).toString());
  244. }
  245. field_16_e.func_6095_b(d3, d5, d7, f2, f3);
  246. boolean flag2 = worldserver.func_481_a(field_16_e, field_16_e.field_312_v.func_711_b().func_694_e(f4, f4, f4)).size() == 0;
  247. if(flag && (flag1 || !flag2) && !field_16_e.func_22057_E())
  248. {
  249. func_41_a(field_9009_g, field_9008_h, field_9007_i, f2, f3);
  250. return;
  251. }
  252. AxisAlignedBB axisalignedbb = field_16_e.field_312_v.func_711_b().func_708_b(f4, f4, f4).func_700_a(0.0D, -0.55000000000000004D, 0.0D);
  253. if(!field_17_d.field_27005_o && !field_16_e.field_425_ad.func_35698_b() && !worldserver.func_27069_b(axisalignedbb))
  254. {
  255. if(d15 >= -0.03125D)
  256. {
  257. field_27004_h++;
  258. if(field_27004_h > 80)
  259. {
  260. field_20_a.warning((new StringBuilder()).append(field_16_e.field_409_aq).append(" was kicked for floating too long!").toString());
  261. func_43_c("Flying is not enabled on this server");
  262. return;
  263. }
  264. }
  265. } else
  266. {
  267. field_27004_h = 0;
  268. }
  269. field_16_e.field_9086_A = p_18_1_.field_67_g;
  270. field_17_d.field_6033_f.func_613_b(field_16_e);
  271. field_16_e.func_9153_b(field_16_e.field_321_m - d1, p_18_1_.field_67_g);
  272. }
  273. }
  274. public void func_41_a(double p_41_1_, double p_41_3_, double p_41_5_, float p_41_7_,
  275. float p_41_8_)
  276. {
  277. field_9006_j = false;
  278. field_9009_g = p_41_1_;
  279. field_9008_h = p_41_3_;
  280. field_9007_i = p_41_5_;
  281. field_16_e.func_6095_b(p_41_1_, p_41_3_, p_41_5_, p_41_7_, p_41_8_);
  282. field_16_e.field_20908_a.func_39_b(new Packet13PlayerLookMove(p_41_1_, p_41_3_ + 1.6200000047683716D, p_41_3_, p_41_5_, p_41_7_, p_41_8_, false));
  283. }
  284. public void func_26_a(Packet14BlockDig p_26_1_)
  285. {
  286. WorldServer worldserver = field_17_d.func_28004_a(field_16_e.field_4110_as);
  287. if(p_26_1_.field_55_e == 4)
  288. {
  289. field_16_e.func_48347_R();
  290. return;
  291. }
  292. if(p_26_1_.field_55_e == 5)
  293. {
  294. field_16_e.func_35196_E();
  295. return;
  296. }
  297. boolean flag = worldserver.field_819_z = worldserver.field_4272_q.field_6165_g != 0 || field_17_d.field_6033_f.func_639_g(field_16_e.field_409_aq);
  298. boolean flag1 = false;
  299. if(p_26_1_.field_55_e == 0)
  300. {
  301. flag1 = true;
  302. }
  303. if(p_26_1_.field_55_e == 2)
  304. {
  305. flag1 = true;
  306. }
  307. int i = p_26_1_.field_54_a;
  308. int j = p_26_1_.field_53_b;
  309. int k = p_26_1_.field_57_c;
  310. if(flag1)
  311. {
  312. double d = field_16_e.field_322_l - ((double)i + 0.5D);
  313. double d1 = (field_16_e.field_321_m - ((double)j + 0.5D)) + 1.5D;
  314. double d3 = field_16_e.field_320_n - ((double)k + 0.5D);
  315. double d5 = d * d + d1 * d1 + d3 * d3;
  316. if(d5 > 36D)
  317. {
  318. return;
  319. }
  320. if(j >= field_17_d.field_48081_t)
  321. {
  322. return;
  323. }
  324. }
  325. ChunkCoordinates chunkcoordinates = worldserver.func_22078_l();
  326. int l = MathHelper.func_35475_a(i - chunkcoordinates.field_22216_a);
  327. int i1 = MathHelper.func_35475_a(k - chunkcoordinates.field_528_b);
  328. if(l > i1)
  329. {
  330. i1 = l;
  331. }
  332. if(p_26_1_.field_55_e == 0)
  333. {
  334. if(i1 > 16 || flag)
  335. {
  336. field_16_e.field_425_ad.func_324_a(i, j, k, p_26_1_.field_56_d);
  337. } else
  338. {
  339. field_16_e.field_20908_a.func_39_b(new Packet53BlockChange(i, j, k, worldserver));
  340. }
  341. } else
  342. if(p_26_1_.field_55_e == 2)
  343. {
  344. field_16_e.field_425_ad.func_22045_b(i, j, k);
  345. if(worldserver.func_444_a(i, j, k) != 0)
  346. {
  347. field_16_e.field_20908_a.func_39_b(new Packet53BlockChange(i, j, k, worldserver));
  348. }
  349. } else
  350. if(p_26_1_.field_55_e == 3)
  351. {
  352. double d2 = field_16_e.field_322_l - ((double)i + 0.5D);
  353. double d4 = field_16_e.field_321_m - ((double)j + 0.5D);
  354. double d6 = field_16_e.field_320_n - ((double)k + 0.5D);
  355. double d7 = d2 * d2 + d4 * d4 + d6 * d6;
  356. if(d7 < 256D)
  357. {
  358. field_16_e.field_20908_a.func_39_b(new Packet53BlockChange(i, j, k, worldserver));
  359. }
  360. }
  361. worldserver.field_819_z = false;
  362. }
  363. public void func_24_a(Packet15Place p_24_1_)
  364. {
  365. WorldServer worldserver = field_17_d.func_28004_a(field_16_e.field_4110_as);
  366. ItemStack itemstack = field_16_e.field_416_aj.func_213_b();
  367. boolean flag = false;
  368. int i = p_24_1_.field_78_a;
  369. int j = p_24_1_.field_77_b;
  370. int k = p_24_1_.field_81_c;
  371. int l = p_24_1_.field_80_d;
  372. boolean flag1 = worldserver.field_819_z = worldserver.field_4272_q.field_6165_g != 0 || field_17_d.field_6033_f.func_639_g(field_16_e.field_409_aq);
  373. if(p_24_1_.field_80_d == 255)
  374. {
  375. if(itemstack == null)
  376. {
  377. return;
  378. }
  379. field_16_e.field_425_ad.func_6154_a(field_16_e, worldserver, itemstack);
  380. } else
  381. if(p_24_1_.field_77_b < field_17_d.field_48081_t - 1 || p_24_1_.field_80_d != 1 && p_24_1_.field_77_b < field_17_d.field_48081_t)
  382. {
  383. ChunkCoordinates chunkcoordinates = worldserver.func_22078_l();
  384. int i1 = MathHelper.func_35475_a(i - chunkcoordinates.field_22216_a);
  385. int j1 = MathHelper.func_35475_a(k - chunkcoordinates.field_528_b);
  386. if(i1 > j1)
  387. {
  388. j1 = i1;
  389. }
  390. if(field_9006_j && field_16_e.func_101_d((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64D && (j1 > 16 || flag1))
  391. {
  392. field_16_e.field_425_ad.func_327_a(field_16_e, worldserver, itemstack, i, j, k, l);
  393. }
  394. flag = true;
  395. } else
  396. {
  397. field_16_e.field_20908_a.func_39_b(new Packet3Chat((new StringBuilder()).append("\2477Height limit for building is ").append(field_17_d.field_48081_t).toString()));
  398. flag = true;
  399. }
  400. if(flag)
  401. {
  402. field_16_e.field_20908_a.func_39_b(new Packet53BlockChange(i, j, k, worldserver));
  403. if(l == 0)
  404. {
  405. j--;
  406. }
  407. if(l == 1)
  408. {
  409. j++;
  410. }
  411. if(l == 2)
  412. {
  413. k--;
  414. }
  415. if(l == 3)
  416. {
  417. k++;
  418. }
  419. if(l == 4)
  420. {
  421. i--;
  422. }
  423. if(l == 5)
  424. {
  425. i++;
  426. }
  427. field_16_e.field_20908_a.func_39_b(new Packet53BlockChange(i, j, k, worldserver));
  428. }
  429. itemstack = field_16_e.field_416_aj.func_213_b();
  430. if(itemstack != null && itemstack.field_853_a == 0)
  431. {
  432. field_16_e.field_416_aj.field_496_a[field_16_e.field_416_aj.field_499_d] = null;
  433. itemstack = null;
  434. }
  435. if(itemstack == null || itemstack.func_35614_l() == 0)
  436. {
  437. field_16_e.field_20064_am = true;
  438. field_16_e.field_416_aj.field_496_a[field_16_e.field_416_aj.field_499_d] = ItemStack.func_20117_a(field_16_e.field_416_aj.field_496_a[field_16_e.field_416_aj.field_499_d]);
  439. Slot slot = field_16_e.field_20052_ap.func_20127_a(field_16_e.field_416_aj, field_16_e.field_416_aj.field_499_d);
  440. field_16_e.field_20052_ap.func_20125_a();
  441. field_16_e.field_20064_am = false;
  442. if(!ItemStack.func_20119_a(field_16_e.field_416_aj.func_213_b(), p_24_1_.field_79_e))
  443. {
  444. func_39_b(new Packet103SetSlot(field_16_e.field_20052_ap.field_20134_f, slot.field_20100_c, field_16_e.field_416_aj.func_213_b()));
  445. }
  446. }
  447. worldserver.field_819_z = false;
  448. }
  449. public void func_6_a(String p_6_1_, Object p_6_2_[])
  450. {
  451. field_20_a.info((new StringBuilder()).append(field_16_e.field_409_aq).append(" lost connection: ").append(p_6_1_).toString());
  452. field_17_d.field_6033_f.func_631_a(new Packet3Chat((new StringBuilder()).append("\247e").append(field_16_e.field_409_aq).append(" left the game.").toString()));
  453. field_17_d.field_6033_f.func_616_c(field_16_e);
  454. field_18_c = true;
  455. }
  456. public void func_6001_a(Packet p_6001_1_)
  457. {
  458. field_20_a.warning((new StringBuilder()).append(getClass()).append(" wasn't prepared to deal with a ").append(p_6001_1_.getClass()).toString());
  459. func_43_c("Protocol error, unexpected packet");
  460. }
  461. public void func_39_b(Packet p_39_1_)
  462. {
  463. field_19_b.func_745_a(p_39_1_);
  464. }
  465. public void func_11_a(Packet16BlockItemSwitch p_11_1_)
  466. {
  467. if(p_11_1_.field_74_b < 0 || p_11_1_.field_74_b >= InventoryPlayer.func_25054_e())
  468. {
  469. field_20_a.warning((new StringBuilder()).append(field_16_e.field_409_aq).append(" tried to set an invalid carried item").toString());
  470. return;
  471. } else
  472. {
  473. field_16_e.field_416_aj.field_499_d = p_11_1_.field_74_b;
  474. return;
  475. }
  476. }
  477. public void func_23_a(Packet3Chat p_23_1_)
  478. {
  479. String s = p_23_1_.field_150_a;
  480. if(s.length() > 100)
  481. {
  482. func_43_c("Chat message too long");
  483. return;
  484. }
  485. s = s.trim();
  486. for(int i = 0; i < s.length(); i++)
  487. {
  488. if(!ChatAllowedCharacters.func_48409_a(s.charAt(i)))
  489. {
  490. func_43_c("Illegal characters in chat");
  491. return;
  492. }
  493. }
  494. if(s.startsWith("/"))
  495. {
  496. func_4010_d(s);
  497. } else
  498. {
  499. s = (new StringBuilder()).append("<").append(field_16_e.field_409_aq).append("> ").append(s).toString();
  500. field_20_a.info(s);
  501. field_17_d.field_6033_f.func_631_a(new Packet3Chat(s));
  502. }
  503. field_45001_m += 20;
  504. if(field_45001_m > 200)
  505. {
  506. func_43_c("disconnect.spam");
  507. }
  508. }
  509. private void func_4010_d(String p_4010_1_)
  510. {
  511. if(p_4010_1_.toLowerCase().startsWith("/me "))
  512. {
  513. p_4010_1_ = (new StringBuilder()).append("* ").append(field_16_e.field_409_aq).append(" ").append(p_4010_1_.substring(p_4010_1_.indexOf(" ")).trim()).toString();
  514. field_20_a.info(p_4010_1_);
  515. field_17_d.field_6033_f.func_631_a(new Packet3Chat(p_4010_1_));
  516. } else
  517. if(p_4010_1_.toLowerCase().startsWith("/kill"))
  518. {
  519. field_16_e.func_121_a(DamageSource.field_35096_j, 1000);
  520. } else
  521. if(p_4010_1_.toLowerCase().startsWith("/tell "))
  522. {
  523. String as[] = p_4010_1_.split(" ");
  524. if(as.length >= 3)
  525. {
  526. p_4010_1_ = p_4010_1_.substring(p_4010_1_.indexOf(" ")).trim();
  527. p_4010_1_ = p_4010_1_.substring(p_4010_1_.indexOf(" ")).trim();
  528. p_4010_1_ = (new StringBuilder()).append("\2477").append(field_16_e.field_409_aq).append(" whispers ").append(p_4010_1_).toString();
  529. field_20_a.info((new StringBuilder()).append(p_4010_1_).append(" to ").append(as[1]).toString());
  530. if(!field_17_d.field_6033_f.func_621_a(as[1], new Packet3Chat(p_4010_1_)))
  531. {
  532. func_39_b(new Packet3Chat("\247cThere's no player by that name online."));
  533. }
  534. }
  535. } else
  536. if(field_17_d.field_6033_f.func_639_g(field_16_e.field_409_aq))
  537. {
  538. String s = p_4010_1_.substring(1);
  539. field_20_a.info((new StringBuilder()).append(field_16_e.field_409_aq).append(" issued server command: ").append(s).toString());
  540. field_17_d.func_6010_a(s, this);
  541. } else
  542. {
  543. String s1 = p_4010_1_.substring(1);
  544. field_20_a.info((new StringBuilder()).append(field_16_e.field_409_aq).append(" tried command: ").append(s1).toString());
  545. }
  546. }
  547. public void func_3_a(Packet18Animation p_3_1_)
  548. {
  549. if(p_3_1_.field_119_b == 1)
  550. {
  551. field_16_e.func_168_z();
  552. }
  553. }
  554. public void func_21001_a(Packet19EntityAction p_21001_1_)
  555. {
  556. if(p_21001_1_.field_21020_b == 1)
  557. {
  558. field_16_e.func_21043_b(true);
  559. } else
  560. if(p_21001_1_.field_21020_b == 2)
  561. {
  562. field_16_e.func_21043_b(false);
  563. } else
  564. if(p_21001_1_.field_21020_b == 4)
  565. {
  566. field_16_e.func_35146_g(true);
  567. } else
  568. if(p_21001_1_.field_21020_b == 5)
  569. {
  570. field_16_e.func_35146_g(false);
  571. } else
  572. if(p_21001_1_.field_21020_b == 3)
  573. {
  574. field_16_e.func_22062_a(false, true, true);
  575. field_9006_j = false;
  576. }
  577. }
  578. public void func_4009_a(Packet255KickDisconnect p_4009_1_)
  579. {
  580. field_19_b.func_753_a("disconnect.quitting", new Object[0]);
  581. }
  582. public int func_38_b()
  583. {
  584. return field_19_b.func_744_d();
  585. }
  586. public void func_2_b(String p_2_1_)
  587. {
  588. func_39_b(new Packet3Chat((new StringBuilder()).append("\2477").append(p_2_1_).toString()));
  589. }
  590. public String func_1_c()
  591. {
  592. return field_16_e.field_409_aq;
  593. }
  594. public void func_6006_a(Packet7UseEntity p_6006_1_)
  595. {
  596. WorldServer worldserver = field_17_d.func_28004_a(field_16_e.field_4110_as);
  597. Entity entity = worldserver.func_6158_a(p_6006_1_.field_9018_b);
  598. if(entity != null)
  599. {
  600. boolean flag = field_16_e.func_145_g(entity);
  601. double d = 36D;
  602. if(!flag)
  603. {
  604. d = 9D;
  605. }
  606. if(field_16_e.func_102_b(entity) < d)
  607. {
  608. if(p_6006_1_.field_9020_c == 0)
  609. {
  610. field_16_e.func_9145_g(entity);
  611. } else
  612. if(p_6006_1_.field_9020_c == 1)
  613. {
  614. field_16_e.func_9146_h(entity);
  615. }
  616. }
  617. }
  618. }
  619. public void func_9002_a(Packet9Respawn p_9002_1_)
  620. {
  621. if(field_16_e.field_41032_j)
  622. {
  623. field_16_e = field_17_d.field_6033_f.func_9242_d(field_16_e, 0, true);
  624. } else
  625. {
  626. if(field_16_e.func_40097_ai() > 0)
  627. {
  628. return;
  629. }
  630. field_16_e = field_17_d.field_6033_f.func_9242_d(field_16_e, 0, false);
  631. }
  632. }
  633. public void func_20006_a(Packet101CloseWindow p_20006_1_)
  634. {
  635. field_16_e.func_20059_K();
  636. }
  637. public void func_20007_a(Packet102WindowClick p_20007_1_)
  638. {
  639. if(field_16_e.field_20052_ap.field_20134_f == p_20007_1_.field_20024_a && field_16_e.field_20052_ap.func_20124_c(field_16_e))
  640. {
  641. ItemStack itemstack = field_16_e.field_20052_ap.func_27085_a(p_20007_1_.field_20023_b, p_20007_1_.field_20027_c, p_20007_1_.field_27039_f, field_16_e);
  642. if(ItemStack.func_20119_a(p_20007_1_.field_20025_e, itemstack))
  643. {
  644. field_16_e.field_20908_a.func_39_b(new Packet106Transaction(p_20007_1_.field_20024_a, p_20007_1_.field_20026_d, true));
  645. field_16_e.field_20064_am = true;
  646. field_16_e.field_20052_ap.func_20125_a();
  647. field_16_e.func_20058_J();
  648. field_16_e.field_20064_am = false;
  649. } else
  650. {
  651. field_10_k.func_554_a(field_16_e.field_20052_ap.field_20134_f, Short.valueOf(p_20007_1_.field_20026_d));
  652. field_16_e.field_20908_a.func_39_b(new Packet106Transaction(p_20007_1_.field_20024_a, p_20007_1_.field_20026_d, false));
  653. field_16_e.field_20052_ap.func_20129_a(field_16_e, false);
  654. ArrayList arraylist = new ArrayList();
  655. for(int i = 0; i < field_16_e.field_20052_ap.field_20135_e.size(); i++)
  656. {
  657. arraylist.add(((Slot)field_16_e.field_20052_ap.field_20135_e.get(i)).func_20092_c());
  658. }
  659. field_16_e.func_20054_a(field_16_e.field_20052_ap, arraylist);
  660. }
  661. }
  662. }
  663. public void func_40001_a(Packet108EnchantItem p_40001_1_)
  664. {
  665. if(field_16_e.field_20052_ap.field_20134_f == p_40001_1_.field_40265_a && field_16_e.field_20052_ap.func_20124_c(field_16_e))
  666. {
  667. field_16_e.field_20052_ap.func_40331_a(field_16_e, p_40001_1_.field_40264_b);
  668. field_16_e.field_20052_ap.func_20125_a();
  669. }
  670. }
  671. public void func_35004_a(Packet107CreativeSetSlot p_35004_1_)
  672. {
  673. if(field_16_e.field_425_ad.func_35698_b())
  674. {
  675. boolean flag = p_35004_1_.field_35108_a < 0;
  676. ItemStack itemstack = p_35004_1_.field_40263_b;
  677. boolean flag1 = p_35004_1_.field_35108_a >= 36 && p_35004_1_.field_35108_a < 36 + InventoryPlayer.func_25054_e();
  678. boolean flag2 = itemstack == null || itemstack.field_855_c < Item.field_176_c.length && itemstack.field_855_c >= 0 && Item.field_176_c[itemstack.field_855_c] != null;
  679. boolean flag3 = itemstack == null || itemstack.func_21125_h() >= 0 && itemstack.func_21125_h() >= 0 && itemstack.field_853_a <= 64 && itemstack.field_853_a > 0;
  680. if(flag1 && flag2 && flag3)
  681. {
  682. if(itemstack == null)
  683. {
  684. field_16_e.field_20053_ao.func_35498_a(p_35004_1_.field_35108_a, null);
  685. } else
  686. {
  687. field_16_e.field_20053_ao.func_35498_a(p_35004_1_.field_35108_a, itemstack);
  688. }
  689. field_16_e.field_20053_ao.func_20129_a(field_16_e, true);
  690. } else
  691. if(flag && flag2 && flag3 && field_48073_n < 200)
  692. {
  693. field_48073_n += 20;
  694. EntityItem entityitem = field_16_e.func_48348_b(itemstack);
  695. if(entityitem != null)
  696. {
  697. entityitem.func_48316_k();
  698. }
  699. }
  700. }
  701. }
  702. public void func_20008_a(Packet106Transaction p_20008_1_)
  703. {
  704. Short short1 = (Short)field_10_k.func_550_a(field_16_e.field_20052_ap.field_20134_f);
  705. if(short1 != null && p_20008_1_.field_20033_b == short1.shortValue() && field_16_e.field_20052_ap.field_20134_f == p_20008_1_.field_20034_a && !field_16_e.field_20052_ap.func_20124_c(field_16_e))
  706. {
  707. field_16_e.field_20052_ap.func_20129_a(field_16_e, true);
  708. }
  709. }
  710. public void func_20005_a(Packet130UpdateSign p_20005_1_)
  711. {
  712. WorldServer worldserver = field_17_d.func_28004_a(field_16_e.field_4110_as);
  713. if(worldserver.func_530_e(p_20005_1_.field_20020_a, p_20005_1_.field_20019_b, p_20005_1_.field_20022_c))
  714. {
  715. TileEntity tileentity = worldserver.func_451_k(p_20005_1_.field_20020_a, p_20005_1_.field_20019_b, p_20005_1_.field_20022_c);
  716. if(tileentity instanceof TileEntitySign)
  717. {
  718. TileEntitySign tileentitysign = (TileEntitySign)tileentity;
  719. if(!tileentitysign.func_25052_a())
  720. {
  721. field_17_d.func_25002_c((new StringBuilder()).append("Player ").append(field_16_e.field_409_aq).append(" just tried to change non-editable sign").toString());
  722. return;
  723. }
  724. }
  725. for(int i = 0; i < 4; i++)
  726. {
  727. boolean flag = true;
  728. if(p_20005_1_.field_20021_d[i].length() > 15)
  729. {
  730. flag = false;
  731. } else
  732. {
  733. for(int l = 0; l < p_20005_1_.field_20021_d[i].length(); l++)
  734. {
  735. if(ChatAllowedCharacters.field_20162_a.indexOf(p_20005_1_.field_20021_d[i].charAt(l)) < 0)
  736. {
  737. flag = false;
  738. }
  739. }
  740. }
  741. if(!flag)
  742. {
  743. p_20005_1_.field_20021_d[i] = "!?";
  744. }
  745. }
  746. if(tileentity instanceof TileEntitySign)
  747. {
  748. int j = p_20005_1_.field_20020_a;
  749. int k = p_20005_1_.field_20019_b;
  750. int i1 = p_20005_1_.field_20022_c;
  751. TileEntitySign tileentitysign1 = (TileEntitySign)tileentity;
  752. for(int j1 = 0; j1 < 4; j1++)
  753. {
  754. tileentitysign1.field_485_e[j1] = p_20005_1_.field_20021_d[j1];
  755. }
  756. tileentitysign1.func_183_c();
  757. worldserver.func_521_f(j, k, i1);
  758. }
  759. }
  760. }
  761. public void func_35005_a(Packet0KeepAlive p_35005_1_)
  762. {
  763. if(p_35005_1_.field_35126_a == field_35013_i)
  764. {
  765. int i = (int)(System.nanoTime() / 0xf4240L - field_35011_j);
  766. field_16_e.field_35219_i = (field_16_e.field_35219_i * 3 + i) / 4;
  767. }
  768. }
  769. public boolean func_27003_c()
  770. {
  771. return true;
  772. }
  773. public void func_50003_a(Packet202PlayerAbilities p_50003_1_)
  774. {
  775. field_16_e.field_35214_K.field_35658_b = p_50003_1_.field_50005_b && field_16_e.field_35214_K.field_35659_c;
  776. }
  777. }