Merge branch 'feature/moba' into develop

This commit is contained in:
cnr 2017-06-14 19:55:53 -05:00
commit 05eabdbfd8
145 changed files with 15145 additions and 93 deletions

View File

@ -69,6 +69,16 @@ public class SkinData
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 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 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=");
public static final SkinData DANA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjkyMzgxMDAsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hOWRhYTg5OGVkN2E0N2YyOGFkMjVmNjk5Y2Y4MzQyODFmMTVkZTY5OWM1MWVhMTRkOWRlYzVhM2VlNzY1MiJ9fX0=", "KUI3h0MDUNWQ3avjozkw0KnZf1UAMkRHzRKY9yGS/iUh9EMmDbfLcRfBhUvR5Dd6//75Yw2tElBrvPx+VqfJk0LqMACQc71n0lDY1NzqnXbpf6vNGyuhyumjhMSjJTG3BJ8Qtdd1yCsPK2x5ym+cGPS1FevJj4Vcu6rxg9HXZokgfjD11NXEwulFuPIiWHpJlnd8NlBw4a3txlrVwDnaHo7GqYSJeM1uOCrdICdpThSA2N2mOUEmOHvH9rHUhQvkKHipbsQMIxIX4oiXDWeK6P/GtT+Iv0DIeJfQdDkhDiIG5/zUyxmpC2mma1FQIsFsQOaJfgYZLfcOXGdhwlL/OcZ9ULBIKhgSx7Ozwzsc+JKonqlaBOuaietq5z/XvMClgFG9U2a1LXc5BIgaN/ClsO0uTksuoA8H0SDx9k3EmOjaPdrJOsQ/fgWQSkWN2XniLLFiEtSOEOI58vw6ORVXDgjbP+TqD0b6/d10z0jUzS2FD7AO51LHzTw+BjqoyVef4fszNNSqMi5QEgfBl++EAolZBAMHgN7hq6k52ry2LPlO5L8sm6NoZ4DrLyrx1oFNtXZZgYvNVy7rtEpIDdQczwAZkJFV0fuz8tRH3CkW/roA5HbfX3Fv19mQoteoemrSUrOwLlQsyVPxsFsn8uX94Cw88Q5KgBCGmGY2vpXHuiI=");
public static final SkinData BARDOLF = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjkxMTE4NjEsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84MjUxNjZmNzc0ZjcyNmZmMDE3NTQ3OTk0NDc0MGYxNjRmMTZmYmI2M2I3NGI3NmNmNzk0NDMxZGZkNzUyIn19fQ==", "W8TO4M/IQ4rQ91627EaudboKwR8TuKTp5mAYOCyOJLCD0vyyEJmnZFy1Hv9HlXKiXsEm9iC36+cmQ8JfSE0JlIfU2vRH5qbXUL4HUHZi20SHVA5YKM2ztxI9uouc14ctv8pxlhT/huKxYNgB/eJR+ckT1gyc78RBoJj5YLwUTsptO87KE/vFg9hbHVo5lVSdk//jhfDsMRyf0RXp/wKZ1KGxaRA5hWQUc86mLJTiQU1EBVh3Lfb2zUq2w/gpLCoxdwiX8KnNuX1a1iC8pFCZm4VJ20yvNPaIgzFYDFfNQO6Vwv9fcLsdxVH819cEkjxg5do9MpZBj1OVmaWnTmQ4w4r3iKFzL6LMae4eOEyA/vJ8e7mbWUNrxM3+EPUPlxpG/NKr2VsR2ihIIF9GTduBZa2ayj7BJAkL9UK5PEGh/UxG6jf0YS7RjQ9ROaRgmTLMFsOVnQlFlp2UFRTe+heh/woD8/QSpd9MELdWFzeKRAlo7+hvo5AfWyjBI/3e9PIJfCXp+nF3Z92HKoR5V0m9QoYu2WGzbkhU49DJF7n+Bnd3ur0qefHFVl3USdVU2DJLcdcKU+Qn5G6E8NSy/3TVkjDg6u/o38b203b0tUBZNftAYYmCCpx/HVMEoNC03orIBPrwGYD6g//RC1TZ2ZxkLDU4QxeaM6neWq1xryXbvS4=");
public static final SkinData BARDOLF_WEREWOLF = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjkxODMxOTAsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9kNzc0ZGY3OWU1OGFiNDQ5OGQ2YzY3ZTdlMjY2NWFjZmE2OTViOWNjOWNkZTE1MmQ3ZTVlM2NjMTUyNzM5In19fQ==", "nqc7IdRVa2RF2SZXRli/HVhw7q5NfY7rnZFWbDyzjQ90Y/H6NWhb+9gwDDdnh7B1WolyptyUnukzTOQmrAcSecVO5vblhCTYY8PEOfcwUKznjpCmL/BgXdzBoYJHs43HFbtvzt3yhshcQ8Wvh7mtdmNu0MEYKbIX7lTqcfSoUbDk+A1PZDINuOF5RM8disGCrkq6WTdLij+k7pd3e7MJhtf8vJbtSoo5TjfzyzJyFvEvZqa+3lxobbPA9Z4cels0DVWVU8I/FEJhB29aSVXDVAZps3vWUr1sLMM9+PRaZdxHPZfNHx6q9R3oHXgjAlqzJwkljtJGExyOV+vOHEUuxrytdwMcW0XGjalukHVJ1A9DCgNMZqAXEbfYKk+BsN2BzOwT/+dtGfsOU+Rq7Kzp1/iit9saQy1QEG8Bynj6A2Vmg9XZsvbYsXZXsE+qNG6TOADEV0yrS9icEhLhOnO0re/+wE4Zsd5WDF51e87+ugvoH3iM4zrzvaWQb6McgxD/wlYlJyVHD+2f5VYCIw2yacNXp6LaZuXpfQyyDCqpHAosTYNLxWwjinl05C/TprQw+sZoLHFCGbVFQjTPEkDhQzG73PHecnO5Px3USBVleDoTb1kZfq6J2wJ1B1/7MTBW21Din3j2DmmuAVUNJYe6kifaNOhY1ghG2WVRNdIf1b4=");
public static final SkinData LARISSA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjE0MTUxMzQsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYThjNDRhOWVmZTY3NzExMDYzMjM5ODEwNDRmOTdjYmM1OWJmZmRlOGI1ODdlMGQzMWE4N2ViMDhhMmExZiJ9fX0=", "Lyac51CrnMK/CI2dWgGQLowAm/ZnQMpf0Ict/gqVrUgJVlGWDIVG77Rd1JyMQDEeESvTmoyivH+usiO0ePW95qjisqT3R43YEmLi85CqctGYqLKeSYpGYwYRz8Euw57LwJAALKOMLhVc2s4h2Or9nTecunG8KSmkCuZc4H1qh3frU+ltuV4HLqgdFUULbIHTggyvqiINov2tBqkkXeEjT7sOcTJCJNgNYU2O7//qg5kJmhso2CKHlRLpmy9LsaUK/Z+BzUmoRbwQgSwr3mz7dFAdlVWWKvKNcgX3nt1et0DIig3JKYmrnQX2Fprg+kWcr3nuizzLgjVwAlADC48P3DN0s/VBty2AYoWie16VNPIM+CV4BF2JRQ34GxZ8XceXbCKURrOjoCBgLGHvIhRW35eicoh26xp3/mwLvk5anPi5StJ/qEuzWJALeWcNbLsnt21m2MZp9h/MxaY6ftWOTzjTr5CYVd/teJyscMnGK4+lcV1dlt12lhbDMv6I+iz8iG9NIzuW5OvGkax90dA/Gq+Cd9FXVThPY4ufxWttHcTqgPB64GfMn6rywRm1B0eO1pJpYc/KlJZlW/PuaO8L1assyJs5KkOypBSy3zc6TO6pzgeOZv+VpQfA/UWpogv6ofmTpgdtwpjLFGSzIKTDXvF6FftALKVlYypG0fYbssA=");
public static final SkinData ROWENA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0Njk1MTcxOTgsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jNDY1OGExODY4YzNhNjhhZWVhZmZkOTUxZDQyYmZkN2QxYTRjNGZjNDJjZDI2YTlmYzhkNTNmOTkxMTM1ZCJ9fX0=", "OqXMyH9SMmQ/Pwmb21In29YnCxbsN6yqUxfudN6KNgDwRUK6y072XhW6TIoTh9JQLAUKftpeVB53tk0LxHIxnsuBMrIHvETPDQFysIc/6xq3ABogs+zqFzcp5jk6S73HiD78JxLq5pzfUzhgDPMPuZP5Q/u2q1rYbe6B9lVEJ5sUcxBLUTossgucoR4qXYAlWVQdHRhq85Ol8a+OU7ruw3HackNGto6wt6u2MigCtiHVTt9XhJ/AJE4ScodQ3XwW4L6urpl/lV2OMCsr3mCjjjEz2EMhDbCWxrAorQ9aPpMbDkHBS+4TC1tbMGUlKhj5n+EZBYVaeLr4NGPACPSdT35p/2Zra49+DXn9Xn+681yNEB0ghTdsnsgwXg76+HVPHPqRHQMuTBQGQyGZaaTX/zE0tFjH+osMElLdb8dmz3dC7kQA4A13B2phj3YbMSF1FoU4GvnPKIQn6JIuEd6hd+pRLUW7Y+mgYIHHX1FT0ihrXAyVO6lQQ6rs92gSQr7sxC7tnhPSMFcmh7OcJYcbRpn97GMubthPLanOhVy7CKqjmwIkEVtYgP28idigKwNJ+sJuUONrOu7nMKl1UTD5EEapOacc/np6UhdSw8yW+LnWD/x9ueYz9ksnyRrJgcOa41izo/WCbjPK/j3JVezr9Q3x1yveWuFmdl7CGYdXngw=");
public static final SkinData BIFF = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjEzMDQzNjYsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9mOWMyMTE3ZDY0ZWE0ZmUxMWZiY2NhZmE2YzU5YzhlZjY3NDVkZjVkMTZjM2QwMmI4NmI2OTlmZWJjNTA0OGI1In19fQ==", "mJMpEvQ4A02z0S/chgLm5bKrrrd+zmp7A0012AB7b3KlyIHoLKEDDz+ZJgJtvN6skOqed3P+yNVqkxitugXaZZP8Af9J+/TseHn+vOy6CTK5tykRSY3Zb8Zmw1kn36v/SARAVtDIHD53yuPgJayYSAbVB7aknj1Q8XBQGUmZRMRxWWxeD7rQTOwgRYI4YJeKFf4UL9i6zxvOJuHsOAouJ7scu7VohG8vgR77Js/Z8rSu8/aSG+O9AQdzP6h9ixYNFkkQOHm7DseK/5tsWKHM4FYBgjIDKt3ApQokSbhThzGB55BA1qjXZkfCoOb13y1nOMC8WoIL6Ees1qzxG3VloGx2WAZLh+Q+/irwrFDMxk1zeU5fIRuj1c/UIM2HKdxxWgoRdrZ8ww/Jrll6maiOBx7geMn/0aOUbJ2U7gkTif6RG6YNS5YN9ZQDLh72l/akJMxF3SlmuAPmLs2kBghQ6eD2YQKuxWR/Hf1yS1YXtogFVNsGnzC1nda7F48EGL3zI+kCajbDlAGQ32aRt0btbEQ+Gj575kir3Aa53qiZ0YOIYQlhgZdOsTN2NE2s8uuy/15Rgc6K3ydgEmSZfdqyMyW0Dy7pE5TfVL8DumKRVRXdOceT5WfnW7MyqSmdorP5ab1fw2wLOnAVzhJmW8oXXNSs77WJ1/PURclxOWB4IF8=");
// Comments this out for now, so it doesn't load the player profile // Comments this out for now, so it doesn't load the player profile
// A better way to do this would check for the properties when getting the skull or the skin // A better way to do this would check for the properties when getting the skull or the skin
// Might change on the next version // Might change on the next version

View File

@ -258,11 +258,9 @@ public class UtilParticle
} }
} }
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleType.particle, displayFar, return new PacketPlayOutWorldParticles(particleType.particle, displayFar,
(float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed,
count, details); count, details);
return packet;
} }
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY,

View File

@ -654,7 +654,7 @@ public class UtilPlayer
continue; continue;
} }
double dist = UtilMath.offset(cur.getLocation(), loc); double dist = UtilMath.offsetSquared(cur.getLocation(), loc);
if (best == null || dist < bestDist) if (best == null || dist < bestDist)
{ {

View File

@ -31,10 +31,16 @@ public class LineParticle
private double _maxRange; private double _maxRange;
private Set<Material> _ignoredTypes; private Set<Material> _ignoredTypes;
private boolean _ignoreAllBlocks;
private ParticleType _particleType; private ParticleType _particleType;
private Player[] _toDisplay; private Player[] _toDisplay;
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, ParticleType particleType, Player... toDisplay)
{
this(start, null, direction, incrementedRange, maxRange, null, particleType, toDisplay);
}
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay) public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay)
{ {
this(start, null, direction, incrementedRange, maxRange, ignoredTypes, particleType, toDisplay); this(start, null, direction, incrementedRange, maxRange, ignoredTypes, particleType, toDisplay);
@ -73,7 +79,7 @@ public class LineParticle
Location newTarget = _start.clone().add(new Vector(0, 0.2, 0)).add(_direction.clone().multiply(_curRange)); Location newTarget = _start.clone().add(new Vector(0, 0.2, 0)).add(_direction.clone().multiply(_curRange));
_lastLocation = newTarget; _lastLocation = newTarget;
if (!(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())) if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType()))
{ {
@ -88,6 +94,11 @@ public class LineParticle
return done; return done;
} }
public void setIgnoreAllBlocks(boolean b)
{
_ignoreAllBlocks = b;
}
public Location getLastLocation() public Location getLastLocation()
{ {
return _lastLocation; return _lastLocation;

View File

@ -217,7 +217,11 @@ public enum AchievementCategory
GEM_HUNTERS("Gem Hunters", null, GEM_HUNTERS("Gem Hunters", null,
new StatDisplay[] {StatDisplay.KILLS, StatDisplay.GEMS_EARNED, StatDisplay.fromGame("Quests Completed", GameDisplay.GemHunters, "QuestsCompleted"), StatDisplay.fromGame("Chests Opened", GameDisplay.GemHunters, "ChestsOpened")}, new StatDisplay[] {StatDisplay.KILLS, StatDisplay.GEMS_EARNED, StatDisplay.fromGame("Quests Completed", GameDisplay.GemHunters, "QuestsCompleted"), StatDisplay.fromGame("Chests Opened", GameDisplay.GemHunters, "ChestsOpened")},
Material.EMERALD, 0, GameCategory.SURVIVAL, null, false, GameDisplay.GemHunters.getGameId()); Material.EMERALD, 0, GameCategory.SURVIVAL, null, false, GameDisplay.GemHunters.getGameId()),
MOBA("Heroes Of Gwen", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, StatDisplay.fromGame("Gold Earned", GameDisplay.MOBA, "GoldEarned")},
Material.PRISMARINE_SHARD, 0, GameCategory.CLASSICS, null, false, GameDisplay.MOBA.getGameId());
private String _name; private String _name;
private String[] _statsToPull; private String[] _statsToPull;

View File

@ -51,7 +51,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
protected void buildPage() protected void buildPage()
{ {
ArrayList<Integer> pageLayout = new ItemLayout( ArrayList<Integer> pageLayout = new ItemLayout(
"XXOXOXOXO", "OXOXOXOXO",
"OXOXOXOXO", "OXOXOXOXO",
"OXOXOXOXO", "OXOXOXOXO",
"OXOXOXOXO", "OXOXOXOXO",

View File

@ -33,7 +33,7 @@ public class FallingBlocks extends MiniPlugin
if (vec.getY() < 0) if (vec.getY() < 0)
{ {
vec.setY(vec.getY() * -1); vec.setY(-vec.getY());
} }
Spawn(location, type, data, vec); Spawn(location, type, data, vec);
@ -46,7 +46,6 @@ public class FallingBlocks extends MiniPlugin
UtilAction.velocity(fall, velocity, 0.5 + 0.25 * Math.random(), false, 0, 0.4 + 0.20 * Math.random(), 10, false); UtilAction.velocity(fall, velocity, 0.5 + 0.25 * Math.random(), false, 0, 0.4 + 0.20 * Math.random(), 10, false);
fall.setMetadata(METADATA, new FixedMetadataValue(_plugin, "x"));
UtilEnt.SetMetadata(fall, METADATA, "x"); UtilEnt.SetMetadata(fall, METADATA, "x");
} }

View File

@ -20,7 +20,7 @@ public class ParticleCoalFumes extends ParticleGadget
public ParticleCoalFumes(GadgetManager manager) public ParticleCoalFumes(GadgetManager manager)
{ {
super(manager, "Coal Fumes", super(manager, "Coal Fumes",
UtilText.splitLineToArray(C.cGray + "Being on the Naughty List does have some perks... if you love coal, that is...", LineFormat.LORE), UtilText.splitLineToArray(C.cGray + "Being on the Naughty List does have some hattori... if you love coal, that is...", LineFormat.LORE),
-1, Material.COAL, (byte) 0); -1, Material.COAL, (byte) 0);
} }

View File

@ -104,6 +104,8 @@ public enum GameDisplay
AlienInvasion("Alien Invasion", Material.ENDER_STONE, (byte) 0, GameCategory.EVENT, 69, false), AlienInvasion("Alien Invasion", Material.ENDER_STONE, (byte) 0, GameCategory.EVENT, 69, false),
MOBA("Heroes of GWEN", Material.SKULL_ITEM, (byte)1, GameCategory.CLASSICS, 70, true),
GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.SURVIVAL, 71, false), GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.SURVIVAL, 71, false),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999, false), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999, false),

View File

@ -1,13 +1,7 @@
package mineplex.core.itemstack; package mineplex.core.itemstack;
import java.util.ArrayList; import mineplex.core.common.util.C;
import java.util.Arrays; import mineplex.core.common.util.UtilInv;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
@ -21,10 +15,18 @@ import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.FireworkEffectMeta; import org.bukkit.inventory.meta.FireworkEffectMeta;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.PotionEffect;
import mineplex.core.common.util.C; import java.util.ArrayList;
import mineplex.core.common.util.UtilInv; import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class ItemBuilder public class ItemBuilder
{ {
@ -53,14 +55,15 @@ public class ItemBuilder
private Color _color; private Color _color;
private short _data; private short _data;
private short _durability; private short _durability;
private final HashMap<Enchantment, Integer> _enchants = new HashMap<Enchantment, Integer>(); private final Map<Enchantment, Integer> _enchants = new HashMap<>();
private final List<String> _lore = new ArrayList<String>(); private final List<String> _lore = new ArrayList<>();
private Material _mat; private Material _mat;
private String _title = null; private String _title = null;
private boolean _unbreakable; private boolean _unbreakable;
private boolean _glow; private boolean _glow;
private String _playerHeadName = null; private String _playerHeadName = null;
private HashSet<ItemFlag> _itemFlags = new HashSet<ItemFlag>(); private Set<ItemFlag> _itemFlags = new HashSet<>();
private List<PotionEffect> _potionEffects = new ArrayList<>();
public ItemBuilder(ItemStack item) public ItemBuilder(ItemStack item)
{ {
@ -86,6 +89,13 @@ public class ItemBuilder
{ {
setColor(((LeatherArmorMeta) meta).getColor()); setColor(((LeatherArmorMeta) meta).getColor());
} }
else if (meta instanceof PotionMeta)
{
for (PotionEffect effect : ((PotionMeta) meta).getCustomEffects())
{
addPotionEffect(effect);
}
}
_itemFlags.addAll(meta.getItemFlags()); _itemFlags.addAll(meta.getItemFlags());
@ -124,7 +134,7 @@ public class ItemBuilder
return this; return this;
} }
public HashSet<ItemFlag> getItemFlags() public Set<ItemFlag> getItemFlags()
{ {
return _itemFlags; return _itemFlags;
} }
@ -279,6 +289,22 @@ public class ItemBuilder
{ {
((BannerMeta) meta).setBaseColor(DyeColor.getByColor(_color)); ((BannerMeta) meta).setBaseColor(DyeColor.getByColor(_color));
} }
else if (meta instanceof PotionMeta)
{
PotionMeta potionMeta = (PotionMeta) meta;
for (PotionEffect effect : _potionEffects)
{
potionMeta.addCustomEffect(effect, true);
}
if (!_potionEffects.isEmpty())
{
potionMeta.setMainEffect(_potionEffects.get(0).getType());
}
meta = potionMeta;
}
meta.addItemFlags(getItemFlags().toArray(new ItemFlag[0])); meta.addItemFlags(getItemFlags().toArray(new ItemFlag[0]));
meta.spigot().setUnbreakable(isUnbreakable()); meta.spigot().setUnbreakable(isUnbreakable());
@ -307,7 +333,7 @@ public class ItemBuilder
} }
newBuilder.setColor(_color); newBuilder.setColor(_color);
// newBuilder.potion = potion;
newBuilder.setDurability(_durability); newBuilder.setDurability(_durability);
newBuilder.setData(_data); newBuilder.setData(_data);
@ -322,10 +348,15 @@ public class ItemBuilder
newBuilder.setPlayerHead(_playerHeadName); newBuilder.setPlayerHead(_playerHeadName);
for (PotionEffect potionEffect : _potionEffects)
{
newBuilder.addPotionEffect(potionEffect);
}
return newBuilder; return newBuilder;
} }
public HashMap<Enchantment, Integer> getAllEnchantments() public Map<Enchantment, Integer> getAllEnchantments()
{ {
return _enchants; return _enchants;
} }
@ -452,4 +483,9 @@ public class ItemBuilder
return this; return this;
} }
public ItemBuilder addPotionEffect(PotionEffect effect)
{
_potionEffects.add(effect);
return this;
}
} }

View File

@ -674,7 +674,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
_lastPlayerCount = playerCount; _lastPlayerCount = playerCount;
Bukkit.getOnlinePlayers().stream().filter(player -> _clientManager.Get(player).GetRank() == Rank.ALL).forEach(player -> Bukkit.getOnlinePlayers().stream().filter(player -> _clientManager.Get(player).GetRank() == Rank.ALL).forEach(player ->
{ {
UtilTextBottom.display(C.cGray + "Visit " + F.elem("http://www.mineplex.com/shop") + " for exclusive perks!", player); UtilTextBottom.display(C.cGray + "Visit " + F.elem("http://www.mineplex.com/shop") + " for exclusive hattori!", player);
}); });
} }

View File

@ -44,6 +44,7 @@ public enum GameType
MineWare("MineWare"), MineWare("MineWare"),
MinecraftLeague("MCL"), MinecraftLeague("MCL"),
MilkCow("Milk the Cow"), MilkCow("Milk the Cow"),
HOG("Heroes of GWEN"),
MonsterLeague("MonsterLeague"), MonsterLeague("MonsterLeague"),
MonsterMaze("Monster Maze"), MonsterMaze("Monster Maze"),
Paintball("Super Paintball"), Paintball("Super Paintball"),

View File

@ -100,7 +100,7 @@ public class CustomDamageEvent extends Event implements Cancellable
public void AddMod(String source, double mod) public void AddMod(String source, double mod)
{ {
AddMod(source, new String(), mod, false); AddMod(source, "", mod, false);
} }
public void AddMod(String source, String reason, double mod, boolean useAttackName) public void AddMod(String source, String reason, double mod, boolean useAttackName)

View File

