From 3975ee193e52f3fad1616301956e6ce6d40177b6 Mon Sep 17 00:00:00 2001 From: travja Date: Wed, 20 Mar 2013 15:13:03 -0600 Subject: [PATCH 1/5] Updated to most recent Dev (3/20) --- bin/me/Travja/HungerArena/Chests.class | Bin 5624 -> 5638 bytes src/me/travja/hungerarena/Chests.java | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/me/Travja/HungerArena/Chests.class b/bin/me/Travja/HungerArena/Chests.class index fd7e33e58889f14789cee08d6b07eb6c8de439f5..5bb67a69c45b9075dc78d6d7851dcf60eb0ae21d 100644 GIT binary patch delta 28 jcmeyN-KMjlmYrWF+M_ftJ+;WOC^auJR$+4;dler5ncoT> delta 14 VcmZqE`Jug`mYtDra}RqJ9{?$}1m^$% diff --git a/src/me/travja/hungerarena/Chests.java b/src/me/travja/hungerarena/Chests.java index 0eb9b69..45b0302 100644 --- a/src/me/travja/hungerarena/Chests.java +++ b/src/me/travja/hungerarena/Chests.java @@ -37,7 +37,7 @@ public class Chests implements Listener { plugin.getConfig().set("StorageXYZ", list2); plugin.getConfig().options().copyDefaults(true); plugin.saveConfig(); - p.sendMessage("Chest Removed!"); + p.sendMessage("[HungerArena] Chest Removed!"); } else { event.setCancelled(true); p.sendMessage(ChatColor.RED + "[HungerArena] That's a storage chest! You don't have permission to break it!"); From 3bd1f1f87a585827a1d4f2babf8952274852532f Mon Sep 17 00:00:00 2001 From: travja Date: Wed, 20 Mar 2013 15:34:45 -0600 Subject: [PATCH 2/5] Removed files --- bin/me/Travja/HungerArena/Blocks.class | Bin 1899 -> 0 bytes .../Travja/HungerArena/DeathListener$2.class | Bin 976 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$10.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$11.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$12.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$13.class | Bin 1164 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$14.class | Bin 1011 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$15.class | Bin 1250 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$16.class | Bin 960 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$17.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$18.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$19.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$20.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$21.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$22.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$23.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$24.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$25.class | Bin 959 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$26.class | Bin 1164 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$5.class | Bin 1248 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$6.class | Bin 2931 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$7.class | Bin 957 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$8.class | Bin 957 -> 0 bytes bin/me/Travja/HungerArena/HaCommands$9.class | Bin 957 -> 0 bytes bin/me/Travja/HungerArena/Main$2$1.class | Bin 4103 -> 0 bytes src/me/Travja/HungerArena/Blocks.java | 25 ----------------- src/me/travja/hungerarena/Blocks.java | 26 ------------------ 27 files changed, 51 deletions(-) delete mode 100644 bin/me/Travja/HungerArena/Blocks.class delete mode 100644 bin/me/Travja/HungerArena/DeathListener$2.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$10.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$11.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$12.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$13.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$14.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$15.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$16.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$17.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$18.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$19.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$20.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$21.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$22.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$23.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$24.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$25.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$26.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$5.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$6.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$7.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$8.class delete mode 100644 bin/me/Travja/HungerArena/HaCommands$9.class delete mode 100644 bin/me/Travja/HungerArena/Main$2$1.class delete mode 100644 src/me/Travja/HungerArena/Blocks.java delete mode 100644 src/me/travja/hungerarena/Blocks.java diff --git a/bin/me/Travja/HungerArena/Blocks.class b/bin/me/Travja/HungerArena/Blocks.class deleted file mode 100644 index 35982cf1935ffc9c8d2cae86ad769f169fdc4077..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1899 zcma)7YgZdp6x}xjCJ6&*T4+IpV724{jBVAbsjUz|ib+7gDEO#1$t4UK?!>VCUzdWJX_(lg4Y>j^0w zhJlXdw@gXS%dhud;ifE--91y9-hGDY?Ee|&Y7Fs`-4rSGVMs?3!wh}dTrCMgr$a-6 zVWezIQT31N!r9?pSP zwaSl()2rn7zjoO698bOR%l=R>~qU~*pjv*O5CNYogwKo%AV@8FLbQo zA%pG;uf%0TSe9r~sO(;@rr}G5Yp+&&$v3U0a8g*uP!d&aYS^H@h)_{F;9kkLY)8je z*dnEFtt>N)McIF8LiJw9j*hQEq8Z?wj*t|7KFZ2zQ6qH@Q|KX~Dt$}x+_n8ogUeYj zQ&+0Z1ln{nzZ?jeIkEj&M`TnRQ|ryBn0qSbcdvvxrRKs=>f{ePepK2>cy?&7+;q`yi=n6!N6p=^hlw3)FE|6DWpjgku>@2$Uvd#bKq&34Q+e8(XQ}L zZwjWiZQp4K)$xQm9C{0?(v%7njIMsVNUccFuOdcoNu=mLNUK#^$LN{LKZTwz{Em@d z1DiMLK1^o;9dQh)DUCF(#zJdc!Btw(IgFB5<$Vm-=-YML8=%!VJ(d6Gk3!5kk&^I~ht=#H&pBtbGye1U*KYuAJhYKx*cl7=Nb$*tyRTC@5bC)SlDjVj z*F!H%w2(s8+BWhGOzVDBOuWhU`ROaZ%R7&2D1jCvhhDq&!R2J4ARA z%1}RJsMl9wG>#ea-8c{hFr0T_W4#CqB?kqR8LYY~D0!h2@6vH!sH16L6)*OAbj(#~ z@)?*n%`)t+Vq9xevzAI_5m#`{##M%`SPk5MdU6tK_eB;QT*nQD!a(SrP!pjTF4Y^} zLfsVZ7?E2JZsQKUE>(A9nZ%Lk2^kntYnkN7<1v?kJFDtW(`j*M9d{XuLta%P(Ol^b zY-7hpZMnaxuY>#8rRNF4HQzIYXy z=~tGvXWtOW?NItroDkuy(8D;e@ql4_h3#;#50{1<%MTGh6)F>F*jwsVOoY@folu{; z3w4JE@0ew9-bh;IZp4#BB&gEbSai;TmCI&(=$FXRDWFK`2HhT0ZjfTL^&L+02R6TD zHCqPDz8LlwR48|dW6%q@NRg(E@=WDv<^q(?aQO^3E7hO4XW`TTQhjV9Sdc2sq%71) UFoy=36!U0d4+ohQ%Pi^o54@)JZvX%Q diff --git a/bin/me/Travja/HungerArena/HaCommands$10.class b/bin/me/Travja/HungerArena/HaCommands$10.class deleted file mode 100644 index 8e1af1924aa421f4d434d48ca35ac9625b86f092..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmah{U2oGc6g_UrvUY)XDdS@d7+VKv2TKPpNI^(b1!7V=J~|Bvp4`M_=~4$dN&gqp z0Ko%4fFFgpUMqE?KrLDJJw84@zW4t8_5BBchuAeyVAvcA_fYZCfV(ep849(hgrq%h zC&M9^L0aE!nJ6+;2Ykfcn9I<8*&hf$GqJ#6PtiBIl)N7chK1}nO6x6#jm|uEkJwKl z8D&oyww(F&#t}oYodlu;hKm+VES6!QVxfd8gW+gGr4vbUkPrJp9gZE@oy6zy5m%9p zCty+Aq-W>8N+}?phRS6LS8?6MHHP(hKeMok8}z%6aUMpJVeKE!ba^DbGH&9wiCYY- zf7jJ43+uSUPzpuX6KW(B!-~`BBr0_K`N>I?xntN{#3loKw1h3(GjW$;d4^-bL4%6g zR|yY%o@QN+Ah2)Og2W?Mo?CJLYLBQc4=tj^+ih zYE?H3b$@|o31vc;X!n?6jg*_)pJ6q>;?k!x&a%eNPUyCA0Gncq?r5}z%d}FuP@Smk z5mTSlny0W%apeov?2T`z7x4BEIpY;<h*)ua!Dcpq4EA9v>ec-+O=l`u+pJKK4u$7&eE(J5qc!;NGiThC&@EA!*N> z$#BSJKdtW(vB*#v@DcZ7E<^84Zy|7STtzyb zfJJSSo}K$DrGR`IDwh^+;@3Q>G3+m5lY#9oVGEB;JY-m&;n;BCQc-&< z;r)Q8SzDwj52<)7PHS4zPNpIm`tBh^sgvX?5HBNL;qtUUb~Kxi7cz*Gl-O;NohE%7 zJMhSCA}5W+@WHw4H5m7oH#zPI*%!+H55u4J^?nv|PZ;b&DTQjrJWWMPNu%1)yaHCK z=!T*0FVM75B6Nv%Pbt<&sj>YTcH=9qeY)T*YwY5LZW|p`DYog3Mr*iEE2RsSiOK;n z^;xZP4*MK8zF@7o@eTC?j{lG|-l1xAFUi#=at0bCP{1}G(^{lvdxBlsX`@=2#%~Ck B>fZnW diff --git a/bin/me/Travja/HungerArena/HaCommands$12.class b/bin/me/Travja/HungerArena/HaCommands$12.class deleted file mode 100644 index 9a2dfa85b05a938cc6b90e2e0b28c47b30b79e57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmah{U2oGc6g_UrvUGuVE#qSh7+VKP2g|xAq#&fJ0x_utiB1D;Pi|_mbg6@!r2h+P zfZ%~2z>h*)ua!Dcpq4EA9v>ec-+O=l`u+pJ9-1Z!44XsY9V$K=aPL(vL!tJSkhJHm zWH{uqpVpguCW;J|0UvQM<}&o&^adixOe`=|r|8>UO5TeF!$Ni%rS)BgjrKfspV-eL z8D-BIww(EN_lTj`O8UYA!&Mt57E3Ttwqc>dU^tpkZbwqQ&WAmr4#$qF?Ihsw5m%9p zCty+Aq-W>8N+}?phRUUdo49S_7Q_0ypV?T&9s1qJI1eMqu=bB$9-D_oxT$Bt$b@=(h15Rf=u8qtP0!(@N<=WumfA zOnp{soWnlHjW1ZMZhS+%fOmh$8ONv^Czs@E6FCD75-4CBk7+GZvpvBs?X*!XP2)Ea Cv+C~v diff --git a/bin/me/Travja/HungerArena/HaCommands$13.class b/bin/me/Travja/HungerArena/HaCommands$13.class deleted file mode 100644 index 1bc267cf64922e0fca304c31c91cc146abe9656e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1164 zcmah|YflqF6g|@|tSt+z1$-cCfue1BEDsg6;3GsLNzud-Of*KP+i}^loi($&{oubc z0gQg|2l%6mcW9H66zwLnbLZZ>=iGbe?C(E6e*sv-GZP7hxt6f^6>m4W{W6xWP|uZ+ zWb^Hy)#9=d7FO3yBpI?z-sZN?rE9;gH-!_K7-q=zyl-MDdEFNb!_lD^7FHN$tAo%h z3}&1Ag;wYiSha^%i_e%$b;Fn7SBOXIUsz3=;7B`Ve0l~Sl}pNF9cktZ=4w1$w#X09Y@L7RCo$p|k#w(s32nXlJ;Ni7u2wnL4&qKE~KF zrjC(6#hvcq6boc!f51-QZP%AP!Tlal4oSfHh*9GcW(zo3B`ZzTnw*}$S!Erl diff --git a/bin/me/Travja/HungerArena/HaCommands$14.class b/bin/me/Travja/HungerArena/HaCommands$14.class deleted file mode 100644 index 5a72c767c4da4972689e0f950947fc70791ebc50..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1011 zcma)5+iuf95Iq~4I!R5PhWkBjQ^*DC79oKYK!OMaQUIx`ilDq~oF#GUtkK%efAN4Q zJn#X06k^t~NZLMxht=*LpP6%ZX8ill&tCxUW5+^{VPh=ZJ;f&@?!HRoK&WR*NILU& zI39D^kE%NlESLy3mLTUcT!&(PgOO5O_u!%{r-qv|%pdS_Ag7O@}u z(vP1qY}OXj>-!95JM4=B7|zC$!60TUd%&;1&f!j+C5B=DEo^Cd-;u=F?AmXl26QLL`)aso% z-V|=>BsXl_#4V~SvD=}H!a#I|?CYTB@gQ&72RCD7ZJCl=d8{$yhrANST*b@Sz@~-j zad%Ty8@F+XO4IkFFFf{!SssRmwRwv(wY2-0OlQ{RZmfJcXw^S56uV)fJn_=kJ$Ggk zv!&UDypUcHM#O$2;$hggaF?O7XdrBC!KEsO@}I-c|Ko73%qQN^I_>`8G^8J7zm`&{ zcEF=ZM5xe&8MMxTl}dWh=&#AqDxgT{GMygLT_eRt^Be5OcdUF(Ijb5=zfiRK0cE<| z6r<5|I8Qr`21;3$C#eeH9O2>-u9qu6ux{Y}iB#qRR?JUxshlj8ff^;up^gUaCYrd1 L?No}Tl63qFY%>6h diff --git a/bin/me/Travja/HungerArena/HaCommands$15.class b/bin/me/Travja/HungerArena/HaCommands$15.class deleted file mode 100644 index d55824c20ce791b217d802149ea2e1330b058042..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1250 zcmah}YflqF6g|^cmbR;{<)x@lplDkj3n;#pM{46MDH;Vy)DLFbj%8sxOZI`kOCu09 z@dx;$jCa~Et= z4!E83gscl!ML2H5s0Mp`mT%PB6pRj)&6W>E^sQLZ^4A!i=6fgT4OrM_h?SkXh=U=e zLqosXUDgptB7rCdbR;pz5X~#sRK=3wMbNAYcdK1*rsCANz0F-qojb;u5`kg5CqojL zYKppn)NqYqq^szr?^?3)D6nkOCV^25#4(1fhH-|$kWS?t?w1|gadk{!l8Pz4dQ)N; z4wwGV$5cQ$9n-i;O7i`EQk7vYU+Ly;_tz|hO#e|a`;jLGCELz!xmGpsg_r%r-F;D? zP~b%cK63)I4R8*oik#Ci4}+oKciR4xC4ZWRnZzP)Ygl5)hGaN%Ty)&QGDA`g*oN>t z-k<>;3RnA=8MQXC=>%>~Jh9Xir@G(3ywZj&k7dnvJnG4Y@OPZLhKIzU*NE#_!74-C zk)1ha_?Qp3=1kt^IUeSz#+dIlM&@(NafqIYRsbm$`+#9Ot3Yzc2(Hk|a210c zsEt-iV7&Mh=^q$ADacObmPzyd>MioQ;zlMh+DX0 z;5NhR-*q+1#5(RW6nv5Ngc=FOuwvCak@9UfJv|K)dki~^*ks7GnoHQieFOIxmS;#N zEYzv0u8Mfy<8jgzam;AL7kD=I$Qss#kfi7`r+8{fcO~`ZUg;7lG zu1HRzzKI>!B8_b>@_k`>V<@|@?%=&sW3)PPq%snZEYKJ_IMNCgr;%~7{KM3Z*f IsFtSj8&%Tm0{{R3 diff --git a/bin/me/Travja/HungerArena/HaCommands$17.class b/bin/me/Travja/HungerArena/HaCommands$17.class deleted file mode 100644 index 9abc50cd4593232d65d73e494c5dd92cc2814ddc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmah{U2oGc6g}?8vUY)XE#qSh7+VKP2g}9_piGmd3dE!qBsvWVp4`M_=~4$dNq-T7 zXQTmw2YvuQ3UR$w>O_HBvg~_&e0+TG{rT(r4*(CaV<5+{J`m2K;=?|7o@Fu+YF`OS zd)|r%11|lfvGdSCfuY*xL+(Ue2F{CKUwEm3IfmKuQ#XRorGM1tRSVH57_r$+FwA3Y=bcauTM_2zKYO&cGfoU;}pz++kRp;+U{t zQ&D>==Dx?1v?G#)2UNTzt39b{H&vkwT>F5b+>JBkiKn5iaAndTTbfPC6X`{9LhO!6 zk7M7&7927g%W)$yytU4I^+x^WjE}oQ`a-$?VYt)2-b_RGYX0ux|(HT9d{W@zDRmPjfG-Zu^XL8`A$DQJq;3P0=tXYWMHi&Y~j9vdko7n91}Jg zRMftT_`u_F(iL&ceJb9H-I><3m#9GcZsUNV+>27>iD!YXaAn#bJDN?%Q|X0KOzf^m zPNIQ{9XMn*l361$ytOZS^(Ou0WXC-r2SU03VYsut-poRc*9_)?ltQ&b9>*f4q*3i? z7Qw1j-7wVsIhrMu30-zuz diff --git a/bin/me/Travja/HungerArena/HaCommands$19.class b/bin/me/Travja/HungerArena/HaCommands$19.class deleted file mode 100644 index 4be9c51b8bd15e220531f316b1506ce9160dc51e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmah{U2oGc6g}?8vSxvHE#qSh7+VKv2g}9_pdh5F0x_utiB3b>p4`-A=~4$dNq-h% z(g48&KY$;FxLzZ5qChQK_B}p6KEC(<{Pq0@fJfLdkYiXM3TI#O(SSRzQt1n|tAwOI zZ$-l)m;JcD^VC3rp)%kj?u1OhJou0tFwM)VHr2+cOSyk4IwFp_PsLlZ+mo7h6BS6`ZR|0a-6&O_cp2ylmnZ$PrP+kMkX{(Y#O{dX zIO<#2fTqhCA)+Xc}r9GFW?33e^gE9E+HeMzy0^ z1glhZ!%+9$OrR3e=Ki-{a%s<9qMVU*CTK*u@hAIfl)la1Iq84Y>0U|2|x!=&C~*yzktcZvNx zlwtaUVauLRZyYfc+OaQ6V7Ow!z+xGBR7{jmWysr_Q0atH9Av}3P={kjRwwp&bi`Gt z;|W;MHtE^9uTl!gXI^Epgd4bJ;3mWRyq}p^#clfCrzi_T$*}g1XSzI;ZW(uQ&%j-V z)xYa%mWg%TXD9_C?Fls!iebfWbYc}a{p{osk9#7J)ND>}U@mB24w5GjOg)(p(`wZn?oGDMd3U!4m)Bf1eY(id2FNzalcSU*} z`zChakl9#H8j0bfec7uw?k{I@+!N9l%KZ<+o%Qu$7HYg_F!!YtsvYqp5eX%YYDcpO zR;}uWq3+MoETK&3678N*tdVka`wV9DE3SUN;4EwG;)HG&zrdo{q&pg|;To-!E>tHf zd&JadwdN_zQ(QmCnziu_^&H;)Ay+(uRXo2WSDVP?(IkN!w(*G80yW!Xv}mV|YH1q3 E0dDH-2><{9 diff --git a/bin/me/Travja/HungerArena/HaCommands$21.class b/bin/me/Travja/HungerArena/HaCommands$21.class deleted file mode 100644 index a27181561e54f1076ecc4df30a829f18838908bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmah{Yikoh6g`tix4T_UnphvTYHd^9q}r_oL0Az=P%I=BOlhHhnrz1Hrkh!r-Oc|J z>Z^i3z#k>vX#y!m&A>2o&zw1P=HC1B*ZB_sJ9uIs$FM#S?t$XNK6hVdG7xH42}yh2 zj0XcQdr57Fhy{jnpAWekaT&O8x_#lN2Id$l6ZCB+CGSRpVJ4Lo32oZ{GUP^Y4H zRm^)nPtvwX5*|?TmYmk4rkzxUGVtnq3|1%3lrLU|y27PNe{5+sAupvL#R;+7B0Y(F zHn!lB*;tMniQ&C-*{eV5FL!+05wa(g_aBBg?d#n%R6l00_oNi68Sx|$2_=ncN3#f4 zF6)M&?$6OQVG+7OyJr+@#Aorm*3e=Ki-{a%s<9qMVUthifXyJi@9K+^FIERXlhunFdN?)iwB_!>6 zI~t9+9K`ij%RqslI^<*Sgk1X0i~dk}iGc+MYl^;1rR4okFf1g;L0sQu*yzktcZvNt zkU{c3nJRT=q5y#x8;;q=7X-#{H3Z(Bg_8H2(C{><#7U&9Brv0&_*@QfmUKqv1?uz6% z8kpFDLuMnHH4?*H`@C0g(qB$?+!Jyjl=~lsJL~JsEYx_-VD3vPR6FExEMiI;)sAKn ztXkC#L*1XFSwfl6CE7irSR>`;_6L~FPq_I0jI*qi7V z0|XB|Ab8O8wrNF^dwAb+YD>1S?V6K zpM)|@pE7JXv+4CihC(y$2@?#LEEt$CA&;^J6E;KM(S&jK93H$ z3UxdN3)&_Dd}k$AW`8 z6}78k-t&2qwndWgfQq-|v?ev}q$-qwSKntSb>d9<;(4emT%PpDmSz+3O!`rr5W6kX zlelML3oe>9vWAg*7#wT2Uf6iId*!c^T4c diff --git a/bin/me/Travja/HungerArena/HaCommands$24.class b/bin/me/Travja/HungerArena/HaCommands$24.class deleted file mode 100644 index e83b507685657a8670a2cb4709628b4e249b32ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmah{U2oGc6g}?8vUGuFE#qSh7+VKv2g|5OkOTGMW-LK%4VeTGsu&Xg}+gu24zX@Bf!HX+ZYAH@l=J0d-f z`xbWKlG#{J8j0b(bJ43m?k{(8+!eAfl=mNoH|y)&EL4BXVC_pOR4d|1A`(g()sAKn z%(ivIQ1|C(nkW&vM7t*xYoyfJ{sgP>1(!dbbCxxBenPj4KTx6AqB|O`;tH*lF4z;5 zJ!0y!YU32vDXxCTT4m!aYB{|5L$3G}mEze2x#~nNj|K_ku#E?_7O2@CVwZN>sFtSj E8O8wrNF^dwAb+YD>1S?V6K zpM)|@pE7JXv+4CihC(y$2@?#LEEt$CA&;^J6E;KM(S&jK93H$ z3UxdN3)&_Dd}k$AW`8 z6}78k-t&2qwndWgfQq-|v?ev}q$-qwSKntSb>d9<;(4emT%PpDmSz+3O!`rr5W6kX zlelML3oe>9vWAg*7#wT2Uf6iId*!c{$Q+ diff --git a/bin/me/Travja/HungerArena/HaCommands$26.class b/bin/me/Travja/HungerArena/HaCommands$26.class deleted file mode 100644 index 346fc29d39ad2a1075fee55dc590ae59ec1167ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1164 zcmah|+iuf95Ivj3HA!6((w0jp&`SzQdT}Yx0%^IZqM}j?5~+#=Pa9`(ojPl@w)4PW zA+<&Dzz6V#xO@&`wuzKVDa6uxXJ^Le%*-Bt`}5^1fE7G3kzkl@342%Zc9YxBW9bU@ zR0&Bo-wawUE*oKCWz|HAA=l(>Zu?xi_RD%xIFX4VhJ4TaDwdMheZepk?R#NinPH|n z2))8!wz*$ug)V_rduX*tdD5lu(7GqR=n=zOaWGmxKxvO5wHY)-8Vp$rCeCT=f`v3P z86+`kVHjf!$)ZlpRy`?R#I3qeyPan8)xhEY9#@_|cbzHSA;a9jifDS&LsG>ujjOn3 zVv=EM&`>N~#|`TIy&t=tWSIO1%?|fuC5>s!nwVjjI2%`IStwwR5VutDK@j3-XHaqE z`E=FceoaJ`3~r%hqDaFzxrWn03uQec!|?@I8DdTP;H?Y#*3wDpj^8i z9~^j*-Emijv5XZHw+Xf{XyFd-lC^QwIibapkZMHB&l>DyE12ZS3F(3(^0?O z4cCNh2vzw{My0>rxBadXm1=EEDb%LV!%&2nA~7au8A#-ETAe^HueC}4XoA)-EQ*eh zwL#}3?b-7D5zdzvj*u&VLjL1P;yArCCm+x(jPJNeXZ<0i;}R~@&Ts`|T_}e#b!@SG zi1UY-IKQ);!d&+QPV1?mvzJG%LfQ1c)XxXic7#NZU zbPTH9SpzY|)4Kid*B(2KQ`r?iiy=1cqE+hPg#5 zN%KOf;{wB2SJ1V@VFFnl8HV8=naZ0yD7%j98JNTr)lz!#s>Cqb zTlqg9O9AB!T)|ZmlJD%0s0_3DN;hx2y;h;e^dA*#5P4!ya-8hCXIH~O_}TZ|+Y$9i z1zuF((}ytI04HFo$XNq(Fc}5|x9v|^@<(Y{30%hw9SaQE9vP0E76Ui2$dFL;wJLm{ zH)uXbdaM1*j5-@%b3?Bt9@%P$lie?1PH97yhqC6lKJ{c(1ensNFY zMCeYyptq-Kw@hb^)?{&d4`+%qdq@=zkpA3q9HD2t6+ntYwqrr%ASdz(}2oX&%n2A7QAYh1F({q_=Xu7exhb8X2 zao4CZWYyAOEMKgGnDHUyv;GCE{1d)u8PDx*n3+ICs(SkNxo5fe`_96z|NMLdz&3m> zBgC*_geQA!b!iacLp3wW!vjNHb7hn> z#0%1+Inz`J49-yQW_71-3;FI?%6SVzWK1>c9B!t$Ei5cMlN`tm59@AH^G}crPSWk^ zkcBKPMw|?V?rI-p~&Q@LBGLwV4!ISOu)8^?0;+6_DlKr@48)+wkO-Rbv%#bWeg{9pn z*n+JLRT=L3xzM3IF2R^sgh5}Fb9Eyrv|6Irj-4`gFf8*jYJNw-F6^e1)13n&qwb`~ zWPcP7phZSA!Ci7juV6~kRl#07$WSQ`#qBYX>0oW%Jgkj@i=PO3k(I>|}Aq6p}Ns*~;JF5#5JxQsDkxWGcN zsbE61o-)ngsvW^eyddNG(p1>*HChEP;w6HK;Gnv6EQ9;4mZ7mURSON-(<<%D6?ld6 zJge3os3(D=ojX5Jyl)`Zz*^i?=UE$ zrnD?i=L}I+iPEz=b2~}@lJlBgrM;`*JyB`pn&Yar8^s6sNXCcMEsE&AtqTPo;}gms zVoc*kkLnClHd6&si;oqN$n(LMgILfWeAOrQiCntDM>Wy@vBS6#N_DQ zsHnRo+}?$twUT{Rx2tNyo$6>XVItjD&epi-#KcZv)^8R`M3MuhW>^l5(@ySYt+awm zxJ=|)<~)Ie|A)Y$yWT=^%ffS>SSYIRCzeyD$?Y~nbsX-XmZqyjPZ^|GOblKi78hgJ zd(+UR|7=3^RACuuRnuxeeTV72vY~Mnv4*Bu#2Yrv(&tZD{iCN{L%$KviY%lvSWDju zS(6R!#5#I2+=Vs1zfd*Bmq`?Bm_cj?ch8_M-f#^~9gTTxV>pZTv=Pr^4}-7KdL8@o zI2c0TG=@m2i=k^8eVg()%J2)?Is-@7@I+G{$3tii*M#$Uiow%uE}uqiO?jZLHJ8S5a#jb+yzhN@qP#b%P<6%?N|;-XAzU8P$QkgPU!+t(nXw*E@48tj8pVJ zO|tXSH@GT&iy7$(Zb;MkP5KUhNLTTv^gXMVe(-qMK}-|Y0S_@Er4gSJ6Db_RX<{iv z(_s%j!{-!xg5rLGGi324okB3^>z}376iJRj{#y+B?Kdf5!ZH{wiOO!^CYm7o0vT;2 rl4*8$JL?wFtw1O+#$VK;C7dJYA)LnrdWUI@U&L3micnaQMD+JBzc~|# diff --git a/bin/me/Travja/HungerArena/HaCommands$7.class b/bin/me/Travja/HungerArena/HaCommands$7.class deleted file mode 100644 index e60c2f25e9183263c17b645334d83f71c44a0a1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 957 zcmah{U2oGc6g_UrvUY)HE#qSh7^8!vgJtl*kb*#^0&P+Y5}k$wPi|_mbg6@!r2h+P zfZ%~2z>h*)ua!Dcpq4D(dwhI+?0bLy`u+pJLp(51VAvQ6??CaFG^rIZ^6W383rmAO0XFWM-wXTNQzhauqV{P*ip5e1Ux?ED$@A` zENYt!^|`m!cgd!qa#_M+ihmmAh`^POE9!bB9>$qv+2E*## zbv4VvI&LwPLXmZa8VSX);<)WZgwcl$FVHNZOz09tk15wkxv}*bR^ux!d^+VUYwUD~P8-iqrQD)38m-|Xt@K^6Cn`;1 z>b+Xy1l9>IeZg9F;~VM)y!}JYXrgL7KOQ4Xw diff --git a/bin/me/Travja/HungerArena/HaCommands$8.class b/bin/me/Travja/HungerArena/HaCommands$8.class deleted file mode 100644 index 1541d8f6c1bb1998f2545121e953a8287b0ab59b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 957 zcmah{?QYXB6g_UrvSxvHE#qShHbw_Y2g^W0suYAY6$X=9kmxid_~oW1OP4yxN%~$$ z0|Y;K03Hf)y;kZ(fm*VB@A2{RvG4u)>-!G?kMPh$fnjqfyhFuD1Ma=dWhm615|U!x zN`^x&`)R#tqR3Dg@DcZ7E<^8iZy)(vW@8mM=y4z8Jd7m6+COgT@JRX=ZercUEr!*< z>uQ#b4culZg(B+;H4=(p#c|t-3cX%_auQ|U81@%&hk-p_!WQnCxXZ9S!?EGOrJD9s z!utVFvyMnp9#ZXAoc6S&-AqL?^xXpntDEF15c`oXaCzDtJDN?%a~Z@*O6-ovj+4HP z9e89mk&`xJ_~4xP8jQQkn{0Q5>%0a z(fvZbU!YlnMd%VmP0BT5HMT#)ZhXb1PiLHEjh*e#Y2z8Hl-qPhqcvQnmA(s=iOL=^ z^~~-u@wH?4xSDI44(|$QfvmKmpshPiv8y?E!Wv(nhs3jo**m B>R$i= diff --git a/bin/me/Travja/HungerArena/HaCommands$9.class b/bin/me/Travja/HungerArena/HaCommands$9.class deleted file mode 100644 index 302ca57ca75f1baa4d63579c63e10450bd11c8e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 957 zcmah{U2oGc6g_UrvUGuVE#qSh7+VKv2g^V_Fa;q^6^M!yBsy&pJh`dK(xnb^lKwBG z0fGm906z+Gy;kZ(fm*VB@A2{RvG4u)>-!G?kMPh$fnj4P+yli&1Ma@eWhm6X5|U!x zN`^x&`)Pg8M3JE~;3MwFT!!wO-arJIi3Nu06n&dZ$$PP2Sjdi}w7yH){ycGy*iR!F zWzQJ4ocZ*|Aw#j1^o0e6i#ALwmSCW4!$O6@a5SOpM^e1bhdrSV#*V6f67cwtt4QY) zu&8Y^)aTw>-y@rb%B6*?xNhPa!}`33*;vI5dfdl24uQ#bb=+aFLXmZa8VSX);xzn3g>ElDIf*iN410^%WMGe%u!Vaj?lLUTaBMheP)&O( z;r)Q8Sx2NP52GAaCzDtJDN?%a~Z@*O6-ovj+4HP z9k^sRk&`xJ_~4xP8jQQkoosi7>%0a z(fvZbU!ZBBMCcMlPbk+&sk!|bcJnJPeLCYTYwT=?P8)4hDYxm2Mr*iCD}5I#6P0~p z>b+X?6!s~ue8F0E;~VM)9Q`3@yh7FR&&ky$at4|tP{20s(^{lvdw^Yvv{5Zh<2RV~ B>Tdu5 diff --git a/bin/me/Travja/HungerArena/Main$2$1.class b/bin/me/Travja/HungerArena/Main$2$1.class deleted file mode 100644 index 29720b32f294edac4846520b1e90236ccc5a421b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4103 zcmb7H{d*Kw6@Jfd$dJtx(xtR~yJ&<22wSk)mVlU~K~fW-B!Z-Yv~b`lHWdeDCbnY@Y<|=E=^TbMAf5 zx#zs++`Di6_r;e1Y{X>^A;F3fGv1dr#)ggf_N%SnZ^yo?YF^#F2^(J z0=2c9EywacF1V@b%0M%$Zr&rP>2L?lItb?L&@fkxuGLY8NCaUl&{2=;1mPw%b$++y zm^-o~17^Cfu!(55n=tG>M%q&EMPZHFnILvWcN#a)_i#GvM6eXgH7pY>yHXr(gih-+9ch`&!T9XEnhiX=_1-F0o#a0CmR0vYf1(w38KZSGgje?-Sk_$Y&EGkeO# zGPkmxWyiN0nN*K4+8V*lxK+a~B!o}Api;*ss07lWU{%mkf%mP=0pmqc1Y59G1F2fT z^UI`2WF4PCn?NJgv*ykr!SzjDL5LFHHFVI~Ky(xV)fOUXN2iW$_$2p5ulBlWdr)v) zQ*$sezO=O-UHFuS+gYyxBwwea8$E?U?y`-;W|~Bf5~C7;ZY$#vVJGg;uuCwnTBBn( zdg+1XnasYMRvQVf?kdWO@M-MTz^W>A2S2zat&Y!NA4}6Q4>7!I50%O<22;bGf<*!M zO~2FkKvm}~Oi_#&Q7o?FL6OJGw5v>y zzQ?!Sk<$w;!h&scnWRMNksY}VPsjbLEH#xwR%?W% z`k;=l;H!ccv!2^KKb1PH=r#P9 z=WAe7qdsmt2p_@Y_=%1u@l!^g4)h%!W&T!G$9RTyY98(P<7Yaa#xtzrv^nBdyDnH= zweQ(rn#qiQJgeh5#S9f+o(As0ZMKz6c}n$j9lyXSsxnn7wuq+w<~?(9nx|(Ui9BRE zh8-I)JkK^`Bv@>~OlF;xG1bb?=s1fPxFloU%^i|;U5e|Is*G}6KU1L z50QbaXJ%ptRpkuOo{=C?WA4zaP;`j}F=xoKx~CPy+{9Jp`ot1k)9V?D z13ZU|x2j05n@uN7b&p_h)U9*9qC9V9ole4bGt5Je>80F39gEeKP499XGu>eunT(l1 zjMus_|K}jo(4g*lKtojB@_4}w@xLBAwbyX8h3{cL=dW2iiFs?*O`>7VIYiI+6BqJ3 z;xAx;?F6VadJ;#A*g75i7n=U{!QY4(pEL zzOrN^M-4fA>;i5MPhqn^YR}=eJhlt+*dgc{N9Vdc`UDry-(6l9JBIaZ&tw0-bNJj@ zd_D)WqMCx0gA@G%zjDaraWDiTd{J3t>mg z`!_dHwiP=re=onxVED;d41ZG@E-ws(t1LTOj$0nz4PkFl!RQ~YxoZ+fTk?2J#qzjd z)0}avSUjf~&Br&@EUwAniA}XFi)-_EDg>qS!}Jd>8W$Wxq$Qlk$x8h8m(7-Pd8jN2 zI5&GPx0LqT-(8))=<`fh8SCC0ewo8W^xOckEji;=FbivC3FOB1(eVU%6t_3iMxLc*G}UO zgf-%8y#3%mXq%=dq6C=6vMN>QG@(nX=74G%Db#X_hGC*;JQ01cCDZISLF}$uX9vH% j0=}HN`7^x>;T^ooXAOUY{sn*KC`#E Date: Wed, 20 Mar 2013 15:41:09 -0600 Subject: [PATCH 3/5] Removed unimportant files --- src/me/Travja/HungerArena/BlockStorage.java | 289 --- src/me/Travja/HungerArena/ChatListener.java | 51 - src/me/Travja/HungerArena/Chests.java | 81 - src/me/Travja/HungerArena/CommandBlock.java | 27 - src/me/Travja/HungerArena/DeathListener.java | 167 -- src/me/Travja/HungerArena/FreezeListener.java | 21 - src/me/Travja/HungerArena/HaCommands.java | 1370 --------------- .../HungerArena/JoinAndQuitListener.java | 108 -- src/me/Travja/HungerArena/Main.java | 69 - src/me/Travja/HungerArena/PvP.java | 24 - src/me/Travja/HungerArena/Signs.java | 47 - src/me/Travja/HungerArena/SpawnsCommand.java | 243 --- .../Travja/HungerArena/SpectatorListener.java | 125 -- .../Travja/HungerArena/SponsorCommands.java | 102 -- src/me/travja/hungerarena/BlockStorage.java | 402 ----- src/me/travja/hungerarena/ChatListener.java | 50 - src/me/travja/hungerarena/Chests.java | 85 - src/me/travja/hungerarena/CommandBlock.java | 149 -- src/me/travja/hungerarena/DeathListener.java | 151 -- src/me/travja/hungerarena/DmgListener.java | 33 - src/me/travja/hungerarena/FreezeListener.java | 63 - src/me/travja/hungerarena/HaCommands.java | 1558 ----------------- .../hungerarena/JoinAndQuitListener.java | 156 -- src/me/travja/hungerarena/Main.java | 511 ------ .../hungerarena/PlayerWinGamesEvent.java | 27 - src/me/travja/hungerarena/PvP.java | 66 - src/me/travja/hungerarena/Signs.java | 53 - src/me/travja/hungerarena/SpawnsCommand.java | 81 - .../travja/hungerarena/SpectatorListener.java | 171 -- .../travja/hungerarena/SponsorCommands.java | 163 -- .../travja/hungerarena/TeleportListener.java | 50 - .../travja/hungerarena/WinGamesListener.java | 24 - 32 files changed, 6517 deletions(-) delete mode 100644 src/me/Travja/HungerArena/BlockStorage.java delete mode 100644 src/me/Travja/HungerArena/ChatListener.java delete mode 100644 src/me/Travja/HungerArena/Chests.java delete mode 100644 src/me/Travja/HungerArena/CommandBlock.java delete mode 100644 src/me/Travja/HungerArena/DeathListener.java delete mode 100644 src/me/Travja/HungerArena/FreezeListener.java delete mode 100644 src/me/Travja/HungerArena/HaCommands.java delete mode 100644 src/me/Travja/HungerArena/JoinAndQuitListener.java delete mode 100644 src/me/Travja/HungerArena/Main.java delete mode 100644 src/me/Travja/HungerArena/PvP.java delete mode 100644 src/me/Travja/HungerArena/Signs.java delete mode 100644 src/me/Travja/HungerArena/SpawnsCommand.java delete mode 100644 src/me/Travja/HungerArena/SpectatorListener.java delete mode 100644 src/me/Travja/HungerArena/SponsorCommands.java delete mode 100644 src/me/travja/hungerarena/BlockStorage.java delete mode 100644 src/me/travja/hungerarena/ChatListener.java delete mode 100644 src/me/travja/hungerarena/Chests.java delete mode 100644 src/me/travja/hungerarena/CommandBlock.java delete mode 100644 src/me/travja/hungerarena/DeathListener.java delete mode 100644 src/me/travja/hungerarena/DmgListener.java delete mode 100644 src/me/travja/hungerarena/FreezeListener.java delete mode 100644 src/me/travja/hungerarena/HaCommands.java delete mode 100644 src/me/travja/hungerarena/JoinAndQuitListener.java delete mode 100644 src/me/travja/hungerarena/Main.java delete mode 100644 src/me/travja/hungerarena/PlayerWinGamesEvent.java delete mode 100644 src/me/travja/hungerarena/PvP.java delete mode 100644 src/me/travja/hungerarena/Signs.java delete mode 100644 src/me/travja/hungerarena/SpawnsCommand.java delete mode 100644 src/me/travja/hungerarena/SpectatorListener.java delete mode 100644 src/me/travja/hungerarena/SponsorCommands.java delete mode 100644 src/me/travja/hungerarena/TeleportListener.java delete mode 100644 src/me/travja/hungerarena/WinGamesListener.java diff --git a/src/me/Travja/HungerArena/BlockStorage.java b/src/me/Travja/HungerArena/BlockStorage.java deleted file mode 100644 index ff6b675..0000000 --- a/src/me/Travja/HungerArena/BlockStorage.java +++ /dev/null @@ -1,289 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockFormEvent; -import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.event.block.BlockPistonExtendEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerBucketFillEvent; - -public class BlockStorage implements Listener { - public Main plugin; - public BlockStorage(Main m) { - this.plugin = m; - } - /*@EventHandler - public void creeperExplosion(EntityExplodeEvent event){ - if(plugin.canjoin== true){ - for(Block b:event.blockList()){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Explode: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - } - @EventHandler - public void burningBlocks(BlockBurnEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Burn: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void leafDecay(LeavesDecayEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Decay: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void blockPlace(BlockPlaceEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - if(!(d== 51) && !(d==12){ - System.out.println("Place: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Placed", blocks); - plugin.saveConfig(); - } - Location location = b.getLocation(); - if (b.getType() == Material.SAND || b.getType() == Material.GRAVEL) { - if (location.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) { - int i = 0; - for (i = location.getBlockY(); i > -1; i --) { - location = new Location(location.getWorld(), location.getBlockX(), i, location.getBlockZ()); - if (location.getBlock().getType() != Material.AIR && location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.LAVA) { - break; - } - event.getPlayer().sendMessage("Block will land at: " + location); - System.out.println("Sand Place: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - } - } - } - @EventHandler - public void bucketEmpty(PlayerBucketEmptyEvent event){ - if(plugin.canjoin== true){ - Block clicked = event.getBlockClicked(); - BlockFace face = event.getBlockFace(); - Block b = clicked.getRelative(face); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Bucket Empty: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void bucketFill(PlayerBucketFillEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlockClicked(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Bucket Fill: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void blockBreak(BlockBreakEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Break: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void blockMelt(BlockFadeEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Fade: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void blockGrow(BlockGrowEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Grow: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void blockForm(BlockFormEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Snowfall: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void pistonPush(BlockPistonExtendEvent event){ - if(plugin.canjoin== true){ - for(Block b:event.getBlocks()){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Piston: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - } - @EventHandler - public void onChange(BlockPhysicsEvent event){ - Block block = event.getBlock(); - Material changed = event.getChangedType(); - if (block.getType() == Material.LAVA){ - if (changed == Material.LAVA){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Lava Change: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - }else if(changed == Material.WATER){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Water Change: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - }else if (block.getType() == Material.SAND || block.getType() == Material.GRAVEL) { - if (changed == Material.AIR) { - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Sand/Gravel Fall: " + coords); - List blocks = plugin.config.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - }*/ -} \ No newline at end of file diff --git a/src/me/Travja/HungerArena/ChatListener.java b/src/me/Travja/HungerArena/ChatListener.java deleted file mode 100644 index 365696e..0000000 --- a/src/me/Travja/HungerArena/ChatListener.java +++ /dev/null @@ -1,51 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerChatEvent; - -public class ChatListener implements Listener { - public Main plugin; - public ChatListener(Main m) { - this.plugin = m; - } - @EventHandler - public void TributeChat(PlayerChatEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Playing.contains(pname)){ - String msg = "<" + ChatColor.RED + "[Tribute] " + ChatColor.WHITE + p.getName() + ">" + " " + event.getMessage(); - if(plugin.config.getString("ChatClose").equalsIgnoreCase("True")){ - double radius = plugin.config.getDouble("ChatClose_Radius"); - List near = p.getNearbyEntities(radius, radius, radius); - event.setCancelled(true); - if(!(near.size()== 0)){ - p.sendMessage(msg); - for(Entity e:near){ - if(e instanceof Player){ - ((Player) e).sendMessage(msg); - } - } - }else if(near.size()== 0){ - p.sendMessage(msg); - p.sendMessage(ChatColor.YELLOW + "No one near!"); - }else if(!(near.size()== 0)){ - for(Entity en:near){ - if(!(en instanceof Player)){ - p.sendMessage(msg); - p.sendMessage(ChatColor.YELLOW + "No one near!"); - } - } - } - }else{ - event.setCancelled(true); - plugin.getServer().broadcastMessage(msg); - } - } - } -} diff --git a/src/me/Travja/HungerArena/Chests.java b/src/me/Travja/HungerArena/Chests.java deleted file mode 100644 index eec2f8b..0000000 --- a/src/me/Travja/HungerArena/Chests.java +++ /dev/null @@ -1,81 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.Chest; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; - -public class Chests implements Listener { - public Main plugin; - public Chests(Main m) { - this.plugin = m; - } - @EventHandler - public void ChestSaves(PlayerInteractEvent event){ - Block block = event.getClickedBlock(); - Player p = event.getPlayer(); - if(p.getItemInHand().getType()== Material.BLAZE_ROD && event.getAction() == Action.LEFT_CLICK_BLOCK){ - if(block.getState() instanceof Chest){ - if(p.hasPermission("HungerArena.Chest.Store")){ - ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents(); - int blockx = block.getX(); - int blocky = block.getY(); - int blockz = block.getZ(); - String blockw = block.getWorld().getName().toString(); - if(!plugin.getConfig().contains("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X")){ - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X", blockx); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest); - }else{ - plugin.getConfig().set("Storage." + blockx + "," + blocky+ "," + blockz + ".Location.X",blockx); - plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky); - plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z", blockz); - plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw); - plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest); - } - List list2 = plugin.getConfig().getStringList("StorageXYZ"); - list2.add(blockx + "," + blocky + "," + blockz); - plugin.getConfig().set("StorageXYZ", list2); - plugin.getConfig().options().copyDefaults(true); - plugin.saveConfig(); - p.sendMessage(ChatColor.GREEN + "Chest Stored!"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission to store chests!"); - } - } - } - } - @EventHandler - public void onBlockBreak(BlockBreakEvent event) { - Player p = event.getPlayer(); - Block block = event.getBlock(); - Location blocklocation = event.getBlock().getLocation(); - if (block.getState() instanceof Chest && !plugin.Playing.contains(p.getDisplayName())) { - int blockx = blocklocation.getBlockX(); - int blocky = blocklocation.getBlockY(); - int blockz = blocklocation.getBlockZ(); - if (plugin.getConfig().getStringList("StorageXYZ").contains(blockx + "," + blocky + "," + blockz)) { - if(p.hasPermission("HungerArena.Chest.Break")){ - List list2 = plugin.getConfig().getStringList("StorageXYZ"); - list2.remove(blockx + "," + blocky + "," + blockz); - plugin.getConfig().set("StorageXYZ", list2); - plugin.getConfig().options().copyDefaults(true); - plugin.saveConfig(); - p.sendMessage("Chest Removed!"); - } - } - } - } -} diff --git a/src/me/Travja/HungerArena/CommandBlock.java b/src/me/Travja/HungerArena/CommandBlock.java deleted file mode 100644 index cedacb9..0000000 --- a/src/me/Travja/HungerArena/CommandBlock.java +++ /dev/null @@ -1,27 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; - -public class CommandBlock implements Listener { - public Main plugin; - public CommandBlock(Main m) { - this.plugin = m; - } - @EventHandler(priority = EventPriority.HIGHEST) - public void CatchCommand(PlayerCommandPreprocessEvent event){ - String cmd = event.getMessage(); - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(!cmd.contains("/ha") && plugin.Playing.contains(pname) && plugin.canjoin== true){ - if(!p.hasPermission("HungerArena.UseCommands")){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are only allowed to use /ha commands!"); - } - } - } -} diff --git a/src/me/Travja/HungerArena/DeathListener.java b/src/me/Travja/HungerArena/DeathListener.java deleted file mode 100644 index a063e4b..0000000 --- a/src/me/Travja/HungerArena/DeathListener.java +++ /dev/null @@ -1,167 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerRespawnEvent; - -public class DeathListener implements Listener{ - public Main plugin; - public DeathListener(Main m){ - this.plugin = m; - } - public FileConfiguration config; - int i = 0; - @EventHandler - public void onPlayerRespawn(PlayerRespawnEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Dead.contains(pname)){ - String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); - World spawnw = plugin.getServer().getWorld(Spawncoords[3]); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - event.setRespawnLocation(Spawn); - } - } - @EventHandler - public void onPlayerDeath(PlayerDeathEvent event){ - Player p = event.getEntity(); - Server s = p.getServer(); - String pname = p.getDisplayName(); - String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); - World spawnw = plugin.getServer().getWorld(Spawncoords[3]); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - if(plugin.Playing.contains(pname)){ - if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ - double y = p.getLocation().getY(); - double newy = y+200; - double x = p.getLocation().getX(); - double z = p.getLocation().getZ(); - Location strike = new Location(p.getWorld(), x, newy, z); - p.getWorld().strikeLightning(strike); - } - plugin.Dead.add(pname); - plugin.Playing.remove(pname); - String leftmsg = ChatColor.BLUE + "There are now " + plugin.Playing.size() + " tributes left!"; - if(p.getKiller() instanceof Player){ - if(p.getKiller().getItemInHand().getType().getId()== 0){ - Player killer = p.getKiller(); - String killername = killer.getName(); - event.setDeathMessage(""); - s.broadcastMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!"); - s.broadcastMessage(leftmsg); - if(plugin.Playing.size()== 1 && plugin.canjoin== true){ - //Announce winner - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.teleport(Spawn); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - plugin.Playing.clear(); - //Show spectators - if(!plugin.Watching.isEmpty()){ - String s1 = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s1); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - }else{ - Player killer = p.getKiller(); - String killername = killer.getName(); - Material weapon = killer.getItemInHand().getType(); - String msg = ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with a(n) " + weapon; - event.setDeathMessage(""); - s.broadcastMessage(msg); - s.broadcastMessage(leftmsg); - if(plugin.Playing.size()== 1 && plugin.canjoin== true){ - //Announce winner - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.teleport(Spawn); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - plugin.Playing.clear(); - //Show spectators - if(!plugin.Watching.isEmpty()){ - String s1 = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s1); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - } - }else{ - event.setDeathMessage(""); - s.broadcastMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!"); - s.broadcastMessage(leftmsg); - if(plugin.Playing.size()== 1 && plugin.canjoin== true){ - //Announce winner - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.teleport(Spawn); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - plugin.Playing.clear(); - //Show spectators - if(!plugin.Watching.isEmpty()){ - String s1 = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s1); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - } - } - } -} diff --git a/src/me/Travja/HungerArena/FreezeListener.java b/src/me/Travja/HungerArena/FreezeListener.java deleted file mode 100644 index b61c20d..0000000 --- a/src/me/Travja/HungerArena/FreezeListener.java +++ /dev/null @@ -1,21 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; - -public class FreezeListener implements Listener { - public Main plugin; - public FreezeListener(Main m) { - this.plugin = m; - } - @EventHandler - public void onPlayerMove(PlayerMoveEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Frozen.contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){ - event.setCancelled(true); - } - } -} diff --git a/src/me/Travja/HungerArena/HaCommands.java b/src/me/Travja/HungerArena/HaCommands.java deleted file mode 100644 index f1a33f3..0000000 --- a/src/me/Travja/HungerArena/HaCommands.java +++ /dev/null @@ -1,1370 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.Chest; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class HaCommands implements CommandExecutor { - public Main plugin; - public HaCommands(Main m) { - this.plugin = m; - } - int i = 0; - @SuppressWarnings("unchecked") - @Override - public boolean onCommand(final CommandSender sender, Command cmd, String commandLabel, String[] args){ - String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - String spawnworld = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(spawnworld); - Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - if(sender instanceof Player){ - final Player p = (Player) sender; - final String pname = p.getDisplayName(); - ChatColor c = ChatColor.AQUA; - if(cmd.getName().equalsIgnoreCase("Ha")){ - if(args.length== 0){ - p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!"); - return false; - } - if(args[0].equalsIgnoreCase("Help")){ - p.sendMessage(ChatColor.GREEN + "----HungerArena Help----"); - p.sendMessage(c + "/ha - Displays author message!"); - sender.sendMessage(c + "/ha help - Displays this screen!"); - sender.sendMessage(c + "/ha join - Makes you join the game!"); - sender.sendMessage(c + "/ha ready - Votes for the game to start!"); - sender.sendMessage(c + "/ha leave - Makes you leave the game!"); - sender.sendMessage(c + "/ha watch - Lets you watch the tributes!"); - sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!"); - sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!"); - sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!"); - sender.sendMessage(c + "/ha restart - Makes it so dead tributes can join again!"); - sender.sendMessage(c + "/ha warpall - Warps all tribute into position!"); - sender.sendMessage(c + "/ha reload - Reloads the config!"); - sender.sendMessage(c + "/ha refill - Refills all chests!"); - sender.sendMessage(c + "/ha start - Unfreezes tributes allowing them to fight!"); - sender.sendMessage(c + "/ha list - Shows a list of players in the game and their health!"); - sender.sendMessage(c + "/ha rlist - See who's ready!"); - sender.sendMessage(c + "/startpoint [1,2,3,4,etc] - Sets the starting points of tributes!"); - sender.sendMessage(ChatColor.GREEN + "----------------------"); - return false; - }else if(args[0].equalsIgnoreCase("List")){ - if(p.hasPermission("HungerArena.GameMaker")){ - sender.sendMessage(ChatColor.AQUA + "-----People Playing-----"); - if(!plugin.Playing.isEmpty()){ - for(String playernames: plugin.Playing){ - Player players = plugin.getServer().getPlayerExact(playernames); - p.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); - } - }else if(plugin.Playing.isEmpty()){ - p.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - p.sendMessage(ChatColor.AQUA + "----------------------"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("rList")){ - if(p.hasPermission("HungerArena.GameMaker")){ - p.sendMessage(ChatColor.AQUA + "-----People Ready-----"); - if(!plugin.Ready.isEmpty()){ - for(String readyname: plugin.Ready){ - Player ready = plugin.getServer().getPlayerExact(readyname); - p.sendMessage(ChatColor.GREEN + readyname + " Life: " + ready.getHealth() + "/20"); - } - }else if(plugin.Ready.isEmpty()){ - p.sendMessage(ChatColor.GRAY + "No one is ready!"); - } - p.sendMessage(ChatColor.AQUA + "---------------------"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("SetSpawn")){ - if(p.hasPermission("HungerArena.SetSpawn")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Spawn_coords", x + "," + y + "," + z + "," + w); - plugin.config.set("Spawns_set", "true"); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Join")){ - if(p.hasPermission("HungerArena.Join")){ - if(plugin.Playing.contains(pname)){ - p.sendMessage(ChatColor.RED + "You are already playing!"); - }else if(plugin.Dead.contains(pname) || plugin.Quit.contains(pname)){ - p.sendMessage(ChatColor.RED + "You DIED/QUIT! You can't join again!"); - }else if(plugin.Playing.size()== 24){ - p.sendMessage(ChatColor.RED + "There are already 24 Tributes!"); - }else if(plugin.canjoin== true){ - p.sendMessage(ChatColor.RED + "The game is in progress!"); - }else if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){ - p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); - }else if(plugin.NeedConfirm.contains(pname)){ - p.sendMessage(ChatColor.RED + "You need to do /ha confirm"); - }else if(plugin.config.getString("Need_Confirm").equalsIgnoreCase("true")){ - plugin.NeedConfirm.add(pname); - p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); - }else{ - plugin.Playing.add(pname); - p.getInventory().clear(); - p.getInventory().setBoots(null); - p.getInventory().setChestplate(null); - p.getInventory().setHelmet(null); - p.getInventory().setLeggings(null); - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - if(plugin.Playing.size()== 24){ - p.performCommand("ha warpall"); - } - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Confirm")){ - if(plugin.NeedConfirm.contains(pname)){ - plugin.Playing.add(pname); - plugin.NeedConfirm.remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - p.getInventory().clear(); - p.getInventory().setBoots(null); - p.getInventory().setChestplate(null); - p.getInventory().setHelmet(null); - p.getInventory().setLeggings(null); - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - if(plugin.Playing.size()== 24){ - p.performCommand("ha warpall"); - } - } - }else if(args[0].equalsIgnoreCase("Ready")){ - if(plugin.Playing.contains(pname)){ - if(plugin.Ready.contains(pname)){ - p.sendMessage(ChatColor.RED + "You're already ready!"); - }else if(plugin.Playing.size()== 1){ - p.sendMessage(ChatColor.RED + "You can't be ready when no one else is playing!"); - }else{ - plugin.Ready.add(pname); - p.sendMessage(ChatColor.AQUA + "You have marked yourself as READY!"); - if(plugin.Playing.size()-4== plugin.Ready.size()){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha warpall"); - } - } - }else if(!plugin.Playing.contains(pname)){ - p.sendMessage(ChatColor.RED + "You aren't playing!"); - } - }else if(args[0].equalsIgnoreCase("Leave")){ - if(!plugin.Playing.contains(pname)){ - p.sendMessage(ChatColor.RED + "You aren't playing!"); - }else if(plugin.canjoin== false){ - plugin.Playing.remove(pname); - p.sendMessage(ChatColor.AQUA + "You have left the game!"); - p.getServer().broadcastMessage(ChatColor.RED + pname + " Quit!"); - p.getInventory().clear(); - p.teleport(Spawn); - p.getInventory().setBoots(null); - p.getInventory().setChestplate(null); - p.getInventory().setHelmet(null); - p.getInventory().setLeggings(null); - if(plugin.Frozen.contains(pname)){ - plugin.Frozen.remove(pname); - } - }else{ - plugin.Playing.remove(pname); - plugin.Quit.add(pname); - p.sendMessage(ChatColor.AQUA + "You have left the game!"); - p.getServer().broadcastMessage(ChatColor.RED + pname + " Quit!"); - p.getInventory().clear(); - p.getInventory().setBoots(null); - p.getInventory().setChestplate(null); - p.getInventory().setHelmet(null); - p.getInventory().setLeggings(null); - p.teleport(Spawn); - if(plugin.Frozen.contains(pname)){ - plugin.Frozen.remove(pname); - } - if(plugin.Playing.size()== 1){ - //Announce the Winner - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.teleport(Spawn); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - plugin.Playing.clear(); - //Show spectators - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - } - }else if(args[0].equalsIgnoreCase("Watch")){ - if(sender.hasPermission("HungerArena.Watch")){ - if(!plugin.Watching.contains(pname) && !plugin.Playing.contains(pname) && plugin.canjoin== true){ - plugin.Watching.add(pname); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.hidePlayer(p); - } - p.setAllowFlight(true); - p.sendMessage(ChatColor.AQUA + "You can now spectate!"); - }else if(plugin.canjoin== false){ - p.sendMessage(ChatColor.RED + "The game isn't in progress!"); - }else if(plugin.Playing.contains(pname)){ - p.sendMessage(ChatColor.RED + "You can't watch while you're playing!"); - }else if(plugin.Watching.contains(pname)){ - plugin.Watching.remove(pname); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(p); - } - p.teleport(Spawn); - p.setAllowFlight(false); - p.sendMessage(ChatColor.AQUA + "You are not spectating anymore"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Kick")){ - Player target = plugin.getServer().getPlayer(args[1]); - if(sender.hasPermission("HungerArena.Kick")){ - if(plugin.Playing.contains(target.getDisplayName())){ - plugin.Playing.remove(target.getDisplayName()); - plugin.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from the game!"); - target.teleport(Spawn); - target.getInventory().clear(); - target.getInventory().setBoots(null); - target.getInventory().setChestplate(null); - target.getInventory().setHelmet(null); - target.getInventory().setLeggings(null); - plugin.Quit.add(target.getDisplayName()); - if(plugin.Playing.size()== 1 && plugin.canjoin== true){ - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.teleport(Spawn); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - plugin.Playing.clear(); - if(!plugin.Watching.isEmpty()){ - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - }else{ - sender.sendMessage(ChatColor.RED + "That player isn't in the game!"); - } - }else{ - sender.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Refill")){ - if(p.hasPermission("HungerArena.Refill")){ - int list056; - list056 = 0; - int limit = plugin.config.getStringList("StorageXYZ").size(); - while(limit > list056){ - String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); - int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); - int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); - int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); - String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); - Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); - plugin.exists = false; - if(blockatlocation.getState() instanceof Chest){ - plugin.exists = true; - Chest chest = (Chest) blockatlocation.getState(); - chest.getInventory().clear(); - ItemStack[] itemsinchest = null; - Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); - if(o instanceof ItemStack[]){ - itemsinchest = (ItemStack[]) o; - }else if(o instanceof List){ - itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); - } - list056 = list056+1; - chest.getInventory().setContents(itemsinchest); - } - } - if(limit== list056){ - sender.sendMessage(ChatColor.GREEN + "All chests refilled!"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Restart")){ - if(p.hasPermission("HungerArena.Restart")){ - if(!plugin.Watching.isEmpty()){ - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - plugin.Dead.clear(); - plugin.Quit.clear(); - plugin.Watching.clear(); - plugin.Frozen.clear(); - plugin.Ready.clear(); - plugin.NeedConfirm.clear(); - plugin.Out.clear(); - plugin.Playing.clear(); - plugin.canjoin = false; - p.performCommand("ha refill"); - p.sendMessage(ChatColor.AQUA + "The games have been reset!"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Reload")){ - plugin.reloadConfig(); - p.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!"); - }else if(args[0].equalsIgnoreCase("WarpAll")){ - if(p.hasPermission("HungerArena.Warpall")){ - if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){ - sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); - }else{ - if(plugin.Playing.size()== 1){ - sender.sendMessage(ChatColor.RED + "There are not enough players!"); - } - if(plugin.Playing.size()>= 2){ - plugin.config.getString("Tribute_one_spawn"); - String[] onecoords = plugin.config.getString("Tribute_one_spawn").split(","); - Player Tribute_one = plugin.getServer().getPlayerExact(plugin.Playing.get(0)); - double x = Double.parseDouble(onecoords[0]); - double y = Double.parseDouble(onecoords[1]); - double z = Double.parseDouble(onecoords[2]); - String world = onecoords[3]; - World w = plugin.getServer().getWorld(world); - Location oneloc = new Location(w, x, y, z); - Tribute_one.teleport(oneloc); - plugin.Frozen.add(Tribute_one.getDisplayName()); - Tribute_one.setFoodLevel(20); - plugin.config.getString("Tribute_two_spawn"); - String[] twocoords = plugin.config.getString("Tribute_two_spawn").split(","); - Player Tribute_two = plugin.getServer().getPlayerExact(plugin.Playing.get(1)); - double twox = Double.parseDouble(twocoords[0]); - double twoy = Double.parseDouble(twocoords[1]); - double twoz = Double.parseDouble(twocoords[2]); - String twoworld = twocoords[3]; - World twow = plugin.getServer().getWorld(twoworld); - Location twoloc = new Location(twow, twox, twoy, twoz); - Tribute_two.teleport(twoloc); - plugin.Frozen.add(Tribute_two.getDisplayName()); - Tribute_two.setFoodLevel(20); - p.getWorld().setTime(0); - if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){ - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start"); - } - }, 20L); - } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.sendMessage(ChatColor.AQUA + "All Tributes warped!"); - } - }, 20L); - } - if(plugin.Playing.size()>= 3){ - plugin.config.getString("Tribute_three_spawn"); - String[] coords = plugin.config.getString("Tribute_three_spawn").split(","); - Player Tribute_three = plugin.getServer().getPlayerExact(plugin.Playing.get(2)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_three.teleport(loc); - plugin.Frozen.add(Tribute_three.getDisplayName()); - Tribute_three.setFoodLevel(20); - } - if(plugin.Playing.size()>= 4){ - plugin.config.getString("Tribute_four_spawn"); - String[] coords = plugin.config.getString("Tribute_four_spawn").split(","); - Player Tribute_four = plugin.getServer().getPlayerExact(plugin.Playing.get(3)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_four.teleport(loc); - plugin.Frozen.add(Tribute_four.getDisplayName()); - Tribute_four.setFoodLevel(20); - } - if(plugin.Playing.size()>= 5){ - plugin.config.getString("Tribute_five_spawn"); - String[] coords = plugin.config.getString("Tribute_five_spawn").split(","); - Player Tribute_five = plugin.getServer().getPlayerExact(plugin.Playing.get(4)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_five.teleport(loc); - plugin.Frozen.add(Tribute_five.getDisplayName()); - Tribute_five.setFoodLevel(20); - } - if(plugin.Playing.size()>= 6){ - plugin.config.getString("Tribute_six_spawn"); - String[] coords = plugin.config.getString("Tribute_six_spawn").split(","); - Player Tribute_six = plugin.getServer().getPlayerExact(plugin.Playing.get(5)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_six.teleport(loc); - plugin.Frozen.add(Tribute_six.getDisplayName()); - Tribute_six.setFoodLevel(20); - } - if(plugin.Playing.size()>= 7){ - plugin.config.getString("Tribute_seven_spawn"); - String[] coords = plugin.config.getString("Tribute_seven_spawn").split(","); - Player Tribute_seven = plugin.getServer().getPlayerExact(plugin.Playing.get(6)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_seven.teleport(loc); - plugin.Frozen.add(Tribute_seven.getDisplayName()); - Tribute_seven.setFoodLevel(20); - } - if(plugin.Playing.size()>= 8){ - plugin.config.getString("Tribute_eight_spawn"); - String[] coords = plugin.config.getString("Tribute_eight_spawn").split(","); - Player Tribute_eight = plugin.getServer().getPlayerExact(plugin.Playing.get(7)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_eight.teleport(loc); - plugin.Frozen.add(Tribute_eight.getDisplayName()); - Tribute_eight.setFoodLevel(20); - } - if(plugin.Playing.size()>= 9){ - plugin.config.getString("Tribute_nine_spawn"); - String[] coords = plugin.config.getString("Tribute_nine_spawn").split(","); - Player Tribute_nine = plugin.getServer().getPlayerExact(plugin.Playing.get(8)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_nine.teleport(loc); - plugin.Frozen.add(Tribute_nine.getDisplayName()); - Tribute_nine.setFoodLevel(20); - } - if(plugin.Playing.size()>= 10){ - plugin.config.getString("Tribute_ten_spawn"); - String[] coords = plugin.config.getString("Tribute_ten_spawn").split(","); - Player Tribute_ten = plugin.getServer().getPlayerExact(plugin.Playing.get(9)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_ten.teleport(loc); - plugin.Frozen.add(Tribute_ten.getDisplayName()); - Tribute_ten.setFoodLevel(20); - } - if(plugin.Playing.size()>= 11){ - plugin.config.getString("Tribute_eleven_spawn"); - String[] coords = plugin.config.getString("Tribute_eleven_spawn").split(","); - Player Tribute_eleven = plugin.getServer().getPlayerExact(plugin.Playing.get(10)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_eleven.teleport(loc); - plugin.Frozen.add(Tribute_eleven.getDisplayName()); - Tribute_eleven.setFoodLevel(20); - } - if(plugin.Playing.size()>= 12){ - plugin.config.getString("Tribute_twelve_spawn"); - String[] coords = plugin.config.getString("Tribute_twelve_spawn").split(","); - Player Tribute_twelve = plugin.getServer().getPlayerExact(plugin.Playing.get(11)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twelve.teleport(loc); - plugin.Frozen.add(Tribute_twelve.getDisplayName()); - Tribute_twelve.setFoodLevel(20); - } - if(plugin.Playing.size()>= 13){ - plugin.config.getString("Tribute_thirteen_spawn"); - String[] coords = plugin.config.getString("Tribute_thirteen_spawn").split(","); - Player Tribute_thirteen = plugin.getServer().getPlayerExact(plugin.Playing.get(12)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_thirteen.teleport(loc); - plugin.Frozen.add(Tribute_thirteen.getDisplayName()); - Tribute_thirteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 14){ - plugin.config.getString("Tribute_fourteen_spawn"); - String[] coords = plugin.config.getString("Tribute_fourteen_spawn").split(","); - Player Tribute_fourteen = plugin.getServer().getPlayerExact(plugin.Playing.get(13)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_fourteen.teleport(loc); - plugin.Frozen.add(Tribute_fourteen.getDisplayName()); - Tribute_fourteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 15){ - plugin.config.getString("Tribute_fifteen_spawn"); - String[] coords = plugin.config.getString("Tribute_fifteen_spawn").split(","); - Player Tribute_fifteen = plugin.getServer().getPlayerExact(plugin.Playing.get(14)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_fifteen.teleport(loc); - plugin.Frozen.add(Tribute_fifteen.getDisplayName()); - Tribute_fifteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 16){ - plugin.config.getString("Tribute_sixteen_spawn"); - String[] coords = plugin.config.getString("Tribute_sixteen_spawn").split(","); - Player Tribute_sixteen = plugin.getServer().getPlayerExact(plugin.Playing.get(15)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_sixteen.teleport(loc); - plugin.Frozen.add(Tribute_sixteen.getDisplayName()); - Tribute_sixteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 17){ - plugin.config.getString("Tribute_seventeen_spawn"); - String[] coords = plugin.config.getString("Tribute_seventeen_spawn").split(","); - Player Tribute_seventeen = plugin.getServer().getPlayerExact(plugin.Playing.get(16)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_seventeen.teleport(loc); - plugin.Frozen.add(Tribute_seventeen.getDisplayName()); - Tribute_seventeen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 18){ - plugin.config.getString("Tribute_eighteen_spawn"); - String[] coords = plugin.config.getString("Tribute_eighteen_spawn").split(","); - Player Tribute_eighteen = plugin.getServer().getPlayerExact(plugin.Playing.get(17)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_eighteen.teleport(loc); - plugin.Frozen.add(Tribute_eighteen.getDisplayName()); - Tribute_eighteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 19){ - plugin.config.getString("Tribute_nineteen_spawn"); - String[] coords = plugin.config.getString("Tribute_nineteen_spawn").split(","); - Player Tribute_nineteen = plugin.getServer().getPlayerExact(plugin.Playing.get(18)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_nineteen.teleport(loc); - plugin.Frozen.add(Tribute_nineteen.getDisplayName()); - Tribute_nineteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 20){ - plugin.config.getString("Tribute_twenty_spawn"); - String[] coords = plugin.config.getString("Tribute_twenty_spawn").split(","); - Player Tribute_twenty = plugin.getServer().getPlayerExact(plugin.Playing.get(19)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twenty.teleport(loc); - plugin.Frozen.add(Tribute_twenty.getDisplayName()); - Tribute_twenty.setFoodLevel(20); - } - if(plugin.Playing.size()>= 21){ - plugin.config.getString("Tribute_twentyone_spawn"); - String[] coords = plugin.config.getString("Tribute_twentyone_spawn").split(","); - Player Tribute_twentyone = plugin.getServer().getPlayerExact(plugin.Playing.get(20)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentyone.teleport(loc); - plugin.Frozen.add(Tribute_twentyone.getDisplayName()); - Tribute_twentyone.setFoodLevel(20); - } - if(plugin.Playing.size()>= 22){ - plugin.config.getString("Tribute_twentytwo_spawn"); - String[] coords = plugin.config.getString("Tribute_twentytwo_spawn").split(","); - Player Tribute_twentytwo = plugin.getServer().getPlayerExact(plugin.Playing.get(21)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentytwo.teleport(loc); - plugin.Frozen.add(Tribute_twentytwo.getDisplayName()); - Tribute_twentytwo.setFoodLevel(20); - } - if(plugin.Playing.size()>= 23){ - plugin.config.getString("Tribute_twentythree_spawn"); - String[] coords = plugin.config.getString("Tribute_twentythree_spawn").split(","); - Player Tribute_twentythree = plugin.getServer().getPlayerExact(plugin.Playing.get(22)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentythree.teleport(loc); - plugin.Frozen.add(Tribute_twentythree.getDisplayName()); - Tribute_twentythree.setFoodLevel(20); - } - if(plugin.Playing.size()>= 24){ - plugin.config.getString("Tribute_twentyfour_spawn"); - String[] coords = plugin.config.getString("Tribute_twentyfour_spawn").split(","); - Player Tribute_twentyfour = plugin.getServer().getPlayerExact(plugin.Playing.get(23)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentyfour.teleport(loc); - plugin.Frozen.add(Tribute_twentyfour.getDisplayName()); - Tribute_twentyfour.setFoodLevel(20); - } - } - } - }else if(args[0].equalsIgnoreCase("Start")){ - String begin = plugin.config.getString("Start_Message"); - begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2"); - final String msg = begin; - if(p.hasPermission("HungerArena.Start")){ - if(plugin.config.getString("Countdown").equalsIgnoreCase("true")){ - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("10"); - } - }, 20L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("9"); - } - }, 40L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("8"); - } - }, 60L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("7"); - } - }, 80L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("6"); - } - }, 100L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("5"); - } - }, 120L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("4"); - } - }, 140L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("3"); - } - }, 160L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("2"); - } - }, 180L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("1"); - } - }, 200L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.Frozen.clear(); - plugin.getServer().broadcastMessage(msg); - plugin.canjoin = true; - } - }, 220L); - }else{ - plugin.Frozen.clear(); - p.getServer().broadcastMessage(msg); - plugin.canjoin = true; - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else{ - p.sendMessage(ChatColor.RED + "Unknown command, type /ha help for a list of commands"); - } - } - }else if(sender instanceof ConsoleCommandSender){ - if(cmd.getName().equalsIgnoreCase("Ha")){ - if(args.length== 0){ - sender.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!"); - return false; - } - if(args[0].equalsIgnoreCase("Help")){ - ChatColor c = ChatColor.AQUA; - sender.sendMessage(ChatColor.GREEN + "----HungerArena Help----"); - sender.sendMessage(c + "/ha - Displays author message!"); - sender.sendMessage(c + "/ha help - Displays this screen!"); - sender.sendMessage(c + "/ha join - Makes you join the game!"); - sender.sendMessage(c + "/ha ready - Votes for the game to start!"); - sender.sendMessage(c + "/ha leave - Makes you leave the game!"); - sender.sendMessage(c + "/ha watch - Lets you watch the tributes!"); - sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!"); - sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!"); - sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!"); - sender.sendMessage(c + "/ha restart - Makes it so dead tributes can join again!"); - sender.sendMessage(c + "/ha warpall - Warps all tribute into position!"); - sender.sendMessage(c + "/ha reload - Reloads the config!"); - sender.sendMessage(c + "/ha refill - Refills all chests!"); - sender.sendMessage(c + "/ha start - Unfreezes tributes allowing them to fight!"); - sender.sendMessage(c + "/ha list - Shows a list of players in the game and their health!"); - sender.sendMessage(c + "/ha rlist - See who's ready!"); - sender.sendMessage(c + "/startpoint [1,2,3,4,etc] - Sets the starting points of tributes!"); - sender.sendMessage(ChatColor.GREEN + "----------------------"); - return false; - }else if(args[0].equalsIgnoreCase("List")){ - sender.sendMessage(ChatColor.AQUA + "-----People Playing-----"); - if(!plugin.Playing.isEmpty()){ - for(String playernames: plugin.Playing){ - Player players = plugin.getServer().getPlayerExact(playernames); - sender.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20"); - } - }else if(plugin.Playing.isEmpty()){ - sender.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - sender.sendMessage(ChatColor.AQUA + "----------------------"); - }else if(args[0].equalsIgnoreCase("rList")){ - sender.sendMessage(ChatColor.AQUA + "-----People Ready-----"); - if(!plugin.Ready.isEmpty()){ - for(String readyname: plugin.Ready){ - Player ready = plugin.getServer().getPlayerExact(readyname); - sender.sendMessage(ChatColor.GREEN + readyname + " Life: " + ready.getHealth() + "/20"); - } - }else if(plugin.Ready.isEmpty()){ - sender.sendMessage(ChatColor.GRAY + "No one is ready!"); - } - sender.sendMessage(ChatColor.AQUA + "---------------------"); - }else if(args[0].equalsIgnoreCase("SetSpawn") || args[0].equalsIgnoreCase("Join") || args[0].equalsIgnoreCase("Confirm") || args[0].equalsIgnoreCase("Ready") || args[0].equalsIgnoreCase("Leave") || args[0].equalsIgnoreCase("Watch")){ - sender.sendMessage(ChatColor.RED + "That can only be run by a player!"); - }else if(args[0].equalsIgnoreCase("Kick")){ - Player target = plugin.getServer().getPlayer(args[1]); - if(plugin.Playing.contains(target)){ - plugin.Playing.remove(target.getDisplayName()); - plugin.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from the game!"); - target.teleport(Spawn); - target.getInventory().clear(); - target.getInventory().setBoots(null); - target.getInventory().setChestplate(null); - target.getInventory().setHelmet(null); - target.getInventory().setLeggings(null); - plugin.Quit.add(target.getDisplayName()); - if(plugin.Playing.size()== 1 && plugin.canjoin== true){ - //Announce winner - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.teleport(Spawn); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - plugin.Playing.clear(); - //Make spectators visible - if(!plugin.Watching.isEmpty()){ - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - }else{ - sender.sendMessage(ChatColor.RED + "That player isn't in the game!"); - } - }else if(args[0].equalsIgnoreCase("Refill")){ - int list056; - list056 = 0; - int limit = plugin.getConfig().getStringList("StorageXYZ").size(); - while(limit > list056){ - String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); - int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); - int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); - int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); - String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); - Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); - plugin.exists = false; - if(blockatlocation.getState() instanceof Chest){ - plugin.exists = true; - Chest chest = (Chest) blockatlocation.getState(); - chest.getInventory().clear(); - ItemStack[] itemsinchest = null; - Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); - if(o instanceof ItemStack[]){ - itemsinchest = (ItemStack[]) o; - }else if(o instanceof List){ - itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); - } - list056 = list056+1; - chest.getInventory().setContents(itemsinchest); - } - } - if(limit== list056){ - sender.sendMessage(ChatColor.GREEN + "All chests refilled!"); - } - }else if(args[0].equalsIgnoreCase("Restart")){ - if(!plugin.Watching.isEmpty()){ - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - plugin.Dead.clear(); - plugin.Quit.clear(); - plugin.Watching.clear(); - plugin.Frozen.clear(); - plugin.Ready.clear(); - plugin.NeedConfirm.clear(); - plugin.Out.clear(); - plugin.Playing.clear(); - plugin.canjoin = false; - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill"); - sender.sendMessage(ChatColor.AQUA + "The games have been reset!"); - }else if(args[0].equalsIgnoreCase("Reload")){ - plugin.reloadConfig(); - sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!"); - }else if(args[0].equalsIgnoreCase("WarpAll")){ - if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){ - sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); - }else{ - if(plugin.Playing.size()<= 1){ - sender.sendMessage(ChatColor.RED + "There are not enough players!"); - } - if(plugin.Playing.size()>= 2){ - plugin.config.getString("Tribute_one_spawn"); - String[] onecoords = plugin.config.getString("Tribute_one_spawn").split(","); - Player Tribute_one = plugin.getServer().getPlayerExact(plugin.Playing.get(0)); - double x = Double.parseDouble(onecoords[0]); - double y = Double.parseDouble(onecoords[1]); - double z = Double.parseDouble(onecoords[2]); - String world = onecoords[3]; - World w = plugin.getServer().getWorld(world); - Location oneloc = new Location(w, x, y, z); - Tribute_one.teleport(oneloc); - plugin.Frozen.add(Tribute_one.getDisplayName()); - Tribute_one.setFoodLevel(20); - plugin.config.getString("Tribute_two_spawn"); - String[] twocoords = plugin.config.getString("Tribute_two_spawn").split(","); - Player Tribute_two = plugin.getServer().getPlayerExact(plugin.Playing.get(1)); - double twox = Double.parseDouble(twocoords[0]); - double twoy = Double.parseDouble(twocoords[1]); - double twoz = Double.parseDouble(twocoords[2]); - String twoworld = twocoords[3]; - World twow = plugin.getServer().getWorld(twoworld); - Location twoloc = new Location(twow, twox, twoy, twoz); - Tribute_two.teleport(twoloc); - plugin.Frozen.add(Tribute_two.getDisplayName()); - Tribute_two.setFoodLevel(20); - Tribute_one.getWorld().setTime(0); - if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){ - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start"); - } - }, 20L); - } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - sender.sendMessage(ChatColor.AQUA + "All Tributes warped!"); - } - }, 20L); - } - if(plugin.Playing.size()>= 3){ - plugin.config.getString("Tribute_three_spawn"); - String[] coords = plugin.config.getString("Tribute_three_spawn").split(","); - Player Tribute_three = plugin.getServer().getPlayerExact(plugin.Playing.get(2)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_three.teleport(loc); - plugin.Frozen.add(Tribute_three.getDisplayName()); - Tribute_three.setFoodLevel(20); - } - if(plugin.Playing.size()>= 4){ - plugin.config.getString("Tribute_four_spawn"); - String[] coords = plugin.config.getString("Tribute_four_spawn").split(","); - Player Tribute_four = plugin.getServer().getPlayerExact(plugin.Playing.get(3)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_four.teleport(loc); - plugin.Frozen.add(Tribute_four.getDisplayName()); - Tribute_four.setFoodLevel(20); - } - if(plugin.Playing.size()>= 5){ - plugin.config.getString("Tribute_five_spawn"); - String[] coords = plugin.config.getString("Tribute_five_spawn").split(","); - Player Tribute_five = plugin.getServer().getPlayerExact(plugin.Playing.get(4)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_five.teleport(loc); - plugin.Frozen.add(Tribute_five.getDisplayName()); - Tribute_five.setFoodLevel(20); - } - if(plugin.Playing.size()>= 6){ - plugin.config.getString("Tribute_six_spawn"); - String[] coords = plugin.config.getString("Tribute_six_spawn").split(","); - Player Tribute_six = plugin.getServer().getPlayerExact(plugin.Playing.get(5)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_six.teleport(loc); - plugin.Frozen.add(Tribute_six.getDisplayName()); - Tribute_six.setFoodLevel(20); - } - if(plugin.Playing.size()>= 7){ - plugin.config.getString("Tribute_seven_spawn"); - String[] coords = plugin.config.getString("Tribute_seven_spawn").split(","); - Player Tribute_seven = plugin.getServer().getPlayerExact(plugin.Playing.get(6)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_seven.teleport(loc); - plugin.Frozen.add(Tribute_seven.getDisplayName()); - Tribute_seven.setFoodLevel(20); - } - if(plugin.Playing.size()>= 8){ - plugin.config.getString("Tribute_eight_spawn"); - String[] coords = plugin.config.getString("Tribute_eight_spawn").split(","); - Player Tribute_eight = plugin.getServer().getPlayerExact(plugin.Playing.get(7)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_eight.teleport(loc); - plugin.Frozen.add(Tribute_eight.getDisplayName()); - Tribute_eight.setFoodLevel(20); - } - if(plugin.Playing.size()>= 9){ - plugin.config.getString("Tribute_nine_spawn"); - String[] coords = plugin.config.getString("Tribute_nine_spawn").split(","); - Player Tribute_nine = plugin.getServer().getPlayerExact(plugin.Playing.get(8)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_nine.teleport(loc); - plugin.Frozen.add(Tribute_nine.getDisplayName()); - Tribute_nine.setFoodLevel(20); - } - if(plugin.Playing.size()>= 10){ - plugin.config.getString("Tribute_ten_spawn"); - String[] coords = plugin.config.getString("Tribute_ten_spawn").split(","); - Player Tribute_ten = plugin.getServer().getPlayerExact(plugin.Playing.get(9)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_ten.teleport(loc); - plugin.Frozen.add(Tribute_ten.getDisplayName()); - Tribute_ten.setFoodLevel(20); - } - if(plugin.Playing.size()>= 11){ - plugin.config.getString("Tribute_eleven_spawn"); - String[] coords = plugin.config.getString("Tribute_eleven_spawn").split(","); - Player Tribute_eleven = plugin.getServer().getPlayerExact(plugin.Playing.get(10)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_eleven.teleport(loc); - plugin.Frozen.add(Tribute_eleven.getDisplayName()); - Tribute_eleven.setFoodLevel(20); - } - if(plugin.Playing.size()>= 12){ - plugin.config.getString("Tribute_twelve_spawn"); - String[] coords = plugin.config.getString("Tribute_twelve_spawn").split(","); - Player Tribute_twelve = plugin.getServer().getPlayerExact(plugin.Playing.get(11)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twelve.teleport(loc); - plugin.Frozen.add(Tribute_twelve.getDisplayName()); - Tribute_twelve.setFoodLevel(20); - } - if(plugin.Playing.size()>= 13){ - plugin.config.getString("Tribute_thirteen_spawn"); - String[] coords = plugin.config.getString("Tribute_thirteen_spawn").split(","); - Player Tribute_thirteen = plugin.getServer().getPlayerExact(plugin.Playing.get(12)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_thirteen.teleport(loc); - plugin.Frozen.add(Tribute_thirteen.getDisplayName()); - Tribute_thirteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 14){ - plugin.config.getString("Tribute_fourteen_spawn"); - String[] coords = plugin.config.getString("Tribute_fourteen_spawn").split(","); - Player Tribute_fourteen = plugin.getServer().getPlayerExact(plugin.Playing.get(13)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_fourteen.teleport(loc); - plugin.Frozen.add(Tribute_fourteen.getDisplayName()); - Tribute_fourteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 15){ - plugin.config.getString("Tribute_fifteen_spawn"); - String[] coords = plugin.config.getString("Tribute_fifteen_spawn").split(","); - Player Tribute_fifteen = plugin.getServer().getPlayerExact(plugin.Playing.get(14)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_fifteen.teleport(loc); - plugin.Frozen.add(Tribute_fifteen.getDisplayName()); - Tribute_fifteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 16){ - plugin.config.getString("Tribute_sixteen_spawn"); - String[] coords = plugin.config.getString("Tribute_sixteen_spawn").split(","); - Player Tribute_sixteen = plugin.getServer().getPlayerExact(plugin.Playing.get(15)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_sixteen.teleport(loc); - plugin.Frozen.add(Tribute_sixteen.getDisplayName()); - Tribute_sixteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 17){ - plugin.config.getString("Tribute_seventeen_spawn"); - String[] coords = plugin.config.getString("Tribute_seventeen_spawn").split(","); - Player Tribute_seventeen = plugin.getServer().getPlayerExact(plugin.Playing.get(16)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_seventeen.teleport(loc); - plugin.Frozen.add(Tribute_seventeen.getDisplayName()); - Tribute_seventeen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 18){ - plugin.config.getString("Tribute_eighteen_spawn"); - String[] coords = plugin.config.getString("Tribute_eighteen_spawn").split(","); - Player Tribute_eighteen = plugin.getServer().getPlayerExact(plugin.Playing.get(17)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_eighteen.teleport(loc); - plugin.Frozen.add(Tribute_eighteen.getDisplayName()); - Tribute_eighteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 19){ - plugin.config.getString("Tribute_nineteen_spawn"); - String[] coords = plugin.config.getString("Tribute_nineteen_spawn").split(","); - Player Tribute_nineteen = plugin.getServer().getPlayerExact(plugin.Playing.get(18)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_nineteen.teleport(loc); - plugin.Frozen.add(Tribute_nineteen.getDisplayName()); - Tribute_nineteen.setFoodLevel(20); - } - if(plugin.Playing.size()>= 20){ - plugin.config.getString("Tribute_twenty_spawn"); - String[] coords = plugin.config.getString("Tribute_twenty_spawn").split(","); - Player Tribute_twenty = plugin.getServer().getPlayerExact(plugin.Playing.get(19)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twenty.teleport(loc); - plugin.Frozen.add(Tribute_twenty.getDisplayName()); - Tribute_twenty.setFoodLevel(20); - } - if(plugin.Playing.size()>= 21){ - plugin.config.getString("Tribute_twentyone_spawn"); - String[] coords = plugin.config.getString("Tribute_twentyone_spawn").split(","); - Player Tribute_twentyone = plugin.getServer().getPlayerExact(plugin.Playing.get(20)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentyone.teleport(loc); - plugin.Frozen.add(Tribute_twentyone.getDisplayName()); - Tribute_twentyone.setFoodLevel(20); - } - if(plugin.Playing.size()>= 22){ - plugin.config.getString("Tribute_twentytwo_spawn"); - String[] coords = plugin.config.getString("Tribute_twentytwo_spawn").split(","); - Player Tribute_twentytwo = plugin.getServer().getPlayerExact(plugin.Playing.get(21)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentytwo.teleport(loc); - plugin.Frozen.add(Tribute_twentytwo.getDisplayName()); - Tribute_twentytwo.setFoodLevel(20); - } - if(plugin.Playing.size()>= 23){ - plugin.config.getString("Tribute_twentythree_spawn"); - String[] coords = plugin.config.getString("Tribute_twentythree_spawn").split(","); - Player Tribute_twentythree = plugin.getServer().getPlayerExact(plugin.Playing.get(22)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentythree.teleport(loc); - plugin.Frozen.add(Tribute_twentythree.getDisplayName()); - Tribute_twentythree.setFoodLevel(20); - } - if(plugin.Playing.size()>= 24){ - plugin.config.getString("Tribute_twentyfour_spawn"); - String[] coords = plugin.config.getString("Tribute_twentyfour_spawn").split(","); - Player Tribute_twentyfour = plugin.getServer().getPlayerExact(plugin.Playing.get(23)); - double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[1]); - double z = Double.parseDouble(coords[2]); - String world = coords[3]; - World w = plugin.getServer().getWorld(world); - Location loc = new Location(w, x, y, z); - Tribute_twentyfour.teleport(loc); - plugin.Frozen.add(Tribute_twentyfour.getDisplayName()); - Tribute_twentyfour.setFoodLevel(20); - } - } - }else if(args[0].equalsIgnoreCase("Start")){ - String begin = plugin.config.getString("Start_Message"); - begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2"); - final String msg = begin; - if(plugin.config.getString("Countdown").equalsIgnoreCase("true")){ - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("10"); - } - }, 20L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("9"); - } - }, 40L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("8"); - } - }, 60L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("7"); - } - }, 80L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("6"); - } - }, 100L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("5"); - } - }, 120L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("4"); - } - }, 140L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("3"); - } - }, 160L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("2"); - } - }, 180L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.getServer().broadcastMessage("1"); - } - }, 200L); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - plugin.Frozen.clear(); - plugin.getServer().broadcastMessage(msg); - plugin.canjoin = true; - } - }, 220L); - }else{ - plugin.Frozen.clear(); - plugin.getServer().broadcastMessage(msg); - plugin.canjoin = true; - } - }else{ - sender.sendMessage(ChatColor.RED + "Unknown command, type /ha help to see all commands!"); - } - } - } - return false; - } -} - diff --git a/src/me/Travja/HungerArena/JoinAndQuitListener.java b/src/me/Travja/HungerArena/JoinAndQuitListener.java deleted file mode 100644 index 3aa7403..0000000 --- a/src/me/Travja/HungerArena/JoinAndQuitListener.java +++ /dev/null @@ -1,108 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -public class JoinAndQuitListener implements Listener { - public Main plugin; - public JoinAndQuitListener(Main m) { - this.plugin = m; - } - int i = 0; - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event){ - final Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(!plugin.Watching.isEmpty()){ - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - p.hidePlayer(spectator); - } - if(plugin.Out.contains(pname)){ - plugin.Playing.add(pname); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.sendMessage(ChatColor.AQUA + "You have saved yourself from being ejected from the arena!"); - } - }, 40L); - plugin.Out.remove(pname); - } - if(plugin.Quit.contains(pname) || plugin.Dead.contains(pname)){ - String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.teleport(Spawn); - p.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfieted!"); - } - }, 40L); - } - } - @EventHandler - public void onPlayerQuit(PlayerQuitEvent event){ - final Player p = event.getPlayer(); - final String pname = p.getDisplayName(); - String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - if(plugin.Playing.contains(pname)){ - plugin.Out.add(pname); - plugin.Playing.remove(pname); - } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - if(plugin.Out.contains(pname)){ - if(plugin.canjoin== true){ - plugin.Quit.add(pname); - plugin.Out.remove(pname); - if(plugin.Playing.size()== 1){ - //Announce Winner - String winnername = plugin.Playing.get(i++); - Player winner = plugin.getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - p.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.getInventory().addItem(plugin.Reward); - //Make spectators visible - if(!plugin.Watching.isEmpty()){ - String s = plugin.Watching.get(i++); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - } - } - } - }else{ - plugin.Quit.add(pname); - plugin.Out.remove(pname); - } - } - }, 1200L); - } -} diff --git a/src/me/Travja/HungerArena/Main.java b/src/me/Travja/HungerArena/Main.java deleted file mode 100644 index 6259c62..0000000 --- a/src/me/Travja/HungerArena/Main.java +++ /dev/null @@ -1,69 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.logging.Logger; - -import org.bukkit.command.CommandExecutor; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; - -public class Main extends JavaPlugin{ - Logger log; - public ArrayList Playing = new ArrayList(); - public ArrayList Ready = new ArrayList(); - public ArrayList Dead = new ArrayList(); - public ArrayList Quit = new ArrayList(); - public ArrayList Out = new ArrayList(); - public ArrayList Watching = new ArrayList(); - public ArrayList NeedConfirm = new ArrayList(); - public HashSet Frozen = new HashSet(); - public Listener DeathListener = new DeathListener(this); - public Listener SpectatorListener = new SpectatorListener(this); - public Listener FreezeListener = new FreezeListener(this); - public Listener JoinAndQuitListener = new JoinAndQuitListener(this); - public Listener ChatListener = new ChatListener(this); - public Listener Chests = new Chests(this); - public Listener PvP = new PvP(this); - public Listener Blocks = new Blocks(this); - public Listener CommandBlock = new CommandBlock(this); - public Listener Signs = new Signs(this); - public Listener BlockStorage = new BlockStorage(this); - public CommandExecutor HaCommands = new HaCommands(this); - public CommandExecutor SponsorCommands = new SponsorCommands(this); - public CommandExecutor SpawnsCommand = new SpawnsCommand(this); - public boolean canjoin; - public boolean exists; - public FileConfiguration config; - public ItemStack Reward; - public ItemStack Cost; - public void onEnable(){ - log = this.getLogger(); - log.info("HungerArena has been Enabled"); - config = getConfig(); - config.options().copyDefaults(true); - this.saveDefaultConfig(); - getServer().getPluginManager().registerEvents(DeathListener, this); - getServer().getPluginManager().registerEvents(SpectatorListener, this); - getServer().getPluginManager().registerEvents(FreezeListener, this); - getServer().getPluginManager().registerEvents(JoinAndQuitListener, this); - getServer().getPluginManager().registerEvents(ChatListener, this); - getServer().getPluginManager().registerEvents(Chests, this); - getServer().getPluginManager().registerEvents(PvP, this); - getServer().getPluginManager().registerEvents(Blocks, this); - getServer().getPluginManager().registerEvents(CommandBlock, this); - getServer().getPluginManager().registerEvents(Signs, this); - getServer().getPluginManager().registerEvents(BlockStorage, this); - getCommand("Ha").setExecutor(HaCommands); - getCommand("Sponsor").setExecutor(SponsorCommands); - getCommand("Startpoint").setExecutor(SpawnsCommand); - Reward = new ItemStack(config.getInt("Reward.ID"), config.getInt("Reward.Amount")); - Cost = new ItemStack(config.getInt("Sponsor_Cost.ID"), config.getInt("Sponsor_Cost.Amount")); - } - public void onDisable(){ - log = this.getLogger(); - log.info("HungerArena has been Disabled"); - } -} diff --git a/src/me/Travja/HungerArena/PvP.java b/src/me/Travja/HungerArena/PvP.java deleted file mode 100644 index 1aaefb7..0000000 --- a/src/me/Travja/HungerArena/PvP.java +++ /dev/null @@ -1,24 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; - -public class PvP implements Listener { - public Main plugin; - public PvP(Main m) { - this.plugin = m; - } - @EventHandler - public void PlayerPvP(EntityDamageByEntityEvent event){ - Entity p = event.getEntity(); - if(p instanceof Player){ - String pname = ((Player) p).getDisplayName(); - if(plugin.Playing.contains(pname) && plugin.canjoin== false){ - event.setCancelled(true); - } - } - } -} diff --git a/src/me/Travja/HungerArena/Signs.java b/src/me/Travja/HungerArena/Signs.java deleted file mode 100644 index d31fb97..0000000 --- a/src/me/Travja/HungerArena/Signs.java +++ /dev/null @@ -1,47 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.player.PlayerInteractEvent; - -public class Signs implements Listener { - public Main plugin; - public Signs(Main m) { - this.plugin = m; - } - @EventHandler - public void Sign(PlayerInteractEvent event){ - Player p = event.getPlayer(); - Block b = event.getClickedBlock(); - if(event.getAction()== Action.RIGHT_CLICK_BLOCK){ - if(b.getType()== Material.SIGN || b.getType()==Material.SIGN_POST || b.getType()==Material.WALL_SIGN){ - org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState(); - String[] lines = sign.getLines(); - if(lines[0].equalsIgnoreCase(ChatColor.BLUE + "[HungerArena]")){ - if(lines[1].isEmpty()){ - p.performCommand("ha"); - }else{ - p.performCommand("ha " + lines[1]); - } - } - if(lines[0].equalsIgnoreCase(ChatColor.BLUE + "[Sponsor]")){ - p.performCommand("sponsor " + lines[1] + " " + lines[2] + " " + lines[3]); - } - } - } - } - @EventHandler - public void Create(SignChangeEvent event){ - String[] lines = event.getLines(); - String top = lines[0]; - if(top.equalsIgnoreCase("[HungerArena]") || top.equalsIgnoreCase("[Sponsor]")){ - event.setLine(0, ChatColor.BLUE + top); - } - } -} diff --git a/src/me/Travja/HungerArena/SpawnsCommand.java b/src/me/Travja/HungerArena/SpawnsCommand.java deleted file mode 100644 index 9d99ae4..0000000 --- a/src/me/Travja/HungerArena/SpawnsCommand.java +++ /dev/null @@ -1,243 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class SpawnsCommand implements CommandExecutor { - public Main plugin; - public SpawnsCommand(Main m) { - this.plugin = m; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - Player p = (Player) sender; - if(cmd.getName().equalsIgnoreCase("StartPoint")){ - if(p.hasPermission("HungerArena.StartPoint")){ - if(args[0].equalsIgnoreCase("1")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_one_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute one!"); - } - if(args[0].equalsIgnoreCase("2")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_two_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute two!"); - } - if(args[0].equalsIgnoreCase("3")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_three_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute three!"); - } - if(args[0].equalsIgnoreCase("4")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_four_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute four!"); - } - if(args[0].equalsIgnoreCase("5")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_five_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute five!"); - } - if(args[0].equalsIgnoreCase("6")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_six_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute six!"); - } - if(args[0].equalsIgnoreCase("7")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_seven_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute seven!"); - } - if(args[0].equalsIgnoreCase("8")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_eight_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute eight!"); - } - if(args[0].equalsIgnoreCase("9")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_nine_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute nine!"); - } - if(args[0].equalsIgnoreCase("10")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_ten_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute ten!"); - } - if(args[0].equalsIgnoreCase("11")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_eleven_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute eleven!"); - } - if(args[0].equalsIgnoreCase("12")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_twelve_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twelve!"); - } - if(args[0].equalsIgnoreCase("13")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_thirteen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute thirteen!"); - } - if(args[0].equalsIgnoreCase("14")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_fourteen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute fourteen!"); - } - if(args[0].equalsIgnoreCase("15")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_fifteen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute fifteen!"); - } - if(args[0].equalsIgnoreCase("16")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_sixteen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute sixteen!"); - } - if(args[0].equalsIgnoreCase("17")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_seventeen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute seventeen!"); - } - if(args[0].equalsIgnoreCase("18")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_eighteen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute eighteen!"); - } - if(args[0].equalsIgnoreCase("19")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_nineteen_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute nineteen!"); - } - if(args[0].equalsIgnoreCase("20")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_twenty_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twenty!"); - } - if(args[0].equalsIgnoreCase("21")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_twentyone_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twentyone!"); - } - if(args[0].equalsIgnoreCase("22")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_twentytwo_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twentytwo!"); - } - if(args[0].equalsIgnoreCase("23")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_twentythree_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twentythree!"); - } - if(args[0].equalsIgnoreCase("24")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.config.set("Tribute_twentyfour_spawn", x + "," + y + "," + z + "," + w); - plugin.saveConfig(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twentyfour!"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - } - return false; - } - -} diff --git a/src/me/Travja/HungerArena/SpectatorListener.java b/src/me/Travja/HungerArena/SpectatorListener.java deleted file mode 100644 index 35f001e..0000000 --- a/src/me/Travja/HungerArena/SpectatorListener.java +++ /dev/null @@ -1,125 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; - -public class SpectatorListener implements Listener { - public Main plugin; - public SpectatorListener(Main m){ - this.plugin = m; - } - @EventHandler - public void SpectatorDrops(PlayerDropItemEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Watching.contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - @EventHandler - public void SpectatorInteractions(PlayerInteractEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Watching.contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - @EventHandler - public void SpectatorItems(PlayerPickupItemEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Watching.contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - @EventHandler - public void SpectatorPvP(EntityDamageByEntityEvent event){ - Entity offense = event.getDamager(); - if(offense instanceof Player){ - Player Attacker = (Player) event.getDamager(); - String attackerName = Attacker.getDisplayName(); - if(plugin.Watching.contains(attackerName)){ - event.setCancelled(true); - Attacker.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - }else if(event.getDamager() instanceof Projectile){ - Projectile arrow = (Projectile) offense; - if(arrow.getShooter() instanceof Player){ - Player BowMan = (Player) arrow.getShooter(); - String bowManName = BowMan.getDisplayName(); - if(plugin.Watching.contains(bowManName)){ - event.setCancelled(true); - BowMan.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - @EventHandler - public void SpectatorBlocks(BlockBreakEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - if(plugin.Watching.contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - @EventHandler - public void SpectatorJoin(PlayerJoinEvent event){ - Player p = event.getPlayer(); - String pname = p.getDisplayName(); - final Player player = event.getPlayer(); - if(plugin.Watching.contains(pname)){ - if(plugin.canjoin== false){ - String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - for(Player everyone:plugin.getServer().getOnlinePlayers()){ - everyone.showPlayer(p); - } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - player.teleport(Spawn); - player.sendMessage(ChatColor.RED + "You have been teleported to spawn because the game is over!"); - } - }, 40L); - plugin.Watching.remove(pname); - }else{ - p.setAllowFlight(true); - p.setFlying(true); - for(Player everyone:plugin.getServer().getOnlinePlayers()){ - everyone.hidePlayer(p); - } - } - } - } - @EventHandler - public void MobNerf(EntityTargetEvent event){ - Entity target = event.getTarget(); - if(target instanceof Player){ - String targetName = ((Player) target).getDisplayName(); - if(plugin.Watching.contains(targetName)){ - event.setCancelled(true); - } - } - } -} diff --git a/src/me/Travja/HungerArena/SponsorCommands.java b/src/me/Travja/HungerArena/SponsorCommands.java deleted file mode 100644 index 2189a29..0000000 --- a/src/me/Travja/HungerArena/SponsorCommands.java +++ /dev/null @@ -1,102 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class SponsorCommands implements CommandExecutor { - public Main plugin; - public SponsorCommands(Main m) { - this.plugin = m; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - if(cmd.getName().equalsIgnoreCase("Sponsor")){ - if(sender instanceof Player){ - Player p = (Player) sender; - String pname = p.getName(); - String epname = p.getDisplayName(); - if(p.hasPermission("HungerArena.Sponsor")){ - if(!plugin.Playing.contains(epname)){ - if(args.length== 0){ - p.sendMessage(ChatColor.RED + "You didn't specify a tribute!"); - return false; - } - if(args.length== 1){ - p.sendMessage(ChatColor.RED + "You didn't specify an item!"); - } - if(args.length== 2){ - p.sendMessage(ChatColor.RED + "You didn't specify an amount!"); - } - if(args.length== 3){ - Player target = Bukkit.getPlayer(args[0]); - if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){ - p.sendMessage(ChatColor.RED + "You can't sponsor that item!"); - }else{ - int ID = Integer.parseInt(args[1]); - int Amount = Integer.parseInt(args[2]); - ItemStack sponsoritem = new ItemStack(ID, Amount); - if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){ - if(!plugin.Playing.contains(target.getDisplayName())){ - p.sendMessage(ChatColor.RED + "That person isn't playing!"); - }else{ - if(args[0].equalsIgnoreCase(pname)){ - p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); - }else{ - target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); - target.getInventory().addItem(sponsoritem); - p.sendMessage("You have sponsored " + target.getName() + "!"); - p.getInventory().removeItem(plugin.Cost); - } - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!"); - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(sender instanceof ConsoleCommandSender){ - if(args.length== 0){ - sender.sendMessage(ChatColor.RED + "You didn't specify a tribute!"); - return false; - } - if(args.length== 1){ - sender.sendMessage(ChatColor.RED + "You didn't specify an item!"); - } - if(args.length== 2){ - sender.sendMessage(ChatColor.RED + "You didn't specify an amount!"); - } - if(args.length== 3){ - Player target = Bukkit.getPlayer(args[0]); - if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){ - sender.sendMessage(ChatColor.RED + "You can't sponsor that item!"); - }else{ - int ID = Integer.parseInt(args[1]); - int Amount = Integer.parseInt(args[2]); - ItemStack sponsoritem = new ItemStack(ID, Amount); - if(!plugin.Playing.contains(target.getDisplayName())){ - sender.sendMessage(ChatColor.RED + "That person isn't playing!"); - }else{ - sender.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); - target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); - target.getInventory().addItem(sponsoritem); - sender.sendMessage("You have sponsored " + target.getName() + "!"); - } - } - } - } - } - return false; - } -} diff --git a/src/me/travja/hungerarena/BlockStorage.java b/src/me/travja/hungerarena/BlockStorage.java deleted file mode 100644 index 1ce0492..0000000 --- a/src/me/travja/hungerarena/BlockStorage.java +++ /dev/null @@ -1,402 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerBucketFillEvent; - -public class BlockStorage implements Listener { - public Main plugin; - public BlockStorage(Main m) { - this.plugin = m; - } - @EventHandler(priority = EventPriority.MONITOR) - public void BlockBreak(BlockBreakEvent event){ - Block b = event.getBlock(); - Player p = event.getPlayer(); - String pname = p.getName(); - if(plugin.getArena(p)!= null){ - int a = plugin.getArena(p); - if(!event.isCancelled()){ - if(plugin.Playing.get(a).contains(pname)){ - if(plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")){ - p.sendMessage(ChatColor.RED + "You can't break blocks while playing!"); - } - if(plugin.canjoin.get(a)){ - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(p.getWorld().getName()))){ - if(!plugin.management.getBoolean("blocks.useWhitelistAsBlacklist")){ - if(!plugin.management.getIntegerList("blocks.whitelist").isEmpty()){ - if(!plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "That is an illegal block!"); - }else if(plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - }else{ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "That is an illegal block!"); - } - }else{ - if(!plugin.management.getIntegerList("blocks.whitelist").isEmpty()){ - if(!plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - }else if(plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "That is an illegal block"); - } - }else{ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - } - } - } - } - } - } - } - @EventHandler(priority = EventPriority.MONITOR) - public void Explosion(EntityExplodeEvent event){ - List blocksd = event.blockList(); - Entity e = event.getEntity(); - int i = 0; - if(!event.isCancelled()){ - for(i = 1; i <= plugin.canjoin.size(); i++){ - if(plugin.canjoin.get(i)){ - i = plugin.canjoin.size()+1; - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getEntity().getWorld().getName()))){ - if(e.getType()== EntityType.PRIMED_TNT){ - if(!plugin.data.getStringList("Blocks_Placed").contains(e.getLocation().getWorld() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ()) /*|| !plugin.data.getStringList("Blocks_Destroyed").contains(e.getLocation().getWorld() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ())*/){ - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - blocks.add(e.getLocation().getWorld().getName() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ() + ",46" + ",0"); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - for(Block b:blocksd){ - String w = event.getEntity().getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + i; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + i) || !plugin.data.getStringList("Blocks_Destroyed").contains(w + "," + x + "," + y + "," + z + "," + i)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - } - } - } - } - } - @EventHandler(priority = EventPriority.MONITOR) - public void burningBlocks(BlockBurnEvent event){ - Block b = event.getBlock(); - int i = 0; - if(!event.isCancelled()){ - for(i = 1; i <= plugin.canjoin.size(); i++){ - if(plugin.canjoin.get(i)){ - i = plugin.canjoin.size()+1; - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(b.getWorld().getName()))){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + i; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + i)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - } - } - } - } - @EventHandler(priority = EventPriority.MONITOR) - public void blockPlace(BlockPlaceEvent event){ - Block b = event.getBlock(); - Player p = event.getPlayer(); - if(plugin.getArena(p)!= null){ - int a = plugin.getArena(p); - if(!event.isCancelled()){ - if(plugin.Playing.get(a).contains(p.getName())){ - if(plugin.canjoin.get(a)){ - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(b.getWorld().getName()))){ - if((b.getType()== Material.SAND || b.getType()== Material.GRAVEL) && (b.getRelative(BlockFace.DOWN).getType()== Material.AIR || b.getRelative(BlockFace.DOWN).getType()== Material.WATER || b.getRelative(BlockFace.DOWN).getType()== Material.LAVA)){ - int n = b.getY() -1; - while(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.AIR || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.WATER || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.LAVA){ - n = n -1; - event.getPlayer().sendMessage(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType().toString().toLowerCase()); - if(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.AIR || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.WATER || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.LAVA){ - int l = n +1; - Block br = b.getWorld().getBlockAt(b.getX(), l, b.getZ()); - String w = br.getWorld().getName(); - int x = br.getX(); - int y = br.getY(); - int z = br.getZ(); - String coords = w + "," + x + "," + y + "," + z + "," + a; - p.sendMessage(ChatColor.GREEN + "Sand/Gravel will land at " + coords); - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Placed", blocks); - plugin.saveData(); - } - } - }else{ - if(b.getType()!= Material.SAND || b.getType()!= Material.GRAVEL){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - String coords = w + "," + x + "," + y + "," + z + "," + a; - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Placed", blocks); - plugin.saveData(); - } - } - } - } - } - } - } - } - @EventHandler(priority = EventPriority.MONITOR) - public void bucketEmpty(PlayerBucketEmptyEvent event){ - if(plugin.getArena(event.getPlayer())!= null){ - int a = plugin.getArena(event.getPlayer()); - if(!event.isCancelled()){ - if(plugin.canjoin.get(a)){ - if(plugin.Playing.get(a).contains(event.getPlayer().getName())){ - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getPlayer().getWorld().getName()))){ - Block b = event.getBlockClicked().getRelative(event.getBlockFace()); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - String coords = w + "," + x + "," + y + "," + z + "," + a; - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Placed", blocks); - plugin.saveData(); - } - } - } - } - } - } - @EventHandler(priority = EventPriority.MONITOR) - public void bucketFill(PlayerBucketFillEvent event){ - if(plugin.getArena(event.getPlayer())!= null){ - int a = plugin.getArena(event.getPlayer()); - if(!event.isCancelled()){ - if(plugin.canjoin.get(a)){ - if(plugin.Playing.get(a).contains(event.getPlayer().getName())){ - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getPlayer().getWorld().getName()))){ - Block b = event.getBlockClicked().getRelative(event.getBlockFace()); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - } - } - } - } - } - @EventHandler(priority = EventPriority.MONITOR) - public void blockMelt(BlockFadeEvent event){ - int i = 0; - if(!event.isCancelled()){ - for(i = 1; i <= plugin.canjoin.size(); i++){ - if(plugin.canjoin.get(i)){ - if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getBlock().getWorld().getName()))){ - i = plugin.canjoin.size()+1; - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - byte m = b.getData(); - String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + i; - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + i)){ - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveData(); - } - } - } - } - } - } - /*@EventHandler - public void blockGrow(BlockGrowEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Grow: " + coords); - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void blockForm(BlockFormEvent event){ - if(plugin.canjoin== true){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Snowfall: " + coords); - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - @EventHandler - public void pistonPush(BlockPistonExtendEvent event){ - if(plugin.canjoin== true){ - for(Block b:event.getBlocks()){ - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Piston: " + coords); - List blocks = plugin.data.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - } - @EventHandler - public void onChange(BlockPhysicsEvent event){ - Block block = event.getBlock(); - Material changed = event.getChangedType(); - if (block.getType() == Material.LAVA){ - if (changed == Material.LAVA){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Lava Change: " + coords); - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - }else if(changed == Material.WATER){ - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Water Change: " + coords); - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - }else if (block.getType() == Material.SAND || block.getType() == Material.GRAVEL) { - if (changed == Material.AIR) { - Block b = event.getBlock(); - String w = b.getWorld().getName(); - int x = b.getX(); - int y = b.getY(); - int z = b.getZ(); - int d = b.getTypeId(); - String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Sand/Gravel Fall: " + coords); - List blocks = plugin.data.getStringList("Blocks_Placed"); - blocks.add(coords); - plugin.data.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); - } - } - }*/ -} \ No newline at end of file diff --git a/src/me/travja/hungerarena/ChatListener.java b/src/me/travja/hungerarena/ChatListener.java deleted file mode 100644 index b225ab4..0000000 --- a/src/me/travja/hungerarena/ChatListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; - -public class ChatListener implements Listener { - public Main plugin; - public ChatListener(Main m) { - this.plugin = m; - } - @EventHandler - public void TributeChat(AsyncPlayerChatEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - if(plugin.getArena(p)!= null){ - String msg = "<" + ChatColor.RED + "[Tribute] " + ChatColor.WHITE + pname + ">" + " " + event.getMessage(); - if(plugin.config.getString("ChatClose").equalsIgnoreCase("True")){ - double radius = plugin.config.getDouble("ChatClose_Radius"); - List near = p.getNearbyEntities(radius, radius, radius); - event.setCancelled(true); - if(!(near.size()== 0)){ - p.sendMessage(msg); - for(Entity e:near){ - if(e instanceof Player) - ((Player) e).sendMessage(msg); - } - }else if(near.size()== 0){ - p.sendMessage(msg); - p.sendMessage(ChatColor.YELLOW + "No one near!"); - }else if(!(near.size()== 0)){ - for(Entity en:near){ - if(!(en instanceof Player)){ - p.sendMessage(msg); - p.sendMessage(ChatColor.YELLOW + "No one near!"); - } - } - } - }else{ - event.setCancelled(true); - plugin.getServer().broadcastMessage(msg); - } - } - } -} diff --git a/src/me/travja/hungerarena/Chests.java b/src/me/travja/hungerarena/Chests.java deleted file mode 100644 index 45b0302..0000000 --- a/src/me/travja/hungerarena/Chests.java +++ /dev/null @@ -1,85 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.block.Chest; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; - -public class Chests implements Listener { - public Main plugin; - public Chests(Main m) { - this.plugin = m; - } - @EventHandler(priority = EventPriority.HIGHEST) - public void ChestBreak(BlockBreakEvent event){ - Player p = event.getPlayer(); - - Block block = event.getBlock(); - if(p.hasPermission("HungerArena.Chest.Break")){ - Location blocklocation = block.getLocation(); - int blockx = blocklocation.getBlockX(); - int blocky = blocklocation.getBlockY(); - int blockz = blocklocation.getBlockZ(); - if (plugin.getConfig().getStringList("StorageXYZ").contains(blockx + "," + blocky + "," + blockz)) { - if(p.hasPermission("HungerArena.Chest.Break") && plugin.getArena(p)== null){ - List list2 = plugin.getConfig().getStringList("StorageXYZ"); - list2.remove(blockx + "," + blocky + "," + blockz); - plugin.getConfig().set("Storage." + blockx + "," + blocky+ "," + blockz, null); - plugin.getConfig().set("StorageXYZ", list2); - plugin.getConfig().options().copyDefaults(true); - plugin.saveConfig(); - p.sendMessage("[HungerArena] Chest Removed!"); - } else { - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "[HungerArena] That's a storage chest! You don't have permission to break it!"); - } - } - } - } - @EventHandler - public void ChestSaves(PlayerInteractEvent event){ - Block block = event.getClickedBlock(); - Player p = event.getPlayer(); - if(plugin.getArena(p)!= null){ - int a = plugin.getArena(p); - if(plugin.Playing.get(a).contains(p.getName()) && plugin.canjoin.get(a)){ - if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){ - if(block!= null){ - if(block.getState() instanceof Chest){ - ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents(); - int blockx = block.getX(); - int blocky = block.getY(); - int blockz = block.getZ(); - String blockw = block.getWorld().getName().toString(); - if(!plugin.getConfig().contains("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X")){ - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X", blockx); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest); - plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Arena", a); - } - List list2 = plugin.getConfig().getStringList("StorageXYZ"); - if(!list2.contains(blockx + "," + blocky + "," + blockz)){ - list2.add(blockx + "," + blocky + "," + blockz); - plugin.getConfig().set("StorageXYZ", list2); - plugin.getConfig().options().copyDefaults(true); - plugin.saveConfig(); - p.sendMessage(ChatColor.GREEN + "Thank you for finding this undiscovered chest, it has been stored!!"); - } - } - } - } - } - } - } -} diff --git a/src/me/travja/hungerarena/CommandBlock.java b/src/me/travja/hungerarena/CommandBlock.java deleted file mode 100644 index fdb28de..0000000 --- a/src/me/travja/hungerarena/CommandBlock.java +++ /dev/null @@ -1,149 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; - -public class CommandBlock implements Listener { - public Main plugin; - public CommandBlock(Main m) { - this.plugin = m; - } - @EventHandler(priority = EventPriority.MONITOR) - public void CatchCommand(PlayerCommandPreprocessEvent event){ - String cmd = event.getMessage(); - Player p = event.getPlayer(); - String pname = p.getName(); - int i = 0; - int x = 0; - for(x = 1; x < plugin.Watching.size(); x++){ - if(plugin.Watching.get(x).contains(p.getName())){ - if(!p.hasPermission("HungerArena.UseCommands")){ - if(!plugin.management.getStringList("commands.whitelist").isEmpty()){ - for(String whitelist: plugin.management.getStringList("commands.whitelist")){ - i = i+1; - if(i== plugin.management.getStringList("commands.whitelist").size()){ - if(!cmd.toLowerCase().startsWith(whitelist.toLowerCase()) || !cmd.toLowerCase().startsWith("/ha")){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:"); - for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){ - p.sendMessage(ChatColor.AQUA + whitelistfull); - } - p.sendMessage(ChatColor.AQUA + "/ha"); - p.sendMessage(ChatColor.AQUA + "/ha close"); - p.sendMessage(ChatColor.AQUA + "/ha help"); - p.sendMessage(ChatColor.AQUA + "/ha join"); - p.sendMessage(ChatColor.AQUA + "/ha kick [Player]"); - p.sendMessage(ChatColor.AQUA + "/ha leave"); - p.sendMessage(ChatColor.AQUA + "/ha list"); - p.sendMessage(ChatColor.AQUA + "/ha open"); - p.sendMessage(ChatColor.AQUA + "/ha ready"); - p.sendMessage(ChatColor.AQUA + "/ha refill"); - p.sendMessage(ChatColor.AQUA + "/ha reload"); - p.sendMessage(ChatColor.AQUA + "/ha restart"); - p.sendMessage(ChatColor.AQUA + "/ha rlist"); - p.sendMessage(ChatColor.AQUA + "/ha setspawn"); - p.sendMessage(ChatColor.AQUA + "/ha start"); - p.sendMessage(ChatColor.AQUA + "/ha tp"); - p.sendMessage(ChatColor.AQUA + "/ha watch"); - p.sendMessage(ChatColor.AQUA + "/ha warpall"); - } - } - } - }else if(!cmd.toLowerCase().startsWith("/ha")){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are only allowed to perform /ha commands!"); - } - }else if(!cmd.toLowerCase().startsWith("/ha")){ - if(cmd.toLowerCase().startsWith("/spawn")){ - event.setCancelled(true); - p.sendMessage("You have perms for all commands except this one!"); - } - } - } - } - if(plugin.getArena(p)!= null){ - if(!p.hasPermission("HungerArena.UseCommands")){ - if(!plugin.management.getStringList("commands.whitelist").isEmpty()){ - for(String whitelist: plugin.management.getStringList("commands.whitelist")){ - i = i+1; - if(i== plugin.management.getStringList("commands.whitelist").size()){ - if(!cmd.toLowerCase().startsWith(whitelist.toLowerCase()) || !cmd.toLowerCase().startsWith("/ha")){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:"); - for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){ - p.sendMessage(ChatColor.AQUA + whitelistfull); - } - p.sendMessage(ChatColor.AQUA + "/ha"); - p.sendMessage(ChatColor.AQUA + "/ha close"); - p.sendMessage(ChatColor.AQUA + "/ha help"); - p.sendMessage(ChatColor.AQUA + "/ha join"); - p.sendMessage(ChatColor.AQUA + "/ha kick [Player]"); - p.sendMessage(ChatColor.AQUA + "/ha leave"); - p.sendMessage(ChatColor.AQUA + "/ha list"); - p.sendMessage(ChatColor.AQUA + "/ha open"); - p.sendMessage(ChatColor.AQUA + "/ha ready"); - p.sendMessage(ChatColor.AQUA + "/ha refill"); - p.sendMessage(ChatColor.AQUA + "/ha reload"); - p.sendMessage(ChatColor.AQUA + "/ha restart"); - p.sendMessage(ChatColor.AQUA + "/ha rlist"); - p.sendMessage(ChatColor.AQUA + "/ha setspawn"); - p.sendMessage(ChatColor.AQUA + "/ha start"); - p.sendMessage(ChatColor.AQUA + "/ha tp"); - p.sendMessage(ChatColor.AQUA + "/ha watch"); - p.sendMessage(ChatColor.AQUA + "/ha warpall"); - } - } - } - }else if(!cmd.toLowerCase().startsWith("/ha")){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are only allowed to perform /ha commands!"); - } - }else if(!cmd.toLowerCase().startsWith("/ha")){ - if(cmd.toLowerCase().startsWith("/spawn")){ - event.setCancelled(true); - p.sendMessage("You have perms for all commands except this one!"); - } - } - }else if(cmd.toLowerCase().equals("/back")){ - for(i = 1; i < plugin.Dead.size(); i++){ - if(plugin.Dead.get(i).contains(pname) && plugin.canjoin.get(i)) - plugin.Tele.add(p); - } - }else if(cmd.startsWith("/tp") || cmd.startsWith("/tpa") || cmd.startsWith("/tpo")){ - String[] args = cmd.split(" "); - Player arg1 = null; - Player arg2 = null; - if(args.length == 2){ - if(Bukkit.getPlayer(args[0]) != null && Bukkit.getPlayer(args[1]) != null){ - arg1 = Bukkit.getPlayer(args[0]); - arg2 = Bukkit.getPlayer(args[1]); - if(plugin.isSpectating(p)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "Invalid command for spectating, using /ha tp " + arg2); - p.performCommand("/ha tp " + arg2); - }else if(plugin.getArena(arg1)!= null || plugin.getArena(arg2)!= null){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You can't teleport to other tributes!"); - } - } - }else if(args.length == 1){ - if(Bukkit.getPlayer(args[0]) != null){ - arg1 = Bukkit.getPlayer(args[0]); - if(plugin.isSpectating(p)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "Invalid command for spectating, using /ha tp " + arg1); - p.performCommand("/ha tp " + arg1); - }else if(plugin.getArena(arg1)!= null || plugin.getArena(p)!= null){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You can't teleport to other tributes!"); - } - } - } - } - } -} diff --git a/src/me/travja/hungerarena/DeathListener.java b/src/me/travja/hungerarena/DeathListener.java deleted file mode 100644 index 15d653d..0000000 --- a/src/me/travja/hungerarena/DeathListener.java +++ /dev/null @@ -1,151 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerRespawnEvent; - -public class DeathListener implements Listener{ - public Main plugin; - public DeathListener(Main m){ - this.plugin = m; - } - public FileConfiguration config; - int i = 0; - int a = 0; - @EventHandler - public void onPlayerRespawn(PlayerRespawnEvent event){ - final Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 1; i < plugin.Dead.size(); i++){ - if(plugin.Dead.get(i).contains(pname)){ - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - World spawnw = plugin.getServer().getWorld(Spawncoords[3]); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.teleport(Spawn); - } - }, 10L); - } - } - } - @EventHandler - public void onPlayerDeath(PlayerDeathEvent event){ - Player p = event.getEntity(); - Server s = p.getServer(); - String pname = p.getName(); - int players = plugin.Playing.size()-1; - String leftmsg = null; - for(i = 1; i < plugin.Frozen.size(); i++){ - if(plugin.Frozen.get(i).contains(pname)){ - if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - players = plugin.Playing.get(a).size()-1; - leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!"; - if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ - double y = p.getLocation().getY(); - double newy = y+200; - double x = p.getLocation().getX(); - double z = p.getLocation().getZ(); - Location strike = new Location(p.getWorld(), x, newy, z); - p.getWorld().strikeLightning(strike); - } - event.setDeathMessage(""); - if(plugin.config.getBoolean("broadcastAll")){ - p.getServer().broadcastMessage(pname + ChatColor.LIGHT_PURPLE + " Stepped off their pedestal too early!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(pname + ChatColor.LIGHT_PURPLE + " Stepped off their pedestal too early!"); - } - } - plugin.Frozen.get(a).remove(pname); - plugin.Playing.get(a).remove(pname); - plugin.Dead.get(a).add(pname); - if(plugin.config.getBoolean("broadcastAll")){ - p.getServer().broadcastMessage(leftmsg); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(leftmsg); - } - } - plugin.winner(a); - } - }else if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - players = plugin.Playing.get(a).size()-1; - leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!"; - if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ - double y = p.getLocation().getY(); - double newy = y+200; - double x = p.getLocation().getX(); - double z = p.getLocation().getZ(); - Location strike = new Location(p.getWorld(), x, newy, z); - p.getWorld().strikeLightning(strike); - } - plugin.Dead.get(a).add(pname); - plugin.Playing.get(a).remove(pname); - if(p.getKiller() instanceof Player){ - if(p.getKiller().getItemInHand().getType().getId()== 0){ - Player killer = p.getKiller(); - String killername = killer.getName(); - event.setDeathMessage(""); - if(plugin.config.getBoolean("broadcastAll")){ - s.broadcastMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!"); - s.broadcastMessage(leftmsg); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!"); - g.sendMessage(leftmsg); - } - } - plugin.winner(a); - }else{ - Player killer = p.getKiller(); - String killername = killer.getName(); - String weapon = killer.getItemInHand().getType().toString().replace('_', ' '); - String msg = ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with a(n) " + weapon; - event.setDeathMessage(""); - if(plugin.config.getBoolean("broadcastAll")){ - s.broadcastMessage(msg); - s.broadcastMessage(leftmsg); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(msg); - g.sendMessage(leftmsg); - } - } - plugin.winner(a); - } - }else{ - event.setDeathMessage(""); - if(plugin.config.getBoolean("broadcastAll")){ - s.broadcastMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!"); - s.broadcastMessage(leftmsg); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!"); - g.sendMessage(leftmsg); - } - } - plugin.winner(a); - } - } - } - } -} diff --git a/src/me/travja/hungerarena/DmgListener.java b/src/me/travja/hungerarena/DmgListener.java deleted file mode 100644 index 41cfe93..0000000 --- a/src/me/travja/hungerarena/DmgListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageEvent; - -/** - * - * @author YoshiGenius - */ -public class DmgListener implements Listener { - - public Main plugin; - public DmgListener(Main m) { - this.plugin = m; - } - int i = 0; - @EventHandler - public void onDmg(EntityDamageEvent evt) { - Entity e = evt.getEntity(); - if (e instanceof Player) { - Player p = (Player) e; - String pn = p.getName(); - for(i= 1; i < plugin.Frozen.size(); i++){ - if (plugin.Frozen.get(i).contains(pn)) - evt.setCancelled(true); - } - } - } - -} diff --git a/src/me/travja/hungerarena/FreezeListener.java b/src/me/travja/hungerarena/FreezeListener.java deleted file mode 100644 index 1ab1197..0000000 --- a/src/me/travja/hungerarena/FreezeListener.java +++ /dev/null @@ -1,63 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.HashMap; - -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; - -public class FreezeListener implements Listener { - public Main plugin; - public FreezeListener(Main m) { - this.plugin = m; - } - int i = 0; - int a = 0; - private HashMap timeUp= new HashMap(); - @EventHandler - public void onPlayerMove(PlayerMoveEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - if(plugin.Frozen.get(a).contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){ - if(plugin.config.getString("Explode_on_Move").equalsIgnoreCase("true")){ - for(String players: plugin.Playing.get(a)){ - final Player playing = plugin.getServer().getPlayerExact(players); - i = plugin.Playing.get(a).indexOf(players); - if(!timeUp.get(a)){ - if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(a).get(i))){ - playing.teleport(plugin.location.get(a).get(i)); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - if(!timeUp.get(a)){ - timeUp.put(a, true); - } - } - },30L); - } - }else{ - if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(a).get(i))){ - if(!plugin.Dead.get(a).contains(playing.getName())){ - World world = playing.getLocation().getWorld(); - world.createExplosion(playing.getLocation(), 0.0F, false); - playing.setHealth(0); - } - } - } - } - }else{ - for(String players:plugin.Playing.get(a)){ - Player playing = plugin.getServer().getPlayerExact(players); - i = plugin.Playing.get(a).indexOf(players)+1; - if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(a).get(i))){ - playing.teleport(plugin.location.get(a).get(i)); - } - } - } - } - } - } -} diff --git a/src/me/travja/hungerarena/HaCommands.java b/src/me/travja/hungerarena/HaCommands.java deleted file mode 100644 index 40d1b51..0000000 --- a/src/me/travja/hungerarena/HaCommands.java +++ /dev/null @@ -1,1558 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.Chest; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class HaCommands implements CommandExecutor { - public Main plugin; - public HaCommands(Main m) { - this.plugin = m; - } - int i = 0; - int a = 1; - @SuppressWarnings("deprecation") - private void clearInv(Player p){ - p.getInventory().clear(); - p.getInventory().setBoots(null); - p.getInventory().setChestplate(null); - p.getInventory().setHelmet(null); - p.getInventory().setLeggings(null); - p.updateInventory(); - } - @SuppressWarnings({ "unchecked" }) - @Override - public boolean onCommand(final CommandSender sender, Command cmd, String commandLabel, String[] args){ - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - String spawnworld = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(spawnworld); - Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - if(sender instanceof Player){ - final Player p = (Player) sender; - final String pname = p.getName(); - ChatColor c = ChatColor.AQUA; - if(cmd.getName().equalsIgnoreCase("Ha")){ - if(args.length== 0){ - p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja! Version: " + plugin.getDescription().getVersion()); - return false; - }else if(args[0].equalsIgnoreCase("SetSpawn")){ - if(p.hasPermission("HungerArena.SetSpawn")){ - double x = p.getLocation().getX(); - double y = p.getLocation().getY(); - double z = p.getLocation().getZ(); - String w = p.getWorld().getName(); - plugin.spawns.set("Spawn_coords", x + "," + y + "," + z + "," + w); - plugin.spawns.set("Spawns_set", "true"); - plugin.saveSpawns(); - p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Help")){ - p.sendMessage(ChatColor.GREEN + "----HungerArena Help----"); - sender.sendMessage(c + "/ha - Displays author message!"); - sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!"); - sender.sendMessage(c + "/startpoint [1,2,3,4,etc] [1,2,3,4,etc] - Sets the starting points of tributes in a specific arena!"); - sender.sendMessage(c + "/ha close (1,2,3,4,etc) - Prevents anyone from joining that arena! Numbers are optional"); - sender.sendMessage(c + "/ha help - Displays this screen!"); - sender.sendMessage(c + "/ha join [1,2,3,4,etc] - Makes you join the game!"); - sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!"); - sender.sendMessage(c + "/ha leave - Makes you leave the game!"); - sender.sendMessage(c + "/ha list (1,2,3,4,etc) - Shows a list of players in the game and their health! Numbers are optional."); - sender.sendMessage(c + "/ha open (1,2,3,4,etc) - Opens the game allowing people to join! Numbers are optional"); - sender.sendMessage(c + "/ha ready - Votes for the game to start!"); - sender.sendMessage(c + "/ha refill (1,2,3,4,etc) - Refills all chests! Numbers are optional"); - sender.sendMessage(c + "/ha reload - Reloads the config!"); - sender.sendMessage(c + "/ha restart (1,2,3,4,etc) - Restarts the game! Numbers are optional"); - sender.sendMessage(c + "/ha rlist (1,2,3,4,etc) - See who's ready! Numbers are optional"); - sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!"); - sender.sendMessage(c + "/ha tp [player] - Teleports you to a tribute!"); - sender.sendMessage(c + "/ha start [1,2,3,4,etc] - Unfreezes tributes allowing them to fight!"); - sender.sendMessage(c + "/ha watch [1,2,3,4,etc] - Lets you watch the tributes!"); - sender.sendMessage(c + "/ha warpall [1,2,3,4,etc] - Warps all tribute into position!"); - sender.sendMessage(ChatColor.GREEN + "----------------------"); - }else if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){ - p.sendMessage(ChatColor.RED + "That can't be run in this world!"); - }else if((plugin.restricted && plugin.worlds.contains(p.getWorld().getName())) || !plugin.restricted){ - //////////////////////////////////////// LISTING /////////////////////////////////////////////// - if(args[0].equalsIgnoreCase("List")){ - if(p.hasPermission("HungerArena.GameMaker") || plugin.Watching.get(a).contains(pname) || p.hasPermission("HungerArena.List")){ - if(args.length>= 2){ - try{ - a = Integer.parseInt(args[1]); - sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); - if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ - for(String playernames: plugin.Playing.get(a)){ - Player players = plugin.getServer().getPlayerExact(playernames); - if(p.hasPermission("HungerArena.GameMaker")){ - sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); - }else if(p.hasPermission("HungerArena.List")){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - } - }else{ - p.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - p.sendMessage(ChatColor.AQUA + "-------------------"); - }catch(Exception e){ - p.sendMessage(ChatColor.RED + "Argument not an integer or is an invalid arena!"); - } - }else{ - if(plugin.getArena(p)== null){ - p.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); - if(!plugin.Playing.get(1).isEmpty() && plugin.Playing.containsKey(1)){ - for(String playernames: plugin.Playing.get(1)){ - Player players = plugin.getServer().getPlayerExact(playernames); - if(p.hasPermission("HungerArena.GameMaker")){ - sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); - }else if(p.hasPermission("HungerArena.List")){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - } - }else{ - p.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - }else{ - a = plugin.getArena(p); - sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); - if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ - for(String playernames: plugin.Playing.get(a)){ - Player players = plugin.getServer().getPlayerExact(playernames); - if(p.hasPermission("HungerArena.GameMaker")){ - sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); - }else if(p.hasPermission("HungerArena.List")){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - } - }else{ - p.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - } - p.sendMessage(ChatColor.AQUA + "-------------------"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("rList")){ - if(p.hasPermission("HungerArena.GameMaker")){ - if(args.length>= 2){ - try{ - a = Integer.parseInt(args[1]); - sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); - if(!plugin.Ready.get(a).isEmpty() && plugin.Ready.containsKey(a)){ - for(String playernames: plugin.Ready.get(a)){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - }else{ - p.sendMessage(ChatColor.GRAY + "No one is ready!"); - } - p.sendMessage(ChatColor.AQUA + "-------------------"); - }catch(Exception e){ - p.sendMessage(ChatColor.RED + "Argument not an integer!"); - } - }else{ - p.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); - if(!plugin.Ready.get(1).isEmpty() && plugin.Ready.containsKey(1)){ - for(String playernames: plugin.Ready.get(1)){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - }else{ - p.sendMessage(ChatColor.GRAY + "No one is ready!"); - } - p.sendMessage(ChatColor.AQUA + "-------------------"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - //////////////////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////// JOINING/LEAVING ////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("Join")){ - if(p.hasPermission("HungerArena.Join")){ - boolean needconfirm = false; - for(i= 1; i< plugin.NeedConfirm.size(); i++){ - if(plugin.NeedConfirm.get(i).contains(pname)){ - needconfirm = true; - p.sendMessage(ChatColor.GOLD + "You need to run /ha confirm"); - } - } - if(!needconfirm){ - try{ - a = Integer.parseInt(args[1]); - }catch(Exception e){ - i = 1; - while(i <= plugin.Playing.size()){ - if(plugin.Playing.get(i).size()< plugin.maxPlayers.get(i)){ - a = i; - i = plugin.Playing.size()+1; - } - if(plugin.Playing.size()== i){ - p.sendMessage(ChatColor.RED + "All games are full!"); - } - i++; - } - } - if(plugin.Playing.get(a)!= null){ - if(plugin.Playing.get(a).contains(pname)){ - p.sendMessage(ChatColor.RED + "You are already playing!"); - }else if(plugin.Dead.get(a).contains(pname) || plugin.Quit.get(a).contains(pname)){ - p.sendMessage(ChatColor.RED + "You DIED/QUIT! You can't join again!"); - }else if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - p.sendMessage(ChatColor.RED + "There are already " + plugin.maxPlayers.get(a) + " Tributes in that Arena!"); - }else if(plugin.canjoin.get(a)== true){ - p.sendMessage(ChatColor.RED + "That game is in progress!"); - }else if(!plugin.open.get(a)){ - p.sendMessage(ChatColor.RED + "That game is closed!"); - }else if(plugin.spawns.getString("Spawns_set").equalsIgnoreCase("false")){ - p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); - }else if(plugin.NeedConfirm.get(a).contains(pname)){ - p.sendMessage(ChatColor.RED + "You need to do /ha confirm"); - }else if(plugin.getArena(p)!= null){ - p.sendMessage(ChatColor.RED + "You are already in an arena!"); - }else if(plugin.config.getString("Need_Confirm").equalsIgnoreCase("true")){ - if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ - i = 0; - for(ItemStack fee: plugin.Fee){ - int total = plugin.Fee.size(); - if(p.getInventory().contains(fee)){ - i = i+1; - if(total == i){ - plugin.NeedConfirm.get(a).add(pname); - p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); - } - } - } - if(plugin.Fee.size() > i){ - p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); - } - }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ - i = 0; - for(ItemStack fee: plugin.Fee){ - int total = plugin.Fee.size(); - if(p.getInventory().contains(fee)){ - i = i+1; - if(total == i){ - plugin.NeedConfirm.get(a).add(pname); - p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); - } - } - } - if(plugin.Fee.size() > i){ - p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); - } - }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ - plugin.NeedConfirm.get(a).add(pname); - p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); - } - }else{ - plugin.NeedConfirm.get(a).add(pname); - p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); - } - }else if(plugin.config.getString("Need_Confirm").equalsIgnoreCase("false")){ - if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ - i = 0; - for(ItemStack fee: plugin.Fee){ - int total = plugin.Fee.size(); - if(p.getInventory().contains(fee)){ - i = i+1; - if(total == i){ - plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); - for(ItemStack fees: plugin.Fee){ - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); - } - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - } - } - } - if(plugin.Fee.size() > i){ - p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); - } - }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ - i = 0; - for(ItemStack fee: plugin.Fee){ - int total = plugin.Fee.size(); - if(p.getInventory().contains(fee)){ - i = i+1; - if(total == i){ - for(ItemStack fees: plugin.Fee){ - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); - } - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - } - } - } - if(plugin.Fee.size() > i){ - p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); - } - }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ - plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); - } - }else{ - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "That arena doesn't exist!"); - } - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - //////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////// CONFIRMATION /////////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("Confirm")){ - int v = 0; - for(v = 1; v < plugin.NeedConfirm.size(); v++){ - if(plugin.NeedConfirm.get(v).contains(pname)){ - v = plugin.NeedConfirm.size()+1; - if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ - i = 0; - for(ItemStack fee: plugin.Fee){ - int total = plugin.Fee.size(); - if(p.getInventory().contains(fee)){ - i = i+1; - if(total == i){ - plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); - for(ItemStack fees: plugin.Fee){ - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); - } - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - } - } - } - if(plugin.Fee.size() > i){ - p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); - } - }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ - i = 0; - for(ItemStack fee: plugin.Fee){ - int total = plugin.Fee.size(); - if(p.getInventory().contains(fee)){ - i = i+1; - if(total == i){ - for(ItemStack fees: plugin.Fee){ - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); - } - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - } - } - } - if(plugin.Fee.size() > i){ - p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); - } - }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ - plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); - } - }else{ - plugin.Playing.get(a).add(pname); - plugin.NeedConfirm.get(a).remove(pname); - p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); - clearInv(p); - if(plugin.config.getBoolean("broadcastAll")){ - plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); - } - } - if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); - } - } - } - if(v== plugin.NeedConfirm.size()){ - p.sendMessage(ChatColor.RED + "You haven't joined any games!"); - } - } - }else if(args[0].equalsIgnoreCase("Ready")){ - p.sendMessage(String.valueOf(plugin.getArena(p))); - if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - for(String s:plugin.Playing.get(a)) - p.sendMessage(s); - if(plugin.Playing.get(a).contains(pname)){ - if(plugin.Ready.get(a).contains(pname)){ - p.sendMessage(ChatColor.RED + "You're already ready!"); - }else if(plugin.Playing.get(a).size()== 1){ - p.sendMessage(ChatColor.RED + "You can't be ready when no one else is playing!"); - }else{ - plugin.Ready.get(a).add(pname); - p.sendMessage(ChatColor.AQUA + "You have marked yourself as READY!"); - if(plugin.Playing.get(a).size()-4== plugin.Ready.get(a).size() || plugin.Playing.get(a).size()==plugin.Ready.get(a).size()){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha warpall " + a); - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "You aren't playing in any games!"); - } - }else if(args[0].equalsIgnoreCase("Leave")){ - if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - if(plugin.canjoin.get(a)== true){ - plugin.Playing.get(a).remove(pname); - p.sendMessage(ChatColor.AQUA + "You have left the game!"); - if(plugin.config.getBoolean("broadcastAll")){ - p.getServer().broadcastMessage(ChatColor.RED + pname + " Left Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.RED + pname + " Quit!"); - } - } - clearInv(p); - p.teleport(Spawn); - if(plugin.Frozen.get(a).contains(pname)){ - plugin.Frozen.get(a).remove(pname); - } - plugin.winner(a); - }else{ - plugin.Playing.get(a).remove(pname); - p.sendMessage(ChatColor.AQUA + "You have left the game!"); - if(plugin.config.getBoolean("broadcastAll")){ - p.getServer().broadcastMessage(ChatColor.RED + pname + " Left Arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.RED + pname + " Quit!"); - } - } - clearInv(p); - p.teleport(Spawn); - if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - plugin.econ.depositPlayer(pname, plugin.config.getDouble("EntryFee.cost")); - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been added to your account!"); - for(ItemStack fees: plugin.Fee){ - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was refunded because you left the games."); - } - }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ - for(ItemStack fees: plugin.Fee){ - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was refunded because you left the games."); - } - }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ - plugin.econ.depositPlayer(pname, plugin.config.getDouble("EntryFee.cost")); - p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has added to your account!"); - } - } - }else{ - p.sendMessage(ChatColor.RED + "You aren't in any games!"); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////// SPECTATOR RELATED ////////////////////////////////// - }else if(args[0].equalsIgnoreCase("Watch")){ - if(sender.hasPermission("HungerArena.Watch")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(!plugin.Watching.get(a).contains(pname) && plugin.getArena(p)== null && plugin.canjoin.get(a)== true){ - plugin.Watching.get(a).add(pname); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.hidePlayer(p); - } - p.setAllowFlight(true); - p.sendMessage(ChatColor.AQUA + "You can now spectate!"); - }else if(plugin.canjoin.get(a)== false){ - p.sendMessage(ChatColor.RED + "That game isn't in progress!"); - }else if(plugin.Playing.get(a).contains(pname)){ - p.sendMessage(ChatColor.RED + "You can't watch while you're playing!"); - }else if(plugin.Watching.get(a).contains(pname)){ - plugin.Watching.get(a).remove(pname); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(p); - } - p.teleport(Spawn); - p.setAllowFlight(false); - p.sendMessage(ChatColor.AQUA + "You are not spectating any more"); - } - }else{ - p.sendMessage(ChatColor.RED + "Too few arguments!"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("tp")){ - int b = 0; - for(i = 1; i <= plugin.Watching.size(); i++){ - if(plugin.Watching.get(a).contains(pname)){ - if(plugin.getArena(Bukkit.getServer().getPlayer(args[1])) != null){ - Player target = Bukkit.getServer().getPlayer(args[1]); - p.teleport(target); - p.sendMessage(ChatColor.AQUA + "You've been teleported to " + target.getName()); - }else{ - p.sendMessage(ChatColor.RED + "That person isn't in game!"); - } - }else{ - b = b+1; - if(b== plugin.Watching.size()){ - p.sendMessage(ChatColor.RED + "You have to be spectating first!"); - } - } - } - ///////////////////////////////////////////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("Kick")){ - if (args.length != 2) { - return false; - } - Player target = Bukkit.getServer().getPlayer(args[1]); - if(sender.hasPermission("HungerArena.Kick")){ - if(plugin.getArena(target) != null){ - a = plugin.getArena(target); - plugin.Playing.get(a).remove(target.getName()); - if(plugin.config.getBoolean("broadcastAll")){ - p.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.RED + target.getName() + " was kicked from the game!"); - } - } - clearInv(target); - target.teleport(Spawn); - plugin.Quit.get(a).add(target.getName()); - plugin.winner(a); - }else{ - sender.sendMessage(ChatColor.RED + "That player isn't in the game!"); - } - }else{ - sender.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Refill")){ - if(p.hasPermission("HungerArena.Refill")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - int list056; - list056 = 0; - int limit = plugin.config.getStringList("StorageXYZ").size(); - while(limit > list056){ - String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); - int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); - int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); - int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); - int chesta = plugin.getConfig().getInt("Storage." + xyz2 + ".Arena"); - String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); - Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); - plugin.exists = false; - if(chesta== a){ - if(blockatlocation.getState() instanceof Chest){ - plugin.exists = true; - Chest chest = (Chest) blockatlocation.getState(); - if(chesta== a){ - chest.getInventory().clear(); - ItemStack[] itemsinchest = null; - Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); - if(o instanceof ItemStack[]){ - itemsinchest = (ItemStack[]) o; - }else if(o instanceof List){ - itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); - } - list056 = list056+1; - chest.getInventory().setContents(itemsinchest); - chest.update(); - } - } - }else{ - list056 = list056+1; - } - if(limit== list056){ - sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!"); - } - } - }else{ - int list056; - list056 = 0; - int limit = plugin.config.getStringList("StorageXYZ").size(); - while(limit > list056){ - String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); - int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); - int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); - int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); - String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); - Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); - plugin.exists = false; - if(blockatlocation.getState() instanceof Chest){ - plugin.exists = true; - Chest chest = (Chest) blockatlocation.getState(); - chest.getInventory().clear(); - ItemStack[] itemsinchest = null; - Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); - if(o instanceof ItemStack[]){ - itemsinchest = (ItemStack[]) o; - }else if(o instanceof List){ - itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); - } - list056 = list056+1; - chest.getInventory().setContents(itemsinchest); - chest.update(); - } - } - if(limit== list056){ - sender.sendMessage(ChatColor.GREEN + "All chests refilled!"); - } - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(args[0].equalsIgnoreCase("Restart")){ - int b = 0; - if(p.hasPermission("HungerArena.Restart")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - for(b = 0; b < plugin.Watching.get(a).size(); b++){ - String s = plugin.Watching.get(a).get(b); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - plugin.Dead.get(a).clear(); - plugin.Quit.get(a).clear(); - plugin.Watching.get(a).clear(); - plugin.Frozen.get(a).clear(); - plugin.Ready.get(a).clear(); - plugin.NeedConfirm.get(a).clear(); - plugin.Out.get(a).clear(); - plugin.Playing.get(a).clear(); - plugin.inArena.get(a).clear(); - plugin.canjoin.put(a, false); - plugin.open.put(a, true); - List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); - List blocksplaced = plugin.data.getStringList("Blocks_Placed"); - ArrayList toremove = new ArrayList(); - ArrayList toremove2 = new ArrayList(); - for(String blocks:blocksplaced){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int arena = Integer.parseInt(coords[4]); - int d = 0; - byte m = 0; - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - if(arena== a){ - block.setTypeIdAndData(d, m, true); - block.getState().update(); - toremove.add(blocks); - } - } - for(String blocks:blocksbroken){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int d = Integer.parseInt(coords[4]); - byte m = Byte.parseByte(coords[5]); - int arena = Integer.parseInt(coords[6]); - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - if(arena== a){ - block.setTypeIdAndData(d, m, true); - block.getState().update(); - toremove2.add(blocks); - } - } - for(String blocks: toremove){ - blocksplaced.remove(blocks); - } - for(String blocks: toremove2){ - blocksbroken.remove(blocks); - } - toremove.clear(); - toremove2.clear(); - plugin.data.set("Blocks_Destroyed", blocksbroken); - plugin.data.set("Blocks_Placed", blocksplaced); - plugin.data.options().copyDefaults(); - plugin.saveData(); - p.performCommand("ha refill " + a); - p.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!"); - }else{ - for(i = 1; i <= plugin.Watching.size(); i++){ - for(b = 0; b <= plugin.Watching.get(i).size(); b++){ - if(plugin.Watching.get(i).get(b)!= null){ - String s = plugin.Watching.get(i).get(b); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - } - } - plugin.Dead.clear(); - plugin.Quit.clear(); - plugin.Watching.clear(); - plugin.Frozen.clear(); - plugin.Ready.clear(); - plugin.NeedConfirm.clear(); - plugin.Out.clear(); - plugin.Playing.clear(); - plugin.inArena.clear(); - for(i = 1; i <= plugin.canjoin.size(); i++){ - plugin.canjoin.put(i, false); - } - for(i = 1; i <= plugin.open.size(); i++){ - plugin.open.put(i, true); - } - List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); - List blocksplaced = plugin.data.getStringList("Blocks_Placed"); - for(String blocks:blocksplaced){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int d = 0; - byte m = 0; - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - block.setTypeIdAndData(d, m, true); - block.getState().update(); - } - for(String blocks:blocksbroken){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int d = Integer.parseInt(coords[4]); - byte m = Byte.parseByte(coords[5]); - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - block.setTypeIdAndData(d, m, true); - block.getState().update(); - } - blocksplaced.clear(); - blocksbroken.clear(); - plugin.data.set("Blocks_Destroyed", blocksbroken); - plugin.data.set("Blocks_Placed", blocksplaced); - plugin.data.options().copyDefaults(); - plugin.saveData(); - p.performCommand("ha refill"); - p.sendMessage(ChatColor.AQUA + "All games have been reset!"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - /////////////////////////////////// Toggle ////////////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("close")){ - if(p.hasPermission("HungerArena.toggle")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(plugin.open.get(a)){ - plugin.open.put(a, false); - if(plugin.Playing.get(a)!= null){ - for(String players: plugin.Playing.get(a)){ - Player tributes = plugin.getServer().getPlayerExact(players); - clearInv(tributes); - tributes.teleport(tributes.getWorld().getSpawnLocation()); - } - } - if(plugin.Watching.get(a)!= null){ - for(String sname: plugin.Watching.get(a)){ - Player spectators = plugin.getServer().getPlayerExact(sname); - spectators.teleport(spectators.getWorld().getSpawnLocation()); - spectators.setAllowFlight(false); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectators); - } - } - } - plugin.Dead.get(a).clear(); - plugin.Quit.get(a).clear(); - plugin.Watching.get(a).clear(); - plugin.Frozen.get(a).clear(); - plugin.Ready.get(a).clear(); - plugin.NeedConfirm.get(a).clear(); - plugin.Out.get(a).clear(); - plugin.Playing.get(a).clear(); - plugin.inArena.get(a).clear(); - p.performCommand("ha refill " + a); - p.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!"); - }else{ - p.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!"); - } - }else{ - for(i = 1; i <= plugin.open.size(); i++){ - if(plugin.open.get(i)){ - plugin.open.put(i, false); - if(plugin.Playing.get(i)!= null){ - for(String players: plugin.Playing.get(i)){ - Player tributes = plugin.getServer().getPlayerExact(players); - clearInv(tributes); - tributes.teleport(tributes.getWorld().getSpawnLocation()); - } - } - if(plugin.Watching.get(i)!= null){ - for(String sname: plugin.Watching.get(i)){ - Player spectators = plugin.getServer().getPlayerExact(sname); - spectators.teleport(spectators.getWorld().getSpawnLocation()); - spectators.setAllowFlight(false); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectators); - } - } - } - plugin.Dead.clear(); - plugin.Quit.clear(); - plugin.Watching.clear(); - plugin.Frozen.clear(); - plugin.Ready.clear(); - plugin.NeedConfirm.clear(); - plugin.Out.clear(); - plugin.Playing.clear(); - plugin.inArena.clear(); - p.performCommand("ha refill"); - p.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!"); - }else{ - p.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!"); - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "No Perms!"); - } - }else if(args[0].equalsIgnoreCase("open")){ - if(p.hasPermission("HungerArena.toggle")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(!plugin.open.get(a)){ - plugin.open.put(a, true); - p.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); - }else{ - p.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); - } - }else{ - for(i = 1; i <= plugin.open.size(); i++){ - if(!plugin.open.get(i)){ - plugin.open.put(i, true); - p.sendMessage(ChatColor.GOLD + "Arena " + i + " Open!"); - i = i+1; - }else{ - p.sendMessage(ChatColor.RED + "Arena " + i + " already open, type /ha close to close them!"); - i = i+1; - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "No Perms!"); - } - //////////////////////////////////////////////////////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("Reload")){ - if(p.hasPermission("HungerArena.Reload")){ - plugin.location.clear(); - plugin.Reward.clear(); - plugin.Cost.clear(); - plugin.Fee.clear(); - plugin.onEnable(); - p.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!"); - System.out.println(ChatColor.GREEN + pname + " reloaded HungerArena!"); - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission"); - } - }else if(args[0].equalsIgnoreCase("WarpAll")){ - if(p.hasPermission("HungerArena.Warpall")){ - if(plugin.spawns.getString("Spawns_set").equalsIgnoreCase("false")){ - sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); - }else{ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(plugin.Playing.get(a).size()== 1){ - sender.sendMessage(ChatColor.RED + "There are not enough players!"); - }else{ - if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){ - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start " + a); - } - }, 20L); - } - i = 1; - for(String playing:plugin.Playing.get(a)){ - Player tribute = plugin.getServer().getPlayerExact(playing); - tribute.teleport(plugin.location.get(a).get(i)); - tribute.setHealth(20); - tribute.setFoodLevel(20); - tribute.setSaturation(20); - tribute.setLevel(0); - clearInv(tribute); - for(PotionEffect pe: tribute.getActivePotionEffects()){ - PotionEffectType potion = pe.getType(); - tribute.removePotionEffect(potion); - } - if(tribute.getAllowFlight()){ - tribute.setAllowFlight(false); - } - plugin.Frozen.get(a).add(tribute.getName()); - i = i+1; - } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.sendMessage(ChatColor.AQUA + "All Tributes warped!"); - } - }, 20L); - } - }else{ - p.sendMessage(ChatColor.RED + "Too few arguments, specify an arena"); - } - } - } - }else if(args[0].equalsIgnoreCase("Start")){ - if(p.hasPermission("HungerArena.Start")){ - if(args.length!= 2){ - p.sendMessage(ChatColor.RED + "You need an arena!"); - }else{ - a = Integer.parseInt(args[1]); - if(plugin.canjoin.get(a)== true) - p.sendMessage(ChatColor.RED + "Game already in progress!"); - else if(plugin.Playing.get(a).isEmpty()) - p.sendMessage(ChatColor.RED + "No one is in that game!"); - else - plugin.startGames(a); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else{ - p.sendMessage(ChatColor.RED + "Unknown command, type /ha help for a list of commands"); - } - } - } - }else if(sender instanceof ConsoleCommandSender){ - if(cmd.getName().equalsIgnoreCase("Ha")){ - if(args.length== 0){ - sender.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja! Version: " + plugin.getDescription().getVersion()); - return false; - } - if(args[0].equalsIgnoreCase("Help")){ - ChatColor c = ChatColor.AQUA; - sender.sendMessage(ChatColor.GREEN + "----HungerArena Help----"); - sender.sendMessage(c + "/ha - Displays author message!"); - sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!"); - sender.sendMessage(c + "/startpoint [1,2,3,4,etc] [1,2,3,4,etc] - Sets the starting points of tributes in a specific arena!"); - sender.sendMessage(c + "/ha close (1,2,3,4,etc) - Prevents anyone from joining that arena! Numbers are optional"); - sender.sendMessage(c + "/ha help - Displays this screen!"); - sender.sendMessage(c + "/ha join [1,2,3,4,etc] - Makes you join the game!"); - sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!"); - sender.sendMessage(c + "/ha leave - Makes you leave the game!"); - sender.sendMessage(c + "/ha list (1,2,3,4,etc) - Shows a list of players in the game and their health! Numbers are optional."); - sender.sendMessage(c + "/ha open (1,2,3,4,etc) - Opens the game allowing people to join! Numbers are optional"); - sender.sendMessage(c + "/ha ready - Votes for the game to start!"); - sender.sendMessage(c + "/ha refill (1,2,3,4,etc) - Refills all chests! Numbers are optional"); - sender.sendMessage(c + "/ha reload - Reloads the config!"); - sender.sendMessage(c + "/ha restart (1,2,3,4,etc) - Restarts the game! Numbers are optional"); - sender.sendMessage(c + "/ha rlist (1,2,3,4,etc) - See who's ready! Numbers are optional"); - sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!"); - sender.sendMessage(c + "/ha tp [player] - Teleports you to a tribute!"); - sender.sendMessage(c + "/ha start [1,2,3,4,etc] - Unfreezes tributes allowing them to fight!"); - sender.sendMessage(c + "/ha watch [1,2,3,4,etc] - Lets you watch the tributes!"); - sender.sendMessage(c + "/ha warpall [1,2,3,4,etc] - Warps all tribute into position!"); - sender.sendMessage(ChatColor.GREEN + "----------------------"); - return false; - }else if(args[0].equalsIgnoreCase("List")){ - if(args.length>= 2){ - try{ - a = Integer.parseInt(args[1]); - sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); - if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ - for(String playernames: plugin.Playing.get(a)){ - Player players = plugin.getServer().getPlayerExact(playernames); - sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); - } - }else{ - sender.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - sender.sendMessage(ChatColor.AQUA + "---------------------"); - }catch(Exception e){ - sender.sendMessage(ChatColor.RED + "Argument not an integer!"); - } - }else{ - sender.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); - if(!plugin.Playing.get(1).isEmpty() && plugin.Playing.containsKey(1)){ - for(String playernames: plugin.Playing.get(1)){ - Player players = plugin.getServer().getPlayerExact(playernames); - sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); - } - }else{ - sender.sendMessage(ChatColor.GRAY + "No one is playing!"); - } - sender.sendMessage(ChatColor.AQUA + "---------------------"); - } - }else if(args[0].equalsIgnoreCase("rList")){ - if(args.length>= 2){ - try{ - a = Integer.parseInt(args[1]); - sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); - if(!plugin.Ready.get(a).isEmpty() && plugin.Ready.containsKey(a)){ - for(String playernames: plugin.Ready.get(a)){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - }else{ - sender.sendMessage(ChatColor.GRAY + "No one is ready!"); - } - sender.sendMessage(ChatColor.AQUA + "---------------------"); - }catch(Exception e){ - sender.sendMessage(ChatColor.RED + "Argument not an integer!"); - } - }else{ - sender.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); - if(!plugin.Ready.get(1).isEmpty() && plugin.Ready.containsKey(1)){ - for(String playernames: plugin.Ready.get(1)){ - sender.sendMessage(ChatColor.GREEN + playernames); - } - }else{ - sender.sendMessage(ChatColor.GRAY + "No one is ready!"); - } - sender.sendMessage(ChatColor.AQUA + "---------------------"); - } - }else if(args[0].equalsIgnoreCase("SetSpawn") || args[0].equalsIgnoreCase("Join") || args[0].equalsIgnoreCase("Confirm") || args[0].equalsIgnoreCase("Ready") || args[0].equalsIgnoreCase("Leave") || args[0].equalsIgnoreCase("Watch")){ - sender.sendMessage(ChatColor.RED + "That can only be run by a player!"); - }else if(args[0].equalsIgnoreCase("Kick")){ - if(args.length>= 2){ - Player target = Bukkit.getPlayer(args[1]); - if(plugin.getArena(target) != null){ - a = plugin.getArena(target); - plugin.Playing.get(a).remove(target.getName()); - if(plugin.config.getBoolean("broadcastAll")){ - sender.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from arena " + a + "!"); - }else{ - for(String gn: plugin.Playing.get(a)){ - Player g = plugin.getServer().getPlayer(gn); - g.sendMessage(ChatColor.RED + target.getName() + " was kicked from the game!"); - } - } - clearInv(target); - target.teleport(Spawn); - plugin.Quit.get(a).add(target.getName()); - plugin.winner(a); - }else{ - sender.sendMessage(ChatColor.RED + "That player isn't in the game!"); - } - }else{ - sender.sendMessage(ChatColor.RED + "Too few arguments"); - } - }else if(args[0].equalsIgnoreCase("Refill")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - int list056; - list056 = 0; - int limit = plugin.config.getStringList("StorageXYZ").size(); - while(limit > list056){ - String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); - int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); - int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); - int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); - int chesta = plugin.getConfig().getInt("Storage." + xyz2 + ".Arena"); - String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); - Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); - plugin.exists = false; - if(chesta== a){ - if(blockatlocation.getState() instanceof Chest){ - plugin.exists = true; - Chest chest = (Chest) blockatlocation.getState(); - if(chesta== a){ - chest.getInventory().clear(); - ItemStack[] itemsinchest = null; - Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); - if(o instanceof ItemStack[]){ - itemsinchest = (ItemStack[]) o; - }else if(o instanceof List){ - itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); - } - list056 = list056+1; - chest.getInventory().setContents(itemsinchest); - chest.update(); - } - } - }else{ - list056 = list056+1; - } - } - if(limit== list056){ - sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!"); - } - }else{ - int list056; - list056 = 0; - int limit = plugin.config.getStringList("StorageXYZ").size(); - while(limit > list056){ - String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); - int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); - int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); - int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); - String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); - Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); - plugin.exists = false; - if(blockatlocation.getState() instanceof Chest){ - plugin.exists = true; - Chest chest = (Chest) blockatlocation.getState(); - chest.getInventory().clear(); - ItemStack[] itemsinchest = null; - Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); - if(o instanceof ItemStack[]){ - itemsinchest = (ItemStack[]) o; - }else if(o instanceof List){ - itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); - } - list056 = list056+1; - chest.getInventory().setContents(itemsinchest); - chest.update(); - } - } - if(limit== list056){ - sender.sendMessage(ChatColor.GREEN + "All chests refilled!"); - } - } - }else if(args[0].equalsIgnoreCase("Restart")){ - int b = 0; - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(!plugin.Watching.get(a).isEmpty()){ - for(b = 0; b < plugin.Watching.get(a).size(); b++){ - String s = plugin.Watching.get(a).get(b); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - } - plugin.Dead.get(a).clear(); - plugin.Quit.get(a).clear(); - plugin.Watching.get(a).clear(); - plugin.Frozen.get(a).clear(); - plugin.Ready.get(a).clear(); - plugin.NeedConfirm.get(a).clear(); - plugin.Out.get(a).clear(); - plugin.Playing.get(a).clear(); - plugin.inArena.get(a).clear(); - plugin.canjoin.put(a, false); - plugin.open.put(a, true); - List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); - List blocksplaced = plugin.data.getStringList("Blocks_Placed"); - ArrayList toremove = new ArrayList(); - ArrayList toremove2 = new ArrayList(); - for(String blocks:blocksplaced){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int arena = Integer.parseInt(coords[4]); - int d = 0; - byte m = 0; - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - if(arena== a){ - block.setTypeIdAndData(d, m, true); - block.getState().update(); - toremove.add(blocks); - } - } - for(String blocks:blocksbroken){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int d = Integer.parseInt(coords[4]); - byte m = Byte.parseByte(coords[5]); - int arena = Integer.parseInt(coords[6]); - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - if(arena== a){ - block.setTypeIdAndData(d, m, true); - block.getState().update(); - toremove2.add(blocks); - } - } - for(String blocks: toremove){ - blocksplaced.remove(blocks); - } - for(String blocks: toremove2){ - blocksbroken.remove(blocks); - } - toremove.clear(); - toremove2.clear(); - plugin.data.set("Blocks_Destroyed", blocksbroken); - plugin.data.set("Blocks_Placed", blocksplaced); - plugin.data.options().copyDefaults(); - plugin.saveData(); - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill " + a); - sender.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!"); - }else{ - for(i = 1; i <= plugin.Watching.size(); i++){ - for(b = 0; b < plugin.Watching.get(b).size(); b++){ - String s = plugin.Watching.get(i).get(b); - Player spectator = plugin.getServer().getPlayerExact(s); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - } - plugin.Dead.clear(); - plugin.Quit.clear(); - plugin.Watching.clear(); - plugin.Frozen.clear(); - plugin.Ready.clear(); - plugin.NeedConfirm.clear(); - plugin.Out.clear(); - plugin.Playing.clear(); - plugin.inArena.clear(); - for(i = 1; i <= plugin.canjoin.size(); i++){ - plugin.canjoin.put(i, false); - } - for(i = 1; i <= plugin.open.size(); i++){ - plugin.open.put(i, true); - } - List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); - List blocksplaced = plugin.data.getStringList("Blocks_Placed"); - for(String blocks:blocksplaced){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int d = 0; - byte m = 0; - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - block.setTypeIdAndData(d, m, true); - block.getState().update(); - } - for(String blocks:blocksbroken){ - String[] coords = blocks.split(","); - World w = plugin.getServer().getWorld(coords[0]); - double x = Double.parseDouble(coords[1]); - double y = Double.parseDouble(coords[2]); - double z = Double.parseDouble(coords[3]); - int d = Integer.parseInt(coords[4]); - byte m = Byte.parseByte(coords[5]); - Location blockl = new Location(w, x, y, z); - Block block = w.getBlockAt(blockl); - block.setTypeIdAndData(d, m, true); - block.getState().update(); - } - blocksplaced.clear(); - blocksbroken.clear(); - plugin.data.set("Blocks_Destroyed", blocksbroken); - plugin.data.set("Blocks_Placed", blocksplaced); - plugin.data.options().copyDefaults(); - plugin.saveData(); - plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill"); - sender.sendMessage(ChatColor.AQUA + "All games have been reset!"); - } - /////////////////////////////////// Toggle ////////////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("close")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(plugin.open.get(a)){ - plugin.open.put(a, false); - if(plugin.Playing.get(a)!= null){ - for(String players: plugin.Playing.get(a)){ - Player tributes = plugin.getServer().getPlayerExact(players); - clearInv(tributes); - tributes.teleport(tributes.getWorld().getSpawnLocation()); - } - } - if(plugin.Watching.get(a)!= null){ - for(String sname: plugin.Watching.get(a)){ - Player spectators = plugin.getServer().getPlayerExact(sname); - spectators.teleport(spectators.getWorld().getSpawnLocation()); - spectators.setAllowFlight(false); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectators); - } - } - } - plugin.Dead.get(a).clear(); - plugin.Quit.get(a).clear(); - plugin.Watching.get(a).clear(); - plugin.Frozen.get(a).clear(); - plugin.Ready.get(a).clear(); - plugin.NeedConfirm.get(a).clear(); - plugin.Out.get(a).clear(); - plugin.Playing.get(a).clear(); - plugin.inArena.get(a).clear(); - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill " + a); - sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!"); - }else{ - sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!"); - } - }else{ - for(i = 1; i <= plugin.open.size(); i++){ - if(plugin.open.get(i)){ - plugin.open.put(i, false); - if(plugin.Playing.get(i)!= null){ - for(String players: plugin.Playing.get(i)){ - Player tributes = plugin.getServer().getPlayerExact(players); - clearInv(tributes); - tributes.teleport(tributes.getWorld().getSpawnLocation()); - } - } - if(plugin.Watching.get(i)!= null){ - for(String sname: plugin.Watching.get(i)){ - Player spectators = plugin.getServer().getPlayerExact(sname); - spectators.teleport(spectators.getWorld().getSpawnLocation()); - spectators.setAllowFlight(false); - for(Player online:plugin.getServer().getOnlinePlayers()){ - online.showPlayer(spectators); - } - } - } - plugin.Dead.clear(); - plugin.Quit.clear(); - plugin.Watching.clear(); - plugin.Frozen.clear(); - plugin.Ready.clear(); - plugin.NeedConfirm.clear(); - plugin.Out.clear(); - plugin.Playing.clear(); - plugin.inArena.clear(); - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill"); - sender.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!"); - }else{ - sender.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!"); - } - } - } - }else if(args[0].equalsIgnoreCase("open")){ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(!plugin.open.get(a)){ - plugin.open.put(a, true); - sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); - }else{ - sender.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); - } - }else{ - for(i = 1; i <= plugin.open.size(); i++){ - if(!plugin.open.get(i)){ - plugin.open.put(i, true); - sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); - }else{ - sender.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); - } - } - } - //////////////////////////////////////////////////////////////////////////////////////////// - }else if(args[0].equalsIgnoreCase("Reload")){ - plugin.location.clear(); - plugin.Reward.clear(); - plugin.Cost.clear(); - plugin.Fee.clear(); - plugin.onEnable(); - sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!"); - }else if(args[0].equalsIgnoreCase("WarpAll")){ - if(plugin.spawns.getString("Spawns_set").equalsIgnoreCase("false")){ - sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); - }else{ - if(args.length>= 2){ - a = Integer.parseInt(args[1]); - if(plugin.Playing.get(a).size()== 1){ - sender.sendMessage(ChatColor.RED + "There are not enough players!"); - }else{ - if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){ - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start " + a); - } - }, 20L); - } - i = 1; - for(String playing: plugin.Playing.get(a)){ - Player tribute = plugin.getServer().getPlayerExact(playing); - tribute.teleport(plugin.location.get(a).get(i)); - tribute.setHealth(20); - tribute.setFoodLevel(20); - tribute.setSaturation(20); - tribute.setLevel(0); - clearInv(tribute); - for(PotionEffect pe: tribute.getActivePotionEffects()){ - PotionEffectType potion = pe.getType(); - tribute.removePotionEffect(potion); - } - if(tribute.getAllowFlight()){ - tribute.setAllowFlight(false); - } - plugin.Frozen.get(a).add(tribute.getName()); - i = i+1; - } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - sender.sendMessage(ChatColor.AQUA + "All Tributes warped!"); - } - }, 20L); - } - }else{ - sender.sendMessage(ChatColor.RED + "Too few arguments, specify an arena"); - } - } - }else if(args[0].equalsIgnoreCase("Start")){ - if(args.length!= 2){ - sender.sendMessage(ChatColor.RED + "You need an arena!"); - }else{ - a = Integer.parseInt(args[1]); - if(plugin.canjoin.get(a)== true) - sender.sendMessage(ChatColor.RED + "Game already in progress!"); - else if(plugin.Playing.get(a).isEmpty()) - sender.sendMessage(ChatColor.RED + "No one is in that game!"); - else - plugin.startGames(a); - } - }else{ - sender.sendMessage(ChatColor.RED + "Unknown command, type /ha help to see all commands!"); - } - } - } - return false; - } -} diff --git a/src/me/travja/hungerarena/JoinAndQuitListener.java b/src/me/travja/hungerarena/JoinAndQuitListener.java deleted file mode 100644 index 8f611d4..0000000 --- a/src/me/travja/hungerarena/JoinAndQuitListener.java +++ /dev/null @@ -1,156 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -public class JoinAndQuitListener implements Listener { - public Main plugin; - public JoinAndQuitListener(Main m) { - this.plugin = m; - } - public HaCommands commands; - public JoinAndQuitListener(HaCommands h){ - this.commands = h; - } - int i = 0; - int a = 0; - @EventHandler - public void onJoin(PlayerJoinEvent evt) { - Player p = evt.getPlayer(); - for(i = 1; i <= plugin.Watching.size(); i++){ - for (String s : plugin.Watching.get(i)) { - Player spectator = Bukkit.getServer().getPlayerExact(s); - p.hidePlayer(spectator); - } - } - } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event){ - final Player p = event.getPlayer(); - final String pname = p.getName(); - for(i = 1; i <= plugin.Watching.size(); i++){ - for(String s: plugin.Watching.get(i)){ - Player spectator = plugin.getServer().getPlayerExact(s); - p.hidePlayer(spectator); - } - } - for(i = 1; i <= plugin.Out.size(); i++){ - if(plugin.Out.get(i).contains(pname)){ - plugin.Playing.get(i).add(pname); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.sendMessage(ChatColor.AQUA + "You have saved yourself from being ejected from the arena!"); - } - }, 40L); - plugin.Out.get(i).remove(pname); - } - } - for(i = 1; i <= plugin.Quit.size(); i++){ - if(plugin.Quit.get(i).contains(pname)){ - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.teleport(Spawn); - p.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfeited!"); - } - }, 40L); - } - } - for(i = 1; i <= plugin.Dead.size(); i++){ - if(plugin.Dead.get(i).contains(pname)){ - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.teleport(Spawn); - p.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfeited!"); - } - }, 40L); - } - } - for(i = 1; i <= plugin.inArena.size(); i++){ - if(plugin.inArena.get(i)!= null){ - if(plugin.inArena.get(i).contains(pname)){ - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - p.teleport(Spawn); - p.getInventory().clear(); - p.getInventory().setBoots(null); - p.getInventory().setLeggings(null); - p.getInventory().setChestplate(null); - p.getInventory().setHelmet(null); - plugin.inArena.remove(pname); - p.sendMessage(ChatColor.RED + "You were still in the arena when you left and now the games are over."); - } - }, 40L); - } - } - } - } - @EventHandler - public void onQuit(PlayerQuitEvent evt) { - Player p = evt.getPlayer(); - String pname = p.getName(); - for(i = 1; i <= plugin.Frozen.size(); i++){ - if (plugin.Frozen.get(i).contains(pname)) { - plugin.Frozen.remove(pname); - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - p.teleport(Spawn); - } - } - } - @EventHandler - public void onPlayerQuit(PlayerQuitEvent event){ - final Player p = event.getPlayer(); - final String pname = p.getName(); - if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - plugin.Out.get(a).add(pname); - plugin.Playing.get(a).remove(pname); - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ - public void run(){ - if(plugin.Out.get(a).contains(pname)){ - plugin.Quit.get(a).add(pname); - plugin.Out.remove(pname); - plugin.winner(a); - plugin.inArena.get(a).add(pname); - }else if(plugin.getArena(p)== null){ - plugin.Quit.get(a).add(pname); - } - } - }, 1200L); - } - } -} diff --git a/src/me/travja/hungerarena/Main.java b/src/me/travja/hungerarena/Main.java deleted file mode 100644 index cb144ba..0000000 --- a/src/me/travja/hungerarena/Main.java +++ /dev/null @@ -1,511 +0,0 @@ -package me.Travja.HungerArena; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Level; -import java.util.logging.Logger; - -import net.milkbowl.vault.economy.Economy; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import org.bukkit.command.CommandExecutor; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class Main extends JavaPlugin{ - static Logger log; - public HashMap> Playing = new HashMap>(); - public HashMap> Ready = new HashMap>(); - public HashMap> Dead = new HashMap>(); - public HashMap> Quit = new HashMap>(); - public HashMap> Out = new HashMap>(); - public HashMap> Watching = new HashMap>(); - public HashMap> NeedConfirm = new HashMap>(); - public HashMap> location = new HashMap>(); - public ArrayList Tele = new ArrayList(); - public HashMap> inArena = new HashMap>(); - public HashMap> Frozen = new HashMap>(); - public HashMap> arena = new HashMap>(); - public HashMap canjoin = new HashMap(); - public HashMap maxPlayers = new HashMap(); - public HashMap open = new HashMap(); - public List worlds; - public Listener DeathListener = new DeathListener(this); - public Listener SpectatorListener = new SpectatorListener(this); - public Listener FreezeListener = new FreezeListener(this); - public Listener JoinAndQuitListener = new JoinAndQuitListener(this); - public Listener ChatListener = new ChatListener(this); - public Listener Chests = new Chests(this); - public Listener PvP = new PvP(this); - public Listener CommandBlock = new CommandBlock(this); - public Listener Damage = new DmgListener(this); - public Listener Teleport = new TeleportListener(this); - public Listener Signs = new Signs(this); - public Listener BlockStorage = new BlockStorage(this); - public Listener WinGames = new WinGamesListener(this); - public CommandExecutor HaCommands = new HaCommands(this); - public CommandExecutor SponsorCommands = new SponsorCommands(this); - public CommandExecutor SpawnsCommand = new SpawnsCommand(this); - public boolean exists; - public boolean restricted; - public FileConfiguration config; - public FileConfiguration spawns = null; - public File spawnsFile = null; - public FileConfiguration data = null; - public File dataFile = null; - public File managementFile = null; - public FileConfiguration management = null; - public ArrayList Reward = new ArrayList(); - public ArrayList Cost = new ArrayList(); - public ArrayList Fee = new ArrayList(); - public boolean vault = false; - public boolean eco = false; - public Economy econ = null; - int i = 0; - int v = 0; - int start = 0; - int deathtime = 0; - int timetodeath = 0; - int a = 0; - public void onEnable(){ - log = this.getLogger(); - config = this.getConfig(); - config.options().copyDefaults(true); - this.saveDefaultConfig(); - spawns = this.getSpawns(); - spawns.options().copyDefaults(true); - this.saveSpawns(); - data = this.getData(); - data.options().copyDefaults(true); - this.saveData(); - management = this.getManagement(); - management.options().copyDefaults(true); - this.saveManagement(); - getServer().getPluginManager().registerEvents(DeathListener, this); - getServer().getPluginManager().registerEvents(SpectatorListener, this); - getServer().getPluginManager().registerEvents(FreezeListener, this); - getServer().getPluginManager().registerEvents(JoinAndQuitListener, this); - getServer().getPluginManager().registerEvents(ChatListener, this); - getServer().getPluginManager().registerEvents(Chests, this); - getServer().getPluginManager().registerEvents(PvP, this); - getServer().getPluginManager().registerEvents(CommandBlock, this); - getServer().getPluginManager().registerEvents(Signs, this); - getServer().getPluginManager().registerEvents(BlockStorage, this); - getServer().getPluginManager().registerEvents(WinGames, this); - getServer().getPluginManager().registerEvents(Damage, this); - getCommand("Ha").setExecutor(HaCommands); - getCommand("Sponsor").setExecutor(SponsorCommands); - getCommand("Startpoint").setExecutor(SpawnsCommand); - i = 1; - //TODO THIS CRAP - if(spawns.getConfigurationSection("Spawns")!= null){ - Map temp = spawns.getConfigurationSection("Spawns").getValues(false); - for(Entry entry: temp.entrySet()){ - if(spawns.getConfigurationSection("Spawns." + entry.getKey())!= null){ - Map temp2 = spawns.getConfigurationSection("Spawns." + entry.getKey()).getValues(false); - for(Map.Entry e: temp2.entrySet()){ - if(spawns.get("Spawns." + entry.getKey() + "." + e.getKey())!= null){ - String[] coords = ((String) spawns.get("Spawns." + entry.getKey() + "." + e.getKey())).split(","); - Integer a = Integer.parseInt(entry.getKey()); - Integer s = Integer.parseInt(e.getKey()); - if(location.get(a)== null) - location.put(a, new HashMap()); - log.info("Added spawn number " + s + " in arena " + a + "!"); - location.get(a).put(s, new Location(getServer().getWorld(coords[0]), Double.parseDouble(coords[1]), Double.parseDouble(coords[2]), Double.parseDouble(coords[3]))); - } - } - } - } - } - for(i = 1; i <= location.size(); i++){ - log.info("Loaded " + location.get(i).size() + " tribute spawns for arena " + i + "!"); - Playing.put(i, new ArrayList()); - Ready.put(i, new ArrayList()); - Dead.put(i, new ArrayList()); - Quit.put(i, new ArrayList()); - Out.put(i, new ArrayList()); - Watching.put(i, new ArrayList()); - NeedConfirm.put(i, new ArrayList()); - inArena.put(i, new ArrayList()); - Frozen.put(i, new ArrayList()); - arena.put(i, new ArrayList()); - canjoin.put(i, false); - if(location.get(i).size()== config.getInt("maxPlayers")){ - maxPlayers.put(i, location.get(i).size()); - }else if(location.size()< config.getInt("maxPlayers")){ - maxPlayers.put(i, location.get(i).size()); - }else if(location.size()> config.getInt("maxPlayers")){ - maxPlayers.put(i, config.getInt("maxPlayers")); - } - log.info("Max players is for arena " + i + " is " + maxPlayers.get(i)); - open.put(i, true); - } - if (setupEconomy()) { - log.info("Found Vault! Hooking in for economy!"); - } - if (config.getDouble("config.version") != 1.3) { - config.set("config.version", 1.3); - config.set("rewardEco.enabled", false); - config.set("rewardEco.reward", 100); - } - if (config.getBoolean("rewardEco.enabled", true) || config.getBoolean("sponsorEco.enabled", true) || config.getBoolean("EntryFee.eco", true)) { - if (vault == true) { - log.info("Economy hook deployed."); - eco = true; - }else{ - log.info("You want economy support... yet you either don't have Vault or don't have an economy plugin. Sorry, can't give you it."); - } - } - if (!eco) { - if (vault == true) { - log.info("We see that you have Vault on your server. To set economy support to true, enable it in the config."); - } - } - try{ - for(String rewards: config.getStringList("Reward")){ - String[] rinfo = rewards.split(","); - Reward.add(new ItemStack(Integer.parseInt(rinfo[0]), Integer.parseInt(rinfo[1]))); - } - for(String scost: config.getStringList("Sponsor_Cost")){ - String[] sinfo = scost.split(","); - Cost.add(new ItemStack(Integer.parseInt(sinfo[0]), Integer.parseInt(sinfo[1]))); - } - if(config.getBoolean("EntryFee.enabled")){ - for(String fee: config.getStringList("EntryFee.fee")){ - String[] finfo = fee.split(","); - Fee.add(new ItemStack(Integer.parseInt(finfo[0]), Integer.parseInt(finfo[1]))); - } - } - }catch(Exception e){ - log.warning("Could not add a reward/sponsor/entry cost! One of the rewards/costs is not a number!"); - } - worlds = config.getStringList("worlds"); - if(worlds.isEmpty()){ - restricted = false; - }else if(!worlds.isEmpty()){ - restricted = true; - } - log.info("Enabled v" + getDescription().getVersion()); - } - - public void onDisable(){ - log.info("Disabled v" + getDescription().getVersion()); - } - - public boolean setupEconomy() { - if (getServer().getPluginManager().getPlugin("Vault") == null) { - return false; - } - RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); - if (rsp == null) { - return false; - } - econ = rsp.getProvider(); - vault = true; - return econ != null; - } - public void reloadSpawns() { - if (spawnsFile == null) { - spawnsFile = new File(getDataFolder(), "spawns.yml"); - } - spawns = YamlConfiguration.loadConfiguration(spawnsFile); - - // Look for defaults in the jar - InputStream defConfigStream = this.getResource("spawns.yml"); - if (defConfigStream != null) { - YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); - spawns.setDefaults(defConfig); - } - } - public FileConfiguration getSpawns() { - if (spawns == null) { - this.reloadSpawns(); - } - return spawns; - } - public void saveSpawns() { - if (spawns == null || spawnsFile == null) { - return; - } - try { - getSpawns().save(spawnsFile); - } catch (IOException ex) { - this.getLogger().log(Level.SEVERE, "Could not save config to " + spawnsFile, ex); - } - } - public void reloadData() { - if (dataFile == null) { - dataFile = new File(getDataFolder(), "Data.yml"); - } - data = YamlConfiguration.loadConfiguration(dataFile); - - // Look for defaults in the jar - InputStream defConfigStream = this.getResource("Data.yml"); - if (defConfigStream != null) { - YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); - data.setDefaults(defConfig); - } - } - public FileConfiguration getData() { - if (data == null) { - this.reloadData(); - } - return data; - } - public void saveData() { - if (data == null || dataFile == null) { - return; - } - try { - getData().save(dataFile); - } catch (IOException ex) { - this.getLogger().log(Level.SEVERE, "Could not save config to " + dataFile, ex); - } - } - public void reloadManagement() { - if (managementFile == null) { - managementFile = new File(getDataFolder(), "commandAndBlockManagement.yml"); - } - management = YamlConfiguration.loadConfiguration(managementFile); - - // Look for defaults in the jar - InputStream defConfigStream = this.getResource("commandAndBlockManagement.yml"); - if (defConfigStream != null) { - YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); - management.setDefaults(defConfig); - } - } - public FileConfiguration getManagement() { - if (management == null) { - this.reloadManagement(); - } - return management; - } - public void saveManagement() { - if (management == null || managementFile == null) { - return; - } - try { - getManagement().save(managementFile); - } catch (IOException ex) { - this.getLogger().log(Level.SEVERE, "Could not save config to " + managementFile, ex); - } - } - public void winner(Integer a){ - String[] Spawncoords = spawns.getString("Spawn_coords").split(","); - World spawnw = getServer().getWorld(Spawncoords[3]); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - if(Playing.get(a).size()== 1 && canjoin.get(a)== true){ - //Announce winner - for(i = 0; i < Playing.get(a).size(); i++){ - String winnername = Playing.get(a).get(i); - Player winner = getServer().getPlayerExact(winnername); - String winnername2 = winner.getName(); - getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); - winner.getInventory().clear(); - winner.getInventory().setBoots(null); - winner.getInventory().setChestplate(null); - winner.getInventory().setHelmet(null); - winner.getInventory().setLeggings(null); - winner.setLevel(0); - for(PotionEffect pe: winner.getActivePotionEffects()){ - PotionEffectType potion = pe.getType(); - winner.removePotionEffect(potion); - } - Tele.add(winner); - final World w = winner.getWorld(); - winner.teleport(Spawn); - if(config.getBoolean("reloadWorld")){ - getServer().unloadWorld(w, false); - getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){ - public void run(){ - getServer().createWorld(new WorldCreator(w.getName())); - } - },200L); - } - if(!config.getBoolean("rewardEco.enabled")){ - for(ItemStack Rewards: Reward){ - winner.getInventory().addItem(Rewards); - } - }else{ - for(ItemStack Rewards: Reward){ - winner.getInventory().addItem(Rewards); - } - econ.depositPlayer(winner.getName(), config.getDouble("rewardEco.reward")); - } - Playing.get(a).clear(); - getServer().getScheduler().cancelTask(deathtime); - } - //Show spectators - for(String s1: Watching.get(a)){ - Player spectator = getServer().getPlayerExact(s1); - spectator.setAllowFlight(false); - spectator.teleport(Spawn); - for(Player online:getServer().getOnlinePlayers()){ - online.showPlayer(spectator); - } - } - if(config.getString("Auto_Restart").equalsIgnoreCase("True")){ - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){ - public void run(){ - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); - - } - }, 220L); - } - } - } - public void startGames(final Integer a){ - String begin = config.getString("Start_Message"); - begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2"); - final String msg = begin; - i = 10; - if(config.getString("Countdown").equalsIgnoreCase("true")){ - start = getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ - public void run(){ - if(i > 0){ - if(worlds.isEmpty()){ - if(config.getBoolean("broadcastAll")){ - getServer().broadcastMessage(String.valueOf(i)); - }else{ - for(String gn: Playing.get(a)){ - Player g = getServer().getPlayer(gn); - g.sendMessage(String.valueOf(i)); - } - } - }else{ - for(String world: worlds){ - World w = getServer().getWorld(world); - if(config.getBoolean("broadcastAll")){ - for(Player wp: w.getPlayers()){ - wp.sendMessage(String.valueOf(i)); - } - }else{ - for(String gn: Playing.get(a)){ - Player g = getServer().getPlayer(gn); - g.sendMessage(String.valueOf(i)); - } - } - } - } - } - i = i-1; - canjoin.put(a, true); - if(i== -1){ - if(Frozen.get(a)!= null) - Frozen.get(a).clear(); - if(config.getBoolean("broadcastAll")){ - getServer().broadcastMessage(msg); - }else{ - for(String gn: Playing.get(a)){ - Player g = getServer().getPlayer(gn); - g.sendMessage(msg); - } - } - getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha Refill " + a); - getServer().getScheduler().cancelTask(start); - if(config.getInt("DeathMatch")!= 0){ - int death = config.getInt("DeathMatch"); - timetodeath = death; - deathtime = getServer().getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugin("HungerArena"), new Runnable(){ - public void run(){ - timetodeath = timetodeath-1; - if(config.getBoolean("broadcastAll")){ - for(Player wp: location.get(a).get(0).getWorld().getPlayers()){ - if(timetodeath!= 0){ - wp.sendMessage(ChatColor.RED + String.valueOf(timetodeath) + " mins till the death match!"); - } - } - }else{ - for(String gn: Playing.get(a)){ - Player g = getServer().getPlayer(gn); - g.sendMessage(ChatColor.RED + String.valueOf(timetodeath) + " mins till the death match!"); - } - } - if(timetodeath== 0){ - for(String playing: Playing.get(a)){ - Player tribute = getServer().getPlayerExact(playing); - tribute.teleport(location.get(a).get(i)); - i = i+1; - for(PotionEffect pe: tribute.getActivePotionEffects()){ - PotionEffectType potion = pe.getType(); - tribute.removePotionEffect(potion); - } - if(tribute.getAllowFlight()){ - tribute.setAllowFlight(false); - } - } - if(config.getBoolean("broadcastAll")){ - for(Player wp: location.get(a).get(0).getWorld().getPlayers()){ - wp.sendMessage(ChatColor.RED + "The final battle has begun! " + Playing.size() + " tributes will be facing off!"); - } - }else{ - for(String gn: Playing.get(a)){ - Player g = getServer().getPlayer(gn); - g.sendMessage(ChatColor.RED + "The final battle has begun! " + Playing.size() + " tributes will be facing off!"); - } - } - getServer().getScheduler().cancelTask(deathtime); - } - } - }, 1200L, 1200L); - } - } - } - }, 20L, 20L); - }else{ - Frozen.get(a).clear(); - if(config.getBoolean("broadcastAll")){ - getServer().broadcastMessage(msg); - }else{ - for(String gn: Playing.get(a)){ - Player g = getServer().getPlayer(gn); - g.sendMessage(msg); - } - } - canjoin.put(a, true); - getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha Refill " + a); - } - } - public Integer getArena(Player p){ - for (int x: Playing.keySet()) { - if (Playing.get(x).contains(p.getName())){ - return x; - } - } - return null; - } - public boolean isSpectating(Player p){ - int x = 0; - if(!Watching.isEmpty()){ - for(x= 1; x <= Watching.size(); x++){ - if(Watching.get(x).contains(p.getName())){ - x = Watching.size()+1; - return true; - }else if(Watching.size()== x) - return false; - } - } - return false; - } -} diff --git a/src/me/travja/hungerarena/PlayerWinGamesEvent.java b/src/me/travja/hungerarena/PlayerWinGamesEvent.java deleted file mode 100644 index f40ba78..0000000 --- a/src/me/travja/hungerarena/PlayerWinGamesEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; - -/** - * - * @author YoshiGenius - */ -public class PlayerWinGamesEvent extends PlayerEvent { - - private static final HandlerList handlers = new HandlerList(); - - public PlayerWinGamesEvent(final Player p) { - super(p); - } - - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } - -} diff --git a/src/me/travja/hungerarena/PvP.java b/src/me/travja/hungerarena/PvP.java deleted file mode 100644 index 0fce3f8..0000000 --- a/src/me/travja/hungerarena/PvP.java +++ /dev/null @@ -1,66 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Skeleton; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; - -public class PvP implements Listener { - public Main plugin; - public PvP(Main m) { - this.plugin = m; - } - int a = 0; - @EventHandler(priority= EventPriority.MONITOR) - public void PlayerPvP(EntityDamageByEntityEvent event){ - Entity pl = event.getEntity(); - Entity dl = event.getDamager(); - if(pl instanceof Player && dl instanceof Player){ - Player p = (Player) pl; - Player d = (Player) dl; - if(plugin.getArena(p)!= null && plugin.getArena(d)!= null){ - a = plugin.getArena(p); - if(plugin.canjoin.get(a)){ - if(event.isCancelled()){ - event.setCancelled(false); - } - } - } - if(plugin.getArena(p)!= null){ - a = plugin.getArena(p); - if(!plugin.canjoin.get(a)){ - if(!event.isCancelled()){ - event.setCancelled(true); - } - } - } - if(plugin.getArena(p)== null && plugin.getArena(d)!= null){ - if(!event.isCancelled()){ - event.setCancelled(true); - } - } - }else if(pl instanceof Player && dl instanceof Projectile){ - Projectile projectile = (Projectile) dl; - Player p = (Player) pl; - if(projectile.getShooter() instanceof Player){ - if(plugin.getArena(p) != null){ - Player shooter = (Player) projectile.getShooter(); - if(plugin.getArena(shooter)!= null){ - event.setCancelled(false); - } - } - }else if(projectile.getShooter() instanceof Entity){ - Entity e = projectile.getShooter(); - if(e instanceof Skeleton){ - if(plugin.getArena(p)!= null){ - event.setCancelled(false); - } - } - } - } - } -} diff --git a/src/me/travja/hungerarena/Signs.java b/src/me/travja/hungerarena/Signs.java deleted file mode 100644 index e1ff7d5..0000000 --- a/src/me/travja/hungerarena/Signs.java +++ /dev/null @@ -1,53 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.player.PlayerInteractEvent; - -public class Signs implements Listener { - public Main plugin; - public Signs(Main m) { - this.plugin = m; - } - @EventHandler - public void Sign(PlayerInteractEvent event){ - Player p = event.getPlayer(); - Block b = event.getClickedBlock(); - if (b == null) { - return; - } - if(event.getAction()== Action.RIGHT_CLICK_BLOCK){ - if(b.getType()== Material.SIGN || b.getType()==Material.SIGN_POST || b.getType()==Material.WALL_SIGN){ - org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState(); - String line1 = sign.getLine(0); - String line2 = sign.getLine(1); - String line3 = sign.getLine(2); - String line4 = sign.getLine(3); - if(line1.equalsIgnoreCase(ChatColor.BLUE + "[HungerArena]") || line1.equalsIgnoreCase(ChatColor.BLUE + "[HA]")){ - if(!line2.equals("")) - p.performCommand("ha " + line2); - else if(!line3.equals("")) - p.performCommand("ha " + line2 + " " + line3); - else - p.performCommand("ha"); - } - if(line1.equalsIgnoreCase(ChatColor.BLUE + "[Sponsor]")){ - p.performCommand("sponsor " + line2 + " " + line3 + " " + line4); - } - } - } - } - @EventHandler - public void Create(SignChangeEvent event){ - String top = event.getLine(0); - if(top.equalsIgnoreCase("[HungerArena]") || top.equalsIgnoreCase("[HA]") || top.equalsIgnoreCase("[Sponsor]")){ - event.setLine(0, ChatColor.BLUE + top); - } - } -} diff --git a/src/me/travja/hungerarena/SpawnsCommand.java b/src/me/travja/hungerarena/SpawnsCommand.java deleted file mode 100644 index e50335d..0000000 --- a/src/me/travja/hungerarena/SpawnsCommand.java +++ /dev/null @@ -1,81 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.ArrayList; -import java.util.HashMap; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class SpawnsCommand implements CommandExecutor { - public Main plugin; - int i = 0; - int a = 0; - public SpawnsCommand(Main m) { - this.plugin = m; - } - @Override - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - Player p = (Player) sender; - if(cmd.getName().equalsIgnoreCase("StartPoint")){ - if(p.hasPermission("HungerArena.StartPoint")){ - if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){ - if(args.length>= 2){ - try{ - i = Integer.valueOf(args[1]); - a = Integer.valueOf(args[0]); - }catch(Exception e){ - p.sendMessage(ChatColor.RED + "Argument not an integer!"); - } - if(i >= 1 && i <= plugin.config.getInt("maxPlayers")){ - if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){ - p.sendMessage(ChatColor.GOLD + "We ran the command, however, this isn't a world you defined in the config..."); - p.sendMessage(ChatColor.GOLD + "If this is the right world, please disregard this message."); - } - Location ploc = p.getLocation().getBlock().getLocation(); - double x = ploc.getX(); - double y = ploc.getY(); - double z = ploc.getZ(); - if(plugin.location.get(a)!= null){ - if(plugin.location.get(a).size()>= i){ - plugin.location.get(a).put(i, new Location(ploc.getWorld(), x, y, z)); - }else{ - plugin.location.get(a).put(i, new Location(ploc.getWorld(), x, y, z)); - } - }else{ - plugin.location.put(a, new HashMap()); - plugin.location.get(a).put(i, new Location(ploc.getWorld(), x, y, z)); - plugin.Playing.put(a, new ArrayList()); - plugin.Ready.put(a, new ArrayList()); - plugin.Dead.put(a, new ArrayList()); - plugin.Quit.put(a, new ArrayList()); - plugin.Out.put(a, new ArrayList()); - plugin.Watching.put(a, new ArrayList()); - plugin.NeedConfirm.put(a, new ArrayList()); - plugin.inArena.put(a, new ArrayList()); - plugin.Frozen.put(a, new ArrayList()); - plugin.arena.put(a, new ArrayList()); - plugin.canjoin.put(a, false); - plugin.open.put(a, true); - } - String coords = plugin.location.get(a).get(i).getWorld().getName() + "," + plugin.location.get(a).get(i).getX() + "," + plugin.location.get(a).get(i).getY() + "," + plugin.location.get(a).get(i).getZ(); - plugin.spawns.set("Spawns." + a + "." + i, coords); - plugin.saveSpawns(); - plugin.maxPlayers.put(a, plugin.location.get(a).size()); - p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute " + i + " in arena " + a + "!"); - }else{ - p.sendMessage(ChatColor.RED + "You can't go past " + plugin.maxPlayers + " players!"); - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - } - return false; - } - -} diff --git a/src/me/travja/hungerarena/SpectatorListener.java b/src/me/travja/hungerarena/SpectatorListener.java deleted file mode 100644 index a9c6ec3..0000000 --- a/src/me/travja/hungerarena/SpectatorListener.java +++ /dev/null @@ -1,171 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.player.*; - -public class SpectatorListener implements Listener { - public Main plugin; - public SpectatorListener(Main m){ - this.plugin = m; - } - int i = 0; - @EventHandler - public void SpectatorDrops(PlayerDropItemEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - @EventHandler - public void SpectatorInteractBlock(PlayerInteractEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - - @EventHandler - public void SpectatorInteractEntity(PlayerInteractEntityEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - @EventHandler - public void SpectatorItems(PlayerPickupItemEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - @EventHandler - public void SpectatorPvP(EntityDamageByEntityEvent event){ - Entity offense = event.getDamager(); - if(offense instanceof Player){ - Player Attacker = (Player) event.getDamager(); - String attackerName = Attacker.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(attackerName)){ - event.setCancelled(true); - Attacker.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - }else if(event.getDamager() instanceof Projectile){ - Projectile arrow = (Projectile) offense; - if(arrow.getShooter() instanceof Player){ - Player BowMan = (Player) arrow.getShooter(); - String bowManName = BowMan.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(bowManName)){ - event.setCancelled(true); - BowMan.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - } - } - @EventHandler - public void SpectatorBlockBreak(BlockBreakEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - @EventHandler - public void SpectatorBlockPlace(BlockPlaceEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); - } - } - } - } - @EventHandler - public void SpectatorQuit(PlayerQuitEvent event){ - Player p = event.getPlayer(); - String pname = p.getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(pname)){ - plugin.Watching.get(i).remove(pname); - String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); - String w = Spawncoords[3]; - World spawnw = plugin.getServer().getWorld(w); - double spawnx = Double.parseDouble(Spawncoords[0]); - double spawny = Double.parseDouble(Spawncoords[1]); - double spawnz = Double.parseDouble(Spawncoords[2]); - final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); - p.teleport(Spawn); - } - } - } - } - - @EventHandler - public void MobNerf(EntityTargetEvent event){ - Entity target = event.getTarget(); - Entity e = event.getEntity(); - if (e instanceof Player) { - return; - } - if(target instanceof Player){ - String targetName = ((Player) target).getName(); - for(i = 0; i < plugin.Watching.size(); i++){ - if(plugin.Watching.get(i)!= null){ - if(plugin.Watching.get(i).contains(targetName)){ - event.setTarget(null); - } - } - } - } - } -} diff --git a/src/me/travja/hungerarena/SponsorCommands.java b/src/me/travja/hungerarena/SponsorCommands.java deleted file mode 100644 index b7cfdbd..0000000 --- a/src/me/travja/hungerarena/SponsorCommands.java +++ /dev/null @@ -1,163 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class SponsorCommands implements CommandExecutor { - public Main plugin; - public SponsorCommands(Main m) { - this.plugin = m; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - if(cmd.getName().equalsIgnoreCase("Sponsor")){ - if(sender instanceof Player){ - int i = 0; - Player p = (Player) sender; - String pname = p.getName(); - if(p.hasPermission("HungerArena.Sponsor")){ - if(plugin.getArena(p)== null){ - if(args.length== 0){ - p.sendMessage(ChatColor.RED + "You didn't specify a tribute!"); - return false; - } - if(args.length== 1){ - p.sendMessage(ChatColor.RED + "You didn't specify an item!"); - } - if(args.length== 2){ - p.sendMessage(ChatColor.RED + "You didn't specify an amount!"); - } - if(args.length== 3){ - Player target = Bukkit.getServer().getPlayer(args[0]); - if(plugin.getArena(target)== null){ - p.sendMessage(ChatColor.RED + "That person isn't playing!"); - }else{ - try{ - int ID = Integer.parseInt(args[1]); - int Amount = Integer.parseInt(args[2]); - if((!plugin.management.getStringList("sponsors.blacklist").isEmpty() && !plugin.management.getStringList("sponsors.blacklist").contains(ID)) || plugin.management.getStringList("sponsors.blacklist").isEmpty()){ - ItemStack sponsoritem = new ItemStack(ID, Amount); - if(!plugin.config.getBoolean("sponsorEco.enabled")){ - for(ItemStack Costs: plugin.Cost){ - if(p.getInventory().contains(Costs)){ - i = i+1; - if(plugin.Cost.size() == i){ - if(args[0].equalsIgnoreCase(pname)){ - p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); - }else{ - target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); - target.getInventory().addItem(sponsoritem); - p.sendMessage("You have sponsored " + target.getName() + "!"); - for(ItemStack aCosts: plugin.Cost){ - p.getInventory().removeItem(aCosts); - } - } - } - } - } - if(plugin.Cost.size() > i){ - p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!"); - } - }else{ - if(args[0].equalsIgnoreCase(pname)){ - p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); - }else if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("sponsorEco.cost"))){ - if(!plugin.Cost.isEmpty()){ - for(ItemStack Costs: plugin.Cost){ - if(p.getInventory().contains(Costs)){ - i = i+1; - if(plugin.Cost.size()== i){ - if(args[0].equalsIgnoreCase(pname)){ - p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); - }else{ - target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); - target.getInventory().addItem(sponsoritem); - p.sendMessage("You have sponsored " + target.getName() + "!"); - plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("sponsorEco.cost")); - for(ItemStack aCosts: plugin.Cost){ - p.getInventory().removeItem(aCosts); - } - } - } - } - } - if(plugin.Cost.size() > i){ - p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!"); - } - }else{ - target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); - target.getInventory().addItem(sponsoritem); - p.sendMessage("You have sponsored " + target.getName() + "!"); - plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("sponsorEco.cost")); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have enough money to do that!"); - } - } - }else{ - p.sendMessage(ChatColor.RED + "You can't sponsor that item!"); - p.sendMessage(ChatColor.GREEN + "Other items you can't sponsor are:"); - for(String blacklist: plugin.management.getStringList("sponsors.blacklist")){ - p.sendMessage(ChatColor.AQUA + blacklist); - } - } - }catch(Exception e){ - p.sendMessage(ChatColor.RED + "Something went wrong there... Make sure that you do like this /sponsor [name] [number] [number]"); - } - } - } - }else{ - p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!"); - } - }else{ - p.sendMessage(ChatColor.RED + "You don't have permission!"); - } - }else if(sender instanceof ConsoleCommandSender){ - if(args.length== 0){ - sender.sendMessage(ChatColor.RED + "You didn't specify a tribute!"); - return false; - } - if(args.length== 1){ - sender.sendMessage(ChatColor.RED + "You didn't specify an item!"); - } - if(args.length== 2){ - sender.sendMessage(ChatColor.RED + "You didn't specify an amount!"); - } - if(args.length== 3){ - Player target = Bukkit.getPlayer(args[0]); - int ID = Integer.parseInt(args[1]); - int Amount = Integer.parseInt(args[2]); - try{ - if((!plugin.management.getStringList("sponsors.blacklist").isEmpty() && !plugin.management.getStringList("sponsors.blacklist").contains(ID)) || plugin.management.getStringList("sponsors.blacklist").isEmpty()){ - ItemStack sponsoritem = new ItemStack(ID, Amount); - if(plugin.getArena(target)== null){ - sender.sendMessage(ChatColor.RED + "That person isn't playing!"); - }else{ - sender.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); - target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); - target.getInventory().addItem(sponsoritem); - sender.sendMessage("You have sponsored " + target.getName() + "!"); - } - }else{ - sender.sendMessage(ChatColor.RED + "You can't sponsor that item!"); - sender.sendMessage(ChatColor.GREEN + "Other items you can't sponsor are:"); - for(String blacklist: plugin.management.getStringList("sponsors.blacklist")){ - sender.sendMessage(ChatColor.AQUA + blacklist); - } - } - }catch(Exception e){ - sender.sendMessage(ChatColor.RED + "Something went wrong there... Make sure that you do like this /sponsor [name] [number] [number]"); - } - } - } - } - return false; - } -} diff --git a/src/me/travja/hungerarena/TeleportListener.java b/src/me/travja/hungerarena/TeleportListener.java deleted file mode 100644 index 819d5c2..0000000 --- a/src/me/travja/hungerarena/TeleportListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package me.Travja.HungerArena; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerTeleportEvent; - -public class TeleportListener implements Listener { - - public Main plugin; - public TeleportListener(Main m) { - this.plugin = m; - } - @EventHandler(priority = EventPriority.MONITOR) - public void onTP(PlayerTeleportEvent event){ - Player p = event.getPlayer(); - List worlds = plugin.config.getStringList("worlds"); - if(worlds.contains(event.getTo().getWorld().getName()) && plugin.Tele.contains(p)){ - event.setCancelled(true); - p.sendMessage(ChatColor.RED + "You are a dead tribute... How are you supposed to get back into the arena...."); - plugin.Tele.remove(p); - }else if(plugin.Tele.contains(p)){ - if(event.isCancelled()){ - event.setCancelled(false); - plugin.Tele.remove(p); - } - } - } - /*@EventHandler Unwanted right now... - public void onTP(PlayerTeleportEvent evt) { - @SuppressWarnings("unused") - Player p = evt.getPlayer(); - TeleportCause tc = evt.getCause(); - if (tc == TeleportCause.ENDER_PEARL) { - return; - } - if (tc == TeleportCause.END_PORTAL) { - return; - } - if (tc == TeleportCause.NETHER_PORTAL) { - return; - } - evt.setCancelled(true); - }*/ - -} diff --git a/src/me/travja/hungerarena/WinGamesListener.java b/src/me/travja/hungerarena/WinGamesListener.java deleted file mode 100644 index f9b2620..0000000 --- a/src/me/travja/hungerarena/WinGamesListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package me.Travja.HungerArena; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -/** - * - * @author YoshiGenius - */ -public class WinGamesListener implements Listener { - - public Main plugin; - public WinGamesListener(Main m) { - this.plugin = m; - } - - @EventHandler - public void onWin(PlayerWinGamesEvent evt) { - Player p = evt.getPlayer(); - plugin.econ.depositPlayer(p.getName(), plugin.config.getDouble("EcoReward")); - } - -} From fedf9842cdaa89c59147c29697a8d0b6138ee3ce Mon Sep 17 00:00:00 2001 From: travja Date: Wed, 20 Mar 2013 15:42:45 -0600 Subject: [PATCH 4/5] Added back the src file --- src/me/Travja/HungerArena/BlockStorage.java | 402 +++++ src/me/Travja/HungerArena/ChatListener.java | 50 + src/me/Travja/HungerArena/Chests.java | 85 + src/me/Travja/HungerArena/CommandBlock.java | 149 ++ src/me/Travja/HungerArena/DeathListener.java | 151 ++ src/me/Travja/HungerArena/DmgListener.java | 33 + src/me/Travja/HungerArena/FreezeListener.java | 63 + src/me/Travja/HungerArena/HaCommands.java | 1558 +++++++++++++++++ .../HungerArena/JoinAndQuitListener.java | 156 ++ src/me/Travja/HungerArena/Main.java | 511 ++++++ .../HungerArena/PlayerWinGamesEvent.java | 27 + src/me/Travja/HungerArena/PvP.java | 66 + src/me/Travja/HungerArena/Signs.java | 53 + src/me/Travja/HungerArena/SpawnsCommand.java | 81 + .../Travja/HungerArena/SpectatorListener.java | 171 ++ .../Travja/HungerArena/SponsorCommands.java | 163 ++ .../Travja/HungerArena/TeleportListener.java | 50 + .../Travja/HungerArena/WinGamesListener.java | 24 + 18 files changed, 3793 insertions(+) create mode 100644 src/me/Travja/HungerArena/BlockStorage.java create mode 100644 src/me/Travja/HungerArena/ChatListener.java create mode 100644 src/me/Travja/HungerArena/Chests.java create mode 100644 src/me/Travja/HungerArena/CommandBlock.java create mode 100644 src/me/Travja/HungerArena/DeathListener.java create mode 100644 src/me/Travja/HungerArena/DmgListener.java create mode 100644 src/me/Travja/HungerArena/FreezeListener.java create mode 100644 src/me/Travja/HungerArena/HaCommands.java create mode 100644 src/me/Travja/HungerArena/JoinAndQuitListener.java create mode 100644 src/me/Travja/HungerArena/Main.java create mode 100644 src/me/Travja/HungerArena/PlayerWinGamesEvent.java create mode 100644 src/me/Travja/HungerArena/PvP.java create mode 100644 src/me/Travja/HungerArena/Signs.java create mode 100644 src/me/Travja/HungerArena/SpawnsCommand.java create mode 100644 src/me/Travja/HungerArena/SpectatorListener.java create mode 100644 src/me/Travja/HungerArena/SponsorCommands.java create mode 100644 src/me/Travja/HungerArena/TeleportListener.java create mode 100644 src/me/Travja/HungerArena/WinGamesListener.java diff --git a/src/me/Travja/HungerArena/BlockStorage.java b/src/me/Travja/HungerArena/BlockStorage.java new file mode 100644 index 0000000..1ce0492 --- /dev/null +++ b/src/me/Travja/HungerArena/BlockStorage.java @@ -0,0 +1,402 @@ +package me.Travja.HungerArena; + +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; + +public class BlockStorage implements Listener { + public Main plugin; + public BlockStorage(Main m) { + this.plugin = m; + } + @EventHandler(priority = EventPriority.MONITOR) + public void BlockBreak(BlockBreakEvent event){ + Block b = event.getBlock(); + Player p = event.getPlayer(); + String pname = p.getName(); + if(plugin.getArena(p)!= null){ + int a = plugin.getArena(p); + if(!event.isCancelled()){ + if(plugin.Playing.get(a).contains(pname)){ + if(plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")){ + p.sendMessage(ChatColor.RED + "You can't break blocks while playing!"); + } + if(plugin.canjoin.get(a)){ + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(p.getWorld().getName()))){ + if(!plugin.management.getBoolean("blocks.useWhitelistAsBlacklist")){ + if(!plugin.management.getIntegerList("blocks.whitelist").isEmpty()){ + if(!plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "That is an illegal block!"); + }else if(plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + }else{ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "That is an illegal block!"); + } + }else{ + if(!plugin.management.getIntegerList("blocks.whitelist").isEmpty()){ + if(!plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + }else if(plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "That is an illegal block"); + } + }else{ + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + } + } + } + } + } + } + } + @EventHandler(priority = EventPriority.MONITOR) + public void Explosion(EntityExplodeEvent event){ + List blocksd = event.blockList(); + Entity e = event.getEntity(); + int i = 0; + if(!event.isCancelled()){ + for(i = 1; i <= plugin.canjoin.size(); i++){ + if(plugin.canjoin.get(i)){ + i = plugin.canjoin.size()+1; + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getEntity().getWorld().getName()))){ + if(e.getType()== EntityType.PRIMED_TNT){ + if(!plugin.data.getStringList("Blocks_Placed").contains(e.getLocation().getWorld() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ()) /*|| !plugin.data.getStringList("Blocks_Destroyed").contains(e.getLocation().getWorld() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ())*/){ + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + blocks.add(e.getLocation().getWorld().getName() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ() + ",46" + ",0"); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + for(Block b:blocksd){ + String w = event.getEntity().getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + i; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + i) || !plugin.data.getStringList("Blocks_Destroyed").contains(w + "," + x + "," + y + "," + z + "," + i)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + } + } + } + } + } + @EventHandler(priority = EventPriority.MONITOR) + public void burningBlocks(BlockBurnEvent event){ + Block b = event.getBlock(); + int i = 0; + if(!event.isCancelled()){ + for(i = 1; i <= plugin.canjoin.size(); i++){ + if(plugin.canjoin.get(i)){ + i = plugin.canjoin.size()+1; + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(b.getWorld().getName()))){ + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + i; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + i)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + } + } + } + } + @EventHandler(priority = EventPriority.MONITOR) + public void blockPlace(BlockPlaceEvent event){ + Block b = event.getBlock(); + Player p = event.getPlayer(); + if(plugin.getArena(p)!= null){ + int a = plugin.getArena(p); + if(!event.isCancelled()){ + if(plugin.Playing.get(a).contains(p.getName())){ + if(plugin.canjoin.get(a)){ + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(b.getWorld().getName()))){ + if((b.getType()== Material.SAND || b.getType()== Material.GRAVEL) && (b.getRelative(BlockFace.DOWN).getType()== Material.AIR || b.getRelative(BlockFace.DOWN).getType()== Material.WATER || b.getRelative(BlockFace.DOWN).getType()== Material.LAVA)){ + int n = b.getY() -1; + while(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.AIR || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.WATER || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.LAVA){ + n = n -1; + event.getPlayer().sendMessage(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType().toString().toLowerCase()); + if(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.AIR || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.WATER || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.LAVA){ + int l = n +1; + Block br = b.getWorld().getBlockAt(b.getX(), l, b.getZ()); + String w = br.getWorld().getName(); + int x = br.getX(); + int y = br.getY(); + int z = br.getZ(); + String coords = w + "," + x + "," + y + "," + z + "," + a; + p.sendMessage(ChatColor.GREEN + "Sand/Gravel will land at " + coords); + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Placed", blocks); + plugin.saveData(); + } + } + }else{ + if(b.getType()!= Material.SAND || b.getType()!= Material.GRAVEL){ + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + String coords = w + "," + x + "," + y + "," + z + "," + a; + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Placed", blocks); + plugin.saveData(); + } + } + } + } + } + } + } + } + @EventHandler(priority = EventPriority.MONITOR) + public void bucketEmpty(PlayerBucketEmptyEvent event){ + if(plugin.getArena(event.getPlayer())!= null){ + int a = plugin.getArena(event.getPlayer()); + if(!event.isCancelled()){ + if(plugin.canjoin.get(a)){ + if(plugin.Playing.get(a).contains(event.getPlayer().getName())){ + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getPlayer().getWorld().getName()))){ + Block b = event.getBlockClicked().getRelative(event.getBlockFace()); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + String coords = w + "," + x + "," + y + "," + z + "," + a; + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Placed", blocks); + plugin.saveData(); + } + } + } + } + } + } + @EventHandler(priority = EventPriority.MONITOR) + public void bucketFill(PlayerBucketFillEvent event){ + if(plugin.getArena(event.getPlayer())!= null){ + int a = plugin.getArena(event.getPlayer()); + if(!event.isCancelled()){ + if(plugin.canjoin.get(a)){ + if(plugin.Playing.get(a).contains(event.getPlayer().getName())){ + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getPlayer().getWorld().getName()))){ + Block b = event.getBlockClicked().getRelative(event.getBlockFace()); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + } + } + } + } + } + @EventHandler(priority = EventPriority.MONITOR) + public void blockMelt(BlockFadeEvent event){ + int i = 0; + if(!event.isCancelled()){ + for(i = 1; i <= plugin.canjoin.size(); i++){ + if(plugin.canjoin.get(i)){ + if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getBlock().getWorld().getName()))){ + i = plugin.canjoin.size()+1; + Block b = event.getBlock(); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + byte m = b.getData(); + String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + i; + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + i)){ + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveData(); + } + } + } + } + } + } + /*@EventHandler + public void blockGrow(BlockGrowEvent event){ + if(plugin.canjoin== true){ + Block b = event.getBlock(); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + String coords = w + "," + x + "," + y + "," + z + "," + d; + System.out.println("Grow: " + coords); + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + } + } + @EventHandler + public void blockForm(BlockFormEvent event){ + if(plugin.canjoin== true){ + Block b = event.getBlock(); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + String coords = w + "," + x + "," + y + "," + z + "," + d; + System.out.println("Snowfall: " + coords); + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + } + } + @EventHandler + public void pistonPush(BlockPistonExtendEvent event){ + if(plugin.canjoin== true){ + for(Block b:event.getBlocks()){ + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + String coords = w + "," + x + "," + y + "," + z + "," + d; + System.out.println("Piston: " + coords); + List blocks = plugin.data.getStringList("Blocks_Destroyed"); + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + } + } + } + @EventHandler + public void onChange(BlockPhysicsEvent event){ + Block block = event.getBlock(); + Material changed = event.getChangedType(); + if (block.getType() == Material.LAVA){ + if (changed == Material.LAVA){ + Block b = event.getBlock(); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + String coords = w + "," + x + "," + y + "," + z + "," + d; + System.out.println("Lava Change: " + coords); + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + }else if(changed == Material.WATER){ + Block b = event.getBlock(); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + String coords = w + "," + x + "," + y + "," + z + "," + d; + System.out.println("Water Change: " + coords); + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + } + }else if (block.getType() == Material.SAND || block.getType() == Material.GRAVEL) { + if (changed == Material.AIR) { + Block b = event.getBlock(); + String w = b.getWorld().getName(); + int x = b.getX(); + int y = b.getY(); + int z = b.getZ(); + int d = b.getTypeId(); + String coords = w + "," + x + "," + y + "," + z + "," + d; + System.out.println("Sand/Gravel Fall: " + coords); + List blocks = plugin.data.getStringList("Blocks_Placed"); + blocks.add(coords); + plugin.data.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + } + } + }*/ +} \ No newline at end of file diff --git a/src/me/Travja/HungerArena/ChatListener.java b/src/me/Travja/HungerArena/ChatListener.java new file mode 100644 index 0000000..b225ab4 --- /dev/null +++ b/src/me/Travja/HungerArena/ChatListener.java @@ -0,0 +1,50 @@ +package me.Travja.HungerArena; + +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerChatEvent; + +public class ChatListener implements Listener { + public Main plugin; + public ChatListener(Main m) { + this.plugin = m; + } + @EventHandler + public void TributeChat(AsyncPlayerChatEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + if(plugin.getArena(p)!= null){ + String msg = "<" + ChatColor.RED + "[Tribute] " + ChatColor.WHITE + pname + ">" + " " + event.getMessage(); + if(plugin.config.getString("ChatClose").equalsIgnoreCase("True")){ + double radius = plugin.config.getDouble("ChatClose_Radius"); + List near = p.getNearbyEntities(radius, radius, radius); + event.setCancelled(true); + if(!(near.size()== 0)){ + p.sendMessage(msg); + for(Entity e:near){ + if(e instanceof Player) + ((Player) e).sendMessage(msg); + } + }else if(near.size()== 0){ + p.sendMessage(msg); + p.sendMessage(ChatColor.YELLOW + "No one near!"); + }else if(!(near.size()== 0)){ + for(Entity en:near){ + if(!(en instanceof Player)){ + p.sendMessage(msg); + p.sendMessage(ChatColor.YELLOW + "No one near!"); + } + } + } + }else{ + event.setCancelled(true); + plugin.getServer().broadcastMessage(msg); + } + } + } +} diff --git a/src/me/Travja/HungerArena/Chests.java b/src/me/Travja/HungerArena/Chests.java new file mode 100644 index 0000000..45b0302 --- /dev/null +++ b/src/me/Travja/HungerArena/Chests.java @@ -0,0 +1,85 @@ +package me.Travja.HungerArena; + +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +public class Chests implements Listener { + public Main plugin; + public Chests(Main m) { + this.plugin = m; + } + @EventHandler(priority = EventPriority.HIGHEST) + public void ChestBreak(BlockBreakEvent event){ + Player p = event.getPlayer(); + + Block block = event.getBlock(); + if(p.hasPermission("HungerArena.Chest.Break")){ + Location blocklocation = block.getLocation(); + int blockx = blocklocation.getBlockX(); + int blocky = blocklocation.getBlockY(); + int blockz = blocklocation.getBlockZ(); + if (plugin.getConfig().getStringList("StorageXYZ").contains(blockx + "," + blocky + "," + blockz)) { + if(p.hasPermission("HungerArena.Chest.Break") && plugin.getArena(p)== null){ + List list2 = plugin.getConfig().getStringList("StorageXYZ"); + list2.remove(blockx + "," + blocky + "," + blockz); + plugin.getConfig().set("Storage." + blockx + "," + blocky+ "," + blockz, null); + plugin.getConfig().set("StorageXYZ", list2); + plugin.getConfig().options().copyDefaults(true); + plugin.saveConfig(); + p.sendMessage("[HungerArena] Chest Removed!"); + } else { + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "[HungerArena] That's a storage chest! You don't have permission to break it!"); + } + } + } + } + @EventHandler + public void ChestSaves(PlayerInteractEvent event){ + Block block = event.getClickedBlock(); + Player p = event.getPlayer(); + if(plugin.getArena(p)!= null){ + int a = plugin.getArena(p); + if(plugin.Playing.get(a).contains(p.getName()) && plugin.canjoin.get(a)){ + if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){ + if(block!= null){ + if(block.getState() instanceof Chest){ + ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents(); + int blockx = block.getX(); + int blocky = block.getY(); + int blockz = block.getZ(); + String blockw = block.getWorld().getName().toString(); + if(!plugin.getConfig().contains("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X")){ + plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X", blockx); + plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky); + plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz); + plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw); + plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest); + plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Arena", a); + } + List list2 = plugin.getConfig().getStringList("StorageXYZ"); + if(!list2.contains(blockx + "," + blocky + "," + blockz)){ + list2.add(blockx + "," + blocky + "," + blockz); + plugin.getConfig().set("StorageXYZ", list2); + plugin.getConfig().options().copyDefaults(true); + plugin.saveConfig(); + p.sendMessage(ChatColor.GREEN + "Thank you for finding this undiscovered chest, it has been stored!!"); + } + } + } + } + } + } + } +} diff --git a/src/me/Travja/HungerArena/CommandBlock.java b/src/me/Travja/HungerArena/CommandBlock.java new file mode 100644 index 0000000..fdb28de --- /dev/null +++ b/src/me/Travja/HungerArena/CommandBlock.java @@ -0,0 +1,149 @@ +package me.Travja.HungerArena; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +public class CommandBlock implements Listener { + public Main plugin; + public CommandBlock(Main m) { + this.plugin = m; + } + @EventHandler(priority = EventPriority.MONITOR) + public void CatchCommand(PlayerCommandPreprocessEvent event){ + String cmd = event.getMessage(); + Player p = event.getPlayer(); + String pname = p.getName(); + int i = 0; + int x = 0; + for(x = 1; x < plugin.Watching.size(); x++){ + if(plugin.Watching.get(x).contains(p.getName())){ + if(!p.hasPermission("HungerArena.UseCommands")){ + if(!plugin.management.getStringList("commands.whitelist").isEmpty()){ + for(String whitelist: plugin.management.getStringList("commands.whitelist")){ + i = i+1; + if(i== plugin.management.getStringList("commands.whitelist").size()){ + if(!cmd.toLowerCase().startsWith(whitelist.toLowerCase()) || !cmd.toLowerCase().startsWith("/ha")){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:"); + for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){ + p.sendMessage(ChatColor.AQUA + whitelistfull); + } + p.sendMessage(ChatColor.AQUA + "/ha"); + p.sendMessage(ChatColor.AQUA + "/ha close"); + p.sendMessage(ChatColor.AQUA + "/ha help"); + p.sendMessage(ChatColor.AQUA + "/ha join"); + p.sendMessage(ChatColor.AQUA + "/ha kick [Player]"); + p.sendMessage(ChatColor.AQUA + "/ha leave"); + p.sendMessage(ChatColor.AQUA + "/ha list"); + p.sendMessage(ChatColor.AQUA + "/ha open"); + p.sendMessage(ChatColor.AQUA + "/ha ready"); + p.sendMessage(ChatColor.AQUA + "/ha refill"); + p.sendMessage(ChatColor.AQUA + "/ha reload"); + p.sendMessage(ChatColor.AQUA + "/ha restart"); + p.sendMessage(ChatColor.AQUA + "/ha rlist"); + p.sendMessage(ChatColor.AQUA + "/ha setspawn"); + p.sendMessage(ChatColor.AQUA + "/ha start"); + p.sendMessage(ChatColor.AQUA + "/ha tp"); + p.sendMessage(ChatColor.AQUA + "/ha watch"); + p.sendMessage(ChatColor.AQUA + "/ha warpall"); + } + } + } + }else if(!cmd.toLowerCase().startsWith("/ha")){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are only allowed to perform /ha commands!"); + } + }else if(!cmd.toLowerCase().startsWith("/ha")){ + if(cmd.toLowerCase().startsWith("/spawn")){ + event.setCancelled(true); + p.sendMessage("You have perms for all commands except this one!"); + } + } + } + } + if(plugin.getArena(p)!= null){ + if(!p.hasPermission("HungerArena.UseCommands")){ + if(!plugin.management.getStringList("commands.whitelist").isEmpty()){ + for(String whitelist: plugin.management.getStringList("commands.whitelist")){ + i = i+1; + if(i== plugin.management.getStringList("commands.whitelist").size()){ + if(!cmd.toLowerCase().startsWith(whitelist.toLowerCase()) || !cmd.toLowerCase().startsWith("/ha")){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:"); + for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){ + p.sendMessage(ChatColor.AQUA + whitelistfull); + } + p.sendMessage(ChatColor.AQUA + "/ha"); + p.sendMessage(ChatColor.AQUA + "/ha close"); + p.sendMessage(ChatColor.AQUA + "/ha help"); + p.sendMessage(ChatColor.AQUA + "/ha join"); + p.sendMessage(ChatColor.AQUA + "/ha kick [Player]"); + p.sendMessage(ChatColor.AQUA + "/ha leave"); + p.sendMessage(ChatColor.AQUA + "/ha list"); + p.sendMessage(ChatColor.AQUA + "/ha open"); + p.sendMessage(ChatColor.AQUA + "/ha ready"); + p.sendMessage(ChatColor.AQUA + "/ha refill"); + p.sendMessage(ChatColor.AQUA + "/ha reload"); + p.sendMessage(ChatColor.AQUA + "/ha restart"); + p.sendMessage(ChatColor.AQUA + "/ha rlist"); + p.sendMessage(ChatColor.AQUA + "/ha setspawn"); + p.sendMessage(ChatColor.AQUA + "/ha start"); + p.sendMessage(ChatColor.AQUA + "/ha tp"); + p.sendMessage(ChatColor.AQUA + "/ha watch"); + p.sendMessage(ChatColor.AQUA + "/ha warpall"); + } + } + } + }else if(!cmd.toLowerCase().startsWith("/ha")){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are only allowed to perform /ha commands!"); + } + }else if(!cmd.toLowerCase().startsWith("/ha")){ + if(cmd.toLowerCase().startsWith("/spawn")){ + event.setCancelled(true); + p.sendMessage("You have perms for all commands except this one!"); + } + } + }else if(cmd.toLowerCase().equals("/back")){ + for(i = 1; i < plugin.Dead.size(); i++){ + if(plugin.Dead.get(i).contains(pname) && plugin.canjoin.get(i)) + plugin.Tele.add(p); + } + }else if(cmd.startsWith("/tp") || cmd.startsWith("/tpa") || cmd.startsWith("/tpo")){ + String[] args = cmd.split(" "); + Player arg1 = null; + Player arg2 = null; + if(args.length == 2){ + if(Bukkit.getPlayer(args[0]) != null && Bukkit.getPlayer(args[1]) != null){ + arg1 = Bukkit.getPlayer(args[0]); + arg2 = Bukkit.getPlayer(args[1]); + if(plugin.isSpectating(p)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "Invalid command for spectating, using /ha tp " + arg2); + p.performCommand("/ha tp " + arg2); + }else if(plugin.getArena(arg1)!= null || plugin.getArena(arg2)!= null){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You can't teleport to other tributes!"); + } + } + }else if(args.length == 1){ + if(Bukkit.getPlayer(args[0]) != null){ + arg1 = Bukkit.getPlayer(args[0]); + if(plugin.isSpectating(p)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "Invalid command for spectating, using /ha tp " + arg1); + p.performCommand("/ha tp " + arg1); + }else if(plugin.getArena(arg1)!= null || plugin.getArena(p)!= null){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You can't teleport to other tributes!"); + } + } + } + } + } +} diff --git a/src/me/Travja/HungerArena/DeathListener.java b/src/me/Travja/HungerArena/DeathListener.java new file mode 100644 index 0000000..15d653d --- /dev/null +++ b/src/me/Travja/HungerArena/DeathListener.java @@ -0,0 +1,151 @@ +package me.Travja.HungerArena; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerRespawnEvent; + +public class DeathListener implements Listener{ + public Main plugin; + public DeathListener(Main m){ + this.plugin = m; + } + public FileConfiguration config; + int i = 0; + int a = 0; + @EventHandler + public void onPlayerRespawn(PlayerRespawnEvent event){ + final Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 1; i < plugin.Dead.size(); i++){ + if(plugin.Dead.get(i).contains(pname)){ + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + World spawnw = plugin.getServer().getWorld(Spawncoords[3]); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + p.teleport(Spawn); + } + }, 10L); + } + } + } + @EventHandler + public void onPlayerDeath(PlayerDeathEvent event){ + Player p = event.getEntity(); + Server s = p.getServer(); + String pname = p.getName(); + int players = plugin.Playing.size()-1; + String leftmsg = null; + for(i = 1; i < plugin.Frozen.size(); i++){ + if(plugin.Frozen.get(i).contains(pname)){ + if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + players = plugin.Playing.get(a).size()-1; + leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!"; + if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ + double y = p.getLocation().getY(); + double newy = y+200; + double x = p.getLocation().getX(); + double z = p.getLocation().getZ(); + Location strike = new Location(p.getWorld(), x, newy, z); + p.getWorld().strikeLightning(strike); + } + event.setDeathMessage(""); + if(plugin.config.getBoolean("broadcastAll")){ + p.getServer().broadcastMessage(pname + ChatColor.LIGHT_PURPLE + " Stepped off their pedestal too early!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(pname + ChatColor.LIGHT_PURPLE + " Stepped off their pedestal too early!"); + } + } + plugin.Frozen.get(a).remove(pname); + plugin.Playing.get(a).remove(pname); + plugin.Dead.get(a).add(pname); + if(plugin.config.getBoolean("broadcastAll")){ + p.getServer().broadcastMessage(leftmsg); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(leftmsg); + } + } + plugin.winner(a); + } + }else if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + players = plugin.Playing.get(a).size()-1; + leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!"; + if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ + double y = p.getLocation().getY(); + double newy = y+200; + double x = p.getLocation().getX(); + double z = p.getLocation().getZ(); + Location strike = new Location(p.getWorld(), x, newy, z); + p.getWorld().strikeLightning(strike); + } + plugin.Dead.get(a).add(pname); + plugin.Playing.get(a).remove(pname); + if(p.getKiller() instanceof Player){ + if(p.getKiller().getItemInHand().getType().getId()== 0){ + Player killer = p.getKiller(); + String killername = killer.getName(); + event.setDeathMessage(""); + if(plugin.config.getBoolean("broadcastAll")){ + s.broadcastMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!"); + s.broadcastMessage(leftmsg); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!"); + g.sendMessage(leftmsg); + } + } + plugin.winner(a); + }else{ + Player killer = p.getKiller(); + String killername = killer.getName(); + String weapon = killer.getItemInHand().getType().toString().replace('_', ' '); + String msg = ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with a(n) " + weapon; + event.setDeathMessage(""); + if(plugin.config.getBoolean("broadcastAll")){ + s.broadcastMessage(msg); + s.broadcastMessage(leftmsg); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(msg); + g.sendMessage(leftmsg); + } + } + plugin.winner(a); + } + }else{ + event.setDeathMessage(""); + if(plugin.config.getBoolean("broadcastAll")){ + s.broadcastMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!"); + s.broadcastMessage(leftmsg); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!"); + g.sendMessage(leftmsg); + } + } + plugin.winner(a); + } + } + } + } +} diff --git a/src/me/Travja/HungerArena/DmgListener.java b/src/me/Travja/HungerArena/DmgListener.java new file mode 100644 index 0000000..41cfe93 --- /dev/null +++ b/src/me/Travja/HungerArena/DmgListener.java @@ -0,0 +1,33 @@ +package me.Travja.HungerArena; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; + +/** + * + * @author YoshiGenius + */ +public class DmgListener implements Listener { + + public Main plugin; + public DmgListener(Main m) { + this.plugin = m; + } + int i = 0; + @EventHandler + public void onDmg(EntityDamageEvent evt) { + Entity e = evt.getEntity(); + if (e instanceof Player) { + Player p = (Player) e; + String pn = p.getName(); + for(i= 1; i < plugin.Frozen.size(); i++){ + if (plugin.Frozen.get(i).contains(pn)) + evt.setCancelled(true); + } + } + } + +} diff --git a/src/me/Travja/HungerArena/FreezeListener.java b/src/me/Travja/HungerArena/FreezeListener.java new file mode 100644 index 0000000..1ab1197 --- /dev/null +++ b/src/me/Travja/HungerArena/FreezeListener.java @@ -0,0 +1,63 @@ +package me.Travja.HungerArena; + +import java.util.HashMap; + +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerMoveEvent; + +public class FreezeListener implements Listener { + public Main plugin; + public FreezeListener(Main m) { + this.plugin = m; + } + int i = 0; + int a = 0; + private HashMap timeUp= new HashMap(); + @EventHandler + public void onPlayerMove(PlayerMoveEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + if(plugin.Frozen.get(a).contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){ + if(plugin.config.getString("Explode_on_Move").equalsIgnoreCase("true")){ + for(String players: plugin.Playing.get(a)){ + final Player playing = plugin.getServer().getPlayerExact(players); + i = plugin.Playing.get(a).indexOf(players); + if(!timeUp.get(a)){ + if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(a).get(i))){ + playing.teleport(plugin.location.get(a).get(i)); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + if(!timeUp.get(a)){ + timeUp.put(a, true); + } + } + },30L); + } + }else{ + if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(a).get(i))){ + if(!plugin.Dead.get(a).contains(playing.getName())){ + World world = playing.getLocation().getWorld(); + world.createExplosion(playing.getLocation(), 0.0F, false); + playing.setHealth(0); + } + } + } + } + }else{ + for(String players:plugin.Playing.get(a)){ + Player playing = plugin.getServer().getPlayerExact(players); + i = plugin.Playing.get(a).indexOf(players)+1; + if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(a).get(i))){ + playing.teleport(plugin.location.get(a).get(i)); + } + } + } + } + } + } +} diff --git a/src/me/Travja/HungerArena/HaCommands.java b/src/me/Travja/HungerArena/HaCommands.java new file mode 100644 index 0000000..40d1b51 --- /dev/null +++ b/src/me/Travja/HungerArena/HaCommands.java @@ -0,0 +1,1558 @@ +package me.Travja.HungerArena; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class HaCommands implements CommandExecutor { + public Main plugin; + public HaCommands(Main m) { + this.plugin = m; + } + int i = 0; + int a = 1; + @SuppressWarnings("deprecation") + private void clearInv(Player p){ + p.getInventory().clear(); + p.getInventory().setBoots(null); + p.getInventory().setChestplate(null); + p.getInventory().setHelmet(null); + p.getInventory().setLeggings(null); + p.updateInventory(); + } + @SuppressWarnings({ "unchecked" }) + @Override + public boolean onCommand(final CommandSender sender, Command cmd, String commandLabel, String[] args){ + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + String spawnworld = Spawncoords[3]; + World spawnw = plugin.getServer().getWorld(spawnworld); + Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + if(sender instanceof Player){ + final Player p = (Player) sender; + final String pname = p.getName(); + ChatColor c = ChatColor.AQUA; + if(cmd.getName().equalsIgnoreCase("Ha")){ + if(args.length== 0){ + p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja! Version: " + plugin.getDescription().getVersion()); + return false; + }else if(args[0].equalsIgnoreCase("SetSpawn")){ + if(p.hasPermission("HungerArena.SetSpawn")){ + double x = p.getLocation().getX(); + double y = p.getLocation().getY(); + double z = p.getLocation().getZ(); + String w = p.getWorld().getName(); + plugin.spawns.set("Spawn_coords", x + "," + y + "," + z + "," + w); + plugin.spawns.set("Spawns_set", "true"); + plugin.saveSpawns(); + p.sendMessage(ChatColor.AQUA + "You have set the spawn for dead tributes!"); + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else if(args[0].equalsIgnoreCase("Help")){ + p.sendMessage(ChatColor.GREEN + "----HungerArena Help----"); + sender.sendMessage(c + "/ha - Displays author message!"); + sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!"); + sender.sendMessage(c + "/startpoint [1,2,3,4,etc] [1,2,3,4,etc] - Sets the starting points of tributes in a specific arena!"); + sender.sendMessage(c + "/ha close (1,2,3,4,etc) - Prevents anyone from joining that arena! Numbers are optional"); + sender.sendMessage(c + "/ha help - Displays this screen!"); + sender.sendMessage(c + "/ha join [1,2,3,4,etc] - Makes you join the game!"); + sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!"); + sender.sendMessage(c + "/ha leave - Makes you leave the game!"); + sender.sendMessage(c + "/ha list (1,2,3,4,etc) - Shows a list of players in the game and their health! Numbers are optional."); + sender.sendMessage(c + "/ha open (1,2,3,4,etc) - Opens the game allowing people to join! Numbers are optional"); + sender.sendMessage(c + "/ha ready - Votes for the game to start!"); + sender.sendMessage(c + "/ha refill (1,2,3,4,etc) - Refills all chests! Numbers are optional"); + sender.sendMessage(c + "/ha reload - Reloads the config!"); + sender.sendMessage(c + "/ha restart (1,2,3,4,etc) - Restarts the game! Numbers are optional"); + sender.sendMessage(c + "/ha rlist (1,2,3,4,etc) - See who's ready! Numbers are optional"); + sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!"); + sender.sendMessage(c + "/ha tp [player] - Teleports you to a tribute!"); + sender.sendMessage(c + "/ha start [1,2,3,4,etc] - Unfreezes tributes allowing them to fight!"); + sender.sendMessage(c + "/ha watch [1,2,3,4,etc] - Lets you watch the tributes!"); + sender.sendMessage(c + "/ha warpall [1,2,3,4,etc] - Warps all tribute into position!"); + sender.sendMessage(ChatColor.GREEN + "----------------------"); + }else if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){ + p.sendMessage(ChatColor.RED + "That can't be run in this world!"); + }else if((plugin.restricted && plugin.worlds.contains(p.getWorld().getName())) || !plugin.restricted){ + //////////////////////////////////////// LISTING /////////////////////////////////////////////// + if(args[0].equalsIgnoreCase("List")){ + if(p.hasPermission("HungerArena.GameMaker") || plugin.Watching.get(a).contains(pname) || p.hasPermission("HungerArena.List")){ + if(args.length>= 2){ + try{ + a = Integer.parseInt(args[1]); + sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); + if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ + for(String playernames: plugin.Playing.get(a)){ + Player players = plugin.getServer().getPlayerExact(playernames); + if(p.hasPermission("HungerArena.GameMaker")){ + sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); + }else if(p.hasPermission("HungerArena.List")){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + } + }else{ + p.sendMessage(ChatColor.GRAY + "No one is playing!"); + } + p.sendMessage(ChatColor.AQUA + "-------------------"); + }catch(Exception e){ + p.sendMessage(ChatColor.RED + "Argument not an integer or is an invalid arena!"); + } + }else{ + if(plugin.getArena(p)== null){ + p.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); + if(!plugin.Playing.get(1).isEmpty() && plugin.Playing.containsKey(1)){ + for(String playernames: plugin.Playing.get(1)){ + Player players = plugin.getServer().getPlayerExact(playernames); + if(p.hasPermission("HungerArena.GameMaker")){ + sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); + }else if(p.hasPermission("HungerArena.List")){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + } + }else{ + p.sendMessage(ChatColor.GRAY + "No one is playing!"); + } + }else{ + a = plugin.getArena(p); + sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); + if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ + for(String playernames: plugin.Playing.get(a)){ + Player players = plugin.getServer().getPlayerExact(playernames); + if(p.hasPermission("HungerArena.GameMaker")){ + sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); + }else if(p.hasPermission("HungerArena.List")){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + } + }else{ + p.sendMessage(ChatColor.GRAY + "No one is playing!"); + } + } + p.sendMessage(ChatColor.AQUA + "-------------------"); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else if(args[0].equalsIgnoreCase("rList")){ + if(p.hasPermission("HungerArena.GameMaker")){ + if(args.length>= 2){ + try{ + a = Integer.parseInt(args[1]); + sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); + if(!plugin.Ready.get(a).isEmpty() && plugin.Ready.containsKey(a)){ + for(String playernames: plugin.Ready.get(a)){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + }else{ + p.sendMessage(ChatColor.GRAY + "No one is ready!"); + } + p.sendMessage(ChatColor.AQUA + "-------------------"); + }catch(Exception e){ + p.sendMessage(ChatColor.RED + "Argument not an integer!"); + } + }else{ + p.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); + if(!plugin.Ready.get(1).isEmpty() && plugin.Ready.containsKey(1)){ + for(String playernames: plugin.Ready.get(1)){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + }else{ + p.sendMessage(ChatColor.GRAY + "No one is ready!"); + } + p.sendMessage(ChatColor.AQUA + "-------------------"); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + //////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////// JOINING/LEAVING ////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("Join")){ + if(p.hasPermission("HungerArena.Join")){ + boolean needconfirm = false; + for(i= 1; i< plugin.NeedConfirm.size(); i++){ + if(plugin.NeedConfirm.get(i).contains(pname)){ + needconfirm = true; + p.sendMessage(ChatColor.GOLD + "You need to run /ha confirm"); + } + } + if(!needconfirm){ + try{ + a = Integer.parseInt(args[1]); + }catch(Exception e){ + i = 1; + while(i <= plugin.Playing.size()){ + if(plugin.Playing.get(i).size()< plugin.maxPlayers.get(i)){ + a = i; + i = plugin.Playing.size()+1; + } + if(plugin.Playing.size()== i){ + p.sendMessage(ChatColor.RED + "All games are full!"); + } + i++; + } + } + if(plugin.Playing.get(a)!= null){ + if(plugin.Playing.get(a).contains(pname)){ + p.sendMessage(ChatColor.RED + "You are already playing!"); + }else if(plugin.Dead.get(a).contains(pname) || plugin.Quit.get(a).contains(pname)){ + p.sendMessage(ChatColor.RED + "You DIED/QUIT! You can't join again!"); + }else if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + p.sendMessage(ChatColor.RED + "There are already " + plugin.maxPlayers.get(a) + " Tributes in that Arena!"); + }else if(plugin.canjoin.get(a)== true){ + p.sendMessage(ChatColor.RED + "That game is in progress!"); + }else if(!plugin.open.get(a)){ + p.sendMessage(ChatColor.RED + "That game is closed!"); + }else if(plugin.spawns.getString("Spawns_set").equalsIgnoreCase("false")){ + p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); + }else if(plugin.NeedConfirm.get(a).contains(pname)){ + p.sendMessage(ChatColor.RED + "You need to do /ha confirm"); + }else if(plugin.getArena(p)!= null){ + p.sendMessage(ChatColor.RED + "You are already in an arena!"); + }else if(plugin.config.getString("Need_Confirm").equalsIgnoreCase("true")){ + if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ + i = 0; + for(ItemStack fee: plugin.Fee){ + int total = plugin.Fee.size(); + if(p.getInventory().contains(fee)){ + i = i+1; + if(total == i){ + plugin.NeedConfirm.get(a).add(pname); + p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); + } + } + } + if(plugin.Fee.size() > i){ + p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); + } + }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ + i = 0; + for(ItemStack fee: plugin.Fee){ + int total = plugin.Fee.size(); + if(p.getInventory().contains(fee)){ + i = i+1; + if(total == i){ + plugin.NeedConfirm.get(a).add(pname); + p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); + } + } + } + if(plugin.Fee.size() > i){ + p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); + } + }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ + plugin.NeedConfirm.get(a).add(pname); + p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); + } + }else{ + plugin.NeedConfirm.get(a).add(pname); + p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); + } + }else if(plugin.config.getString("Need_Confirm").equalsIgnoreCase("false")){ + if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ + i = 0; + for(ItemStack fee: plugin.Fee){ + int total = plugin.Fee.size(); + if(p.getInventory().contains(fee)){ + i = i+1; + if(total == i){ + plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); + for(ItemStack fees: plugin.Fee){ + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); + } + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + } + } + } + if(plugin.Fee.size() > i){ + p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); + } + }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ + i = 0; + for(ItemStack fee: plugin.Fee){ + int total = plugin.Fee.size(); + if(p.getInventory().contains(fee)){ + i = i+1; + if(total == i){ + for(ItemStack fees: plugin.Fee){ + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); + } + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + } + } + } + if(plugin.Fee.size() > i){ + p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); + } + }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ + plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); + } + }else{ + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + } + } + }else{ + p.sendMessage(ChatColor.RED + "That arena doesn't exist!"); + } + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + //////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////// CONFIRMATION /////////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("Confirm")){ + int v = 0; + for(v = 1; v < plugin.NeedConfirm.size(); v++){ + if(plugin.NeedConfirm.get(v).contains(pname)){ + v = plugin.NeedConfirm.size()+1; + if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ + i = 0; + for(ItemStack fee: plugin.Fee){ + int total = plugin.Fee.size(); + if(p.getInventory().contains(fee)){ + i = i+1; + if(total == i){ + plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); + for(ItemStack fees: plugin.Fee){ + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); + } + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + } + } + } + if(plugin.Fee.size() > i){ + p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); + } + }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ + i = 0; + for(ItemStack fee: plugin.Fee){ + int total = plugin.Fee.size(); + if(p.getInventory().contains(fee)){ + i = i+1; + if(total == i){ + for(ItemStack fees: plugin.Fee){ + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was paid to join the games."); + } + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + } + } + } + if(plugin.Fee.size() > i){ + p.sendMessage(ChatColor.RED + "You are missing some items and can't join the games..."); + } + }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("EntryFee.cost"))){ + plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("EntryFee.cost")); + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been taken from your account!"); + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to join!"); + } + }else{ + plugin.Playing.get(a).add(pname); + plugin.NeedConfirm.get(a).remove(pname); + p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!"); + clearInv(p); + if(plugin.config.getBoolean("broadcastAll")){ + plugin.getServer().broadcastMessage(ChatColor.AQUA + pname + " has Joined Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.AQUA + pname + " has Joined the Game!"); + } + } + if(plugin.Playing.get(a).size()== plugin.maxPlayers.get(a)){ + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha warpall " + a); + } + } + } + if(v== plugin.NeedConfirm.size()){ + p.sendMessage(ChatColor.RED + "You haven't joined any games!"); + } + } + }else if(args[0].equalsIgnoreCase("Ready")){ + p.sendMessage(String.valueOf(plugin.getArena(p))); + if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + for(String s:plugin.Playing.get(a)) + p.sendMessage(s); + if(plugin.Playing.get(a).contains(pname)){ + if(plugin.Ready.get(a).contains(pname)){ + p.sendMessage(ChatColor.RED + "You're already ready!"); + }else if(plugin.Playing.get(a).size()== 1){ + p.sendMessage(ChatColor.RED + "You can't be ready when no one else is playing!"); + }else{ + plugin.Ready.get(a).add(pname); + p.sendMessage(ChatColor.AQUA + "You have marked yourself as READY!"); + if(plugin.Playing.get(a).size()-4== plugin.Ready.get(a).size() || plugin.Playing.get(a).size()==plugin.Ready.get(a).size()){ + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha warpall " + a); + } + } + } + }else{ + p.sendMessage(ChatColor.RED + "You aren't playing in any games!"); + } + }else if(args[0].equalsIgnoreCase("Leave")){ + if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + if(plugin.canjoin.get(a)== true){ + plugin.Playing.get(a).remove(pname); + p.sendMessage(ChatColor.AQUA + "You have left the game!"); + if(plugin.config.getBoolean("broadcastAll")){ + p.getServer().broadcastMessage(ChatColor.RED + pname + " Left Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.RED + pname + " Quit!"); + } + } + clearInv(p); + p.teleport(Spawn); + if(plugin.Frozen.get(a).contains(pname)){ + plugin.Frozen.get(a).remove(pname); + } + plugin.winner(a); + }else{ + plugin.Playing.get(a).remove(pname); + p.sendMessage(ChatColor.AQUA + "You have left the game!"); + if(plugin.config.getBoolean("broadcastAll")){ + p.getServer().broadcastMessage(ChatColor.RED + pname + " Left Arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.RED + pname + " Quit!"); + } + } + clearInv(p); + p.teleport(Spawn); + if(plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + plugin.econ.depositPlayer(pname, plugin.config.getDouble("EntryFee.cost")); + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has been added to your account!"); + for(ItemStack fees: plugin.Fee){ + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was refunded because you left the games."); + } + }else if(plugin.config.getBoolean("EntryFee.enabled") && !plugin.config.getBoolean("EntryFee.eco")){ + for(ItemStack fees: plugin.Fee){ + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + fees + " was refunded because you left the games."); + } + }else if(!plugin.config.getBoolean("EntryFee.enabled") && plugin.config.getBoolean("EntryFee.eco")){ + plugin.econ.depositPlayer(pname, plugin.config.getDouble("EntryFee.cost")); + p.sendMessage(ChatColor.GOLD + "[HungerArena] " + ChatColor.GREEN + "$" + plugin.config.getDouble("EntryFee.cost") + " has added to your account!"); + } + } + }else{ + p.sendMessage(ChatColor.RED + "You aren't in any games!"); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////// SPECTATOR RELATED ////////////////////////////////// + }else if(args[0].equalsIgnoreCase("Watch")){ + if(sender.hasPermission("HungerArena.Watch")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(!plugin.Watching.get(a).contains(pname) && plugin.getArena(p)== null && plugin.canjoin.get(a)== true){ + plugin.Watching.get(a).add(pname); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.hidePlayer(p); + } + p.setAllowFlight(true); + p.sendMessage(ChatColor.AQUA + "You can now spectate!"); + }else if(plugin.canjoin.get(a)== false){ + p.sendMessage(ChatColor.RED + "That game isn't in progress!"); + }else if(plugin.Playing.get(a).contains(pname)){ + p.sendMessage(ChatColor.RED + "You can't watch while you're playing!"); + }else if(plugin.Watching.get(a).contains(pname)){ + plugin.Watching.get(a).remove(pname); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(p); + } + p.teleport(Spawn); + p.setAllowFlight(false); + p.sendMessage(ChatColor.AQUA + "You are not spectating any more"); + } + }else{ + p.sendMessage(ChatColor.RED + "Too few arguments!"); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else if(args[0].equalsIgnoreCase("tp")){ + int b = 0; + for(i = 1; i <= plugin.Watching.size(); i++){ + if(plugin.Watching.get(a).contains(pname)){ + if(plugin.getArena(Bukkit.getServer().getPlayer(args[1])) != null){ + Player target = Bukkit.getServer().getPlayer(args[1]); + p.teleport(target); + p.sendMessage(ChatColor.AQUA + "You've been teleported to " + target.getName()); + }else{ + p.sendMessage(ChatColor.RED + "That person isn't in game!"); + } + }else{ + b = b+1; + if(b== plugin.Watching.size()){ + p.sendMessage(ChatColor.RED + "You have to be spectating first!"); + } + } + } + ///////////////////////////////////////////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("Kick")){ + if (args.length != 2) { + return false; + } + Player target = Bukkit.getServer().getPlayer(args[1]); + if(sender.hasPermission("HungerArena.Kick")){ + if(plugin.getArena(target) != null){ + a = plugin.getArena(target); + plugin.Playing.get(a).remove(target.getName()); + if(plugin.config.getBoolean("broadcastAll")){ + p.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.RED + target.getName() + " was kicked from the game!"); + } + } + clearInv(target); + target.teleport(Spawn); + plugin.Quit.get(a).add(target.getName()); + plugin.winner(a); + }else{ + sender.sendMessage(ChatColor.RED + "That player isn't in the game!"); + } + }else{ + sender.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else if(args[0].equalsIgnoreCase("Refill")){ + if(p.hasPermission("HungerArena.Refill")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + int list056; + list056 = 0; + int limit = plugin.config.getStringList("StorageXYZ").size(); + while(limit > list056){ + String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); + int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); + int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); + int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); + int chesta = plugin.getConfig().getInt("Storage." + xyz2 + ".Arena"); + String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); + Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); + plugin.exists = false; + if(chesta== a){ + if(blockatlocation.getState() instanceof Chest){ + plugin.exists = true; + Chest chest = (Chest) blockatlocation.getState(); + if(chesta== a){ + chest.getInventory().clear(); + ItemStack[] itemsinchest = null; + Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); + if(o instanceof ItemStack[]){ + itemsinchest = (ItemStack[]) o; + }else if(o instanceof List){ + itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); + } + list056 = list056+1; + chest.getInventory().setContents(itemsinchest); + chest.update(); + } + } + }else{ + list056 = list056+1; + } + if(limit== list056){ + sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!"); + } + } + }else{ + int list056; + list056 = 0; + int limit = plugin.config.getStringList("StorageXYZ").size(); + while(limit > list056){ + String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); + int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); + int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); + int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); + String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); + Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); + plugin.exists = false; + if(blockatlocation.getState() instanceof Chest){ + plugin.exists = true; + Chest chest = (Chest) blockatlocation.getState(); + chest.getInventory().clear(); + ItemStack[] itemsinchest = null; + Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); + if(o instanceof ItemStack[]){ + itemsinchest = (ItemStack[]) o; + }else if(o instanceof List){ + itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); + } + list056 = list056+1; + chest.getInventory().setContents(itemsinchest); + chest.update(); + } + } + if(limit== list056){ + sender.sendMessage(ChatColor.GREEN + "All chests refilled!"); + } + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else if(args[0].equalsIgnoreCase("Restart")){ + int b = 0; + if(p.hasPermission("HungerArena.Restart")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + for(b = 0; b < plugin.Watching.get(a).size(); b++){ + String s = plugin.Watching.get(a).get(b); + Player spectator = plugin.getServer().getPlayerExact(s); + spectator.setAllowFlight(false); + spectator.teleport(Spawn); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectator); + } + } + plugin.Dead.get(a).clear(); + plugin.Quit.get(a).clear(); + plugin.Watching.get(a).clear(); + plugin.Frozen.get(a).clear(); + plugin.Ready.get(a).clear(); + plugin.NeedConfirm.get(a).clear(); + plugin.Out.get(a).clear(); + plugin.Playing.get(a).clear(); + plugin.inArena.get(a).clear(); + plugin.canjoin.put(a, false); + plugin.open.put(a, true); + List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); + List blocksplaced = plugin.data.getStringList("Blocks_Placed"); + ArrayList toremove = new ArrayList(); + ArrayList toremove2 = new ArrayList(); + for(String blocks:blocksplaced){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int arena = Integer.parseInt(coords[4]); + int d = 0; + byte m = 0; + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + if(arena== a){ + block.setTypeIdAndData(d, m, true); + block.getState().update(); + toremove.add(blocks); + } + } + for(String blocks:blocksbroken){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int d = Integer.parseInt(coords[4]); + byte m = Byte.parseByte(coords[5]); + int arena = Integer.parseInt(coords[6]); + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + if(arena== a){ + block.setTypeIdAndData(d, m, true); + block.getState().update(); + toremove2.add(blocks); + } + } + for(String blocks: toremove){ + blocksplaced.remove(blocks); + } + for(String blocks: toremove2){ + blocksbroken.remove(blocks); + } + toremove.clear(); + toremove2.clear(); + plugin.data.set("Blocks_Destroyed", blocksbroken); + plugin.data.set("Blocks_Placed", blocksplaced); + plugin.data.options().copyDefaults(); + plugin.saveData(); + p.performCommand("ha refill " + a); + p.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!"); + }else{ + for(i = 1; i <= plugin.Watching.size(); i++){ + for(b = 0; b <= plugin.Watching.get(i).size(); b++){ + if(plugin.Watching.get(i).get(b)!= null){ + String s = plugin.Watching.get(i).get(b); + Player spectator = plugin.getServer().getPlayerExact(s); + spectator.setAllowFlight(false); + spectator.teleport(Spawn); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectator); + } + } + } + } + plugin.Dead.clear(); + plugin.Quit.clear(); + plugin.Watching.clear(); + plugin.Frozen.clear(); + plugin.Ready.clear(); + plugin.NeedConfirm.clear(); + plugin.Out.clear(); + plugin.Playing.clear(); + plugin.inArena.clear(); + for(i = 1; i <= plugin.canjoin.size(); i++){ + plugin.canjoin.put(i, false); + } + for(i = 1; i <= plugin.open.size(); i++){ + plugin.open.put(i, true); + } + List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); + List blocksplaced = plugin.data.getStringList("Blocks_Placed"); + for(String blocks:blocksplaced){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int d = 0; + byte m = 0; + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + block.setTypeIdAndData(d, m, true); + block.getState().update(); + } + for(String blocks:blocksbroken){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int d = Integer.parseInt(coords[4]); + byte m = Byte.parseByte(coords[5]); + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + block.setTypeIdAndData(d, m, true); + block.getState().update(); + } + blocksplaced.clear(); + blocksbroken.clear(); + plugin.data.set("Blocks_Destroyed", blocksbroken); + plugin.data.set("Blocks_Placed", blocksplaced); + plugin.data.options().copyDefaults(); + plugin.saveData(); + p.performCommand("ha refill"); + p.sendMessage(ChatColor.AQUA + "All games have been reset!"); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + /////////////////////////////////// Toggle ////////////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("close")){ + if(p.hasPermission("HungerArena.toggle")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(plugin.open.get(a)){ + plugin.open.put(a, false); + if(plugin.Playing.get(a)!= null){ + for(String players: plugin.Playing.get(a)){ + Player tributes = plugin.getServer().getPlayerExact(players); + clearInv(tributes); + tributes.teleport(tributes.getWorld().getSpawnLocation()); + } + } + if(plugin.Watching.get(a)!= null){ + for(String sname: plugin.Watching.get(a)){ + Player spectators = plugin.getServer().getPlayerExact(sname); + spectators.teleport(spectators.getWorld().getSpawnLocation()); + spectators.setAllowFlight(false); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectators); + } + } + } + plugin.Dead.get(a).clear(); + plugin.Quit.get(a).clear(); + plugin.Watching.get(a).clear(); + plugin.Frozen.get(a).clear(); + plugin.Ready.get(a).clear(); + plugin.NeedConfirm.get(a).clear(); + plugin.Out.get(a).clear(); + plugin.Playing.get(a).clear(); + plugin.inArena.get(a).clear(); + p.performCommand("ha refill " + a); + p.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!"); + }else{ + p.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!"); + } + }else{ + for(i = 1; i <= plugin.open.size(); i++){ + if(plugin.open.get(i)){ + plugin.open.put(i, false); + if(plugin.Playing.get(i)!= null){ + for(String players: plugin.Playing.get(i)){ + Player tributes = plugin.getServer().getPlayerExact(players); + clearInv(tributes); + tributes.teleport(tributes.getWorld().getSpawnLocation()); + } + } + if(plugin.Watching.get(i)!= null){ + for(String sname: plugin.Watching.get(i)){ + Player spectators = plugin.getServer().getPlayerExact(sname); + spectators.teleport(spectators.getWorld().getSpawnLocation()); + spectators.setAllowFlight(false); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectators); + } + } + } + plugin.Dead.clear(); + plugin.Quit.clear(); + plugin.Watching.clear(); + plugin.Frozen.clear(); + plugin.Ready.clear(); + plugin.NeedConfirm.clear(); + plugin.Out.clear(); + plugin.Playing.clear(); + plugin.inArena.clear(); + p.performCommand("ha refill"); + p.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!"); + }else{ + p.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!"); + } + } + } + }else{ + p.sendMessage(ChatColor.RED + "No Perms!"); + } + }else if(args[0].equalsIgnoreCase("open")){ + if(p.hasPermission("HungerArena.toggle")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(!plugin.open.get(a)){ + plugin.open.put(a, true); + p.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); + }else{ + p.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); + } + }else{ + for(i = 1; i <= plugin.open.size(); i++){ + if(!plugin.open.get(i)){ + plugin.open.put(i, true); + p.sendMessage(ChatColor.GOLD + "Arena " + i + " Open!"); + i = i+1; + }else{ + p.sendMessage(ChatColor.RED + "Arena " + i + " already open, type /ha close to close them!"); + i = i+1; + } + } + } + }else{ + p.sendMessage(ChatColor.RED + "No Perms!"); + } + //////////////////////////////////////////////////////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("Reload")){ + if(p.hasPermission("HungerArena.Reload")){ + plugin.location.clear(); + plugin.Reward.clear(); + plugin.Cost.clear(); + plugin.Fee.clear(); + plugin.onEnable(); + p.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!"); + System.out.println(ChatColor.GREEN + pname + " reloaded HungerArena!"); + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission"); + } + }else if(args[0].equalsIgnoreCase("WarpAll")){ + if(p.hasPermission("HungerArena.Warpall")){ + if(plugin.spawns.getString("Spawns_set").equalsIgnoreCase("false")){ + sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); + }else{ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(plugin.Playing.get(a).size()== 1){ + sender.sendMessage(ChatColor.RED + "There are not enough players!"); + }else{ + if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){ + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start " + a); + } + }, 20L); + } + i = 1; + for(String playing:plugin.Playing.get(a)){ + Player tribute = plugin.getServer().getPlayerExact(playing); + tribute.teleport(plugin.location.get(a).get(i)); + tribute.setHealth(20); + tribute.setFoodLevel(20); + tribute.setSaturation(20); + tribute.setLevel(0); + clearInv(tribute); + for(PotionEffect pe: tribute.getActivePotionEffects()){ + PotionEffectType potion = pe.getType(); + tribute.removePotionEffect(potion); + } + if(tribute.getAllowFlight()){ + tribute.setAllowFlight(false); + } + plugin.Frozen.get(a).add(tribute.getName()); + i = i+1; + } + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + p.sendMessage(ChatColor.AQUA + "All Tributes warped!"); + } + }, 20L); + } + }else{ + p.sendMessage(ChatColor.RED + "Too few arguments, specify an arena"); + } + } + } + }else if(args[0].equalsIgnoreCase("Start")){ + if(p.hasPermission("HungerArena.Start")){ + if(args.length!= 2){ + p.sendMessage(ChatColor.RED + "You need an arena!"); + }else{ + a = Integer.parseInt(args[1]); + if(plugin.canjoin.get(a)== true) + p.sendMessage(ChatColor.RED + "Game already in progress!"); + else if(plugin.Playing.get(a).isEmpty()) + p.sendMessage(ChatColor.RED + "No one is in that game!"); + else + plugin.startGames(a); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else{ + p.sendMessage(ChatColor.RED + "Unknown command, type /ha help for a list of commands"); + } + } + } + }else if(sender instanceof ConsoleCommandSender){ + if(cmd.getName().equalsIgnoreCase("Ha")){ + if(args.length== 0){ + sender.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja! Version: " + plugin.getDescription().getVersion()); + return false; + } + if(args[0].equalsIgnoreCase("Help")){ + ChatColor c = ChatColor.AQUA; + sender.sendMessage(ChatColor.GREEN + "----HungerArena Help----"); + sender.sendMessage(c + "/ha - Displays author message!"); + sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!"); + sender.sendMessage(c + "/startpoint [1,2,3,4,etc] [1,2,3,4,etc] - Sets the starting points of tributes in a specific arena!"); + sender.sendMessage(c + "/ha close (1,2,3,4,etc) - Prevents anyone from joining that arena! Numbers are optional"); + sender.sendMessage(c + "/ha help - Displays this screen!"); + sender.sendMessage(c + "/ha join [1,2,3,4,etc] - Makes you join the game!"); + sender.sendMessage(c + "/ha kick [Player] - Kicks a player from the arena!"); + sender.sendMessage(c + "/ha leave - Makes you leave the game!"); + sender.sendMessage(c + "/ha list (1,2,3,4,etc) - Shows a list of players in the game and their health! Numbers are optional."); + sender.sendMessage(c + "/ha open (1,2,3,4,etc) - Opens the game allowing people to join! Numbers are optional"); + sender.sendMessage(c + "/ha ready - Votes for the game to start!"); + sender.sendMessage(c + "/ha refill (1,2,3,4,etc) - Refills all chests! Numbers are optional"); + sender.sendMessage(c + "/ha reload - Reloads the config!"); + sender.sendMessage(c + "/ha restart (1,2,3,4,etc) - Restarts the game! Numbers are optional"); + sender.sendMessage(c + "/ha rlist (1,2,3,4,etc) - See who's ready! Numbers are optional"); + sender.sendMessage(c + "/ha setspawn - Sets the spawn for dead tributes!"); + sender.sendMessage(c + "/ha tp [player] - Teleports you to a tribute!"); + sender.sendMessage(c + "/ha start [1,2,3,4,etc] - Unfreezes tributes allowing them to fight!"); + sender.sendMessage(c + "/ha watch [1,2,3,4,etc] - Lets you watch the tributes!"); + sender.sendMessage(c + "/ha warpall [1,2,3,4,etc] - Warps all tribute into position!"); + sender.sendMessage(ChatColor.GREEN + "----------------------"); + return false; + }else if(args[0].equalsIgnoreCase("List")){ + if(args.length>= 2){ + try{ + a = Integer.parseInt(args[1]); + sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); + if(!plugin.Playing.get(a).isEmpty() && plugin.Playing.containsKey(a)){ + for(String playernames: plugin.Playing.get(a)){ + Player players = plugin.getServer().getPlayerExact(playernames); + sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); + } + }else{ + sender.sendMessage(ChatColor.GRAY + "No one is playing!"); + } + sender.sendMessage(ChatColor.AQUA + "---------------------"); + }catch(Exception e){ + sender.sendMessage(ChatColor.RED + "Argument not an integer!"); + } + }else{ + sender.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); + if(!plugin.Playing.get(1).isEmpty() && plugin.Playing.containsKey(1)){ + for(String playernames: plugin.Playing.get(1)){ + Player players = plugin.getServer().getPlayerExact(playernames); + sender.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20"); + } + }else{ + sender.sendMessage(ChatColor.GRAY + "No one is playing!"); + } + sender.sendMessage(ChatColor.AQUA + "---------------------"); + } + }else if(args[0].equalsIgnoreCase("rList")){ + if(args.length>= 2){ + try{ + a = Integer.parseInt(args[1]); + sender.sendMessage(ChatColor.AQUA + "----- Arena " + a + " -----"); + if(!plugin.Ready.get(a).isEmpty() && plugin.Ready.containsKey(a)){ + for(String playernames: plugin.Ready.get(a)){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + }else{ + sender.sendMessage(ChatColor.GRAY + "No one is ready!"); + } + sender.sendMessage(ChatColor.AQUA + "---------------------"); + }catch(Exception e){ + sender.sendMessage(ChatColor.RED + "Argument not an integer!"); + } + }else{ + sender.sendMessage(ChatColor.AQUA + "----- Arena 1 -----"); + if(!plugin.Ready.get(1).isEmpty() && plugin.Ready.containsKey(1)){ + for(String playernames: plugin.Ready.get(1)){ + sender.sendMessage(ChatColor.GREEN + playernames); + } + }else{ + sender.sendMessage(ChatColor.GRAY + "No one is ready!"); + } + sender.sendMessage(ChatColor.AQUA + "---------------------"); + } + }else if(args[0].equalsIgnoreCase("SetSpawn") || args[0].equalsIgnoreCase("Join") || args[0].equalsIgnoreCase("Confirm") || args[0].equalsIgnoreCase("Ready") || args[0].equalsIgnoreCase("Leave") || args[0].equalsIgnoreCase("Watch")){ + sender.sendMessage(ChatColor.RED + "That can only be run by a player!"); + }else if(args[0].equalsIgnoreCase("Kick")){ + if(args.length>= 2){ + Player target = Bukkit.getPlayer(args[1]); + if(plugin.getArena(target) != null){ + a = plugin.getArena(target); + plugin.Playing.get(a).remove(target.getName()); + if(plugin.config.getBoolean("broadcastAll")){ + sender.getServer().broadcastMessage(ChatColor.RED + target.getName() + " was kicked from arena " + a + "!"); + }else{ + for(String gn: plugin.Playing.get(a)){ + Player g = plugin.getServer().getPlayer(gn); + g.sendMessage(ChatColor.RED + target.getName() + " was kicked from the game!"); + } + } + clearInv(target); + target.teleport(Spawn); + plugin.Quit.get(a).add(target.getName()); + plugin.winner(a); + }else{ + sender.sendMessage(ChatColor.RED + "That player isn't in the game!"); + } + }else{ + sender.sendMessage(ChatColor.RED + "Too few arguments"); + } + }else if(args[0].equalsIgnoreCase("Refill")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + int list056; + list056 = 0; + int limit = plugin.config.getStringList("StorageXYZ").size(); + while(limit > list056){ + String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); + int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); + int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); + int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); + int chesta = plugin.getConfig().getInt("Storage." + xyz2 + ".Arena"); + String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); + Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); + plugin.exists = false; + if(chesta== a){ + if(blockatlocation.getState() instanceof Chest){ + plugin.exists = true; + Chest chest = (Chest) blockatlocation.getState(); + if(chesta== a){ + chest.getInventory().clear(); + ItemStack[] itemsinchest = null; + Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); + if(o instanceof ItemStack[]){ + itemsinchest = (ItemStack[]) o; + }else if(o instanceof List){ + itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); + } + list056 = list056+1; + chest.getInventory().setContents(itemsinchest); + chest.update(); + } + } + }else{ + list056 = list056+1; + } + } + if(limit== list056){ + sender.sendMessage(ChatColor.GREEN + "All for arena " + a + " refilled!"); + } + }else{ + int list056; + list056 = 0; + int limit = plugin.config.getStringList("StorageXYZ").size(); + while(limit > list056){ + String xyz2 = plugin.getConfig().getStringList("StorageXYZ").get(list056); + int chestx = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.X"); + int chesty = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Y"); + int chestz = plugin.getConfig().getInt("Storage." + xyz2 + ".Location.Z"); + String chestw = plugin.getConfig().getString("Storage." + xyz2 + ".Location.W"); + Block blockatlocation = Bukkit.getWorld(chestw).getBlockAt(chestx, chesty, chestz); + plugin.exists = false; + if(blockatlocation.getState() instanceof Chest){ + plugin.exists = true; + Chest chest = (Chest) blockatlocation.getState(); + chest.getInventory().clear(); + ItemStack[] itemsinchest = null; + Object o = plugin.getConfig().get("Storage." + xyz2 + ".ItemsInStorage"); + if(o instanceof ItemStack[]){ + itemsinchest = (ItemStack[]) o; + }else if(o instanceof List){ + itemsinchest = (ItemStack[]) ((List) o).toArray(new ItemStack[0]); + } + list056 = list056+1; + chest.getInventory().setContents(itemsinchest); + chest.update(); + } + } + if(limit== list056){ + sender.sendMessage(ChatColor.GREEN + "All chests refilled!"); + } + } + }else if(args[0].equalsIgnoreCase("Restart")){ + int b = 0; + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(!plugin.Watching.get(a).isEmpty()){ + for(b = 0; b < plugin.Watching.get(a).size(); b++){ + String s = plugin.Watching.get(a).get(b); + Player spectator = plugin.getServer().getPlayerExact(s); + spectator.setAllowFlight(false); + spectator.teleport(Spawn); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectator); + } + } + } + plugin.Dead.get(a).clear(); + plugin.Quit.get(a).clear(); + plugin.Watching.get(a).clear(); + plugin.Frozen.get(a).clear(); + plugin.Ready.get(a).clear(); + plugin.NeedConfirm.get(a).clear(); + plugin.Out.get(a).clear(); + plugin.Playing.get(a).clear(); + plugin.inArena.get(a).clear(); + plugin.canjoin.put(a, false); + plugin.open.put(a, true); + List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); + List blocksplaced = plugin.data.getStringList("Blocks_Placed"); + ArrayList toremove = new ArrayList(); + ArrayList toremove2 = new ArrayList(); + for(String blocks:blocksplaced){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int arena = Integer.parseInt(coords[4]); + int d = 0; + byte m = 0; + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + if(arena== a){ + block.setTypeIdAndData(d, m, true); + block.getState().update(); + toremove.add(blocks); + } + } + for(String blocks:blocksbroken){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int d = Integer.parseInt(coords[4]); + byte m = Byte.parseByte(coords[5]); + int arena = Integer.parseInt(coords[6]); + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + if(arena== a){ + block.setTypeIdAndData(d, m, true); + block.getState().update(); + toremove2.add(blocks); + } + } + for(String blocks: toremove){ + blocksplaced.remove(blocks); + } + for(String blocks: toremove2){ + blocksbroken.remove(blocks); + } + toremove.clear(); + toremove2.clear(); + plugin.data.set("Blocks_Destroyed", blocksbroken); + plugin.data.set("Blocks_Placed", blocksplaced); + plugin.data.options().copyDefaults(); + plugin.saveData(); + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill " + a); + sender.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!"); + }else{ + for(i = 1; i <= plugin.Watching.size(); i++){ + for(b = 0; b < plugin.Watching.get(b).size(); b++){ + String s = plugin.Watching.get(i).get(b); + Player spectator = plugin.getServer().getPlayerExact(s); + spectator.setAllowFlight(false); + spectator.teleport(Spawn); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectator); + } + } + } + plugin.Dead.clear(); + plugin.Quit.clear(); + plugin.Watching.clear(); + plugin.Frozen.clear(); + plugin.Ready.clear(); + plugin.NeedConfirm.clear(); + plugin.Out.clear(); + plugin.Playing.clear(); + plugin.inArena.clear(); + for(i = 1; i <= plugin.canjoin.size(); i++){ + plugin.canjoin.put(i, false); + } + for(i = 1; i <= plugin.open.size(); i++){ + plugin.open.put(i, true); + } + List blocksbroken = plugin.data.getStringList("Blocks_Destroyed"); + List blocksplaced = plugin.data.getStringList("Blocks_Placed"); + for(String blocks:blocksplaced){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int d = 0; + byte m = 0; + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + block.setTypeIdAndData(d, m, true); + block.getState().update(); + } + for(String blocks:blocksbroken){ + String[] coords = blocks.split(","); + World w = plugin.getServer().getWorld(coords[0]); + double x = Double.parseDouble(coords[1]); + double y = Double.parseDouble(coords[2]); + double z = Double.parseDouble(coords[3]); + int d = Integer.parseInt(coords[4]); + byte m = Byte.parseByte(coords[5]); + Location blockl = new Location(w, x, y, z); + Block block = w.getBlockAt(blockl); + block.setTypeIdAndData(d, m, true); + block.getState().update(); + } + blocksplaced.clear(); + blocksbroken.clear(); + plugin.data.set("Blocks_Destroyed", blocksbroken); + plugin.data.set("Blocks_Placed", blocksplaced); + plugin.data.options().copyDefaults(); + plugin.saveData(); + plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill"); + sender.sendMessage(ChatColor.AQUA + "All games have been reset!"); + } + /////////////////////////////////// Toggle ////////////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("close")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(plugin.open.get(a)){ + plugin.open.put(a, false); + if(plugin.Playing.get(a)!= null){ + for(String players: plugin.Playing.get(a)){ + Player tributes = plugin.getServer().getPlayerExact(players); + clearInv(tributes); + tributes.teleport(tributes.getWorld().getSpawnLocation()); + } + } + if(plugin.Watching.get(a)!= null){ + for(String sname: plugin.Watching.get(a)){ + Player spectators = plugin.getServer().getPlayerExact(sname); + spectators.teleport(spectators.getWorld().getSpawnLocation()); + spectators.setAllowFlight(false); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectators); + } + } + } + plugin.Dead.get(a).clear(); + plugin.Quit.get(a).clear(); + plugin.Watching.get(a).clear(); + plugin.Frozen.get(a).clear(); + plugin.Ready.get(a).clear(); + plugin.NeedConfirm.get(a).clear(); + plugin.Out.get(a).clear(); + plugin.Playing.get(a).clear(); + plugin.inArena.get(a).clear(); + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill " + a); + sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Closed!"); + }else{ + sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!"); + } + }else{ + for(i = 1; i <= plugin.open.size(); i++){ + if(plugin.open.get(i)){ + plugin.open.put(i, false); + if(plugin.Playing.get(i)!= null){ + for(String players: plugin.Playing.get(i)){ + Player tributes = plugin.getServer().getPlayerExact(players); + clearInv(tributes); + tributes.teleport(tributes.getWorld().getSpawnLocation()); + } + } + if(plugin.Watching.get(i)!= null){ + for(String sname: plugin.Watching.get(i)){ + Player spectators = plugin.getServer().getPlayerExact(sname); + spectators.teleport(spectators.getWorld().getSpawnLocation()); + spectators.setAllowFlight(false); + for(Player online:plugin.getServer().getOnlinePlayers()){ + online.showPlayer(spectators); + } + } + } + plugin.Dead.clear(); + plugin.Quit.clear(); + plugin.Watching.clear(); + plugin.Frozen.clear(); + plugin.Ready.clear(); + plugin.NeedConfirm.clear(); + plugin.Out.clear(); + plugin.Playing.clear(); + plugin.inArena.clear(); + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill"); + sender.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!"); + }else{ + sender.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!"); + } + } + } + }else if(args[0].equalsIgnoreCase("open")){ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(!plugin.open.get(a)){ + plugin.open.put(a, true); + sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); + }else{ + sender.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); + } + }else{ + for(i = 1; i <= plugin.open.size(); i++){ + if(!plugin.open.get(i)){ + plugin.open.put(i, true); + sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!"); + }else{ + sender.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!"); + } + } + } + //////////////////////////////////////////////////////////////////////////////////////////// + }else if(args[0].equalsIgnoreCase("Reload")){ + plugin.location.clear(); + plugin.Reward.clear(); + plugin.Cost.clear(); + plugin.Fee.clear(); + plugin.onEnable(); + sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!"); + }else if(args[0].equalsIgnoreCase("WarpAll")){ + if(plugin.spawns.getString("Spawns_set").equalsIgnoreCase("false")){ + sender.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); + }else{ + if(args.length>= 2){ + a = Integer.parseInt(args[1]); + if(plugin.Playing.get(a).size()== 1){ + sender.sendMessage(ChatColor.RED + "There are not enough players!"); + }else{ + if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){ + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start " + a); + } + }, 20L); + } + i = 1; + for(String playing: plugin.Playing.get(a)){ + Player tribute = plugin.getServer().getPlayerExact(playing); + tribute.teleport(plugin.location.get(a).get(i)); + tribute.setHealth(20); + tribute.setFoodLevel(20); + tribute.setSaturation(20); + tribute.setLevel(0); + clearInv(tribute); + for(PotionEffect pe: tribute.getActivePotionEffects()){ + PotionEffectType potion = pe.getType(); + tribute.removePotionEffect(potion); + } + if(tribute.getAllowFlight()){ + tribute.setAllowFlight(false); + } + plugin.Frozen.get(a).add(tribute.getName()); + i = i+1; + } + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + sender.sendMessage(ChatColor.AQUA + "All Tributes warped!"); + } + }, 20L); + } + }else{ + sender.sendMessage(ChatColor.RED + "Too few arguments, specify an arena"); + } + } + }else if(args[0].equalsIgnoreCase("Start")){ + if(args.length!= 2){ + sender.sendMessage(ChatColor.RED + "You need an arena!"); + }else{ + a = Integer.parseInt(args[1]); + if(plugin.canjoin.get(a)== true) + sender.sendMessage(ChatColor.RED + "Game already in progress!"); + else if(plugin.Playing.get(a).isEmpty()) + sender.sendMessage(ChatColor.RED + "No one is in that game!"); + else + plugin.startGames(a); + } + }else{ + sender.sendMessage(ChatColor.RED + "Unknown command, type /ha help to see all commands!"); + } + } + } + return false; + } +} diff --git a/src/me/Travja/HungerArena/JoinAndQuitListener.java b/src/me/Travja/HungerArena/JoinAndQuitListener.java new file mode 100644 index 0000000..8f611d4 --- /dev/null +++ b/src/me/Travja/HungerArena/JoinAndQuitListener.java @@ -0,0 +1,156 @@ +package me.Travja.HungerArena; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +public class JoinAndQuitListener implements Listener { + public Main plugin; + public JoinAndQuitListener(Main m) { + this.plugin = m; + } + public HaCommands commands; + public JoinAndQuitListener(HaCommands h){ + this.commands = h; + } + int i = 0; + int a = 0; + @EventHandler + public void onJoin(PlayerJoinEvent evt) { + Player p = evt.getPlayer(); + for(i = 1; i <= plugin.Watching.size(); i++){ + for (String s : plugin.Watching.get(i)) { + Player spectator = Bukkit.getServer().getPlayerExact(s); + p.hidePlayer(spectator); + } + } + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event){ + final Player p = event.getPlayer(); + final String pname = p.getName(); + for(i = 1; i <= plugin.Watching.size(); i++){ + for(String s: plugin.Watching.get(i)){ + Player spectator = plugin.getServer().getPlayerExact(s); + p.hidePlayer(spectator); + } + } + for(i = 1; i <= plugin.Out.size(); i++){ + if(plugin.Out.get(i).contains(pname)){ + plugin.Playing.get(i).add(pname); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + p.sendMessage(ChatColor.AQUA + "You have saved yourself from being ejected from the arena!"); + } + }, 40L); + plugin.Out.get(i).remove(pname); + } + } + for(i = 1; i <= plugin.Quit.size(); i++){ + if(plugin.Quit.get(i).contains(pname)){ + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + String w = Spawncoords[3]; + World spawnw = plugin.getServer().getWorld(w); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + p.teleport(Spawn); + p.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfeited!"); + } + }, 40L); + } + } + for(i = 1; i <= plugin.Dead.size(); i++){ + if(plugin.Dead.get(i).contains(pname)){ + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + String w = Spawncoords[3]; + World spawnw = plugin.getServer().getWorld(w); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + p.teleport(Spawn); + p.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfeited!"); + } + }, 40L); + } + } + for(i = 1; i <= plugin.inArena.size(); i++){ + if(plugin.inArena.get(i)!= null){ + if(plugin.inArena.get(i).contains(pname)){ + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + String w = Spawncoords[3]; + World spawnw = plugin.getServer().getWorld(w); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + p.teleport(Spawn); + p.getInventory().clear(); + p.getInventory().setBoots(null); + p.getInventory().setLeggings(null); + p.getInventory().setChestplate(null); + p.getInventory().setHelmet(null); + plugin.inArena.remove(pname); + p.sendMessage(ChatColor.RED + "You were still in the arena when you left and now the games are over."); + } + }, 40L); + } + } + } + } + @EventHandler + public void onQuit(PlayerQuitEvent evt) { + Player p = evt.getPlayer(); + String pname = p.getName(); + for(i = 1; i <= plugin.Frozen.size(); i++){ + if (plugin.Frozen.get(i).contains(pname)) { + plugin.Frozen.remove(pname); + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + String w = Spawncoords[3]; + World spawnw = plugin.getServer().getWorld(w); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + p.teleport(Spawn); + } + } + } + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event){ + final Player p = event.getPlayer(); + final String pname = p.getName(); + if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + plugin.Out.get(a).add(pname); + plugin.Playing.get(a).remove(pname); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){ + public void run(){ + if(plugin.Out.get(a).contains(pname)){ + plugin.Quit.get(a).add(pname); + plugin.Out.remove(pname); + plugin.winner(a); + plugin.inArena.get(a).add(pname); + }else if(plugin.getArena(p)== null){ + plugin.Quit.get(a).add(pname); + } + } + }, 1200L); + } + } +} diff --git a/src/me/Travja/HungerArena/Main.java b/src/me/Travja/HungerArena/Main.java new file mode 100644 index 0000000..cb144ba --- /dev/null +++ b/src/me/Travja/HungerArena/Main.java @@ -0,0 +1,511 @@ +package me.Travja.HungerArena; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.milkbowl.vault.economy.Economy; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.command.CommandExecutor; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class Main extends JavaPlugin{ + static Logger log; + public HashMap> Playing = new HashMap>(); + public HashMap> Ready = new HashMap>(); + public HashMap> Dead = new HashMap>(); + public HashMap> Quit = new HashMap>(); + public HashMap> Out = new HashMap>(); + public HashMap> Watching = new HashMap>(); + public HashMap> NeedConfirm = new HashMap>(); + public HashMap> location = new HashMap>(); + public ArrayList Tele = new ArrayList(); + public HashMap> inArena = new HashMap>(); + public HashMap> Frozen = new HashMap>(); + public HashMap> arena = new HashMap>(); + public HashMap canjoin = new HashMap(); + public HashMap maxPlayers = new HashMap(); + public HashMap open = new HashMap(); + public List worlds; + public Listener DeathListener = new DeathListener(this); + public Listener SpectatorListener = new SpectatorListener(this); + public Listener FreezeListener = new FreezeListener(this); + public Listener JoinAndQuitListener = new JoinAndQuitListener(this); + public Listener ChatListener = new ChatListener(this); + public Listener Chests = new Chests(this); + public Listener PvP = new PvP(this); + public Listener CommandBlock = new CommandBlock(this); + public Listener Damage = new DmgListener(this); + public Listener Teleport = new TeleportListener(this); + public Listener Signs = new Signs(this); + public Listener BlockStorage = new BlockStorage(this); + public Listener WinGames = new WinGamesListener(this); + public CommandExecutor HaCommands = new HaCommands(this); + public CommandExecutor SponsorCommands = new SponsorCommands(this); + public CommandExecutor SpawnsCommand = new SpawnsCommand(this); + public boolean exists; + public boolean restricted; + public FileConfiguration config; + public FileConfiguration spawns = null; + public File spawnsFile = null; + public FileConfiguration data = null; + public File dataFile = null; + public File managementFile = null; + public FileConfiguration management = null; + public ArrayList Reward = new ArrayList(); + public ArrayList Cost = new ArrayList(); + public ArrayList Fee = new ArrayList(); + public boolean vault = false; + public boolean eco = false; + public Economy econ = null; + int i = 0; + int v = 0; + int start = 0; + int deathtime = 0; + int timetodeath = 0; + int a = 0; + public void onEnable(){ + log = this.getLogger(); + config = this.getConfig(); + config.options().copyDefaults(true); + this.saveDefaultConfig(); + spawns = this.getSpawns(); + spawns.options().copyDefaults(true); + this.saveSpawns(); + data = this.getData(); + data.options().copyDefaults(true); + this.saveData(); + management = this.getManagement(); + management.options().copyDefaults(true); + this.saveManagement(); + getServer().getPluginManager().registerEvents(DeathListener, this); + getServer().getPluginManager().registerEvents(SpectatorListener, this); + getServer().getPluginManager().registerEvents(FreezeListener, this); + getServer().getPluginManager().registerEvents(JoinAndQuitListener, this); + getServer().getPluginManager().registerEvents(ChatListener, this); + getServer().getPluginManager().registerEvents(Chests, this); + getServer().getPluginManager().registerEvents(PvP, this); + getServer().getPluginManager().registerEvents(CommandBlock, this); + getServer().getPluginManager().registerEvents(Signs, this); + getServer().getPluginManager().registerEvents(BlockStorage, this); + getServer().getPluginManager().registerEvents(WinGames, this); + getServer().getPluginManager().registerEvents(Damage, this); + getCommand("Ha").setExecutor(HaCommands); + getCommand("Sponsor").setExecutor(SponsorCommands); + getCommand("Startpoint").setExecutor(SpawnsCommand); + i = 1; + //TODO THIS CRAP + if(spawns.getConfigurationSection("Spawns")!= null){ + Map temp = spawns.getConfigurationSection("Spawns").getValues(false); + for(Entry entry: temp.entrySet()){ + if(spawns.getConfigurationSection("Spawns." + entry.getKey())!= null){ + Map temp2 = spawns.getConfigurationSection("Spawns." + entry.getKey()).getValues(false); + for(Map.Entry e: temp2.entrySet()){ + if(spawns.get("Spawns." + entry.getKey() + "." + e.getKey())!= null){ + String[] coords = ((String) spawns.get("Spawns." + entry.getKey() + "." + e.getKey())).split(","); + Integer a = Integer.parseInt(entry.getKey()); + Integer s = Integer.parseInt(e.getKey()); + if(location.get(a)== null) + location.put(a, new HashMap()); + log.info("Added spawn number " + s + " in arena " + a + "!"); + location.get(a).put(s, new Location(getServer().getWorld(coords[0]), Double.parseDouble(coords[1]), Double.parseDouble(coords[2]), Double.parseDouble(coords[3]))); + } + } + } + } + } + for(i = 1; i <= location.size(); i++){ + log.info("Loaded " + location.get(i).size() + " tribute spawns for arena " + i + "!"); + Playing.put(i, new ArrayList()); + Ready.put(i, new ArrayList()); + Dead.put(i, new ArrayList()); + Quit.put(i, new ArrayList()); + Out.put(i, new ArrayList()); + Watching.put(i, new ArrayList()); + NeedConfirm.put(i, new ArrayList()); + inArena.put(i, new ArrayList()); + Frozen.put(i, new ArrayList()); + arena.put(i, new ArrayList()); + canjoin.put(i, false); + if(location.get(i).size()== config.getInt("maxPlayers")){ + maxPlayers.put(i, location.get(i).size()); + }else if(location.size()< config.getInt("maxPlayers")){ + maxPlayers.put(i, location.get(i).size()); + }else if(location.size()> config.getInt("maxPlayers")){ + maxPlayers.put(i, config.getInt("maxPlayers")); + } + log.info("Max players is for arena " + i + " is " + maxPlayers.get(i)); + open.put(i, true); + } + if (setupEconomy()) { + log.info("Found Vault! Hooking in for economy!"); + } + if (config.getDouble("config.version") != 1.3) { + config.set("config.version", 1.3); + config.set("rewardEco.enabled", false); + config.set("rewardEco.reward", 100); + } + if (config.getBoolean("rewardEco.enabled", true) || config.getBoolean("sponsorEco.enabled", true) || config.getBoolean("EntryFee.eco", true)) { + if (vault == true) { + log.info("Economy hook deployed."); + eco = true; + }else{ + log.info("You want economy support... yet you either don't have Vault or don't have an economy plugin. Sorry, can't give you it."); + } + } + if (!eco) { + if (vault == true) { + log.info("We see that you have Vault on your server. To set economy support to true, enable it in the config."); + } + } + try{ + for(String rewards: config.getStringList("Reward")){ + String[] rinfo = rewards.split(","); + Reward.add(new ItemStack(Integer.parseInt(rinfo[0]), Integer.parseInt(rinfo[1]))); + } + for(String scost: config.getStringList("Sponsor_Cost")){ + String[] sinfo = scost.split(","); + Cost.add(new ItemStack(Integer.parseInt(sinfo[0]), Integer.parseInt(sinfo[1]))); + } + if(config.getBoolean("EntryFee.enabled")){ + for(String fee: config.getStringList("EntryFee.fee")){ + String[] finfo = fee.split(","); + Fee.add(new ItemStack(Integer.parseInt(finfo[0]), Integer.parseInt(finfo[1]))); + } + } + }catch(Exception e){ + log.warning("Could not add a reward/sponsor/entry cost! One of the rewards/costs is not a number!"); + } + worlds = config.getStringList("worlds"); + if(worlds.isEmpty()){ + restricted = false; + }else if(!worlds.isEmpty()){ + restricted = true; + } + log.info("Enabled v" + getDescription().getVersion()); + } + + public void onDisable(){ + log.info("Disabled v" + getDescription().getVersion()); + } + + public boolean setupEconomy() { + if (getServer().getPluginManager().getPlugin("Vault") == null) { + return false; + } + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); + if (rsp == null) { + return false; + } + econ = rsp.getProvider(); + vault = true; + return econ != null; + } + public void reloadSpawns() { + if (spawnsFile == null) { + spawnsFile = new File(getDataFolder(), "spawns.yml"); + } + spawns = YamlConfiguration.loadConfiguration(spawnsFile); + + // Look for defaults in the jar + InputStream defConfigStream = this.getResource("spawns.yml"); + if (defConfigStream != null) { + YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); + spawns.setDefaults(defConfig); + } + } + public FileConfiguration getSpawns() { + if (spawns == null) { + this.reloadSpawns(); + } + return spawns; + } + public void saveSpawns() { + if (spawns == null || spawnsFile == null) { + return; + } + try { + getSpawns().save(spawnsFile); + } catch (IOException ex) { + this.getLogger().log(Level.SEVERE, "Could not save config to " + spawnsFile, ex); + } + } + public void reloadData() { + if (dataFile == null) { + dataFile = new File(getDataFolder(), "Data.yml"); + } + data = YamlConfiguration.loadConfiguration(dataFile); + + // Look for defaults in the jar + InputStream defConfigStream = this.getResource("Data.yml"); + if (defConfigStream != null) { + YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); + data.setDefaults(defConfig); + } + } + public FileConfiguration getData() { + if (data == null) { + this.reloadData(); + } + return data; + } + public void saveData() { + if (data == null || dataFile == null) { + return; + } + try { + getData().save(dataFile); + } catch (IOException ex) { + this.getLogger().log(Level.SEVERE, "Could not save config to " + dataFile, ex); + } + } + public void reloadManagement() { + if (managementFile == null) { + managementFile = new File(getDataFolder(), "commandAndBlockManagement.yml"); + } + management = YamlConfiguration.loadConfiguration(managementFile); + + // Look for defaults in the jar + InputStream defConfigStream = this.getResource("commandAndBlockManagement.yml"); + if (defConfigStream != null) { + YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); + management.setDefaults(defConfig); + } + } + public FileConfiguration getManagement() { + if (management == null) { + this.reloadManagement(); + } + return management; + } + public void saveManagement() { + if (management == null || managementFile == null) { + return; + } + try { + getManagement().save(managementFile); + } catch (IOException ex) { + this.getLogger().log(Level.SEVERE, "Could not save config to " + managementFile, ex); + } + } + public void winner(Integer a){ + String[] Spawncoords = spawns.getString("Spawn_coords").split(","); + World spawnw = getServer().getWorld(Spawncoords[3]); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + if(Playing.get(a).size()== 1 && canjoin.get(a)== true){ + //Announce winner + for(i = 0; i < Playing.get(a).size(); i++){ + String winnername = Playing.get(a).get(i); + Player winner = getServer().getPlayerExact(winnername); + String winnername2 = winner.getName(); + getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!"); + winner.getInventory().clear(); + winner.getInventory().setBoots(null); + winner.getInventory().setChestplate(null); + winner.getInventory().setHelmet(null); + winner.getInventory().setLeggings(null); + winner.setLevel(0); + for(PotionEffect pe: winner.getActivePotionEffects()){ + PotionEffectType potion = pe.getType(); + winner.removePotionEffect(potion); + } + Tele.add(winner); + final World w = winner.getWorld(); + winner.teleport(Spawn); + if(config.getBoolean("reloadWorld")){ + getServer().unloadWorld(w, false); + getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){ + public void run(){ + getServer().createWorld(new WorldCreator(w.getName())); + } + },200L); + } + if(!config.getBoolean("rewardEco.enabled")){ + for(ItemStack Rewards: Reward){ + winner.getInventory().addItem(Rewards); + } + }else{ + for(ItemStack Rewards: Reward){ + winner.getInventory().addItem(Rewards); + } + econ.depositPlayer(winner.getName(), config.getDouble("rewardEco.reward")); + } + Playing.get(a).clear(); + getServer().getScheduler().cancelTask(deathtime); + } + //Show spectators + for(String s1: Watching.get(a)){ + Player spectator = getServer().getPlayerExact(s1); + spectator.setAllowFlight(false); + spectator.teleport(Spawn); + for(Player online:getServer().getOnlinePlayers()){ + online.showPlayer(spectator); + } + } + if(config.getString("Auto_Restart").equalsIgnoreCase("True")){ + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){ + public void run(){ + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart"); + + } + }, 220L); + } + } + } + public void startGames(final Integer a){ + String begin = config.getString("Start_Message"); + begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2"); + final String msg = begin; + i = 10; + if(config.getString("Countdown").equalsIgnoreCase("true")){ + start = getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ + public void run(){ + if(i > 0){ + if(worlds.isEmpty()){ + if(config.getBoolean("broadcastAll")){ + getServer().broadcastMessage(String.valueOf(i)); + }else{ + for(String gn: Playing.get(a)){ + Player g = getServer().getPlayer(gn); + g.sendMessage(String.valueOf(i)); + } + } + }else{ + for(String world: worlds){ + World w = getServer().getWorld(world); + if(config.getBoolean("broadcastAll")){ + for(Player wp: w.getPlayers()){ + wp.sendMessage(String.valueOf(i)); + } + }else{ + for(String gn: Playing.get(a)){ + Player g = getServer().getPlayer(gn); + g.sendMessage(String.valueOf(i)); + } + } + } + } + } + i = i-1; + canjoin.put(a, true); + if(i== -1){ + if(Frozen.get(a)!= null) + Frozen.get(a).clear(); + if(config.getBoolean("broadcastAll")){ + getServer().broadcastMessage(msg); + }else{ + for(String gn: Playing.get(a)){ + Player g = getServer().getPlayer(gn); + g.sendMessage(msg); + } + } + getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha Refill " + a); + getServer().getScheduler().cancelTask(start); + if(config.getInt("DeathMatch")!= 0){ + int death = config.getInt("DeathMatch"); + timetodeath = death; + deathtime = getServer().getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugin("HungerArena"), new Runnable(){ + public void run(){ + timetodeath = timetodeath-1; + if(config.getBoolean("broadcastAll")){ + for(Player wp: location.get(a).get(0).getWorld().getPlayers()){ + if(timetodeath!= 0){ + wp.sendMessage(ChatColor.RED + String.valueOf(timetodeath) + " mins till the death match!"); + } + } + }else{ + for(String gn: Playing.get(a)){ + Player g = getServer().getPlayer(gn); + g.sendMessage(ChatColor.RED + String.valueOf(timetodeath) + " mins till the death match!"); + } + } + if(timetodeath== 0){ + for(String playing: Playing.get(a)){ + Player tribute = getServer().getPlayerExact(playing); + tribute.teleport(location.get(a).get(i)); + i = i+1; + for(PotionEffect pe: tribute.getActivePotionEffects()){ + PotionEffectType potion = pe.getType(); + tribute.removePotionEffect(potion); + } + if(tribute.getAllowFlight()){ + tribute.setAllowFlight(false); + } + } + if(config.getBoolean("broadcastAll")){ + for(Player wp: location.get(a).get(0).getWorld().getPlayers()){ + wp.sendMessage(ChatColor.RED + "The final battle has begun! " + Playing.size() + " tributes will be facing off!"); + } + }else{ + for(String gn: Playing.get(a)){ + Player g = getServer().getPlayer(gn); + g.sendMessage(ChatColor.RED + "The final battle has begun! " + Playing.size() + " tributes will be facing off!"); + } + } + getServer().getScheduler().cancelTask(deathtime); + } + } + }, 1200L, 1200L); + } + } + } + }, 20L, 20L); + }else{ + Frozen.get(a).clear(); + if(config.getBoolean("broadcastAll")){ + getServer().broadcastMessage(msg); + }else{ + for(String gn: Playing.get(a)){ + Player g = getServer().getPlayer(gn); + g.sendMessage(msg); + } + } + canjoin.put(a, true); + getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha Refill " + a); + } + } + public Integer getArena(Player p){ + for (int x: Playing.keySet()) { + if (Playing.get(x).contains(p.getName())){ + return x; + } + } + return null; + } + public boolean isSpectating(Player p){ + int x = 0; + if(!Watching.isEmpty()){ + for(x= 1; x <= Watching.size(); x++){ + if(Watching.get(x).contains(p.getName())){ + x = Watching.size()+1; + return true; + }else if(Watching.size()== x) + return false; + } + } + return false; + } +} diff --git a/src/me/Travja/HungerArena/PlayerWinGamesEvent.java b/src/me/Travja/HungerArena/PlayerWinGamesEvent.java new file mode 100644 index 0000000..f40ba78 --- /dev/null +++ b/src/me/Travja/HungerArena/PlayerWinGamesEvent.java @@ -0,0 +1,27 @@ +package me.Travja.HungerArena; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +/** + * + * @author YoshiGenius + */ +public class PlayerWinGamesEvent extends PlayerEvent { + + private static final HandlerList handlers = new HandlerList(); + + public PlayerWinGamesEvent(final Player p) { + super(p); + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + +} diff --git a/src/me/Travja/HungerArena/PvP.java b/src/me/Travja/HungerArena/PvP.java new file mode 100644 index 0000000..0fce3f8 --- /dev/null +++ b/src/me/Travja/HungerArena/PvP.java @@ -0,0 +1,66 @@ +package me.Travja.HungerArena; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; + +public class PvP implements Listener { + public Main plugin; + public PvP(Main m) { + this.plugin = m; + } + int a = 0; + @EventHandler(priority= EventPriority.MONITOR) + public void PlayerPvP(EntityDamageByEntityEvent event){ + Entity pl = event.getEntity(); + Entity dl = event.getDamager(); + if(pl instanceof Player && dl instanceof Player){ + Player p = (Player) pl; + Player d = (Player) dl; + if(plugin.getArena(p)!= null && plugin.getArena(d)!= null){ + a = plugin.getArena(p); + if(plugin.canjoin.get(a)){ + if(event.isCancelled()){ + event.setCancelled(false); + } + } + } + if(plugin.getArena(p)!= null){ + a = plugin.getArena(p); + if(!plugin.canjoin.get(a)){ + if(!event.isCancelled()){ + event.setCancelled(true); + } + } + } + if(plugin.getArena(p)== null && plugin.getArena(d)!= null){ + if(!event.isCancelled()){ + event.setCancelled(true); + } + } + }else if(pl instanceof Player && dl instanceof Projectile){ + Projectile projectile = (Projectile) dl; + Player p = (Player) pl; + if(projectile.getShooter() instanceof Player){ + if(plugin.getArena(p) != null){ + Player shooter = (Player) projectile.getShooter(); + if(plugin.getArena(shooter)!= null){ + event.setCancelled(false); + } + } + }else if(projectile.getShooter() instanceof Entity){ + Entity e = projectile.getShooter(); + if(e instanceof Skeleton){ + if(plugin.getArena(p)!= null){ + event.setCancelled(false); + } + } + } + } + } +} diff --git a/src/me/Travja/HungerArena/Signs.java b/src/me/Travja/HungerArena/Signs.java new file mode 100644 index 0000000..e1ff7d5 --- /dev/null +++ b/src/me/Travja/HungerArena/Signs.java @@ -0,0 +1,53 @@ +package me.Travja.HungerArena; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class Signs implements Listener { + public Main plugin; + public Signs(Main m) { + this.plugin = m; + } + @EventHandler + public void Sign(PlayerInteractEvent event){ + Player p = event.getPlayer(); + Block b = event.getClickedBlock(); + if (b == null) { + return; + } + if(event.getAction()== Action.RIGHT_CLICK_BLOCK){ + if(b.getType()== Material.SIGN || b.getType()==Material.SIGN_POST || b.getType()==Material.WALL_SIGN){ + org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState(); + String line1 = sign.getLine(0); + String line2 = sign.getLine(1); + String line3 = sign.getLine(2); + String line4 = sign.getLine(3); + if(line1.equalsIgnoreCase(ChatColor.BLUE + "[HungerArena]") || line1.equalsIgnoreCase(ChatColor.BLUE + "[HA]")){ + if(!line2.equals("")) + p.performCommand("ha " + line2); + else if(!line3.equals("")) + p.performCommand("ha " + line2 + " " + line3); + else + p.performCommand("ha"); + } + if(line1.equalsIgnoreCase(ChatColor.BLUE + "[Sponsor]")){ + p.performCommand("sponsor " + line2 + " " + line3 + " " + line4); + } + } + } + } + @EventHandler + public void Create(SignChangeEvent event){ + String top = event.getLine(0); + if(top.equalsIgnoreCase("[HungerArena]") || top.equalsIgnoreCase("[HA]") || top.equalsIgnoreCase("[Sponsor]")){ + event.setLine(0, ChatColor.BLUE + top); + } + } +} diff --git a/src/me/Travja/HungerArena/SpawnsCommand.java b/src/me/Travja/HungerArena/SpawnsCommand.java new file mode 100644 index 0000000..e50335d --- /dev/null +++ b/src/me/Travja/HungerArena/SpawnsCommand.java @@ -0,0 +1,81 @@ +package me.Travja.HungerArena; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class SpawnsCommand implements CommandExecutor { + public Main plugin; + int i = 0; + int a = 0; + public SpawnsCommand(Main m) { + this.plugin = m; + } + @Override + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + Player p = (Player) sender; + if(cmd.getName().equalsIgnoreCase("StartPoint")){ + if(p.hasPermission("HungerArena.StartPoint")){ + if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){ + if(args.length>= 2){ + try{ + i = Integer.valueOf(args[1]); + a = Integer.valueOf(args[0]); + }catch(Exception e){ + p.sendMessage(ChatColor.RED + "Argument not an integer!"); + } + if(i >= 1 && i <= plugin.config.getInt("maxPlayers")){ + if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){ + p.sendMessage(ChatColor.GOLD + "We ran the command, however, this isn't a world you defined in the config..."); + p.sendMessage(ChatColor.GOLD + "If this is the right world, please disregard this message."); + } + Location ploc = p.getLocation().getBlock().getLocation(); + double x = ploc.getX(); + double y = ploc.getY(); + double z = ploc.getZ(); + if(plugin.location.get(a)!= null){ + if(plugin.location.get(a).size()>= i){ + plugin.location.get(a).put(i, new Location(ploc.getWorld(), x, y, z)); + }else{ + plugin.location.get(a).put(i, new Location(ploc.getWorld(), x, y, z)); + } + }else{ + plugin.location.put(a, new HashMap()); + plugin.location.get(a).put(i, new Location(ploc.getWorld(), x, y, z)); + plugin.Playing.put(a, new ArrayList()); + plugin.Ready.put(a, new ArrayList()); + plugin.Dead.put(a, new ArrayList()); + plugin.Quit.put(a, new ArrayList()); + plugin.Out.put(a, new ArrayList()); + plugin.Watching.put(a, new ArrayList()); + plugin.NeedConfirm.put(a, new ArrayList()); + plugin.inArena.put(a, new ArrayList()); + plugin.Frozen.put(a, new ArrayList()); + plugin.arena.put(a, new ArrayList()); + plugin.canjoin.put(a, false); + plugin.open.put(a, true); + } + String coords = plugin.location.get(a).get(i).getWorld().getName() + "," + plugin.location.get(a).get(i).getX() + "," + plugin.location.get(a).get(i).getY() + "," + plugin.location.get(a).get(i).getZ(); + plugin.spawns.set("Spawns." + a + "." + i, coords); + plugin.saveSpawns(); + plugin.maxPlayers.put(a, plugin.location.get(a).size()); + p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute " + i + " in arena " + a + "!"); + }else{ + p.sendMessage(ChatColor.RED + "You can't go past " + plugin.maxPlayers + " players!"); + } + } + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + } + return false; + } + +} diff --git a/src/me/Travja/HungerArena/SpectatorListener.java b/src/me/Travja/HungerArena/SpectatorListener.java new file mode 100644 index 0000000..a9c6ec3 --- /dev/null +++ b/src/me/Travja/HungerArena/SpectatorListener.java @@ -0,0 +1,171 @@ +package me.Travja.HungerArena; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.*; + +public class SpectatorListener implements Listener { + public Main plugin; + public SpectatorListener(Main m){ + this.plugin = m; + } + int i = 0; + @EventHandler + public void SpectatorDrops(PlayerDropItemEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + @EventHandler + public void SpectatorInteractBlock(PlayerInteractEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + + @EventHandler + public void SpectatorInteractEntity(PlayerInteractEntityEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + @EventHandler + public void SpectatorItems(PlayerPickupItemEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + @EventHandler + public void SpectatorPvP(EntityDamageByEntityEvent event){ + Entity offense = event.getDamager(); + if(offense instanceof Player){ + Player Attacker = (Player) event.getDamager(); + String attackerName = Attacker.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(attackerName)){ + event.setCancelled(true); + Attacker.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + }else if(event.getDamager() instanceof Projectile){ + Projectile arrow = (Projectile) offense; + if(arrow.getShooter() instanceof Player){ + Player BowMan = (Player) arrow.getShooter(); + String bowManName = BowMan.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(bowManName)){ + event.setCancelled(true); + BowMan.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + } + } + @EventHandler + public void SpectatorBlockBreak(BlockBreakEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + @EventHandler + public void SpectatorBlockPlace(BlockPlaceEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!"); + } + } + } + } + @EventHandler + public void SpectatorQuit(PlayerQuitEvent event){ + Player p = event.getPlayer(); + String pname = p.getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(pname)){ + plugin.Watching.get(i).remove(pname); + String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(","); + String w = Spawncoords[3]; + World spawnw = plugin.getServer().getWorld(w); + double spawnx = Double.parseDouble(Spawncoords[0]); + double spawny = Double.parseDouble(Spawncoords[1]); + double spawnz = Double.parseDouble(Spawncoords[2]); + final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + p.teleport(Spawn); + } + } + } + } + + @EventHandler + public void MobNerf(EntityTargetEvent event){ + Entity target = event.getTarget(); + Entity e = event.getEntity(); + if (e instanceof Player) { + return; + } + if(target instanceof Player){ + String targetName = ((Player) target).getName(); + for(i = 0; i < plugin.Watching.size(); i++){ + if(plugin.Watching.get(i)!= null){ + if(plugin.Watching.get(i).contains(targetName)){ + event.setTarget(null); + } + } + } + } + } +} diff --git a/src/me/Travja/HungerArena/SponsorCommands.java b/src/me/Travja/HungerArena/SponsorCommands.java new file mode 100644 index 0000000..b7cfdbd --- /dev/null +++ b/src/me/Travja/HungerArena/SponsorCommands.java @@ -0,0 +1,163 @@ +package me.Travja.HungerArena; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class SponsorCommands implements CommandExecutor { + public Main plugin; + public SponsorCommands(Main m) { + this.plugin = m; + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + if(cmd.getName().equalsIgnoreCase("Sponsor")){ + if(sender instanceof Player){ + int i = 0; + Player p = (Player) sender; + String pname = p.getName(); + if(p.hasPermission("HungerArena.Sponsor")){ + if(plugin.getArena(p)== null){ + if(args.length== 0){ + p.sendMessage(ChatColor.RED + "You didn't specify a tribute!"); + return false; + } + if(args.length== 1){ + p.sendMessage(ChatColor.RED + "You didn't specify an item!"); + } + if(args.length== 2){ + p.sendMessage(ChatColor.RED + "You didn't specify an amount!"); + } + if(args.length== 3){ + Player target = Bukkit.getServer().getPlayer(args[0]); + if(plugin.getArena(target)== null){ + p.sendMessage(ChatColor.RED + "That person isn't playing!"); + }else{ + try{ + int ID = Integer.parseInt(args[1]); + int Amount = Integer.parseInt(args[2]); + if((!plugin.management.getStringList("sponsors.blacklist").isEmpty() && !plugin.management.getStringList("sponsors.blacklist").contains(ID)) || plugin.management.getStringList("sponsors.blacklist").isEmpty()){ + ItemStack sponsoritem = new ItemStack(ID, Amount); + if(!plugin.config.getBoolean("sponsorEco.enabled")){ + for(ItemStack Costs: plugin.Cost){ + if(p.getInventory().contains(Costs)){ + i = i+1; + if(plugin.Cost.size() == i){ + if(args[0].equalsIgnoreCase(pname)){ + p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); + }else{ + target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); + target.getInventory().addItem(sponsoritem); + p.sendMessage("You have sponsored " + target.getName() + "!"); + for(ItemStack aCosts: plugin.Cost){ + p.getInventory().removeItem(aCosts); + } + } + } + } + } + if(plugin.Cost.size() > i){ + p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!"); + } + }else{ + if(args[0].equalsIgnoreCase(pname)){ + p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); + }else if(!(plugin.econ.getBalance(pname) < plugin.config.getDouble("sponsorEco.cost"))){ + if(!plugin.Cost.isEmpty()){ + for(ItemStack Costs: plugin.Cost){ + if(p.getInventory().contains(Costs)){ + i = i+1; + if(plugin.Cost.size()== i){ + if(args[0].equalsIgnoreCase(pname)){ + p.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); + }else{ + target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); + target.getInventory().addItem(sponsoritem); + p.sendMessage("You have sponsored " + target.getName() + "!"); + plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("sponsorEco.cost")); + for(ItemStack aCosts: plugin.Cost){ + p.getInventory().removeItem(aCosts); + } + } + } + } + } + if(plugin.Cost.size() > i){ + p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!"); + } + }else{ + target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); + target.getInventory().addItem(sponsoritem); + p.sendMessage("You have sponsored " + target.getName() + "!"); + plugin.econ.withdrawPlayer(pname, plugin.config.getDouble("sponsorEco.cost")); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have enough money to do that!"); + } + } + }else{ + p.sendMessage(ChatColor.RED + "You can't sponsor that item!"); + p.sendMessage(ChatColor.GREEN + "Other items you can't sponsor are:"); + for(String blacklist: plugin.management.getStringList("sponsors.blacklist")){ + p.sendMessage(ChatColor.AQUA + blacklist); + } + } + }catch(Exception e){ + p.sendMessage(ChatColor.RED + "Something went wrong there... Make sure that you do like this /sponsor [name] [number] [number]"); + } + } + } + }else{ + p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!"); + } + }else{ + p.sendMessage(ChatColor.RED + "You don't have permission!"); + } + }else if(sender instanceof ConsoleCommandSender){ + if(args.length== 0){ + sender.sendMessage(ChatColor.RED + "You didn't specify a tribute!"); + return false; + } + if(args.length== 1){ + sender.sendMessage(ChatColor.RED + "You didn't specify an item!"); + } + if(args.length== 2){ + sender.sendMessage(ChatColor.RED + "You didn't specify an amount!"); + } + if(args.length== 3){ + Player target = Bukkit.getPlayer(args[0]); + int ID = Integer.parseInt(args[1]); + int Amount = Integer.parseInt(args[2]); + try{ + if((!plugin.management.getStringList("sponsors.blacklist").isEmpty() && !plugin.management.getStringList("sponsors.blacklist").contains(ID)) || plugin.management.getStringList("sponsors.blacklist").isEmpty()){ + ItemStack sponsoritem = new ItemStack(ID, Amount); + if(plugin.getArena(target)== null){ + sender.sendMessage(ChatColor.RED + "That person isn't playing!"); + }else{ + sender.sendMessage(ChatColor.RED + "You can't sponsor yourself!"); + target.sendMessage(ChatColor.AQUA + "You have been Sponsored!"); + target.getInventory().addItem(sponsoritem); + sender.sendMessage("You have sponsored " + target.getName() + "!"); + } + }else{ + sender.sendMessage(ChatColor.RED + "You can't sponsor that item!"); + sender.sendMessage(ChatColor.GREEN + "Other items you can't sponsor are:"); + for(String blacklist: plugin.management.getStringList("sponsors.blacklist")){ + sender.sendMessage(ChatColor.AQUA + blacklist); + } + } + }catch(Exception e){ + sender.sendMessage(ChatColor.RED + "Something went wrong there... Make sure that you do like this /sponsor [name] [number] [number]"); + } + } + } + } + return false; + } +} diff --git a/src/me/Travja/HungerArena/TeleportListener.java b/src/me/Travja/HungerArena/TeleportListener.java new file mode 100644 index 0000000..819d5c2 --- /dev/null +++ b/src/me/Travja/HungerArena/TeleportListener.java @@ -0,0 +1,50 @@ +package me.Travja.HungerArena; + +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerTeleportEvent; + +public class TeleportListener implements Listener { + + public Main plugin; + public TeleportListener(Main m) { + this.plugin = m; + } + @EventHandler(priority = EventPriority.MONITOR) + public void onTP(PlayerTeleportEvent event){ + Player p = event.getPlayer(); + List worlds = plugin.config.getStringList("worlds"); + if(worlds.contains(event.getTo().getWorld().getName()) && plugin.Tele.contains(p)){ + event.setCancelled(true); + p.sendMessage(ChatColor.RED + "You are a dead tribute... How are you supposed to get back into the arena...."); + plugin.Tele.remove(p); + }else if(plugin.Tele.contains(p)){ + if(event.isCancelled()){ + event.setCancelled(false); + plugin.Tele.remove(p); + } + } + } + /*@EventHandler Unwanted right now... + public void onTP(PlayerTeleportEvent evt) { + @SuppressWarnings("unused") + Player p = evt.getPlayer(); + TeleportCause tc = evt.getCause(); + if (tc == TeleportCause.ENDER_PEARL) { + return; + } + if (tc == TeleportCause.END_PORTAL) { + return; + } + if (tc == TeleportCause.NETHER_PORTAL) { + return; + } + evt.setCancelled(true); + }*/ + +} diff --git a/src/me/Travja/HungerArena/WinGamesListener.java b/src/me/Travja/HungerArena/WinGamesListener.java new file mode 100644 index 0000000..f9b2620 --- /dev/null +++ b/src/me/Travja/HungerArena/WinGamesListener.java @@ -0,0 +1,24 @@ +package me.Travja.HungerArena; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +/** + * + * @author YoshiGenius + */ +public class WinGamesListener implements Listener { + + public Main plugin; + public WinGamesListener(Main m) { + this.plugin = m; + } + + @EventHandler + public void onWin(PlayerWinGamesEvent evt) { + Player p = evt.getPlayer(); + plugin.econ.depositPlayer(p.getName(), plugin.config.getDouble("EcoReward")); + } + +} From 2a8416d1a844b4df191641a27639ae6d600c393d Mon Sep 17 00:00:00 2001 From: travja Date: Wed, 20 Mar 2013 15:47:22 -0600 Subject: [PATCH 5/5] 3/20 - Most recent Dev --- README | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README b/README index c57eff5..1fbc15b 100644 --- a/README +++ b/README @@ -1 +1,6 @@ -Hello World! \ No newline at end of file +http://dev.bukkit.org/server-mods/hungerarena +/\ +| +| +| +Go there for more info! \ No newline at end of file