diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 0b301c04b..59daf1b80 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -69,7 +69,6 @@ public class SkinData public final static SkinData BUGS_BUNNY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzE5MDU2MTgsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84MmUyMjRkMGJkZGJmNjRiODIzMmUxNWRhNGRkN2NjN2NiYTYzM2NiODkyMTFhYjVjNDRhODU0ZjM1NDhlZWRiIn19fQ==", "QtM7YGNpqGcTnlUCTtQsQIEc8VGvL8cxWzAvN4LjYZrY4Fv15ysEVSPWPmRL/FJTRyUFCrJFO/0miVbuIEsGyUnsgHJAr9qkeyMvfD3+pZtKU1FkS58VNQkL/YaPDms7XPy1BPNo+ynQnVevdVCNDOvs2244Px3UljtuReBteKqL8QGMR1K6FFCQuKKvcvYsljdM8RV91r2yuT9UDxnzMRghWyRZuthvCeGL85g1LQxCnzJ0NUqIqCDrTWa8jeuncLnmRooKZYGsQjCAVOSFRk4KytD+fv8xgNK2igqBgVcqAINl5IjrFt7yyPQ2FVBbshETsjewusa6eZSBoy1Lc17G7bcndoOdwGMuztLjHPMzxFpIV1RkbZrngjcSTE/IQdSw79NlzMOEMKjE/34M7xcSnSZA1xwW33g+/xq+pNbqcXu85e7VXkziWDhHREp9ITT4YjrVdrss1yfYBzZgRmmLyaMpVmVsecKB9adpuZkhGzKIVrQHDGYEHoqoRnsRGJREdZQPxaSWp4+DSxpV/0oJXJWDz+XFztbcVbBcjBOD9kpFP0s+R5t1WA2B+jsf9J3LdsUUDbBiWikBwbAXKhHxTWWKv6OZLZovhgvGnW2lXQsHglEKuD7jE/mnFj4SF2qRO2N37AUjaG8AGQtTVhxW5JneIiBA0dbKIk06yoY="); public final static SkinData SLENDERMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzUyNzk4NTUsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hMWNkOTI5OTFmYTRjZGQ2MGVlZDNhZTM3ZmI5NWRmZjFkNWNkOGNiZmYwYWFjMzE4MmQ0ODU2NDU5NTIzYyJ9fX0=", "OVqWFLCekyZcdGli6kPBKNh8/VYPhKZGNqlAvSOKc3RLgh4pIkI6TDPr/Y+VQdhz1wZozARFYSeoDJJJ4nZTi7gi3rVPG2rL1ZnKo7so5hdT8caEzSTRmgwPKzo03ZhEEsW9AEJo9mpiUxGSJdBlgEb9UgodpYFW1IjRC09CcBUqzRWP8QGZTSFSN5x9emQ97DyiFmt0NFWubHCKHdb7CExhchPRtbahL3hOEzPY8/Y+Irl9OZjx7jONE7O/sYItCuZoXc3FaTgCV0riiXHCgH2eA54s5TQVWumtp3FU7VIcKR6pm/o61+GusvqhNgdFNk9XSHWMUyp+HNU0R8sConZQN/eaVx9laJmUUb4zNZ7hX/hLYV+r9LFU1NXOeIZWJPShD+bYfZgEorIpD+EAL4BHht/f5e6a1IZUDBWb001PFibby2t9WWjoDVKz4McbxZ2Xui7EHKFG1K3biPibhWx6fvnOeJ2xW6UDIZcD+TCXwlW/knkFt44Xpyv3oNHk3UNkyrQgghd6qkc3gZHxP8PQCNvKIyK1I+pHR6JMZvSStp7ZQRDpvsvIUyOJvq+7Bs7lFYs8hcJHMzEB+8PYlH2k7P7iLuA6ZYFUmvOW1LLq0+hvxK96ZdNEsJdmMkVVTZBRw7vsZ4GPbkdp2cMOFH2lHcQj80xKqVbd43IqFDA="); public final static SkinData BOB_ROSS = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTU2NjEyOTc2NTcsInByb2ZpbGVJZCI6IjdkYTJhYjNhOTNjYTQ4ZWU4MzA0OGFmYzNiODBlNjhlIiwicHJvZmlsZU5hbWUiOiJHb2xkYXBmZWwiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzVhNzZhN2NlMzZlZGRiYmZhNWMzMmJhZmVhYmUyNmQ3ZWJlNWRlOTBkNzYyYzJmNWY3OTQ1ZTQ1ODUxOTU2ZDYifX19", "b7pUQSZ1UkMZJNSqdaBPGWfm+rfvFkEh58pBvYTG2RBPwVju1kKinb1LfsyYhFKlyPvL1jfqi30udmb0302QvE0SKg7p3txxULa3Hr94+eCJWFxrOxUNorRT9E+TurJxH6jimu6KW1p6goPn77/kgNaWb9xn3+E84+vH0z9ETjgc5G0aYLT+cSzThUorhvOQ7DRLfRgSWiFxfm3Er0g+waLfDEeNNAd6OJ5k3X+kgM/+V6QTIFofnZZ6NdZZInTARAVol2H0pRfQfAuVYfJyVyvA0uF+ZX+wlMuBTG1MeyWjZgI1iUKmGaQADXsAV796kT+Z+tAXpbRYYYZnxil5jx5P4druiHvaQfV2KK3lbKm2uH9M3SZr5d57C3V24BKRRWGS4C9INzgO8ORIIomes7kp0gECS4MnSMI6hcl0JsXVlaAy88BgmT/PKxM+3q4PCQE1N9fTCuhoil7vVYIU3uBXwFUE7NTAOUdBee+3TtMstIu2WP8rtEZBVpGH9CmomaLTCzPZSdXGY31goOFXSRYMNi8j4ykuBgP0qJqimipWH0rBF1bMdHqMu359h62tTLRKipHWXPxj4N8c/n1CVPYjuXH9X3f1HAU4DnET+v93Vb/uzbx8rXFrz6jLPwAjSlJ8Th3VE+4ey/ZBHWPB+SuHetN+e0r/LYxiqwwlnwI="); - public static final SkinData HATTORI = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjEyMTczMDgsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS83MjczMTBiMzlhMTIzOWI3ZTI4Y2JjNTkzMWY1MzlkNGVlNmQxOTc3ODhjNWI1YTY3YWY1NDJlYzk0MmZkMyJ9fX0=", "aHfFqPOZmcQkUqFPjVa27h27k5gyvkZMCOyIaIdIZfqVDg/69/hakkDQazvKg/U8KTlYaDSRyOp9ZD5qOUSCPvRtRDMhuX/Tn68KD9BdW5jYKsXo0puOa7IJDKAE47z7YQ8AvfOtxuOAg6S0ihjYEQqRA56UQ+gPbkd+pxpMxvXoLyAx7IEIKWmlkibG/rmaX8J7OEgq8Wi9s6BhtPVNMaLoznzdzOiiYkcza/zEG5zMXnj/hFHHUpWrYff0Oj7/SUB+krLsiMficASzzs/9HZq81V0ketqUhJYX66HL8F5fQniP8kYu9LbNNcVJmtlER03QaEqP/H8udemlVskFkOYLkTmhxfSetL46N+ZVf0Sxp2xYcFOH3djH/Q26IIXtzEqVyUW5Gun/ZJp8B8zYMOXbXSmaALAYPoX9cs91ZilNX/W7zn7b5Kb9kUBGt58eUpKoXjgK7rSvmH0X2JOZGFVji5QKzp/eOQAqMhkBOU8sEm9AT6mfZjjlyIDOZxSX6hjEJXRVVzFFlzTiRPTcAtaHWRnlRFywsDDSgVBGvQMPNMNa6CFeo0ajnhmfHWa4Ga77kpfQ75PzOoJ/j6Z/2sSIHfQFWE6INAGAyypX/x0Fd/AH6SmYfilnX6lhtd7OsDlxS01QGoRLPBh/ol+wY6rHSM1N6Qta0ulpQZLYIms="); public static final SkinData ANATH = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0Njg4NjM4MTYsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NGI5NGQ4NzE5ZWFhYjc0YjVhMzhjN2Q5NDliM2FkMmIyYzA0ODIxZGY4OWM1ZDA0YjY5ZjNjZmExYmJhNjUifX19", "IKlnXzQ2k57XyTHge5V2ttnV1AqbRKrV0JktZS4+nLXx+ROM77/HRuf3/bYTqg48SB8npXy+c6nLYTCY1fTZOl3t2puS6BpZMBXuTV//A0OMQ1pJKzDb8vW6CwPYw2Nu6o0QX3J/FeUIaBj16GZAPxXOtSekkeOw9qsdh57GyqSmzODlEA/7CnJWqX2Ani5DACzo6j5rzfsz2qRgOzVlnbVlVzpXicRuYYLxKvT4nMS+B3HpQdsyFKAx8nTO/GmCHDzW97jck6w/VDlW9x+J39tPDEaKPLbDz1YV59yJt6hjNAcnwgbf3KvHSAbGZNLqRegq/Rk20ZI2J5GYT5ipiyf+p8rHfkRTxIsVCMyVecnSKaz59YQ7AleiWVGzYHDETU702UyigAZFHGHQ/0Kj9UyyZ4ew228FQuGo7iGY4dS/PKq40d1v3fq+czwBhcXR+Msi1Zqg/4dTh+QwwwWsIS3CKtOInpJgZ3U/tkn4STB3o+oKBbmBWvpJk8SrA6DVKKJMjHQig+67hXKSbdcRUWAoGc/iuRhRXgILkC99Ot4PHohEbwbEW8MsKxm49OFqzP4zptaUaiQpMK4YCxENhLrI7X+w51tt2XTjroIHu4oLYS4pG16ZnhUmd/RFg8Ar7mBVOv/2lUtOO5aMAv88CpyD+XXNcCQB4G5pv4c0F14="); public static final SkinData DEVON = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0Njk0NDE1MDYsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85N2FkNjY1MjFmNzNjOWFmYzE4MzliZGExYzE5ZDNkMjg3YjNmMjRmY2EwZTBlMTE1NzhiOTE0ZTNiNWIwZDIifX19", "BNIc7N3SGIXOEUKFe3hrQp4YmniPxkiL5aKAUNkTmYqbygAQlrCCrwJTuK6JrzkWmD5AzMSzMDKkmoMWOikgulhSmDyC88lQz/LQH3co7WldPHaPL6kk27ZirmIIZEm5WKcvWhQ7ChNWQd2KsZuFqxZSdLSQmsbujF9vpuVbhlU4hajsUwbdiOJRZ18fOAFoJYq/g3RlvqC9VtAA/IAAN7jIpXf9Pn5+vjLqN+AdKm27YknCpqMtBfkYaIhMrpTBe2gP+o50TmH0xm0IZPCS+ORYNGwFdCsg6DzEU7a0rtcUdcZgdInc09mS8tMY9eeMAISYYq5MpyliHQ/areGKk0RJEYg7muc9r/N6vBUpxZtZH8BioDj2dNj4JOoH/58cwU3+hv/Woykc9o5NUPyz0nndiOtTUp1SaDXleKyHryoYnIkPyaDPyuA7qTbIKZQHxyAdrRsnknb0PYku6T8RA4kWNK2jlOH+R9D4eiKFcbLRU2Zl6L57lJTZFFI6GUvzDsyD/vBb59gjvXYzRmvguX9CHUc1aLDeUKhV8NFXeaonoYM9VPIUBQRWNdMery9OlBiQvg4VXy1w2yKLvlHRhJZJpDm/IDdsfg27o8+BUOZ0xHF9iXPBDkOiLXXZ02X4IonLcopVNImCMRZJ1dKHwgu9qnFqVTEKH4mwXUz2Zq8="); @@ -84,6 +83,7 @@ public class SkinData public static final SkinData AMERICA_HAT = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg2MDI3MjMyODgsInByb2ZpbGVJZCI6IjNlMjZiMDk3MWFjZDRjNmQ5MzVjNmFkYjE1YjYyMDNhIiwicHJvZmlsZU5hbWUiOiJOYWhlbGUiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzYzMjI0MDhkYzBiZjMxNjU4N2RiNDJiN2Q5ZmViZTUwYWQ4MGY0OGU4Njc5YzI0NTFkOTk3MTdjZmVjNTdkYWQifX19","oRo6DIuhOTaXDkFsgwJ488LWqx5d1QpwtglwG1SdEvkbX1aCMGdZyDm9YIopQRjfBg0uYKQFetOZ1ZkdMmc/aKC5/dm0+Ema7g8AUzjwf4OaSLH1r4C1UJ4ruaNG5diBxNTkYnMa7yT8zvyEr22CA7lUOIgTh8ymBfSGK35RPhsn8jM0hDjdhjemBAlxKpiioByfmAQbwokNBOrXfh/PnKq+iJYg4WpMSZ1zo5Rr0CzLXwu+/T3dvrb6mg7qry7J3Lj5/qn6iIdBcjJBeyvy1sCo45jQ3Rzc6oL/84Vu5Dpn395EqUK8Sa7mdpVpATTcj56TCjkNNtDapXNqyO/IIQuzU4wnBKNQmZefaxRl6LV0DhZ8n8YQaPj6hH/mr2oDsd23+jejjqu6Y95ReTyukp06mIGqgekmrdZV2etML2oMAOTv9ieVvqtfo5gEomYs+NFAL7rMmzjAlhd17VOgqNRMpmJazAHWOYKl8KdOH99wGDe5XcyKHysh+qyHKMvhPJztIeAEaosynF/aGHghH2PM354KCuUVNmdR5G7UZUoG9ZA5ZU3EzZ854jeqxcqw3jzb6qL7A83QNuFqOsb87ugL/jO3QEDdQ9drdf3WAQauQGkU3nYBrls5wxoMrQ+Ceth+FtZw9a1v7dc+DEWOeJKCtOAIskb29pv6OcRe0Wk="); public static final SkinData REVOLUTIONARY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg3ODQ5Mzk3NjAsInByb2ZpbGVJZCI6ImIwZDRiMjhiYzFkNzQ4ODlhZjBlODY2MWNlZTk2YWFiIiwicHJvZmlsZU5hbWUiOiJZZWxlaGEiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2I4NTBkZDNkYWQ0MjkxYzFhYmU4NGU2OTM2ZmQ3MDM0ZWVlZTk1OTk2MWI3YjE5NDZhODIxYWRlMTFiODI2YjIifX19","U2xBG+ryUacvZq3WreWF2J4QnQERuvp1okqdlkAYECqvVHz0cars78usPuZYD4s3HyOM0eGASzS4zkQERF6Hk8crnG+ZtqvML5kL+TkxK8gEbn2j5qB+YDG0qTx635mYGC77sGaqE/CsZAlhRYU6lyXILW2616Af8B8orOlpyCMRytijp/OfJREK0bC4I1QnB7AJ2QmBYuZJ9l8473858fJOlCVHjbsC/WRcUvepPSYYxvl8Z5NwayyIVnnz3tGVN6hnM7tzil/gQmsmDwGhlSyify/MEGssvd0sHLTlccA7XX98tyUFHXU84L5MJuNKg/uXTYz+9cRPIgJaptJNfqCoEa/ape+YHlOlK2lm5qRvubvp931X+VwFbcrEuaIFgbqr9cof5JW6DYfpVKvcngi9+K9IzgtPG59Jro5kxb70IfQhZcDkcHGo1pz5Tj7cdJdD7crBeIBaE/EoKU6iaSOrUFoILEdpcWQfaToRnk4L/JMet7zPXBNE/D/vEgQLGLNX7byofdCXSD9njtjLWmHg4rCzwuUqaiWnTCYIkkdg/mFuRQ3oTRRTzdlLXsK90Pz0XU9N6gBhWA9pxhzDJR7YK+mdXODALuMXE6zcCsbVuWhqbnN+EByGdjT9X1QPSN+/5iV9d5JyweiJrF7arf2PmxgEIb9OSjePNKRmHoo="); public static final SkinData MELON_PERSON = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjA2OTU5MDgsInByb2ZpbGVJZCI6ImNiZDIwN2M3ZDNkZDQwYTg5NTBiZGQ4ZTU4M2IyYjY1IiwicHJvZmlsZU5hbWUiOiJBbGVzc2FuZHJvQ2Vydm8iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzNiNDQwYjc5NWY3ZGNjZGNiODY3MzBjYzMyYzE0MGQ4NzM2NmRjNDU2YWZhZjA4Y2VkNjE1OTEyOWViMCJ9fX0=","U5yXWm6A0R4gzZRFWeeI0IUwOlpjOUogDIJyPX1b9ItcT1CMkKF/oc2IKmbMJGhwktzV8U3YKh8J3IHHomJYMiZN6WH8QNyzAiw4uaaWd2JFtG5LYRLFI7DPiaXrRW0Wdz4IffFBZ5yyDOIOLcGCExLrxyeKAO7yNah6IMgEbtY8wX6uZYFWkxRx7Orbici2zsDakghXUFcnvNE+plmK3Gxjb45RtYfWeurGzcsCEEjkRK/aQ4aohvCkx5sc4Bl3ObWiDVJ9FvHzPSd09zjnIpL9jyxKQTscbeRFKasjtbJLEbq/yq5cAjI9uGYbPkBG9C1JgmWDZBz9a0bCwRokihKtYJbDAs1417qcyzoH0ylLt85fz+XM7G+MIHba8hZ3aJFZughyslsCg/+5jAm+Ci9yQJgYFf3yHFUrmVktHz+dsWdgrfDqIMXKJWXVKccvHMD0u+yKCMxW6C4RxZmOgnAqYfvPUJqTrAW4FpbFuPBTpFsGYF7QfgIekib8aXsUr0hCh1HqEYqICVXT8Jr38A4ySMZ1NKnbRzEsDwL/4gE5YDtza+qcanY2Ewl906Z+m3uMXXXKM7uYq47RyOYWYyOcyJhr9n7C1pEbyoaTt1m4+u9j9TEMX/8oN7qCSvDhkBH5M+XIt6OJhu7bJObW0HjqUo6yADUx3srK9cX9Rpw="); + public static final SkinData BEACH_BALL = new SkinData("eyJ0aW1lc3RhbXAiOjE1MTY3MjcwMjMyMzQsInByb2ZpbGVJZCI6IjI2NzhjZDkzNjMxMDQ0NGNiZTRhZDRkMmIzYTJkOWI2IiwicHJvZmlsZU5hbWUiOiJUb3BwbGVtb3AiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzk1MzU4MzQxZDUzNjg1YTRlNWIxNWM0ZDY1ZDU4NjhiZTVhM2Q1NTA2NmZhZjAyZWE5ZDkyZGRlMjEyMzQifX19", "coBrfVUi7feMFheeKA4ZTz9GkSAjlL2RjaJR21NHg5dYrtcxMezXugN6t/CJrJP6exzu3rcxZX1LojdbQqG4kFpp/tEX/Dt8hcbv83JpT/I6IYuEndKu+1yPMAx6yu6/KUGhYfy7eRwPSM20aOm34ANiQI5VYTua5nwRBMCuWQ7zIfWV0b14Nstxtzbhne1EfOCk9WzDN93PHt42X//hpSoYC4OPqXgpbswOadDOSlqj0HCDRiZ3Fg0242gdRdVZYR+Gmq9/m0G4l4sLPYBdDN3y4IEY6ZHScouB+tyLRRlIAL/nGdMJNYn0yzlCuCVIl8ZA6Vv+hDOxCeN9KHiBDz1DfQLsegasCHojNh1ypGL24oqdTB51EWaFggc5z/dzViZz4GmmRtTheRikTy0ncnXrpmDkwZBqlGx6vRdoOa24IAUtd96KRe8X/z+yTOe/M9ciS0QR/NHcoOLiIXX+Vcm2x6Jo0Oo124yLYr6t4TPwH8ZLYrX9PV4OaQUFUj4gcV0cwrwh4u4g3hN9yDHMHPMYQwO0HrZ2JMZUNXrvg176s1nTuPA1/3cXjmeXRIHDe8NxrGbuOnuLqgnpsKLVu0ZVHMjIJ1D/cqQNq3bL9jKOR9BRdTLhOXU9Yin98uxpzW8C01kB2ZLM/Tc0oKrVyVaeCpihZRDISXsWPT0ZWkY="); public static final SkinData APPLE = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjMzODU3NzAsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zNWUyZTA5NTk3MTJkY2QzMzU3Y2MzY2VhODVmOTliM2ZkODA5Nzg1NWM3NTRiOWIxNzFmOTYzNTE0MjI1ZCJ9fX0=", "tK+zKZp42fBhSLoXyFMwJ7AYubID12WUhhp9At4YA7A6SuYHj022IrkxWjsl8e7stsd+gmMsPbr25HMHH8JXRQhzH+5qRa3PBVqhYFUHWI7jrrmTk7krhwZOg+Ozw0+TU4nqyRZGeZxwKiy0DcpO7tsgcFQtbJTG27jh4ZGlkqANDHYsqi8BiOXVz51yquuf8x8Bgml+0wyuCrkgUo2a0iXB5la9zs/HnxFJbHi/IHn+a2+RqGa49JhgMCykKkohsgPEqcuCBuUbqs8pxdnUHTqCxmZ/XKjgXq3NpFkfp2RYynDTW5RfZdEbo+D+cbivZgrehBtJatJd8vZu+kmuxwxYR0mdre4MrlRcgn1CpSvPk5/EJrkst8TVv1iEtUeR2l82umw+QfemNOgrOP3K/DT+JX6faRskrLP7J6JAIWP04dEuDI83t1Y7UPX/tSsGOrA2PO/VR8670dwCMS5Wc60RLhT98PKs0ctFaPK4RQRp4XbOw7jtWiNUZ+iy7JOUFLKcoTZNOFqoXs1IVs2JZ/nHJHkzLXkvaHzeM5KlYiq8igCy3XF5CQvVrTsFYX+PELkq+2wpyVgSHITqhUZl96mDAWMFm8IepE0JEkTfp8VrTTXeym3LL5Ecu7Azeoh7SiKf5lSKyLro3hp2N+JvN8l0BPB8qpZAjs4VJd79dns="); public static final SkinData MELON = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjMzNTc0MjcsInByb2ZpbGVJZCI6ImJiMDgwOTFhOTJlZDQzYWQ5NGYxZWRmZDc0NmIwYTJjIiwicHJvZmlsZU5hbWUiOiJJcDRuZHgiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzFjNDA4MWM4ZjRmY2RjODE5Y2VjZDZmOTRmM2ViZmFiZTBkMDMxMTVkZjJjNjYyODIwYTdhZWJhODljMmUifX19", "qHvPSsGfSDapqJlLxk1BQb2cVFbjggbDbQWCaHkzpfCx7yTojSR29ywqg0F5rLabZ7Q13wG7l2CUkdCsK4urO1qx2MpSK3iVL/mG2x2O3m3Hg7FUU6fcaupP9T8V36n8HNag5uM3lbtnzoNmhwuCS6EbzRbgk5cL38jRwPod4Bxea/UKOBFmrl506Y2pjg0gi3nZVHPmnweNC3kV8FwmHHfFUt2T6QrvULKANLfxTYmIJj9jrG5CZ3oGQj6vnHo0iA5NpMpUYAqLSKrAV2GTVZ8U7SEcTkUgLkXfd7UnNKGWVoH93LUtRyti71fwtx5q591xfqdbRiMQZBz5r5U0kUg9HrCuz8nUaCX4ox9vPJp3TktlRT8cqRyadm+bqVHPccnS0Wt/7HTMC85X1VhB+5EawHdx8umkky404mEJbPcWZZlXfbsDchASMq2tgfeZZufgJX/DY/qyVz8L1Pmp9IXuqnzvV2CaUwjKtyc8gd6ZrOGOmYovhth/IgvRUaChB248Wwh2qe3sQz0PYxAuFMP0D3mf8ctLFmVyR3bPKtxJYW6vrLiZ8a6lg1houf/pQMF4q5HQSzW7Nbic7gR766TXgy5dRxavyToPRuFkCnI3EQwmleeYg88pazcGRWGOEueAM1/4dbNjNsAoif8fCSI3/1UT7lgvcCAinDJe6AE="); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index 6ddca054a..de9d0be61 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -105,7 +105,10 @@ public class UtilAlg return true; } - + public static Vector getTrajectory(float yaw, float pitch) + { + return new Location(null, 0, 0, 0, yaw, pitch).getDirection(); + } public static float GetPitch(Vector vec) { return GetPitch(vec.getX(), vec.getY(), vec.getZ()); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 2a4b0cad5..28dde50b4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -480,7 +480,10 @@ public class UtilPlayer public static List getNearby(Location loc, double maxDist, boolean onlySurvival) { - maxDist *= maxDist; + if (maxDist > 0) + { + maxDist *= maxDist; + } LinkedList nearbyMap = new LinkedList<>(); for (Player cur : loc.getWorld().getPlayers()) @@ -500,7 +503,7 @@ public class UtilPlayer for (int i = 0; i < nearbyMap.size(); i++) { - if (dist < Math.pow(loc.toVector().subtract(nearbyMap.get(i).getLocation().toVector()).length(), 2)) + if (dist < UtilMath.offsetSquared(loc, nearbyMap.get(i).getLocation())) { nearbyMap.add(i, cur); break; @@ -525,7 +528,6 @@ public class UtilPlayer { maxDist *= maxDist; } - Player best = null; double bestDist = 0; @@ -658,9 +660,9 @@ public class UtilPlayer return players; } - public static HashMap getPlayersInPyramid(Player player, double angleLimit, double distance) + public static Map getPlayersInPyramid(Player player, double angleLimit, double distance) { - HashMap players = new HashMap(); + Map players = new HashMap<>(); for (Player cur : player.getWorld().getPlayers()) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java index 2842cdd75..04945be36 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java @@ -62,7 +62,7 @@ public class LineParticle if (_direction == null) { - _direction = UtilAlg.getTrajectory(start, end).normalize(); + _direction = UtilAlg.getTrajectory(start, end); } } @@ -75,11 +75,16 @@ public class LineParticle public boolean update() { boolean done = _curRange > _maxRange; - - Location newTarget = _start.clone().add(new Vector(0, 0.2, 0)).add(_direction.clone().multiply(_curRange)); + Location newTarget = _start.clone().add(_direction.clone().multiply(_curRange)); + + if (newTarget.getY() < 0) + { + newTarget.add(0, 0.2, 0); + } + _lastLocation = newTarget; - if (!_ignoreAllBlocks && (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))))) + if (!_ignoreAllBlocks && !(UtilBlock.airFoliage(newTarget.getBlock()) && UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))) { if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType())) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseVillager.java index d9f367bdf..25a5b22aa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseVillager.java @@ -1,12 +1,33 @@ package mineplex.core.disguise.disguises; -import org.bukkit.entity.*; +import net.minecraft.server.v1_8_R3.EntityVillager; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Villager.Profession; public class DisguiseVillager extends DisguiseAgeable { + + private Profession _profession; + public DisguiseVillager(Entity entity) { super(EntityType.VILLAGER, entity); + DataWatcher.a(16, 0, EntityVillager.META_TYPE, 0); + } + + public void setProfession(Profession profession) + { + _profession = profession; + + int id = profession.getId(); + DataWatcher.watch(16, id, EntityVillager.META_TYPE, id); + } + + public Profession getProfession() + { + return _profession; } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java index 02601d751..e57905dce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java @@ -327,24 +327,33 @@ public class Explosion extends MiniPlugin if (blockSet.isEmpty()) return; + int lowestY = Integer.MAX_VALUE; + + for (Block block : blockSet) + { + int y = block.getLocation().getBlockY(); + + if (y < lowestY) + { + lowestY = y; + } + } + //Save - final HashMap> blocks = new HashMap>(); + final HashMap> blocks = new HashMap<>(); for (Block cur : blockSet) { - if (cur.getTypeId() == 0) + if (cur.getTypeId() == 0 || onlyAbove && cur.getY() < mid.getY()) continue; - if (onlyAbove && cur.getY() < mid.getY()) - continue; - - blocks.put(cur, new AbstractMap.SimpleEntry(cur.getTypeId(), cur.getData())); + blocks.put(cur, new AbstractMap.SimpleEntry<>(cur.getTypeId(), cur.getData())); if (removeBlock) { if (_regenerateGround) { - _blockRestore.add(cur, 0, (byte) 0, (long) (_regenerateTime + (cur.getLocation().getBlockY() * 3000) + (Math.random() * 1500))); + _blockRestore.add(cur, 0, (byte) 0, (long) (_regenerateTime + ((cur.getLocation().getBlockY() - lowestY) * 3000) + (Math.random() * 1500))); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 6c2f07935..657f36b71 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -118,6 +118,7 @@ import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphType; import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadget; import mineplex.core.gadget.gadgets.hat.HatItem; import mineplex.core.gadget.gadgets.hat.HatType; +import mineplex.core.gadget.gadgets.item.ItemBallCatch; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCandy; @@ -519,6 +520,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ItemCandy(this)); addGadget(new ItemOAndX(this)); addGadget(new ItemMobBomb(this)); + addGadget(new ItemBallCatch(this)); // Costume addGadget(new OutfitRaveSuitHelmet(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBallCatch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBallCatch.java new file mode 100644 index 000000000..3426ca6cf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBallCatch.java @@ -0,0 +1,221 @@ +package mineplex.core.gadget.gadgets.item; + +import java.time.Month; +import java.time.YearMonth; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerArmorStandManipulateEvent; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.gadget.util.CostConstants; +import mineplex.core.recharge.Recharge; + +public class ItemBallCatch extends ItemGadget +{ + + private static final double VELOCITY_FACTOR = 0.25; + private static final double VELOCITY_INCREASE_FACTOR = 1.05; + private static final double VELOCITY_Y = 0.2; + private static final double VELOCITY_Y_DECREASE = 0.005; + private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(20); + + private final Map _balls; + + public ItemBallCatch(GadgetManager manager) + { + super(manager, "Play Catch", new String[] + { + C.cWhite + "Play Catch", + C.cWhite + "with other players!", + C.blankLine, + C.cWhite + "Left click hit the ball.", + C.cWhite + "You cannot hit the ball twice", + C.cWhite + "in a row.", + C.cWhite + "Try and keep it in the air", + C.cWhite + "for as long as you can!" + }, CostConstants.POWERPLAY_BONUS, Material.WOOL, (byte) 14, 500, null); + + _balls = new HashMap<>(); + + Free = false; + setDisplayItem(SkinData.BEACH_BALL.getSkull()); + setPPCYearMonth(YearMonth.of(2018, Month.FEBRUARY)); + } + + @Override + public void disableCustom(Player player, boolean message) + { + super.disableCustom(player, message); + + _balls.entrySet().removeIf(entry -> + { + if (entry.getValue().Shooter.equals(player)) + { + entry.getKey().remove(); + return true; + } + + return false; + }); + } + + @Override + public boolean activatePreprocess(Player player) + { + return _balls.values().stream() + .noneMatch(data -> data.Shooter.equals(player)); + } + + @Override + public void ActivateCustom(Player player) + { + Location location = player.getLocation().add(0, 0.4, 0); + location.add(location.getDirection()); + + ArmorStand stand = location.getWorld().spawn(location, ArmorStand.class); + stand.setHelmet(getDisplayItem()); + stand.setVisible(false); + stand.setGravity(false); + stand.setCustomNameVisible(true); + + BallData data = new BallData(player); + updateHits(stand, data); + + _balls.put(stand, data); + UtilTextMiddle.display(C.cGreen + "Punch the ball", "Keep it in the air for as long as you can!", 10 ,40, 10, player); + + Manager.runSyncTimer(new BukkitRunnable() + { + @Override + public void run() + { + Vector direction = data.Direction; + + if (data.Last == null || direction == null) + { + return; + } + + Location newLocation = stand.getLocation(); + + direction.setY(direction.getY() - VELOCITY_Y_DECREASE); + stand.teleport(newLocation.add(direction)); + + if (!stand.isValid() || UtilBlock.solid(newLocation.add(0, 1.5, 0).getBlock())) + { + String message = F.main(Manager.getName(), "You managed to keep the ball in the air for " + F.count(data.Hits) + " passes, " + F.time(UtilTime.MakeStr(System.currentTimeMillis() - data.Start)) + " with " + F.count(data.Players.size()) + " playing the game!"); + data.Players.forEach(player1 -> + { + player1.playSound(player1.getLocation(), Sound.NOTE_PLING, 1, 0.3F); + player1.sendMessage(message); + }); + _balls.remove(stand); + stand.remove(); + cancel(); + Recharge.Instance.use(player, getName(), COOLDOWN, true, true); + } + } + }, 10, 1); + } + + @EventHandler + public void interactBall(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Player)) + { + return; + } + + Entity entity = event.getEntity(); + Player player = (Player) event.getDamager(); + BallData data = _balls.get(entity); + + if (data == null) + { + return; + } + + if (data.Last != null && data.Last.equals(player)) + { + player.sendMessage(F.main(Manager.getName(), "You cannot hit the ball twice in a row!")); + return; + } + + Vector newDirection = player.getLocation().getDirection(); + newDirection.setX(newDirection.getX() * data.VelocityFactor); + newDirection.setY(VELOCITY_Y); + newDirection.setZ(newDirection.getZ() * data.VelocityFactor); + + if (data.Start == 0) + { + data.Start = System.currentTimeMillis(); + } + + data.Hits++; + data.Last = player; + data.Direction = newDirection; + data.VelocityFactor *= VELOCITY_INCREASE_FACTOR; + data.Players.add(player); + player.getWorld().playSound(entity.getLocation().add(0, 1, 0), Sound.ORB_PICKUP, 1, 1.4F); + updateHits(entity, data); + } + + @EventHandler + public void armourStandInteract(PlayerArmorStandManipulateEvent event) + { + for (ArmorStand stand : _balls.keySet()) + { + if (stand.equals(event.getRightClicked())) + { + event.setCancelled(true); + return; + } + } + } + + private void updateHits(Entity stand, BallData data) + { + stand.setCustomName(C.cGreen + data.Hits + " Hit" + (data.Hits == 1 ? "" : "s")); + } + + private class BallData + { + + Player Shooter; + Player Last; + int Hits; + long Start; + double VelocityFactor; + Vector Direction; + Set Players; + + BallData(Player shooter) + { + Shooter = shooter; + VelocityFactor = VELOCITY_FACTOR; + Players = new HashSet<>(); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/SpiralEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/SpiralEffect.java index 6ec0bc505..55f8ee05e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/SpiralEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/SpiralEffect.java @@ -13,40 +13,48 @@ public abstract class SpiralEffect extends Effect private static final double DELTA_RADIUS = 0.05; private final double _maxRadius; + private final int _iterations; - private double _radius; - private double _theta; - private double _z; + private double _radius, _theta, _z; public SpiralEffect(int ticks, double maxRadius, Location location) + { + this(ticks, maxRadius, 1, location); + } + + public SpiralEffect(int ticks, double maxRadius, int iterations, Location location) { super(ticks, new EffectLocation(location)); _maxRadius = maxRadius; + _iterations = iterations; } @Override public void runEffect() { - double x = _radius * Math.cos(_theta); - double y = _radius * Math.sin(_theta); - double z = _z += DELTA_Z; - - Location location = getEffectLocation().getFixedLocation(); - - location.add(x, y, z); - - rotateDirection(location); - - location.subtract(x * 2, y * 2, 0); - - rotateDirection(location); - - _theta += DELTA_THETA; - - if (_radius < _maxRadius) + for (int i = 0; i < _iterations; i++) { - _radius += DELTA_RADIUS; + double x = _radius * Math.cos(_theta); + double y = _radius * Math.sin(_theta); + double z = _z += DELTA_Z; + + Location location = getEffectLocation().getFixedLocation(); + + location.add(x, y, z); + + rotateDirection(location); + + location.subtract(x * 2, y * 2, 0); + + rotateDirection(location); + + _theta += DELTA_THETA; + + if (_radius < _maxRadius) + { + _radius += DELTA_RADIUS; + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 44da32c23..dca70b578 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -46,6 +46,7 @@ public class PowerPlayClubRewards .put(YearMonth.of(2017, Month.NOVEMBER), new UnknownSalesPackageItem("Tic Tac Toe")) .put(YearMonth.of(2017, Month.DECEMBER), new UnknownSalesPackageItem("Sledge Mount")) .put(YearMonth.of(2018, Month.JANUARY), new UnknownSalesPackageItem("Mob Bomb")) + .put(YearMonth.of(2018, Month.FEBRUARY), new UnknownSalesPackageItem("Play Catch")) .build(); public interface PowerPlayClubItem diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index 82c07bae2..82c15f0ef 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -216,9 +216,18 @@ public class CustomDamageEvent extends Event implements Cancellable public void SetIgnoreArmor(boolean ignore) { + if (ignore) + { + _cancellers.removeIf(reason -> reason.equals("World/Monster Damage Rate")); + } + _ignoreArmor = ignore; } + /** + * A warning to those using this method, the {@link DamageManager} cancels for rate on {@link org.bukkit.event.EventPriority#LOW}, which is a problem. + * So only call this on {@link org.bukkit.event.EventPriority#LOWEST} otherwise it will not work. It's stupid but there you go. + */ public void SetIgnoreRate(boolean ignore) { _ignoreRate = ignore; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PerkDoubleJumpEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PerkDoubleJumpEvent.java new file mode 100644 index 000000000..98cb39d0c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/events/PerkDoubleJumpEvent.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PerkDoubleJumpEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private double _power; + private double _heightMax; + private boolean _control, _cancelled; + + public PerkDoubleJumpEvent(Player who, double power, double heightMax, boolean control) + { + super(who); + + _power = power; + _heightMax = heightMax; + _control = control; + } + + public void setPower(double power) + { + _power = power; + } + + public double getPower() + { + return _power; + } + + public void setHeightMax(double heightMax) + { + _heightMax = heightMax; + } + + public double getHeightMax() + { + return _heightMax; + } + + public void setControl(boolean control) + { + _control = control; + } + + public boolean isControlled() + { + return _control; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean b) + { + _cancelled = b; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 5a5b8e17e..e21cab737 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -339,7 +339,7 @@ public class GameTeam if (GetColor() == ChatColor.AQUA) return (byte) 3; if (GetColor() == ChatColor.YELLOW) return (byte) 4; if (GetColor() == ChatColor.GREEN) return (byte) 5; - //if (GetColor() == ChatColor.PINK) return (byte)6; + if (GetColor() == ChatColor.LIGHT_PURPLE) return (byte) 6; if (GetColor() == ChatColor.DARK_GRAY) return (byte) 7; if (GetColor() == ChatColor.GRAY) return (byte) 8; if (GetColor() == ChatColor.DARK_AQUA) return (byte) 9; @@ -357,7 +357,7 @@ public class GameTeam { if (GetColor() == ChatColor.WHITE) return Color.WHITE; if (GetColor() == ChatColor.GOLD) return Color.ORANGE; - if (GetColor() == ChatColor.LIGHT_PURPLE) return Color.PURPLE; + if (GetColor() == ChatColor.LIGHT_PURPLE) return Color.FUCHSIA; if (GetColor() == ChatColor.AQUA) return Color.AQUA; if (GetColor() == ChatColor.YELLOW) return Color.YELLOW; if (GetColor() == ChatColor.GREEN) return Color.GREEN; @@ -372,30 +372,11 @@ public class GameTeam else return Color.WHITE; } - public String getColorName() - { - if (GetColor() == ChatColor.WHITE) return "WHITE"; - if (GetColor() == ChatColor.GOLD) return "ORANGE"; - if (GetColor() == ChatColor.LIGHT_PURPLE) return "PURPLE"; - if (GetColor() == ChatColor.AQUA) return "AQUA"; - if (GetColor() == ChatColor.YELLOW) return "YELLOW"; - if (GetColor() == ChatColor.GREEN) return "GREEN"; - if (GetColor() == ChatColor.DARK_GRAY) return "GRAY"; - if (GetColor() == ChatColor.GRAY) return "GRAY"; - if (GetColor() == ChatColor.DARK_AQUA) return "AQUA"; - if (GetColor() == ChatColor.DARK_PURPLE) return "PURPLE"; - if (GetColor() == ChatColor.BLUE) return "BLUE"; - if (GetColor() == ChatColor.DARK_BLUE) return "BLUE"; - if (GetColor() == ChatColor.DARK_GREEN) return "GREEN"; - if (GetColor() == ChatColor.RED) return "RED"; - else return "WHITE"; - } - public DyeColor getDyeColor() { if (GetColor() == ChatColor.WHITE) return DyeColor.WHITE; if (GetColor() == ChatColor.GOLD) return DyeColor.ORANGE; - if (GetColor() == ChatColor.LIGHT_PURPLE) return DyeColor.MAGENTA; + if (GetColor() == ChatColor.LIGHT_PURPLE) return DyeColor.PINK; if (GetColor() == ChatColor.AQUA) return DyeColor.LIGHT_BLUE; if (GetColor() == ChatColor.YELLOW) return DyeColor.YELLOW; if (GetColor() == ChatColor.GREEN) return DyeColor.LIME; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index 6ee11eb55..0738be587 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -86,8 +86,6 @@ public class Gladiators extends SoloGame private ArenaType _furthestOutCurrent; - private boolean _firstRound; - private HotbarEditor _hotbarEditor; public Gladiators(ArcadeManager manager) @@ -143,9 +141,9 @@ public class Gladiators extends SoloGame _playerArenas = new HashMap<>(); _roundState = RoundState.WAITING; - _firstRound = true; - _hotbarEditor = new HotbarEditor(manager.getPlugin(), this); + _hotbarEditor = new HotbarEditor(); + _hotbarEditor.register(this); new CompassModule() .setGiveCompass(true) @@ -1120,14 +1118,6 @@ public class Gladiators extends SoloGame Scoreboard.draw(); } - - @Override - public void disable() - { - super.disable(); - _hotbarEditor.deregisterSelf(); // De-register as listener - _hotbarEditor.onDisable(); // Fully disable - } public HashMap getArenas() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java index 364028b29..57de78bd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java @@ -9,7 +9,6 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; @@ -19,55 +18,53 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; import com.google.common.collect.Lists; -import mineplex.core.MiniPlugin; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; + import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.gladiators.Gladiators; +import nautilus.game.arcade.game.modules.Module; /** * Created by William (WilliamTiger). * 18/12/15 */ -public class HotbarEditor extends MiniPlugin +public class HotbarEditor extends Module { - private Gladiators _host; - private ItemStack _item; - private Listener _pageListener; + + private final ItemStack _item; + private final Listener _pageListener; - public HotbarEditor(JavaPlugin plugin, Gladiators gladiators) + public HotbarEditor() { - super("Hotbar Editor", plugin); - - _host = gladiators; _item = new ItemBuilder(Material.NAME_TAG).setTitle(C.cGold + "Hotbar Editor") .addLore(C.cGray + "Right click to edit your Gladiators hotbar").build(); _pageListener = new HotbarPageListener(this); - getPluginManager().registerEvents(_pageListener, getPlugin()); + UtilServer.RegisterEvents(_pageListener); } @Override - public void disable() + public void cleanup() { - HandlerList.unregisterAll(_pageListener); + UtilServer.Unregister(_pageListener); } @EventHandler public void onJoin(PlayerJoinEvent event) { - if (_host.Manager.GetGame() != _host) + if (getGame().Manager.GetGame() != getGame()) return; - if (_host.GetState() == Game.GameState.Recruit || _host.GetState() == Game.GameState.Live) + if (getGame().GetState() == Game.GameState.Recruit || getGame().GetState() == Game.GameState.Live) { event.getPlayer().getInventory().setItem(0, _item); } @@ -76,16 +73,13 @@ public class HotbarEditor extends MiniPlugin @EventHandler public void onDeath(final PlayerDeathEvent event) { - Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + getGame().getArcadeManager().runSyncLater(() -> { - public void run() + if (getGame().IsLive()) { - if (_host.IsLive()) - { - event.getEntity().getInventory().setItem(0, _item); - } + event.getEntity().getInventory().setItem(0, _item); } - }); + }, 1); } @EventHandler(priority = EventPriority.HIGH) @@ -93,10 +87,10 @@ public class HotbarEditor extends MiniPlugin { if (event.getMessage().equalsIgnoreCase("/spec")) { - if (_host == null) + if (getGame() == null) return; - if (!_host.IsAlive(event.getPlayer()) + if (!getGame().IsAlive(event.getPlayer()) && !UtilInv.contains(event.getPlayer(), _item.getType(), (byte) 0, 1)) { event.getPlayer().getInventory().setItem(0, _item); @@ -107,9 +101,6 @@ public class HotbarEditor extends MiniPlugin @EventHandler public void onJoin(GameStateChangeEvent event) { - if (event.GetGame() != _host) - return; - if (event.GetState() == Game.GameState.Recruit) { for (Player player : Bukkit.getOnlinePlayers()) @@ -146,14 +137,9 @@ public class HotbarEditor extends MiniPlugin } } - public Gladiators getHost() - { - return _host; - } - public HotbarLayout getLayout(Player player) { - int data = _host.Manager.getArcadePlayer(player).get("hotbar"); + int data = getGame().Manager.getArcadePlayer(player).get("hotbar"); data = (data == -1 ? 1239 : data); List ints = new ArrayList<>(); @@ -207,7 +193,7 @@ public class HotbarEditor extends MiniPlugin save.setRod(save.getEmpty()); } - _host.Manager.getArcadePlayer(player).put("hotbar", save.toDataSaveNumber(), true); + getGame().Manager.getArcadePlayer(player).put("hotbar", save.toDataSaveNumber(), true); player.sendMessage(F.main("Game", "Saved new hotbar layout!")); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java index 7b0245de3..904e9039c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.function.Predicate; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -141,7 +142,7 @@ public class MobaTraining extends Moba _overtimeManager.disableOvertime(); _minion.disableMinions(); - Function safeFunction = player -> UtilAlg.inBoundingBox(player.getLocation(), _borderA, _borderB); + Predicate safeFunction = player -> UtilAlg.inBoundingBox(player.getLocation(), _borderA, _borderB); Function teamFunction = player -> GetTeam(ChatColor.GRAY); new TrainingGameModule() .setGiveReturnToSpawn(false) @@ -197,7 +198,7 @@ public class MobaTraining extends Moba registerDebugCommand("skip", Perm.DEBUG_SKIP_COMMAND, PermissionGroup.PLAYER, (caller, args) -> { - if (!safeFunction.apply(caller)) + if (!safeFunction.test(caller)) { caller.teleport(GetTeam(ChatColor.YELLOW).GetSpawn()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 05336ab56..a5ad50dca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -28,6 +28,7 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; @@ -35,6 +36,7 @@ import com.google.common.collect.Sets; import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.PermissionGroup; +import mineplex.core.achievement.Achievement; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -46,6 +48,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.hologram.Hologram; @@ -79,15 +82,16 @@ import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; import nautilus.game.arcade.game.games.smash.kits.KitSlime; import nautilus.game.arcade.game.games.smash.kits.KitSnowman; import nautilus.game.arcade.game.games.smash.kits.KitSpider; +import nautilus.game.arcade.game.games.smash.kits.KitVillager; import nautilus.game.arcade.game.games.smash.kits.KitWitch; import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; import nautilus.game.arcade.game.games.smash.kits.KitWolf; import nautilus.game.arcade.game.games.smash.kits.KitZombie; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; import nautilus.game.arcade.game.modules.compass.CompassModule; +import nautilus.game.arcade.game.modules.perks.PerkSpreadsheetModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.managers.PerkSpreadsheetModule; public abstract class SuperSmash extends Game { @@ -97,15 +101,28 @@ public abstract class SuperSmash extends Game DEBUG_SMASH_COMMAND, DEBUG_NEXTSMASH_COMMAND, DEBUG_COOLDOWN_COMMAND, + DEBUG_PERK_COMMANDS } private static final int MAX_LIVES = 4; private static final int POWERUP_SPAWN_Y_INCREASE = 120; private static final int HUNGER_DELAY = 250; + private static final int RESPAWN_INVUL = 1500; private static final String DATA_POINT_POWERUP = "RED"; - private Map _lives = new HashMap<>(); + public static final Achievement[] ACHIEVEMENTS = + { + Achievement.SMASH_MOBS_1V3, + Achievement.SMASH_MOBS_FREE_KITS, + Achievement.SMASH_MOBS_MLG_PRO, + Achievement.SMASH_MOBS_RECOVERY_MASTER, + Achievement.SMASH_MOBS_TRIPLE_KILL, + Achievement.SMASH_MOBS_WINS + }; + + private final Map _lives = new HashMap<>(); + private final Map _respawnTime = new HashMap<>(); private Location _powerupCurrent = null; private Location _powerupTarget = null; @@ -124,7 +141,7 @@ public abstract class SuperSmash extends Game new KitSkeleton(manager), new KitGolem(manager), new KitSpider(manager), new KitSlime(manager), new KitCreeper(manager), new KitEnderman(manager), new KitSnowman(manager), new KitWolf(manager), new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager), - new KitWitherSkeleton(manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), new KitSheep(manager), new KitGuardian(manager) + new KitWitherSkeleton(manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), new KitSheep(manager), new KitGuardian(manager), new KitVillager(manager) }, type, description); } @@ -148,7 +165,8 @@ public abstract class SuperSmash extends Game .setGiveCompassToAlive(true) .register(this); - new PerkSpreadsheetModule(this, "SMASH_KITS"); + new PerkSpreadsheetModule("SMASH_KITS") + .register(this); registerDebugCommand("cooldown", Perm.DEBUG_COOLDOWN_COMMAND, PermissionGroup.ADMIN, (caller, args) -> { @@ -174,13 +192,20 @@ public abstract class SuperSmash extends Game if (!IsAlive(caller)) { - SetPlayerState(caller, PlayerState.IN); + GetTeamList().get(0).AddPlayer(caller, true); RespawnPlayer(caller); caller.sendMessage(F.main("Revive", "You are back in the game!")); } _lives.put(caller, MAX_LIVES); }); + + PermissionGroup.ADMIN.setPermission(Perm.DEBUG_PERK_COMMANDS, true, true); + + if (UtilServer.isTestServer()) + { + PermissionGroup.QA.setPermission(Perm.DEBUG_PERK_COMMANDS, true, true); + } } @EventHandler(priority = EventPriority.HIGH) @@ -212,6 +237,7 @@ public abstract class SuperSmash extends Game public void playerQuit(PlayerQuitEvent event) { _lives.remove(event.getPlayer()); + _respawnTime.remove(event.getPlayer()); } public int getLives(Player player) @@ -303,7 +329,6 @@ public abstract class SuperSmash extends Game UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1); - player.setHealth(player.getMaxHealth()); player.playSound(player.getLocation(), ultimate.getSound(), 10, 1); Announce(C.Bold + event.getPlayer().getName() + " activated " + C.cGreenB + name + ChatColor.RESET + C.Bold + "!"); @@ -457,7 +482,7 @@ public abstract class SuperSmash extends Game private void giveSmashItem(Player player) { int amount = 1; - if(GetKit(player) instanceof KitSnowman) + if (GetKit(player) instanceof KitSnowman) { amount = 3; } @@ -488,6 +513,22 @@ public abstract class SuperSmash extends Game } } + @EventHandler + public void expireRespawnTime(PlayerInteractEvent event) + { + if (!IsLive()) + { + return; + } + + Player player = event.getPlayer(); + + if (player.getItemInHand() != null) + { + _respawnTime.remove(player); + } + } + @EventHandler(priority = EventPriority.HIGH) public void knockback(CustomDamageEvent event) { @@ -499,11 +540,29 @@ public abstract class SuperSmash extends Game if (event.GetDamageePlayer() != null) { Player player = event.GetDamageePlayer(); + Long respawnTime = _respawnTime.get(player); + + if (respawnTime != null && !UtilTime.elapsed(respawnTime, RESPAWN_INVUL)) + { + event.SetCancelled("Just Respawned"); + } event.AddKnockback("Smash Knockback", 1 + 0.1 * (player.getMaxHealth() - player.getHealth())); } } + @EventHandler(priority = EventPriority.HIGH) + public void velocity(PlayerVelocityEvent event) + { + Player player = event.getPlayer(); + Long respawnTime = _respawnTime.get(player); + + if (respawnTime != null && !UtilTime.elapsed(respawnTime, RESPAWN_INVUL)) + { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.HIGH) public void arenaBoundry(CustomDamageEvent event) { @@ -576,6 +635,14 @@ public abstract class SuperSmash extends Game } } + @Override + public void RespawnPlayer(Player player) + { + super.RespawnPlayer(player); + + _respawnTime.put(player, System.currentTimeMillis()); + } + @EventHandler(priority = EventPriority.LOWEST) public void abilityDescription(PlayerInteractEvent event) { @@ -714,16 +781,16 @@ public abstract class SuperSmash extends Game { switch (lives) { - case 3: - return C.cYellow; - case 2: - return C.cGold; - case 1: - return C.cRed; - case 0: - return C.cGray + C.Strike; - default: - return C.cGreen; + case 3: + return C.cYellow; + case 2: + return C.cGold; + case 1: + return C.cRed; + case 0: + return C.cGray + C.Strike; + default: + return C.cGreen; } } @@ -736,7 +803,7 @@ public abstract class SuperSmash extends Game { return GetState() == GameState.Recruit; } - + public void setNextPowerupTime(long time) { _nextPowerup = time; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java index 064ce150a..8b633c79d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java @@ -1,29 +1,34 @@ package nautilus.game.arcade.game.games.smash; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilTime; -import mineplex.core.hologram.Hologram; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.smash.events.SmashActivateEvent; -import nautilus.game.arcade.game.modules.TrainingGameModule; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; - import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; -import java.util.function.Function; +import java.util.function.Predicate; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.smash.events.SmashActivateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.modules.TrainingGameModule; +import nautilus.game.arcade.kit.Kit; public class SuperSmashTraining extends SuperSmash { @@ -37,9 +42,10 @@ public class SuperSmashTraining extends SuperSmash C.cYellow + "Click the " + C.cGreen + "Bed" + C.cYellow + " to return to this island" }; + private final TrainingGameModule _trainingModule; private Location _borderA; private Location _borderB; - private Function _safeFunction = player -> !UtilAlg.inBoundingBox(player.getLocation(), _borderA, _borderB); + private Predicate _safeFunction = player -> !UtilAlg.inBoundingBox(player.getLocation(), _borderA, _borderB); private Map _lastDeath; private boolean _announceEnd; @@ -58,10 +64,15 @@ public class SuperSmashTraining extends SuperSmash _lastDeath = new HashMap<>(); - new TrainingGameModule() + _trainingModule = new TrainingGameModule() .setSkillFunction(_safeFunction) .setDamageFunction(_safeFunction) - .register(this); + .setKitSelectFunction(player -> + { + Kit kit = GetKit(player); + return kit != null && kit instanceof SmashKit && !((SmashKit) kit).isSmashActive(player); + }); + _trainingModule.register(this); } @Override @@ -169,7 +180,7 @@ public class SuperSmashTraining extends SuperSmash for (Player player : GetPlayers(true)) { - if (_safeFunction.apply(player)) + if (_safeFunction.test(player)) { _lastDeath.remove(player.getUniqueId()); } @@ -179,10 +190,12 @@ public class SuperSmashTraining extends SuperSmash @EventHandler public void smashActivate(SmashActivateEvent event) { - if (!_safeFunction.apply(event.getPlayer())) + if (!_safeFunction.test(event.getPlayer())) { event.setCancelled(true); } + + _trainingModule.preventReturnToSpawn(event.getPlayer()); } @Override @@ -219,7 +232,7 @@ public class SuperSmashTraining extends SuperSmash return UtilTime.elapsed(_lastDeath.get(player.getUniqueId()), 4000); } - return super.displayKitInfo(player) || !_safeFunction.apply(player); + return super.displayKitInfo(player) || !_safeFunction.test(player); } private void spawnInfoHologram(Location location) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/items/SmashItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/items/SmashItem.java deleted file mode 100644 index 954c2e571..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/items/SmashItem.java +++ /dev/null @@ -1,5 +0,0 @@ -package nautilus.game.arcade.game.games.smash.items; - -public class SmashItem { - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index b248334df..c5c535f26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -67,10 +67,10 @@ public class KitBlaze extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET) + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index 434bef8f3..60f3f7593 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -54,8 +54,7 @@ public class KitChicken extends SmashKit C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flap", new String[]{ ChatColor.RESET + "You are able to use your double jump", - ChatColor.RESET + "up to 6 times in a row. However, with", - ChatColor.RESET + "each flap, it loses some potency.", + ChatColor.RESET + "up to 6 times in a row.", ChatColor.RESET + "", ChatColor.RESET + C.cAqua + "Flap uses Energy (Experience Bar)", }), @@ -71,7 +70,7 @@ public class KitChicken extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, null, - new ItemStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), null }; @@ -94,6 +93,10 @@ public class KitChicken extends SmashKit { player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); } + else + { + player.setExp(0.999f); + } player.getInventory().setArmorContents(PLAYER_ARMOR); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 7d9c1bf3f..f161fab23 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -74,10 +74,10 @@ public class KitCow extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.IRON_BOOTS), - new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.IRON_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index 6d56a56ad..96933ff27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -75,10 +75,10 @@ public class KitCreeper extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.LEATHER_BOOTS), - new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), - new ItemStack(Material.LEATHER_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), }; public KitCreeper(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index cb1e1d08d..1b4836e2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -1,11 +1,27 @@ package nautilus.game.arcade.game.games.smash.kits; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; @@ -19,13 +35,6 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.inventory.ItemStack; public class KitEnderman extends SmashKit { @@ -70,16 +79,19 @@ public class KitEnderman extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; + private final Map> _heldBlock; public KitEnderman(ArcadeManager manager) { super(manager, "Enderman", KitAvailability.Gem, 3000, PERKS, EntityType.ENDERMAN, IN_HAND, DisguiseEnderman.class); + + _heldBlock = new HashMap<>(4); } @Override @@ -102,19 +114,36 @@ public class KitEnderman extends SmashKit @EventHandler public void BlockGrab(PerkBlockGrabEvent event) { - setBlock(event.GetPlayer(), event.GetId(), event.GetData()); + setBlock(event.GetPlayer(), event.GetId(), event.GetData(), true); } @EventHandler public void BlockThrow(PerkBlockThrowEvent event) { - setBlock(event.GetPlayer(), 0, (byte) 0); + setBlock(event.GetPlayer(), 0, (byte) 0, true); } @EventHandler public void Death(PlayerDeathEvent event) { - setBlock(event.getEntity(), 0, (byte) 0); + setBlock(event.getEntity(), 0, (byte) 0, true); + } + + @EventHandler + public void updateHeldBlock(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || !Manager.GetGame().IsLive()) + { + return; + } + + _heldBlock.forEach((player, pair) -> setBlock(player, pair.getLeft(), pair.getRight(), false)); + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + _heldBlock.remove(event.getPlayer()); } @EventHandler @@ -129,14 +158,14 @@ public class KitEnderman extends SmashKit DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - if (player != null && disguise != null && disguise instanceof DisguiseEnderman) + if (disguise != null && disguise instanceof DisguiseEnderman) { // Endermen drop their held block when damaged. This means the client renders it this way, so we need to resend the correct data on the next tick. Manager.runSyncLater(() -> Manager.GetDisguise().updateDisguise(disguise), 1); } } - public void setBlock(Player player, int id, byte data) + public void setBlock(Player player, int id, byte data, boolean save) { DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); @@ -147,6 +176,11 @@ public class KitEnderman extends SmashKit disguiseEnderman.SetCarriedData(data); Manager.GetDisguise().updateDisguise(disguiseEnderman); + + if (save) + { + _heldBlock.put(player, Pair.create(id, data)); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java index 649a3c072..e1dc62fff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java @@ -20,7 +20,7 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkIronHook; -import nautilus.game.arcade.kit.perks.PerkSeismicSlam; +import nautilus.game.arcade.game.games.smash.perks.golem.PerkSeismicSlam; import nautilus.game.arcade.kit.perks.PerkSlow; public class KitGolem extends SmashKit @@ -70,10 +70,10 @@ public class KitGolem extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.DIAMOND_BOOTS), - new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), - new ItemStack(Material.IRON_HELMET), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), }; public KitGolem(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 6d81d90b6..a25e2ffd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -79,8 +79,8 @@ public class KitGuardian extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.DIAMOND_BOOTS), - new ItemStack(Material.DIAMOND_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS), null, null, }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index 745f725a6..f581c3f3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -67,7 +67,7 @@ public class KitMagmaCube extends SmashKit C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fuel the Fire", new String[] { - ChatColor.RESET + "Each kill increases your size, damage", + ChatColor.RESET + "Each kill increases your size, damage,", ChatColor.RESET + "armor and decreases your knockback taken.", ChatColor.RESET + "Resets on death.", }), @@ -82,10 +82,10 @@ public class KitMagmaCube extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), null, - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; public KitMagmaCube(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index fb92a55d0..c5ca6d959 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -83,9 +83,9 @@ public class KitPig extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), null, }; @@ -130,7 +130,7 @@ public class KitPig extends SmashKit continue; } - player.setExp((float) Math.min(MAX_ENERGY, player.getExp() + (isSmashActive(player) ? ENERGY_PER_TICK_SMASH : ENERGY_PER_TICK_NORMAL))); + player.setExp(Math.min(MAX_ENERGY, player.getExp() + (isSmashActive(player) ? ENERGY_PER_TICK_SMASH : ENERGY_PER_TICK_NORMAL))); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index 7d6c3403d..11c2ca151 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -13,6 +13,7 @@ import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.SuperSmash; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.sheep.SmashSheep; @@ -79,21 +80,11 @@ public class KitSheep extends SmashKit null }; - private static final Achievement[] ACHIEVEMENTS = { - Achievement.SMASH_MOBS_1V3, - Achievement.SMASH_MOBS_FREE_KITS, - Achievement.SMASH_MOBS_MLG_PRO, - Achievement.SMASH_MOBS_RECOVERY_MASTER, - Achievement.SMASH_MOBS_TRIPLE_KILL, - Achievement.SMASH_MOBS_WINS - }; - - public KitSheep(ArcadeManager manager) { super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, PERKS, EntityType.SHEEP, IN_HAND, DisguiseSheep.class); - this.setAchievementRequirements(ACHIEVEMENTS); + this.setAchievementRequirements(SuperSmash.ACHIEVEMENTS); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index e034fe899..a51ab3e33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -8,9 +8,11 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseHorse; import mineplex.core.itemstack.ItemStackFactory; @@ -79,10 +81,10 @@ public class KitSkeletalHorse extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.IRON_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; public KitSkeletalHorse(ArcadeManager manager) @@ -112,8 +114,17 @@ public class KitSkeletalHorse extends SmashKit @Override public Entity SpawnEntity(Location loc) { - Horse horse = UtilVariant.spawnHorse(loc, Variant.SKELETON_HORSE); + Horse entity = UtilVariant.spawnHorse(loc, Variant.SKELETON_HORSE); - return horse; + entity.setRemoveWhenFarAway(false); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); + entity.setCustomNameVisible(true); + entity.getEquipment().setItemInHand(_itemInHand); + + UtilEnt.vegetate(entity, true); + UtilEnt.ghost(entity, true, false); + UtilEnt.setFakeHead(entity, true); + + return entity; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 8237cf19a..507bea8e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; @@ -32,7 +33,7 @@ import nautilus.game.arcade.kit.perks.PerkRopedArrow; public class KitSkeleton extends SmashKit { - private static double ARROW_DAMAGE = 6; + private static final double ARROW_DAMAGE = 6; private static final Perk[] PERKS = { new PerkSmashStats(), @@ -81,10 +82,10 @@ public class KitSkeleton extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index a831fa700..25b2544d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -75,9 +75,9 @@ public class KitSkySquid extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), null }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index 0a5c66d2c..329e1038b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -66,10 +66,10 @@ public class KitSlime extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), null, - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; public KitSlime(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index adfb1ce7b..faf7c6fb5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -62,10 +62,10 @@ public class KitSnowman extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; public KitSnowman(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 343ad990b..aa7bdab00 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -80,10 +80,10 @@ public class KitSpider extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + null, + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), }; public KitSpider(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitVillager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitVillager.java new file mode 100644 index 000000000..64257fc27 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitVillager.java @@ -0,0 +1,306 @@ +package nautilus.game.arcade.game.games.smash.kits; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager.Profession; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseVillager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.SuperSmash; +import nautilus.game.arcade.game.games.smash.events.SmashActivateEvent; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.villager.PerkArts; +import nautilus.game.arcade.game.games.smash.perks.villager.PerkSonicBoom; +import nautilus.game.arcade.game.games.smash.perks.villager.PerkVillagerShot; +import nautilus.game.arcade.game.games.smash.perks.villager.SmashVillager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; + +public class KitVillager extends SmashKit +{ + + private static final Perk[] PERKS = { + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkSonicBoom(), + new PerkVillagerShot(), + new PerkArts(), + new SmashVillager() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WHEAT); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Sonic Hurr", + new String[]{ + C.Reset + "Screech at the top of your lungs piercing players ears", + C.Reset + "dealing damage and knockback in front of you.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_HOE, (byte) 0, 1, + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Trade Scatter", + new String[]{ + C.Reset + "After a hard days work of trading with the players,", + C.Reset + "you unload your goods upon your enemies,", + C.Reset + "propelling you back or forth depending on your trade skills", + C.Reset + "and throwing your favorite items in the opposite direction." + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Cycle Arts", + new String[]{ + C.Reset + "Use your schooling from villager academy to hone in on one of", + C.Reset + "three arts you specialized in and that give you different stats.", + C.Reset + "Press right click to switch between arts and drop to activate.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellowB + "Smash Crystal" + C.cWhiteB + " - " + C.cGreenB + "Perfection", + new String[]{ + C.Reset + "Master all of the three arts and reaching perfection!", + C.Reset + "You gain all of the positive effects from all three arts." + }), + }; + + public static final int ART_ACTIVE_SLOT = 2; + public static final int ART_VISUAL_SLOT = 7; + + private static final ItemStack[] PLAYER_ARMOR_NORMAL = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null, + }; + private static final ItemStack[] PLAYER_ARMOR_ATTACK = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), + null, + }; + + private static final ItemStack[] PLAYER_ARMOR_DEFENSE = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + null, + }; + + private static final ItemStack[] PLAYER_ARMOR_SPEED = { + null, + null, + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE), + null, + }; + + + private final Map _types = new HashMap<>(); + + public KitVillager(ArcadeManager manager) + { + super(manager, "Villager", KitAvailability.Achievement, 0, PERKS, EntityType.VILLAGER, IN_HAND, DisguiseVillager.class); + + setAchievementRequirements(SuperSmash.ACHIEVEMENTS); + } + + @Override + public void GiveItems(Player player) + { + _types.putIfAbsent(player, VillagerType.ATTACK); + VillagerType type = get(player); + + disguise(player); + + UtilInv.Clear(player); + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + { + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + } + else + { + player.getInventory().setItem(ART_ACTIVE_SLOT, getArtItem(type, false)); + player.getInventory().setItem(ART_VISUAL_SLOT, getArtVisualItem(player, type)); + } + + giveArmour(player, false); + } + + public void giveArmour(Player player, boolean active) + { + if (!active) + { + player.getInventory().setArmorContents(PLAYER_ARMOR_NORMAL); + return; + } + + VillagerType type = get(player); + player.getInventory().setArmorContents(type.getArmour()); + } + + public void updateDisguise(Player player, Profession profession) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise == null || !(disguise instanceof DisguiseVillager)) + { + return; + } + + ((DisguiseVillager) disguise).setProfession(profession); + Manager.GetDisguise().updateDisguise(disguise); + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + _types.remove(event.getPlayer()); + } + + @EventHandler + public void smashActivate(SmashActivateEvent event) + { + Player player = event.getPlayer(); + + if (HasKit(player)) + { + player.getInventory().setArmorContents(PLAYER_ARMOR_DEFENSE); + } + } + + public VillagerType get(Player player) + { + return _types.get(player); + } + + public void set(Player player, VillagerType type) + { + _types.put(player, type); + } + + public ItemStack getArtItem(Player player, boolean active) + { + return getArtItem(get(player), active); + } + + public ItemStack getArtItem(VillagerType type, boolean active) + { + return new ItemBuilder(Material.IRON_SPADE) + .setTitle(C.cYellowB + "Right-Click/Drop" + C.cWhiteB + " - " + (active ? ChatColor.GRAY : type.getChatColour()) + C.Bold + type.getName()) + .setUnbreakable(true) + .build(); + } + + public ItemStack getArtVisualItem(Player player, VillagerType type) + { + return getArtVisualItem(type, !Recharge.Instance.usable(player, type.getName())); + } + + public ItemStack getArtVisualItem(VillagerType type, boolean active) + { + if (!active) + { + return new ItemBuilder(Material.INK_SACK, type.getDyeData()) + .setTitle(type.getChatColour() + C.Bold + type.getName()) + .build(); + } + else + { + return new ItemBuilder(Material.STAINED_GLASS_PANE, DyeColor.getByDyeData(type.getDyeData()).getWoolData()) + .setTitle(C.cGrayB + type.getName()) + .build(); + } + } + + public VillagerType getActiveArt(Player player) + { + for (Perk perk : GetPerks()) + { + if (perk instanceof PerkArts) + { + return ((PerkArts) perk).getActiveArt(player); + } + } + + return null; + } + + public enum VillagerType + { + + ATTACK("Butcher", ChatColor.RED, Color.RED, 1, Profession.BUTCHER, PLAYER_ARMOR_ATTACK), + DEFENSE("Blacksmith", ChatColor.GOLD, Color.ORANGE, 14, Profession.BLACKSMITH, PLAYER_ARMOR_DEFENSE), + SPEED("Speedster", ChatColor.GREEN, Color.LIME, 10, Profession.LIBRARIAN, PLAYER_ARMOR_SPEED); + + private final String _name; + private final ChatColor _chatColour; + private final Color _colour; + private final byte _dyeData; + private final Profession _profession; + private final ItemStack[] _armour; + + VillagerType(String name, ChatColor chatColour, Color colour, int dyeData, Profession profession, ItemStack[] armour) + { + _name = name; + _chatColour = chatColour; + _colour = colour; + _dyeData = (byte) dyeData; + _profession = profession; + _armour = armour; + } + + public String getName() + { + return _name; + } + + public ChatColor getChatColour() + { + return _chatColour; + } + + public Color getColour() + { + return _colour; + } + + public byte getDyeData() + { + return _dyeData; + } + + public Profession getProfession() + { + return _profession; + } + + public ItemStack[] getArmour() + { + return _armour; + } + + public VillagerType getNext() + { + return ordinal() == values().length - 1 ? values()[0] : values()[ordinal() + 1]; + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 72a7f2c85..e15ac3eb1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -75,9 +75,9 @@ public class KitWitch extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), null }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 5c9587963..bbde6a2e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -41,8 +41,7 @@ public class KitWitherSkeleton extends SmashKit C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Guided Wither Skull", new String[]{ ChatColor.RESET + "Launch a Wither Skull forwards, hold", - ChatColor.RESET + "block to guide the missile! Release", - ChatColor.RESET + "block to detonate it midair.", + ChatColor.RESET + "block to guide the missile!" }), ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Image", @@ -70,10 +69,10 @@ public class KitWitherSkeleton extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), - new ItemStack(Material.CHAINMAIL_HELMET) + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) }; public KitWitherSkeleton(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 7e758f379..84ae754fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -67,8 +67,8 @@ public class KitWolf extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), null }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 5fd207064..d300ff308 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -77,9 +77,9 @@ public class KitZombie extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - new ItemStack(Material.CHAINMAIL_BOOTS), - new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), null, }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java index 534ab5f3b..974c1e7da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java @@ -1,16 +1,17 @@ package nautilus.game.arcade.game.games.smash.perks; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import nautilus.game.arcade.kit.Perk; public class PerkSmashStats extends Perk { @@ -62,17 +63,8 @@ public class PerkSmashStats extends Perk public void Knockback(CustomDamageEvent event) { Player damagee = event.GetDamageePlayer(); - if (damagee == null) - { - return; - } - if (!Kit.HasKit(damagee)) - { - return; - } - - if (!Manager.IsAlive(damagee)) + if (damagee == null || !Kit.HasKit(damagee) || !Manager.IsAlive(damagee)) { return; } @@ -98,14 +90,4 @@ public class PerkSmashStats extends Perk UtilPlayer.health(player, _regen); } } - - public double getArmour() - { - return _armor; - } - - public void setArmor(double armor) - { - _armor = armor; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java index cb0c4f566..64d77bfe0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -1,29 +1,36 @@ package nautilus.game.arcade.game.games.smash.perks; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.Perk; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import java.util.*; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.kit.Perk; public class SmashUltimate extends Perk { - private static final int MIN_ULTIAMTE_DISPLAY_TIME = 1000; - - private Map _lastUltimate = new HashMap<>(); + private static final int MIN_ULTIMATE_DISPLAY_TIME = 1000; - private Sound _sound; + private final Map _lastUltimate = new HashMap<>(); + + private final Sound _sound; private int _length; public SmashUltimate(String name, String[] perkDesc, Sound sound, int length) @@ -42,12 +49,13 @@ public class SmashUltimate extends Perk public void activate(Player player) { + player.setHealth(player.getMaxHealth()); _lastUltimate.put(player.getUniqueId(), System.currentTimeMillis()); - - if (_length > MIN_ULTIAMTE_DISPLAY_TIME) + + if (_length > MIN_ULTIMATE_DISPLAY_TIME) { Recharge recharge = Recharge.Instance; - + recharge.recharge(player, GetName()); recharge.use(player, GetName(), _length, false, false); recharge.setDisplayForce(player, GetName(), true); @@ -57,23 +65,26 @@ public class SmashUltimate extends Perk public void cancel(Player player) { - _lastUltimate.remove(player.getUniqueId()); + if (_lastUltimate.remove(player.getUniqueId()) == null) + { + return; + } - if (_length > MIN_ULTIAMTE_DISPLAY_TIME) + if (_length > MIN_ULTIMATE_DISPLAY_TIME) { player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + ".")); player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0); } - + player.getInventory().clear(); Kit.GiveItems(player); } - + public boolean isUsable(Player player) { return true; } - + @EventHandler public void onUpdate(UpdateEvent event) { @@ -84,7 +95,7 @@ public class SmashUltimate extends Perk List list = new ArrayList<>(); list.addAll(_lastUltimate.keySet()); - + for (UUID uuid : list) { Player player = UtilPlayer.searchExact(uuid); @@ -122,15 +133,18 @@ public class SmashUltimate extends Perk @EventHandler public void onGameStateChange(GameStateChangeEvent event) { - if (event.GetState() != GameState.End) + for (Player player : UtilServer.getPlayersCollection()) { - for (UUID uuid : _lastUltimate.keySet()) - { - cancel(UtilPlayer.searchExact(uuid)); - } + cancel(player); } } + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + _lastUltimate.remove(event.getPlayer().getUniqueId()); + } + public boolean isUsingUltimate(Player player) { return isUsingUltimate(player.getUniqueId()); @@ -141,11 +155,11 @@ public class SmashUltimate extends Perk return _lastUltimate.containsKey(uuid); } - public Map getLastUltimate() + protected Map getLastUltimate() { return _lastUltimate; } - + public Sound getSound() { return _sound; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java index 811fbae19..36842cfdd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java @@ -9,6 +9,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -28,6 +29,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.FireflyData; @@ -151,12 +153,6 @@ public class PerkFirefly extends SmashPerk boolean superActive = isSuperActive(data.Player); String skillName = superActive ? "Phoenix" : GetName(); - if (UtilPlayer.isSpectator(player)) - { - dataIterator.remove(); - continue; - } - // Warmup if (!UtilTime.elapsed(data.Time, _warmupTime) && !superActive) { @@ -249,7 +245,7 @@ public class PerkFirefly extends SmashPerk continue; } - if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player)) + if (!UtilTime.elapsed(data.Time, _warmupTime) && !isSuperActive(data.Player)) { if (isTeamDamage(data.Player, event.GetDamagerPlayer(true))) { @@ -275,4 +271,10 @@ public class PerkFirefly extends SmashPerk event.AddKnockback(GetName(), _knockbackMagnitude); } + + @EventHandler + public void playerDeath(PlayerDeathEvent event) + { + _data.removeIf(data -> data.Player.equals(event.getEntity())); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java index 2099330c5..1669e7434 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Item; @@ -30,7 +31,8 @@ public class PerkInferno extends SmashPerk { private static final float MAX_ENERGY = 0.999F; - + private static final ItemStack POWDER = new ItemStack(Material.BLAZE_POWDER); + private float _energyTick = 0.025F; private float _energyItem = 0.035F; @@ -151,23 +153,23 @@ public class PerkInferno extends SmashPerk } // Fire - Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), new ItemStack(Material.BLAZE_POWDER)); + Location location = cur.getEyeLocation(); + Item fire = cur.getWorld().dropItem(location, POWDER); Manager.GetFire().Add(fire, cur, _itemExpireTime, 0, _itemBurnTime, _itemDamage, GetName(), false); - fire.teleport(cur.getEyeLocation()); - fire.setVelocity(cur.getLocation().getDirection().add(getRandomVector()).multiply(_itemVelocityMagnitude)); + fire.setVelocity(location.getDirection().multiply(_itemVelocityMagnitude)); // Effect - cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + cur.getWorld().playSound(location, Sound.GHAST_FIREBALL, 0.1f, 1f); } } - private Vector getRandomVector() - { - double x = 0.07 - (UtilMath.r(14) / 100); - double y = 0.07 - (UtilMath.r(14) / 100); - double z = 0.07 - (UtilMath.r(14) / 100); - - return new Vector(x, y, z); - } +// private Vector getRandomVector() +// { +// double x = 0.07 - (UtilMath.r(14) / 100); +// double y = 0.07 - (UtilMath.r(14) / 100); +// double z = 0.07 - (UtilMath.r(14) / 100); +// +// return new Vector(x, y, z); +// } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java index 4d9cf7bd3..37f921371 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java @@ -19,6 +19,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Egg; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -96,7 +97,7 @@ public class PerkEggGun extends SmashPerk @EventHandler public void Update(UpdateEvent event) { - if (event.getType() != UpdateType.TICK) + if (event.getType() != UpdateType.TICK || !Manager.GetGame().IsLive()) { return; } @@ -141,7 +142,7 @@ public class PerkEggGun extends SmashPerk } } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void EggHit(CustomDamageEvent event) { if (event.GetProjectile() == null || !(event.GetProjectile() instanceof Egg)) @@ -149,6 +150,7 @@ public class PerkEggGun extends SmashPerk return; } + Player damagee = event.GetDamageePlayer(); Player damager = event.GetDamagerPlayer(true); if (damager == null || !hasPerk(damager)) @@ -157,9 +159,13 @@ public class PerkEggGun extends SmashPerk } event.AddMod("Negate", -event.GetDamage()); - event.AddMod(damager.getName(), "Egg Blaster", _damage, true); + event.AddMod(damager.getName(), "Egg Blaster", _damage, true); event.SetIgnoreRate(true); + event.SetKnockback(false); - UtilAction.zeroVelocity(event.GetDamageeEntity()); + if (damagee == null || !isTeamDamage(damagee, damager)) + { + UtilAction.zeroVelocity(event.GetDamageeEntity()); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java index 507104549..1039e99a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java @@ -69,7 +69,7 @@ public class PerkFlap extends SmashPerk // Disable Flight player.setAllowFlight(false); - double power = 0.4 + 0.6 * (_power * player.getExp()); + double power = 0.4 + _power; // Velocity if (_control) @@ -114,7 +114,7 @@ public class PerkFlap extends SmashPerk continue; } - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().subtract(0, 2, 0).getBlock())) + if (UtilEnt.onBlock(player)) { player.setExp(Math.min(MAX_ENERGY, player.getExp() + _energyPerTick)); player.setAllowFlight(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java index 6026c0f8d..7eb37c3b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java @@ -1,20 +1,19 @@ package nautilus.game.arcade.game.games.smash.perks.cow; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; - import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; + public class DataCowMilkSpiral { public long Time; @@ -52,23 +51,23 @@ public class DataCowMilkSpiral //Move Forward Spiral.add(Direction.clone().multiply(0.7)); - + //Spiral - for (int i=0 ; i<2 ; i++) + for (int i = 0; i < 2; i++) { - double lead = i * ((2d * Math.PI)/2); + double lead = i * ((2d * Math.PI) / 2); //Orbit double speed = 3d; - double oX = -Math.sin(Player.getTicksLived()/speed + lead) * 1.5; - double oZ = Math.cos(Player.getTicksLived()/speed + lead) * 1.5; - + double oX = -Math.sin(Player.getTicksLived() / speed + lead) * 1.5; + double oZ = Math.cos(Player.getTicksLived() / speed + lead) * 1.5; + Location newSpiral = Spiral.clone(); newSpiral.add(UtilAlg.getLeft(Direction).multiply(oX)); newSpiral.add(UtilAlg.getUp(Direction).multiply(oZ)); - + newSpiral.getWorld().playSound(newSpiral, Sound.SPLASH, 0.2f, 0.75f); - + if (i == 0) { if (SpiralA != null) @@ -84,8 +83,8 @@ public class DataCowMilkSpiral SpiralA = newSpiral; } } - - + + else { if (SpiralB != null) @@ -102,10 +101,8 @@ public class DataCowMilkSpiral } } } - - if (UtilBlock.solid(Spiral.getBlock())) - return true; - - return (UtilTime.elapsed(Time, 3000)); + + return UtilTime.elapsed(Time, 3000); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java index c373de9fb..c2167bc05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java @@ -21,10 +21,10 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowMilkSpiral extends SmashPerk @@ -113,17 +113,16 @@ public class PerkCowMilkSpiral extends SmashPerk for (Player player : Manager.GetGame().GetPlayers(true)) { - if (player.equals(data.Player) || !Recharge.Instance.use(player, GetName() + " Rate", 3000, false, false)) + if (player.equals(data.Player) || !Recharge.Instance.use(player, GetName() + " Rate", 500, false, false)) { continue; } - if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < _hitBoxRadius) + if (UtilMath.offset(player.getLocation().add(0, 1.5, 0), data.Spiral) < _hitBoxRadius) { Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, _damage, true, false, false, player.getName(), GetName()); - UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, - ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticleToAll(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.25f, 2f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java index b95f1d738..0efdc4b07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java @@ -32,6 +32,7 @@ public class PerkCowStampede extends SmashPerk { private long _speedTime; + private double _stopSprintDamage; private Map _sprintTime = new HashMap<>(); private Map _sprintStr = new HashMap<>(); @@ -45,6 +46,7 @@ public class PerkCowStampede extends SmashPerk public void setupValues() { _speedTime = getPerkTime("Speed Time"); + _stopSprintDamage = getPerkDouble("Stop Sprint Damage"); } @EventHandler @@ -202,7 +204,7 @@ public class PerkCowStampede extends SmashPerk UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); } - @EventHandler(priority = EventPriority.HIGH) + @EventHandler public void damageCancel(CustomDamageEvent event) { if (event.IsCancelled()) @@ -212,7 +214,7 @@ public class PerkCowStampede extends SmashPerk Player damagee = event.GetDamageePlayer(); - if (damagee == null) + if (damagee == null || event.GetDamage() < _stopSprintDamage) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java index 518cd14bb..e828394fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java @@ -1,15 +1,24 @@ package nautilus.game.arcade.game.games.smash.perks.creeper; -import mineplex.core.common.util.*; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Material; @@ -21,21 +30,13 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; public class PerkCreeperSulphurBomb extends SmashPerk { - private static ItemStack POWDER = new ItemStack(Material.SULPHUR); - private int _cooldown; private float _damage; private float _knockbackMagnitude; - private float _damagePowder; private final IThrown _sulphurThrown = new IThrown() { @@ -64,7 +65,13 @@ public class PerkCreeperSulphurBomb extends SmashPerk { Explode(data); } - + + @Override + public void ChunkUnload(ProjectileUser data) + { + data.getThrown().remove(); + } + @Override public void ChunkUnload(ProjectileUser data) { @@ -78,50 +85,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk data.getThrown().remove(); } }; - private final IThrown _powderThrown = new IThrown() - { - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - Explode(data); - - if (target == null) - { - return; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePowder, false, true, false, UtilEnt.getName(data.getThrower()), GetName()); - } - - @Override - public void Idle(ProjectileUser data) - { - Explode(data); - } - - @Override - public void Expire(ProjectileUser data) - { - Explode(data); - } - - @Override - public void ChunkUnload(ProjectileUser data) - { - data.getThrown().remove(); - } - - private void Explode(ProjectileUser data) - { - UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.LONG); - data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 2f); - data.getThrown().remove(); - _sulphur.remove(data.getThrower().getUniqueId()); - } - }; - - private Map _sulphur = new HashMap<>(); public PerkCreeperSulphurBomb() { @@ -134,7 +97,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk _cooldown = getPerkTime("Cooldown"); _damage = getPerkFloat("Damage"); _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); - _damagePowder = getPerkFloat("Damage Powder"); } @EventHandler @@ -183,10 +145,8 @@ public class PerkCreeperSulphurBomb extends SmashPerk Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); - _sulphur.put(player.getUniqueId(), ent); - UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, _sulphurThrown, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f); + Manager.GetProjectile().AddThrow(ent, player, _sulphurThrown, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 1); // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); @@ -195,29 +155,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); } - @EventHandler - public void dropPowder(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - { - return; - } - - for (Map.Entry entry : _sulphur.entrySet()) - { - Player player = UtilPlayer.searchExact(entry.getKey()); - - if (player == null) - { - continue; - } - - Item item = entry.getValue(); - Item powder = item.getWorld().dropItem(item.getLocation(), POWDER); - Manager.GetProjectile().AddThrow(powder, player, _powderThrown, -1, true, true, true, true, 1F); - } - } - @EventHandler public void Knockback(CustomDamageEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index 3fa5b8412..d32c6675b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -7,8 +7,10 @@ import java.util.Set; import java.util.UUID; import org.bukkit.Effect; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -50,7 +52,6 @@ public class PerkBlockToss extends SmashPerk implements IThrown private Map _hold = new HashMap<>(); private Set _charged = new HashSet<>(); - private Map _falling = new HashMap<>(); public PerkBlockToss() { @@ -70,7 +71,6 @@ public class PerkBlockToss extends SmashPerk implements IThrown @Override public void unregisteredEvents() { - _falling.clear(); _hold.clear(); } @@ -87,7 +87,8 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; } - if (UtilBlock.usable(event.getClickedBlock())) + Material material = event.getClickedBlock().getType(); + if (UtilBlock.usable(event.getClickedBlock()) || material == Material.REDSTONE_WIRE || material == Material.SKULL) { return; } @@ -191,8 +192,6 @@ public class PerkBlockToss extends SmashPerk implements IThrown FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); - _falling.put(block, key); - _charged.remove(key); long charge = System.currentTimeMillis() - data.Time; @@ -218,6 +217,12 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; } + if (target instanceof EnderCrystal) + { + data.getThrown().remove(); + return; + } + // Damage Event Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, Math.min(_maxDamage, data.getThrown().getVelocity().length() * _damage), true, true, false, UtilEnt.getName(data .getThrower()), GetName()); @@ -227,17 +232,8 @@ public class PerkBlockToss extends SmashPerk implements IThrown { FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte) 0); - - // Remove Old - _falling.remove(thrown); + data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte) 0); thrown.remove(); - - // Add New - if (data.getThrower() instanceof Player) - { - _falling.put(newThrown, data.getThrower().getUniqueId()); - } } } @@ -270,7 +266,6 @@ public class PerkBlockToss extends SmashPerk implements IThrown falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); - _falling.remove(falling); falling.remove(); event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index 625791668..5af9fe48a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEndermanTeleport extends SmashPerk @@ -36,7 +37,7 @@ public class PerkEndermanTeleport extends SmashPerk public PerkEndermanTeleport() { - super("Teleport", new String[] { C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" }); + super("Teleport", new String[] {C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport"}); } @Override @@ -128,12 +129,12 @@ public class PerkEndermanTeleport extends SmashPerk } } - @Override - public void unregisteredEvents() - { - _target.clear(); - _charge.clear(); - } + @Override + public void unregisteredEvents() + { + _target.clear(); + _charge.clear(); + } @EventHandler public void clean(PlayerQuitEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java index e625809ba..fb62d71ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.golem; import java.util.HashSet; import java.util.Set; +import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; @@ -80,7 +81,8 @@ public class PerkFissure extends Perk return; } - FissureData data = new FissureData(this, player, player.getLocation().getDirection(), player.getLocation().add(0, -0.4, 0)); + Location location = player.getLocation(); + FissureData data = new FissureData(this, player, location.getDirection(), location.add(location.getDirection()).add(0, -0.4, 0)); _active.add(data); // Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java index 88b960cd1..fb52d28ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java @@ -29,34 +29,45 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; public class PerkSeismicSlam extends Perk { - private static final int COOLDOWN = 7000; - private static final int TIME = 1000; - private static final int DAMAGE = 10; - private static final int RADIUS = 8; - private static final float KNOCKBACK_MAGNITUDE = 2.4F; + private long _cooldown; + private long _time; + private int _damage; + private int _radius; + private float _knockbackMagnitude; private Map _live = new HashMap<>(); public PerkSeismicSlam() { - super("Seismic Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" }); + super("Seismic Slam", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam"}); + } + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _time = getPerkTime("Time"); + _damage = getPerkInt("Damage"); + _radius = getPerkInt("Radius"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); } @EventHandler public void deactivateDeath(PlayerDeathEvent event) { Player player = event.getEntity(); - + if (!hasPerk(player)) { return; } - + if (_live.containsKey(player)) { _live.remove(player); @@ -93,7 +104,7 @@ public class PerkSeismicSlam extends Perk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) return; // Action @@ -122,17 +133,7 @@ public class PerkSeismicSlam extends Perk for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!UtilEnt.isGrounded(player)) - { - continue; - } - - if (!_live.containsKey(player)) - { - continue; - } - - if (!UtilTime.elapsed(_live.get(player), TIME)) + if (!UtilEnt.onBlock(player) || !_live.containsKey(player) || !UtilTime.elapsed(_live.get(player), _time)) { continue; } @@ -141,7 +142,7 @@ public class PerkSeismicSlam extends Perk // Action - Map targets = UtilEnt.getInRadius(player.getLocation(), RADIUS); + Map targets = UtilEnt.getInRadius(player.getLocation(), _radius); for (LivingEntity cur : targets.keySet()) { @@ -150,31 +151,35 @@ public class PerkSeismicSlam extends Perk continue; } - if (cur instanceof Player && !UtilPlayer.isSpectator(cur)) + if (UtilPlayer.isSpectator(cur)) { continue; } // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); // Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); // Inform if (cur instanceof Player) - UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + { + UtilPlayer.message(cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } } // Effect player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); - + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4).keySet()) { - if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + if (Math.random() < 0.9 || UtilBlock.airFoliage(cur) || !UtilBlock.airFoliage(cur.getRelative(BlockFace.UP))) { - cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getType()); + continue; } + + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getType()); } } } @@ -186,7 +191,7 @@ public class PerkSeismicSlam extends Perk { return; } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index 0cfd4b163..b79eb9e2b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.game.games.smash.perks.golem; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.bukkit.Effect; import org.bukkit.Material; @@ -10,6 +12,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAction; @@ -29,6 +32,8 @@ public class SmashGolem extends SmashUltimate private int _damageRadius; private int _effectRadius; + private final Set _killed = new HashSet<>(); + public SmashGolem() { super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, 0); @@ -45,9 +50,11 @@ public class SmashGolem extends SmashUltimate } @Override - public void activate(Player player) + public void cancel(Player player) { - super.activate(player); + super.cancel(player); + + _killed.clear(); } @EventHandler @@ -71,7 +78,7 @@ public class SmashGolem extends SmashUltimate for (Player other : alivePlayers) { - if (player.equals(other) || UtilPlayer.isSpectator(other) || team.contains(other)) + if (player.equals(other) || UtilPlayer.isSpectator(other) || team.contains(other) || _killed.contains(other)) { continue; } @@ -126,4 +133,17 @@ public class SmashGolem extends SmashUltimate } } } + + @EventHandler + public void playerDeath(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + if (getLastUltimate().isEmpty()) + { + return; + } + + _killed.add(player); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index 3930d138f..a1beca36a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -6,7 +6,6 @@ import java.util.Set; import org.bukkit.Effect; import org.bukkit.Material; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -32,22 +31,25 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkTargetLazer extends SmashPerk { + private static final int ACTIVE_ITEM_SLOT = 2; + private int _cooldown; private int _maxRange; private int _maxTime; private int _damageIncrease; private int _knockbackIncrease; - + private Set _data = new HashSet<>(); - + public PerkTargetLazer() { - super("Target Laser", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Laser" }); + super("Target Laser", new String[] {C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Laser"}); } @Override @@ -89,44 +91,44 @@ public class PerkTargetLazer extends SmashPerk { return; } - + if (!UtilEnt.isGrounded(player)) { player.sendMessage(F.main("Game", "You must be on the ground to use " + F.skill(GetName())) + "."); return; } - + if (!Recharge.Instance.usable(player, GetName())) { return; } - + Player best = null; double bestD = Double.MAX_VALUE; - + for (Player other : UtilServer.getPlayers()) { if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) { continue; } - + double d = UtilMath.offset(player, other); - + if (d > _maxRange) { continue; } - + if (best == null || d < bestD) { best = other; bestD = d; } } - + boolean contained = false; - + for (TargetLazerData data : _data) { if (data.getAttacker().equals(player)) @@ -135,80 +137,72 @@ public class PerkTargetLazer extends SmashPerk { return; } - + contained = true; data.setTarget(best); } } - + if (best == null) { player.sendMessage(F.main("Game", "There are no targets within range.")); return; } - + player.sendMessage(F.main("Game", "You targeted " + F.name(best.getName())) + " with " + F.skill(GetName()) + "."); best.sendMessage(F.main("Game", F.name(player.getName()) + " targeted you with their " + F.skill(GetName()) + ".")); - + if (!contained) { TargetLazerData data = new TargetLazerData(player); - + _data.add(data); data.setTarget(best); } setLazerTarget(player, best); } - + @EventHandler public void update(UpdateEvent event) { - if (event.getType() == UpdateType.TICK) - { - for (TargetLazerData data : _data) - { - data.update(Manager); - } - } - if (event.getType() != UpdateType.FASTER) { return; } - + Iterator iterator = _data.iterator(); - + while (iterator.hasNext()) { TargetLazerData data = iterator.next(); - + if (data.getTarget() == null) { continue; } - + UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, data.getTarget().getLocation().add(0, 0.5, 0.5), 1F, 0.5F, 1F, 0.1F, 10, ViewDist.LONG, data.getAttacker()); - + if (UtilMath.offset(data.getTarget(), data.getAttacker()) > _maxRange || data.getTimeElapsed() > _maxTime) { long time = data.getTimeElapsed() / 1000; double damage = 0.5 * time; - ArmorStand targetPlaceholder = data.update(Manager); - - targetPlaceholder.remove(); - setLazerTarget(data.getAttacker(), null); - - data.getAttacker().sendMessage(F.main("Game", "Your laser broke, dealing damage to " + F.name(data.getTarget().getName())) + "."); - Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); - - Recharge.Instance.use(data.getAttacker(), GetName(), _cooldown, true, true); - + Player attacker = data.getAttacker(); + + setLazerTarget(attacker, null); + + attacker.sendMessage(F.main("Game", "Your laser broke, dealing damage to " + F.name(data.getTarget().getName())) + "."); + Manager.GetDamage().NewDamageEvent(data.getTarget(), attacker, null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); + + Recharge.Instance.use(attacker, GetName(), _cooldown, true, true); + Recharge.Instance.Get(attacker).get(GetName()).Item = attacker.getInventory().getItem(ACTIVE_ITEM_SLOT); + iterator.remove(); } } } - + @EventHandler public void damage(CustomDamageEvent event) { @@ -216,54 +210,55 @@ public class PerkTargetLazer extends SmashPerk { return; } - + Player damager = event.GetDamagerPlayer(true); Player damagee = event.GetDamageePlayer(); - + for (TargetLazerData data : _data) { if (data.getTarget() == null) { continue; } - + if (data.getAttacker().equals(damager) && data.getTarget().equals(damagee)) { event.AddMod(GetName(), _damageIncrease); event.AddKnockback(GetName(), _knockbackIncrease); - data.getAttacker().playEffect(damagee.getLocation().add(0, 0.5, 0), Effect.STEP_SOUND, Material.REDSTONE_BLOCK); + damagee.playEffect(damagee.getLocation().add(0, 0.5, 0), Effect.STEP_SOUND, Material.REDSTONE_BLOCK); } } } - + @EventHandler public void death(PlayerDeathEvent event) { Player player = event.getEntity(); - _data.removeIf(data -> data.getTarget().equals(player) || data.getAttacker().equals(player)); + _data.removeIf(data -> + { + if (data.getTarget().equals(player) || data.getAttacker().equals(player)) + { + setLazerTarget(data.getAttacker(), null); + return true; + } + + return false; + }); } private void setLazerTarget(Player disguised, Player target) { DisguiseManager disguiseManager = Manager.GetDisguise(); DisguiseGuardian disguise = (DisguiseGuardian) disguiseManager.getActiveDisguise(disguised); - - for (TargetLazerData data : _data) + int entityId = 0; + + if (target != null) { - if (data.getAttacker().equals(disguised)) - { - if (target == null) - { - disguise.setTarget(0); - } - else - { - disguise.setTarget(data.update(Manager).getEntityId()); - } - - disguiseManager.updateDisguise(disguise); - } + entityId = disguiseManager.getActiveDisguise(target).getEntityId(); } + + disguise.setTarget(entityId); + disguiseManager.updateDisguise(disguise); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index c233cebf0..8e2ae1e08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -11,8 +11,10 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; import org.bukkit.Effect; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -140,7 +142,7 @@ public class PerkWaterSplash extends Perk UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, player.getLocation(), 0.5F, 0.5F, 0.5F, 0.01F, 10, ViewDist.LONG); - if (UtilEnt.isGrounded(player) && UtilTime.elapsed(_active.get(uuid), _minAirTime)) + if (UtilEnt.isGrounded(player) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.FENCE && UtilTime.elapsed(_active.get(uuid), _minAirTime)) { iterator.remove(); _usedSecondBoost.remove(uuid); @@ -149,7 +151,7 @@ public class PerkWaterSplash extends Perk for (Block block : UtilBlock.getInRadius(player.getLocation(), _radius).keySet()) { - if (Math.random() > 0.5) + if (Math.random() < 0.9 || UtilBlock.airFoliage(block) || !UtilBlock.airFoliage(block.getRelative(BlockFace.UP))) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java index f81316ce8..bdb6f3acc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -1,21 +1,15 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; -import mineplex.core.common.util.UtilEnt; - -import nautilus.game.arcade.ArcadeManager; - public class TargetLazerData { private Player _attacker; private Player _target; private long _startTime; - private ArmorStand _targetPlaceholder; - public TargetLazerData(Player attacker) + TargetLazerData(Player attacker) { _attacker = attacker; } @@ -26,27 +20,6 @@ public class TargetLazerData _startTime = System.currentTimeMillis(); } - public ArmorStand update(ArcadeManager manager) - { - if (_targetPlaceholder == null || !_targetPlaceholder.isValid()) - { - manager.GetGame().CreatureAllowOverride = true; - _targetPlaceholder = _target.getWorld().spawn(_target.getLocation(), ArmorStand.class); - _targetPlaceholder.setArms(false); - _targetPlaceholder.setSmall(true); - _targetPlaceholder.setBasePlate(false); - _targetPlaceholder.setGravity(false); - _targetPlaceholder.setVisible(false); - - UtilEnt.ghost(_targetPlaceholder, true, true); - - manager.GetGame().CreatureAllowOverride = false; - } - - _targetPlaceholder.teleport(_target.getLocation().add(0, 0.25, 0)); - return _targetPlaceholder; - } - public Player getAttacker() { return _attacker; @@ -61,5 +34,4 @@ public class TargetLazerData { return System.currentTimeMillis() - _startTime; } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java index 45fe2b378..9fcbf8432 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java @@ -40,7 +40,7 @@ public class PerkFlameDash extends Perk private int _damageRadius; private int _knockbackMagnitude; - private Set _data = new HashSet(); + private Set _data = new HashSet<>(); public PerkFlameDash() { @@ -76,7 +76,7 @@ public class PerkFlameDash extends Perk Player player = event.getPlayer(); - if (!UtilItem.isSpade(player.getItemInHand())) + if (!UtilItem.isSpade(player.getItemInHand()) || !Recharge.Instance.use(player, GetName() + " Double Activation", 100, false, false)) { return; } @@ -111,6 +111,14 @@ public class PerkFlameDash extends Perk return; } + for (Player other : UtilServer.getPlayersCollection()) + { + if (other.getSpectatorTarget() != null && other.getSpectatorTarget().equals(player)) + { + other.setSpectatorTarget(null); + } + } + Recharge.Instance.recharge(player, GetName()); Recharge.Instance.use(player, GetName(), _cooldown, true, true); @@ -130,7 +138,7 @@ public class PerkFlameDash extends Perk UpdateMovement(); } - public void UpdateMovement() + private void UpdateMovement() { Iterator dataIterator = _data.iterator(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java index 49256518c..d18ac1eb0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -30,7 +30,7 @@ public class PerkMagmaBoost extends Perk private static final ItemStack BOOTS = new ItemStack(Material.IRON_BOOTS); private static final ItemStack CHESTPLATE = new ItemStack(Material.IRON_CHESTPLATE); - private static final ItemStack HELMET = new ItemStack(Material.IRON_HELMET); + private static final ItemStack HELMET = new ItemStack(Material.DIAMOND_HELMET); private int _maxStacks; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java index 2160c60a5..224171f06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.pig; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -35,6 +36,7 @@ import mineplex.core.disguise.disguises.DisguisePigZombie; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigBaconBomb extends SmashPerk @@ -49,7 +51,7 @@ public class PerkPigBaconBomb extends SmashPerk private int _explodeDamage; private int _explodeDamageRadius; - private Map> _pigs = new HashMap>(); + private Map> _pigs = new HashMap<>(); public PerkPigBaconBomb() { @@ -146,7 +148,7 @@ public class PerkPigBaconBomb extends SmashPerk // Store if (!_pigs.containsKey(key)) { - _pigs.put(key, new HashSet()); + _pigs.put(key, new HashSet<>()); } _pigs.get(key).add(pig); @@ -182,18 +184,21 @@ public class PerkPigBaconBomb extends SmashPerk continue; } - Player target = UtilPlayer.getClosest(pig.getLocation(), player); + List targets = UtilPlayer.getNearby(pig.getLocation(), 20); - if (target == null) + for (Player target : targets) { - continue; - } - - UtilEnt.CreatureMoveFast(pig, target.getLocation(), _pigSpeed); + if (player.equals(target) || isTeamDamage(player, target)) + { + return; + } - if (UtilMath.offset(target, pig) < _explodeRadius) - { - PigExplode(pigIterator, pig, player); + UtilEnt.CreatureMoveFast(pig, target.getLocation(), _pigSpeed); + + if (UtilMath.offset(target, pig) < _explodeRadius) + { + PigExplode(pigIterator, pig, player); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java index 43371b217..e6e594fe2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java @@ -43,10 +43,11 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown private float _energyBacon; private float _energyBaconDisgtuiseFactor; private float _energyBaconBack; + private float _hitBox; private int _cooldown; private int _healthBacon; private int _damageBacon; - + public PerkPigBaconBounce() { super("Bouncy Bacon", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon", }); @@ -58,6 +59,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown _energyBacon = getPerkFloat("Energy Per Bacon"); _energyBaconDisgtuiseFactor = getPerkFloat("Energy Per Bacon Disguise Factor"); _energyBaconBack = getPerkFloat("Energy Per Bacon Back"); + _hitBox = getPerkFloat("Hit Box"); _cooldown = getPerkInt("Cooldown (ms)"); _healthBacon = getPerkInt("Health Per Bacon"); _damageBacon = getPerkInt("Bacon Damage"); @@ -121,7 +123,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown // Launch Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon" + System.currentTimeMillis())); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, .8F); + Manager.GetProjectile().AddThrow(ent, player, this, 5000, true, true, true, false, _hitBox); ent.setPickupDelay(9999); // Sound @@ -141,6 +143,11 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown return; } + if (target instanceof Player && isTeamDamage((Player) target, (Player) data.getThrower())) + { + return; + } + // Damage Event Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, _damageBacon, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java index 7bbbc05f6..aef837c84 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.pig; import org.bukkit.Sound; import org.bukkit.entity.Player; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashPig extends SmashUltimate @@ -10,21 +11,24 @@ public class SmashPig extends SmashUltimate public SmashPig() { - super("Pig Stink", new String[] {}, Sound.PIG_IDLE, 0); + super("Pig Stink", new String[]{}, Sound.PIG_IDLE, 0); } - + @Override public void activate(Player player) { super.activate(player); - + + GameTeam team = Manager.GetGame().GetTeam(player); + for (Player other : Manager.GetGame().GetPlayers(true)) { - if (!player.equals(other)) + if (player.equals(other) || team.HasPlayer(player)) { - Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, getLength() / 1000, 0, false, false, false); + continue; } + + Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, getLength() / 1000, 0, false, false, false); } } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java index 0878a36dd..52e5e7968 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java @@ -154,23 +154,17 @@ public class PerkBoneRush extends SmashPerk implements IThrown // Velocity Vector dir = player.getLocation().getDirection(); double limit = isSuperActive(player) ? _yLimit + 0.1 : _yLimit; - - if (dir.getY() > limit) - { - dir.setY(limit); - } - // Player if (!player.isSneaking()) { - UtilAction.velocity(player, dir, 0.6, false, 0, 0.1, 0.3, false); + UtilAction.velocity(player, dir, 0.6, false, 0, 0, limit, false); } // Bones for (int i = 0; i < 6; i++) { Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random() * 5 - 2.5, Math.random() * 3, Math.random() * 5 - 2.5), new ItemStack(Material.BONE)); - UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false); + UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0, 0.3, false); Manager.GetProjectile().AddThrow(bone, player, this, _expireTime, true, true, true, true, 0.5f); } } @@ -210,11 +204,10 @@ public class PerkBoneRush extends SmashPerk implements IThrown return; } - target = (Player) target; Player damager = (Player) data.getThrower(); String reason = GetName(); - if (target instanceof Player && damager instanceof Player) + if (damager instanceof Player) { if (isTeamDamage((Player) target, damager)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java index 0708471b7..6eb8c9968 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java @@ -48,7 +48,7 @@ public class PerkDeadlyBones extends SmashPerk @EventHandler public void damageActivate(CustomDamageEvent event) { - if (event.IsCancelled()) + if (event.IsCancelled() || event.GetCause() == DamageCause.STARVATION) { return; } @@ -106,6 +106,8 @@ public class PerkDeadlyBones extends SmashPerk if (player == null) { + item.remove(); + _active.remove(item); continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java index ab02a5e92..865df1050 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java @@ -43,11 +43,11 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { - private int _cooldown = 6000; - private float _energyTick = 0.004F; - private int _knockbackMagnitude = 3; - private int _maxEnergyTime = 3000; - private int _maxHoldTime = 5000; + private int _cooldown; + private float _energyTick; + private int _knockbackMagnitude; + private int _maxEnergyTime; + private int _maxHoldTime; private Map _charge = new HashMap<>(); private Map _owner = new HashMap<>(); @@ -55,7 +55,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public PerkSlimeRocket() { - super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" }); + super("Slime Rocket", new String[]{C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket"}); } @Override @@ -199,7 +199,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown // Use Energy if (!UtilTime.elapsed(time, _maxEnergyTime)) { - player.setExp((float) Math.max(0, player.getExp() - 0.01f)); + player.setExp(Math.max(0, player.getExp() - 0.01f)); } // AutoFire @@ -257,26 +257,21 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown @EventHandler public void SlimeTarget(EntityTargetEvent event) { - if (event.isCancelled()) + UUID uuid = _owner.get(event.getEntity()); + + if (uuid == null) { return; } - if (!_owner.containsKey(event.getEntity())) + Player owner = UtilPlayer.searchExact(uuid); + + if (owner == null || event.getTarget() == null) { return; } - if (event.getTarget() instanceof Player) - { - if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity())))) - { - event.setCancelled(true); - return; - } - } - - if (_owner.get(event.getEntity()).equals(event.getTarget())) + if (event.getTarget() instanceof Player && isTeamDamage((Player) event.getTarget(), owner) || event.getTarget().equals(owner)) { event.setCancelled(true); } @@ -285,12 +280,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (target == null) - { - return; - } - - if (!(data.getThrown() instanceof Slime)) + if (target == null || !(data.getThrown() instanceof Slime)) { return; } @@ -302,13 +292,14 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Player targetPlayer = (Player) target; Player throwerPlayer = (Player) data.getThrower(); - if (isTeamDamage(targetPlayer, throwerPlayer)) + if (isTeamDamage(targetPlayer, throwerPlayer) || !Recharge.Instance.use(targetPlayer, GetName() + slime.getUniqueId(), 2000, false, false)) { return; } } // Damage Event + _lastAttack.put(slime, System.currentTimeMillis()); Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); } @@ -320,7 +311,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), _knockbackMagnitude); + event.AddKnockback(GetName(), _knockbackMagnitude * (event.GetDamageInitial() / 3)); } @Override @@ -375,7 +366,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown return; } - if (owner != null && owner.equals(event.GetDamageeEntity())) + if (owner.equals(event.GetDamageeEntity())) { event.SetCancelled("Owner Damage"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java index 7a2690bcf..0060a3fb7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java @@ -94,9 +94,9 @@ public class PerkBlizzard extends Perk for (int i = 0; i < SNOWBALL_PER_USE; i++) { Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class); - double x = 0.1 - (UtilMath.r(20) / 100d); + double x = 0.1 - (UtilMath.r(10) / 100d); double y = UtilMath.r(20) / 100d; - double z = 0.1 - (UtilMath.r(20) / 100d); + double z = 0.1 - (UtilMath.r(10) / 100d); snow.setShooter(player); snow.setVelocity(player.getLocation().getDirection().add(new Vector(x, y, z)).multiply(2)); _snowball.put(snow, player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index bcff8ef4b..8d9badf63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -68,10 +68,8 @@ public class SmashSnowman extends SmashUltimate @Override public void activate(Player player) { -// super.activate(player); - player.sendMessage(F.main("Game", "Activated " + F.skill(GetName()) + ".")); - + UtilPlayer.health(player, 3.5); Game game = Manager.GetGame(); @@ -95,27 +93,10 @@ public class SmashSnowman extends SmashUltimate @Override public void cancel(Player player) { -// super.cancel(player); - - player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + ".")); - - - /* - Iterator iterator = _turret.keySet().iterator(); - - while (iterator.hasNext()) + if (Kit.HasKit(player)) { - Snowman snowman = iterator.next(); - - if (_turret.get(snowman).equals(player)) - { - UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); - snowman.remove(); - iterator.remove(); - return; - } + player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + ".")); } - */ } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java index 7db5d925c..2a5697e83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -62,15 +62,11 @@ public class PerkSpiderLeap extends Perk if (!player.isSneaking()) { - boolean grounded = UtilEnt.isGrounded(player); - - if (grounded) + if (UtilEnt.onBlock(player)) { + player.setExp(Math.min(0.999F, player.getExp() + _energyTick)); _secondJump.remove(player.getUniqueId()); } - - player.setExp(Math.min(0.999F, player.getExp() + (grounded ? _energyTick * 2 : _energyTick))); - continue; } @@ -162,7 +158,7 @@ public class PerkSpiderLeap extends Perk continue; } - if (UtilEnt.isGrounded(player)) + if (UtilEnt.onBlock(player)) { player.setAllowFlight(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java index b070f0a57..bee9c4a3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java @@ -147,10 +147,13 @@ public class PerkFishFlurry extends SmashPerk implements IThrown { DataSquidGeyser data = activeIter.next(); - // particles - for (Block block : data.Blocks) + if (event.getTick() % 3 == 0) { - UtilParticle.PlayParticleToAll(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 1, ViewDist.LONG); + // particles + for (Block block : data.Blocks) + { + UtilParticle.PlayParticleToAll(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 1, ViewDist.LONG); + } } // sound diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java index 13dff7e65..e9da03d59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java @@ -5,8 +5,10 @@ import java.util.Map; import java.util.UUID; import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; @@ -135,7 +137,10 @@ public class PerkSuperSquid extends SmashPerk @EventHandler public void DamageCancel(CustomDamageEvent event) { - if (_active.containsKey(event.GetDamageeEntity().getUniqueId())) + LivingEntity damagee = event.GetDamageeEntity(); + LivingEntity damager = event.GetDamagerEntity(false); + + if (_active.containsKey(damagee.getUniqueId()) || damager != null && event.GetCause() == DamageCause.ENTITY_ATTACK && _active.containsKey(damager.getUniqueId())) { event.SetCancelled(GetName()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java index f7cc4b4e5..c7519883b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java @@ -9,6 +9,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -34,6 +35,8 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.managers.LobbyEnt; +import nautilus.game.arcade.managers.lobby.LobbyManager; public class SmashSquid extends SmashUltimate { @@ -127,29 +130,27 @@ public class SmashSquid extends SmashUltimate UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, loc.clone().add(0, 0.5, 0), 1f, 1f, 1f, 0.1f, 40, ViewDist.MAX, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + Map kitNPCs = Manager.GetLobby().getKits(); + + Manager.runSyncLater(() -> { - @Override - public void run() + // Warning + player.getWorld().spigot().strikeLightningEffect(loc, false); + + Map targets = UtilEnt.getInRadius(loc, _damageRadius); + + for (LivingEntity cur : targets.keySet()) { - // Warning - player.getWorld().spigot().strikeLightningEffect(loc, false); - - Map targets = UtilEnt.getInRadius(loc, _damageRadius); - - for (LivingEntity cur : targets.keySet()) + if (cur.equals(player) || kitNPCs.containsKey(cur)) { - if (cur.equals(player)) - { - continue; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur), false, true, false, player.getName(), GetName()); - - // Velocity - UtilAction.velocity(cur, UtilAlg.getTrajectory(loc, cur.getLocation()), 3 * targets.get(cur), false, 0, 1 * targets.get(cur), 2, true); + continue; } + + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur), false, true, false, player.getName(), GetName()); + + // Velocity + UtilAction.velocity(cur, UtilAlg.getTrajectory(loc, cur.getLocation()), 3 * targets.get(cur), false, 0, 1 * targets.get(cur), 2, true); } }, 10); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkArts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkArts.java new file mode 100644 index 000000000..1c2ca58de --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkArts.java @@ -0,0 +1,403 @@ +package nautilus.game.arcade.game.games.smash.perks.villager; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager.Profession; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilItem; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargedEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.events.PerkDoubleJumpEvent; +import nautilus.game.arcade.game.games.smash.events.SmashActivateEvent; +import nautilus.game.arcade.game.games.smash.kits.KitVillager; +import nautilus.game.arcade.game.games.smash.kits.KitVillager.VillagerType; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkArts extends SmashPerk +{ + + private final Map _data = new HashMap<>(); + + private int _duration; + private int _cooldown; + + private double _attackDamageMod; + private float _attackSpeedMod; + private double _attackKBMod; + private double _attackDoubleJumpMod; + + private float _defenseDamageMod; + private float _defenseSpeedMod; + private double _defenseKBMod; + private double _defenseDoubleJumpMod; + + private float _speedDamageMod; + private float _speedSpeedMod; + private double _speedKBMod; + private double _speedDoubleJumpMod; + + public PerkArts() + { + super("Villager Arts", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " Spade to cycle through " + C.cGreen + "Villager Arts", + C.cYellow + "Drop" + C.cGray + " to activate the selected " + C.cGreen + "Villager Art", + }); + } + + @Override + public void setupValues() + { + _duration = getPerkTime("Duration"); + _cooldown = getPerkTime("Cooldown"); + + _attackDamageMod = getPerkDouble("Attack.Damage Mod"); + _attackSpeedMod = getPerkFloat("Attack.Speed Mod"); + _attackKBMod = getPerkPercentage("Attack.Knockback Mod"); + _attackDoubleJumpMod = getPerkDouble("Attack.Double Jump Mod"); + + _defenseDamageMod = getPerkFloat("Defense.Damage Mod"); + _defenseSpeedMod = getPerkFloat("Defense.Speed Mod"); + _defenseKBMod = getPerkPercentage("Defense.Knockback Mod"); + _defenseDoubleJumpMod = getPerkDouble("Defense.Double Jump Mod"); + + _speedDamageMod = getPerkFloat("Speed.Damage Mod"); + _speedSpeedMod = getPerkFloat("Speed.Speed Mod"); + _speedKBMod = getPerkPercentage("Speed.Knockback Mod"); + _speedDoubleJumpMod = getPerkDouble("Speed.Double Jump Mod"); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void playerInteract(PlayerInteractEvent event) + { + if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R) || UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (!UtilItem.isSpade(itemStack) || !hasPerk(player) || !Recharge.Instance.use(player, GetName(), 100, false, false)) + { + return; + } + + event.setCancelled(true); + + KitVillager kit = (KitVillager) Kit; + VillagerType newType = kit.get(player).getNext(); + boolean active = !Recharge.Instance.usable(player, newType.getName()); + + kit.set(player, newType); + player.getInventory().setItem(KitVillager.ART_ACTIVE_SLOT, kit.getArtItem(newType, active)); + player.getInventory().setItem(KitVillager.ART_VISUAL_SLOT, kit.getArtVisualItem(newType, active)); + player.updateInventory(); + } + + @EventHandler + public void artRecharge(RechargedEvent event) + { + Player player = event.GetPlayer(); + String ability = event.GetAbility(); + + if (!Manager.GetGame().InProgress() || !hasPerk(player) || isSuperActive(player)) + { + return; + } + + KitVillager kit = (KitVillager) Kit; + ItemStack itemStack = player.getInventory().getItem(KitVillager.ART_ACTIVE_SLOT); + + if (itemStack == null || itemStack.getItemMeta() == null || !itemStack.getItemMeta().getDisplayName().contains(ability)) + { + return; + } + + VillagerType type = kit.get(player); + + player.getInventory().setItem(KitVillager.ART_ACTIVE_SLOT, kit.getArtItem(type, false)); + player.getInventory().setItem(KitVillager.ART_VISUAL_SLOT, kit.getArtVisualItem(type, false)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void playerDropItem(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + ItemStack itemStack = event.getItemDrop().getItemStack(); + + if (!hasPerk(player) || itemStack == null || itemStack.getType() == Material.BED) + { + return; + } + + KitVillager kit = (KitVillager) Kit; + VillagerType type = kit.get(player); + + if (!Recharge.Instance.use(player, type.getName(), _cooldown, true, false)) + { + return; + } + + ArtData previousData = _data.remove(player); + + if (previousData != null) + { + VillagerType oldType = previousData.Type; + player.sendMessage(F.main("Game", "You deactivated the " + F.name(oldType.getChatColour() + oldType.getName()) + " Art.")); + } + + player.sendMessage(F.main("Game", "You activated the " + F.name(type.getChatColour() + type.getName()) + " Art.")); + player.setExp(0.99F); + player.getInventory().setItem(KitVillager.ART_ACTIVE_SLOT, kit.getArtItem(type, true)); + player.getInventory().setItem(KitVillager.ART_VISUAL_SLOT, kit.getArtVisualItem(player, type)); + kit.giveArmour(player, true); + kit.updateDisguise(player, type.getProfession()); + UtilFirework.playFirework(player.getLocation().add(0, 1, 0), FireworkEffect + .builder() + .with(Type.BALL) + .withColor(type.getColour()) + .withFade(Color.WHITE) + .withFlicker() + .build() + ); + reset(player); + + switch (type) + { + case ATTACK: + player.setWalkSpeed(player.getWalkSpeed() + _attackSpeedMod); + break; + case DEFENSE: + player.setWalkSpeed(player.getWalkSpeed() + _defenseSpeedMod); + break; + case SPEED: + player.setWalkSpeed(player.getWalkSpeed() + _speedSpeedMod); + break; + } + + if (UtilItem.isSpade(itemStack)) + { + event.setCancelled(false); + event.getItemDrop().remove(); + } + + _data.put(player, new ArtData(type)); + } + + @EventHandler + public void updateExp(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + _data.keySet().removeIf(player -> + { + ArtData data = _data.get(player); + + if (!player.isOnline() || !hasPerk(player)) + { + return true; + } + + if (player.getExp() == 0) + { + KitVillager kit = (KitVillager) Kit; + + reset(player); + kit.giveArmour(player, false); + kit.updateDisguise(player, Profession.FARMER); + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 0.5F); + player.sendMessage(F.main("Game", "Your " + F.name(data.Type.getChatColour() + data.Type.getName()) + " Art ended.")); + return true; + } + + long time = System.currentTimeMillis() - data.Start; + + if (time > _duration - 2000 && data.Sounds == 0 || time > _duration - 1000 && data.Sounds == 1) + { + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 0.3F); + data.Sounds++; + } + + player.setExp(Math.max(1 - time / (float) _duration, 0)); + return false; + }); + } + + @EventHandler + public void playerDeath(PlayerDeathEvent event) + { + _data.keySet().removeIf(player -> event.getEntity().equals(player)); + } + + @EventHandler(priority = EventPriority.HIGH) + public void damage(CustomDamageEvent event) + { + if (event.isCancelled() || event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + Player damager = event.GetDamagerPlayer(false); + String key = "Knockback Multiplier"; + Double value = event.GetKnockback().get(key); + + if (damager == null || value == null) + { + return; + } + + if (isSuperActive(damager)) + { + LivingEntity damagee = event.GetDamageeEntity(); + damagee.getWorld().playEffect(damagee.getLocation().add(0, 1, 0), Effect.STEP_SOUND, Material.IRON_BLOCK); + + event.AddMod("Perfection", _attackDamageMod); + return; + } + else if (event.GetDamageePlayer() != null && isSuperActive(event.GetDamageePlayer())) + { + event.AddKnockback("Perfection", _defenseKBMod); + return; + } + + ArtData data = _data.get(damager); + + if (data == null) + { + return; + } + + switch (data.Type) + { + case ATTACK: + event.AddMod(data.Type.getName(), _attackDamageMod); + value += _attackKBMod; + break; + case DEFENSE: + event.AddMod(data.Type.getName(), _defenseDamageMod); + value += _defenseKBMod; + break; + case SPEED: + event.AddMod(data.Type.getName(), _speedDamageMod); + value += _speedKBMod; + break; + } + + event.GetKnockback().put(key, value); + } + + @EventHandler + public void doubleJump(PerkDoubleJumpEvent event) + { + Player player = event.getPlayer(); + + if (!hasPerk(player)) + { + return; + } + + double increase = 0; + + if (isSuperActive(player)) + { + increase = _speedDoubleJumpMod; + event.setControl(true); + } + else + { + ArtData data = _data.get(player); + + if (data == null) + { + return; + } + + switch (data.Type) + { + case ATTACK: + increase = _attackDoubleJumpMod; + break; + case DEFENSE: + increase = _defenseDoubleJumpMod; + break; + case SPEED: + increase = _speedDoubleJumpMod; + event.setControl(true); + break; + } + } + + event.setPower(event.getPower() + increase); + } + + private void reset(Player player) + { + player.setWalkSpeed(0.2F); + } + + @EventHandler + public void smashActivate(SmashActivateEvent event) + { + Player player = event.getPlayer(); + + if (!hasPerk(player)) + { + return; + } + + _data.remove(player); + reset(player); + player.setWalkSpeed(player.getWalkSpeed() + _speedSpeedMod); + KitVillager kit = (KitVillager) Kit; + player.getInventory().setItem(KitVillager.ART_ACTIVE_SLOT, kit.getArtItem(player, true)); + } + + public VillagerType getActiveArt(Player player) + { + ArtData data = _data.get(player); + return data == null ? null : data.Type; + } + + private class ArtData + { + VillagerType Type; + long Start; + int Sounds; + + ArtData(VillagerType type) + { + Type = type; + Start = System.currentTimeMillis(); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkSonicBoom.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkSonicBoom.java new file mode 100644 index 000000000..5ffadb095 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkSonicBoom.java @@ -0,0 +1,108 @@ +package nautilus.game.arcade.game.games.smash.perks.villager; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.particleeffects.SpiralEffect; +import mineplex.core.recharge.Recharge; + +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkSonicBoom extends SmashPerk +{ + + private int _cooldown; + private int _distance; + private double _damage; + private float _hitBox, _velocityFactor; + + public PerkSonicBoom() + { + super("Sonic Hurr", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " Axe to use" + C.cGreen + "Sonic Hurr", + }); + } + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _distance = getPerkInt("Distance"); + _damage = getPerkDouble("Damage"); + _hitBox = getPerkFloat("Hitbox"); + _velocityFactor = getPerkFloat("Velocity Factor"); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void playerInteract(PlayerInteractEvent event) + { + if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R) || UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (!UtilItem.isAxe(itemStack) || !hasPerk(player) || !Recharge.Instance.use(player, GetName(), _cooldown, true, true)) + { + return; + } + + Location location = player.getEyeLocation(); + location.add(location.getDirection()); + + player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + ".")); + player.getWorld().playSound(location, Sound.VILLAGER_IDLE, 1.5F, 1.2F); + + new SpiralEffect(1, 2, _distance * 10, location) + { + @Override + public void playParticle(Location location) + { + UtilParticle.PlayParticleToAll(ParticleType.CLOUD, location, null, 0, 1, ViewDist.NORMAL); + + if (Math.random() < 0.05) + { + UtilParticle.PlayParticleToAll(ParticleType.ANGRY_VILLAGER, location, 0.3F, 0.3F, 0.3F, 0, 1, ViewDist.NORMAL); + } + } + }.start(); + + Location center = location.clone().add(location.getDirection().multiply(_distance / 2D)).subtract(0, 0.5, 0); + + for (Player nearby : UtilPlayer.getNearby(center, _hitBox)) + { + if (player.equals(nearby) || isTeamDamage(player, nearby)) + { + return; + } + + double scale = 1 - UtilMath.offset(player, nearby) / _distance / 2; + + Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, scale * _damage, false, true, false, player.getName(), GetName()); + + UtilAction.velocity(nearby, UtilAlg.getTrajectory(player, nearby), scale * _velocityFactor, false, 0, 0.5, 0.8, true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkVillagerShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkVillagerShot.java new file mode 100644 index 000000000..a7743f6bf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/PerkVillagerShot.java @@ -0,0 +1,242 @@ +package nautilus.game.arcade.game.games.smash.perks.villager; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.smash.kits.KitVillager; +import nautilus.game.arcade.game.games.smash.kits.KitVillager.VillagerType; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkVillagerShot extends SmashPerk implements IThrown +{ + + private long _cooldown; + private float _bulletVelocity; + private float _bulletKnockback; + private int _bullets; + private float _hitBox; + + private double _normalRecoil, _attackRecoil, _defenseRecoil, _speedRecoil; + private double _normalSpread, _attackSpread, _defenseSpread, _speedSpread; + private double _normalDamage, _attackDamage, _defenseDamage, _speedDamage; + + private final Map _items; + + public PerkVillagerShot() + { + super("Trade Scatter", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " Hoe to use" + C.cGreen + "Trade Scatter", + }); + + _items = new HashMap<>(); + } + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _bulletVelocity = getPerkFloat("Bullet Velocity"); + _bulletKnockback = getPerkFloat("Bullet Knockback"); + _bullets = getPerkInt("Bullets"); + _hitBox = getPerkFloat("Hitbox"); + + _normalRecoil = getPerkDouble("Normal.Recoil"); + _attackRecoil = getPerkDouble("Attack.Recoil"); + _defenseRecoil = getPerkDouble("Defense.Recoil"); + _speedRecoil = getPerkDouble("Speed.Recoil"); + + _normalSpread = getPerkDouble("Normal.Spread"); + _attackSpread = getPerkDouble("Attack.Spread"); + _defenseSpread = getPerkDouble("Defense.Spread"); + _speedSpread = getPerkDouble("Speed.Spread"); + + _normalDamage = getPerkDouble("Normal.Damage"); + _attackDamage = getPerkDouble("Attack.Damage"); + _defenseDamage = getPerkDouble("Defense.Damage"); + _speedDamage = getPerkDouble("Speed.Damage"); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void playerInteract(PlayerInteractEvent event) + { + if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R) || UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (!UtilItem.isHoe(itemStack) || !hasPerk(player) || !Recharge.Instance.use(player, GetName(), _cooldown, true, true)) + { + return; + } + + KitVillager kit = ((KitVillager) Kit); + VillagerType type = kit.getActiveArt(player); + Material material = Material.EMERALD; + ParticleType particleType = ParticleType.HAPPY_VILLAGER; + double recoil = _normalRecoil, spread = _normalSpread; + boolean front = type != null && (type == VillagerType.ATTACK || type == VillagerType.DEFENSE); + + if (isSuperActive(player)) + { + material = Material.NETHER_STAR; + particleType = ParticleType.ANGRY_VILLAGER; + recoil = _speedRecoil; + spread = _attackSpread; + type = VillagerType.ATTACK; + front = true; + } + else if (type != null) + { + switch (type) + { + case ATTACK: + material = Material.RAW_BEEF; + particleType = ParticleType.FLAME; + recoil = _attackRecoil; + spread = _attackSpread; + break; + case DEFENSE: + material = Material.IRON_INGOT; + particleType = ParticleType.FIREWORKS_SPARK; + recoil = _defenseRecoil; + spread = _defenseSpread; + break; + case SPEED: + material = Material.FEATHER; + particleType = ParticleType.ENCHANTMENT_TABLE; + recoil = _speedRecoil; + spread = _speedSpread; + break; + } + } + + Location location; + Vector direction; + + if (front) + { + location = player.getEyeLocation(); + direction = location.getDirection(); + recoil = -recoil; + } + else + { + location = player.getLocation().add(0, 1.3, 0); + direction = location.getDirection().multiply(-_bulletVelocity); + } + + UtilAction.velocity(player, recoil, 0.3, 1.2, true); + player.getWorld().playSound(location, Sound.FIREWORK_LARGE_BLAST, 1.5F, 1); + + for (int i = 0; i < _bullets; i++) + { + boolean reduceParticles = type != null && type == VillagerType.ATTACK; + Item item = location.getWorld().dropItem(location, new ItemBuilder(material).setTitle("Bullet" + UtilMath.r(100)).build()); + Vector itemDirection = direction.clone().add(new Vector((Math.random() - 0.5) * spread, (Math.random() - 0.5) * spread, (Math.random() - 0.5) * spread)); + item.setVelocity(itemDirection); + _items.put(item, type); + Manager.GetProjectile().AddThrow(item, player, this, 5000, true, true, false, true, null, 0, 0, particleType, reduceParticles ? UpdateType.FASTEST : UpdateType.TICK, _hitBox); + } + + player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void damage(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), _bulletKnockback); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + VillagerType type = remove(data); + double damage = _normalDamage; + + if (target == null) + { + return; + } + + if (type != null) + { + switch (type) + { + case ATTACK: + damage = _attackDamage; + break; + case DEFENSE: + damage = _defenseDamage; + break; + case SPEED: + damage = _speedDamage; + break; + } + } + + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, true, true, false, data.getThrower().getName(), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + remove(data); + } + + @Override + public void Expire(ProjectileUser data) + { + remove(data); + } + + @Override + public void ChunkUnload(ProjectileUser data) + { + remove(data); + } + + private VillagerType remove(ProjectileUser data) + { + data.getThrown().remove(); + return _items.remove(data.getThrown()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/SmashVillager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/SmashVillager.java new file mode 100644 index 000000000..57d280574 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/villager/SmashVillager.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.games.smash.perks.villager; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.recharge.Recharge; + +import nautilus.game.arcade.game.games.smash.kits.KitVillager.VillagerType; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashVillager extends SmashUltimate +{ + + public SmashVillager() + { + super("Perfection", new String[0], Sound.VILLAGER_YES, 0); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + for (VillagerType type : VillagerType.values()) + { + Recharge.Instance.useForce(player, type.getName(), getLength()); + } + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + player.setWalkSpeed(0.2F); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 4a109a73c..fe1f8093f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -12,6 +12,8 @@ import org.bukkit.entity.ThrownPotion; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.common.util.C; @@ -57,7 +59,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown public void setupValues() { _cooldown = getPerkTime("Cooldown"); - _range = getPerkInt( "Range"); + _range = getPerkInt("Range"); _damageDirect = getPerkInt("Damage Direct"); _damageDistance = getPerkInt("Damage Distance"); _knockbackMagnitude = getPerkInt("Knockback Magnitude"); @@ -157,23 +159,23 @@ public class PerkWitchPotion extends SmashPerk implements IThrown List players = new ArrayList<>(Manager.GetGame().GetPlayers(true)); players.removeAll(TeamSuperSmash.getTeam(Manager, thrower, true)); - + List directHit = UtilEnt.getPlayersInsideEntity(data.getThrown(), players); - + for (Player player : directHit) { Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, _damageDirect, true, true, false, thrower.getName(), GetName()); Manager.GetCondition().Factory().Slow(GetName(), player, thrower, 2, 1, true, true, false, false); } - + players.removeAll(directHit); - + Vector a = data.getThrown().getLocation().subtract(_range, _range, _range).toVector(); Vector b = data.getThrown().getLocation().add(_range, _range, _range).toVector(); for (Player player : players) { - if(!UtilEnt.isInsideBoundingBox(player, a, b)) continue; - + if (!UtilEnt.isInsideBoundingBox(player, a, b)) continue; + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, _damageDistance, true, true, false, thrower.getName(), GetName()); Manager.GetCondition().Factory().Slow(GetName(), player, thrower, 2, 0, true, true, false, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java index 605ea110c..5f6d0f759 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.Map; import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -17,6 +16,9 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -30,10 +32,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilVariant; +import mineplex.core.velocity.VelocityFix; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import org.bukkit.util.Vector; public class PerkWitherImage extends SmashPerk { @@ -103,14 +105,14 @@ public class PerkWitherImage extends SmashPerk // Spawn Manager.GetGame().CreatureAllowOverride = true; - Skeleton skel = UtilVariant.spawnWitherSkeleton(player.getEyeLocation().add(player.getLocation().getDirection())); + Skeleton skel = UtilVariant.spawnWitherSkeleton(player.getEyeLocation()); Manager.GetGame().CreatureAllowOverride = false; skel.getEquipment().setItemInHand(player.getItemInHand()); skel.setMaxHealth(20); skel.setHealth(skel.getMaxHealth()); - + for (Player other : UtilPlayer.getNearby(skel.getLocation(), _targetRadius)) { if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) @@ -131,6 +133,7 @@ public class PerkWitherImage extends SmashPerk skel.setCustomName(C.cYellow + player.getName()); } + skel.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1, false, false)); skel.setCustomNameVisible(true); UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); @@ -160,7 +163,8 @@ public class PerkWitherImage extends SmashPerk skel.teleport(player.getLocation()); UtilAction.velocity(skel, oldPlayerVector); player.teleport(loc); - UtilAction.velocity(player, oldSkeletonVector); + // Not using UtilAction.velocity because it causes the player not to get the correct velocity + player.setVelocity(oldSkeletonVector); // Sound player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 2f); @@ -173,20 +177,21 @@ public class PerkWitherImage extends SmashPerk @EventHandler public void entityTarget(EntityTargetEvent event) { - if (_skeletons.containsValue(event.getEntity())) + if (!(event.getEntity() instanceof Skeleton)) { - if (event.getTarget() instanceof Player) - { - if (isTeamDamage((Player) event.getTarget(), getOwner((Skeleton) event.getEntity()))) - { - event.setCancelled(true); - } - } + return; + } - if (event.getTarget() != null && event.getEntity().equals(_skeletons.get(event.getTarget().getUniqueId()))) - { - event.setCancelled(true); - } + Player owner = getOwner((Skeleton) event.getEntity()); + + if (owner == null || event.getTarget() == null) + { + return; + } + + if (event.getTarget() instanceof Player && isTeamDamage((Player) event.getTarget(), owner) || event.getTarget().equals(owner)) + { + event.setCancelled(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java index bd2c99b0e..a74f212ca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java @@ -1,22 +1,19 @@ package nautilus.game.arcade.game.games.smash.perks.witherskeleton; -import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; import java.util.Set; -import java.util.UUID; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.entity.WitherSkull; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import mineplex.core.common.util.C; @@ -30,27 +27,28 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitherSkull extends SmashPerk { + private static final ItemStack HELMET = new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1); + private int _cooldownNormal; private int _cooldownSmash; private int _damage; - private float _knockbackMagnitude; + private float _skullVelocity, _knockbackMagnitude; - private Map _active = new HashMap<>(); - private Set _ignoreControl = new HashSet<>(); + private final Set _active = new HashSet<>(); public PerkWitherSkull() { - super("Wither Skull", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull" }); + super("Wither Skull", new String[] {C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull"}); } @Override @@ -59,19 +57,15 @@ public class PerkWitherSkull extends SmashPerk _cooldownNormal = getPerkTime("Cooldown Normal"); _cooldownSmash = getPerkTime("Cooldown Smash"); _damage = getPerkInt("Damage"); + _skullVelocity = getPerkFloat("Skull Velocity"); _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); } @EventHandler(priority = EventPriority.LOW) // Happen BEFORE super is - // triggered + // triggered public void activate(PlayerInteractEvent event) { - if (event.isCancelled()) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) + if (event.isCancelled() || UtilBlock.usable(event.getClickedBlock())) { return; } @@ -79,40 +73,25 @@ public class PerkWitherSkull extends SmashPerk Player player = event.getPlayer(); boolean smash = isSuperActive(player); - if (!smash) - { - if (!UtilItem.isSword(player.getItemInHand())) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - } - - if (!hasPerk(player)) + if (!smash && (!UtilItem.isSword(player.getItemInHand()) || !UtilEvent.isAction(event, ActionType.R))) { return; } - if (!Recharge.Instance.use(player, GetName(), smash ? _cooldownSmash : _cooldownNormal, !smash, !smash)) + if (!hasPerk(player) || !Recharge.Instance.use(player, GetName(), smash ? _cooldownSmash : _cooldownNormal, !smash, !smash)) { return; } - // Fire - WitherSkull skull = player.launchProjectile(WitherSkull.class); + Manager.GetGame().CreatureAllowOverride = true; + Location location = player.getLocation(); + ArmorStand skull = player.getWorld().spawn(location, ArmorStand.class); + skull.setHelmet(HELMET); + skull.setGravity(false); + skull.setVisible(false); + _active.add(new SkullData(player, skull, location.getDirection().multiply(_skullVelocity), !smash)); + Manager.GetGame().CreatureAllowOverride = false; - if (!smash) - { - skull.setDirection(player.getLocation().getDirection()); - } - - _active.put(skull, player.getLocation().getDirection().multiply(0.6)); - - // Sound player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f); // Inform @@ -120,119 +99,126 @@ public class PerkWitherSkull extends SmashPerk { UtilPlayer.message(player, F.main("Skill", "You launched " + F.skill(GetName()) + ".")); } - - // Control - if (!smash) - { - _ignoreControl.remove(player.getUniqueId()); - } - else - { - _ignoreControl.add(player.getUniqueId()); - } } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void cleanAndControl(UpdateEvent event) { if (event.getType() != UpdateType.TICK) { return; } - - Iterator skullIterator = _active.keySet().iterator(); - while (skullIterator.hasNext()) + _active.removeIf(skullData -> { - WitherSkull skull = skullIterator.next(); - Player player = (Player) skull.getShooter(); + Player shooter = skullData.Shooter; + ArmorStand skullHolder = skullData.SkullHolder; - if (!skull.isValid()) + if (!skullHolder.isValid()) { - skullIterator.remove(); - skull.remove(); - continue; + return true; } - if (_ignoreControl.contains(player.getUniqueId())) + if (skullData.Control && shooter.isBlocking()) { - continue; + skullData.Direction = shooter.getLocation().getDirection(); } - if (player.isBlocking() && !_ignoreControl.contains(player.getUniqueId())) + Location newLocation = skullHolder.getLocation().add(skullData.Direction.clone().multiply(1.6)); + skullHolder.teleport(newLocation); + UtilParticle.PlayParticleToAll(ParticleType.SMOKE, newLocation.add(0, 2, 0), null, 0.01F, 2, ViewDist.LONG); + + boolean hitEntity = false, hitBlock = UtilBlock.solid(skullHolder.getLocation().add(0, 1.5, 0).getBlock()); + + if (!hitBlock) { - skull.setDirection(player.getLocation().getDirection()); - skull.setVelocity(player.getLocation().getDirection().multiply(0.6)); - _active.put(skull, player.getLocation().getDirection().multiply(0.6)); + for (LivingEntity entity : UtilEnt.getInRadius(newLocation, 1).keySet()) + { + if (entity.equals(shooter) || entity.equals(skullHolder)) + { + continue; + } + + hitEntity = true; + break; + } } - else + + if (hitEntity || hitBlock) { - _ignoreControl.add(player.getUniqueId()); - skull.setDirection(_active.get(skull)); - skull.setVelocity(_active.get(skull)); + explode(skullData, hitBlock); + return true; } - } + + return false; + }); } - @EventHandler - public void explode(EntityExplodeEvent event) + private void explode(SkullData skullData, boolean adjustY) { - if (!_active.containsKey(event.getEntity())) + ArmorStand skullHolder = skullData.SkullHolder; + Location location = skullHolder.getLocation(); + double scale = 0.4 + 0.6 * Math.min(1, skullHolder.getTicksLived() / 20d); + + if (adjustY) { - return; + location.add(0, 2, 0); } - event.setCancelled(true); - - WitherSkull skull = (WitherSkull) event.getEntity(); - - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, skull.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - - explode(skull, event.getLocation(), (LivingEntity) skull.getShooter()); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void explodeDamage(CustomDamageEvent event) - { - if (event.IsCancelled()) + UtilPlayer.getInRadius(location, 6).forEach((player, scale1) -> { - return; - } - - if (event.GetProjectile() != null && event.GetProjectile() instanceof WitherSkull) - { - event.SetCancelled("Wither Skull Cancel"); - } - } - - private void explode(WitherSkull skull, Location loc, LivingEntity shooter) - { - double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived() / 20d); - - // Players - Map players = UtilPlayer.getInRadius(skull.getLocation(), 6); - - for (Player player : players.keySet()) - { - if (Manager.isSpectator(player)) + if (player.equals(skullData.Shooter)) { - continue; + return; } - // Damage Event - Manager.GetDamage().NewDamageEvent(player, (LivingEntity) skull.getShooter(), null, DamageCause.CUSTOM, _damage * players.get(player) * scale, true, true, false, UtilEnt.getName( - (LivingEntity) skull.getShooter()), GetName()); - } + Manager.GetDamage().NewDamageEvent(player, skullData.Shooter, null, DamageCause.CUSTOM, _damage * scale * scale1, true, true, false, skullData.Shooter.getName(), GetName()); + }); + + location.getWorld().playSound(location, Sound.EXPLODE, 2.5F, 0.4F); + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, null, 0, 1, ViewDist.LONG); + skullHolder.remove(); } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void knockback(CustomDamageEvent event) { + if (event.isCancelled()) + { + return; + } + + for (SkullData data : _active) + { + if (data.SkullHolder.equals(event.GetDamageeEntity())) + { + event.SetCancelled("Wither Skull Holder"); + return; + } + } + if (event.GetReason() == null || !event.GetReason().contains(GetName())) { return; } - + event.AddKnockback(GetName(), _knockbackMagnitude); } + + private class SkullData + { + + Player Shooter; + ArmorStand SkullHolder; + Vector Direction; + boolean Control; + + SkullData(Player shooter, ArmorStand skullHolder, Vector direction, boolean control) + { + Shooter = shooter; + SkullHolder = skullHolder; + Direction = direction; + Control = control; + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java index dfc79d277..4f457ad5c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.smash.perks.wolf; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -40,7 +41,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWolf extends SmashPerk { - + private int _cooldownNormal; private int _cooldownSmash; private int _wolfHealth; @@ -63,8 +64,8 @@ public class PerkWolf extends SmashPerk public PerkWolf() { - super("Wolf", new String[] { C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + CUB_TACKLE, C.cYellow - + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", }); + super("Wolf", new String[] {C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + CUB_TACKLE, C.cYellow + + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.",}); } @Override @@ -177,7 +178,7 @@ public class PerkWolf extends SmashPerk return; } } - + if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > _maxTicks)) { wolf.remove(); @@ -192,7 +193,7 @@ public class PerkWolf extends SmashPerk { return; } - + if (damagee instanceof Player) { if (isTeamDamage(damager, (Player) damagee)) @@ -253,7 +254,7 @@ public class PerkWolf extends SmashPerk } } - public Player tackleGetOwner(Wolf wolf) + private Player tackleGetOwner(Wolf wolf) { if (_owner.containsKey(wolf)) { @@ -475,8 +476,7 @@ public class PerkWolf extends SmashPerk if (!_repeat.containsKey(damager.getUniqueId())) { - _repeat.put(damager.getUniqueId(), new ArrayList()); - _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + _repeat.put(damager.getUniqueId(), new ArrayList<>(Collections.singletonList(System.currentTimeMillis()))); // Exp damager.setExp(Math.min(0.99F, _repeat.get(damager.getUniqueId()).size() / 9f)); @@ -522,11 +522,11 @@ public class PerkWolf extends SmashPerk } _repeat.get(uuid).removeIf(time -> UtilTime.elapsed(time, 3000)); - + // Exp player.setExp(Math.min(0.999f, _repeat.get(uuid).size() / 9f)); - - if(_repeat.get(uuid).isEmpty()) + + if (_repeat.get(uuid).isEmpty()) { playerIterator.remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java index 3973da393..eedef0f97 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java @@ -76,7 +76,7 @@ public class SmashZombie extends SmashUltimate @EventHandler public void timeUpdate(UpdateEvent event) { - if (event.getType() != UpdateType.TICK) + if (event.getType() != UpdateType.TICK || !Manager.GetGame().IsLive()) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java index e19a91106..fa0d08c1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.wizards.spells; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; import mineplex.core.common.util.UtilAction; @@ -27,7 +28,7 @@ public class SpellGust extends Spell implements SpellClick final double gustSize = (getSpellLevel(player) * 3) + 10; - final HashMap effected = UtilPlayer.getPlayersInPyramid(player, 45, gustSize); + final Map effected = UtilPlayer.getPlayersInPyramid(player, 45, gustSize); Iterator> itel = effected.entrySet().iterator(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java index 0dd6008c7..556e66b21 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java @@ -1,18 +1,11 @@ package nautilus.game.arcade.game.modules; -import mineplex.core.common.events.EntityVelocityChangeEvent; -import mineplex.core.common.util.*; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.managers.LobbyEnt; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Function; +import java.util.function.Predicate; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; @@ -28,8 +21,24 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.inventory.ItemStack; -import java.util.*; -import java.util.function.Function; +import mineplex.core.common.events.EntityVelocityChangeEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.managers.LobbyEnt; public class TrainingGameModule extends Module { @@ -43,8 +52,9 @@ public class TrainingGameModule extends Module private final Set _kits; private Function _teamFunction; - private Function _skillFunction; - private Function _damageFunction; + private Predicate _skillFunction; + private Predicate _damageFunction; + private Predicate _kitSelectFunction; private boolean _giveReturnToSpawn = true; public TrainingGameModule() @@ -122,7 +132,7 @@ public class TrainingGameModule extends Module Entity entity = event.getRightClicked(); LobbyEnt lobbyEnt = getFromEntity(entity); - if (UtilPlayer.isSpectator(player)) + if (UtilPlayer.isSpectator(player) || (_kitSelectFunction != null && !_kitSelectFunction.test(player))) { return; } @@ -220,7 +230,7 @@ public class TrainingGameModule extends Module Player player = event.getPlayer(); - if (!_skillFunction.apply(player)) + if (!_skillFunction.test(player)) { event.setCancelled(true); } @@ -236,7 +246,7 @@ public class TrainingGameModule extends Module Player player = (Player) event.getEntity(); - if (!_skillFunction.apply(player)) + if (!_skillFunction.test(player)) { event.setCancelled(true); } @@ -262,12 +272,7 @@ public class TrainingGameModule extends Module } } - if (_damageFunction == null) - { - return; - } - - if (!_damageFunction.apply(player)) + if (_damageFunction != null && !_damageFunction.test(player)) { event.SetCancelled("Training Area"); } @@ -285,7 +290,7 @@ public class TrainingGameModule extends Module Player player = (Player) entity; - if (!_damageFunction.apply(player)) + if (!_damageFunction.test(player)) { event.setCancelled(true); } @@ -337,24 +342,35 @@ public class TrainingGameModule extends Module } } + public void preventReturnToSpawn(Player player) + { + Recharge.Instance.useForce(player, RETURN_TO_SPAWN_RECHARGE, RETURN_TO_SPAWN_COOLDOWN); + } + public TrainingGameModule setTeamFunction(Function function) { _teamFunction = function; return this; } - public TrainingGameModule setSkillFunction(Function function) + public TrainingGameModule setSkillFunction(Predicate function) { _skillFunction = function; return this; } - public TrainingGameModule setDamageFunction(Function function) + public TrainingGameModule setDamageFunction(Predicate function) { _damageFunction = function; return this; } + public TrainingGameModule setKitSelectFunction(Predicate function) + { + _kitSelectFunction = function; + return this; + } + public TrainingGameModule setGiveReturnToSpawn(boolean b) { _giveReturnToSpawn = b; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java index 23cd74d5f..fa5846ba2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java @@ -10,6 +10,7 @@ import java.util.stream.Stream; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -90,6 +91,7 @@ public class CompassModule extends Module HandlerList.unregisterAll(_compassMenu); _compassMenu = null; _suppliers = null; + UtilServer.getPlayersCollection().forEach(player -> ((CraftPlayer) player).getHandle().compassTarget = null); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkOverrideLoadCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkOverrideLoadCommand.java new file mode 100644 index 000000000..f0d624fad --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkOverrideLoadCommand.java @@ -0,0 +1,31 @@ +package nautilus.game.arcade.game.modules.perks; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.util.F; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.SuperSmash.Perm; + +public class PerkOverrideLoadCommand extends CommandBase +{ + + private final PerkSpreadsheetModule _module; + + public PerkOverrideLoadCommand(ArcadeManager manager, PerkSpreadsheetModule module) + { + super(manager, Perm.DEBUG_PERK_COMMANDS, "perkload"); + + _module = module; + } + + @Override + public void Execute(Player caller, String[] args) + { + _module.setup(); + caller.sendMessage(F.main("Game", "Overridden Values:")); + + PerkSpreadsheetModule.getValueOverrideMap().forEach((key, value) -> caller.sendMessage(F.main("Game", F.name(key) + " -> " + F.elem(value) + "."))); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkOverrideValueCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkOverrideValueCommand.java new file mode 100644 index 000000000..d823cd2dd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkOverrideValueCommand.java @@ -0,0 +1,73 @@ +package nautilus.game.arcade.game.modules.perks; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.util.F; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.SuperSmash.Perm; + +public class PerkOverrideValueCommand extends CommandBase +{ + + private final PerkSpreadsheetModule _module; + + public PerkOverrideValueCommand(ArcadeManager manager, PerkSpreadsheetModule module) + { + super(manager, Perm.DEBUG_PERK_COMMANDS, "perkoverride"); + + _module = module; + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + sendUsage(caller); + return; + } + + StringBuilder builder = new StringBuilder(); + + // Ignore the last argument + for (int i = 0; i < args.length - 1; i++) + { + builder.append(args[i]).append(" "); + } + + String key = builder.toString().trim(); + String value = args[args.length - 1]; + + if (!_module.getDataMap().containsKey(key)) + { + caller.sendMessage(F.main("Game", "That is not a valid key.")); + return; + } + else if (value.equalsIgnoreCase("clear")) + { + PerkSpreadsheetModule.getValueOverrideMap().remove(key); + caller.sendMessage(F.main("Game", "Reset the perk variable " + F.name(key) + " to it's default value.")); + return; + } + + PerkSpreadsheetModule.getValueOverrideMap().put(key, value); + caller.sendMessage(F.main("Game", "Overrode the perk variable " + F.name(key) + " with value " + F.elem(value) + ".")); + } + + private void sendUsage(Player caller) + { + caller.sendMessage(F.main("Game", "/" + _aliasUsed + " ")); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + return new ArrayList<>(_module.getDataMap().keySet()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/PerkSpreadsheetModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkSpreadsheetModule.java similarity index 52% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/PerkSpreadsheetModule.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkSpreadsheetModule.java index 63e90d8d6..065c9fba7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/PerkSpreadsheetModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/perks/PerkSpreadsheetModule.java @@ -1,65 +1,65 @@ -package nautilus.game.arcade.managers; +package nautilus.game.arcade.game.modules.perks; -import mineplex.core.common.Pair; -import mineplex.core.common.util.UtilServer; -import mineplex.core.google.GoogleSheetsManager; -import mineplex.core.google.SheetObjectDeserialiser; -import mineplex.core.slack.SlackAPI; -import mineplex.core.slack.SlackMessage; -import mineplex.core.slack.SlackTeam; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.Perk; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import java.net.MalformedURLException; -import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -public class PerkSpreadsheetModule implements Listener +import mineplex.core.command.CommandBase; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.Pair; +import mineplex.core.common.util.F; +import mineplex.core.google.GoogleSheetsManager; +import mineplex.core.google.SheetObjectDeserialiser; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.modules.Module; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; + +public class PerkSpreadsheetModule extends Module { private static final SheetObjectDeserialiser> DESERIALISER = values -> Pair.create(values[0], values.length == 1 ? "" : values[1]); - - private final Game _game; - private final Map _dataMap; - private final String _fileName; - - public PerkSpreadsheetModule(Game game, String fileName) + private static final Map VALUE_OVERRIDE_MAP = new HashMap<>(); + static Map getValueOverrideMap() { - _game = game; - _fileName = fileName; - - _dataMap = new HashMap<>(); - - UtilServer.RegisterEvents(this); - - setup(); + return VALUE_OVERRIDE_MAP; } - @EventHandler - public void cleanup(GameStateChangeEvent event) + private final String _fileName; + private final Map _dataMap; + private boolean _initialised; + + private CommandBase _valueCommand; + private CommandBase _loadCommand; + + public PerkSpreadsheetModule(String fileName) { - if (event.GetState() != Game.GameState.End) + _fileName = fileName; + _dataMap = new HashMap<>(); + } + + @Override + public void setup() + { + if (!_initialised) { - return; + _initialised = true; + + _valueCommand = new PerkOverrideValueCommand(getGame().getArcadeManager(), this); + _loadCommand = new PerkOverrideLoadCommand(getGame().getArcadeManager(), this); + getGame().getArcadeManager().addCommand(_valueCommand); + getGame().getArcadeManager().addCommand(_loadCommand); } - UtilServer.Unregister(this); - } - - private void setup() - { // File Name must not be null Objects.requireNonNull(_fileName); - GoogleSheetsManager manager = _game.getArcadeManager().getSheetsManager(); + // Make sure this is clear + _dataMap.clear(); + GoogleSheetsManager manager = getGame().getArcadeManager().getSheetsManager(); Map>> map = manager.getSheetData(_fileName); for (Map.Entry>> entry : map.entrySet()) @@ -71,7 +71,6 @@ public class PerkSpreadsheetModule implements Listener if (kit == null) { - manager.log("No kit found for the name " + key); continue; } @@ -104,18 +103,34 @@ public class PerkSpreadsheetModule implements Listener } } - for (Kit kit : _game.GetKits()) + for (Kit kit : getGame().GetKits()) { for (Perk perk : kit.GetPerks()) { - perk.setSpreadsheet(this); + try + { + perk.setSpreadsheet(this); + } + catch (Exception e) + { + getGame().Announce(F.main("Game", "An error occurred at Kit " + F.name(kit.GetName()) + ", Perk " + F.name(perk.GetName()) + "."), false); + return; + } } } } + @Override + public void cleanup() + { + _dataMap.clear(); + CommandCenter.Instance.removeCommand(_valueCommand); + CommandCenter.Instance.removeCommand(_loadCommand); + } + private Kit getFromName(String name) { - for (Kit kit : _game.GetKits()) + for (Kit kit : getGame().GetKits()) { if (kit.GetName().equalsIgnoreCase(name)) { @@ -144,7 +159,19 @@ public class PerkSpreadsheetModule implements Listener return kit.GetName() + "." + perk.GetName() + "." + value; } - public Map getDataMap() + public String getValue(String key) + { + String overrideValue = VALUE_OVERRIDE_MAP.get(key); + + if (overrideValue != null) + { + return overrideValue; + } + + return _dataMap.get(key); + } + + Map getDataMap() { return _dataMap; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index a727a304a..9cb65d91e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -1,10 +1,11 @@ package nautilus.game.arcade.kit; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.managers.PerkSpreadsheetModule; import org.bukkit.entity.Player; import org.bukkit.event.Listener; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.modules.perks.PerkSpreadsheetModule; + public abstract class Perk implements Listener { public ArcadeManager Manager; @@ -116,13 +117,7 @@ public abstract class Perk implements Listener private String getPerkObject(String id) { String key = _spreadsheet.getKey(Kit, this, id); - - if (!_spreadsheet.getDataMap().containsKey(key)) - { - return null; - } - - return _spreadsheet.getDataMap().get(key); + return _spreadsheet.getValue(key); } protected boolean getPerkBoolean(String id) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java index 6db946c88..41d82becd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java @@ -1,9 +1,11 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; +import java.util.Set; import org.bukkit.Effect; import org.bukkit.GameMode; +import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -12,6 +14,8 @@ import org.bukkit.event.player.PlayerToggleFlightEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; @@ -19,17 +23,19 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.events.PerkDoubleJumpEvent; import nautilus.game.arcade.kit.Perk; public class PerkDoubleJump extends Perk { + private double _power; private double _heightMax; private boolean _control; private long _recharge; private boolean _displayForce; - private HashSet _disabled = new HashSet(); + private final Set _disabled = new HashSet<>(); public PerkDoubleJump(String name) { @@ -89,14 +95,10 @@ public class PerkDoubleJump extends Perk { Player player = event.getPlayer(); - if (!hasPerk(player)) - return; - - if (Manager.isSpectator(player)) - return; - - if (player.getGameMode() == GameMode.CREATIVE) + if (!hasPerk(player) || _disabled.contains(player) || Manager.isSpectator(player) || player.getGameMode() == GameMode.CREATIVE) + { return; + } event.setCancelled(true); player.setFlying(false); @@ -104,18 +106,26 @@ public class PerkDoubleJump extends Perk //Disable Flight player.setAllowFlight(false); - //Velocity - if (_control) + PerkDoubleJumpEvent doubleJumpEvent = new PerkDoubleJumpEvent(player, _power, _heightMax, _control); + UtilServer.CallEvent(doubleJumpEvent); + + if (doubleJumpEvent.isCancelled()) { - UtilAction.velocity(player, _power, 0.2, _heightMax, true); + return; + } + + //Velocity + if (doubleJumpEvent.isControlled()) + { + UtilAction.velocity(player, doubleJumpEvent.getPower(), 0.2, doubleJumpEvent.getHeightMax(), true); } else { - UtilAction.velocity(player, player.getLocation().getDirection(), _power, true, _power, 0, _heightMax, true); + UtilAction.velocity(player, player.getLocation().getDirection(), doubleJumpEvent.getPower(), true, doubleJumpEvent.getPower(), 0, doubleJumpEvent.getHeightMax(), true); } //Sound - player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0, 16); //Recharge if (_recharge > 0) @@ -127,8 +137,10 @@ public class PerkDoubleJump extends Perk Recharge.Instance.setDisplayForce(player, GetName(), true); } } - - //Recharge.Instance.useForce(player, "Double Jump", 500); + else + { + Recharge.Instance.useForce(player, GetName(), 50); + } } @Override @@ -138,27 +150,27 @@ public class PerkDoubleJump extends Perk } @EventHandler - public void FlightUpdate(UpdateEvent event) + public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) - return; - - for (Player player : UtilServer.getPlayers()) { - if (Manager.isSpectator(player)) + return; + } + + for (Player player : UtilServer.getPlayersCollection()) + { + if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !Recharge.Instance.usable(player, GetName())) + { continue; + } - if (!hasPerk(player)) - continue; +// Block block = player.getLocation().getBlock(); - if (_recharge > 0 && !Recharge.Instance.usable(player, GetName())) - continue; - -// if (!Recharge.Instance.usable(player, "Double Jump")) -// continue; - - if (player.isOnGround() || (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && UtilBlock.solid(player.getLocation().getBlock()))) + if (UtilEnt.onBlock(player)) +// if (player.isOnGround() || UtilBlock.solid(block.getRelative(BlockFace.DOWN)) && UtilBlock.solid(block)) + { player.setAllowFlight(true); + } } } @@ -171,4 +183,5 @@ public class PerkDoubleJump extends Perk { _disabled.remove(player); } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index cb967b8ce..c2e9546a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -49,7 +49,7 @@ public class PerkLazer extends Perk private float _hitBoxRadius; private int _damageRadius; private int _damage; - private int _knockbackMagnitude; + private float _knockbackMagnitude; private double _range; private Set _active = new HashSet<>(); @@ -67,7 +67,7 @@ public class PerkLazer extends Perk _hitBoxRadius = getPerkFloat("Hit Box Radius"); _damageRadius = getPerkInt("Damage Radius"); _damage = getPerkInt("Damage"); - _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); _range = getPerkInt("Range"); } @@ -127,6 +127,7 @@ public class PerkLazer extends Perk if (player == null) { playerIterator.remove(); + continue; } if (player.isBlocking()) @@ -184,7 +185,7 @@ public class PerkLazer extends Perk particleLoop: while (!lineParticle.update()) { - for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), _hitBoxRadius)) + for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation().subtract(0, 1, 0), _hitBoxRadius)) { if (player.equals(other)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java deleted file mode 100644 index db45b760e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ /dev/null @@ -1,202 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.Effect; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - -public class PerkSeismicSlam extends Perk -{ - - private long _cooldown; - private long _time; - private int _damage; - private int _radius; - private float _knockbackMagnitude; - - private Map _live = new HashMap<>(); - - public PerkSeismicSlam() - { - super("Seismic Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" }); - } - - @Override - public void setupValues() - { - _cooldown = getPerkTime("Cooldown"); - _time = getPerkTime("Time"); - _damage = getPerkInt("Damage"); - _radius = getPerkInt("Radius"); - _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); - } - - @EventHandler - public void deactivateDeath(PlayerDeathEvent event) - { - Player player = event.getEntity(); - - if (!hasPerk(player)) - { - return; - } - - if (_live.containsKey(player)) - { - _live.remove(player); - } - } - - @EventHandler - public void Leap(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSpade(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) - return; - - // Action - Vector vec = player.getLocation().getDirection(); - if (vec.getY() < 0) - { - vec.setY(vec.getY() * -1); - } - - UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true); - - // Record - _live.put(player, System.currentTimeMillis()); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Slam(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!UtilEnt.isGrounded(player)) - { - continue; - } - - if (!_live.containsKey(player)) - { - continue; - } - - if (!UtilTime.elapsed(_live.get(player), _time)) - { - continue; - } - - _live.remove(player); - - // Action - - Map targets = UtilEnt.getInRadius(player.getLocation(), _radius); - - for (LivingEntity cur : targets.keySet()) - { - if (cur.equals(player)) - { - continue; - } - - if (UtilPlayer.isSpectator(cur)) - { - continue; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); - - // Condition - Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); - - // Inform - if (cur instanceof Player) - UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); - } - - // Effect - player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); - - for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4).keySet()) - { - if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) - { - cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getType()); - } - } - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), _knockbackMagnitude); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 31e51e04e..a6978f82c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -18,7 +18,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -279,7 +281,7 @@ public class PerkWoolBomb extends Perk implements IThrown // Inform if (cur instanceof Player && !player.equals(cur)) { - UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + UtilPlayer.message(cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); } } @@ -349,7 +351,7 @@ public class PerkWoolBomb extends Perk implements IThrown { solidify(data.getThrower(), false); } - + @Override public void ChunkUnload(ProjectileUser data) { @@ -364,7 +366,7 @@ public class PerkWoolBomb extends Perk implements IThrown return; } - Set detonate = new HashSet(); + Set detonate = new HashSet<>(); Iterator playerIterator = _active.keySet().iterator(); while (playerIterator.hasNext()) @@ -416,4 +418,26 @@ public class PerkWoolBomb extends Perk implements IThrown event.AddKnockback(GetName(), _knockbackMagnitude); } + + @EventHandler + public void playerDeath(PlayerDeathEvent event) + { + clear(event.getEntity()); + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + clear(event.getPlayer()); + } + + private void clear(Player player) + { + WoolBombData data = _active.remove(player.getUniqueId()); + + if (data != null) + { + data.restore(); + } + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java index af0f21bc4..a25b5e878 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java @@ -1,18 +1,21 @@ package nautilus.game.arcade.kit.perks.data; +import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -public class ChickenMissileData + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; + +public class ChickenMissileData { public Player Player; public Entity Chicken; public Vector Direction; public long Time; - public double LastX; - public double LastY; - public double LastZ; + public Location Last; public ChickenMissileData(Player player, Entity chicken) { @@ -24,30 +27,15 @@ public class ChickenMissileData public boolean HasHitBlock() { + Location current = Chicken.getLocation(); + //Not First Run - if (LastX != 0 && LastY != 0 && LastZ != 0) + if (Last != null && UtilMath.offsetSquared(Last, current) < 0.2 || UtilEnt.isGrounded(Chicken)) { - if (Math.abs(Chicken.getLocation().getX() - LastX) < Math.abs(Direction.getX()/10d)) - { - return true; - } - if (Math.abs(Chicken.getLocation().getY() - LastY) < Math.abs(Direction.getY()/10d)) - { - if (Direction.getY() > 0 || -0.02 > Direction.getY()) - { - return true; - } - } - if (Math.abs(Chicken.getLocation().getZ() - LastZ) < Math.abs(Direction.getZ()/10d)) - { - return true; - } + return true; } - LastX = Chicken.getLocation().getX(); - LastY = Chicken.getLocation().getY(); - LastZ = Chicken.getLocation().getZ(); - + Last = current; return false; } }