@ -419,6 +419,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@Override @Override
public void handlePlayerJoin(String playerName) public void handlePlayerJoin(String playerName)
{ {
if (GetGame() != null && GetGame().GetState() != GameState.Loading && GetGame().GetState() != GameState.Recruit && GetGame().UseCustomScoreboard)
{
return;
}
CoreClient client = GetClients().Get(playerName); CoreClient client = GetClients().Get(playerName);
for (MineplexScoreboard scoreboard : getScoreboards().values()) for (MineplexScoreboard scoreboard : getScoreboards().values())
@ -1225,6 +1230,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(false); player.setAllowFlight(false);
player.setFlySpeed(0.1F); player.setFlySpeed(0.1F);
player.setWalkSpeed(0.2F);
UtilInv.Clear(player); UtilInv.Clear(player);

View File

@ -1,14 +1,11 @@
package nautilus.game.arcade; package nautilus.game.arcade;
import nautilus.game.arcade.game.games.alieninvasion.AlienInvasion;
import nautilus.game.arcade.game.games.smash.SuperSmashTraining;
import org.bukkit.Material;
import mineplex.core.common.MinecraftVersion; import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.game.GameCategory; import mineplex.core.game.GameCategory;
import mineplex.core.game.GameDisplay; import mineplex.core.game.GameDisplay;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.alieninvasion.AlienInvasion;
import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl; import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl;
import nautilus.game.arcade.game.games.barbarians.Barbarians; import nautilus.game.arcade.game.games.barbarians.Barbarians;
import nautilus.game.arcade.game.games.basketball.Basketball; import nautilus.game.arcade.game.games.basketball.Basketball;
@ -65,6 +62,7 @@ import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minestrike.Minestrike; import nautilus.game.arcade.game.games.minestrike.Minestrike;
import nautilus.game.arcade.game.games.minestrike.modes.SuperPaintstrike; import nautilus.game.arcade.game.games.minestrike.modes.SuperPaintstrike;
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.monsterleague.MonsterLeague; import nautilus.game.arcade.game.games.monsterleague.MonsterLeague;
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
import nautilus.game.arcade.game.games.oldmineware.OldMineWare; import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
@ -93,6 +91,7 @@ import nautilus.game.arcade.game.games.skywars.modes.SkySmash;
import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars; import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars;
import nautilus.game.arcade.game.games.smash.SoloSuperSmash; import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
import nautilus.game.arcade.game.games.smash.SuperSmashDominate; import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
import nautilus.game.arcade.game.games.smash.SuperSmashTraining;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.modes.RandomKitSSM; import nautilus.game.arcade.game.games.smash.modes.RandomKitSSM;
import nautilus.game.arcade.game.games.snake.Snake; import nautilus.game.arcade.game.games.snake.Snake;
@ -124,6 +123,7 @@ import nautilus.game.arcade.game.games.valentines.Valentines;
import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
import org.bukkit.Material;
public enum GameType public enum GameType
{ {
@ -232,6 +232,8 @@ public enum GameType
AlienInvasion(AlienInvasion.class, GameDisplay.AlienInvasion), AlienInvasion(AlienInvasion.class, GameDisplay.AlienInvasion),
MOBA(Moba.class, GameDisplay.MOBA),
Event(EventGame.class, GameDisplay.Event, new GameType[]{ Event(EventGame.class, GameDisplay.Event, new GameType[]{
GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build, GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas, GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,

View File

@ -145,6 +145,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
// Scoreboard // Scoreboard
protected GameScoreboard Scoreboard; protected GameScoreboard Scoreboard;
public boolean UseCustomScoreboard = false;
// Loaded from Map Config // Loaded from Map Config
public WorldData WorldData = null; public WorldData WorldData = null;
@ -227,7 +228,6 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public int HealthSet = -1; public int HealthSet = -1;
public boolean SpawnTeleport = true; public boolean SpawnTeleport = true;
public boolean PrepareFreeze = true;
private double _itemMergeRadius = 0; private double _itemMergeRadius = 0;
@ -263,7 +263,10 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public boolean AllowParticles = true; public boolean AllowParticles = true;
public boolean Prepare = true;
public long PrepareTime = 9000; public long PrepareTime = 9000;
public boolean PrepareFreeze = true;
public boolean PrepareAutoAnnounce = true;
public boolean PlaySoundGameStart = true; public boolean PlaySoundGameStart = true;
public double XpMult = 1; public double XpMult = 1;

View File

@ -19,7 +19,7 @@ public class KitEnderman
// @Override // @Override
// protected void giveItems(Player player) // protected void giveItems(Player player)
// { // {
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); // player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
// //
// player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); // player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f);
// //

View File

@ -34,7 +34,7 @@ public class KitSkeleton
// player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); // player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build());
// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); // player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build());
// //
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); // player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
// //
// player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); // player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f);
// //

View File

@ -42,9 +42,9 @@ public class KitJetpack extends ProgressingKit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
//player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SHEARS, (byte)0, 1, "Block Cannon")); //player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.SHEARS, (byte)0, 1, "Block Cannon"));
//player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter")); //player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter"));
//player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows")); //player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows"));
player.getInventory().addItem(PLAYER_ITEMS); player.getInventory().addItem(PLAYER_ITEMS);
player.getInventory().setArmorContents(PLAYER_ARMOR); player.getInventory().setArmorContents(PLAYER_ARMOR);
} }

View File

@ -1470,7 +1470,7 @@ public class MinecraftLeague extends RankedTeamGame
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLUE).setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLUE).setUnbreakable(true).build());
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5)); //player.getInventory().addSkillItem(new ItemStack(Material.COOKED_BEEF, 5));
_blockLock.put(player, new BlockProtection(this, player)); _blockLock.put(player, new BlockProtection(this, player));
_noFall.add(player); _noFall.add(player);
} }
@ -1482,7 +1482,7 @@ public class MinecraftLeague extends RankedTeamGame
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.RED).setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.RED).setUnbreakable(true).build());
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5)); //player.getInventory().addSkillItem(new ItemStack(Material.COOKED_BEEF, 5));
_blockLock.put(player, new BlockProtection(this, player)); _blockLock.put(player, new BlockProtection(this, player));
_noFall.add(player); _noFall.add(player);
} }

View File

@ -1,50 +1,784 @@
package nautilus.game.arcade.game.games.moba; package nautilus.game.arcade.game.games.moba;
import java.util.ArrayList; import mineplex.core.Managers;
import mineplex.core.beta.BetaWhitelist;
import mineplex.core.common.Pair;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.leaderboard.Leaderboard;
import mineplex.core.leaderboard.LeaderboardManager;
import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.sheep.kits.*; import nautilus.game.arcade.game.games.moba.boss.BossManager;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.fountain.MobaFountain;
import nautilus.game.arcade.game.games.moba.general.ArrowKBManager;
import nautilus.game.arcade.game.games.moba.general.BetaManager;
import nautilus.game.arcade.game.games.moba.general.EnderPearlManager;
import nautilus.game.arcade.game.games.moba.general.MobaDamageManager;
import nautilus.game.arcade.game.games.moba.gold.GoldManager;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.KitPlayer;
import nautilus.game.arcade.game.games.moba.kit.anath.HeroAnath;
import nautilus.game.arcade.game.games.moba.kit.bardolf.HeroBardolf;
import nautilus.game.arcade.game.games.moba.kit.biff.HeroBiff;
import nautilus.game.arcade.game.games.moba.kit.bob.HeroBob;
import nautilus.game.arcade.game.games.moba.kit.dana.HeroDana;
import nautilus.game.arcade.game.games.moba.kit.devon.HeroDevon;
import nautilus.game.arcade.game.games.moba.kit.hattori.HeroHattori;
import nautilus.game.arcade.game.games.moba.kit.hp.HPManager;
import nautilus.game.arcade.game.games.moba.kit.larissa.HeroLarissa;
import nautilus.game.arcade.game.games.moba.kit.rowena.HeroRowena;
import nautilus.game.arcade.game.games.moba.minion.MinionManager;
import nautilus.game.arcade.game.games.moba.prepare.PrepareManager;
import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection;
import nautilus.game.arcade.game.games.moba.recall.Recall;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePointManager;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import nautilus.game.arcade.game.modules.CustomScoreboardModule;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
import nautilus.game.arcade.scoreboard.GameScoreboard;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
public class Moba extends TeamGame public class Moba extends TeamGame
{ {
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private static final String[] DESCRIPTION = {
"..."
};
private static final long PREPARE_TIME = TimeUnit.MINUTES.toMillis(1);
private final HeroKit[] _kits;
private final Set<MobaPlayer> _playerData = new HashSet<>();
private final Set<Listener> _listeners = new HashSet<>();
private final MobaShop _shop;
private final GoldManager _goldManager;
private final BossManager _boss;
private final TowerManager _tower;
private final CapturePointManager _capturePoint;
private final ArrowKBManager _arrowKb;
private final BuffManager _buffs;
private final BetaWhitelist _betaWhitelist;
public Moba(ArcadeManager manager) public Moba(ArcadeManager manager)
{ {
super(manager, GameType.Sheep, super(manager, GameType.MOBA, new Kit[]{new KitPlayer(manager)}, DESCRIPTION);
new Kit[] _kits = new HeroKit[]{
{ new HeroHattori(Manager),
new NullKit(manager) new HeroDevon(Manager),
}, new HeroAnath(Manager),
new HeroDana(Manager),
new HeroBiff(Manager),
new HeroLarissa(Manager),
new HeroBardolf(Manager),
new HeroRowena(Manager),
new HeroBob(Manager)
};
new String[] AllowParticles = false;
{ DontAllowOverfill = true;
"..." PrepareAutoAnnounce = false;
}); PrepareFreeze = false;
PrepareTime = PREPARE_TIME;
DeathOut = false;
DeathSpectateSecs = 12;
HungerSet = 20;
DamageFall = false;
this.DeathOut = false; manager.getCosmeticManager().setHideParticles(true);
this.DeathSpectateSecs = 8; manager.GetCreature().SetDisableCustomDrops(true);
this.HungerSet = 20; // Instantiate managers
registerChatStats(); // Global managers
_shop = registerManager(new MobaShop(this));
_goldManager = registerManager(new GoldManager(this));
registerManager(new HPManager(this));
registerManager(new MobaDamageManager(this));
registerManager(new MobaFountain(this));
registerManager(new Recall(this));
// Pregame managers
registerManager(new PrepareManager(this));
registerManager(new PrepareSelection(this));
// Bosses
_boss = registerManager(new BossManager(this));
// Structures
_tower = registerManager(new TowerManager(this));
_capturePoint = registerManager(new CapturePointManager(this));
// Minions
registerManager(new MinionManager(this));
// Arrow Knockback
_arrowKb = registerManager(new ArrowKBManager(this));
// Ender Pearls
registerManager(new EnderPearlManager());
// Buffs
_buffs = registerManager(new BuffManager());
// Beta Message
registerManager(new BetaManager(this));
// Beta Whitelist
_betaWhitelist = new BetaWhitelist(manager.GetClients(), manager.getBonusManager().getPowerPlayClubRepository());
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)
.setGiveCompassToAlive(false) .setGiveCompassToAlive(false)
.register(this); .register(this);
new CustomScoreboardModule()
.setSidebar((player, scoreboard) ->
{
GameState state = GetState();
switch (state)
{
case Prepare:
writePrepare(player, scoreboard);
break;
case Live:
writeLive(player, scoreboard);
break;
case End:
case WinRoom:
writeEnd(player, scoreboard);
break;
}
})
.setPrefix((perspective, subject) ->
{
if (!IsAlive(subject))
{
return C.cGray;
}
GameTeam team = GetTeam(subject);
return team.GetColor().toString();
})
.setSuffix((perspective, subject) ->
{
GameState state = GetState();
GameTeam perspectiveTeam = GetTeam(perspective);
GameTeam subjectTeam = GetTeam(subject);
if (!IsAlive(subject) || perspectiveTeam == null || subjectTeam == null)
{
return "";
}
MobaPlayer mobaPlayer = getMobaData(subject);
String suffix;
if (state == GameState.Prepare && !perspectiveTeam.equals(subjectTeam))
{
suffix = C.cYellow + " Unknown";
}
else if (mobaPlayer.getKit() == null)
{
suffix = C.cYellow + " Selecting";
}
else
{
suffix = mobaPlayer.getRole().getChatColor() + " " + mobaPlayer.getKit().GetName();
}
return suffix + C.Reset;
})
.setUnderNameObjective(C.cRed + "")
.setUnderName((perspective, subject) ->
(int) (Math.ceil(subject.getHealth() / 2D)))
.register(this);
registerDebugCommand(new DebugCommand("kit", Rank.ADMIN)
{
@Override
public void Execute(Player caller, String[] args)
{
StringBuilder builder = new StringBuilder();
for (String arg : args)
{
builder.append(arg).append(" ");
}
String kit = builder.toString().trim();
for (Kit kits : _kits)
{
if (kit.equalsIgnoreCase(kits.GetName()))
{
SetKit(caller, kits, true);
return;
}
}
caller.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
}
});
}
private <T extends Listener> T registerManager(T listener)
{
_listeners.add(listener);
return listener;
} }
@Override @Override
public void ParseData() public void ParseData()
{ {
// Register all "Managers"
_listeners.forEach(UtilServer::RegisterEvents);
// Make all spawns face the center of the map
for (List<Location> locations : WorldData.SpawnLocs.values())
{
locations.forEach(location -> location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, GetSpectatorLocation()))));
}
SpectatorSpawn = WorldData.GetCustomLocs("CENTER").get(0);
// Leaderboards
if (Manager.IsRewardStats())
{
if (Manager.GetLobby() instanceof NewGameLobbyManager)
{
Map<String, List<Location>> lobbyCustomLocs = ((NewGameLobbyManager) Manager.GetLobby()).getCustomLocs();
LeaderboardManager leaderboard = Managers.get(LeaderboardManager.class);
Pair<String, String> winPair = Pair.create("Win", "Wins");
Pair<String, String> killPair = Pair.create("Kill", "Kills");
Pair<String, String> goldPair = Pair.create("Gold", "Gold");
{
Location location = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0);
leaderboard.registerLeaderboard("TOP_HOG_DAILY_WINS", new Leaderboard("Top Daily Wins", winPair, new String[]{GetName() + ".Wins"}, LeaderboardSQLType.DAILY, location, 10));
}
{
Location location = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0);
leaderboard.registerLeaderboard("TOP_HOG_DAILY_KILLS", new Leaderboard("Top Daily Kills", killPair, new String[]{GetName() + ".Kills"}, LeaderboardSQLType.DAILY, location, 10));
}
{
Location location = lobbyCustomLocs.get("TOP_DAILY_GOLD").get(0);
leaderboard.registerLeaderboard("TOP_HOG_DAILY_GOLD", new Leaderboard("Top Daily Gold Earned", goldPair, new String[]{GetName() + ".GoldEarned"}, LeaderboardSQLType.DAILY, location, 10));
}
{
Location location = lobbyCustomLocs.get("TOP_WINS").get(0);
leaderboard.registerLeaderboard("TOP_HOG_WINS", new Leaderboard("Top Wins", winPair, new String[]{GetName() + ".Wins"}, LeaderboardSQLType.ALL, location, 10));
}
{
Location location = lobbyCustomLocs.get("TOP_KILLS").get(0);
leaderboard.registerLeaderboard("TOP_HOG_KILLS", new Leaderboard("Top Kills", killPair, new String[]{GetName() + ".Kills"}, LeaderboardSQLType.ALL, location, 10));
}
{
Location location = lobbyCustomLocs.get("TOP_GOLD").get(0);
leaderboard.registerLeaderboard("TOP_HOG_GOLD", new Leaderboard("Top Gold Earned", goldPair, new String[]{GetName() + ".GoldEarned"}, LeaderboardSQLType.ALL, location, 10));
}
}
}
}
private void writePrepare(Player player, GameScoreboard scoreboard)
{
MobaPlayer mobaPlayer = getMobaData(player);
scoreboard.writeNewLine();
scoreboard.write(C.cYellowB + "Hero Selection");
scoreboard.write(UtilTime.MakeStr(GetStateTime() + PREPARE_TIME - System.currentTimeMillis()));
scoreboard.writeNewLine();
scoreboard.write(C.cYellowB + "Hero");
scoreboard.write((mobaPlayer == null || mobaPlayer.getKit() == null) ? "Unselected " : mobaPlayer.getKit().GetName() + " (" + mobaPlayer.getRole().getName() + ")");
scoreboard.writeNewLine();
scoreboard.write(C.cYellowB + "Players");
int kits = 0;
for (MobaPlayer otherMobaPlayer : _playerData)
{
if (otherMobaPlayer.getKit() != null)
{
kits++;
}
}
scoreboard.write(kits + "/" + GetPlayers(true).size());
scoreboard.writeNewLine();
}
private void writeLive(Player player, GameScoreboard scoreboard)
{
GameTeam team = GetTeam(player);
boolean alive = IsAlive(player);
scoreboard.writeNewLine();
// Towers
GameTeam red = GetTeam(ChatColor.RED);
GameTeam blue = GetTeam(ChatColor.AQUA);
String redTitle;
String blueTitle;
if (alive)
{
boolean playerRed = team.equals(red);
redTitle = playerRed ? "Your Team" : "Enemy Team";
blueTitle = playerRed ? "Enemy Team" : "Your Team";
}
else
{
redTitle = "Red Team";
blueTitle = "Blue Team";
}
scoreboard.write(red.GetColor() + C.Bold + redTitle);
scoreboard.write("Base: " + _tower.getDisplayString(red) + _boss.getWitherDisplayString(red));
scoreboard.writeNewLine();
scoreboard.write(blue.GetColor() + C.Bold + blueTitle);
scoreboard.write("Base: " + _tower.getDisplayString(blue) + _boss.getWitherDisplayString(blue));
scoreboard.writeNewLine();
scoreboard.write(C.cGreenB + "Beacons");
scoreboard.write(_capturePoint.getDisplayString());
scoreboard.writeNewLine();
// Gold
scoreboard.write(C.cGoldB + "Your Gold");
if (alive)
{
int gold = _goldManager.getGold(player);
scoreboard.write(String.valueOf(gold));
}
else
{
scoreboard.write("None");
}
scoreboard.writeNewLine();
scoreboard.write(C.cYellowB + "Time");
scoreboard.write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime()));
}
private void writeEnd(Player player, GameScoreboard scoreboard)
{
scoreboard.writeNewLine();
scoreboard.write("Game Over");
scoreboard.writeNewLine();
}
@EventHandler(priority = EventPriority.LOWEST)
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
// Override those kits!
setKits(_kits);
// Store player data
for (Player player : GetPlayers(true))
{
_playerData.add(new MobaPlayer(player));
MobaUtil.setTeamEntity(player, GetTeam(player));
}
}
@EventHandler
public void preventOverfill(PlayerPrepareTeleportEvent event)
{
Player player = event.GetPlayer();
if (GetPlayers(true).size() > 8)
{
SetPlayerState(player, GameTeam.PlayerState.OUT);
Manager.addSpectator(player, true);
player.sendMessage(F.main("Game", "Too many players are in this server. You are now spectating, sorry."));
}
}
@Override
public void EndCheck()
{
if (!IsLive())
{
return;
}
// Only one team online check
List<GameTeam> teamsWithPlayers = new ArrayList<>(GetTeamList().size());
for (GameTeam team : GetTeamList())
{
if (team.GetPlayers(true).isEmpty())
{
continue;
}
teamsWithPlayers.add(team);
}
if (teamsWithPlayers.size() == 1)
{
AnnounceEnd(teamsWithPlayers.get(0));
SetState(GameState.End);
return;
}
// Wither Dead check
for (GameTeam team : GetTeamList())
{
WitherBoss boss = _boss.getWitherBoss(team);
LivingEntity entity = boss.getEntity();
// Dead Wither
if (entity == null || !entity.isValid() || entity.isDead())
{
// Get the other team
for (GameTeam otherTeam : GetTeamList())
{
for (Player player : otherTeam.GetPlayers(true))
{
AddGems(player, 10, "Participation", true, true);
}
if (team.equals(otherTeam))
{
continue;
}
for (Player player : otherTeam.GetPlayers(true))
{
AddGems(player, 20, "Winning", true, true);
}
AnnounceEnd(otherTeam);
SetState(GameState.End);
}
}
}
}
@Override
public void RespawnPlayer(Player player)
{
super.RespawnPlayer(player);
player.setGameMode(GameMode.ADVENTURE);
}
@Override
public void disable()
{
super.disable();
_listeners.forEach(UtilServer::Unregister);
_listeners.clear();
_betaWhitelist.deregisterSelf();
}
@Override
public void SetKit(Player player, Kit kit, boolean announce)
{
super.SetKit(player, kit, announce);
if (kit instanceof HeroKit)
{
getMobaData(player).setKit((HeroKit) kit);
}
}
@Override
public DeathMessageType GetDeathMessageType()
{
return DeathMessageType.Detailed;
}
// Clear up memory
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
_playerData.removeIf(mobaPlayer -> mobaPlayer.getPlayer().equals(player));
}
// Clean up arrows
@EventHandler
public void projectileHit(ProjectileHitEvent event)
{
if (event.getEntity() instanceof Arrow)
{
event.getEntity().remove();
}
}
// Undisguise everyone upon game end
@EventHandler
public void end(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
{
return;
}
for (Player player : Bukkit.getOnlinePlayers())
{
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null)
{
Manager.GetDisguise().undisguise(disguise);
}
}
}
public Map<String, Location> getLocationStartsWith(String s)
{
Map<String, Location> map = new HashMap<>();
for (String key : WorldData.GetAllCustomLocs().keySet())
{
if (key.startsWith(s))
{
map.put(key, WorldData.GetCustomLocs(key).get(0));
}
}
return map;
}
public GameTeam getTeam(String name)
{
for (GameTeam team : GetTeamList())
{
if (team.GetName().equalsIgnoreCase(name))
{
return team;
}
}
return null;
}
public HeroKit[] getKits()
{
return _kits;
}
public List<HeroKit> getKits(MobaRole role)
{
List<HeroKit> kits = new ArrayList<>();
for (HeroKit kit : _kits)
{
if (kit.getRole() == role && kit.isVisible())
{
kits.add(kit);
}
}
return kits;
}
public Set<MobaPlayer> getMobaData()
{
return _playerData;
}
public MobaPlayer getMobaData(Player player)
{
for (MobaPlayer mobaPlayer : _playerData)
{
if (mobaPlayer.getPlayer().equals(player))
{
return mobaPlayer;
}
}
return null;
}
public HeroKit getFirstKit(Player player)
{
MobaPlayer mobaPlayer = getMobaData(player);
if (mobaPlayer.getRole() == null)
{
MobaRole role = getRandomRole(player);
return getFirstKit(role);
}
else if (mobaPlayer.getKit() == null)
{
return getFirstKit(mobaPlayer.getRole());
}
return null;
}
private HeroKit getFirstKit(MobaRole role)
{
for (HeroKit kit : _kits)
{
if (kit.getRole() == role && kit.isVisible())
{
return kit;
}
}
return null;
}
private MobaRole getRandomRole(Player player)
{
List<MobaRole> roles = new ArrayList<>();
for (MobaPlayer mobaPlayer : getTeamData(GetTeam(player)))
{
MobaRole role = mobaPlayer.getRole();
if (role != null)
{
roles.add(role);
}
}
return UtilAlg.Random(Arrays.asList(MobaRole.values()), roles);
}
private List<MobaPlayer> getTeamData(GameTeam team)
{
List<MobaPlayer> players = new ArrayList<>();
for (MobaPlayer mobaPlayer : _playerData)
{
GameTeam otherTeam = GetTeam(mobaPlayer.getPlayer());
if (team.equals(otherTeam))
{
players.add(mobaPlayer);
}
}
return players;
}
public boolean isRoleFree(Player player, MobaRole role)
{
GameTeam team = GetTeam(player);
if (team == null)
{
return false;
}
for (MobaPlayer mobaPlayer : getTeamData(team))
{
if (mobaPlayer.getRole() == role)
{
return false;
}
}
return true;
}
public CustomScoreboardModule getScoreboardModule()
{
return getModule(CustomScoreboardModule.class);
}
public MobaShop getShop()
{
return _shop;
}
public GoldManager getGoldManager()
{
return _goldManager;
}
public TowerManager getTowerManager()
{
return _tower;
}
public CapturePointManager getCapturePointManager()
{
return _capturePoint;
}
public BossManager getBossManager()
{
return _boss;
}
public ArrowKBManager getArrowKbManager()
{
return _arrowKb;
}
public BuffManager getBuffManager()
{
return _buffs;
} }
} }

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.game.games.moba;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import org.bukkit.entity.Player;
public class MobaPlayer
{
private final Player _player;
private MobaRole _role;
private HeroKit _kit;
public MobaPlayer(Player player)
{
_player = player;
}
public Player getPlayer()
{
return _player;
}
public void setRole(MobaRole role)
{
_role = role;
}
public MobaRole getRole()
{
return _role;
}
public void setKit(HeroKit kit)
{
_kit = kit;
}
public HeroKit getKit()
{
return _kit;
}
}

View File

@ -0,0 +1,40 @@
package nautilus.game.arcade.game.games.moba;
import org.bukkit.ChatColor;
import org.bukkit.Color;
public enum MobaRole
{
ASSASSIN("Assassin", Color.GRAY, ChatColor.DARK_GRAY),
HUNTER("Hunter", Color.LIME, ChatColor.GREEN),
MAGE("Mage", Color.PURPLE, ChatColor.DARK_PURPLE),
WARRIOR("Warrior", Color.YELLOW, ChatColor.GOLD),
;
private final String _name;
private final Color _color;
private final ChatColor _chatColor;
MobaRole(String name, Color color, ChatColor chatColor)
{
_name = name;
_color = color;
_chatColor = chatColor;
}
public String getName()
{
return _name;
}
public Color getColor()
{
return _color;
}
public ChatColor getChatColor()
{
return _chatColor;
}
}

View File

@ -0,0 +1,92 @@
package nautilus.game.arcade.game.games.moba.ai;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import java.util.List;
public class MobaAI
{
private final GameTeam _owner;
private final float _speedTarget;
private final float _speedHome;
private final List<Location> _boundaries;
private LivingEntity _entity;
private LivingEntity _target;
private Location _home;
private MobaAIMethod _aiMethod;
public MobaAI(Moba host, GameTeam owner, LivingEntity entity, Location home, float speedTarget, float speedHome, MobaAIMethod aiMethod)
{
_owner = owner;
_speedTarget = speedTarget;
_speedHome = speedHome;
_entity = entity;
_home = home;
_aiMethod = aiMethod;
_boundaries = host.WorldData.GetDataLocs(getBoundaryKey());
}
public void updateTarget()
{
// Entity not spawned
if (_entity == null || _entity.isDead() || !_entity.isValid())
{
return;
}
if (_target == null || _target.isDead() || !_target.isValid())
{
_target = MobaUtil.getBestEntityTarget(_owner, _entity, _home, _boundaries);
if (_target == null)
{
returnToHome();
return;
}
}
else if (!MobaUtil.isInBoundary(_owner, _entity, _home, _boundaries, _target))
{
_target = null;
returnToHome();
}
if (_target != null)
{
_aiMethod.updateMovement(_entity, _target.getLocation(), _speedTarget);
}
}
private void returnToHome()
{
_aiMethod.updateMovement(_entity, _home, _speedHome);
}
public void setEntity(LivingEntity entity)
{
_entity = entity;
}
public LivingEntity getTarget()
{
return _target;
}
public List<Location> getBoundaries()
{
return _boundaries;
}
public String getBoundaryKey()
{
return _owner.GetColor() == ChatColor.RED ? "ORANGE" : "LIGHT_BLUE";
}
}

