001 002 import java.io.PrintStream; 003 import java.util.ArrayList; 004 import java.util.Arrays; 005 import java.util.HashMap; 006 import java.util.List; 007 import java.util.Map; 008 import java.util.logging.Logger; 009 import net.minecraft.server.MinecraftServer; 010 011 public class lp extends gi 012 implements gd { 013 014 public static Logger a = Logger.getLogger("Minecraft"); 015 public ca b; 016 public boolean c = false; 017 private MinecraftServer d; 018 private fy e; 019 private int f = 0; 020 private double g; 021 private double h; 022 private double i; 023 private boolean j = true; 024 private Map k = new HashMap(); 025 026 public lp(MinecraftServer paramMinecraftServer, ca paramca, fy paramfy) { 027 d = paramMinecraftServer; 028 b = paramca; 029 paramca.a(this); 030 e = paramfy; 031 paramfy.a = this; 032 } 033 034 /** 035 * Returns the item in player's hand 036 * 037 * @return 038 */ 039 public int getItemInHand() { 040 if (this.e.an.e() != null) { 041 return this.e.an.e().c; 042 } 043 return -1; 044 } 045 046 public Player getPlayer() { 047 return e.getPlayer(); 048 } 049 050 /** 051 * Sends a message to the player 052 * 053 * @param msg 054 */ 055 public void msg(String msg) { 056 b(new bz(msg)); 057 } 058 059 public void a() { 060 b.a(); 061 if (f++ % 20 == 0) { 062 b.a(new mt()); 063 } 064 } 065 066 public void a(String paramString) { 067 b.a(new mf(paramString)); 068 b.c(); 069 d.f.a(new bz("\u00A7e" + e.aw + " left the game.")); 070 d.f.c(e); 071 c = true; 072 } 073 074 public void a(iv paramiv) { 075 if (!j) { 076 double d1 = paramiv.b - h; 077 if ((paramiv.a == g) && (d1 * d1 < 0.01D) && (paramiv.c == i)) { 078 j = true; 079 } 080 } 081 if (j) { 082 if (e.k != null) { 083 float f1 = e.v; 084 float f2 = e.w; 085 e.k.E(); 086 double d3 = e.p; 087 double d4 = e.q; 088 double d5 = e.r; 089 double d6 = 0.0D; 090 double d7 = 0.0D; 091 if (paramiv.i) { 092 f1 = paramiv.e; 093 f2 = paramiv.f; 094 } 095 if ((paramiv.h) && (paramiv.b == -999.0D) && (paramiv.d == -999.0D)) { 096 d6 = paramiv.a; 097 d7 = paramiv.c; 098 } 099 100 e.A = paramiv.g; 101 102 e.n(); 103 e.c(d6, 0.0D, d7); 104 e.b(d3, d4, d5, f1, f2); 105 e.s = d6; 106 e.u = d7; 107 if (e.k != null) { 108 d.e.b(e.k, true); 109 } 110 if (e.k != null) { 111 e.k.E(); 112 } 113 d.f.b(e); 114 g = e.p; 115 h = e.q; 116 i = e.r; 117 d.e.f(e); 118 119 return; 120 } 121 122 double d2 = e.q; 123 g = e.p; 124 h = e.q; 125 i = e.r; 126 127 double d3 = e.p; 128 double d4 = e.q; 129 double d5 = e.r; 130 131 float f3 = e.v; 132 float f4 = e.w; 133 134 if ((paramiv.h) && (paramiv.b == -999.0D) && (paramiv.d == -999.0D)) { 135 paramiv.h = false; 136 } 137 138 if (paramiv.h) { 139 d3 = paramiv.a; 140 d4 = paramiv.b; 141 d5 = paramiv.c; 142 double d7 = paramiv.d - paramiv.b; 143 if ((d7 > 1.65D) || (d7 < 0.1D)) { 144 a("Illegal stance"); 145 a.warning(e.aw + " had an illegal stance: " + d7); 146 } 147 e.al = paramiv.d; 148 } 149 if (paramiv.i) { 150 f3 = paramiv.e; 151 f4 = paramiv.f; 152 } 153 154 e.n(); 155 e.R = 0.0F; 156 e.b(g, h, i, f3, f4); 157 158 double d7 = d3 - e.p; 159 double d8 = d4 - e.q; 160 double d9 = d5 - e.r; 161 162 float f5 = 0.0625F; 163 int m = d.e.a(e, e.z.b().e(f5, f5, f5)).size() == 0 ? 1 : 0; 164 165 e.c(d7, d8, d9); 166 d7 = d3 - e.p; 167 d8 = d4 - e.q; 168 if ((d8 > -0.5D) || (d8 < 0.5D)) { 169 d8 = 0.0D; 170 } 171 d9 = d5 - e.r; 172 double d10 = d7 * d7 + d8 * d8 + d9 * d9; 173 int n = 0; 174 if (d10 > 0.0625D) { 175 n = 1; 176 a.warning(e.aw + " moved wrongly!"); 177 System.out.println("Got position " + d3 + ", " + d4 + ", " + d5); 178 System.out.println("Expected " + e.p + ", " + e.q + ", " + e.r); 179 } 180 e.b(d3, d4, d5, f3, f4); 181 182 int i1 = d.e.a(e, e.z.b().e(f5, f5, f5)).size() == 0 ? 1 : 0; 183 if ((m != 0) && ((n != 0) || (i1 == 0))) { 184 a(g, h, i, f3, f4); 185 return; 186 } 187 188 e.A = paramiv.g; 189 d.f.b(e); 190 e.b(e.q - d2, paramiv.g); 191 } 192 } 193 194 public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) { 195 j = false; 196 g = paramDouble1; 197 h = paramDouble2; 198 i = paramDouble3; 199 e.b(paramDouble1, paramDouble2, paramDouble3, paramFloat1, paramFloat2); 200 e.a.b(new fl(paramDouble1, paramDouble2 + 1.620000004768372D, paramDouble2, paramDouble3, paramFloat1, paramFloat2, false)); 201 } 202 203 public void a(kf paramkf) { 204 if (paramkf.e == 4) { 205 e.O(); 206 return; 207 } 208 boolean bool = d.e.B = d.f.g(e.aw); 209 int m = 0; 210 if (paramkf.e == 0) { 211 m = 1; 212 } 213 if (paramkf.e == 1) { 214 m = 1; 215 } 216 217 int n = paramkf.a; 218 int i1 = paramkf.b; 219 int i2 = paramkf.c; 220 if (m != 0) { 221 double d1 = e.p - (n + 0.5D); 222 double d2 = e.q - (i1 + 0.5D); 223 double d4 = e.r - (i2 + 0.5D); 224 double d6 = d1 * d1 + d2 * d2 + d4 * d4; 225 if (d6 > 36.0D) { 226 return; 227 } 228 229 double d8 = e.q; 230 e.q = e.al; 231 232 e.q = d8; 233 } 234 235 int i3 = paramkf.d; 236 int i4 = (int) iz.e(n - d.e.m); 237 int i5 = (int) iz.e(i2 - d.e.o); 238 if (i4 > i5) { 239 i5 = i4; 240 } 241 if (paramkf.e == 0) { 242 if ((i5 > 16) || (bool)) { 243 e.c.a(n, i1, i2); 244 } 245 } else if (paramkf.e == 2) { 246 e.c.a(); 247 } else if (paramkf.e == 1) { 248 if ((i5 > 16) || (bool)) { 249 e.c.a(n, i1, i2, i3); 250 } 251 } else if (paramkf.e == 3) { 252 double d3 = e.p - (n + 0.5D); 253 double d5 = e.q - (i1 + 0.5D); 254 double d7 = e.r - (i2 + 0.5D); 255 double d9 = d3 * d3 + d5 * d5 + d7 * d7; 256 if (d9 < 256.0D) { 257 e.a.b(new gw(n, i1, i2, d.e)); 258 } 259 } 260 d.e.B = false; 261 } 262 263 public void a(hp paramhp) { 264 jl localjl = e.an.e(); 265 266 boolean bool = d.e.B = d.f.g(e.aw); 267 if (paramhp.d == 255) { 268 if (localjl == null) { 269 return; 270 } 271 e.c.a(e, d.e, localjl); 272 } else { 273 int m = paramhp.a; 274 int n = paramhp.b; 275 int i1 = paramhp.c; 276 int i2 = paramhp.d; 277 int i3 = (int) iz.e(m - d.e.m); 278 int i4 = (int) iz.e(i1 - d.e.o); 279 if (i3 > i4) { 280 i4 = i3; 281 } 282 if ((i4 > 16) || (bool)) { 283 e.c.a(e, d.e, localjl, m, n, i1, i2); 284 } 285 286 e.a.b(new gw(m, n, i1, d.e)); 287 288 if (i2 == 0) { 289 n--; 290 } 291 if (i2 == 1) { 292 n++; 293 } 294 if (i2 == 2) { 295 i1--; 296 } 297 if (i2 == 3) { 298 i1++; 299 } 300 if (i2 == 4) { 301 m--; 302 } 303 if (i2 == 5) { 304 m++; 305 } 306 307 e.a.b(new gw(m, n, i1, d.e)); 308 } 309 if ((localjl != null) && (localjl.a == 0)) { 310 e.an.a[e.an.c] = null; 311 } 312 313 e.am = true; 314 e.an.a[e.an.c] = jl.b(e.an.a[e.an.c]); 315 hj localhj = e.ap.a(e.an, e.an.c); 316 e.ap.a(); 317 e.am = false; 318 319 if (!jl.a(e.an.e(), paramhp.e)) { 320 b(new in(e.ap.f, localhj.c, e.an.e())); 321 } 322 323 d.e.B = false; 324 } 325 326 public void a(String paramString, Object[] paramArrayOfObject) { 327 a.info(e.aw + " lost connection: " + paramString); 328 d.f.a(new bz("\u00A7e" + e.aw + " left the game.")); 329 d.f.c(e); 330 c = true; 331 } 332 333 public void a(kx paramkx) { 334 a.warning(getClass() + " wasn't prepared to deal with a " + paramkx.getClass()); 335 a("Protocol error, unexpected packet"); 336 } 337 338 public void b(kx paramkx) { 339 b.a(paramkx); 340 } 341 342 public void a(ik paramik) { 343 e.an.c = paramik.a; 344 } 345 346 public void a(bz parambz) { 347 String str = parambz.a; 348 // hMod: redirect chathandling to player class 349 getPlayer().chat(str); 350 } 351 352 public void a(z paramz) { 353 if (paramz.b == 1) { 354 e.K(); 355 } 356 } 357 358 public void a(gv paramgv) { 359 System.out.println("handlePlayerCommand " + paramgv.a + " " + paramgv.b); 360 if (paramgv.b == 1) { 361 e.b(true); 362 } else if (paramgv.b == 2) { 363 e.b(false); 364 } 365 } 366 367 public void a(mf parammf) { 368 b.a("disconnect.quitting", new Object[0]); 369 } 370 371 public int b() { 372 return b.d(); 373 } 374 375 public void b(String paramString) { 376 b(new bz("\u00A77" + paramString)); 377 } 378 379 public String c() { 380 return e.aw; 381 } 382 383 public void a(a parama) { 384 fe localfe = d.e.a(parama.b); 385 386 if ((localfe != null) && (e.i(localfe))) { 387 if (parama.c == 0) { 388 e.g(localfe); 389 } else if (parama.c == 1) { 390 e.h(localfe); 391 } 392 } 393 } 394 395 public void a(bo parambo) { 396 if (e.aZ > 0) { 397 return; 398 } 399 400 e = d.f.d(e); 401 } 402 403 public void a(h paramh) { 404 e.N(); 405 } 406 407 public void a(dc paramdc) { 408 if ((e.ap.f == paramdc.a) && (e.ap.c(e))) { 409 jl localjl = e.ap.a(paramdc.b, paramdc.c, e); 410 411 if (jl.a(paramdc.e, localjl)) { 412 e.a.b(new bd(paramdc.a, paramdc.d, true)); 413 e.am = true; 414 e.ap.a(); 415 e.M(); 416 e.am = false; 417 } else { 418 k.put(Integer.valueOf(e.ap.f), Short.valueOf(paramdc.d)); 419 e.a.b(new bd(paramdc.a, paramdc.d, false)); 420 e.ap.a(e, false); 421 422 ArrayList localArrayList = new ArrayList(); 423 for (int m = 0; m < e.ap.e.size(); m++) { 424 localArrayList.add(((hj) e.ap.e.get(m)).c()); 425 } 426 e.a(e.ap, localArrayList); 427 } 428 } 429 } 430 431 public void a(bd parambd) { 432 Short localShort = (Short) k.get(Integer.valueOf(e.ap.f)); 433 if ((localShort != null) && (parambd.b == localShort.shortValue()) && (e.ap.f == parambd.a) && (!e.ap.c(e))) { 434 e.ap.a(e, true); 435 } 436 } 437 438 public void a(hh paramhh) { 439 if (d.e.f(paramhh.a, paramhh.b, paramhh.c)) { 440 bm localbm = d.e.m(paramhh.a, paramhh.b, paramhh.c); 441 int n, m; 442 int i1; 443 for (m = 0; m < 4; m++) { 444 n = 1; 445 // hMod: Remove the char limit, for plugins. 446 //if (paramhh.d[m].length() > 15) 447 // n = 0; 448 //else { 449 for (i1 = 0; i1 < paramhh.d[m].length(); i1++) { 450 if (gg.a.indexOf(paramhh.d[m].charAt(i1)) < 0) { 451 n = 0; 452 } 453 } 454 //} 455 if (n == 0) { 456 paramhh.d[m] = "!?"; 457 } 458 } 459 if ((localbm instanceof lv)) { 460 461 m = paramhh.a; 462 n = paramhh.b; 463 i1 = paramhh.c; 464 lv locallv = (lv) localbm; 465 // hMod: Copy the old line text 466 String[] old = Arrays.copyOf(locallv.e, locallv.e.length); 467 468 for (int i2 = 0; i2 < 4; i2++) { 469 locallv.e[i2] = paramhh.d[i2]; 470 } 471 472 // hMod: Check if we can change it 473 Sign sign = new Sign(locallv); 474 if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.SIGN_CHANGE, getPlayer(), sign)) { 475 locallv.e = Arrays.copyOf(old, old.length); 476 } 477 locallv.d(); 478 d.e.g(m, n, i1); 479 } 480 } 481 } 482 }