View File

@ -0,0 +1,11 @@
package nautilus.game.arcade.game.games.moba.ai.goal;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
public interface MobaAIMethod
{
boolean updateMovement(LivingEntity entity, Location goal, float speed);
}

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.game.games.moba.ai.goal;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
public class MobaDirectAIMethod implements MobaAIMethod
{
@Override
public boolean updateMovement(LivingEntity entity, Location goal, float speed)
{
Location entityLocation = entity.getLocation();
// Speed is number of ticks to travel 1 block
float magnitude = speed / 20F;
// Get the direct vector between the entity and the goal
Vector direction = UtilAlg.getTrajectory(entityLocation, goal);
// From the direction, get the yaw of this direction
float directionYaw = UtilAlg.GetYaw(direction);
entityLocation.setYaw(directionYaw);
// If reached the goal
if (UtilMath.offsetSquared(entityLocation, goal) < 4)
{
return false;
}
else
{
// Modify the direction's magnitude to be at the same rate as the speed
direction.multiply(magnitude);
// Add the modified direction to the original entity location
entityLocation.add(direction);
}
// Move the entity to its new location
entity.teleport(entityLocation);
return true;
}
}

View File

@ -0,0 +1,99 @@
package nautilus.game.arcade.game.games.moba.boss;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.boss.pumpkin.PumpkinBoss;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BossManager implements Listener
{
private final Moba _host;
private Map<GameTeam, WitherBoss> _teamBosses;
private PumpkinBoss _pumpkinBoss;
public BossManager(Moba host)
{
_host = host;
_teamBosses = new HashMap<>(2);
}
private void spawnBosses()
{
_host.CreatureAllowOverride = true;
WorldData worldData = _host.WorldData;
// Spawn Team Withers
for (GameTeam team : _host.GetTeamList())
{
WitherBoss boss = new WitherBoss(_host, worldData.GetDataLocs(team.GetName().toUpperCase()).get(0), team);
boss.setup();
_teamBosses.put(team, boss);
}
// Pumpkin King
_pumpkinBoss = new PumpkinBoss(_host, worldData.GetDataLocs("BLACK").get(0));
_pumpkinBoss.setup();
_host.CreatureAllowOverride = false;
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
spawnBosses();
}
@EventHandler
public void cleanup(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End && event.GetState() != GameState.Dead)
{
return;
}
_teamBosses.forEach((team, witherBoss) -> witherBoss.cleanup());
_pumpkinBoss.cleanup();
}
public String getWitherDisplayString(GameTeam team)
{
WitherBoss boss = getWitherBoss(team);
return MobaUtil.getColour(boss.getHealthPercentage()) + "";
}
public WitherBoss getWitherBoss(GameTeam team)
{
return _teamBosses.get(team);
}
public List<MobaBoss> getBosses()
{
List<MobaBoss> bosses = new ArrayList<>();
bosses.addAll(_teamBosses.values());
bosses.add(_pumpkinBoss);
return bosses;
}
}

View File

@ -0,0 +1,142 @@
package nautilus.game.arcade.game.games.moba.boss;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public abstract class MobaBoss implements Listener
{
protected final Moba _host;
protected LivingEntity _entity;
protected Location _location;
private int _respawnTime;
private long _lastDeath;
private List<MobaBossAttack> _attacks;
public MobaBoss(Moba host, Location location)
{
this(host, location, -1);
}
public MobaBoss(Moba host, Location location, int respawnTime)
{
_host = host;
_location = location;
_respawnTime = respawnTime;
_lastDeath = -1;
_attacks = new ArrayList<>(3);
}
public void setup()
{
_entity = spawnEntity();
UtilServer.RegisterEvents(this);
}
public void cleanup()
{
UtilServer.Unregister(this);
_attacks.forEach(MobaBossAttack::cleanup);
}
public void addAttack(MobaBossAttack attack)
{
_attacks.add(attack);
}
@EventHandler
public void updateAttack(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || getAi().getTarget() == null)
{
return;
}
MobaBossAttack attack = UtilAlg.Random(_attacks);
if (attack == null)
{
return;
}
attack.run();
}
@EventHandler
public void updateMovement(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || _entity == null || !_host.IsLive())
{
return;
}
getAi().updateTarget();
}
@EventHandler
public void entityDeath(EntityDeathEvent event)
{
if (_entity != null && _entity.equals(event.getEntity()))
{
event.getDrops().clear();
event.setDroppedExp(0);
_entity = null;
_lastDeath = System.currentTimeMillis();
getAi().setEntity(null);
}
}
@EventHandler
public void updateRespawn(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || _lastDeath == -1 || !UtilTime.elapsed(_lastDeath, _respawnTime))
{
return;
}
_lastDeath = -1;
_entity = spawnEntity();
getAi().setEntity(_entity);
}
public abstract LivingEntity spawnEntity();
public abstract MobaAI getAi();
public abstract String getName();
public Moba getHost()
{
return _host;
}
public LivingEntity getEntity()
{
return _entity;
}
public boolean isDead()
{
return _entity == null || _entity.isDead() || !_entity.isValid();
}
}

View File

@ -0,0 +1,10 @@
package nautilus.game.arcade.game.games.moba.boss;
import org.bukkit.event.Listener;
public interface MobaBossAttack extends Runnable, Listener
{
void cleanup();
}

View File

@ -0,0 +1,307 @@
package nautilus.game.arcade.game.games.moba.boss.pumpkin;
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.UtilEnt;
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.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaDirectAIMethod;
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffPumpkinKing;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.TimeUnit;
public class PumpkinBoss extends MobaBoss
{
private static final String NAME = "Pumpkin King";
private static final int SPAWN_TIME = (int) TimeUnit.MINUTES.toMillis(5);
private static final int RESPAWN_TIME = (int) TimeUnit.MINUTES.toMillis(5);
private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
private static final ItemStack HELMET = new ItemStack(Material.PUMPKIN);
private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD);
private static final String DAMAGE_REASON = "Pumpkin King";
private static final int DAMAGE_RADIUS = 2;
private static final int DAMAGE_RANGE = 2;
private static final int DAMAGE_DIRECT = 6;
private static final int DAMAGE_DIRECT_RADIUS_SQUARED = 9;
private static final int HEALTH = 100;
private static final int HEALTH_OUT_OF_COMBAT = 2;
private static final Material[] BLOCKS = {
Material.OBSIDIAN,
Material.NETHERRACK,
Material.NETHER_BRICK
};
private MobaAI _ai;
private boolean _initialSpawn;
private final Set<Block> _changed;
public PumpkinBoss(Moba host, Location location)
{
super(host, location, RESPAWN_TIME);
_changed = new HashSet<>();
}
@Override
public void setup()
{
// Override this so that the entity isn't spawned as soon as the game starts.
UtilServer.RegisterEvents(this);
}
@Override
public LivingEntity spawnEntity()
{
_host.CreatureAllowOverride = true;
Skeleton skeleton = UtilVariant.spawnWitherSkeleton(_location);
skeleton.setCustomName(C.cDRedB + NAME);
skeleton.setCustomNameVisible(true);
skeleton.getEquipment().setHelmet(HELMET);
skeleton.getEquipment().setItemInHand(IN_HAND);
skeleton.setMaxHealth(HEALTH);
skeleton.setHealth(HEALTH);
UtilEnt.vegetate(skeleton);
UtilEnt.setFakeHead(skeleton, true);
skeleton.getWorld().strikeLightningEffect(skeleton.getLocation());
// preDamage uses getAi() which would have been called in a game long before spawnEntity has
// This is unique to the pumpkin king, so we must manually update the AI's corresponding entity
getAi().setEntity(skeleton);
UtilTextMiddle.display(C.cDRedB + "The Pumpkin King", "Has Awoken!", 10, 40, 10);
_host.Announce(F.main("Game", C.cRedB + "The Pumpkin King Has Awoken!"), false);
for (Player player : Bukkit.getOnlinePlayers())
{
player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 1, 0.4F);
}
for (Entry<Block, Double> entry : UtilBlock.getInRadius(skeleton.getLocation(), 12).entrySet())
{
Block block = entry.getKey();
double setChance = entry.getValue();
if (!UtilBlock.solid(block)|| block.getRelative(BlockFace.UP).getType() != Material.AIR || Math.random() > setChance)
{
continue;
}
_host.getArcadeManager().GetBlockRestore().add(block, BLOCKS[UtilMath.r(BLOCKS.length)].getId(), (byte) 0, Integer.MAX_VALUE);
_changed.add(block);
}
_host.CreatureAllowOverride = false;
return skeleton;
}
@Override
public MobaAI getAi()
{
if (_ai == null)
{
_ai = new PumpkinBossAI(_host, _entity, _location, AI_METHOD);
}
return _ai;
}
@Override
public String getName()
{
return NAME;
}
@EventHandler
public void updateSpawn(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || !_host.IsLive() || _initialSpawn || !UtilTime.elapsed(_host.GetStateTime(), SPAWN_TIME))
{
return;
}
_initialSpawn = true;
_entity = spawnEntity();
}
@Override
public void cleanup()
{
super.cleanup();
for (Block block : _changed)
{
_host.getArcadeManager().GetBlockRestore().restore(block);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void preDamage(CustomDamageEvent event)
{
if (!event.GetDamageeEntity().equals(_entity) || MobaUtil.isInBoundary(null, _entity, _location, getAi().getBoundaries(), event.GetDamagerPlayer(true)))
{
return;
}
event.SetCancelled("Outside of area");
}
@Override
@EventHandler
public void entityDeath(EntityDeathEvent event)
{
if (_entity == null || !event.getEntity().equals(_entity))
{
return;
}
Player player = _entity.getKiller();
if (player == null)
{
return;
}
super.entityDeath(event);
GameTeam team = _host.GetTeam(player);
if (team == null)
{
return;
}
_host.Announce(F.main("Game", team.GetFormattedName() + C.mBody + " killed the " + C.cDRedB + DAMAGE_REASON), false);
UtilTextMiddle.display("", team.GetFormattedName() + C.cWhite + " killed the " + C.cDRedB + DAMAGE_REASON, 10, 40, 10);
for (Block block : _changed)
{
_host.getArcadeManager().GetBlockRestore().restore(block);
}
event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.EXPLODE, 1, 0.2F);
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, event.getEntity().getEyeLocation(), 1, 1, 1, 0.1F, 3, ViewDist.LONG);
// Give the team members the buff
BuffManager buffManager = _host.getBuffManager();
for (Player teamMember : team.GetPlayers(true))
{
if (UtilPlayer.isSpectator(teamMember))
{
continue;
}
buffManager.apply(new BuffPumpkinKing(_host, teamMember));
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void entityDamage(CustomDamageEvent event)
{
if (!event.GetDamageeEntity().equals(_entity))
{
return;
}
updateDisplay();
if (event.GetCause() == DamageCause.SUFFOCATION)
{
event.SetCancelled("Pumpkin King Suffocation");
}
}
@EventHandler
public void updateDamage(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || _entity == null)
{
return;
}
LivingEntity target = _ai.getTarget();
if (target != null)
{
if (UtilMath.offsetSquared(_entity, target) < DAMAGE_DIRECT_RADIUS_SQUARED)
{
_host.getArcadeManager().GetDamage().NewDamageEvent(target, _entity, null, DamageCause.CUSTOM, DAMAGE_DIRECT, true, true, false, DAMAGE_REASON, DAMAGE_REASON);
// Send a fake hit packet
// Magic number 0 means swing item/attack
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(((CraftLivingEntity) _entity).getHandle(), 0);
for (Player player : Bukkit.getOnlinePlayers())
{
UtilPlayer.sendPacket(player, packet);
}
}
}
else
{
_entity.setHealth(Math.min(_entity.getHealth() + HEALTH_OUT_OF_COMBAT, _entity.getMaxHealth()));
updateDisplay();
}
for (LivingEntity entity : UtilEnt.getInRadius(_entity.getLocation(), DAMAGE_RADIUS).keySet())
{
if (_entity.equals(entity))
{
continue;
}
_host.getArcadeManager().GetDamage().NewDamageEvent(entity, _entity, null, DamageCause.CUSTOM, DAMAGE_RANGE, false, true, false, NAME, DAMAGE_REASON);
UtilAction.velocity(entity, UtilAlg.getTrajectory(_entity, entity).setY(1));
UtilParticle.PlayParticleToAll(ParticleType.FLAME, entity.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.1F, 5, ViewDist.LONG);
}
}
private void updateDisplay()
{
_entity.setCustomName(MobaUtil.getHealthBar(_entity, 20));
}
}

View File

@ -0,0 +1,25 @@
package nautilus.game.arcade.game.games.moba.boss.pumpkin;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
public class PumpkinBossAI extends MobaAI
{
private static final float SPEED_TARGET = 5F;
private static final float SPEED_HOME = 3F;
public PumpkinBossAI(Moba host, LivingEntity entity, Location home, MobaAIMethod aiMethod)
{
super(host, null, entity, home, SPEED_TARGET, SPEED_HOME, aiMethod);
}
@Override
public String getBoundaryKey()
{
return "GRAY";
}
}

View File

@ -0,0 +1,233 @@
package nautilus.game.arcade.game.games.moba.boss.wither;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
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.UtilTextTop;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaDirectAIMethod;
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.boss.wither.attack.BossAttackEarthquake;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerDestroyEvent;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
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 java.util.concurrent.TimeUnit;
public class WitherBoss extends MobaBoss
{
private static final String NAME = "Wither Boss";
private static final float SPEED_TARGET = 4F;
private static final float SPEED_HOME = 6F;
private static final int INITIAL_HEALTH = 125;
private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
private static final int MIN_INFORM_TIME = (int) TimeUnit.SECONDS.toMillis(30);
private GameTeam _team;
private MobaAI _ai;
private DisguiseWither _disguise;
private boolean _damageable;
private long _lastInform;
public WitherBoss(Moba host, Location location, GameTeam team)
{
super(host, location);
_location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, host.GetSpectatorLocation())));
_team = team;
addAttack(new BossAttackEarthquake(this));
}
@Override
public LivingEntity spawnEntity()
{
ArmorStand stand = _location.getWorld().spawn(_location, ArmorStand.class);
// Reducing the wither's health to 10% gives a shield like effect.
stand.setMaxHealth(INITIAL_HEALTH);
stand.setHealth(INITIAL_HEALTH * 0.1);
stand.setGravity(false);
UtilEnt.setBoundingBox(stand, 3, 5);
_disguise = new DisguiseWither(stand);
_disguise.setName(_team.GetColor() + _team.GetName() + "\'s Wither");
_disguise.setCustomNameVisible(true);
_host.getArcadeManager().GetDisguise().disguise(_disguise);
return stand;
}
@Override
public MobaAI getAi()
{
if (_ai == null)
{
_ai = new MobaAI(_host, _team, _entity, _location, SPEED_TARGET, SPEED_HOME, AI_METHOD);
}
return _ai;
}
@Override
public String getName()
{
return NAME;
}
@EventHandler(priority = EventPriority.LOWEST)
public void preDamage(CustomDamageEvent event)
{
if (!event.GetDamageeEntity().equals(_entity) || MobaUtil.isInBoundary(_team, _entity, _location, getAi().getBoundaries(), event.GetDamagerPlayer(true)))
{
return;
}
event.SetCancelled("Outside of area");
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damage(CustomDamageEvent event)
{
// Not a Wither Boss
if (event.isCancelled() || !(event.GetDamageeEntity().equals(_entity)))
{
return;
}
event.SetCancelled("Wither Boss");
// Fire doesn't damage the wither
if (event.GetCause() == DamageCause.FIRE || event.GetCause() == DamageCause.FIRE_TICK)
{
return;
}
// If not damageable
if (!_damageable)
{
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
{
damager.sendMessage(F.main("Game", "You must destroy both towers before attacking the Wither!"));
damager.playSound(damager.getLocation(), Sound.NOTE_BASS, 1, 0.8F);
}
return;
}
LivingEntity damagee = event.GetDamageeEntity();
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
{
GameTeam team = _host.GetTeam(damager);
if (team == null || _team.equals(team))
{
return;
}
}
// Inform the team
if (UtilTime.elapsed(_lastInform, MIN_INFORM_TIME))
{
_lastInform = System.currentTimeMillis();
for (Player player : _team.GetPlayers(true))
{
player.playSound(player.getLocation(), Sound.ANVIL_LAND, 1, 0.5F);
player.sendMessage(F.main("Game", "Your Wither is under attack."));
}
}
double newHealth = damagee.getHealth() - event.GetDamage();
// Don't allow the wither to move because of damage
damagee.playEffect(EntityEffect.HURT);
if (newHealth > 0)
{
damagee.setHealth(newHealth);
updateDisplay();
}
else
{
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _entity.getLocation().add(0, 1.5, 0), 0F, 0F, 0F, 0.1F, 1, ViewDist.LONG);
_entity.remove();
}
}
@EventHandler
public void towerDestroy(TowerDestroyEvent event)
{
Tower tower = event.getTower();
if (!_team.equals(tower.getOwner()))
{
return;
}
// Here we can remove the shield effect, as the wither is no longer invincible
if (!tower.isFirstTower())
{
_damageable = true;
_entity.setHealth(INITIAL_HEALTH);
updateDisplay();
}
}
@EventHandler
public void updateTeamDisplay(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || _entity == null)
{
return;
}
double percent = getHealthPercentage();
for (Player player : _team.GetPlayers(true))
{
UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither");
}
}
public double getHealthPercentage()
{
return _damageable ? (_entity.getHealth() / _entity.getMaxHealth()) : 1;
}
private void updateDisplay()
{
_disguise.setName(MobaUtil.getHealthBar(_entity, 40));
}
public GameTeam getTeam()
{
return _team;
}
}

View File

@ -0,0 +1,93 @@
package nautilus.game.arcade.game.games.moba.boss.wither.attack;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.game.games.moba.boss.MobaBossAttack;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
public class BossAttackEarthquake implements MobaBossAttack
{
private static final String ATTACK_NAME = "Earthquake";
private static final int RADIUS = 8;
private static final int DAMAGE = 4;
private static final double FALLING_BLOCK_CHANCE = 0.1;
private final WitherBoss _boss;
private final Set<FallingBlock> _entities;
public BossAttackEarthquake(WitherBoss boss)
{
_boss = boss;
_entities = new HashSet<>();
UtilServer.RegisterEvents(this);
}
@Override
public void run()
{
LivingEntity boss = _boss.getEntity();
for (Block block : UtilBlock.getBlocksInRadius(boss.getLocation(), RADIUS))
{
// Only want blocks that are on the floor
if (block.getType() == Material.AIR || block.getRelative(BlockFace.UP).getType() != Material.AIR || Math.random() > FALLING_BLOCK_CHANCE)
{
continue;
}
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5, 1, 0.5), block.getType(), block.getData());
fallingBlock.setHurtEntities(false);
fallingBlock.setDropItem(false);
fallingBlock.setVelocity(UtilAlg.getTrajectory(boss, fallingBlock).multiply(0.25).setY(0.7 + Math.random()));
}
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(boss.getLocation(), RADIUS).entrySet())
{
LivingEntity entity = entry.getKey();
double dist = entry.getValue();
if (MobaUtil.isTeamEntity(entity, _boss.getTeam()))
{
continue;
}
_boss.getHost().getArcadeManager().GetDamage().NewDamageEvent(entity, boss, null, DamageCause.CUSTOM, DAMAGE * (dist + 0.5), false, true, false, _boss.getName(), ATTACK_NAME);
UtilAction.velocity(entity, UtilAlg.getTrajectory(boss, entity).setY(1));
}
}
@Override
public void cleanup()
{
UtilServer.Unregister(this);
}
@EventHandler
public void entityChangeBlock(EntityChangeBlockEvent event)
{
if (_entities.contains(event.getEntity()))
{
event.setCancelled(true);
event.getEntity().remove();
_entities.remove(event.getEntity());
}
}
}

View File

@ -0,0 +1,57 @@
package nautilus.game.arcade.game.games.moba.buff;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Listener;
public abstract class Buff<T extends LivingEntity> implements Listener
{
protected final Moba _host;
protected final BuffManager _manager;
protected final T _entity;
protected final long _duration;
private long _start;
public Buff(Moba host, T entity, long duration)
{
_host = host;
_manager = host.getBuffManager();
_entity = entity;
_duration = duration;
}
public abstract void onApply();
public abstract void onExpire();
final void apply()
{
_start = System.currentTimeMillis();
UtilServer.RegisterEvents(this);
onApply();
}
final void expire()
{
UtilServer.Unregister(this);
onExpire();
}
public final T getEntity()
{
return _entity;
}
public final long getDuration()
{
return _duration;
}
public final long getStart()
{
return _start;
}
}

View File

@ -0,0 +1,94 @@
package nautilus.game.arcade.game.games.moba.buff;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class BuffManager implements Listener
{
private final Map<LivingEntity, List<Buff<? extends LivingEntity>>> _buffs;
public BuffManager()
{
_buffs = new HashMap<>();
}
public void apply(Buff<? extends LivingEntity> buff)
{
if (UtilPlayer.isSpectator(buff.getEntity()))
{
return;
}
_buffs.putIfAbsent(buff.getEntity(), new ArrayList<>(3));
_buffs.get(buff.getEntity()).add(buff);
buff.apply();
}
public boolean hasBuff(LivingEntity entity, Class<? extends Buff<? extends LivingEntity>> clazz)
{
if (!_buffs.containsKey(entity))
{
return false;
}
for (Buff<? extends LivingEntity> buff : _buffs.get(entity))
{
if (buff.getClass().equals(clazz))
{
return true;
}
}
return false;
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
Iterator<LivingEntity> iterator = _buffs.keySet().iterator();
while (iterator.hasNext())
{
LivingEntity entity = iterator.next();
List<Buff<? extends LivingEntity>> buffs = _buffs.get(entity);
if (entity.isDead() || !entity.isValid() || UtilPlayer.isSpectator(entity) || entity instanceof Player && !((Player) entity).isOnline())
{
buffs.forEach(Buff::expire);
iterator.remove();
continue;
}
Iterator<Buff<? extends LivingEntity>> buffIterator = buffs.iterator();
while (buffIterator.hasNext())
{
Buff buff = buffIterator.next();
if (UtilTime.elapsed(buff.getStart(), buff.getDuration()))
{
buff.expire();
buffIterator.remove();
}
}
}
}
}

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class BuffCripple extends Buff<Player>
{
private static final ItemStack ITEM = new ItemBuilder(Material.IRON_INGOT)
.setTitle(C.cGray + "Crippled")
.build();
public static ItemStack getItemRepresentation()
{
return ITEM;
}
public BuffCripple(Moba host, Player entity, long duration)
{
super(host, entity, duration);
}
@Override
public void onApply()
{
UtilTextMiddle.display("", C.cRed + "Crippled", 10, 20, 10, _entity);
}
@Override
public void onExpire()
{
}
}

View File

@ -0,0 +1,104 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import mineplex.core.common.util.F;
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.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.concurrent.TimeUnit;
public class BuffPumpkinKing extends Buff<Player>
{
private static final long DURATION = TimeUnit.MINUTES.toMillis(1);
private static final String DAMAGE_REASON = "Pumpkin King Buff";
private static final double DAMAGE_FACTOR = 1.5;
private static final ItemStack HELMET = new ItemStack(Material.PUMPKIN);
public BuffPumpkinKing(Moba host, Player entity)
{
super(host, entity, DURATION);
}
@Override
public void onApply()
{
_entity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 60 * 20, 1));
UtilParticle.PlayParticleToAll(ParticleType.LAVA, _entity.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.1F, 10, ViewDist.LONG);
_entity.playSound(_entity.getLocation(), Sound.PORTAL_TRAVEL, 1, 0.5F);
_entity.sendMessage(F.main("Game", "You feel the power of the Pumpkin King flow through you. Your damage and regeneration are increased!"));
}
@Override
public void onExpire()
{
sendFakeHelmet(_entity, _entity.getInventory().getHelmet());
}
@EventHandler
public void updateFakeHelmet(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
{
return;
}
sendFakeHelmet(_entity, HELMET);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damageIncrease(CustomDamageEvent event)
{
if (event.isCancelled())
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
Player damager = event.GetDamagerPlayer(true);
if (damager == null || !damager.equals(_entity))
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, damagee.getLocation().add(0, 0.5, 0), 0.25F, 0.25F, 0.25F, 0.1F, 10, ViewDist.NORMAL);
event.AddMod(DAMAGE_REASON, DAMAGE_FACTOR);
}
private void sendFakeHelmet(Player player, ItemStack itemStack)
{
// Magic number 4 means helmet
PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(player.getEntityId(), 4, CraftItemStack.asNMSCopy(itemStack));
for (Player other : Bukkit.getOnlinePlayers())
{
// Don't send wearer their own data
if (other.equals(player))
{
continue;
}
UtilPlayer.sendPacket(other, packet);
}
}
}

View File

@ -0,0 +1,78 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
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.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
public class BuffRooting extends Buff<Player>
{
public BuffRooting(Moba host, Player entity, long duration)
{
super(host, entity, duration);
}
@Override
public void onApply()
{
UtilAction.zeroVelocity(_entity);
UtilTextMiddle.display("", C.cRed + "Rooted", 10, 20, 10, (Player) _entity);
}
@Override
public void onExpire()
{
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _entity.getLocation().add(0, 0.5, 0), 0.5F, 0.2F, 0.5F, 0.1F, 5, ViewDist.LONG);
}
@EventHandler
public void velocityApply(EntityVelocityChangeEvent event)
{
if (event.getEntity().equals(_entity))
{
event.setCancelled(true);
}
}
@EventHandler
public void move(PlayerMoveEvent event)
{
if (!event.getPlayer().equals(_entity))
{
return;
}
Location from = event.getFrom();
Location to = event.getTo();
if (from.getX() == to.getX() && from.getZ() == to.getZ())
{
return;
}
event.setTo(from);
}
}

View File

@ -0,0 +1,91 @@
package nautilus.game.arcade.game.games.moba.fountain;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class MobaFountain implements Listener
{
private static final int FOUNTAIN_SIZE_SQUARED = 50;
private final Moba _host;
private final Map<GameTeam, Location> _average;
public MobaFountain(Moba host)
{
_host = host;
_average = new HashMap<>();
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
for (GameTeam team : _host.GetTeamList())
{
_average.put(team, UtilAlg.getAverageLocation(team.GetSpawns()));
}
}
@EventHandler
public void respawn(PlayerGameRespawnEvent event)
{
Player player = event.GetPlayer();
_host.getArcadeManager().GetCondition().Factory().Regen("Fountain", player, null, 3, 9, false, true, false);
}
@EventHandler
public void updateInFountain(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || !_host.IsLive())
{
return;
}
for (Player player : _host.GetPlayers(true))
{
GameTeam playerTeam = _host.GetTeam(player);
for (Entry<GameTeam, Location> entry : _average.entrySet())
{
GameTeam team = entry.getKey();
Location location = entry.getValue();
if (UtilMath.offsetSquared(player.getLocation(), location) > FOUNTAIN_SIZE_SQUARED)
{
continue;
}
if (playerTeam.equals(team))
{
player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + 6));
}
else
{
_host.getArcadeManager().GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 10, false, true, true, "Fountain", "Fountain");
}
}
}
}
}

View File

@ -0,0 +1,41 @@
package nautilus.game.arcade.game.games.moba.general;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.metadata.FixedMetadataValue;
public class ArrowKBManager implements Listener
{
private static final String ENTITY_METADATA = "KB";
private final Moba _host;
public ArrowKBManager(Moba host)
{
_host = host;
}
@EventHandler
public void arrowDamage(CustomDamageEvent event)
{
Projectile projectile = event.GetProjectile();
if (projectile == null || projectile.getType() != EntityType.ARROW || projectile.hasMetadata(ENTITY_METADATA))
{
return;
}
event.SetKnockback(false);
}
public void allowKnockback(Entity projectile)
{
projectile.setMetadata(ENTITY_METADATA, new FixedMetadataValue(_host.getArcadeManager().getPlugin(), true));
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.game.games.moba.general;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class BetaManager implements Listener
{
private static final String MESSAGE = F.main("Game", "You can suggest improvements for the game on our Trello here ") + C.cYellow + "https://trello.com/b/MrxWVhlI/mineplex-heroes-of-gwen-feedback-update";
private final Moba _host;
public BetaManager(Moba host)
{
_host = host;
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.MIN_02 || _host.GetState() != GameState.Recruit)
{
return;
}
Bukkit.broadcastMessage(MESSAGE);
}
}

View File

@ -0,0 +1,100 @@
package nautilus.game.arcade.game.games.moba.general;
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.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Location;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.projectiles.ProjectileSource;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class EnderPearlManager implements Listener
{
private static final int MAX_TICKS = 2 * 20;
private final Map<Player, Projectile> _pearls;
public EnderPearlManager()
{
_pearls = new HashMap<>();
}
@EventHandler
public void projectileLaunch(ProjectileLaunchEvent event)
{
Projectile entity = event.getEntity();
if (!(entity instanceof EnderPearl) || !(entity.getShooter() instanceof Player))
{
return;
}
Player shooter = (Player) event.getEntity().getShooter();
_pearls.put(shooter, event.getEntity());
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<Player> iterator = _pearls.keySet().iterator();
while (iterator.hasNext())
{
Player shooter = iterator.next();
Projectile entity = _pearls.get(shooter);
if (UtilPlayer.isSpectator(shooter))
{
iterator.remove();
entity.remove();
}
else if (entity.getTicksLived() > MAX_TICKS)
{
teleport(shooter, entity);
entity.remove();
iterator.remove();
}
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, entity.getLocation(), 0, 0, 0, 0.1F, 3, ViewDist.LONG);
}
}
@EventHandler
public void projectileHit(ProjectileHitEvent event)
{
ProjectileSource source = event.getEntity().getShooter();
if (_pearls.remove(source) != null)
{
teleport((Player) source, event.getEntity());
}
}
private void teleport(Player shooter, Projectile entity)
{
Location toTeleport = entity.getLocation();
Location playerLocation = shooter.getLocation();
toTeleport.setYaw(playerLocation.getYaw());
toTeleport.setPitch(playerLocation.getPitch());
shooter.teleport(toTeleport);
}
}

View File

@ -0,0 +1,107 @@
package nautilus.game.arcade.game.games.moba.general;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class MobaDamageManager implements Listener
{
private final Moba _host;
public MobaDamageManager(Moba host)
{
_host = host;
}
@EventHandler
public void preventTeamDamage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
Player damager = event.GetDamagerPlayer(true);
if (damagee == null || damager == null)
{
return;
}
GameTeam damageeTeam = _host.GetTeam(damagee);
GameTeam damagerTeam = _host.GetTeam(damager);
if (damageeTeam == null || damagerTeam == null)
{
return;
}
if (damageeTeam.equals(damagerTeam))
{
event.SetCancelled("Team Damage");
}
else
{
_host.getScoreboardModule().refreshAsSubject(damagee);
}
}
@EventHandler
public void preventTeamFire(ConditionApplyEvent event)
{
Condition condition = event.GetCondition();
if (condition.GetType() != ConditionType.BURNING)
{
return;
}
if (condition.GetEnt() == null || condition.GetSource() == null)
{
return;
}
if (!(condition.GetEnt() instanceof Player && condition.GetSource() instanceof Player))
{
return;
}
if (!_host.GetTeam((Player) condition.GetEnt()).equals(_host.GetTeam((Player) condition.GetSource())))
{
return;
}
event.setCancelled(true);
}
@EventHandler
public void updateDamageScoreboard(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
_host.getScoreboardModule().refresh();
}
@EventHandler(priority = EventPriority.HIGH)
public void unifyKilledWith(CombatDeathEvent event)
{
String word = event.getKilledWord();
String[] split = word.split("-");
if (word.contains("Click") && split.length > 1)
{
word = split[1].trim();
event.setKilledWord(word);
}
}
}

View File

@ -0,0 +1,179 @@
package nautilus.game.arcade.game.games.moba.gold;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePoint;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePointCaptureEvent;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerDestroyEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.Map;
public class GoldManager implements Listener
{
private static final int GOLD_PER_5 = 20;
private static final int GOLD_PER_CAPTURE_5 = 5;
private static final int GOLD_PER_CAPTURE_INITIAL = 25;
private static final int GOLD_PER_FIRST_TOWER = 100;
private static final int GOLD_PER_SECOND_TOWER = 250;
private final Moba _host;
private final Map<Player, Integer> _playerGold;
public GoldManager(Moba host)
{
_host = host;
_playerGold = new HashMap<>();
host.registerDebugCommand(new DebugCommand("gold", Rank.ADMIN)
{
@Override
public void Execute(Player caller, String[] args)
{
if (args.length < 1)
{
caller.sendMessage(F.main("Debug", "/gold <amount>"));
return;
}
try
{
int amount = Integer.parseInt(args[0]);
addGold(caller, amount);
caller.sendMessage(F.main("Debug", "Gave yourself " + F.elem(args[0]) + " gold."));
}
catch (NumberFormatException e)
{
caller.sendMessage(F.main("Debug", F.elem(args[0]) + " is not a number."));
}
}
});
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
for (Player player : _host.GetPlayers(true))
{
_playerGold.put(player, 0);
}
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_playerGold.remove(event.getPlayer());
}
@EventHandler
public void passiveGain(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC_05 || !_host.IsLive())
{
return;
}
// Every player passive
for (Player player : _host.GetPlayers(true))
{
addGold(player, GOLD_PER_5);
}
// Capture points
for (CapturePoint point : _host.getCapturePointManager().getCapturePoints())
{
GameTeam owner = point.getOwner();
if (owner == null)
{
continue;
}
for (Player player : owner.GetPlayers(true))
{
addGold(player, GOLD_PER_CAPTURE_5);
}
}
}
@EventHandler
public void towerDestroy(TowerDestroyEvent event)
{
for (Player player : _host.GetPlayers(true))
{
// Don't give the gold to the owners
if (_host.GetTeam(player).equals(event.getTower().getOwner()))
{
continue;
}
addGold(player, event.getTower().isFirstTower() ? GOLD_PER_FIRST_TOWER : GOLD_PER_SECOND_TOWER, "Destroying a tower");
}
}
@EventHandler
public void pointCapture(CapturePointCaptureEvent event)
{
GameTeam team = event.getPoint().getOwner();
for (Player player : team.GetPlayers(true))
{
addGold(player, GOLD_PER_CAPTURE_INITIAL, "Capturing a beacon");
}
}
public int getGold(Player player)
{
return _playerGold.get(player);
}
public void addGold(Player player, int amount)
{
addGold(player, amount, null);
}
public void addGold(Player player, int amount, String reason)
{
_playerGold.put(player, _playerGold.get(player) + amount);
_host.getArcadeManager().GetStatsManager().incrementStat(player, _host.GetName() + ".GoldEarned", amount);
if (amount > 20 && reason != null)
{
_host.AddGems(player, (double) amount / 2D, reason, true, true);
player.sendMessage(F.main("Game", C.cGold + "+" + amount + " gold (" + reason + ")" + C.cGray + "."));
}
}
public void removeGold(Player player, int amount)
{
_playerGold.put(player, _playerGold.get(player) - amount);
}
public boolean hasGold(Player player, int amount)
{
return _playerGold.get(player) >= amount;
}
}

View File

@ -0,0 +1,54 @@
package nautilus.game.arcade.game.games.moba.kit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class AmmoGiveEvent extends PlayerEvent
{
private static final HandlerList _handlers = new HandlerList();
private int _ammoToGive;
private int _maxAmmo;
public AmmoGiveEvent(Player who, int ammoToGive, int maxAmmo)
{
super(who);
_ammoToGive = ammoToGive;
_maxAmmo = maxAmmo;
}
public void setAmmoToGive(int ammo)
{
_ammoToGive = ammo;
}
public int getAmmoToGive()
{
return _ammoToGive;
}
public void setMaxAmmo(int ammo)
{
_maxAmmo = ammo;
}
public int getMaxAmmo()
{
return _maxAmmo;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.moba.kit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class CooldownCalculateEvent extends PlayerEvent
{
private static final HandlerList _handlers = new HandlerList();
private final long _initialCooldown;
private final String _ability;
private long _cooldown;
public CooldownCalculateEvent(Player who, String ability, long cooldown)
{
super(who);
_initialCooldown = cooldown;
_ability = ability;
_cooldown = cooldown;
}
public String getAbility()
{
return _ability;
}
public void setCooldown(long cooldown)
{
_cooldown = cooldown;
}
public void decreaseCooldown(double factor)
{
_cooldown -= (long) ((double) _initialCooldown * factor);
}
public long getCooldown()
{
return _cooldown;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -0,0 +1,273 @@
package nautilus.game.arcade.game.games.moba.kit;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilGameProfile;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import java.util.List;
public class HeroKit extends Kit
{
private final MobaRole _role;
private static final int AMMO_SLOT = 7;
private ItemStack _ammo;
private long _giveTime;
private int _maxAmmo;
private SkinData _skin;
private static final int RECALL_SLOT = 8;
private static final ItemStack RECALL_ITEM = new ItemBuilder(Material.BED)
.setTitle(C.cGreenB + "Recall to your Base")
.addLore("Clicking this item will teleport you back to your", "base after " + F.time("5") + " seconds.", "Taking damage or moving will cancel", "your teleport.")
.build();
private static final ItemStack SHOP_ITEM = new ItemBuilder(Material.GOLD_INGOT)
.setTitle(C.cGold + "Open Gold Upgrades")
.addLore("Click to open the Gold Upgrades", "shop while you are respawning.")
.build();
private boolean _visible = true;
public HeroKit(ArcadeManager manager, String name, Perk[] kitPerks, MobaRole role, SkinData skin)
{
super(manager, name, KitAvailability.Free, new String[0], kitPerks, null, null);
_role = role;
_maxAmmo = 64;
_skin = skin;
}
public MobaRole getRole()
{
return _role;
}
public ItemStack getAmmo()
{
return _ammo;
}
public void setAmmo(ItemStack ammo, long giveTime)
{
_ammo = ammo;
_giveTime = giveTime;
}
public void setMaxAmmo(int max)
{
_maxAmmo = max;
}
public boolean useAmmo(Player player, int amount)
{
ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT);
if (itemStack == null)
{
return false;
}
int newAmount = itemStack.getAmount() - amount;
if (itemStack.getAmount() < amount)
{
return false;
}
if (newAmount == 0)
{
player.getInventory().remove(itemStack);
}
else
{
itemStack.setAmount(newAmount);
}
return true;
}
@EventHandler
public void giveAmmo(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST || Manager.GetGame() == null || !Manager.GetGame().IsLive() || _ammo == null)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player) || UtilPlayer.isSpectator(player))
{
continue;
}
long giveTime = _giveTime;
if (!Recharge.Instance.usable(player, MobaConstants.AMMO))
{
continue;
}
CooldownCalculateEvent cooldownEvent = new CooldownCalculateEvent(player, MobaConstants.AMMO, giveTime);
UtilServer.CallEvent(cooldownEvent);
if (!Recharge.Instance.use(player, MobaConstants.AMMO, cooldownEvent.getCooldown(), false, false))
{
continue;
}
giveAmmo(player, 1);
}
}
public void giveAmmo(Player player, int amount)
{
ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT);
AmmoGiveEvent event = new AmmoGiveEvent(player, amount, _maxAmmo);
UtilServer.CallEvent(event);
if (itemStack == null)
{
itemStack = _ammo;
player.getInventory().setItem(AMMO_SLOT, itemStack);
return;
}
if (itemStack.getAmount() >= event.getMaxAmmo())
{
return;
}
itemStack.setAmount(itemStack.getAmount() + event.getAmmoToGive());
}
@Override
public void GiveItems(Player player)
{
PlayerInventory inventory = player.getInventory();
// Give standard items
inventory.setItem(AMMO_SLOT, _ammo);
//inventory.setItem(RECALL_SLOT, RECALL_ITEM);
inventory.setItem(RECALL_SLOT, SHOP_ITEM);
Moba game = (Moba) Manager.GetGame();
List<MobaItem> items = game.getShop().getOwnedItems(player);
for (MobaItem item : items)
{
ItemStack itemstack = item.getItem();
// Give armour
if (UtilItem.isHelmet(itemstack))
{
inventory.setHelmet(itemstack);
}
else if (UtilItem.isChestplate(itemstack))
{
inventory.setChestplate(itemstack);
}
else if (UtilItem.isLeggings(itemstack))
{
inventory.setLeggings(itemstack);
}
else if (UtilItem.isBoots(itemstack))
{
inventory.setBoots(itemstack);
}
// Give consumable items
else if (!UtilItem.isSword(itemstack) && !UtilGear.isBow(itemstack))
{
// Keep moving left from the ammo slot until a free slot is available
for (int i = AMMO_SLOT - 1; i >= GetPerks().length - 1; i--)
{
if (inventory.getItem(i) == null)
{
inventory.setItem(i, itemstack);
break;
}
}
}
}
// Give all skill related items
for (Perk perk : GetPerks())
{
if (!(perk instanceof HeroSkill))
{
continue;
}
HeroSkill skill = (HeroSkill) perk;
if (skill.isOnCooldown(player))
{
player.getInventory().setItem(skill.getSlot(), skill.getCooldownItem());
}
else
{
skill.giveItem(player);
}
}
}
@Override
public void GiveItemsCall(Player player)
{
super.GiveItemsCall(player);
disguise(player);
}
public void disguise(Player player)
{
disguise(player, _skin);
}
public void disguise(Player player, SkinData skin)
{
GameProfile profile = UtilGameProfile.getGameProfile(player);
profile.getProperties().clear();
profile.getProperties().put("textures", skin.getProperty());
DisguisePlayer disguise = new DisguisePlayer(player, profile);
disguise.showInTabList(true, 0);
Manager.GetDisguise().disguise(disguise);
}
public boolean isVisible()
{
return _visible;
}
public void setVisible(boolean visible)
{
_visible = visible;
}
}

View File

@ -0,0 +1,387 @@
package nautilus.game.arcade.game.games.moba.kit;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffCripple;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class HeroSkill extends Perk
{
private ItemStack _item;
private ItemStack _cooldownItem;
private final int _slot;
private final ActionType _actionType;
private boolean _sneakActivate;
private boolean _dropItemActivate;
protected HeroKit _kit;
private long _cooldown;
private final Map<UUID, Long> _lastSkill = new HashMap<>();
public HeroSkill(String name, String[] perkDesc)
{
this(name, perkDesc, null, -1, null);
}
public HeroSkill(String name, String[] perkDesc, ItemStack itemStack, int slot, ActionType actionType)
{
super(name, perkDesc);
_item = itemStack;
_slot = slot;
_actionType = actionType;
}
public void setSneakActivate(boolean activate)
{
_sneakActivate = activate;
}
public void setDropItemActivate(boolean activate)
{
_dropItemActivate = activate;
}
protected void setCooldown(long cooldown)
{
_cooldown = cooldown;
}
private void prettifyItems()
{
String action = null;
if (_actionType == ActionType.ANY)
{
action = "Click";
}
if (_actionType == ActionType.L)
{
action = "Left Click";
}
else if (_actionType == ActionType.R)
{
action = "Right Click";
}
if (_sneakActivate)
{
action += "/Sneak";
}
if (_dropItemActivate)
{
action += "/Drop Item";
}
_item = new ItemBuilder(_item)
.setTitle((action != null ? C.cYellowB + action + C.cGray + " - " : "") + C.cGreenB + GetName())
.addLore(GetDesc())
.setUnbreakable(true)
.build();
_cooldownItem = new ItemBuilder(Material.INK_SACK, (byte) 8)
.setTitle(C.cRed + GetName())
.addLore(GetDesc())
.setUnbreakable(true)
.build();
}
@Override
public void SetHost(Kit kit)
{
super.SetHost(kit);
_kit = (HeroKit) kit;
prettifyItems();
}
@EventHandler
public void giveItem(PlayerKitGiveEvent event)
{
Player player = event.getPlayer();
if (!hasPerk(player))
{
return;
}
if (isOnCooldown(player))
{
player.getInventory().setItem(_slot, _cooldownItem);
}
else
{
giveItem(player);
}
}
@EventHandler
public void clearCooldowns(PlayerQuitEvent event)
{
UUID key = event.getPlayer().getUniqueId();
_lastSkill.remove(key);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
}
protected boolean isSkillItem(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return false;
}
if (!UtilEvent.isAction(event, _actionType))
{
if (_actionType != null || event.getAction() == Action.PHYSICAL)
{
return false;
}
}
Player player = event.getPlayer();
ItemStack itemStack = event.getItem();
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null)
{
return false;
}
return itemStack.isSimilar(_item);
}
protected boolean isSkillSneak(PlayerToggleSneakEvent event)
{
if (event.isCancelled() || !event.isSneaking())
{
return false;
}
Player player = event.getPlayer();
ItemStack itemStack = player.getInventory().getItem(_slot);
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null)
{
return false;
}
return itemStack.isSimilar(_item);
}
@EventHandler
public void dropTrigger(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
if (!_dropItemActivate || !hasPerk(player))
{
return;
}
// Call interact with a fake PlayerInteractEvent
PlayerInteractEvent interactEvent = new PlayerInteractEvent(event.getPlayer(), Action.RIGHT_CLICK_AIR, player.getInventory().getItem(_slot), null, null);
// You actually need to setCancelled false here otherwise it remains cancelled by default when the clicked block is null, thanks Bukkit
interactEvent.setCancelled(false);
interact(interactEvent);
}
public void useSkill(Player player)
{
_lastSkill.put(player.getUniqueId(), System.currentTimeMillis());
if (_cooldown > 0 && !UtilPlayer.isSpectator(player))
{
player.getInventory().setItem(_slot, _cooldownItem);
}
}
protected void broadcast(Player player)
{
Moba game = (Moba) Manager.GetGame();
GameTeam team = game.GetTeam(player);
HeroKit kit = game.getMobaData(player).getKit();
if (team == null || kit == null)
{
return;
}
game.Announce(team.GetColor() + C.Bold + player.getName() + " " + kit.getRole().getChatColor() + kit.GetName() + C.cWhiteB + " activated their " + team.GetColor() + C.Bold + GetName() + C.cWhiteB + ".", false);
player.getWorld().playSound(player.getLocation(), Sound.NOTE_PLING, 10, 0.5F);
}
@EventHandler
public void updateCooldowns(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST || _item == null)
{
return;
}
Moba moba = (Moba) Manager.GetGame();
long current = System.currentTimeMillis();
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !_lastSkill.containsKey(player.getUniqueId()))
{
continue;
}
ItemStack itemStack = player.getInventory().getItem(_slot);
long start = _lastSkill.get(player.getUniqueId());
long cooldown = _cooldown;
// Modify the cooldown with respect to the upgrade items purchased from the shop
CooldownCalculateEvent cooldownEvent = new CooldownCalculateEvent(player, GetName(), cooldown);
UtilServer.CallEvent(cooldownEvent);
cooldown = cooldownEvent.getCooldown();
boolean done = UtilTime.elapsed(start, cooldown);
// If the player is crippled say they are
if (moba.getBuffManager().hasBuff(player, BuffCripple.class))
{
player.getInventory().setItem(_slot, BuffCripple.getItemRepresentation());
continue;
}
if (done)
{
_lastSkill.remove(player.getUniqueId());
giveItem(player);
}
else
{
long timeDiff = current - start;
// Work out the itemstack amount based on the cooldowns.
// Adding 1 as due to the nature of cooldowns it seems to take much longer to go
// from 2 -> 1 -> 0 as the itemstack doesn't change
double amount = (cooldown / 1000) - Math.ceil((double) timeDiff / 1000) + 1;
if (itemStack == null)
{
itemStack = _cooldownItem;
}
itemStack.setAmount((int) amount);
}
}
}
public void giveItem(Player player)
{
player.getInventory().setItem(_slot, _item);
}
public void useActiveSkill(Player player, long time)
{
useActiveSkill(null, player, time);
}
public void useActiveSkill(Runnable complete, Player player, long time)
{
long ticks = (long) (time / 1000D);
ItemStack itemStack = player.getInventory().getItem(getSlot());
itemStack.setAmount((int) (ticks / 20D));
UtilInv.addDullEnchantment(itemStack);
Recharge.Instance.useForce(player, GetName(), time, true);
Recharge.Instance.setDisplayForce(player, GetName(), true);
Manager.runSyncTimer(new BukkitRunnable()
{
int iterations = 0;
@Override
public void run()
{
if (iterations++ > ticks)
{
if (complete != null)
{
complete.run();
}
useSkill(player);
cancel();
return;
}
itemStack.setAmount(itemStack.getAmount() - 1);
}
}, 0, 20);
}
public void resetCooldown(Player player)
{
_lastSkill.put(player.getUniqueId(), 0L);
}
protected boolean isTeamDamage(LivingEntity damagee, LivingEntity damager)
{
if (!(damager instanceof Player))
{
return false;
}
GameTeam team = Manager.GetGame().GetTeam((Player) damager);
return team != null && MobaUtil.isTeamEntity(damagee, team);
}
public int getSlot()
{
return _slot;
}
public ItemStack getCooldownItem()
{
return _cooldownItem;
}
public boolean isOnCooldown(Player player)
{
return _lastSkill.containsKey(player.getUniqueId());
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.moba.kit;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitPlayer extends Kit
{
private static final String[] DESCRIPTION = {
};
public KitPlayer(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free, DESCRIPTION, new Perk[0], EntityType.PIG, null);
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,61 @@
package nautilus.game.arcade.game.games.moba.kit;
import mineplex.core.common.entity.ClientArmorStand;
import nautilus.game.arcade.game.games.moba.MobaRole;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class RoleSelectEvent extends PlayerEvent implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
private final ClientArmorStand _stand;
private final MobaRole _role;
private boolean _cancel;
public RoleSelectEvent(Player who, ClientArmorStand stand, MobaRole role)
{
super(who);
_stand = stand;
_role = role;
}
public ClientArmorStand getStand()
{
return _stand;
}
public MobaRole getRole()
{
return _role;
}
@Override
public boolean isCancelled()
{
return _cancel;
}
@Override
public void setCancelled(boolean b)
{
_cancel = b;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class HeroAnath extends HeroKit
{
private static final Perk[] PERKS = {
new SkillFireProjectile(0),
new SkillBurnBeam(1),
new SkillFlameDash(2),
new SkillMeteor(3)
};
private static final ItemStack AMMO = new ItemBuilder(Material.BLAZE_POWDER)
.setTitle(C.cYellowB + "Embers")
.build();
public HeroAnath(ArcadeManager manager)
{
super(manager, "Anath", PERKS, MobaRole.MAGE, SkinData.ANATH);
setAmmo(AMMO, 1000);
setMaxAmmo(4);
}
}

View File

@ -0,0 +1,97 @@
package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
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.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
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 org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SkillBurnBeam extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Fires a single, vertical beam of Flames which move forward in a straight.",
"It passes through enemies and structures dealing damage",
"to anything it passes through."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FIREBALL);
public SkillBurnBeam(int slot)
{
super("Burn Beam", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(10000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
Vector direction = player.getLocation().getDirection().setY(0);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2, 0.5F);
useSkill(player);
LineParticle particle = new LineParticle(player.getLocation().add(direction), direction, 0.2, 9, null, ParticleType.LAVA, UtilServer.getPlayers());
particle.setIgnoreAllBlocks(true);
Manager.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
for (int i = 0; i < 3; i++)
{
if (particle.update())
{
cancel();
return;
}
else
{
UtilParticle.PlayParticleToAll(ParticleType.FLAME, particle.getLastLocation().clone().add(0, 5, 0), 0.4F, 5, 0.4F, 0.05F, 30, ViewDist.LONG);
}
}
if (Math.random() < 0.1)
{
particle.getLastLocation().getWorld().playSound(particle.getLastLocation(), Sound.GHAST_FIREBALL, 2, 0.5F);
}
for (LivingEntity entity : UtilEnt.getInRadius(particle.getLastLocation(), 2).keySet())
{
if (entity.equals(player) || !Recharge.Instance.use(player, GetName() + entity.getUniqueId() + player.getName(), 2000, false, false))
{
continue;
}
entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.EXPLODE, 2, 0.5F);
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, 15, true, true, false, UtilEnt.getName(player), GetName());
}
}
}, 0, 1);
}
}

View File

@ -0,0 +1,52 @@
package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
public class SkillFireProjectile extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Fires an Ember at high speed in front of you.",
"Any enemies it collides with take damage and are set on fire."
};
private static final int DAMAGE = 5;
private static final ItemStack SKILL_ITEM = new ItemStack(Material.BLAZE_ROD);
public SkillFireProjectile(int slot)
{
super("Flame Wand", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!_kit.useAmmo(player, 1))
{
return;
}
Vector direction = player.getLocation().getDirection().multiply(1.25);
Item item = player.getWorld().dropItem(player.getEyeLocation().add(direction), _kit.getAmmo());
item.setVelocity(direction);
Manager.GetFire().Add(item, player, 3, 0, 1, DAMAGE, MobaConstants.BASIC_ATTACK, false);
((Moba) Manager.GetGame()).getTowerManager().addProjectile(player, item, DAMAGE);
}
}

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.util.UtilBlock;
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class SkillFlameDash extends DashSkill
{
private static final String[] DESCRIPTION = {
"Dash along the ground, leaving fire behind you.",
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillFlameDash(int slot)
{
super("Flame Dash", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(12000);
_collide = false;
_velocityTime = 600;
_velocityStopOnEnd = true;
_horizontial = true;
}
@Override
public void dashTick(Player player)
{
Block block = player.getLocation().getBlock();
while (!UtilBlock.solid(block))
{
block = block.getRelative(BlockFace.DOWN);
}
Block fBlock = block;
Manager.runSyncLater(() -> Manager.GetBlockRestore().add(fBlock.getRelative(BlockFace.UP), Material.FIRE.getId(), (byte) 0, 5000), 10);
}
}

View File

@ -0,0 +1,188 @@
package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
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 nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.kit.perks.data.MeteorShowerData;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LargeFireball;
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.EntityChangeBlockEvent;
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 java.awt.*;
import java.util.HashSet;
import java.util.Set;
public class SkillMeteor extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Shoot out a Block of Netherrack which is placed where it lands.",
"Meteors rain from the sky around the block.",
"Enemies within the area are damaged.",
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private final Set<MeteorShowerData> _data = new HashSet<>();
public SkillMeteor(int slot)
{
super("Meteor Shower", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!Recharge.Instance.use(player, GetName() + "Trigger", 2000, false, false))
{
return;
}
for (MeteorShowerData data : _data)
{
if (data.Shooter.equals(player))
{
return;
}
}
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection()), Material.NETHERRACK, (byte) 0);
block.setVelocity(player.getLocation().getDirection());
Manager.GetProjectile().AddThrow(block, player, this, 2000, true, true, true, false, 0.5F);
broadcast(player);
useActiveSkill(player, 7000);
}
@EventHandler
public void entityChangeBlock(EntityChangeBlockEvent event)
{
if (event.getEntity() instanceof FallingBlock)
{
event.getEntity().remove();
event.setCancelled(true);
}
}
@EventHandler
public void updateShower(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
_data.removeIf(MeteorShowerData::update);
for (MeteorShowerData data : _data)
{
Location location = data.Target;
GameTeam team = Manager.GetGame().GetTeam(data.Shooter);
DustSpellColor colour = new DustSpellColor(team.GetColor() == ChatColor.RED ? Color.RED : Color.CYAN);
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 100)
{
double x = 10 * Math.sin(theta);
double z = 10 * Math.cos(theta);
location.add(x, 0.25, z);
new ColoredParticle(ParticleType.RED_DUST, colour, location).display(ViewDist.LONG);
location.subtract(x, 0.25, z);
}
for (LivingEntity nearby : UtilEnt.getInRadius(location, 10).keySet())
{
if (isTeamDamage(data.Shooter, nearby))
{
continue;
}
nearby.setFireTicks(20);
Manager.GetDamage().NewDamageEvent(nearby, data.Shooter, null, DamageCause.CUSTOM, 2, true, true, false, UtilEnt.getName(data.Shooter), GetName());
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void projectileHit(EntityExplodeEvent event)
{
if (event.getEntity() instanceof LargeFireball)
{
event.blockList().clear();
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Entity thrown = data.getThrown();
startShower(data);
thrown.remove();
}
@Override
public void Idle(ProjectileUser data)
{
Expire(data);
}
@Override
public void Expire(ProjectileUser data)
{
for (MeteorShowerData showerData : _data)
{
if (showerData.Shooter.equals(data.getThrower()))
{
return;
}
}
startShower(data);
data.getThrown().remove();
}
private void startShower(ProjectileUser data)
{
Manager.GetBlockRestore().add(data.getThrown().getLocation().getBlock(), Material.NETHERRACK.getId(), (byte) 0, 6000);
_data.add(new MeteorShowerData((Player) data.getThrower(), data.getThrown().getLocation(), 6000));
}
}

View File

@ -0,0 +1,289 @@
package nautilus.game.arcade.game.games.moba.kit.bardolf;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
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.ArcadeManager;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class HeroBardolf extends HeroKit
{
private static final int MIN_DIST_SQUARED = 2;
private static final int MAX_DIST_SQUARED = 100;
private final List<WolfData> _data;
private static final Perk[] PERKS = {
new SkillSword(0),
new SkillSummonWolf(1),
new SkillWolfPounce(2),
new SkillFullMoon(3)
};
public HeroBardolf(ArcadeManager manager)
{
super(manager, "Bardolf", PERKS, MobaRole.ASSASSIN, SkinData.BARDOLF);
_data = new ArrayList<>(2);
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_data.removeIf(data -> data.getOwner().equals(event.getPlayer()));
}
@EventHandler
public void updateWolves(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || !Manager.GetGame().IsLive())
{
return;
}
for (WolfData data : _data)
{
data.getWolves().removeIf(wolf -> wolf.isDead() || !wolf.isValid());
data.getWolves().forEach(wolf ->
{
if (data.getOverrideTarget().containsKey(wolf))
{
UtilEnt.CreatureMoveFast(wolf, data.getOverrideTarget().get(wolf), data.isUltimate() ? 2F : 1.5F);
return;
}
double ownerOffset = UtilMath.offsetSquared(data.getOwner(), wolf);
if (wolf.getTarget() != null)
{
LivingEntity target = wolf.getTarget();
if (UtilPlayer.isSpectator(target) || target.isDead() || !target.isValid())
{
wolf.setTarget(null);
return;
}
UtilEnt.CreatureMoveFast(wolf, wolf.getTarget().getLocation(), data.isUltimate() ? 2F : 1.5F);
if (UtilMath.offsetSquared(wolf.getTarget(), wolf) < 9 && Recharge.Instance.use(data.getOwner(), "Wolf" + wolf.getTarget().getUniqueId(), 500, false, false))
{
Manager.GetDamage().NewDamageEvent(wolf.getTarget(), data.getOwner(), null, DamageCause.CUSTOM, 2, true, true, false, data.getOwner().getName(), "Wolf");
}
}
else if (ownerOffset > MAX_DIST_SQUARED)
{
wolf.teleport(data.getOwner());
}
else if (ownerOffset > MIN_DIST_SQUARED)
{
UtilEnt.CreatureMoveFast(wolf, data.getOwner().getLocation(), data.isUltimate() ? 2F : 1.5F);
}
});
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void updateTarget(CustomDamageEvent event)
{
if (event.isCancelled())
{
return;
}
Player damager = event.GetDamagerPlayer(true);
WolfData data = getWolfData(damager);
if (damager == null || data == null)
{
return;
}
for (Wolf wolf : data.getWolves())
{
wolf.setTarget(event.GetDamageeEntity());
}
}
@EventHandler
public void preventTeamDamage(CustomDamageEvent event)
{
if (event.isCancelled())
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
LivingEntity damager = event.GetDamagerEntity(true);
WolfData data = getWolfData(damagee);
if (data == null || !(damager instanceof Player))
{
return;
}
GameTeam team = Manager.GetGame().GetTeam((Player) damager);
if (team != null && MobaUtil.isTeamEntity(damagee, team))
{
event.SetCancelled("Team Wolf");
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void entityDeath(EntityDeathEvent event)
{
for (WolfData data : _data)
{
if (data.getWolves().contains(event.getEntity()))
{
event.setDroppedExp(0);
event.getDrops().clear();
}
}
}
@EventHandler
public void playerDeath(PlayerDeathEvent event)
{
WolfData data = getWolfData(event.getEntity());
if (data == null)
{
return;
}
data.getWolves().forEach(Entity::remove);
}
public WolfData getWolfData(Player player)
{
if (player == null)
{
return null;
}
for (WolfData data : _data)
{
if (data.getOwner().equals(player))
{
return data;
}
}
if (Manager.GetGame().GetKit(player).equals(this))
{
WolfData data = new WolfData(player);
_data.add(data);
return data;
}
return null;
}
public WolfData getWolfData(LivingEntity entity)
{
if (entity == null)
{
return null;
}
for (WolfData data : _data)
{
if (data.getOwner().equals(entity))
{
return data;
}
for (Wolf wolf : data.getWolves())
{
if (wolf.equals(entity))
{
return data;
}
}
}
return null;
}
class WolfData
{
private Player _owner;
private List<Wolf> _wolves;
private final Map<Wolf, Location> _overrideTarget;
private boolean _ultimate;
private float _lastSpeedIncrease;
WolfData(Player owner)
{
_owner = owner;
_wolves = new ArrayList<>(5);
_overrideTarget = new HashMap<>(5);
}
public Player getOwner()
{
return _owner;
}
public List<Wolf> getWolves()
{
return _wolves;
}
public Map<Wolf, Location> getOverrideTarget()
{
return _overrideTarget;
}
public void setUltimate(boolean ultimate)
{
_ultimate = ultimate;
}
public boolean isUltimate()
{
return _ultimate;
}
public void setLastSpeedIncrease(float increase)
{
_lastSpeedIncrease = increase;
}
public float getLastSpeedIncrease()
{
return _lastSpeedIncrease;
}
}
}

View File

@ -0,0 +1,118 @@
package nautilus.game.arcade.game.games.moba.kit.bardolf;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.bardolf.HeroBardolf.WolfData;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;
public class SkillFullMoon extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Turns the character into a Werewolf.",
"He gains +1 attack Damage and +5% Movement speed for each Wolf alive in his pack.",
"The Wolves gain movement speed to catch up and are healed to their full HP.",
"As wolves die his power decreases.",
"All Wolves in the pack die after the ultimate ends"
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private static final long DURATION = TimeUnit.SECONDS.toMillis(10);
private static final int HEALTH = 20;
private static final float SPEED_FACTOR = 0.05F;
private final Set<Player> _active = new HashSet<>();
public SkillFullMoon(int slot)
{
super("Full Moon", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!isSkillItem(event) || _active.contains(player))
{
return;
}
HeroBardolf kit = (HeroBardolf) Kit;
WolfData data = kit.getWolfData(player);
if (data == null)
{
return;
}
_active.add(player);
Manager.GetGame().WorldTimeSet = 18000;
player.getWorld().strikeLightningEffect(player.getLocation());
kit.disguise(player, SkinData.BARDOLF_WEREWOLF);
data.setUltimate(true);
float speedIncrease = (float) data.getWolves().size() * SPEED_FACTOR;
data.setLastSpeedIncrease(speedIncrease);
player.setWalkSpeed(player.getWalkSpeed() + speedIncrease);
for (Wolf wolf : data.getWolves())
{
wolf.setMaxHealth(HEALTH);
wolf.setHealth(wolf.getMaxHealth());
wolf.setTamed(false);
wolf.setAngry(true);
wolf.getWorld().playSound(wolf.getLocation(), Sound.WOLF_GROWL, 1, 1);
}
broadcast(player);
useActiveSkill(() ->
{
_active.remove(player);
Manager.GetGame().WorldTimeSet = 12000;
data.setUltimate(false);
kit.disguise(player);
player.setWalkSpeed(player.getWalkSpeed() - data.getLastSpeedIncrease());
for (Wolf wolf : data.getWolves())
{
wolf.setHealth(0);
}
}, player, DURATION);
}
@EventHandler
public void damagePlayer(CustomDamageEvent event)
{
LivingEntity damagerEntity = event.GetDamagerEntity(true);
Player damagerPlayer = event.GetDamagerPlayer(true);
WolfData data = ((HeroBardolf) Kit).getWolfData(damagerEntity);
if (data == null)
{
return;
}
// Player Damage
if (damagerPlayer != null && _active.contains(damagerPlayer))
{
event.AddMod(GetName(), data.getWolves().size());
}
}
}

View File

@ -0,0 +1,124 @@
package nautilus.game.arcade.game.games.moba.kit.bardolf;
import mineplex.core.common.util.F;
import mineplex.core.common.util.SpigotUtil;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.bardolf.HeroBardolf.WolfData;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
public class SkillSummonWolf extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Click to summon a Wolf to your pack.",
"Wolves are tamed and will attack your target or people who damage you.",
"Wolves are weak and can be killed.",
"Maximum of 5."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.BONE);
private static final int MAX_WOLVES = 5;
private static final int HEALTH = 6;
public SkillSummonWolf(int slot)
{
super("Summon Wolf", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(5000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!isSkillItem(event))
{
return;
}
WolfData data = ((HeroBardolf) Kit).getWolfData(player);
if (data == null)
{
return;
}
else if (data.getWolves().size() == MAX_WOLVES)
{
player.sendMessage(F.main("Game", "You have already summoned the maximum amount of wolves."));
return;
}
else if (data.isUltimate())
{
player.sendMessage(F.main("Game", "You cannot summon new wolves right now."));
return;
}
Game game = Manager.GetGame();
GameTeam team = game.GetTeam(player);
if (team == null)
{
return;
}
game.CreatureAllowOverride = true;
Wolf wolf = player.getWorld().spawn(player.getLocation(), Wolf.class);
DyeColor dyeColor = team.GetColor() == ChatColor.RED ? DyeColor.RED : DyeColor.BLUE;
wolf.setCollarColor(dyeColor);
wolf.setTamed(true);
SpigotUtil.setOldOwner_RemoveMeWhenSpigotFixesThis(wolf, player);
wolf.setOwner(player);
wolf.setHealth(HEALTH);
wolf.setMaxHealth(HEALTH);
UtilEnt.vegetate(wolf);
MobaUtil.setTeamEntity(wolf, team);
player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1, 1.1F);
data.getWolves().add(wolf);
game.CreatureAllowOverride = false;
useSkill(player);
}
@EventHandler
public void updateWolfItem(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
HeroBardolf kit = (HeroBardolf) Kit;
for (Player player : Manager.GetGame().GetPlayers(true))
{
WolfData data = kit.getWolfData(player);
ItemStack itemStack = player.getInventory().getItem(getSlot());
if (data == null || itemStack == null || itemStack.getType() != SKILL_ITEM.getType())
{
continue;
}
itemStack.setAmount(data.getWolves().size());
}
}
}

View File

@ -0,0 +1,169 @@
package nautilus.game.arcade.game.games.moba.kit.bardolf;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
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.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.bardolf.HeroBardolf.WolfData;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class SkillWolfPounce extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Dash into the air",
"Your wolves will follow you."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
private static final int COOLDOWN = 7000;
private final Set<PounceData> _data = new HashSet<>(2);
public SkillWolfPounce(int slot)
{
super("Wolf Pounce", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(COOLDOWN);
setSneakActivate(true);
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_data.removeIf(data -> data.Leader.equals(event.getPlayer()));
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@EventHandler
public void toggleSneak(PlayerToggleSneakEvent event)
{
if (!isSkillSneak(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@Override
public void useSkill(Player player)
{
super.useSkill(player);
WolfData data = ((HeroBardolf) Kit).getWolfData(player);
if (data == null)
{
return;
}
for (Wolf wolf : data.getWolves())
{
data.getOverrideTarget().put(wolf, player.getLocation());
}
Vector direction = player.getLocation().getDirection();
direction.setY(Math.max(0.8, direction.getY()));
_data.add(new PounceData(player, data, direction));
UtilAction.velocity(player, direction);
player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 2, 1F);
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation().add(0, 0.6, 0), 0.5F, 0.5F, 0.5F, 0.1F, 15, ViewDist.LONG);
}
@EventHandler
public void updateWolves(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
Iterator<PounceData> iterator = _data.iterator();
while (iterator.hasNext())
{
PounceData data = iterator.next();
for (Wolf wolf : data.WolfData.getWolves())
{
// Wolf has already leaped
if (data.LeapedWolves.contains(wolf) || UtilMath.offsetSquared(data.Target, wolf.getLocation()) > 4)
{
continue;
}
data.LeapedWolves.add(wolf);
wolf.setVelocity(data.Direction);
wolf.getWorld().playSound(wolf.getLocation(), Sound.WOLF_WHINE, 1, 1.5F);
data.WolfData.getOverrideTarget().remove(wolf);
}
if (UtilTime.elapsed(data.Time, COOLDOWN - 500))
{
iterator.remove();
data.WolfData.getOverrideTarget().clear();
}
}
}
private class PounceData
{
Player Leader;
WolfData WolfData;
Location Target;
Vector Direction;
long Time;
List<Wolf> LeapedWolves;
PounceData(Player leader, WolfData wolfData, Vector direction)
{
Leader = leader;
WolfData = wolfData;
Target = leader.getLocation();
Direction = direction.multiply(1.5);
Time = System.currentTimeMillis();
LeapedWolves = new ArrayList<>(5);
}
}
}

View File

@ -0,0 +1,24 @@
package nautilus.game.arcade.game.games.moba.kit.biff;
import mineplex.core.common.skin.SkinData;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.kit.Perk;
public class HeroBiff extends HeroKit
{
private static final Perk[] PERKS = {
new SkillSword(0),
new SkillLeash(1),
new SkillBiffDash(2),
new SkillWarHorse(3)
};
public HeroBiff(ArcadeManager manager)
{
super(manager, "Biff", PERKS, MobaRole.WARRIOR, SkinData.BIFF);
}
}

View File

@ -0,0 +1,158 @@
package nautilus.game.arcade.game.games.moba.kit.biff;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
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.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
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.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.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class SkillBiffDash extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Dash into the air.",
"When you land any enemies near you are damaged",
"and thrown up into the air."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
private final Map<Player, Long> _active = new HashMap<>();
public SkillBiffDash(int slot)
{
super("Battle Leap", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(11000);
setSneakActivate(true);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@EventHandler
public void toggleSneak(PlayerToggleSneakEvent event)
{
if (!isSkillSneak(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@Override
public void useSkill(Player player)
{
if (_active.containsKey(player))
{
return;
}
super.useSkill(player);
Vector direction = player.getLocation().getDirection().setY(1);
UtilAction.velocity(player, direction);
player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_THROW, 1, 1F);
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation().add(0, 0.6, 0), 0.5F, 0.5F, 0.5F, 0.1F, 15, ViewDist.LONG);
_active.put(player, System.currentTimeMillis());
}
@EventHandler
public void landed(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
Iterator<Player> iterator = _active.keySet().iterator();
while (iterator.hasNext())
{
Player player = iterator.next();
long start = _active.get(player);
if (!player.isOnline())
{
iterator.remove();
}
// They have just activated it
if (!UtilTime.elapsed(start, 1000) || player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
continue;
}
for (Block block : UtilBlock.getBlocksInRadius(player.getLocation(), 5))
{
if (block.getType() == Material.AIR || block.getRelative(BlockFace.UP).getType() != Material.AIR || Math.random() > 0.5)
{
continue;
}
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
}
for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 5).keySet())
{
if (isTeamDamage(player, entity))
{
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation().add(0, 0.6, 0), 0.5F, 0.5F, 0.5F, 0.1F, 15, ViewDist.LONG);
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, 4, false, true, false, UtilEnt.getName(player), GetName());
UtilAction.velocity(entity, new Vector(0, 0.6 + Math.random() / 2, 0));
}
iterator.remove();
}
}
@EventHandler
public void playerDeath(PlayerDeathEvent event)
{
_active.remove(event.getEntity());
}
}

View File

@ -0,0 +1,129 @@
package nautilus.game.arcade.game.games.moba.kit.biff;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.common.LeashedEntity;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class SkillLeash extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Enemy heroes near to Biff are hooked with a leash to you.",
"Leashed players are slowed and it breaks if the leashed player moves",
"too far away."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.LEASH);
private final Map<Player, List<LeashedEntity>> _leashed = new HashMap<>();
public SkillLeash(int slot)
{
super("Tether", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(12000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!isSkillItem(event) || _leashed.containsKey(player))
{
return;
}
List<Player> nearbyPlayers = UtilPlayer.getNearby(player.getLocation(), 8);
nearbyPlayers.removeIf(other -> isTeamDamage(other, player));
if (nearbyPlayers.isEmpty())
{
player.sendMessage(F.main("Game", "There was no one in range to leash."));
return;
}
List<LeashedEntity> leashedEntities = new ArrayList<>(nearbyPlayers.size());
StringBuilder builder = new StringBuilder(F.main("Game", "You leashed "));
for (Player nearby : nearbyPlayers)
{
nearby.setLeashHolder(player);
nearby.setPullWhileLeashed(false);
nearby.setShouldBreakLeash(false);
nearby.sendMessage(F.main("Game", F.name(player.getName()) + " leashed you."));
nearby.playSound(nearby.getLocation(), Sound.DOOR_CLOSE, 1, 1);
builder.append(F.name(nearby.getName())).append(", ");
UtilAction.zeroVelocity(nearby);
Manager.GetCondition().Factory().Slow(GetName(), nearby, player, 5, 1, false, true, true, false);
leashedEntities.add(new LeashedEntity(Manager, nearby, player));
}
_leashed.put(player, leashedEntities);
player.playSound(player.getLocation(), Sound.DOOR_CLOSE, 1, 1);
player.sendMessage(builder.toString());
useActiveSkill(() ->
{
for (LeashedEntity leashed : _leashed.remove(player))
{
removeEffect(leashed);
}
}, player, 5000);
}
@EventHandler
public void updateLeashed(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Entry<Player, List<LeashedEntity>> entry : _leashed.entrySet())
{
Iterator<LeashedEntity> iterator = entry.getValue().iterator();
while (iterator.hasNext())
{
LeashedEntity leashed = iterator.next();
if (!UtilPlayer.isSpectator(entry.getKey()) && UtilMath.offsetSquared(entry.getKey(), leashed.getHost()) < 100)
{
continue;
}
removeEffect(leashed);
iterator.remove();
}
}
}
private void removeEffect(LeashedEntity entity)
{
entity.getHost().removePotionEffect(PotionEffectType.SLOW);
entity.remove();
}
}

View File

@ -0,0 +1,170 @@
package nautilus.game.arcade.game.games.moba.kit.biff;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
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.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.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffRooting;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Horse;
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.HashSet;
import java.util.Iterator;
import java.util.Set;
public class SkillWarHorse extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Mounts you on a horse.",
"Any nearby enemy heroes are rooted and will be",
"unable to move."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private static final ItemStack HORSE_ARMOUR = new ItemStack(Material.IRON_BARDING);
private static final ItemStack SADDLE = new ItemStack(Material.SADDLE);
private final Set<WarHorseData> _data = new HashSet<>();
public SkillWarHorse(int slot)
{
super("Cavalry Charge", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(45000);
setDropItemActivate(true);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
for (WarHorseData data : _data)
{
if (data.Owner.equals(player))
{
return;
}
}
Manager.GetGame().CreatureAllowOverride = true;
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, horse.getLocation().add(0, 1, 0), 1, 1, 1, 0.1F, 50, ViewDist.LONG);
horse.getWorld().strikeLightningEffect(horse.getLocation());
horse.getWorld().playSound(horse.getLocation(), Sound.HORSE_DEATH, 1, 1.1F);
horse.setHealth(20);
horse.setMaxHealth(horse.getHealth());
horse.setJumpStrength(1);
horse.setMaxDomestication(1);
horse.setDomestication(horse.getMaxDomestication());
horse.getInventory().setArmor(HORSE_ARMOUR);
horse.getInventory().setSaddle(SADDLE);
horse.setOwner(player);
horse.setPassenger(player);
MobaUtil.setTeamEntity(horse, Manager.GetGame().GetTeam(player));
Manager.GetGame().CreatureAllowOverride = false;
_data.add(new WarHorseData(player, horse));
broadcast(player);
useActiveSkill(player, 5500);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
Iterator<WarHorseData> iterator = _data.iterator();
while (iterator.hasNext())
{
WarHorseData data = iterator.next();
Player owner = data.Owner;
Horse horse = data.Horse;
if (UtilTime.elapsed(data.Start, 6000) || UtilPlayer.isSpectator(owner) || horse.isDead() || !horse.isValid())
{
horse.getWorld().playSound(horse.getLocation(), Sound.HORSE_BREATHE, 1, 1.1F);
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, horse.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.1F, 50, ViewDist.LONG);
horse.remove();
iterator.remove();
}
else
{
Moba game = (Moba) Manager.GetGame();
BuffManager buffManager = game.getBuffManager();
for (Player player : UtilPlayer.getNearby(horse.getLocation(), 5))
{
if (isTeamDamage(owner, player) || !Recharge.Instance.use(player, GetName() + "Rooting", 2000, false, false))
{
continue;
}
owner.sendMessage(F.main("Game", "You hit " + F.name(player.getName()) + "."));
Manager.GetDamage().NewDamageEvent(player, owner, null, DamageCause.CUSTOM, 10, false, true, false, UtilEnt.getName(owner), GetName());
buffManager.apply(new BuffRooting(game, player, 1000));
}
}
}
}
@EventHandler
public void horseDamage(CustomDamageEvent event)
{
for (WarHorseData data : _data)
{
if (data.Horse.equals(event.GetDamageeEntity()))
{
event.SetCancelled("Biff Horse");
return;
}
}
}
private class WarHorseData
{
public Player Owner;
public Horse Horse;
public long Start;
WarHorseData(Player owner, Horse horse)
{
Owner = owner;
Horse = horse;
Start = System.currentTimeMillis();
}
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class HeroBob extends HeroKit
{
private static final Perk[] PERKS = {
new SkillPaint(0),
new SkillHappyTrees(1),
new SkillBeatTheDevil(2),
new SkillBuildPainting(3)
};
private static final ItemStack AMMO = new ItemBuilder(Material.SNOW_BALL)
.setTitle(C.cYellowB + "Titanium Hwhite")
.build();
public HeroBob(ArcadeManager manager)
{
super(manager, "Bob Ross", PERKS, MobaRole.MAGE, SkinData.BOB_ROSS);
setAmmo(AMMO, 500);
setMaxAmmo(8);
setVisible(false);
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Color;
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.inventory.ItemStack;
public class SkillBeatTheDevil extends DashSkill
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillBeatTheDevil(int slot)
{
super("Beat The Devil Out Of It", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(12000);
_collide = false;
_velocityTime = 800;
_velocityStopOnEnd = true;
}
@Override
public void dashTick(Player player)
{
player.getWorld().playSound(player.getLocation(), player.getTicksLived() % 2 == 0 ? Sound.DOOR_OPEN : Sound.DOOR_CLOSE, 1, 0.5F);
for (int i = 0; i < 10; i++)
{
UtilParticle.playColoredParticleToAll(Color.RED, ParticleType.RED_DUST, UtilAlg.getRandomLocation(player.getLocation().add(0, 1, 0), 2), 1, ViewDist.LONG);
}
}
}

View File

@ -0,0 +1,209 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
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.ItemSpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
public class SkillBuildPainting extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final BlockFace[] AXIS = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
private static final byte[][] PAINTING = {
{
3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3
},
{
3, 3, 0, 0, 0, 0, 3, 3, 0, 0, 0, 3, 3, 3, 3
},
{
3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3
},
{
3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 13, 3
},
{
3, 3, 0, 0, 0, 3, 3, 3, 5, 3, 3, 13, 3, 13, 3
},
{
3, 3, 8, 8, 8, 8, 3, 5, 5, 5, 3, 13, 13, 13, 13
},
{
3, 3, 8, 8, 8, 8, 3, 3, 12, 3, 13, 13, 13, 13, 13
},
{
3, 3, 7, 7, 7, 7, 7, 3, 12, 3, 3, 12, 3, 12, 3
},
{
5, 7, 7, 7, 7, 7, 7, 5, 12, 5, 5, 12, 5, 12, 5
}
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
public SkillBuildPainting(int slot)
{
super("The Joy Of Painting", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!Recharge.Instance.use(player, GetName() + " Trigger", 5000, false, false))
{
return;
}
useActiveSkill(player, 4000);
broadcast(player);
Set<Block> blocks = new HashSet<>();
Vector direction = player.getLocation().getDirection().normalize().setY(0);
Location start = player.getLocation().add(direction);
BlockFace facing = getFace(start.getYaw() + 180F);
Block center = start.getBlock().getRelative(facing).getRelative(BlockFace.UP);
float leftYaw = start.getYaw() - 90;
BlockFace leftSide = getFace(leftYaw);
for (int i = 0; i < 7; i++)
{
center = center.getRelative(leftSide);
}
BlockFace rightSide = leftSide.getOppositeFace();
// Rows
for (int y = 0; y < PAINTING.length; y++)
{
byte[] row = PAINTING[y];
// Column in row
for (int x = 0; x < row.length; x++)
{
Block result = center;
for (int i = 0; i < x; i++)
{
result = result.getRelative(rightSide);
}
result = result.getRelative(0, 8, 0);
for (int i = 0; i < y; i++)
{
result = result.getRelative(BlockFace.DOWN);
}
Block fResult = result;
byte blockData = row[x];
Manager.runSyncLater(() ->
{
blocks.add(fResult);
Manager.GetBlockRestore().add(fResult, Material.WOOL.getId(), blockData, Long.MAX_VALUE);
}, UtilMath.r(40));
}
}
Manager.runSyncLater(() ->
{
for (Block block : blocks)
{
if (Math.random() < 0.2)
{
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5, 0.5, 0.5), block.getType(), block.getData());
fallingBlock.setVelocity(direction.clone().multiply(1 + (Math.random() * 0.4)));
Manager.GetProjectile().AddThrow(fallingBlock, player, this, 2000, true, true, true, false, 0.5F);
}
Manager.GetBlockRestore().restore(block);
}
}, 80);
}
@EventHandler
public void itemSpawn(ItemSpawnEvent event)
{
if (event.getEntity().getItemStack().getType() == Material.WOOL)
{
event.setCancelled(true);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
damage(data);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
damage(data);
}
private void damage(ProjectileUser data)
{
Entity entity = data.getThrown();
data.getThrown().getWorld().playEffect(entity.getLocation(), Effect.STEP_SOUND, Material.WOOL, (byte) 0);
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(entity.getLocation(), 3).entrySet())
{
Manager.GetDamage().NewDamageEvent(entry.getKey(), data.getThrower(), null, DamageCause.BLOCK_EXPLOSION, 5, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
data.getThrown().remove();
}
private BlockFace getFace(float yaw)
{
return AXIS[Math.round(yaw / 90F) & 0x3];
}
}

View File

@ -0,0 +1,176 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaParticles;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Material;
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.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.*;
import java.util.Map.Entry;
public class SkillHappyTrees extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.SAPLING);
private final Set<HappyTreeData> _data = new HashSet<>();
public SkillHappyTrees(int slot)
{
super("Happy Little Trees", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(15000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
_data.add(new HappyTreeData(player));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
Iterator<HappyTreeData> iterator = _data.iterator();
while (iterator.hasNext())
{
HappyTreeData data = iterator.next();
if (UtilTime.elapsed(data.Start, 9000))
{
iterator.remove();
}
else if (data.Tree1 == null)
{
data.Tree1 = buildTree(data.Center);
}
else if (data.Tree2 == null)
{
data.Tree2 = buildTree(data.Center);
}
if (UtilTime.elapsed(data.Start, 2000))
{
healPlayers(data.Owner, data.Tree1);
healPlayers(data.Owner, data.Tree2);
}
}
}
private Block buildTree(Location center)
{
Location start = UtilAlg.getRandomLocation(center, 5, 0, 5);
Map<Block, Material> blocks = getTree(start);
for (Entry<Block, Material> entry : blocks.entrySet())
{
Manager.runSyncLater(() -> Manager.GetBlockRestore().add(entry.getKey(), entry.getValue().getId(), (byte) 0, (long) (6000 + (Math.random() * 1000))), UtilMath.r(60));
}
return start.getBlock();
}
private Map<Block, Material> getTree(Location start)
{
Block last = start.getBlock().getRelative(BlockFace.DOWN);
Map<Block, Material> blocks = new HashMap<>();
// Trunk
for (int i = 0; i < 5; i++)
{
Block next = last.getRelative(BlockFace.UP);
last = next;
blocks.put(next, Material.LOG);
}
last = last.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN);
// Bottom Leaves
for (Block block : UtilBlock.getInBoundingBox(last.getLocation().add(2, 1, 2), last.getLocation().subtract(2, 0, 2), false))
{
blocks.put(block, Material.LEAVES);
}
last = last.getRelative(BlockFace.UP).getRelative(BlockFace.UP);
// Middle Leaves
for (Block block : UtilBlock.getInBoundingBox(last.getLocation().add(1, 0, 1), last.getLocation().subtract(1, 0, 1), false))
{
blocks.put(block, Material.LEAVES);
}
last = last.getRelative(BlockFace.UP);
// Top Leaves
blocks.put(last.getRelative(BlockFace.NORTH), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.WEST), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.EAST), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.SOUTH), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.UP), Material.LEAVES);
return blocks;
}
private void healPlayers(Player owner, Block block)
{
for (LivingEntity entity : UtilEnt.getInRadius(block.getLocation(), 5).keySet())
{
// Don't heal enemies
if (!isTeamDamage(entity, owner))
{
continue;
}
MobaUtil.heal(entity, owner, 2);
MobaParticles.healing(entity, 1);
}
}
private class HappyTreeData
{
public Player Owner;
public long Start;
public Location Center;
public Block Tree1;
public Block Tree2;
public HappyTreeData(Player owner)
{
Owner = owner;
Start = System.currentTimeMillis();
Center = owner.getLocation();
}
}
}

View File

@ -0,0 +1,103 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
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.Random;
public class SkillPaint extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final byte[] COLOURS = { 14, 1, 4, 5, 3, 11, 0};
private static final int DAMAGE = 2;
private static final ItemStack SKILL_ITEM = new ItemStack(Material.DIAMOND_BARDING);
public SkillPaint(int slot)
{
super("1-Inch Brush", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!_kit.useAmmo(player, 1))
{
return;
}
useSkill(player);
Snowball snowball = player.launchProjectile(Snowball.class);
((Moba) Manager.GetGame()).getTowerManager().addProjectile(player, snowball, DAMAGE);
Manager.GetProjectile().AddThrow(snowball, player, this, -1, true, true, true, false, 0.5F);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Player thrower = (Player) data.getThrower();
Random random = UtilMath.random;
if (target != null)
{
thrower.playSound(thrower.getLocation(), Sound.LAVA_POP, 1, 1.3F);
Manager.GetDamage().NewDamageEvent(target, thrower, (Projectile) data.getThrown(), DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(thrower), GetName());
}
for (Block nearby : UtilBlock.getBlocksInRadius(data.getThrown().getLocation(), 2))
{
if (UtilBlock.airFoliage(nearby))
{
continue;
}
Manager.GetBlockRestore().add(nearby, Material.STAINED_CLAY.getId(), COLOURS[random.nextInt(COLOURS.length)], (long) (3000 + (Math.random() * 500)));
}
for (LivingEntity entity : UtilEnt.getInRadius(data.getThrown().getLocation(), 2).keySet())
{
Manager.GetDamage().NewDamageEvent(entity, thrower, (Projectile) data.getThrown(), DamageCause.PROJECTILE, 2, true, true, false, UtilEnt.getName(thrower), GetName());
}
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
}

View File

@ -0,0 +1,224 @@
package nautilus.game.arcade.game.games.moba.kit.common;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.*;
import java.util.Map.Entry;
public class DashSkill extends HeroSkill
{
// Teleport Only
protected boolean _teleport = false;
protected boolean _horizontial = false;
protected double _range = 10;
protected ParticleType _particleType = ParticleType.FIREWORKS_SPARK;
// Velocity
protected long _velocityTime;
protected double _velocityMagnitude = 1;
protected boolean _velocityStopOnEnd = false;
// Collisions
protected boolean _collide = true;
protected double _collideRange = 2;
protected boolean _collideTeammates = false;
protected boolean _collidePlayers = true;
protected boolean _collideEntities = true;
protected boolean _collideOnce = true;
private final Map<Player, Long> _startTime;
public DashSkill(String name, String[] perkDesc, ItemStack itemStack, int slot)
{
super(name, perkDesc, itemStack, slot, ActionType.ANY);
_startTime = new HashMap<>();
setSneakActivate(true);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@EventHandler
public void toggleSneak(PlayerToggleSneakEvent event)
{
if (!isSkillSneak(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@Override
public void useSkill(Player player)
{
super.useSkill(player);
preDash(player);
if (_teleport)
{
Vector direction = player.getLocation().getDirection();
if (_horizontial)
{
direction.setY(0);
}
LineParticle particle = new LineParticle(player.getEyeLocation(), direction, 0.8, _range, null, _particleType, UtilServer.getPlayers());
while (!particle.update())
{
dashTick(player);
checkCollisions(player, particle.getLastLocation());
}
player.teleport(particle.getDestination());
postDash(player);
}
// Otherwise we set their velocity.
else if (_velocityTime > 0)
{
_startTime.put(player, System.currentTimeMillis());
}
else
{
setVelocity(player);
}
}
@EventHandler
public void updateVelocity(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Entry<Player, Long> entry : _startTime.entrySet())
{
Player player = entry.getKey();
long start = entry.getValue();
if (UtilTime.elapsed(start, _velocityTime))
{
if (_velocityStopOnEnd)
{
UtilAction.zeroVelocity(player);
}
_startTime.remove(player);
postDash(player);
}
else
{
checkCollisions(player, player.getLocation());
setVelocity(player);
}
}
}
private void setVelocity(Player player)
{
Vector direction = player.getLocation().getDirection().multiply(_velocityMagnitude);
if (_horizontial)
{
direction.setY(0);
}
dashTick(player);
UtilAction.velocity(player, direction);
}
private void checkCollisions(Player player, Location location)
{
// No colliding
if (!_collide || !_collideEntities && !_collidePlayers)
{
return;
}
// All Living entities within the range
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(location, _collideRange).entrySet())
{
LivingEntity entity = entry.getKey();
double scale = entry.getValue();
// If player hit themselves
if (player.equals(entity))
{
continue;
}
if (_collideOnce && !Recharge.Instance.use(player, GetName() + entity.getUniqueId(), 500, false, false))
{
continue;
}
// If not allowing collisions with players
if (!_collidePlayers)
{
continue;
}
boolean sameTeam = isTeamDamage(entity, player);
// If their teams are the same and we don't allow collisions with teammates, ignore
if (sameTeam && !_collideTeammates)
{
continue;
}
collideEntity(entity, player, scale, sameTeam);
}
}
public void preDash(Player player)
{
}
public void dashTick(Player player)
{
}
public void collideEntity(LivingEntity entity, Player damager, double scale, boolean sameTeam)
{
}
public void postDash(Player player)
{
}
}

View File

@ -0,0 +1,85 @@
package nautilus.game.arcade.game.games.moba.kit.common;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class LeashedEntity implements Listener
{
private final LivingEntity _host;
private final Zombie _fakeLeash;
public LeashedEntity(ArcadeManager manager, LivingEntity host, LivingEntity leasher)
{
manager.GetGame().CreatureAllowOverride = true;
_host = host;
_fakeLeash = host.getWorld().spawn(host.getLocation(), Zombie.class);
UtilEnt.vegetate(_fakeLeash);
UtilEnt.silence(_fakeLeash, true);
_fakeLeash.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0, false, false));
_fakeLeash.setLeashHolder(leasher);
manager.GetGame().CreatureAllowOverride = false;
UtilServer.RegisterEvents(this);
}
public void remove()
{
_fakeLeash.setLeashHolder(null);
_fakeLeash.remove();
UtilServer.Unregister(this);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Location location = _host.getLocation();
((CraftLivingEntity) _fakeLeash).getHandle().setPosition(location.getX(), location.getY(), location.getZ());
}
@EventHandler(priority = EventPriority.LOWEST)
public void fakeLeashDamage(CustomDamageEvent event)
{
if (event.GetDamageeEntity().equals(_fakeLeash) && event.GetCause() == DamageCause.ENTITY_ATTACK)
{
event.setDamagee(_host);
event.SetIgnoreRate(false);
}
}
@EventHandler
public void fakeLeashFire(EntityCombustEvent event)
{
if (event.getEntity().equals(_fakeLeash))
{
event.setCancelled(true);
}
}
public LivingEntity getHost()
{
return _host;
}
}

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.game.games.moba.kit.common;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class SkillBow extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Please work"
};
private static final ItemStack SKILL_ITEM = new ItemBuilder(Material.BOW)
.setTitle(C.cGreenB + "Bow")
.setUnbreakable(true)
.build();
public SkillBow(int slot)
{
super("Bow", DESCRIPTION, SKILL_ITEM, slot, null);
}
@Override
public void giveItem(Player player)
{
Moba host = (Moba) Manager.GetGame();
List<MobaItem> ownedItems = host.getShop().getOwnedItems(player);
for (MobaItem item : ownedItems)
{
if (item.getItem().getType() == Material.BOW)
{
player.getInventory().setItem(getSlot(), item.getItem());
return;
}
}
player.getInventory().setItem(getSlot(), SKILL_ITEM);
}
}

View File

@ -0,0 +1,46 @@
package nautilus.game.arcade.game.games.moba.kit.common;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilItem;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class SkillSword extends HeroSkill
{
private static final ItemStack SKILL_ITEM = new ItemBuilder(Material.WOOD_SWORD)
.setTitle(C.cGreenB + "Sword")
.setUnbreakable(true)
.build();
public SkillSword(int slot)
{
super("Sword", new String[0], SKILL_ITEM, slot, null);
}
@Override
public void giveItem(Player player)
{
Moba host = (Moba) Manager.GetGame();
List<MobaItem> ownedItems = host.getShop().getOwnedItems(player);
for (MobaItem item : ownedItems)
{
if (UtilItem.isSword(item.getItem()))
{
player.getInventory().setItem(getSlot(), item.getItem());
return;
}
}
player.getInventory().setItem(getSlot(), SKILL_ITEM);
}
}

View File

@ -0,0 +1,24 @@
package nautilus.game.arcade.game.games.moba.kit.dana;
import mineplex.core.common.skin.SkinData;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.kit.Perk;
public class HeroDana extends HeroKit
{
private static final Perk[] PERKS = {
new SkillSword(0),
new SkillPulseHeal(1),
new SkillDanaDash(2),
new SkillRally(3),
};
public HeroDana(ArcadeManager manager)
{
super(manager, "Dana", PERKS, MobaRole.WARRIOR, SkinData.DANA);
}
}

View File

@ -0,0 +1,83 @@
package nautilus.game.arcade.game.games.moba.kit.dana;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
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 nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.Random;
public class SkillDanaDash extends DashSkill
{
private static final String[] DESCRIPTION = {
"Dash along the ground.",
"Nearby enemies are thrown up into the air."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillDanaDash(int slot)
{
super("Knock up", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(10000);
_velocityTime = 600;
_horizontial = true;
_velocityStopOnEnd = true;
}
@Override
public void preDash(Player player)
{
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_HIT, 2, 0.4F);
}
@Override
public void dashTick(Player player)
{
Random random = UtilMath.random;
Location location = player.getLocation().add(random.nextInt(5) - 2.5, random.nextInt(3), random.nextInt(5) - 2.5);
UtilParticle.PlayParticle(ParticleType.CLOUD, location.add(0, 1, 0), 0.5F, 0.5F, 0.5f, 0.1F, 10, ViewDist.LONG);
}
@Override
public void collideEntity(LivingEntity entity, Player damager, double scale, boolean sameTeam)
{
double damage;
if (entity instanceof Player)
{
damage = 10;
UtilAction.velocity(entity, new Vector(Math.random() / 2 - 0.25, 1, Math.random() / 2 - 0.25));
}
else
{
damage = 6;
UtilAction.velocity(entity, new Vector(Math.random() - 0.5, 0.5, Math.random() - 0.5));
}
entity.getWorld().playSound(entity.getLocation(), Sound.IRONGOLEM_HIT, 1, 0.5F);
Manager.GetDamage().NewDamageEvent(entity, damager, null, DamageCause.CUSTOM, damage, false, true, false, UtilEnt.getName(damager), GetName());
}
@Override
public void postDash(Player player)
{
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2, 0.4F);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, player.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5f, 0.1F, 3, ViewDist.LONG);
}
}

View File

@ -0,0 +1,94 @@
package nautilus.game.arcade.game.games.moba.kit.dana;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
public class SkillPulseHeal extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Heals nearby allies and minions."
};
private static final ItemStack SKILL_ITEM = new ItemBuilder(Material.INK_SACK, (byte) 10).build();
public SkillPulseHeal(int slot)
{
super("Pulse Heal", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(8000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 5).keySet())
{
// Don't heal enemies
if (!isTeamDamage(entity, player))
{
continue;
}
MobaUtil.heal(entity, player, 4);
}
displayPulse(player.getLocation().add(0, 0.5, 0));
}
private void displayPulse(Location location)
{
Manager.runSyncTimer(new BukkitRunnable()
{
double theta = 0;
double radius = 0;
@Override
public void run()
{
if (radius > 5)
{
cancel();
return;
}
for (double theta2 = 0; theta2 < 2 * Math.PI; theta2 += Math.PI / 3)
{
double x = radius * Math.sin(theta + theta2);
double z = radius * Math.cos(theta + theta2);
location.add(x, 0.5, z);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
location.subtract(x, 0.5, z);
}
theta += Math.PI / 100;
radius += 0.2;
}
}, 0, 1);
}
}

View File

@ -0,0 +1,242 @@
package nautilus.game.arcade.game.games.moba.kit.dana;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaParticles;
import org.bukkit.*;
import org.bukkit.block.Banner;
import org.bukkit.block.Block;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
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.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class SkillRally extends HeroSkill
{
private static final String[] DESCRIPTION = {
"You leap up into the air, and upon landing",
"you plant a banner that heals nearby allies",
"and minions."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private Set<RallyData> _data = new HashSet<>();
public SkillRally(int slot)
{
super("Rally", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(40000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
Vector vector = player.getLocation().getDirection();
for (RallyData data : _data)
{
if (data.Owner.equals(player))
{
return;
}
}
vector.setY(1.5);
UtilAction.velocity(player, vector);
_data.add(new RallyData(player));
broadcast(player);
}
@EventHandler
public void updateLand(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<RallyData> iterator = _data.iterator();
while (iterator.hasNext())
{
RallyData data = iterator.next();
Player player = data.Owner;
if (data.Landed)
{
if (UtilTime.elapsed(data.LandTime, 7000))
{
iterator.remove();
}
else
{
for (Player nearby : UtilPlayer.getNearby(data.Banner, 5))
{
// Only heal allies
if (!isTeamDamage(nearby, player))
{
continue;
}
if (Math.random() > 0.75)
{
MobaParticles.healing(nearby, 1);
}
Manager.GetCondition().Factory().Regen(GetName(), nearby, data.Owner, 3, 1, false, true, false);
}
}
}
else if (UtilTime.elapsed(data.LaunchTime, 1000) && UtilEnt.isGrounded(data.Owner))
{
data.LandTime = System.currentTimeMillis();
data.Landed = true;
Location location = data.Owner.getLocation();
data.Banner = location;
useActiveSkill(player, 7000);
GameTeam team = Manager.GetGame().GetTeam(player);
Block block = location.getBlock();
Manager.GetBlockRestore().add(block, Material.STANDING_BANNER.getId(), (byte) 0, 7500);
Banner banner = (Banner) block.getState();
banner.setBaseColor(team.GetColor() == ChatColor.RED ? DyeColor.RED : DyeColor.BLUE);
banner.addPattern(getPattern(team));
banner.update();
for (Block nearby : UtilBlock.getBlocksInRadius(banner.getLocation(), 5))
{
if (UtilBlock.airFoliage(nearby))
{
continue;
}
Manager.GetBlockRestore().add(nearby, Material.STAINED_CLAY.getId(), team.GetColorData(), (long) (7000 + (Math.random() * 500)));
if (Math.random() > 0.9)
{
nearby.getWorld().playEffect(nearby.getLocation(), Effect.STEP_SOUND, Material.STAINED_CLAY, team.GetColorData());
}
}
for (LivingEntity nearby : UtilEnt.getInRadius(player.getLocation(), 3).keySet())
{
Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, 5, true, true, false, UtilEnt.getName(player), GetName());
}
}
}
}
@EventHandler
public void updateParticles(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (RallyData data : _data)
{
if (!data.Landed)
{
continue;
}
Location banner = data.Banner;
for (int i = 0; i < 5; i++)
{
double x = 5 * Math.sin(data.ParticleTheta);
double z = 5 * Math.cos(data.ParticleTheta);
banner.add(x, 0.25, z);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, banner, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
banner.subtract(x, 0.25, z);
data.ParticleTheta += Math.PI / 100;
}
}
}
@EventHandler
public void velocityChange(EntityVelocityChangeEvent event)
{
for (RallyData data : _data)
{
if (!data.Landed && data.Owner.equals(event.getEntity()))
{
event.setCancelled(true);
}
}
}
@EventHandler
public void itemSpawn(ItemSpawnEvent event)
{
if (event.getEntity().getItemStack().getType() == Material.BANNER)
{
event.setCancelled(true);
}
}
@EventHandler
public void playerDeath(PlayerDeathEvent event)
{
_data.removeIf(rallyData -> rallyData.Owner.equals(event.getEntity()));
}
private Pattern getPattern(GameTeam team)
{
return team.GetColor() == ChatColor.RED ? new Pattern(DyeColor.WHITE, PatternType.CROSS) : new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE);
}
private class RallyData
{
Player Owner;
Location Banner;
boolean Landed;
long LaunchTime;
long LandTime;
double ParticleTheta;
RallyData(Player owner)
{
Owner = owner;
LaunchTime = System.currentTimeMillis();
}
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.moba.kit.devon;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.common.SkillBow;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class HeroDevon extends HeroKit
{
private static final Perk[] PERKS = {
new SkillBow(0),
new SkillTNTArrows(1),
new SkillBoost(2),
new SkillInfinity(3)
};
private static final ItemStack AMMO = new ItemBuilder(Material.ARROW)
.setTitle(C.cYellowB + "Hunting Arrow")
.setUnbreakable(true)
.build();
public HeroDevon(ArcadeManager manager)
{
super(manager, "Devon", PERKS, MobaRole.HUNTER, SkinData.DEVON);
setAmmo(AMMO, 3000);
setMaxAmmo(3);
}
}

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.game.games.moba.kit.devon;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.condition.ConditionFactory;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
public class SkillBoost extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Gain Speed II and Jump Boost I for 3 seconds.",
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillBoost(int slot)
{
super("Hunters Boost", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(10000);
setSneakActivate(true);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@EventHandler
public void toggleSneak(PlayerToggleSneakEvent event)
{
if (!isSkillSneak(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
}
@Override
public void useSkill(Player player)
{
super.useSkill(player);
ConditionFactory factory = Manager.GetCondition().Factory();
int time = 3;
factory.Speed(GetName(), player, null, time, 1, true, true, false);
factory.Jump(GetName(), player, null, time, 0, true, true, false);
}
}

View File

@ -0,0 +1,143 @@
package nautilus.game.arcade.game.games.moba.kit.devon;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent.ActionType;
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.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class SkillInfinity extends HeroSkill
{
private static final String[] DESCRIPTION = {
"For 7 seconds, your arrow shots don't consume arrows.",
"They also become heat-seeking and inflict wither onto players."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private final Map<Entity, Player> _arrows = new HashMap<>();
private final Set<Player> _active = new HashSet<>();
public SkillInfinity(int slot)
{
super("Infinity", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event) || _active.contains(event.getPlayer()))
{
return;
}
Player player = event.getPlayer();
ItemStack bow = player.getInventory().getItem(0);
if (bow == null || bow.getType() != Material.BOW)
{
return;
}
// Give 1 arrow just incase the player didn't have one
_kit.giveAmmo(player, 1);
bow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
_active.add(player);
broadcast(player);
useActiveSkill(() ->
{
bow.removeEnchantment(Enchantment.ARROW_INFINITE);
_active.remove(player);
}, player, 7000);
}
@EventHandler
public void shootArrow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
if (!hasPerk(player) || !_active.contains(player))
{
return;
}
Moba moba = (Moba) Manager.GetGame();
moba.getArrowKbManager().allowKnockback(event.getProjectile());
_arrows.put(event.getProjectile(), player);
}
@EventHandler
public void updateArrowTarget(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
for (Entry<Entity, Player> entry : _arrows.entrySet())
{
Entity entity = entry.getKey();
Player player = entry.getValue();
GameTeam team = Manager.GetGame().GetTeam(player);
for (Player nearby : UtilPlayer.getInRadius(entity.getLocation(), 6).keySet())
{
// If the target is on the same team
if (UtilPlayer.isSpectator(player) || team.equals(Manager.GetGame().GetTeam(nearby)))
{
continue;
}
UtilAction.velocity(entity, UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation().add(0, 1.5, 0)));
}
}
}
@EventHandler
public void arrowDamage(CustomDamageEvent event)
{
if (_arrows.containsKey(event.GetProjectile()))
{
Manager.GetCondition().Factory().Wither(GetName(), event.GetDamageeEntity(), event.GetDamagerEntity(true), 3, 0, false, true, false);
}
}
@EventHandler
public void projectileHit(ProjectileHitEvent event)
{
// Delay this as the when the CustomDamageEvent is run. The arrow is already removed from the map.
Manager.runSyncLater(() -> _arrows.remove(event.getEntity()), 1);
}
}

View File

@ -0,0 +1,154 @@
package nautilus.game.arcade.game.games.moba.kit.devon;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.projectiles.ProjectileSource;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class SkillTNTArrows extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Your next 3 arrows are infused with TNT.",
"They explode on contact dealing damage and knockback."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.TNT);
private final Map<Player, Integer> _playerArrows = new HashMap<>();
private final Set<Arrow> _arrows = new HashSet<>();
public SkillTNTArrows(int slot)
{
super("TNT Infusion", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(17000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
_playerArrows.put(player, 3);
UtilInv.addDullEnchantment(player.getItemInHand());
player.getItemInHand().setAmount(3);
}
@EventHandler
public void shootArrow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
if (!hasPerk(player) || !_playerArrows.containsKey(player))
{
return;
}
ItemStack itemStack = player.getInventory().getItem(getSlot());
int arrows = _playerArrows.get(player);
if (arrows == 1)
{
_playerArrows.remove(player);
useSkill(player);
}
else
{
arrows--;
_playerArrows.put(player, arrows);
itemStack.setAmount(arrows);
}
Moba moba = (Moba) Manager.GetGame();
moba.getArrowKbManager().allowKnockback(event.getProjectile());
_arrows.add((Arrow) event.getProjectile());
}
@EventHandler
public void projectileHit(ProjectileHitEvent event)
{
ProjectileSource source = event.getEntity().getShooter();
if (!(source instanceof Player))
{
return;
}
Player player = (Player) source;
Projectile projectile = event.getEntity();
if (!_arrows.contains(projectile))
{
return;
}
_arrows.remove(projectile);
Location location = projectile.getLocation();
location.getWorld().playSound(location, Sound.EXPLODE, 1, 0.9F);
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
double damage = MobaUtil.scaleDamageWithBow(player.getInventory().getItem(0),5);
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(location, 5).entrySet())
{
if (entry.getKey().equals(player))
{
continue;
}
Manager.GetDamage().NewDamageEvent(entry.getKey(), player, null, DamageCause.BLOCK_EXPLOSION, (entry.getValue() + 0.5) * damage, true, true, false, UtilEnt.getName(player), GetName());
}
}
@EventHandler
public void playerDeath(CombatDeathEvent event)
{
_playerArrows.remove(event.GetEvent().getEntity());
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_playerArrows.remove(event.getPlayer());
}
}

View File

@ -0,0 +1,26 @@
package nautilus.game.arcade.game.games.moba.kit.hattori;
import mineplex.core.common.skin.SkinData;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class HeroHattori extends HeroKit
{
private static final Perk[] PERKS = {
new PerkDoubleJump("Double Jump", 1, 1, true, 3000, true),
new SkillSword(0),
new SkillSnowball(1),
new SkillNinjaDash(2),
new SkillNinjaBlade(3)
};
public HeroHattori(ArcadeManager manager)
{
super(manager, "Hattori", PERKS, MobaRole.ASSASSIN, SkinData.HATTORI);
}
}

View File

@ -0,0 +1,148 @@
package nautilus.game.arcade.game.games.moba.kit.hattori;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent.ActionType;
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.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class SkillNinjaBlade extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Turns into a Diamond Sword that deals extreme",
"damage to any player hit by it."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private static final ItemStack ACTIVE_ITEM = new ItemBuilder(Material.DIAMOND_SWORD)
.setTitle(C.cGreenB + "ENDER BLADE")
.setUnbreakable(true)
.build();
private static final int ACTIVE_SLOT = 0;
private static final int BASE_DAMAGE_INCREASE = 4;
private Map<UUID, Integer> _active = new HashMap<>();
public SkillNinjaBlade(int slot)
{
super("Ender Blade", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event) || _active.containsKey(event.getPlayer().getUniqueId()))
{
return;
}
Player player = event.getPlayer();
PlayerInventory inventory = player.getInventory();
inventory.setItem(ACTIVE_SLOT, ACTIVE_ITEM);
inventory.setHeldItemSlot(ACTIVE_SLOT);
int damage = BASE_DAMAGE_INCREASE;
ItemStack sword = inventory.getItem(ACTIVE_SLOT);
if (sword == null)
{
return;
}
Material material = sword.getType();
// Increase damage based on the sword they had previously
switch (material)
{
case WOOD_SWORD:
damage += 2;
break;
case STONE_SWORD:
damage += 3;
break;
case GOLD_SWORD:
case IRON_SWORD:
damage += 4;
break;
case DIAMOND_SWORD:
damage += 5;
break;
}
_active.put(player.getUniqueId(), damage);
int i = 0;
for (ItemStack itemStack : inventory.getContents())
{
if (itemStack != null && !itemStack.equals(ACTIVE_ITEM) && UtilItem.isSword(itemStack))
{
inventory.setItem(i, null);
}
i++;
}
broadcast(player);
useActiveSkill(() ->
{
_active.remove(player.getUniqueId());
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof SkillSword)
{
((SkillSword) perk).giveItem(player);
}
}
}, player, 7000);
}
@EventHandler
public void damage(CustomDamageEvent event)
{
Entity entity = event.GetDamageeEntity();
Player player = event.GetDamagerPlayer(false);
Player damageePlayer = event.GetDamageePlayer();
if (player == null || damageePlayer == null || isTeamDamage(damageePlayer, player))
{
return;
}
ItemStack itemStack = player.getItemInHand();
if (!_active.containsKey(player.getUniqueId()) || itemStack == null || itemStack.getType() != Material.DIAMOND_SWORD || itemStack.getItemMeta() == null || !itemStack.getItemMeta().getDisplayName().equals(ACTIVE_ITEM.getItemMeta().getDisplayName()))
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, entity.getLocation().add(0, 1, 0), 1F, 1F, 1F, 0.1F, 50, ViewDist.LONG);
entity.getWorld().playSound(entity.getLocation(), Sound.EXPLODE, 2, 0.5F);
event.AddMod(GetName(), _active.get(player.getUniqueId()));
}
}

View File

@ -0,0 +1,72 @@
package nautilus.game.arcade.game.games.moba.kit.hattori;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.particles.effects.LineParticle;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Bukkit;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
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 org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class SkillNinjaDash extends DashSkill
{
private static final String[] DESCRIPTION = {
"Dash forward dealing damage to any enemy",
"you collide with."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillNinjaDash(int slot)
{
super("Ninja Dash", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(7000);
_teleport = true;
_range = 10;
}
@Override
public void preDash(Player player)
{
playFirework(player);
}
@Override
public void collideEntity(LivingEntity entity, Player player, double scale, boolean sameTeam)
{
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, 8, true, true, false, UtilEnt.getName(player), GetName());
}
@Override
public void postDash(Player player)
{
playFirework(player);
}
private void playFirework(Player player)
{
GameTeam team = Manager.GetGame().GetTeam(player);
FireworkEffect effect = FireworkEffect.builder().with(Type.BALL).withColor(team.GetColorBase()).withFlicker().build();
UtilFirework.playFirework(player.getLocation(), effect);
}
}

View File

@ -0,0 +1,95 @@
package nautilus.game.arcade.game.games.moba.kit.hattori;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
public class SkillSnowball extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Fires 3 snowballs, one after another.",
"Each snowball deals damage to any enemy it hits."
};
private static final int DAMAGE = 3;
private static final ItemStack SKILL_ITEM = new ItemStack(Material.SNOW_BALL);
public SkillSnowball(int slot)
{
super("Shuriken", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(1000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
event.setCancelled(true);
Player player = event.getPlayer();
useSkill(player);
Manager.runSyncTimer(new BukkitRunnable()
{
int balls = 0;
@Override
public void run()
{
Snowball snowball = player.launchProjectile(Snowball.class);
((Moba) Manager.GetGame()).getTowerManager().addProjectile(player, snowball, DAMAGE);
Manager.GetProjectile().AddThrow(snowball, player, SkillSnowball.this, -1, true, true, true, false, 0.5F);
if (++balls == 3)
{
cancel();
}
}
}, 0, 4);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Player thrower = (Player) data.getThrower();
if (target != null && !isTeamDamage(target, thrower))
{
thrower.playSound(thrower.getLocation(), Sound.LAVA_POP, 1, 1.3F);
Manager.GetDamage().NewDamageEvent(target, thrower, (Projectile) data.getThrown(), DamageCause.CUSTOM, DAMAGE, false, true, false, UtilEnt.getName(thrower), GetName());
}
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
}

View File

@ -0,0 +1,87 @@
package nautilus.game.arcade.game.games.moba.kit.hp;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.potion.PotionEffectType;
public class HPManager implements Listener
{
// Health per 5 seconds.
private static final double HP5 = 0.66;
private static final double HP_KILL_FACTOR = 0.25;
private final Moba _host;
public HPManager(Moba host)
{
_host = host;
}
@EventHandler
public void regeneration(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC_05 || !_host.IsLive())
{
return;
}
for (Player player : _host.GetPlayers(true))
{
if (UtilPlayer.isSpectator(player))
{
continue;
}
MobaHPRegenEvent regenEvent = new MobaHPRegenEvent(player, null, HP5, true);
UtilServer.CallEvent(regenEvent);
if (regenEvent.isCancelled())
{
continue;
}
player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + regenEvent.getHealth()));
}
}
@EventHandler
public void playerDeath(PlayerDeathEvent event)
{
Player killer = event.getEntity().getKiller();
if (killer == null)
{
return;
}
killer.setHealth(Math.min(killer.getHealth() + killer.getMaxHealth() * HP_KILL_FACTOR, killer.getMaxHealth()));
}
@EventHandler
public void preventHungerRegeneration(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED)
{
event.setCancelled(true);
}
}
@EventHandler
public void preventRegenerationWither(MobaHPRegenEvent event)
{
if (event.getPlayer().hasPotionEffect(PotionEffectType.WITHER))
{
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,83 @@
package nautilus.game.arcade.game.games.moba.kit.hp;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class MobaHPRegenEvent extends PlayerEvent implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
private final Player _source;
private final double _initialHealth;
private double _health;
private boolean _natural;
private boolean _cancel;
public MobaHPRegenEvent(Player who, Player source, double health, boolean natural)
{
super(who);
_source = source;
_initialHealth = health;
_health = health;
_natural = natural;
}
public Player getSource()
{
return _source;
}
public void setHealth(double health)
{
_health = health;
}
public void increaseHealth(double factor)
{
_health = _initialHealth + (_initialHealth * factor);
}
public double getHealth()
{
return _health;
}
public void setNatural(boolean natural)
{
_natural = natural;
}
public boolean isNatural()
{
return _natural;
}
@Override
public boolean isCancelled()
{
return _cancel;
}
@Override
public void setCancelled(boolean b)
{
_cancel = b;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.moba.kit.larissa;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class HeroLarissa extends HeroKit
{
private static final Perk[] PERKS = {
new SkillAquaCannon(0),
new SkillAOEHeal(1),
new SkillWaterDash(2),
new SkillStormHeal(3)
};
private static final ItemStack AMMO = new ItemBuilder(Material.INK_SACK, (byte) 4)
.setTitle(C.cYellowB + "Water Stone")
.setUnbreakable(true)
.build();
public HeroLarissa(ArcadeManager manager)
{
super(manager, "Larissa", PERKS, MobaRole.MAGE, SkinData.LARISSA);
setAmmo(AMMO, 3000);
setMaxAmmo(5);
}
}

View File

@ -0,0 +1,187 @@
package nautilus.game.arcade.game.games.moba.kit.larissa;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
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.UtilTime;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaParticles;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
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 org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.TimeUnit;
public class SkillAOEHeal extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Throws a water bucket which upon coming into",
"contact with the ground will heal nearby",
"players and minions."
};
private static final long DURATION = TimeUnit.SECONDS.toMillis(6);
private static final int RADIUS = 3;
private static final int HEALTH_PER_SECOND = 4;
private static final int DAMAGE_PER_SECOND = 2;
private static final ItemStack SKILL_ITEM = new ItemStack(Material.WATER_BUCKET);
private static final ItemStack THROWN_ITEM = new ItemStack(Material.WATER_BUCKET);
private final Set<AOEHealData> _data = new HashSet<>();
public SkillAOEHeal(int slot)
{
super("Dancing Fountain", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(14000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
Vector direction = player.getLocation().getDirection();
Item item = player.getWorld().dropItem(player.getEyeLocation().add(direction), THROWN_ITEM);
item.setVelocity(direction);
useSkill(player);
Manager.GetProjectile().AddThrow(item, player, this, 1000, true, true, true, false, 1F);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
deployAoe((Player) data.getThrower(), data.getThrown(), data.getThrown().getLocation());
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
deployAoe((Player) data.getThrower(), data.getThrown(), data.getThrown().getLocation());
}
@EventHandler
public void updateAOE(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<AOEHealData> iterator = _data.iterator();
while (iterator.hasNext())
{
AOEHealData data = iterator.next();
Player owner = data.Owner;
GameTeam team = Manager.GetGame().GetTeam(owner);
DustSpellColor colour = new DustSpellColor(team.GetColor() == ChatColor.RED ? java.awt.Color.RED : java.awt.Color.CYAN);
if (UtilTime.elapsed(data.Start, DURATION))
{
iterator.remove();
}
else if (UtilTime.elapsed(data.LastHeal, 1000))
{
data.LastHeal = System.currentTimeMillis();
for (LivingEntity entity : UtilEnt.getInRadius(data.Center, RADIUS).keySet())
{
if (isTeamDamage(entity, owner))
{
MobaParticles.healing(entity, HEALTH_PER_SECOND);
MobaUtil.heal(entity, owner, HEALTH_PER_SECOND);
}
else
{
Manager.GetDamage().NewDamageEvent(entity, owner, null, DamageCause.CUSTOM, DAMAGE_PER_SECOND, true, true, false, owner.getName(), GetName());
}
}
}
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, data.Center, RADIUS - 0.5F, 0.2F, RADIUS - 0.5F, 0.1F, 5, ViewDist.LONG);
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 15)
{
double x = RADIUS * Math.cos(theta);
double z = RADIUS * Math.sin(theta);
data.Center.add(x, 0, z);
new ColoredParticle(ParticleType.RED_DUST, colour, data.Center).display(ViewDist.LONG);
data.Center.subtract(x, 0, z);
}
}
}
private void deployAoe(Player thrower, Entity item, Location location)
{
GameTeam team = Manager.GetGame().GetTeam(thrower);
if (team == null)
{
return;
}
UtilFirework.playFirework(location, FireworkEffect.builder().with(Type.BURST).withColor(team.GetColorBase()).withFade(Color.WHITE).withFlicker().build());
thrower.getWorld().playSound(location, Sound.SPLASH2, 1, 1);
item.remove();
_data.add(new AOEHealData(thrower, location));
}
private class AOEHealData
{
Player Owner;
Location Center;
long Start;
long LastHeal;
AOEHealData(Player owner, Location center)
{
Owner = owner;
Center = center;
Start = System.currentTimeMillis();
LastHeal = Start;
}
}
}

View File

@ -0,0 +1,77 @@
package nautilus.game.arcade.game.games.moba.kit.larissa;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
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.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.Material;
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 org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
public class SkillAquaCannon extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Fires a beam of water that deals damage",
"to the first enemy it comes in contact with."
};
private static final int DAMAGE = 6;
private static final ItemStack SKILL_ITEM = new ItemStack(Material.DIAMOND_HOE);
public SkillAquaCannon(int slot)
{
super("Aqua Cannon", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!_kit.useAmmo(player, 1))
{
return;
}
TowerManager towerManager = ((Moba) Manager.GetGame()).getTowerManager();
Vector direction = player.getLocation().getDirection();
LineParticle lineParticle = new LineParticle(player.getLocation().add(0, 1.7, 0), direction, 0.2, 10, ParticleType.DRIP_WATER, UtilServer.getPlayers());
while (!lineParticle.update() && towerManager.damageTowerAt(lineParticle.getLastLocation(), player, DAMAGE) == null)
{
for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 2).keySet())
{
if (isTeamDamage(entity, player))
{
continue;
}
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), MobaConstants.BASIC_ATTACK);
break;
}
}
player.getWorld().playSound(lineParticle.getLastLocation(), Sound.BLAZE_HIT, 1, 1.4F);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, lineParticle.getLastLocation(), 0, 0, 0, 0.2F, 10, ViewDist.LONG);
}
}

View File

@ -0,0 +1,133 @@
package nautilus.game.arcade.game.games.moba.kit.larissa;
import mineplex.core.common.util.UtilEvent.ActionType;
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.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class SkillStormHeal extends HeroSkill
{
private static final String[] DESCRIPTION = {
"All team members are consistently healed",
"over the next 7 seconds."
};
private static final long DURATION = TimeUnit.SECONDS.toMillis(7);
private static final int HEALTH_PER_SECOND = 2;
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private final Map<Player, Long> _active = new HashMap<>();
public SkillStormHeal(int slot)
{
super("Storm's Blessing", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event) || _active.containsKey(event.getPlayer()))
{
return;
}
Player player = event.getPlayer();
for (Player teamMember : Manager.GetGame().GetTeam(player).GetPlayers(true))
{
teamMember.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) (DURATION / 50D), 0));
}
_active.put(player, System.currentTimeMillis());
broadcast(player);
useActiveSkill(player, DURATION - 500);
}
@EventHandler
public void updateHeal(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
_active.forEach((player, start) ->
{
GameTeam team = Manager.GetGame().GetTeam(player);
if (team == null)
{
return;
}
for (Player teamMember : team.GetPlayers(true))
{
MobaUtil.heal(teamMember, player, HEALTH_PER_SECOND);
}
});
}
@EventHandler
public void updateParticles(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
Iterator<Player> iterator = _active.keySet().iterator();
while (iterator.hasNext())
{
Player player = iterator.next();
if (UtilTime.elapsed(_active.get(player), DURATION))
{
iterator.remove();
}
GameTeam team = Manager.GetGame().GetTeam(player);
if (team == null)
{
return;
}
for (Player teamMember : team.GetPlayers(true))
{
if (UtilPlayer.isSpectator(teamMember))
{
continue;
}
Location location = teamMember.getLocation().add(0, 3, 0);
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, location, 0.5F, 0.2F, 0.5F, 0.001F, 12, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, location.subtract(0, 0.2, 0), 0.4F, 0.1F, 0.4F, 0.1F, 2, ViewDist.LONG);
}
}
}
}

View File

@ -0,0 +1,57 @@
package nautilus.game.arcade.game.games.moba.kit.larissa;
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 nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffCripple;
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.concurrent.TimeUnit;
public class SkillWaterDash extends DashSkill
{
private static final String[] DESCRIPTION = {
"Dash along the ground, crippling enemies you",
"come into contact with."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
private static final long CRIPPLE_DURATION = TimeUnit.SECONDS.toMillis(3);
public SkillWaterDash(int slot)
{
super("Water Dash", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(10000);
_collide = false;
_velocityTime = 600;
_velocityStopOnEnd = true;
_horizontial = true;
}
@Override
public void dashTick(Player player)
{
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, player.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.01F, 5, ViewDist.LONG);
Moba moba = (Moba) Manager.GetGame();
BuffManager buffManager = moba.getBuffManager();
for (Player nearby : UtilPlayer.getNearby(player.getLocation(), 2))
{
if (isTeamDamage(nearby, player) || buffManager.hasBuff(nearby, BuffCripple.class))
{
continue;
}
buffManager.apply(new BuffCripple(moba, nearby, CRIPPLE_DURATION));
}
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.moba.kit.rowena;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.common.SkillBow;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class HeroRowena extends HeroKit
{
private static final Perk[] PERKS = {
new SkillBow(0),
new SkillLightArrows(1),
new SkillCombatDash(2),
new SkillBombardment(3)
};
private static final ItemStack AMMO = new ItemBuilder(Material.ARROW)
.setTitle(C.cYellowB + "Hunting Arrow")
.setUnbreakable(true)
.build();
public HeroRowena(ArcadeManager manager)
{
super(manager, "Rowena", PERKS, MobaRole.HUNTER, SkinData.ROWENA);
setAmmo(AMMO, 2000);
setMaxAmmo(2);
}
}

View File

@ -0,0 +1,209 @@
package nautilus.game.arcade.game.games.moba.kit.rowena;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
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;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Material;
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.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class SkillBombardment extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Take to the sky!",
"Your shots become fast high power explosive shots."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private static final int DAMAGE_FACTOR = 2;
private static final int SHOTS = 3;
private static final int MAX_TIME = 10000;
private static final ItemStack ACTIVE_ITEM = new ItemBuilder(Material.DIAMOND_BARDING)
.setTitle(C.cDRedB + "Bombardment")
.build();
private Set<BombardmentData> _data = new HashSet<>();
public SkillBombardment(int slot)
{
super("Bombardment", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
for (BombardmentData data : _data)
{
if (data.Shooter.equals(player))
{
return;
}
}
Location toTeleport = player.getLocation().add(0, 15, 0);
player.teleport(toTeleport);
player.getInventory().setItem(0, ACTIVE_ITEM);
player.getInventory().setHeldItemSlot(0);
broadcast(player);
_data.add(new BombardmentData(player));
}
@EventHandler
public void interactActive(PlayerInteractEvent event)
{
if (event.getItem() == null || !event.getItem().isSimilar(ACTIVE_ITEM))
{
return;
}
Player player = event.getPlayer();
for (BombardmentData data : _data)
{
if (data.Shooter.equals(player))
{
Location location = player.getEyeLocation();
LineParticle lineParticle = new LineParticle(location, location.getDirection(), 0.4, 40, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
double damage = MobaUtil.scaleDamageWithBow(player.getInventory().getItem(0), 0) * DAMAGE_FACTOR;
while (!lineParticle.update())
{
}
player.playSound(player.getLocation(), Sound.EXPLODE, 1, 0.8F);
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, lineParticle.getDestination(), 0, 0, 0, 0.1F, 1, ViewDist.LONG);
for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 5).keySet())
{
if (isTeamDamage(entity, player))
{
continue;
}
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage, true, true, false, player.getName(), GetName());
}
data.Shots--;
return;
}
}
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<BombardmentData> iterator = _data.iterator();
while (iterator.hasNext())
{
BombardmentData data = iterator.next();
Player player = data.Shooter;
if (UtilTime.elapsed(data.Start, MAX_TIME) || data.Shots == 0)
{
useSkill(player);
Kit.GiveItems(player);
data.Block.setType(Material.AIR);
iterator.remove();
}
else if (data.Block != null)
{
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, data.Block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.001F, 3, ViewDist.LONG);
}
}
}
@EventHandler
public void playerMove(PlayerMoveEvent event)
{
Player player = event.getPlayer();
for (BombardmentData data : _data)
{
if (data.Block != null && data.Shooter.equals(player) && (event.getTo().getX() != event.getFrom().getX() || event.getTo().getZ() != event.getFrom().getZ()))
{
event.setTo(event.getFrom());
}
}
}
@EventHandler
public void playerVelocity(EntityVelocityChangeEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
for (BombardmentData data : _data)
{
if (data.Block != null && data.Shooter.equals(player))
{
event.setCancelled(true);
}
}
}
private class BombardmentData
{
Player Shooter;
int Shots;
Block Block;
long Start;
BombardmentData(Player shooter)
{
Shooter = shooter;
Shots = SHOTS;
Block = shooter.getLocation().getBlock().getRelative(BlockFace.DOWN);
Block.setType(Material.BARRIER);
Start = System.currentTimeMillis();
}
}
}

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.moba.kit.rowena;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class SkillCombatDash extends DashSkill
{
private static final String[] DESCRIPTION = {
"Dash very fast along the ground.",
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillCombatDash(int slot)
{
super("Combat Slide", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(8000);
_collide = false;
_velocityTime = 250;
_velocityMagnitude = 1.5;
_horizontial = true;
}
@Override
public void preDash(Player player)
{
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.001F, 20, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1, 1);
}
}

View File

@ -0,0 +1,174 @@
package nautilus.game.arcade.game.games.moba.kit.rowena;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Material;
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.entity.EntityShootBowEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class SkillLightArrows extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Your next 5 arrows become light infused.",
"They pass through blocks and deal high damage."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.GOLD_NUGGET);
private final Map<Player, Integer> _playerArrows = new HashMap<>();
private final Map<Player, Set<LineParticle>> _arrows = new HashMap<>();
public SkillLightArrows(int slot)
{
super("Light Arrows", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(12000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
_playerArrows.put(player, 5);
UtilInv.addDullEnchantment(player.getItemInHand());
player.getItemInHand().setAmount(5);
}
@EventHandler
public void shootArrow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
if (!hasPerk(player) || !_playerArrows.containsKey(player))
{
return;
}
ItemStack itemStack = player.getInventory().getItem(getSlot());
int arrows = _playerArrows.get(player);
if (arrows == 1)
{
_playerArrows.remove(player);
useSkill(player);
}
else
{
arrows--;
_playerArrows.put(player, arrows);
itemStack.setAmount(arrows);
}
event.getProjectile().remove();
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.4, 40, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
lineParticle.setIgnoreAllBlocks(true);
_arrows.putIfAbsent(player, new HashSet<>());
_arrows.get(player).add(lineParticle);
}
@EventHandler
public void updateArrows(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
TowerManager towerManager = ((Moba) Manager.GetGame()).getTowerManager();
for (Entry<Player, Set<LineParticle>> entry : _arrows.entrySet())
{
Player player = entry.getKey();
Iterator<LineParticle> iterator = entry.getValue().iterator();
double damage = MobaUtil.scaleDamageWithBow(player.getInventory().getItem(0), 0);
lineParticleLoop : while (iterator.hasNext())
{
LineParticle lineParticle = iterator.next();
for (int i = 0; i < 4; i++)
{
if (!lineParticle.update())
{
Tower hitTower = towerManager.damageTowerAt(lineParticle.getLastLocation(), player, damage);
if (hitTower != null && UtilMath.offsetSquared(hitTower.getCrystal(), player) > Tower.TARGET_RANGE_SQUARED)
{
continue;
}
for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 1.5).keySet())
{
if (Recharge.Instance.use(player, GetName() + entity.getUniqueId(), 500, false, false))
{
player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 1, 0.8F);
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage, true, true, false, player.getName(), GetName());
}
}
}
else
{
iterator.remove();
continue lineParticleLoop;
}
}
}
}
}
@EventHandler
public void playerDeath(PlayerDeathEvent event)
{
_playerArrows.remove(event.getEntity());
_arrows.remove(event.getEntity());
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_playerArrows.remove(event.getPlayer());
_arrows.remove(event.getPlayer());
}
}

View File

@ -0,0 +1,87 @@
package nautilus.game.arcade.game.games.moba.minion;
import mineplex.core.common.util.UtilEnt;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
public class Minion
{
private static final int HEALTH = 10;
private static final float HIT_BOX = 2F;
private static final ItemStack[] SUPER_ARMOUR = {
new ItemStack(Material.IRON_BOOTS),
new ItemStack(Material.IRON_LEGGINGS),
new ItemStack(Material.IRON_CHESTPLATE),
new ItemStack(Material.IRON_HELMET)
};
private final LivingEntity _entity;
private Location _target;
private int _targetIndex;
public Minion(Location spawn, Class<? extends LivingEntity> clazz, boolean superMinion)
{
_target = spawn;
LivingEntity entity = spawn.getWorld().spawn(spawn, clazz);
_entity = entity;
entity.setMaxHealth(HEALTH);
entity.setRemoveWhenFarAway(false);
if (entity instanceof Zombie)
{
((Zombie) entity).setBaby(true);
}
if (superMinion)
{
entity.getEquipment().setArmorContents(SUPER_ARMOUR);
}
UtilEnt.vegetate(entity);
UtilEnt.silence(entity, true);
UtilEnt.setBoundingBox(entity, HIT_BOX, HIT_BOX);
entity.setCustomNameVisible(true);
updateDisplay(entity.getMaxHealth());
}
public void updateDisplay(double health)
{
_entity.setCustomName(MobaUtil.getHealthBar(_entity, health, 10));
}
public LivingEntity getEntity()
{
return _entity;
}
public void setTarget(Location location)
{
// Keep the Y constant
location.setY(_target.getY());
_target = location;
}
public Location getTarget()
{
return _target;
}
public void setTargetIndex(int index)
{
_targetIndex = index;
}
public int getTargetIndex()
{
return _targetIndex;
}
}

View File

@ -0,0 +1,195 @@
package nautilus.game.arcade.game.games.moba.minion;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerDestroyEvent;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
public class MinionManager implements Listener
{
private static final int MINION_SPAWN_DELAY_TICKS = 40;
private static final long MINION_SPAWN_TIME = TimeUnit.SECONDS.toMillis(30);
private final Moba _host;
private List<Location> _path;
private final Set<MinionWave> _waves;
private long _lastWave;
private boolean _enabled;
public MinionManager(Moba host)
{
_host = host;
_waves = new HashSet<>();
host.registerDebugCommand(new DebugCommand("removeminions", Rank.DEVELOPER)
{
@Override
public void Execute(Player caller, String[] args)
{
for (MinionWave wave : _waves)
{
wave.cleanup();
}
caller.sendMessage(F.main("Debug", "Removed all minions."));
}
});
}
@EventHandler
public void gameCountdownCommence(GamePrepareCountdownCommence event)
{
UtilServer.runSyncLater(() -> setEnabled(true), MINION_SPAWN_DELAY_TICKS);
}
@EventHandler
public void spawnMinions(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || !_enabled || !_host.IsLive() || !UtilTime.elapsed(_lastWave, MINION_SPAWN_TIME))
{
return;
}
_lastWave = System.currentTimeMillis();
for (GameTeam team : _host.GetTeamList())
{
List<Location> path = new ArrayList<>(_path);
boolean reverse = team.GetColor() == ChatColor.RED;
boolean superMinions = true;
for (Tower tower : _host.getTowerManager().getTowers())
{
if (!tower.isDead() && !tower.getOwner().equals(team))
{
superMinions = false;
break;
}
}
// If red team, reverse the pat
if (reverse)
{
Collections.reverse(path);
}
MinionWave wave = new MinionWave(_host, this, team, path, reverse ? Zombie.class : PigZombie.class, superMinions);
_waves.add(wave);
}
}
@EventHandler
public void towerDestroy(TowerDestroyEvent event)
{
Tower tower = event.getTower();
if (tower.isFirstTower())
{
return;
}
for (GameTeam team : _host.GetTeamList())
{
if (team.equals(tower.getOwner()))
{
continue;
}
_host.Announce(F.main("Game", team.GetFormattedName() + "'s " + C.mBody + "minions are now " + C.cYellowB + "Super-Charged" + C.mBody + "!"), false);
}
}
public void setEnabled(boolean enabled)
{
_enabled = enabled;
if (enabled)
{
preparePath();
}
}
public void unregisterWave(MinionWave wave)
{
for (Minion minion : wave.getMinions())
{
minion.getEntity().remove();
}
_waves.remove(wave);
}
public Set<MinionWave> getWaves()
{
return _waves;
}
/**
* This method fills the {@link #_path} with the organised list of locations that the minions must follow.<br>
* <p>
* This says that the blue team is the start and the red team is the end.
*/
private void preparePath()
{
// Step 1 - Find the starting location for the blue team
Location start = _host.WorldData.GetDataLocs(MobaConstants.MINION_PATH_START).get(0);
// Step 2 - Fill a list with ordered locations, from blue to red
ArrayList<Location> path = new ArrayList<>(_host.WorldData.GetDataLocs(MobaConstants.MINION_PATH));
ArrayList<Location> organisedPath = new ArrayList<>(path.size());
while (!path.isEmpty())
{
Location dataPoint = UtilAlg.findClosest(start, path);
organisedPath.add(dataPoint);
path.remove(dataPoint);
start = dataPoint;
}
// Step 3 - Put the ordered path inside the map
_path = organisedPath;
// int i = 0;
// for (Location location : _path)
// {
// Block block = location.getBlock();
// block.setType(Material.SIGN_POST);
// Sign sign = (Sign) block.getState();
// sign.setLine(0, "P" + i++);
// sign.update();
// }
}
}

View File

@ -0,0 +1,472 @@
package nautilus.game.arcade.game.games.moba.minion;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaDirectAIMethod;
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
import org.jooq.util.derby.sys.Sys;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class MinionWave implements Listener
{
private static final int MAX_MINIONS_PER_WAVE = 6;
private static final int TOO_CLOSE_SQUARED = 9;
private static final int DAMAGE_RANGE_SQUARED = 16;
private static final double DAMAGE_AMOUNT = 0.2;
private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
private final Moba _host;
private final MinionManager _minionManager;
private final GameTeam _owner;
private final Class<? extends LivingEntity> _clazz;
private final boolean _superMinions;
private final long _startTime;
private final List<Location> _path;
private final List<Minion> _minions;
public MinionWave(Moba host, MinionManager minionManager, GameTeam owner, List<Location> path, Class<? extends LivingEntity> clazz, boolean superMinions)
{
_host = host;
_minionManager = minionManager;
_owner = owner;
_clazz = clazz;
_superMinions = superMinions;
_startTime = System.currentTimeMillis();
_path = path;
_minions = new ArrayList<>(MAX_MINIONS_PER_WAVE);
UtilServer.RegisterEvents(this);
spawn();
UtilServer.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
if (spawn())
{
cancel();
}
}
}, 15, 15);
}
private boolean spawn()
{
_host.CreatureAllowOverride = true;
Minion minion = new Minion(_path.get(0), _clazz, _superMinions);
MobaUtil.setTeamEntity(minion.getEntity(), _owner);
_minions.add(minion);
_host.CreatureAllowOverride = false;
return _minions.size() >= MAX_MINIONS_PER_WAVE;
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Minion minion : _minions)
{
LivingEntity entity = minion.getEntity();
Location target = null;
Location towerTarget = targetTower(minion);
Minion minionTarget = targetMinion(minion);
Location witherTarget = targetWither(minion);
// Priority -> Tower -> Minion -> Wither
if (towerTarget != null)
{
target = towerTarget;
}
else if (minionTarget != null)
{
target = minionTarget.getEntity().getLocation();
minion.setTarget(target);
}
else if (witherTarget != null)
{
target = witherTarget;
}
if (target != null)
{
minion.setTarget(target);
// Too close
if (UtilMath.offsetSquared(entity.getLocation(), target) < TOO_CLOSE_SQUARED)
{
continue;
}
}
if (!AI_METHOD.updateMovement(entity, minion.getTarget(), 4F))
{
int newTarget = minion.getTargetIndex() + 1;
if (newTarget == _path.size())
{
continue;
}
minion.setTargetIndex(newTarget);
minion.setTarget(_path.get(newTarget));
}
}
}
@EventHandler
public void updateUnregister(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
Iterator<Minion> iterator = _minions.iterator();
while (iterator.hasNext())
{
Minion minion = iterator.next();
LivingEntity entity = minion.getEntity();
if (entity == null || entity.isDead() || !entity.isValid())
{
if (entity != null && entity.getKiller() != null)
{
_host.AddGems(entity.getKiller(), 0.1, "Minion Kills", true, true);
}
iterator.remove();
}
}
// Only should unregister the wave after all entities have spawned
if (_minions.isEmpty() && UtilTime.elapsed(_startTime, 10000))
{
UtilServer.Unregister(this);
_minionManager.unregisterWave(this);
}
}
private Minion targetMinion(Minion minion)
{
for (MinionWave wave : _minionManager.getWaves())
{
// Same team
if (wave.getOwner().equals(_owner))
{
continue;
}
for (Minion otherMinion : wave.getMinions())
{
double distSquared = UtilMath.offsetSquared(minion.getEntity(), otherMinion.getEntity());
if (distSquared < 3)
{
return otherMinion;
}
else if (distSquared > Tower.TARGET_RANGE_SQUARED)
{
continue;
}
return otherMinion;
}
}
return null;
}
private Location targetTower(Minion minion)
{
for (Tower tower : _host.getTowerManager().getTowers())
{
if (tower.isDead() || tower.getOwner().equals(_owner))
{
continue;
}
Location location = tower.getCrystal().getLocation();
double distSquared = UtilMath.offsetSquared(minion.getEntity(), tower.getCrystal());
if (distSquared < 3)
{
return location;
}
else if (distSquared > Tower.TARGET_RANGE_SQUARED)
{
continue;
}
return location;
}
return null;
}
private Location targetWither(Minion minion)
{
for (MobaBoss boss : _host.getBossManager().getBosses())
{
if (boss.isDead() || !(boss instanceof WitherBoss))
{
continue;
}
WitherBoss witherBoss = (WitherBoss) boss;
if (witherBoss.getTeam().equals(_owner))
{
continue;
}
Location location = boss.getEntity().getLocation();
double distSquared = UtilMath.offsetSquared(minion.getEntity(), boss.getEntity());
if (distSquared < 3)
{
return location;
}
else if (distSquared > Tower.TARGET_RANGE_SQUARED)
{
continue;
}
return location;
}
return null;
}
@EventHandler
public void damageMinions(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Minion minion : _minions)
{
for (MinionWave wave : _minionManager.getWaves())
{
// Same team
if (wave.getOwner().equals(_owner))
{
continue;
}
for (Minion otherMinion : wave.getMinions())
{
// Cannot damage, not close enough
if (UtilMath.offsetSquared(minion.getEntity(), otherMinion.getEntity()) > DAMAGE_RANGE_SQUARED)
{
continue;
}
_host.getArcadeManager().GetDamage().NewDamageEvent(otherMinion.getEntity(), minion.getEntity(), null, DamageCause.CUSTOM, DAMAGE_AMOUNT, false, true, false, UtilEnt.getName(minion.getEntity()), "Minion");
}
}
}
for (Minion minion : _minions)
{
for (Tower tower : _host.getTowerManager().getTowers())
{
// Cannot damage, not close enough
if (!_host.getTowerManager().canDamage(tower, _owner) || UtilMath.offsetSquared(minion.getEntity(), tower.getCrystal()) > DAMAGE_RANGE_SQUARED)
{
continue;
}
tower.damage(DAMAGE_AMOUNT);
}
}
}
@EventHandler
public void damageTower(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Minion minion : _minions)
{
for (Tower tower : _host.getTowerManager().getTowers())
{
// Cannot damage, not close enough
if (!_host.getTowerManager().canDamage(tower, _owner) || UtilMath.offsetSquared(minion.getEntity(), tower.getCrystal()) > DAMAGE_RANGE_SQUARED)
{
continue;
}
tower.damage(DAMAGE_AMOUNT);
}
}
}
@EventHandler
public void damageWither(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
List<MobaBoss> bosses = _host.getBossManager().getBosses();
for (Minion minion : _minions)
{
for (MobaBoss boss : bosses)
{
// Dead, not close enough
if (boss.isDead() || UtilMath.offsetSquared(minion.getEntity(), boss.getEntity()) > DAMAGE_RANGE_SQUARED)
{
continue;
}
_host.getArcadeManager().GetDamage().NewDamageEvent(boss.getEntity(), minion.getEntity(), null, DamageCause.CUSTOM, DAMAGE_AMOUNT, false, false, false, UtilEnt.getName(minion.getEntity()), "Minion");
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damage(CustomDamageEvent event)
{
// Not a Minion
if (event.isCancelled() || !isMinion(event.GetDamageeEntity()))
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
Player damager = event.GetDamagerPlayer(true);
GameTeam team = _host.GetTeam(damager);
if (team != null && _owner.equals(team))
{
event.SetCancelled("Same Team Minion");
}
else
{
Minion minion = getMinion(damagee);
if (minion != null)
{
minion.updateDisplay(minion.getEntity().getHealth() - event.GetDamage());
}
}
}
@EventHandler
public void entityCombust(EntityCombustEvent event)
{
if (isMinion(event.getEntity()))
{
event.setCancelled(true);
}
}
@EventHandler
public void suffocation(CustomDamageEvent event)
{
if (isMinion(event.GetDamageeEntity()) && event.GetCause() == DamageCause.SUFFOCATION)
{
event.SetCancelled("Minion Suffocation");
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void entityDeath(EntityDeathEvent event)
{
if (!isMinion(event.getEntity()))
{
return;
}
event.getDrops().clear();
event.setDroppedExp(0);
}
public void cleanup()
{
for (Minion minion : _minions)
{
minion.getEntity().remove();
}
}
public List<Minion> getMinions()
{
return _minions;
}
public GameTeam getOwner()
{
return _owner;
}
private Minion getMinion(Entity entity)
{
for (Minion minion : _minions)
{
if (entity.equals(minion.getEntity()))
{
return minion;
}
}
return null;
}
private boolean isMinion(Entity entity)
{
return getMinion(entity) != null;
}
}

View File

@ -0,0 +1,168 @@
package nautilus.game.arcade.game.games.moba.prepare;
import mineplex.core.common.entity.ClientArmorStand;
import mineplex.core.common.util.*;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaPlayer;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.RoleSelectEvent;
import nautilus.game.arcade.kit.Kit;
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.Listener;
import java.util.concurrent.TimeUnit;
public class PrepareManager implements Listener
{
private static final long PREPARE_TIME = TimeUnit.MINUTES.toMillis(1);
private static final long POST_SELECTION_PREPARE_TIME = TimeUnit.SECONDS.toMillis(5);
private static final int MAX_DISTANCE_WITHOUT_SELECTION_SQUARED = 400;
private final Moba _host;
private boolean _postPrepareStage;
public PrepareManager(Moba host)
{
_host = host;
}
@EventHandler(priority = EventPriority.LOW)
public void updatePrepare(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || _host.GetState() != GameState.Prepare || _postPrepareStage)
{
return;
}
if (!UtilTime.elapsed(_host.GetStateTime(), PREPARE_TIME))
{
for (Player player : _host.GetPlayers(true))
{
Kit kit = _host.GetKit(player);
if (!(kit instanceof HeroKit))
{
return;
}
}
}
_postPrepareStage = true;
_host.AnnounceGame();
_host.StartPrepareCountdown();
//Event
GamePrepareCountdownCommence countdownEvent = new GamePrepareCountdownCommence(_host);
UtilServer.CallEvent(countdownEvent);
// If players took too long, just give them a random free role and kit.
for (Player player : _host.GetPlayers(true))
{
Kit kit = _host.GetKit(player);
if (kit instanceof HeroKit)
{
continue;
}
HeroKit heroKit = _host.getFirstKit(player);
MobaPlayer mobaPlayer = _host.getMobaData(player);
mobaPlayer.setRole(heroKit.getRole());
_host.SetKit(player, heroKit, true);
}
for (GameTeam team : _host.GetTeamList())
{
team.SpawnTeleport();
}
_host.SetStateTime(System.currentTimeMillis());
_host.getArcadeManager().GetChat().Silence(-1, false);
_host.PrepareTime = POST_SELECTION_PREPARE_TIME;
_host.PrepareFreeze = true;
}
@EventHandler
public void updateNearSpawn(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || _host.GetState() != GameState.Prepare)
{
return;
}
for (MobaPlayer mobaPlayer : _host.getMobaData())
{
Player player = mobaPlayer.getPlayer();
GameTeam team = _host.GetTeam(player);
if (UtilMath.offsetSquared(player.getLocation(), team.GetSpawns().get(0)) > MAX_DISTANCE_WITHOUT_SELECTION_SQUARED && (mobaPlayer.getRole() == null || mobaPlayer.getKit() == null))
{
player.sendMessage(F.main("Game", "You haven't finished selecting your hero."));
team.SpawnTeleport(player);
}
}
}
@EventHandler
public void roleSelect(RoleSelectEvent event)
{
Player player = event.getPlayer();
MobaRole role = event.getRole();
ClientArmorStand stand = event.getStand();
if (!_host.isRoleFree(player, role))
{
player.sendMessage(F.main("Game", "Another player has already chosen this role."));
event.setCancelled(true);
return;
}
// Show that the kit is claimed.
stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + player.getName());
// Store the role of the player
_host.getMobaData(player).setRole(role);
// Update the scoreboard
_host.getScoreboardModule().refreshAsSubject(player);
}
@EventHandler
public void live(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
{
return;
}
for (MobaPlayer mobaPlayer : _host.getMobaData())
{
HeroKit kit = mobaPlayer.getKit();
Perk perk = kit.GetPerks()[kit.GetPerks().length - 1];
// Put Ultimates on cooldown
if (perk instanceof HeroSkill)
{
((HeroSkill) perk).useSkill(mobaPlayer.getPlayer());
}
}
_host.getArcadeManager().GetChat().Silence(0, true);
}
}

Some files were not shown because too many files have changed in this diff Show More