diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java index 7bf091d36..06fdc0896 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java @@ -8,18 +8,27 @@ import com.google.gson.Gson; public class ApiEndpoint { private static final String API_HOST = "10.33.53.12"; +// private static final String API_HOST = "localhost"; +// private static final int API_PORT = 3000; private static final int API_PORT = 7979; + private Gson _gson; private ApiWebCall _webCall; public ApiEndpoint(String path, Gson gson) { String url = "http://" + API_HOST + ":" + API_PORT + path; _webCall = new ApiWebCall(url, gson); + _gson = gson; } protected ApiWebCall getWebCall() { return _webCall; } + + public Gson getGson() + { + return _gson; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java index be08bf88f..5b20f11ad 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java @@ -5,8 +5,10 @@ import java.util.Date; /** * @author Shaun Bennett */ -public class ApiResponse +public class ApiResponse implements HttpStatusCode { + // These do not have _ prefix because of gson. Please do not add underscores! + private int statusCode; private boolean success; private String error; @@ -33,4 +35,16 @@ public class ApiResponse ", error='" + error + '\'' + '}'; } + + @Override + public int getStatusCode() + { + return statusCode; + } + + @Override + public void setStatusCode(int statusCode) + { + this.statusCode = statusCode; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java index 053b349be..e59cb7f76 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java @@ -92,6 +92,11 @@ public class ApiWebCall private T parseResponse(CloseableHttpResponse response, Type type) throws IOException { HttpEntity entity = response.getEntity(); - return _gson.fromJson(new InputStreamReader(entity.getContent()), type); + T parsed = _gson.fromJson(new InputStreamReader(entity.getContent()), type); + if (parsed instanceof HttpStatusCode && response.getStatusLine() != null) + { + ((HttpStatusCode) parsed).setStatusCode(response.getStatusLine().getStatusCode()); + } + return parsed; } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java new file mode 100644 index 000000000..8daeb648f --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java @@ -0,0 +1,12 @@ +package mineplex.core.common.api; + +/** + * Interface used to also grab status code from ApiWebCall + * @author Shaun Bennett + */ +public interface HttpStatusCode +{ + public int getStatusCode(); + + public void setStatusCode(int statusCode); +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 7aa895666..b89b34866 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -19,21 +19,27 @@ import net.minecraft.server.v1_8_R3.NBTTagString; public class SkinData { - private static long _nameCount = -99999999999999L; - - public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); - public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg="); - public final static SkinData SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3OTM3NTgsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyNTM5ZGFkZDUxYmE5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU="); + private static long _nameCount = -99999999999999L; + + public final static SkinData FREEDOM_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjY1NzA5NDAzODcsInByb2ZpbGVJZCI6IjQwZWQ5NzU1OWIzNTQ1M2Q4NjU1ZmMwMDM5OGRiNmI5IiwicHJvZmlsZU5hbWUiOiJTcG9vYm5jb29iciIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc4N2Q4OGNlYzNmOWI0M2RiNDg1YTU0Mjc2YTQ1MjQzNGFiZDI2ZDMzY2QzZmZhMTM2N2ZiMzVmOWUzODQifX19", "UgsQyW/HJ/jmDzfI1d7RWFbhKi8PeJAKBuAOk7ajS5dzH5od301KfcmiT2X3TU7cBbUswcKtDb2F/m7gNrg/t+pU7Bi9UKzyALEu9HRjd4s1uKbqGkBip1z5Qycp4fhkSyKvtvTnA2fhpP9oHtE5FxGXdMhZXyFkLrli4Hyxp1BI0N4h7pgbcMaISPS0ZYzDRNxkrSnl3y3KyKn5Rl5qH7utmQtAjoyx9aueMZxG3tg/igfYF7uAvvmuYKsSiTZWZOOuSh+U1dkP+ZE/cQANfryXkLJSJHa9YZPCMJHXe4mMoAyu0/quwZCW9NlW3P30XeCfZ87IxfKxISIP0dLgY8hUJyCuI2u5U7TEDrDggPKr6XTcIbX2kFKOsYSeovsAgjC+1UKFH4Ba0jTbRmqzPK49fk/jU8XqRP2Gl9UZDIVbc0dMEXNOeJ0e0wejDtSyX8flBk9sIKYwqeB9ns4cFqSyTI5tKnNin12BNTFRK/bDp8dN7nloyQvhDGlW88UlnJmOFhR6R0naP89VM04VCLaYCr6jyv/ZwV88uPvL2kjhx14qSFfgqJI5ORhFgYkuc+nhyQaD8+y2t3ZMs0HAfoujmq98lp2ECLWyI0ATUcXjUyNYadLj4valS/m0jl7U2fwzcmVMQqOC3ddu6mHbt871hIkG2X4v6kEcVAtKmkg="); + public final static SkinData COMPANION_CUBE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDk5NjI0NjEsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyMTVkYmRhNTY1ZjVjYjhlYjEyZjU1NWY1ZTNkYTBlYTVmNTUxOTg5MWNjNWM1ZDY3NmZkODJjNjIifX19", "vaAQbhnhnTOs64ToFWLg7o4JmqkIl07HWJ6l7xibfISaOcU4BvYBxsfGvmoxlVdsUeCunAJ8/05qVLl5zZYd8Dt+To6JSY0RlqV8piRaaj3FztYWV2ZvG3YZxPxiD3HRJTAQnDobSuxHyPa1e3khjAFp9xJo4q1oqQ28oI2WDuoT+IHqxwkKVbGzO7UD5lzz5chjQC46E8SxddNKp9aqwbbccrkHYT4gteoonOXu4MFxZniJN12LqUCb6+G15rU8MijlBkWx0xE5NMUloeTGuJZItbHun9fysLk/+HE5xJOKYtpZNMuWX+DB/O5ds9dXrOoSAg+Vn0QU4CZbwcxzLii5ILOfEEBtePuEAgzROri+iCKp59CqlEMBrCsd3Um0MCdbuOfvkXGBHBz+bqX7VJY1ujlSdMefmbJtHAkDANnsaaVb+eli9Dk6139041sptsLytD+EfJzaitX6crBwKZ2WDx2P6LHo8B+iSOzOJxjf/08zlXqFw1vsk62IN6lisuZ89QyZw23RvOx3obLAGYs1GxAlMl9qQdpXcmuE1+lPR3g8gZ0BfnTeYwflC2wbR1tuwGG98lyUGCvGLyqNKAQTN87XV4IFQWR81mi1c5CcasoWhKf9D9nAik9aK7A915fEE5IvpeuUdZseDxDVVN5dBIs5q2PIHFAS0rDsDBc="); + public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ="); + public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); public final static SkinData PRESENT = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3MDIxNjIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2YzRkZWQwNTdjMjhiMTU0NjVkYzQzNmFmODIyYTNkZTY4NzgyZTZjMzgyOGMzMmFhYWE4ZjRiOTIzOWVjIn19fQ==","rJNlxTqHHmOoWwbXdMQLcj0P9w/PIr/hWKXH0nbhm/S2CFo/zfefffZlnQmpKCgn1Y8tXvcRwLGQ4CLpm9m2ZrKprSWRhrnOtZWYabrhExQESEammS3TY81VoNt+4On0pAGBippz/bRfWLuDne2rDbhuljnqvxjROmxpky7gRCU06VMlm2WLFC5XYJkiAaOXBqzpiHMMRPNnCvtcbtpILKi/Luj302eyN8nRKjHHbbiDmttwvlshxZ8UxJHvALtM506IUHba10Q6QX2zCeDAU5/WYRKa6e19r8plROcgGbKYFSq8JW5cWuWT3/rveZM6FnU6ABn9DWsCyfQ5wr2jdBd+xaevGTAScRHA5J493GqL1bBZYKj9yhQFtxJHCAf0++raAVPCZgyPtwTth4TAQisn8gnhM5R+txnW6xK+oflLy0dwEN1YdPLN/h7yuDnyjSMDe9RZT2NKMjok2C6Kux4WBI0KFXKC5Gqwa3Htku4v3WEOWMaVoWOtchQ9BzpQ/etD0ylmzjALQLB+HtndEEm1Jd3tmob42X4hBE8hCce7C3EtGINB33dlx4CK1xBqyGTJEqi69DJRzVL99u98+7kJ1Db9+MaPOfI4B2RY3XbvnSYwecandY//A3bb19FGSdl299ZXbp4zpm8fivzeB1rUAhhmtaA3Iwu/nEQNMkU="); public final static SkinData RUDOLPH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk1NjgxODIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzZjdlMjhiNTJkZjJjZjhlZWM2NDk2ZmM0NWFlMGQ2NTM0Njc5OGIxYWRjNzM3ZDcxYzBmOTRlNDIyMSJ9fX0=","uUBOTe63CL+qRvtsb2g4AjB2YzxE3N6AUqIsTv8n0jYyPsuXpuOmZPSMEdgDVONywEJ1L4XRx05sjnGu56A8vuXmGI/uHQWuMZzbOSjiFfT3DkEm8zEl5AWpH9dz/t8nZ1WYUIwy0pN5VrZqIr1DAkF6AMh/Qy+FGDw1GG9ReRr80eJ0JiRskpkCpCZIGGjrgwNKAM8JOuNZ4gCQOTRC3etrcfls3qmUMFcVlhuB4bydxSR01i2w0A4b5KpufsJjLKw4InWn2+m/druo8hl9sYuusTeItW0MQmZqCAqXCc9YBnRPQ0hDXFgnPxOh3RwGWiZvL4MnWUVmLwZWh/Fk9QmyVbd7zVao0lxS8YNsKtP8j5B+hs4l9qNohhf0A07bt4oPeTtd5fQeOU5N87fUGuUAcpC4gP9U5WpVY5FFPBvLvGbXdV5jpuAQz4lLSoo1grsP9baR2IBvdN/0awjQWoPJfGOttegubkBHwz3LNcVqvZLtX/M13IDHZa6zQZEX0wsnMX60LeWgBWfTON1l2cSgaPTerHFS2EifJ2LvTBife3s9/4XR6Zth3FLFqxI3MSlqT2hVFRPLke6rBqfqPoWOj2MCykQ70IAwb3oTHcJDJ86V2DdNaU2bZ8V4TjaP+nRobsLJOImoPYEPq23MP36X8gbXEIjmuu8S5xRlrrc="); - public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ="); - public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); - public final static SkinData COMPANION_CUBE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDk5NjI0NjEsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyMTVkYmRhNTY1ZjVjYjhlYjEyZjU1NWY1ZTNkYTBlYTVmNTUxOTg5MWNjNWM1ZDY3NmZkODJjNjIifX19", "vaAQbhnhnTOs64ToFWLg7o4JmqkIl07HWJ6l7xibfISaOcU4BvYBxsfGvmoxlVdsUeCunAJ8/05qVLl5zZYd8Dt+To6JSY0RlqV8piRaaj3FztYWV2ZvG3YZxPxiD3HRJTAQnDobSuxHyPa1e3khjAFp9xJo4q1oqQ28oI2WDuoT+IHqxwkKVbGzO7UD5lzz5chjQC46E8SxddNKp9aqwbbccrkHYT4gteoonOXu4MFxZniJN12LqUCb6+G15rU8MijlBkWx0xE5NMUloeTGuJZItbHun9fysLk/+HE5xJOKYtpZNMuWX+DB/O5ds9dXrOoSAg+Vn0QU4CZbwcxzLii5ILOfEEBtePuEAgzROri+iCKp59CqlEMBrCsd3Um0MCdbuOfvkXGBHBz+bqX7VJY1ujlSdMefmbJtHAkDANnsaaVb+eli9Dk6139041sptsLytD+EfJzaitX6crBwKZ2WDx2P6LHo8B+iSOzOJxjf/08zlXqFw1vsk62IN6lisuZ89QyZw23RvOx3obLAGYs1GxAlMl9qQdpXcmuE1+lPR3g8gZ0BfnTeYwflC2wbR1tuwGG98lyUGCvGLyqNKAQTN87XV4IFQWR81mi1c5CcasoWhKf9D9nAik9aK7A915fEE5IvpeuUdZseDxDVVN5dBIs5q2PIHFAS0rDsDBc="); - public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); + public final static SkinData SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3OTM3NTgsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyNTM5ZGFkZDUxYmE5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU="); public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas="); - - public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0="); - public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60="); + public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg="); + public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); + public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M="); + + // 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 + // Might change on the next version + //public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); + + //public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0="); + //public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60="); private Property _skinProperty; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index 9df45eeac..1f51c77bf 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -256,33 +256,36 @@ public class MapUtil @SuppressWarnings({ "rawtypes" }) public static boolean ClearWorldReferences(String worldName) { - HashMap regionfiles = (HashMap) RegionFileCache.a; - - try + synchronized (RegionFileCache.class) { - for (Iterator iterator = regionfiles.entrySet().iterator(); iterator.hasNext();) - { - Map.Entry e = (Map.Entry) iterator.next(); - RegionFile file = (RegionFile) e.getValue(); + HashMap regionfiles = (HashMap) RegionFileCache.a; - try + try + { + for (Iterator iterator = regionfiles.entrySet().iterator(); iterator.hasNext(); ) { - file.c(); - iterator.remove(); - } - catch (Exception ex) - { - ex.printStackTrace(); + Map.Entry e = (Map.Entry) iterator.next(); + RegionFile file = (RegionFile) e.getValue(); + + try + { + file.c(); + iterator.remove(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } } - } - catch (Exception ex) - { - System.out.println("Exception while removing world reference for '" + worldName + "'!"); - ex.printStackTrace(); - } + catch (Exception ex) + { + System.out.println("Exception while removing world reference for '" + worldName + "'!"); + ex.printStackTrace(); + } - return true; + return true; + } } public static BlockPosition getBlockPos(int x, int y, int z) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java index ba7e00bb9..ec8b4ae5e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java @@ -108,4 +108,10 @@ public class UtilFirework UtilMath.random.nextBoolean() ); } + + public static void playFreedomFirework(Location location) + { + playFirework(location, FireworkEffect.builder().withColor(Color.RED).withColor(Color.BLUE) + .withColor(Color.WHITE).withFade(Color.RED).withFade(Color.BLUE).withFade(Color.WHITE).build()); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index 4f8313b43..f7b6cbec7 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -173,7 +173,17 @@ public class UtilInv return getItems(player, true, true, true); } + public static ArrayList getItemsUncloned(Player player) + { + return getItems(player, true, true, true, false); + } + public static ArrayList getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting) + { + return getItems(player, getArmor, getCursor, getCrafting, true); + } + + public static ArrayList getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting, boolean clone) { ArrayList items = new ArrayList(); PlayerInventory inv = player.getInventory(); @@ -182,7 +192,7 @@ public class UtilInv { if (item != null && item.getType() != Material.AIR) { - items.add(item.clone()); + items.add(clone ? item.clone() : item); } } @@ -192,7 +202,7 @@ public class UtilInv { if (item != null && item.getType() != Material.AIR) { - items.add(item.clone()); + items.add(clone ? item.clone() : item); } } } @@ -202,7 +212,7 @@ public class UtilInv ItemStack cursorItem = player.getItemOnCursor(); if (cursorItem != null && cursorItem.getType() != Material.AIR) - items.add(cursorItem.clone()); + items.add(clone ? cursorItem.clone() : cursorItem); } if (getCrafting) @@ -215,7 +225,7 @@ public class UtilInv { if (item != null && item.getType() != Material.AIR) { - items.add(item.clone()); + items.add(clone ? item.clone() : item); } } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index 162d038ff..abe2a726f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -1,5 +1,6 @@ package mineplex.core.common.util; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -340,6 +341,21 @@ public class UtilParticle { PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); } - + + public static void playColoredParticle(Color color, ParticleType particleType, Location location, int count, ViewDist dist, Player... players) + { + if (particleType != ParticleType.RED_DUST + && particleType != ParticleType.MOB_SPELL_AMBIENT) + return; + PlayParticle(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist, players); + } + + public static void playColoredParticleToAll(Color color, ParticleType particleType, Location location, int count, ViewDist dist) + { + if (particleType != ParticleType.RED_DUST + && particleType != ParticleType.MOB_SPELL_AMBIENT) + return; + PlayParticleToAll(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist); + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index db3fb1cea..9f5f14739 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -937,4 +937,10 @@ public class UtilPlayer return false; return true; } + + public static void removeAllowedCommands(Player player) + { + if (ALLOWED_COMMANDS.containsKey(player.getUniqueId())) + ALLOWED_COMMANDS.remove(player.getUniqueId()); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java index 840f78586..886d8e26d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -197,4 +197,14 @@ public class UtilServer { return Lists.newArrayList(getPlayers()); } + + public static boolean isTestServer() + { + return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + } + + public static boolean isHubServer() + { + return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby"); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 7f281b1db..d0825126d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -751,4 +751,20 @@ public class UtilText } return array; } + + public static String colorWords(String str, ChatColor... colors) + { + int c = 0, maxC = colors.length - 1; + StringBuilder stringBuilder = new StringBuilder(); + for (String word : str.split(" ")) + { + stringBuilder.append(colors[c]); + stringBuilder.append(word + " "); + if (c < maxC) + c++; + else + c = 0; + } + return stringBuilder.toString(); + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java index db7d0ccc0..72c1aa5db 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java @@ -180,7 +180,7 @@ public class UtilTime { if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day"; else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour"; - else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute"; + else if (type == TimeUnit.MINUTES) text = (int) (num = (int) UtilMath.trim(trim, time / 60000d)) + " Minute"; else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(trim, time / 1000d)) + " Second"; else text = (int) (num = (int) UtilMath.trim(trim, time)) + " Millisecond"; } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java new file mode 100644 index 000000000..af4dfec31 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java @@ -0,0 +1,70 @@ +package mineplex.core.common.util.banner; + +import org.bukkit.DyeColor; +import org.bukkit.block.banner.Pattern; +import org.bukkit.block.banner.PatternType; +import org.bukkit.inventory.ItemStack; + +public enum CountryFlag +{ + + Brazil(DyeColor.GREEN, new Pattern(DyeColor.YELLOW, PatternType.RHOMBUS_MIDDLE), new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)), + Usa(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.BLUE, PatternType.SQUARE_TOP_RIGHT)), + Canada(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM), + new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)), + Uk(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNLEFT), new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT), + new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.CROSS)), + Ireland(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.STRIPE_TOP), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_BOTTOM)), + Spain(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.RED, PatternType.STRIPE_RIGHT)), + Japan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)), + South_Sudan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_RIGHT), + new Pattern(DyeColor.GREEN, PatternType.TRIANGLE_BOTTOM)), + Jamaica(DyeColor.GREEN, new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP), new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_BOTTOM), + new Pattern(DyeColor.YELLOW, PatternType.CROSS)), + Italy(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM)), + Senegal(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM), + new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)), + France(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)), + India(DyeColor.WHITE, new Pattern(DyeColor.ORANGE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.GREEN, PatternType.STRIPE_RIGHT), + new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)), + Belgium(DyeColor.YELLOW, new Pattern(DyeColor.BLACK, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)), + England(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS)), + Austria(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER)), + Armenia(DyeColor.RED, new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_RIGHT)), + Argentina(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)), + Greece(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.LIGHT_BLUE, PatternType.SQUARE_BOTTOM_LEFT)), + Czech_Republic(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.BLUE, PatternType.TRIANGLE_BOTTOM)), + Romania(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)), + Honduras(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT)), + Algeria(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR), new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)), + Portugal(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.STRIPE_TOP), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)), + Bahrain(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.TRIANGLES_BOTTOM)), + Germany(DyeColor.RED, new Pattern(DyeColor.BLACK, PatternType.STRIPE_LEFT), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_RIGHT)), + Gabon(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT), new Pattern(DyeColor.LIME, PatternType.STRIPE_LEFT)), + Scotland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.CROSS)), + Peru(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM)), + Tanzania(DyeColor.LIME, new Pattern(DyeColor.LIGHT_BLUE, PatternType.DIAGONAL_RIGHT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_DOWNLEFT)), + Morocco(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)), + Solomon_Islands(DyeColor.GREEN, new Pattern(DyeColor.BLUE, PatternType.DIAGONAL_LEFT_MIRROR), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_DOWNRIGHT)), + Switzerland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM), + new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)), + Finland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_LEFT), new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_RIGHT), + new Pattern(DyeColor.WHITE, PatternType.HALF_HORIZONTAL), new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER)), + South_Africa(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL), + new Pattern(DyeColor.GREEN, PatternType.STRIPE_CENTER), new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_BOTTOM)), + Poland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.HALF_VERTICAL_MIRROR)); + + private DyeColor _baseColor; + private Pattern[] _patterns; + + CountryFlag(DyeColor baseColor, Pattern... patterns){ + _baseColor = baseColor; + _patterns = patterns; + } + + public ItemStack getBanner() + { + return UtilBanner.createBanner(_baseColor, _patterns); + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java new file mode 100644 index 000000000..25693bb2a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java @@ -0,0 +1,25 @@ +package mineplex.core.common.util.banner; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.block.banner.Pattern; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; + +public class UtilBanner +{ + + public static ItemStack createBanner(DyeColor baseColor, Pattern... patterns) + { + ItemStack banner = new ItemStack(Material.BANNER); + BannerMeta bannerMeta = (BannerMeta) banner.getItemMeta(); + bannerMeta.setBaseColor(baseColor); + for (Pattern pattern : patterns) + { + bannerMeta.addPattern(pattern); + } + banner.setItemMeta(bannerMeta); + return banner; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java new file mode 100644 index 000000000..09ef34668 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java @@ -0,0 +1,56 @@ +package mineplex.core.common.util.particles; + + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class ColoredParticle extends ParticleData +{ + + private ParticleColor _color; + + public ColoredParticle(UtilParticle.ParticleType particleType, ParticleColor color, Location location) + { + super(particleType, location); + if ((particleType == UtilParticle.ParticleType.RED_DUST || particleType == UtilParticle.ParticleType.MOB_SPELL_AMBIENT) + && !(color instanceof DustSpellColor)) + throw new IllegalArgumentException("RED_DUST and MOB_SPELL_AMBIENT particle types require a DustSpellColor!"); + else if(particleType == UtilParticle.ParticleType.NOTE && !(color instanceof NoteColor)) + throw new IllegalArgumentException("NOTE particle type requires a NoteColor!"); + else if(particleType != UtilParticle.ParticleType.RED_DUST && particleType != UtilParticle.ParticleType.MOB_SPELL_AMBIENT + && particleType != UtilParticle.ParticleType.NOTE) + throw new IllegalArgumentException("Particle Type must be RED_DUST, MOB_SPELL_AMBIENT!"); + _particleType = particleType; + _color = color; + _location = location; + } + + @Override + public void display(UtilParticle.ViewDist viewDist, Player... players) + { + float x = _color.getX(); + if (_particleType == UtilParticle.ParticleType.RED_DUST && x == 0) + x = Float.MIN_NORMAL; + UtilParticle.PlayParticle(_particleType, _location, x, _color.getY(), _color.getZ(), 1, 0, viewDist, players); + } + + @Override + public void display(UtilParticle.ViewDist viewDist) + { + display(viewDist, UtilServer.getPlayers()); + } + + @Override + public void display() + { + display(UtilParticle.ViewDist.NORMAL); + } + + public void setColor(ParticleColor color) + { + _color = color; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java new file mode 100644 index 000000000..be36f059d --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java @@ -0,0 +1,39 @@ +package mineplex.core.common.util.particles; + +import java.awt.*; + +public class DustSpellColor extends ParticleColor +{ + + private int _red, _green, _blue; + + public DustSpellColor(Color color) + { + _red = color.getRed(); + _green = color.getGreen(); + _blue = color.getBlue(); + } + + public DustSpellColor(int r, int g, int b) + { + _red = r; + _green = g; + _blue = b; + } + + public float getX() + { + return (float) _red / 255f; + } + + public float getY() + { + return (float) _green / 255f; + } + + public float getZ() + { + return (float) _blue / 255f; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java new file mode 100644 index 000000000..d7963c80a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java @@ -0,0 +1,14 @@ +package mineplex.core.common.util.particles; + +import mineplex.core.common.util.UtilParticle; +import org.bukkit.Location; + +public class NormalParticle extends ParticleData +{ + + public NormalParticle(UtilParticle.ParticleType particleType, Location location) + { + super(particleType, location); + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java new file mode 100644 index 000000000..94cf5d5d2 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java @@ -0,0 +1,39 @@ +package mineplex.core.common.util.particles; + +import java.awt.*; + +public class NoteColor extends ParticleColor +{ + + private int _red, _green, _blue; + + public NoteColor(Color color) + { + _red = color.getRed(); + _green = color.getGreen(); + _blue = color.getBlue(); + } + + public NoteColor(int r, int g, int b) + { + _red = r; + _green = g; + _blue = b; + } + + public float getX() + { + return (float) _red / 24f; + } + + public float getY() + { + return 0f; + } + + public float getZ() + { + return 0f; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java new file mode 100644 index 000000000..56fff7eca --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java @@ -0,0 +1,14 @@ +package mineplex.core.common.util.particles; + +import java.awt.*; + +public abstract class ParticleColor +{ + + public abstract float getX(); + + public abstract float getY(); + + public abstract float getZ(); + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java new file mode 100644 index 000000000..c6e020ddf --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java @@ -0,0 +1,57 @@ +package mineplex.core.common.util.particles; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class ParticleData +{ + + protected UtilParticle.ParticleType _particleType; + protected Location _location; + + public ParticleData(UtilParticle.ParticleType particleType, Location location) + { + _particleType = particleType; + _location = location; + } + + /** + * Displays the particles for selected players + * @param viewDist The distance of the particle view + * @param players The players that will receive the particle + */ + public void display(UtilParticle.ViewDist viewDist, Player... players) + { + UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist); + } + + /** + * Displays the particles for all the players + * @param viewDist The distance of the particle view + */ + public void display(UtilParticle.ViewDist viewDist) + { + display(viewDist, UtilServer.getPlayers()); + } + + /** + * Displays the particles for all the players, with a NORMAL view distance + */ + public void display() + { + display(UtilParticle.ViewDist.NORMAL); + } + + public void setLocation(Location location) + { + _location = location; + } + + public Location getLocation() + { + return _location; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 4c9081b52..0fd3396b7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -6,7 +6,6 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.bonuses.animations.AnimationCarl; -import mineplex.core.bonuses.commands.AllowCommand; import mineplex.core.bonuses.commands.AnimationCommand; import mineplex.core.bonuses.commands.GuiCommand; import mineplex.core.bonuses.commands.TicketCommand; @@ -39,6 +38,7 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.treasure.TreasureType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.youtube.YoutubeManager; import mineplex.database.Tables; import mineplex.database.tables.records.BonusRecord; import mineplex.serverdata.commands.ServerCommandManager; @@ -122,7 +122,8 @@ public class BonusManager extends MiniClientPlugin implements I private RewardManager _rewardManager; private StatsManager _statsManager; private FacebookManager _facebookManager; -// private BoosterManager _boosterManager; + private YoutubeManager _youtubeManager; + private BoosterManager _boosterManager; public boolean _enabled; private Npc _carlNpc; private AnimationCarl _animation; @@ -161,7 +162,7 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, GadgetManager gadgetManager) + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, BoosterManager boosterManager) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -170,12 +171,14 @@ public class BonusManager extends MiniClientPlugin implements I _npcManager = npcManager; _hologramManager = hologramManager; _inventoryManager = inventoryManager; + _boosterManager = boosterManager; _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); _pollManager = pollManager; _statsManager = statsManager; _facebookManager = facebookManager; + _youtubeManager = youtubeManager; _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); @@ -414,6 +417,7 @@ public class BonusManager extends MiniClientPlugin implements I public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12; public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24; + public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback result) { if (timeTillDailyBonus(player) > 0) @@ -823,7 +827,7 @@ public class BonusManager extends MiniClientPlugin implements I if (entity.equals(_carlNpc.getEntity())) { updateDailyStreak(event.getPlayer()); - new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager).openInventory(); + new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory(); } } @@ -839,7 +843,7 @@ public class BonusManager extends MiniClientPlugin implements I if (event.getEntity().equals(_carlNpc.getEntity())) { updateDailyStreak(player); - new BonusGui(_plugin, player, this, _rewardManager, _facebookManager).openInventory(); + new BonusGui(_plugin, player, this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory(); } } } @@ -901,11 +905,12 @@ public class BonusManager extends MiniClientPlugin implements I int availableRewards = 0; if (canVote(player)) availableRewards++; + if (_youtubeManager.canYoutube(player)) availableRewards++; if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++; if (canDaily(player)) availableRewards++; if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; if (!_facebookManager.hasRedeemed(player)) availableRewards++; -// if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++; + if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++; Hologram hologram; @@ -1052,6 +1057,11 @@ public class BonusManager extends MiniClientPlugin implements I return _facebookManager; } + public YoutubeManager getYoutubeManager() + { + return _youtubeManager; + } + @EventHandler public void Join(final PlayerJoinEvent event) { @@ -1069,6 +1079,8 @@ public class BonusManager extends MiniClientPlugin implements I public void Quit(PlayerQuitEvent event) { _showCarl.remove(event.getPlayer().getName()); + // Removes from allow command map + UtilPlayer.removeAllowedCommands(event.getPlayer()); } @EventHandler @@ -1183,4 +1195,9 @@ public class BonusManager extends MiniClientPlugin implements I { return "SELECT * FROM bonus WHERE accountId = '" + accountId + "';"; } + + public BoosterManager getBoosterManager() + { + return _boosterManager; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java index 7758c377a..649f964e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java @@ -18,7 +18,7 @@ public class GuiCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager()).openInventory(); + new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager(), Plugin.getYoutubeManager(), Plugin.getBoosterManager()).openInventory(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 2392914e4..a8fef8c82 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -1,12 +1,12 @@ package mineplex.core.bonuses.gui; +import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.gui.buttons.*; import mineplex.core.boosters.BoosterManager; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; import mineplex.core.reward.RewardManager; -import mineplex.core.bonuses.BonusManager; - +import mineplex.core.youtube.YoutubeManager; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -15,24 +15,28 @@ public class BonusGui extends SimpleGui private BonusManager manager; - public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager) + public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, YoutubeManager youtubeManager, BoosterManager boosterManager) { super(plugin, player, player.getName() + "'s Bonuses", 5 * 9); this.manager = manager; - setItem(9, new VoteButton(plugin, player, this, manager)); + setItem(10, new VoteButton(plugin, player, this, manager)); - setItem(11, new RankBonusButton(getPlugin(), player, this, manager)); + setItem(12, new RankBonusButton(getPlugin(), player, this, manager)); - setItem(13, new DailyBonusButton(getPlugin(), player, this, manager)); + setItem(14, new DailyBonusButton(getPlugin(), player, this, manager)); - setItem(15, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager)); + setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager)); - setItem(17, new FacebookButton(player, facebookManager)); + setItem(19, new FacebookButton(player, facebookManager)); + + setItem(21, new YoutubeButton(player, youtubeManager)); + + setItem(23, new TwitterButton(player)); + + setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); -// setItem(19, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); - setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java new file mode 100644 index 000000000..fd9804d5d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java @@ -0,0 +1,51 @@ +package mineplex.core.bonuses.gui; + +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.gui.GuiItem; +import mineplex.core.itemstack.ItemBuilder; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public class TwitterButton implements GuiItem +{ + private static final ItemStack ICON = new ItemBuilder(Material.EGG) + .setTitle(C.cGreen + C.Bold + "Visit us on Twitter") + .addLore( + C.cWhite + "Check out and follow Mineplex on", + C.cWhite + "Twitter for Giveaways, Announcements,", + C.cWhite + "Teasers, and Tips!", + " ", + C.cGreen + "Click to visit us on Twitter!" + ) + .build(); + private final Player _player; + + public TwitterButton(Player player) + { + this._player = player; + } + + @Override + public void setup() {} + + @Override + public void close() {} + + @Override + public void click(ClickType clickType) + { + _player.closeInventory(); + + new JsonMessage(C.cAquaB + "Click here to visit our Twitter page!").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player); + } + + @Override + public ItemStack getObject() + { + return ICON; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java index 94f560fa1..a0d53216e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java @@ -84,10 +84,10 @@ public class ClaimTipsButton implements GuiItem, Listener if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Booster Tips Collected"), "Tips Collected", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Amplifier Thanks Collected"), "Thanks Collected", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Booster Tips!")); + UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Amplifiers!")); // Pending explosions are strange.. Not sure why we are using strings. Either way, lets display a rank reward effect _bonusManager.addPendingExplosion(getPlayer(), "RANK"); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); @@ -97,10 +97,10 @@ public class ClaimTipsButton implements GuiItem, Listener // No tips to claim if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Tips to Claim!"), "You have no tips to claim!", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Thanks to Claim!"), "You have no thanks to claim!", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "You have no tips to claim!")); + UtilPlayer.message(getPlayer(), F.main("Carl", "You have no rewards to claim!")); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); } else @@ -108,10 +108,10 @@ public class ClaimTipsButton implements GuiItem, Listener // Failed to claim if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Error collecting tips. Try again later."), "Error", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Error collecting rewards. Try again later."), "Error", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "Error collecting tips. Try again later.")); + UtilPlayer.message(getPlayer(), F.main("Carl", "Error collecting rewards. Try again later.")); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); } @@ -133,9 +133,9 @@ public class ClaimTipsButton implements GuiItem, Listener if (isAvailable()) { material = Material.EMERALD; - itemName = C.cGreen + C.Bold + "Booster Tips"; + itemName = C.cGreen + C.Bold + "Game Amplifiers"; lore.add(" "); - lore.add(C.cYellow + "Your Tips"); + lore.add(C.cYellow + "Your Rewards"); lore.add(" " + C.cWhite + getTips() + " Treasure Shards"); lore.add(" "); lore.add(ChatColor.RESET + "Click to Claim!"); @@ -143,10 +143,12 @@ public class ClaimTipsButton implements GuiItem, Listener else { material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Booster Tips"; + itemName = C.cRed + C.Bold + "Game Amplifiers"; lore.add(" "); - lore.add(C.Reset + "Activate Game Boosters to receive tips"); + lore.add(C.cGray + "Use Amplifiers to earn rewards"); + lore.add(" "); + lore.add(C.cWhite + "Get Amplifiers at " + C.cGreen + "mineplex.com/shop"); } _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java new file mode 100644 index 000000000..475871234 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -0,0 +1,82 @@ +package mineplex.core.bonuses.gui.buttons; + +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.gui.GuiItem; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.youtube.YoutubeManager; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public class YoutubeButton implements GuiItem +{ + private static final ItemStack DISABLED_ICON = new ItemBuilder(Material.APPLE) + .setTitle(C.cGreen + C.Bold + "Visit us on YouTube") + .addLore( + C.cWhite + "Come back tomorrow for your", + C.cWhite + "Daily 250 Shard Reward!", + " ", + C.cWhite + "Check out the latest Video", + C.cWhite + "on the MineplexGames Channel!", + " ", + C.cWhite + "Be sure and Subscribe so you", + C.cWhite + "don't miss a video!", + " ", + C.cGreen + "Click to visit us on YouTube!" + ) + .build(); + private static final ItemStack ENABLED_ICON = new ItemBuilder(Material.APPLE) + .setTitle(C.cGreen + C.Bold + "Visit us on YouTube") + .addLore( + C.cYellow + "Claim your Daily 250 Shard Reward", + C.cWhite + "by checking out the latest Video", + C.cWhite + "on the MineplexGames Channel!", + C.cWhite + " ", + C.cWhite + "Be sure and Subscribe so you", + C.cWhite + "don't miss a video!", + " ", + C.cGreen + "Click to visit us on YouTube!" + ) + .build(); + private final Player _player; + private final YoutubeManager _youtubeManager; + + public YoutubeButton(Player player, YoutubeManager youtubeManager) + { + this._player = player; + this._youtubeManager = youtubeManager; + } + + @Override + public void setup() {} + + @Override + public void close() {} + + @Override + public void click(ClickType clickType) + { + _player.closeInventory(); + + final String message; + if (_youtubeManager.canYoutube(_player)) + { + message = "Click here to claim YouTube Prize!"; + _youtubeManager.attemptYoutube(_player); + } else + { + message = "Click here to visit our YouTube page!"; + } + + new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/mineplexgamesofficial").sendToPlayer(_player); + } + + @Override + public ItemStack getObject() + { + return _youtubeManager.canYoutube(_player) ? ENABLED_ICON : DISABLED_ICON; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java index 143b6d837..5dfb90d42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java @@ -1,5 +1,6 @@ package mineplex.core.boosters; +import com.mojang.authlib.properties.PropertyMap; import mineplex.core.common.util.UtilTime; import java.util.Date; @@ -10,7 +11,7 @@ import java.util.UUID; */ public class Booster { - private int _boosterId; + private int _id; private String _playerName; private UUID _uuid; private int _accountId; @@ -19,14 +20,15 @@ public class Booster private Date _startTime; private Date _endTime; private Date _activationTime; +// private PropertyMap _propertyMap; public Booster() { } - public int getBoosterId() + public int getId() { - return _boosterId; + return _id; } public String getPlayerName() @@ -66,12 +68,24 @@ public class Booster public boolean isActive() { - return getEndTime().before(new Date()); + Date now = new Date(); + return getStartTime().before(now) && getEndTime().after(now); } public long getTimeRemaining() { - return Math.max(0, getEndTime().getTime() - System.currentTimeMillis()); + if (isActive()) + { + return Math.max(0, getEndTime().getTime() - System.currentTimeMillis()); + } + else if (getEndTime().after(new Date())) + { + return _duration * 1000L; + } + else + { + return 0; + } } public String getTimeRemainingString() @@ -84,6 +98,11 @@ public class Booster return _multiplier; } +// public PropertyMap getPropertyMap() +// { +// return _propertyMap; +// } + @Override public boolean equals(Object o) { @@ -92,23 +111,28 @@ public class Booster Booster booster = (Booster) o; - if (_boosterId != booster._boosterId) return false; + if (_id != booster._id) return false; return _accountId == booster._accountId; } @Override public int hashCode() { - int result = _boosterId; + int result = _id; result = 31 * result + _accountId; return result; } + public int getIncreasePercent() + { + return (int) (getMultiplier() - 1) * 100; + } + @Override public String toString() { return "Booster{" + - "_boosterId=" + _boosterId + + "_id=" + _id + ", _playerName='" + _playerName + '\'' + ", _uuid=" + _uuid + ", _accountId=" + _accountId + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java deleted file mode 100644 index ffe7b8a3b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java +++ /dev/null @@ -1,12 +0,0 @@ -package mineplex.core.boosters; - -import mineplex.core.game.GameDisplay; - -/** - * @author Shaun Bennett - */ -public enum BoosterCategory -{ - - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index ae1937537..a8b79473f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -1,31 +1,63 @@ package mineplex.core.boosters; +import com.mojang.authlib.properties.PropertyMap; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.command.BoosterCommand; import mineplex.core.boosters.event.BoosterActivateEvent; -import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterExpireEvent; +import mineplex.core.boosters.event.BoosterUpdateEvent; import mineplex.core.boosters.gui.BoosterShop; +import mineplex.core.boosters.redis.BoosterUpdateRepository; import mineplex.core.boosters.tips.BoosterTipManager; +import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; -import java.io.IOException; -import java.net.URISyntaxException; import java.util.*; /** + * BoosterManager handles the majority of logic for creating and getting Boosters. Every BoosterManager stores a cache + * for all boosters across all servers. We pull all boosters from the API when the server boots up. To keep them in sync, + * instead of consistently polling the API I have decided to go with a redis pub/sub solution to ensuring all boosters + * across all servers are up to date. Whenever the Booster API receives a call to add or modify boosters, it will publish + * an updated version of all boosters over redis. + * + * Boosters are enabled on live servers using "Booster Groups". A {@link mineplex.serverdata.data.ServerGroup} can specify + * which BoosterGroup applies to it. If there is no BoosterGroup, then it means the server does not use boosters. To add + * a BoosterGroup, you must add to the "boostergroups" set on redis (the same way the servergroups set works), otherwise + * the API will return an error saying that BoosterGroup does not exist. Currently BoosterGroups are no more than a String + * key for Boosters. In the future we may want to look into implementing BoosterGroup specific data such as default + * booster length and multiplier. + * * @author Shaun Bennett */ public class BoosterManager extends MiniPlugin { + // The InventoryManager item name for boosters. This is required to activate a booster on servers + public static final String BOOSTER_ITEM = "Game Booster"; + // Item in arcade lobbies that opens the booster gui + public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Game Amplifiers"); + // Slot for the booster gui item + public static final int INTERFACE_SLOT = 7; + private BoosterRepository _repository; private CoreClientManager _clientManager; private DonationManager _donationManager; @@ -33,15 +65,19 @@ public class BoosterManager extends MiniPlugin private BoosterTipManager _tipManager; private BoosterShop _shop; + private String _boosterGroup; + + private boolean _giveInterfaceItem; private long _cacheLastUpdated; private Map> _boosterCache = new HashMap<>(); - public BoosterManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) + public BoosterManager(JavaPlugin plugin, String boosterGroup, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) { super("Booster Manager", plugin); _repository = new BoosterRepository(); + _boosterGroup = boosterGroup; _clientManager = clientManager; _donationManager = donationManager; _inventoryManager = inventoryManager; @@ -51,13 +87,18 @@ public class BoosterManager extends MiniPlugin try { - _boosterCache = _repository.getBoosters(); + Map> boosters = _repository.getBoosters(); + if (boosters != null) _boosterCache = boosters; } catch (Exception e) { System.out.println("Failed to load boosters on server start."); e.printStackTrace(); } + + _giveInterfaceItem = canActivateBoosters(); + + new BoosterUpdateRepository(plugin); } @Override @@ -66,6 +107,10 @@ public class BoosterManager extends MiniPlugin addCommand(new BoosterCommand(this)); } + /** + * Make an API call to grab all Boosters + */ + @Deprecated public void getBoostersAsync(Callback>> callback) { runAsync(() -> { @@ -75,29 +120,7 @@ public class BoosterManager extends MiniPlugin Map> boosters = _repository.getBoosters(); long timeTaken = System.currentTimeMillis() - time; runSync(() -> { - - _boosterCache.entrySet().stream() - .filter(entry -> entry.getValue().size() > 0) - .filter(entry -> boosters.get(entry.getKey()) == null) - .forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getValue().get(0)))); - - for (Map.Entry> entry : boosters.entrySet()) - { - List current = _boosterCache.get(entry.getKey()); - if (current == null || current.get(0) == null) - { - callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); - } - else if (!current.get(0).equals(entry.getValue().get(0))) - { - callNextTick(new BoosterDeactivateEvent(current.get(0))); - callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); - } - - } - - _cacheLastUpdated = System.currentTimeMillis(); - _boosterCache = boosters; + handleBoosterUpdate(boosters); if (callback != null) callback.run(boosters); }); } @@ -109,9 +132,153 @@ public class BoosterManager extends MiniPlugin }); } - public Booster getActiveBoosterFromCache(String serverGroup) + /** + * Make an API call to grab all boosters for a specific booster group + * @param boosterGroup + * @param callback + */ + @Deprecated + public void getBoostersAsync(String boosterGroup, Callback> callback) { - List boosters = _boosterCache.get(serverGroup); + runAsync(() -> { + try + { + List boosters = _repository.getBoosters(boosterGroup); + if (callback != null) runSync(() -> callback.run(boosters)); + } + catch (Exception e) + { + System.err.println("Failed to grab boosters for boostergroup: " + boosterGroup); + e.printStackTrace(); + } + }); + } + + /** + * Process the new boosterMap whenever a BoosterUpdateEvent is sent. This will compare itself to the current + * cached BoosterMap and call events when it finds a booster was activated or deactivated + * @param boosterMap The new booster map + */ + private void handleBoosterUpdate(Map> boosterMap) + { + _boosterCache.entrySet().stream() + .filter(entry -> entry.getValue().size() > 0) + .filter(entry -> boosterMap.get(entry.getKey()) == null) + .forEach(entry -> callNextTick(new BoosterExpireEvent(entry.getKey(), entry.getValue().get(0)))); + + for (Map.Entry> entry : boosterMap.entrySet()) + { + List current = _boosterCache.get(entry.getKey()); + if (entry.getValue() != null && !entry.getValue().isEmpty()) + { + if (current == null || current.isEmpty()) + { + // New booster was added + callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); + } else if (!current.get(0).equals(entry.getValue().get(0))) + { + // First booster was deactivated, new booster replaced it + callNextTick(new BoosterExpireEvent(entry.getKey(), current.get(0))); + callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); + } + } + } + + _cacheLastUpdated = System.currentTimeMillis(); + _boosterCache = boosterMap; + } + + private void tickBoosterCache() + { + List events = new ArrayList<>(3); + for (Map.Entry> entry : _boosterCache.entrySet()) + { + Iterator iterator = entry.getValue().iterator(); + boolean removedOne = false; + while (iterator.hasNext()) + { + Booster booster = iterator.next(); + if (!booster.isActive()) + { + iterator.remove(); + removedOne = true; + events.add(new BoosterExpireEvent(entry.getKey(), booster)); + } + else + { + if (removedOne) events.add(new BoosterActivateEvent(entry.getKey(), booster)); + break; + } + } + } + + events.forEach(Bukkit.getPluginManager()::callEvent); + } + + @EventHandler + public void tickBoosters(UpdateEvent event) + { + if (event.getType() == UpdateType.MIN_10) + { + // sync with API every 10 minutes, incase pubsub fails + getBoostersAsync(null); + } + else if (event.getType() == UpdateType.SEC) + { + tickBoosterCache(); + } + } + + /** + * Return all boosters for the active booster group + * @return list of boosters, or null if there is no active booster group + */ + public List getBoosters() + { + if (_boosterGroup == null || _boosterGroup.length() == 0) + { + return null; + } + else + { + List boosters = _boosterCache.get(_boosterGroup); + return boosters == null ? Collections.emptyList() : boosters; + } + } + + public String getBoosterGroup() + { + return _boosterGroup; + } + + public long getBoostTime() + { + return getBoostTime(_boosterGroup); + } + + public long getBoostTime(String boosterGroup) + { + long time = 0; + List boosters = _boosterCache.get(boosterGroup); + if (boosters != null && boosters.size() > 0) + { + for (Booster booster : boosters) + { + time += booster.getTimeRemaining(); + } + } + + return time; + } + + public Booster getActiveBooster() + { + return getActiveBooster(_boosterGroup); + } + + public Booster getActiveBooster(String boosterGroup) + { + List boosters = _boosterCache.get(boosterGroup); if (boosters != null) { for (Booster booster : boosters) @@ -124,20 +291,9 @@ public class BoosterManager extends MiniPlugin return null; } - public void getBoostersAsync(String serverGroup, Callback> callback) + public void activateBooster(Player player, Callback callback) { - runAsync(() -> { - try - { - List boosters = _repository.getBoosters(serverGroup); - if (callback != null) runSync(() -> callback.run(boosters)); - } - catch (Exception e) - { - System.err.println("Failed to grab boosters for servergroup: " + serverGroup); - e.printStackTrace(); - } - }); + activateBooster(_boosterGroup, player, callback); } public void activateBooster(String serverGroup, Player player, Callback callback) @@ -145,6 +301,7 @@ public class BoosterManager extends MiniPlugin String playerName = player.getName(); UUID uuid = player.getUniqueId(); int accountId = _clientManager.getAccountId(player); +// PropertyMap propertyMap = ((CraftPlayer) player).getHandle().getProfile().getProperties(); runAsync(() -> { BoosterApiResponse response = _repository.addBooster(serverGroup, playerName, uuid, accountId, 3600); @@ -152,18 +309,28 @@ public class BoosterManager extends MiniPlugin }); } + public void chargeBooster(Player player, Callback callback) + { + _inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, -1); + } + + public void refundBooster(Player player, Callback callback) + { + _inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, 1); + } + public void openShop(Player player) { _shop.attemptShopOpen(player); } + /** + * Booster updates are sent from {@link mineplex.core.boosters.redis.BoosterUpdateListener} + */ @EventHandler - public void updateCache(UpdateEvent event) + public void onBoosterUpdate(BoosterUpdateEvent event) { - if (event.getType() == UpdateType.SEC_30) - { - getBoostersAsync(null); - } + handleBoosterUpdate(event.getBoosterMap()); } public BoosterTipManager getTipManager() @@ -178,7 +345,7 @@ public class BoosterManager extends MiniPlugin */ public int getAvailableBoosterCount(Player player) { - return _inventoryManager.Get(player).getItemCount("Game Booster"); + return _inventoryManager.Get(player).getItemCount(BOOSTER_ITEM); } /** @@ -187,18 +354,37 @@ public class BoosterManager extends MiniPlugin */ public boolean canActivateBoosters() { - return true; + return _boosterGroup != null && _boosterGroup.length() > 0; } - public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException + public void giveInterfaceItem(Player player) { - BoosterRepository repository = new BoosterRepository(); - Map> boosters = repository.getBoosters(); - boosters.entrySet().forEach((entry) -> { - System.out.println("Booster Entry: " + entry.getKey()); - System.out.println("Booster Size: " + entry.getValue().size()); - entry.getValue().forEach(System.out::println); - }); + if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD)) + { + player.getInventory().setItem(INTERFACE_SLOT, INTERFACE_ITEM); + + UtilInv.Update(player); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + giveInterfaceItem(event.getPlayer()); + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (INTERFACE_ITEM.equals(event.getPlayer().getItemInHand())) + { + openShop(event.getPlayer()); + } + } + + public Map> getBoosterCache() + { + return _boosterCache; } private void callNextTick(Event event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java deleted file mode 100644 index 09786ce8f..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java +++ /dev/null @@ -1,8 +0,0 @@ -package mineplex.core.boosters; - -/** - * @author Shaun Bennett - */ -public class BoosterMap -{ -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java new file mode 100644 index 000000000..0cc567715 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java @@ -0,0 +1,59 @@ +package mineplex.core.boosters; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.shop.confirmation.ConfirmationCallback; +import mineplex.core.shop.confirmation.ConfirmationProcessor; +import org.bukkit.entity.Player; + +/** + * @author Shaun Bennett + */ +public class BoosterProcessor implements ConfirmationProcessor +{ + private BoosterManager _boosterManager; + private Player _player; + + public BoosterProcessor(BoosterManager boosterManager, Player player) + { + _boosterManager = boosterManager; + _player = player; + } + + @Override + public void process(ConfirmationCallback callback) + { + _boosterManager.chargeBooster(_player, data -> { + if (data) + { + _boosterManager.activateBooster(_player, response -> { + if (response.isSuccess()) + { + long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); + if (timeToStart <= 0) _player.sendMessage(F.main("Amplifier", "Game Amplifier Activated!")); + else _player.sendMessage(F.main("Amplifier", "Game Amplifier Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); + callback.resolve("Success!"); + } + else + { + _player.sendMessage(C.cRed + "There was an error trying to enable your Game Amplifier"); + if (response.getStatusCode() == 503 && response.getError() != null && response.getError().length() > 0) + { + // Service Unavailable HTTP Code + _player.sendMessage(C.cRed + "Error: " + response.getError()); + } + + _boosterManager.refundBooster(_player, null); + callback.reject("Failed. Try again later."); + } + }); + } + else + { + callback.reject("Failed charging account."); + _player.sendMessage(F.main("Amplifier", "There was an error charging your account. Try again later!")); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java index fbe355e28..a057c4071 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java @@ -4,6 +4,7 @@ import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; +import com.mojang.authlib.properties.PropertyMap; import mineplex.core.common.api.ApiEndpoint; import mineplex.core.common.api.ApiFieldNamingStrategy; import mineplex.core.common.api.ApiResponse; @@ -14,6 +15,8 @@ import java.util.Map; import java.util.UUID; /** + * Boosters interaction is handled through a web API. All data is represented as JSON and then parsed using gson. + * * @author Shaun Bennett */ public class BoosterRepository extends ApiEndpoint @@ -21,6 +24,7 @@ public class BoosterRepository extends ApiEndpoint public BoosterRepository() { super("/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) +// .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()) .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create()); } @@ -41,6 +45,7 @@ public class BoosterRepository extends ApiEndpoint body.addProperty("uuid", uuid.toString()); body.addProperty("accountId", accountId); body.addProperty("duration", duration); +// body.add("propertyMap", getGson().toJsonTree(propertyMap)); return getWebCall().post("/" + serverGroup, BoosterApiResponse.class, body); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java index a938b2d20..b86e382e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java @@ -32,11 +32,11 @@ public class AddCommand extends CommandBase { if (response.isSuccess()) { - UtilPlayer.message(caller, F.main("Booster", "Successfully added booster to " + F.elem(serverGroup))); + UtilPlayer.message(caller, F.main("Amplifier", "Successfully added amplifier to " + F.elem(serverGroup))); } else { - UtilPlayer.message(caller, F.main("Booster", "Failed to add booster. Error: " + F.elem(response.getError()))); + UtilPlayer.message(caller, F.main("Amplifier", "Failed to add amplifier. Error: " + F.elem(response.getError()))); } } }); @@ -49,6 +49,6 @@ public class AddCommand extends CommandBase private void help(Player caller) { - UtilPlayer.message(caller, F.help("booster add ", "Add a booster to that server group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("amplifier add ", "Add an amplifier to that server group", Rank.DEVELOPER)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java index 95d6cd706..216130e12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java @@ -15,14 +15,17 @@ public class BoosterCommand extends MultiCommandBase { public BoosterCommand(BoosterManager plugin) { - super(plugin, Rank.DEVELOPER, "booster"); + super(plugin, Rank.DEVELOPER, "amplifier", "booster"); AddCommand(new AddCommand(plugin)); + AddCommand(new GuiCommand(plugin)); + AddCommand(new ReloadCommand(plugin)); } @Override protected void Help(Player caller, String[] args) { - UtilPlayer.message(caller, F.help("booster add ", "Add a booster to that server group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("amplifier add ", "Add an amplifier to that group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("amplifier gui", "Open Amplifier GUI", Rank.DEVELOPER)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java new file mode 100644 index 000000000..762565ce0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java @@ -0,0 +1,23 @@ +package mineplex.core.boosters.command; + +import mineplex.core.boosters.BoosterManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import org.bukkit.entity.Player; + +/** + * @author Shaun Bennett + */ +public class GuiCommand extends CommandBase +{ + public GuiCommand(BoosterManager plugin) + { + super(plugin, Rank.DEVELOPER, "gui"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.openShop(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java new file mode 100644 index 000000000..3b8c543fd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java @@ -0,0 +1,35 @@ +package mineplex.core.boosters.command; + +import mineplex.core.boosters.Booster; +import mineplex.core.boosters.BoosterManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.Map; + +/** + * @author Shaun Bennett + */ +public class ReloadCommand extends CommandBase +{ + public ReloadCommand(BoosterManager plugin) + { + super(plugin, Rank.DEVELOPER, "reload"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.getBoostersAsync(data -> { + if (data != null) + { + UtilPlayer.message(caller, F.main("Amplifier", "Amplifiers reloaded!")); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java index f3592a96a..2972d2c30 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java @@ -5,17 +5,27 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; /** + * Called when a Booster is activated. This will be called regardless of which "BoosterGroup" the current server is set + * to, so if you only want Boosters on the current BoosterGroup, you will need to verify it. + * * @author Shaun Bennett */ public class BoosterActivateEvent extends Event { + private String _boosterGroup; private Booster _booster; - public BoosterActivateEvent(Booster booster) + public BoosterActivateEvent(String boosterGroup, Booster booster) { + _boosterGroup = boosterGroup; _booster = booster; } + public String getBoosterGroup() + { + return _boosterGroup; + } + public Booster getBooster() { return _booster; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterExpireEvent.java similarity index 64% rename from Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java rename to Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterExpireEvent.java index c211274fe..2f527ebac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterExpireEvent.java @@ -5,17 +5,26 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; /** + * Called when a Booster is finished. + * * @author Shaun Bennett */ -public class BoosterDeactivateEvent extends Event +public class BoosterExpireEvent extends Event { + private String _boosterGroup; private Booster _booster; - public BoosterDeactivateEvent(Booster booster) + public BoosterExpireEvent(String boosterGroup, Booster booster) { + _boosterGroup = boosterGroup; _booster = booster; } + public String getBoosterGroup() + { + return _boosterGroup; + } + public Booster getBooster() { return _booster; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java new file mode 100644 index 000000000..8dae38567 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java @@ -0,0 +1,41 @@ +package mineplex.core.boosters.event; + +import mineplex.core.boosters.Booster; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import java.util.List; +import java.util.Map; + +/** + * Called when {@link mineplex.core.boosters.redis.BoosterUpdateListener} receives updated Boosters over redis pubsub. + * + * @author Shaun Bennett + */ +public class BoosterUpdateEvent extends Event +{ + private Map> _boosterMap; + + public BoosterUpdateEvent(Map> boosterMap) + { + _boosterMap = boosterMap; + } + + public Map> getBoosterMap() + { + return _boosterMap; + } + + private static final HandlerList _handlers = new HandlerList(); + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java index 9aa9a054a..a17995b87 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java @@ -4,6 +4,7 @@ import mineplex.core.boosters.BoosterApiResponse; import mineplex.core.boosters.BoosterManager; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilTime; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; @@ -12,6 +13,7 @@ import org.bukkit.event.inventory.ClickType; /** * @author Shaun Bennett */ +@Deprecated public class ActivateBoosterButton implements IButton { private BoosterShop _boosterShop; @@ -27,21 +29,26 @@ public class ActivateBoosterButton implements IButton public void onClick(Player player, ClickType clickType) { player.closeInventory(); - _boosterManager.activateBooster("Testing", player, new Callback() - { - @Override - public void run(BoosterApiResponse response) + + _boosterManager.chargeBooster(player, data -> { + if (data) { - if (response.isSuccess()) - { - long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); - if (timeToStart <= 0) player.sendMessage(C.cGreen + "Booster activated and enabled now!"); - else player.sendMessage(C.cGreen + "Booster activated. Enabled in " + UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)); - } - else - { - player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); - } + _boosterManager.activateBooster(player, response -> { + if (response.isSuccess()) + { + long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); + if (timeToStart <= 0) player.sendMessage(F.main("Amplifier", "Amplifier Activated!")); + else player.sendMessage(F.main("Amplifier", "Game Amplifier Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); + } + else + { + player.sendMessage(C.cRed + "There was an error trying to enable your Amplifier :("); + } + }); + } + else + { + player.sendMessage(F.main("Amplifier", "There was an error charging your account. Try again later!")); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index bbfefa532..e3a9da071 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -1,25 +1,33 @@ package mineplex.core.boosters.gui; import mineplex.core.account.CoreClientManager; -import mineplex.core.boosters.BoosterCategory; +import mineplex.core.boosters.Booster; import mineplex.core.boosters.BoosterManager; +import mineplex.core.boosters.BoosterProcessor; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; +import mineplex.core.shop.confirmation.ConfirmationPage; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; +import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * @author Shaun Bennett */ public class BoosterPage extends ShopPageBase { - public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, BoosterCategory category) + public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Booster", player); + super(plugin, shop, clientManager, donationManager, "Game Amplifiers", player, 45); buildPage(); } @@ -29,15 +37,194 @@ public class BoosterPage extends ShopPageBase { ArrayList lore = new ArrayList<>(); + int amplifierCount = getPlugin().getAvailableBoosterCount(getPlayer()); lore.add(" "); - lore.add(C.cWhite + "You Own: " + getPlugin().getAvailableBoosterCount(getPlayer())); - if (getPlugin().canActivateBoosters()) + lore.add(C.cWhite + "You own " + C.cGreen + amplifierCount + C.cWhite + " Game Amplifiers"); + if (getPlugin().canActivateBoosters() && amplifierCount > 0) + { + List boosters = getPlugin().getBoosters(); + + long waitTime = getPlugin().getBoostTime(); + if (waitTime == 0) + { + lore.add(C.cWhite + "Amplifier would activate " + C.cGreen + "now"); + lore.add(" "); + lore.add(C.cGray + "Once this Amplifier is activated"); + lore.add(C.cGray + "or queued you are not able to"); + lore.add(C.cGray + "cancel or refund it. You will still"); + lore.add(C.cGray + "earn rewards if you are offline."); + lore.add(" "); + lore.add(C.cWhite + "Click to Activate Amplifier"); + } + else + { + lore.add(" "); + lore.add(C.cWhite + "Amplifier would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + if (boosters.size() - 1 == 1) + { + lore.add(C.cWhite + "There is " + C.cGreen + 1 + C.cWhite + " Amplifier queued"); + } + else if (boosters.size() - 1 > 0) + { + lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued"); + } + lore.add(" "); + lore.add(C.cGray + "Once this Amplifier is activated"); + lore.add(C.cGray + "or queued you are not able to"); + lore.add(C.cGray + "cancel or refund it. You will still"); + lore.add(C.cGray + "earn rewards if you are offline."); + lore.add(" "); + lore.add(C.cWhite + "Click to Queue Amplifier"); + } + } + else { lore.add(" "); - lore.add(C.cWhite + "Click to Activate"); + lore.add(C.cGray + "Game Amplifiers allow you to"); + lore.add(C.cGray + "increase the gems and shards"); + lore.add(C.cGray + "earned in that game for 1 hour."); + lore.add(C.cGray + "You will also earn bonus rewards"); + lore.add(C.cGray + "from players thanking you while"); + lore.add(C.cGray + "your amplifier is active."); + lore.add(" "); + lore.add(C.cWhite + "Get Amplifiers at " + C.cGreen + "mineplex.com/shop"); } - ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); - setItem(4, booster); + ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); + if (getPlugin().canActivateBoosters() && amplifierCount > 0) + { + addButton(13, booster, this::openConfirmation); + } + else + { + setItem(13, booster); + } + + addBoosterQueue(); +// addOtherBoosters(); + } + + private void openConfirmation(Player player, ClickType type) + { + ArrayList lore = new ArrayList<>(); + lore.add(" "); + lore.add(C.cGray + "Once this Amplifier is activated"); + lore.add(C.cGray + "or queued you are not able to"); + lore.add(C.cGray + "cancel or refund it. You will still"); + lore.add(C.cGray + "earn rewards if you are offline."); + ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); + + BoosterProcessor processor = new BoosterProcessor(getPlugin(), getPlayer()); + ConfirmationPage page = new ConfirmationPage<>(getPlugin(), getShop(), + getClientManager(), getDonationManager(), getPlayer(), this, processor, booster); + getShop().openPageForPlayer(getPlayer(), page); + } + + private void addBoosterQueue() + { + if (getPlugin().getBoosters() == null) + return; + + List boosters = getPlugin().getBoosters(); + int startIndex = Math.max(0, (9 - boosters.size()) / 2); + for (int i = 0; i < boosters.size() && i < 18; i++) + { + int slot = startIndex + 27 + i; + Booster booster = boosters.get(i); + boolean active = booster.isActive(); + int queueIndex = Math.max(1, i); + boolean owns = getPlayer().getUniqueId().equals(booster.getUuid()); + + long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT); + + List lore = new ArrayList<>(); + if (active) + { + lore.add(C.cWhite + "Active"); + lore.add(" "); + String expireTime = UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS); + lore.add(C.cWhite + "Added by " + C.cGreen + booster.getPlayerName()); + lore.add(C.cWhite + "Expires in " + C.cGreen + expireTime); + } + else + { + long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); + String activeString = UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS); + + lore.add(" "); + lore.add(C.cWhite + "Added by " + C.cGreen + booster.getPlayerName()); + lore.add(C.cWhite + "Starts in " + C.cGreen + activeString); +// lore.add(C.cWhite + "Position " + C.cGreen + queueIndex + C.cWhite + " in queue"); + } + + lore.add(" "); + lore.add(C.cGray + "Added " + activationTime + " ago"); + + ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, + "Game Amplifier", lore.toArray(new String[0]), queueIndex, !active, false); + setItem(slot, shopItem); + + // Add glow if the booster belongs to you + if (owns) + { + addGlow(slot); + } + } + } + + private void addOtherBoosters() + { + Map> boosterMap = getPlugin().getBoosterCache(); + List> tripleList = new ArrayList<>(); + for (Map.Entry> entry : boosterMap.entrySet()) + { + String boosterGroup = entry.getKey(); + // dont display boosters for the current booster group + if (boosterGroup.equals(getPlugin().getBoosterGroup())) + continue; + + List boosters = entry.getValue(); + for (int i = 0; i < boosters.size(); i++) + { + Booster booster = boosters.get(i); + if (booster.getUuid().equals(getPlayer().getUniqueId())) + { + tripleList.add(Triple.of(i, boosterGroup, booster)); + } + } + } + + + int startIndex = Math.max(0, (9 - tripleList.size()) / 2); + for (int i = 0; i < 9 && i < tripleList.size(); i++) + { + Triple triple = tripleList.get(i); + int deliveryAmount = Math.max(1, triple.getLeft()); + String boosterGroup = triple.getMiddle(); + Booster booster = triple.getRight(); + long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT); + + List lore = new ArrayList(); + lore.add(" "); + lore.add(C.cWhite + "Server: " + C.cGreen + boosterGroup); + if (booster.isActive()) + { + lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS)); + } + else + { + long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); + lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + } + + lore.add(" "); + lore.add(C.cGray + "Added " + activationTime + " ago"); + + ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK, + "Game Amplifier", lore.toArray(new String[0]), 1, false, false); + setItem(startIndex + i + 27, shopItem); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java index d8552b315..c23b1b491 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java @@ -5,7 +5,10 @@ import mineplex.core.boosters.BoosterManager; import mineplex.core.donation.DonationManager; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; /** * @author Shaun Bennett @@ -14,12 +17,21 @@ public class BoosterShop extends ShopBase { public BoosterShop(BoosterManager plugin, CoreClientManager clientManager, DonationManager donationManager) { - super(plugin, clientManager, donationManager, "Boosters"); + super(plugin, clientManager, donationManager, "Game Amplifiers"); } @Override protected ShopPageBase> buildPagesFor(Player player) { - return new MenuPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + return new BoosterPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + getPlayerPageMap().values().stream().filter(value -> value instanceof BoosterPage).forEach(ShopPageBase::refresh); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java deleted file mode 100644 index 6686168ef..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java +++ /dev/null @@ -1,37 +0,0 @@ -package mineplex.core.boosters.gui; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.boosters.Booster; -import mineplex.core.boosters.BoosterManager; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.UtilSkull; -import mineplex.core.common.util.UtilTime; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Shaun Bennett - */ -public class MenuPage extends ShopPageBase -{ - public MenuPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) - { - super(plugin, shop, clientManager, donationManager, "Boosters", player); - - buildPage(); - } - - @Override - protected void buildPage() - { - - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java new file mode 100644 index 000000000..0e85b5ee6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java @@ -0,0 +1,44 @@ +package mineplex.core.boosters.redis; + +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import mineplex.core.boosters.Booster; +import mineplex.core.boosters.event.BoosterUpdateEvent; +import mineplex.core.common.api.ApiFieldNamingStrategy; +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; +import redis.clients.jedis.JedisPubSub; + +import java.util.List; +import java.util.Map; + +/** + * @author Shaun Bennett + */ +public class BoosterUpdateListener extends JedisPubSub +{ + private Gson _gson = new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) + .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create(); + private JavaPlugin _plugin; + + public BoosterUpdateListener(JavaPlugin plugin) + { + _plugin = plugin; + } + + @Override + public void onMessage(String channel, String message) + { + try + { + Map> boosterMap = _gson.fromJson(message, new TypeToken>>() {}.getType()); + _plugin.getServer().getScheduler().runTask(_plugin, () -> Bukkit.getPluginManager().callEvent(new BoosterUpdateEvent(boosterMap))); + } + catch (Exception e) + { + System.out.println("Failed to load booster update"); + e.printStackTrace(); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java new file mode 100644 index 000000000..702f55a07 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java @@ -0,0 +1,39 @@ +package mineplex.core.boosters.redis; + +import mineplex.serverdata.Region; +import mineplex.serverdata.redis.RedisRepository; +import org.bukkit.plugin.java.JavaPlugin; +import redis.clients.jedis.Jedis; + +/** + * @author Shaun Bennett + */ +public class BoosterUpdateRepository extends RedisRepository +{ + private JavaPlugin _plugin; + + public BoosterUpdateRepository(JavaPlugin plugin) + { + super(Region.ALL); + + _plugin = plugin; + init(); + } + + private void init() + { + Thread thread = new Thread("Booster Subscriber") + { + @Override + public void run() + { + try (Jedis jedis = getResource(false)) + { + jedis.subscribe(new BoosterUpdateListener(_plugin), "minecraft.boosters"); + } + } + }; + + thread.start(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java index d12827300..1b5603ccd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -17,15 +17,15 @@ import java.sql.SQLException; */ public class BoosterTipManager extends MiniDbClientPlugin { - public static final int TIP_FOR_SPONSOR = 30; - public static final int TIP_FOR_TIPPER = 10; + public static final int TIP_FOR_SPONSOR = 5; + public static final int TIP_FOR_TIPPER = 5; private BoosterTipRepository _repository; private DonationManager _donationManager; public BoosterTipManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) { - super("Booster Tips", plugin, clientManager); + super("Amplifier Thanks", plugin, clientManager); _donationManager = donationManager; _repository = new BoosterTipRepository(plugin); @@ -33,7 +33,7 @@ public class BoosterTipManager extends MiniDbClientPlugin public void addTip(Player player, Booster booster, Callback callback) { - if (!Recharge.Instance.use(player, "Booster Tip", 1000 * 60 * 10, true, false)) + if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 60 * 10, true, false)) { callback.run(TipAddResult.ON_COOLDOWN); return; @@ -57,7 +57,7 @@ public class BoosterTipManager extends MiniDbClientPlugin runAsync(() -> { TipAddResult result; - if (_repository.addTip(accountId, booster.getAccountId(), booster.getBoosterId(), TIP_FOR_SPONSOR)) + if (_repository.addTip(accountId, booster.getAccountId(), booster.getId(), TIP_FOR_SPONSOR)) { _donationManager.rewardCoinsUntilSuccess(null, "Tips", player.getName(), accountId, TIP_FOR_TIPPER); result = TipAddResult.SUCCESS; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java index c48f81c0f..965a8e738 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java @@ -5,9 +5,9 @@ package mineplex.core.boosters.tips; */ public enum TipAddResult { - ALREADY_TIPPED_BOOSTER("You have already tipped!"), + ALREADY_TIPPED_BOOSTER("You have already thanked this Amplifier!"), INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"), - CANNOT_TIP_SELF("You can't tip yourself, silly!"), + CANNOT_TIP_SELF("You can't thank yourself, silly!"), ON_COOLDOWN(null), SUCCESS(null); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java index b0b956f10..802b81b5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java @@ -12,6 +12,7 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.stats.StatsManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.Region; import mineplex.serverdata.redis.counter.Counter; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -24,6 +25,8 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; + /** * @author Shaun Bennett */ @@ -47,8 +50,10 @@ public class FountainManager extends MiniPlugin _brawlShopProvider = shopProvider; World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5 + + int goal = !new File("eu.dat").exists() ? 300000000 : 5000000; _gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5), - C.cGreen + "Gem Fountain", "GemFountain_01", 10000000, this, clientManager, donationManager, _hologramManager, _statsManager); + C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/GemFountainSalesPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/GemFountainSalesPackage.java index 062e5a381..6018772f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/GemFountainSalesPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/GemFountainSalesPackage.java @@ -20,7 +20,7 @@ public class GemFountainSalesPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 3e7a478b5..0f0686a42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -178,7 +178,7 @@ public class CosmeticManager extends MiniPlugin public void disableItemsForGame() { - _gadgetManager.DisableAll(); + _gadgetManager.disableAll(); _mountManager.DisableAll(); _petManager.DisableAll(); } @@ -205,7 +205,7 @@ public class CosmeticManager extends MiniPlugin public void disableTeamArmor() { - for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.Costume)) + for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java index 64844f622..271dbe895 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java @@ -52,17 +52,4 @@ public class CosmeticShop extends ShopBase implements PluginMes { new GadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget()); } - - @EventHandler - public void updatePages(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (ShopPageBase> shop : getPlayerPageMap().values()) - { - if (shop instanceof BoosterPage) - ((BoosterPage) shop).updatePage(); - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java index d4d186eb8..c41b9915a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java @@ -29,7 +29,7 @@ public class MountButton implements IButton { public void run() { - _page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.GetName(), 1); + _page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1); _page.refresh(); } }, _page, _mount, CurrencyType.TREASURE_SHARD, player)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateGadgetButton.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateGadgetButton.java index f3f4cca6d..b953faafc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateGadgetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.activate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateMountButton.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateMountButton.java index ffa63ca11..d76f34950 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateMountButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.activate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -23,7 +23,7 @@ public class ActivateMountButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _mount.Enable(player); + _mount.enable(player); _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java index cc2012e0b..2f1dffd96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.activate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateGadgetButton.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateGadgetButton.java index f5cd11834..589494d30 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateGadgetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.deactivate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateMountButton.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateMountButton.java index 0a18d74f3..cb9854dc6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateMountButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.deactivate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -21,7 +21,7 @@ public class DeactivateMountButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _mount.Disable(player); + _mount.disable(player); _page.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java index f05e36139..2b3fb0c61 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.deactivate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenArrowTrails.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenArrowTrails.java index e9a17fd73..02fc1f8dd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenArrowTrails.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java new file mode 100644 index 000000000..ed816cf42 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java @@ -0,0 +1,22 @@ +package mineplex.core.cosmetic.ui.button.open; + +import mineplex.core.cosmetic.ui.page.BalloonsPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; +import org.bukkit.entity.Player; + +public class OpenBalloons extends OpenPageButton +{ + + public OpenBalloons(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new BalloonsPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Win Effects", player)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenCostumes.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenCostumes.java index 01f528d6e..4add95287 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenCostumes.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDeathAnimations.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDeathAnimations.java index 574d9f7b6..879f7d8d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDeathAnimations.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDoubleJump.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDoubleJump.java index 752a8da23..28802e69f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDoubleJump.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGadgets.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGadgets.java index 7926bf050..f85875f8c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGadgets.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGameModifiers.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGameModifiers.java similarity index 81% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGameModifiers.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGameModifiers.java index 9ad9683a4..e01bbed6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGameModifiers.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGameModifiers.java @@ -1,8 +1,8 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; -import mineplex.core.cosmetic.ui.page.GameModifierPage; +import mineplex.core.cosmetic.ui.page.gamemodifiers.GameModifierPage; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.gadget.types.Gadget; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenHats.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenHats.java index 126382e58..2e818a7af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenHats.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMorphs.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMorphs.java index 34d6ac932..933df4089 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMorphs.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.MorphPage; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMounts.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMounts.java index 75bcc3a78..016349c0e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMounts.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -29,7 +29,7 @@ public class OpenMounts implements IButton if (_active != null) { _menu.playAcceptSound(player); - _active.Disable(player); + _active.disable(player); _menu.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMusic.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMusic.java index 0486bf151..f0ef119fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPageButton.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPageButton.java index 7e0a4159a..318c61758 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPageButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -28,7 +28,7 @@ public abstract class OpenPageButton implements IButton if (_active != null) { _menu.playAcceptSound(player); - _active.Disable(player); + _active.disable(player); _menu.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenParticles.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenParticles.java index 2edea0122..7cc50a1ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenParticles.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java index 5b7e2b700..711679214 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenWinEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenWinEffect.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenWinEffect.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenWinEffect.java index 8a530b03e..0bed3e436 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenWinEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenWinEffect.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java index 621b36d20..52c877e7d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java @@ -28,11 +28,11 @@ public class ArrowTrailPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ARROW_TRAIL)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ArrowTrail) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ARROW_TRAIL) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java new file mode 100644 index 000000000..6eebd5515 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java @@ -0,0 +1,53 @@ +package mineplex.core.cosmetic.ui.page; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +public class BalloonsPage extends GadgetPage +{ + + public BalloonsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.BALLOON)) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.BALLOON) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + if(slot == 35) + slot = 37; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java deleted file mode 100644 index fe2538d59..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java +++ /dev/null @@ -1,45 +0,0 @@ -package mineplex.core.cosmetic.ui.page; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.cosmetic.CosmeticManager; -import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -import java.util.ArrayList; - -/** - * @author Shaun Bennett - */ -public class BoosterPage extends ShopPageBase -{ - public BoosterPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) - { - super(plugin, shop, clientManager, donationManager, "Game Boosters", player, 9); - - buildPage(); - } - - @Override - protected void buildPage() - { - ArrayList lore = new ArrayList<>(); - - lore.add(" "); - lore.add("You Own: " + _plugin.getBoosterManager().getAvailableBoosterCount(getPlayer())); - - ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); - setItem(4, booster); - } - - public void updatePage() - { - refresh(); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java index 0d6f83dd7..525594815 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java @@ -36,9 +36,9 @@ public class CostumePage extends GadgetPage { int slot; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME)) { - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -1) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1) continue; OutfitGadget outfitGadget = ((OutfitGadget) gadget); @@ -51,16 +51,16 @@ public class CostumePage extends GadgetPage slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down - if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest) + if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Chest) slot += 9; - else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Legs) + else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Legs) slot += 18; - else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Boots) + else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Boots) slot += 27; addGadget(gadget, slot); - if (gadget.IsActive(getPlayer())) + if (gadget.isActive(getPlayer())) addGlow(slot); } @@ -69,12 +69,12 @@ public class CostumePage extends GadgetPage public void onClick(Player player, ClickType clickType) { boolean gadgetDisabled = false; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME)) { - if (gadget.IsActive(player)) + if (gadget.isActive(player)) { gadgetDisabled = true; - gadget.Disable(player); + gadget.disable(player); } } @@ -99,7 +99,7 @@ public class CostumePage extends GadgetPage { if (gadget instanceof ItemGadget) { - if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) + if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0) { purchaseGadget(player, gadget); return; @@ -107,7 +107,7 @@ public class CostumePage extends GadgetPage } playAcceptSound(player); - gadget.Enable(player); + gadget.enable(player); buildPage(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java index 65d92f6e0..22a203051 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java @@ -28,11 +28,11 @@ public class DeathEffectPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DEATH)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Death) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DEATH) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java index 5b7c18b70..9e7ab7349 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java @@ -28,11 +28,11 @@ public class DoubleJumpPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DOUBLE_JUMP)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DoubleJump) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DOUBLE_JUMP) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index d63b2d545..154188ad8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -4,10 +4,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import mineplex.core.common.util.banner.CountryFlag; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; @@ -17,8 +19,8 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.ActivateGadgetButton; -import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton; +import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton; +import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton; import mineplex.core.cosmetic.ui.button.GadgetButton; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.morph.MorphBlock; @@ -44,14 +46,14 @@ public class GadgetPage extends ShopPageBase { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ITEM)) { - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -3) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3) continue; addGadget(gadget, slot); - if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0) + if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getDisplayName()) > 0) addGlow(slot); slot++; @@ -80,7 +82,7 @@ public class GadgetPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.addAll(Arrays.asList(gadget.GetDescription())); + itemLore.addAll(Arrays.asList(gadget.getDescription())); if (gadget.getSet() != null) { @@ -89,7 +91,7 @@ public class GadgetPage extends ShopPageBase //Elements for (Gadget cur : gadget.getSet().getGadgets()) - itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "▪ " + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName()); + itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "▪ " + (cur.isActive(getPlayer()) ? C.cGreen : C.cGray) + cur.getName()); itemLore.add(C.cBlack); @@ -101,59 +103,64 @@ public class GadgetPage extends ShopPageBase if (!gadget.ownsGadget(getPlayer())) { - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -1) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1) { //Nothing } //Chest Unlocks - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -3) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -4) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -5) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -6) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -6) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Gifts"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -7) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -7) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Purchased from shop.mineplex.com"); } + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Freedom Chests"); + } //Rank Unlocks - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -10) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -11) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -12) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -13) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -166,15 +173,15 @@ public class GadgetPage extends ShopPageBase ItemGadget itemGadget = (ItemGadget)gadget; itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); + itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getName())); // boolean canAffordAmmo = true; -// if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) > 0) +// if (itemGadget.getAmmo().getCost(CurrencyType.Coins) > 0) // { // itemLore.add(C.cBlack); -// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins"); +// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().getDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().getCost(CurrencyType.Coins) + " Coins"); // -// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().GetCost(CurrencyType.Coins)) +// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().getCost(CurrencyType.Coins)) // { // itemLore.add(C.cGreen + "Right-Click To Purchase"); // } @@ -190,11 +197,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Left-Click to Enable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } else { - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } return; @@ -205,11 +212,11 @@ public class GadgetPage extends ShopPageBase ItemStack item = ((HatGadget)gadget).getHelmetItem(); ItemMeta im = item.getItemMeta(); - im.setDisplayName(C.cGreen + C.Bold + gadget.GetName()); + im.setDisplayName(C.cGreen + C.Bold + gadget.getName()); if (gadget.ownsGadget(getPlayer())) { - if (gadget.GetActive().contains(getPlayer())) + if (gadget.getActive().contains(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); @@ -230,29 +237,35 @@ public class GadgetPage extends ShopPageBase } else { - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.GetCost(CurrencyType.TREASURE_SHARD)) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD)) + { + itemLore.add(C.cBlack); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); + } + + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } } @@ -262,46 +275,81 @@ public class GadgetPage extends ShopPageBase //Standard if (gadget.ownsGadget(getPlayer())) { - if (gadget.GetActive().contains(getPlayer())) + ItemStack gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData()); + ItemMeta meta = gadgetItemStack.getItemMeta(); + meta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); + if (gadget.getActive().contains(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); + meta.setLore(itemLore); + gadgetItemStack.setItemMeta(meta); + + if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH + || gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP) + { + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) + { + gadgetItemStack = CountryFlag.Usa.getBanner(); + BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); + bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); + bannerMeta.setLore(meta.getLore()); + gadgetItemStack.setItemMeta(bannerMeta); + } + } + + addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); } else { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + meta.setLore(itemLore); + gadgetItemStack.setItemMeta(meta); + + if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH + || gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP) + { + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) + { + gadgetItemStack = CountryFlag.Usa.getBanner(); + BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); + bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); + bannerMeta.setLore(meta.getLore()); + gadgetItemStack.setItemMeta(bannerMeta); + } + } + + addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } } else - { - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) + { + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.GetCost(CurrencyType.TREASURE_SHARD)) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } } } @@ -313,7 +361,7 @@ public class GadgetPage extends ShopPageBase { ItemGadget itemGadget = (ItemGadget)gadget; - if (itemGadget.getAmmo().GetCost(CurrencyType.TREASURE_SHARD) < 0) + if (itemGadget.getAmmo().getCost(CurrencyType.TREASURE_SHARD) < 0) return; } @@ -326,7 +374,7 @@ public class GadgetPage extends ShopPageBase { public void run() { - getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); + getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); refresh(); } }, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.TREASURE_SHARD, getPlayer())); @@ -336,7 +384,7 @@ public class GadgetPage extends ShopPageBase { // if (gadget instanceof ItemGadget) // { - // if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) + // if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0) // { // purchaseGadget(player, gadget); // return; @@ -344,9 +392,9 @@ public class GadgetPage extends ShopPageBase // } playAcceptSound(player); - gadget.Enable(player); + gadget.enable(player); - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + refresh(); } public void handleRightClick(Player player, Gadget gadget) @@ -360,7 +408,7 @@ public class GadgetPage extends ShopPageBase public void deactivateGadget(Player player, Gadget gadget) { playAcceptSound(player); - gadget.Disable(player); + gadget.disable(player); refresh(); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java index 54da91d25..c37e4dc9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java @@ -31,13 +31,13 @@ public class HatPage extends GadgetPage { int slot = 19; - List list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat); + List list = getPlugin().getGadgetManager().getGadgets(GadgetType.HAT); if(list != null) for (Gadget gadget : list) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Hat) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.HAT) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 9f2069629..a12a14307 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import mineplex.core.cosmetic.ui.button.open.*; import org.bukkit.Material; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; @@ -18,19 +19,6 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilText; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.OpenArrowTrails; -import mineplex.core.cosmetic.ui.button.OpenCostumes; -import mineplex.core.cosmetic.ui.button.OpenDeathAnimations; -import mineplex.core.cosmetic.ui.button.OpenDoubleJump; -import mineplex.core.cosmetic.ui.button.OpenGadgets; -import mineplex.core.cosmetic.ui.button.OpenGameModifiers; -import mineplex.core.cosmetic.ui.button.OpenHats; -import mineplex.core.cosmetic.ui.button.OpenMorphs; -import mineplex.core.cosmetic.ui.button.OpenMounts; -import mineplex.core.cosmetic.ui.button.OpenMusic; -import mineplex.core.cosmetic.ui.button.OpenParticles; -import mineplex.core.cosmetic.ui.button.OpenPets; -import mineplex.core.cosmetic.ui.button.OpenWinEffect; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -79,7 +67,6 @@ public class Menu extends ShopPageBase int tauntSlot = 49;//slots[11]; int winEffectSlot = 51; int gameModifierSlot = 53; - int boosterSlot = 52;// TODO EnumMap ownedCount = new EnumMap(GadgetType.class); EnumMap maxCount = new EnumMap(GadgetType.class); @@ -113,7 +100,7 @@ public class Menu extends ShopPageBase Mount mountActive = getPlugin().getMountManager().getActive(getPlayer()); for (Mount mount : getPlugin().getMountManager().getMounts()) { - if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.GetName()) || mount.HasMount(getPlayer())) + if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName()) || mount.hasMount(getPlayer())) { mountOwned++; } @@ -135,37 +122,37 @@ public class Menu extends ShopPageBase } Creature petActive = getPlugin().getPetManager().GetPet(getPlayer()); - GadgetType type = GadgetType.Particle; + GadgetType type = GadgetType.PARTICLE; String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type)); addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(particleSlot); - type = GadgetType.ArrowTrail; + type = GadgetType.ARROW_TRAIL; lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type)); addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(arrowSlot); - type = GadgetType.DoubleJump; + type = GadgetType.DOUBLE_JUMP; lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type)); addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(jumpSlot); - type = GadgetType.Death; + type = GadgetType.DEATH; lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type)); addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(deathSlot); - type = GadgetType.Item; + type = GadgetType.ITEM; lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gadgetSlot); - type = GadgetType.Morph; + type = GadgetType.MORPH; lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(morphSlot); - lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.GetName()); + lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.getName()); addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive)); if (mountActive != null) addGlow(mountSlot); @@ -173,18 +160,18 @@ public class Menu extends ShopPageBase addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this)); if (petActive != null) addGlow(petSlot); - type = GadgetType.Hat; + type = GadgetType.HAT; lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type)); addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(hatSlot); - type = GadgetType.Costume; + type = GadgetType.COSTUME; // Fixes more than 8 costumes being counted, even without the WindUp lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type)); addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(costumeSlot); - type = GadgetType.MusicDisc; + type = GadgetType.MUSIC_DISC; lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type)); addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(musicSlot); @@ -198,25 +185,21 @@ public class Menu extends ShopPageBase } }); - type = GadgetType.WinEffect; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awsome effects is even more fun!", "Usable in Lobbies", enabled.get(type)); + type = GadgetType.WIN_EFFECT; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", "Usable in Lobbies", enabled.get(type)); addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(winEffectSlot); - type = GadgetType.GameModifier; + type = GadgetType.GAME_MODIFIER; lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type)); addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gameModifierSlot); - -// addButton(boosterSlot, new ShopItem(Material.EMERALD, "Game Boosters", -// new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), -// (player, clickType) -> openBoosters(player)); } private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) { - return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.GetName()); + return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.getName()); } private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled) @@ -259,9 +242,4 @@ public class Menu extends ShopPageBase { getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player)); } - - public void openBoosters(Player player) - { - getShop().openPageForPlayer(player, new BoosterPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java index fb425172d..0d7daaafb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java @@ -26,11 +26,11 @@ public class MorphPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Morph)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MORPH)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index aea19841c..bc84607ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -13,8 +13,8 @@ import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.ActivateMountButton; -import mineplex.core.cosmetic.ui.button.DeactivateMountButton; +import mineplex.core.cosmetic.ui.button.activate.ActivateMountButton; +import mineplex.core.cosmetic.ui.button.deactivate.DeactivateMountButton; import mineplex.core.cosmetic.ui.button.MountButton; import mineplex.core.donation.DonationManager; import mineplex.core.mount.Mount; @@ -58,105 +58,110 @@ public class MountPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.addAll(Arrays.asList(mount.GetDescription())); + itemLore.addAll(Arrays.asList(mount.getDescription())); - if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) + if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { - if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -1) + if (mount.getCost(CurrencyType.TREASURE_SHARD) == -1) { //Nothing } //Chest Unlocks - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -2 || mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -2 || mount.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -3) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -4) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -5) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -6) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -6) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure"); } + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -7) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Freedom Chests"); + } //Rank Unlocks - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -10) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -11) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -12) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -13) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); } } - if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) + if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { - if (mount.GetActive().containsKey(getPlayer())) + if (mount.getActive().containsKey(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); + addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); } else { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); + addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); } } else { - if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) + if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.GetCost(CurrencyType.TREASURE_SHARD)) + if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); } - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java index 390d937ae..7acb6a46c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java @@ -28,7 +28,7 @@ public class MusicPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MusicDisc)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MUSIC_DISC)) { addGadget(gadget, slot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java index 1a59f158e..479841a09 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java @@ -26,11 +26,11 @@ public class ParticlePage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Particle)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.PARTICLE)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.PARTICLE) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 9a58bdca9..3b278c855 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -24,8 +24,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.PetSorter; -import mineplex.core.cosmetic.ui.button.ActivatePetButton; -import mineplex.core.cosmetic.ui.button.DeactivatePetButton; +import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; +import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.donation.DonationManager; @@ -58,54 +58,54 @@ public class PetPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!"); + itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); //Chest Unlocks if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) { - if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -1) + if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1) { //Nothing } - - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -2 || pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) + + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -2 || pet.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -3) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -4) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -5) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } //Rank Unlocks - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -10) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -11) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -12) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -13) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -118,7 +118,7 @@ public class PetPage extends ShopPageBase String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType()); if (petName == null) { - petName = pet.GetName(); + petName = pet.getName(); } if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType()) @@ -145,20 +145,20 @@ public class PetPage extends ShopPageBase //Not Owned else { - if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) + if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.GetCost(CurrencyType.TREASURE_SHARD)) + if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this)); } - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) + else if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); @@ -185,11 +185,16 @@ public class PetPage extends ShopPageBase if (!getPlugin().getPetManager().hasActivePet(getPlayer().getName())) { itemLore.add(C.cWhite + "You must have an active pet to use this!"); - getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); + getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); } - else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER) + // Silverfish = Wither disguised + // Villager = Elf + // Zombie = Pumpkin + else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.SILVERFISH + || getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.VILLAGER + || getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.ZOMBIE) { - addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); + addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); } slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 431ce81e5..4bc7ac740 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -92,7 +92,7 @@ public class PetTagPage extends ShopPageBase return; } - PetExtra tag = new PetExtra("Rename " + _pet.GetName() + " to " + _tagName, Material.NAME_TAG, 100); + PetExtra tag = new PetExtra("Rename " + _pet.getName() + " to " + _tagName, Material.NAME_TAG, 100); _pet.setDisplayName(C.cGreen + "Purchase " + _tagName); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java index 93aeac8d5..1ff5531fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java @@ -31,13 +31,13 @@ public class TauntPage extends GadgetPage { int slot = 19; - List list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt); + List list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT); if(list != null) for (Gadget gadget : list) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java index 505bc4dde..74b50f0ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java @@ -28,11 +28,11 @@ public class WinEffectPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WinEffect)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WIN_EFFECT)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WinEffect) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierPage.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierPage.java index 34ca04610..beeeba200 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierPage.java @@ -1,8 +1,9 @@ -package mineplex.core.cosmetic.ui.page; +package mineplex.core.cosmetic.ui.page.gamemodifiers; import java.util.List; -import org.bukkit.Bukkit; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -15,7 +16,7 @@ import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; @@ -37,7 +38,7 @@ public class GameModifierPage extends GadgetPage { int own = 0; int total = 0; - for(GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(type)) { + for(GameModifierGadget g : getPlugin().getGadgetManager().getGameModifiers(type)) { if(g.ownsGadget(getPlayer())) own++; total++; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierSubPage.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierSubPage.java index 887d71e18..8049beb5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierSubPage.java @@ -1,5 +1,6 @@ -package mineplex.core.cosmetic.ui.page; +package mineplex.core.cosmetic.ui.page.gamemodifiers; +import mineplex.core.cosmetic.ui.page.GadgetPage; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -11,7 +12,7 @@ import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import org.bukkit.inventory.ItemStack; @@ -47,7 +48,7 @@ public class GameModifierSubPage extends GadgetPage { int own = 0; int total = 0; - for (GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType)) + for (GameModifierGadget g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType)) { if (g.ownsGadget(getPlayer())) own++; total++; @@ -83,12 +84,12 @@ public class GameModifierSubPage extends GadgetPage } else { - for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_type)) + for (GameModifierGadget gadget : getPlugin().getGadgetManager().getGameModifiers(_type)) { addGadget(gadget, slot); - if (gadget.IsActive(getPlayer())) + if (gadget.isActive(getPlayer())) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/KitGameModifierPage.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/KitGameModifierPage.java index a98c145dc..77590aa93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/KitGameModifierPage.java @@ -1,14 +1,15 @@ -package mineplex.core.cosmetic.ui.page; +package mineplex.core.cosmetic.ui.page.gamemodifiers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import org.bukkit.Material; @@ -37,7 +38,7 @@ public class KitGameModifierPage extends GadgetPage int slot = 19; - for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType)) + for (GameModifierGadget gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType)) { if (gadget instanceof KitGameModifier) { @@ -46,18 +47,14 @@ public class KitGameModifierPage extends GadgetPage { addGadget(gadget, slot); - if (gadget.IsActive(getPlayer())) + if (gadget.isActive(getPlayer())) addGlow(slot); slot++; if(slot%9 == 8) slot += 2; } - else - continue; } - else - continue; } addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index da4eeba8c..be83461c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -344,9 +344,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (disguise.GetEntity() instanceof EntityPlayer && disguise instanceof DisguisePlayer) { - if (!((EntityPlayer) disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName())) + if (!(disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName())) { - _blockedNames.add(((Player) disguise.GetEntity()).getName()); + _blockedNames.add((disguise.GetEntity()).getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java new file mode 100644 index 000000000..f47327a24 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java @@ -0,0 +1,13 @@ +package mineplex.core.disguise.disguises; + +import org.bukkit.entity.EntityType; + +public class DisguiseAnimalBase extends DisguiseAnimal +{ + + public DisguiseAnimalBase(EntityType entityType, org.bukkit.entity.Entity entity) + { + super(entityType, entity); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 477be5d8b..3e114c350 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -21,9 +21,11 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import net.minecraft.server.v1_8_R3.WorldSettings; +import org.bukkit.entity.Entity; public class DisguisePlayer extends DisguiseHuman { + private Entity _entity; private GameProfile _profile; private boolean _sneaking; private BlockFace _sleeping; @@ -32,6 +34,7 @@ public class DisguisePlayer extends DisguiseHuman public DisguisePlayer(org.bukkit.entity.Entity entity) { super(entity); + _entity = entity; } public DisguisePlayer(org.bukkit.entity.Entity entity, GameProfile profile) @@ -170,4 +173,9 @@ public class DisguisePlayer extends DisguiseHuman sendPacket(packet); } + + public org.bukkit.entity.Entity getEntity() + { + return _entity; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index f7dc9d8b7..f8c68e0ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,16 +1,27 @@ package mineplex.core.gadget; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.function.Predicate; import mineplex.core.gadget.commands.LockCosmeticsCommand; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.hat.*; +import mineplex.core.gadget.gadgets.morph.*; +import mineplex.core.gadget.gadgets.outfit.windupsuit.*; +import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.gadgets.wineffect.*; +import mineplex.core.gadget.persistence.UserGadgetPersistence; +import mineplex.core.gadget.set.*; +import mineplex.core.gadget.types.*; +import mineplex.core.incognito.events.IncognitoHidePlayerEvent; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; +import org.bukkit.*; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.PlayerDeathEvent; @@ -24,7 +35,6 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.Rank; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; @@ -35,55 +45,44 @@ import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.gadget.event.GadgetEnableEvent; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan; -import mineplex.core.gadget.gadgets.death.DeathBlood; -import mineplex.core.gadget.gadgets.death.DeathCandyCane; -import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart; -import mineplex.core.gadget.gadgets.death.DeathEmerald; -import mineplex.core.gadget.gadgets.death.DeathEnchant; -import mineplex.core.gadget.gadgets.death.DeathFrostLord; -import mineplex.core.gadget.gadgets.death.DeathMusic; -import mineplex.core.gadget.gadgets.death.DeathPinataBurst; -import mineplex.core.gadget.gadgets.death.DeathShadow; -import mineplex.core.gadget.gadgets.death.DeathStorm; -import mineplex.core.gadget.gadgets.death.DeathTitan; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; +import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; +import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.death.music.DeathMusic; +import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; +import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; +import mineplex.core.gadget.gadgets.death.titan.DeathTitan; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; +import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; -import mineplex.core.gadget.gadgets.hat.HatCoal; -import mineplex.core.gadget.gadgets.hat.HatCompanionBlock; -import mineplex.core.gadget.gadgets.hat.HatGrinch; -import mineplex.core.gadget.gadgets.hat.HatLovestruck; -import mineplex.core.gadget.gadgets.hat.HatPresent; -import mineplex.core.gadget.gadgets.hat.HatRudolph; -import mineplex.core.gadget.gadgets.hat.HatSanta; -import mineplex.core.gadget.gadgets.hat.HatSecretPackage; -import mineplex.core.gadget.gadgets.hat.HatSnowman; -import mineplex.core.gadget.gadgets.hat.HatTeddyBear; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -101,21 +100,6 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; -import mineplex.core.gadget.gadgets.morph.MorphBat; -import mineplex.core.gadget.gadgets.morph.MorphBlaze; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.gadgets.morph.MorphBunny; -import mineplex.core.gadget.gadgets.morph.MorphChicken; -import mineplex.core.gadget.gadgets.morph.MorphCow; -import mineplex.core.gadget.gadgets.morph.MorphCreeper; -import mineplex.core.gadget.gadgets.morph.MorphEnderman; -import mineplex.core.gadget.gadgets.morph.MorphPig; -import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; -import mineplex.core.gadget.gadgets.morph.MorphSlime; -import mineplex.core.gadget.gadgets.morph.MorphSnowman; -import mineplex.core.gadget.gadgets.morph.MorphTitan; -import mineplex.core.gadget.gadgets.morph.MorphVillager; -import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; @@ -125,62 +109,19 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; -import mineplex.core.gadget.gadgets.particle.ParticleBlood; -import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; -import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; -import mineplex.core.gadget.gadgets.particle.ParticleEmerald; -import mineplex.core.gadget.gadgets.particle.ParticleEnchant; -import mineplex.core.gadget.gadgets.particle.ParticleFairy; -import mineplex.core.gadget.gadgets.particle.ParticleFireRings; -import mineplex.core.gadget.gadgets.particle.ParticleFoot; -import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; -import mineplex.core.gadget.gadgets.particle.ParticleLegend; -import mineplex.core.gadget.gadgets.particle.ParticleMusic; -import mineplex.core.gadget.gadgets.particle.ParticlePartyTime; -import mineplex.core.gadget.gadgets.particle.ParticleRain; -import mineplex.core.gadget.gadgets.particle.ParticleTitan; -import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; -import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; -import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; -import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; -import mineplex.core.gadget.gadgets.particle.ParticleYinYang; -import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; -import mineplex.core.gadget.gadgets.wineffect.WinEffectFireworks; -import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; -import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; -import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; -import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; -import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium; -import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; -import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; -import mineplex.core.gadget.set.SetCandyCane; -import mineplex.core.gadget.set.SetCupidsLove; -import mineplex.core.gadget.set.SetEmerald; -import mineplex.core.gadget.set.SetFrostLord; -import mineplex.core.gadget.set.SetHowlingWinds; -import mineplex.core.gadget.set.SetMusic; -import mineplex.core.gadget.set.SetParty; -import mineplex.core.gadget.set.SetShadow; -import mineplex.core.gadget.set.SetTitan; -import mineplex.core.gadget.set.SetVampire; -import mineplex.core.gadget.set.SetWisdom; +import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; +import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; +import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; +import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; +import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; +import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; -import mineplex.core.gadget.types.ArrowEffectGadget; -import mineplex.core.gadget.types.DeathEffectGadget; -import mineplex.core.gadget.types.DoubleJumpEffectGadget; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetGameModifier; -import mineplex.core.gadget.types.GadgetSet; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.gadget.types.MusicGadget; -import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.gadget.types.WinEffectGadget; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.MountManager; @@ -204,7 +145,7 @@ public class GadgetManager extends MiniPlugin private final MountManager _mountManager; private final PacketHandler _packetManager; private final HologramManager _hologramManager; - private final OutfitWindUpSuitBoosterManager _boosterManager; + private final OutfitWindUpSuitBoosterManager _boosterManager; private NautHashMap> _gadgets; @@ -212,6 +153,8 @@ public class GadgetManager extends MiniPlugin private final NautHashMap> _playerActiveGadgetMap = new NautHashMap<>(); private final HashSet _sets = new HashSet<>(); + + private UserGadgetPersistence _userGadgetPersistence; private boolean _hideParticles = false; private int _activeItemSlot = 3; @@ -236,9 +179,10 @@ public class GadgetManager extends MiniPlugin _packetManager = packetHandler; _mountManager = mountManager; _hologramManager = hologramManager; + _userGadgetPersistence = new UserGadgetPersistence(this); _boosterManager = new OutfitWindUpSuitBoosterManager(this); - CreateGadgets(); + createGadgets(); createSets(); } @@ -256,14 +200,10 @@ public class GadgetManager extends MiniPlugin addSet(new SetFrostLord(this)); addSet(new SetCandyCane(this)); addSet(new SetTitan(this)); - - // Removes Lovely Set (Duplicate of Cupid's Love) - //addSet(new SetLove(this)); //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); - //Removes WindUp suit for now, as it's not going to be released //addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); @@ -273,11 +213,12 @@ public class GadgetManager extends MiniPlugin addSet(new SetHowlingWinds(this)); addSet(new SetVampire(this)); addSet(new SetMusic(this)); + addSet(new SetFreedom(this)); } - private void CreateGadgets() + private void createGadgets() { - _gadgets = new NautHashMap>(); + _gadgets = new NautHashMap<>(); // Items addGadget(new ItemEtherealPearl(this)); @@ -309,10 +250,10 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitSpaceSuitLeggings(this)); addGadget(new OutfitSpaceSuitBoots(this)); - //addGadget(new OutfitWindUpSuitHelmet(this)); - //addGadget(new OutfitWindUpSuitChestplate(this)); - //addGadget(new OutfitWindUpSuitLeggings(this)); - //addGadget(new OutfitWindUpSuitBoots(this)); + /*addGadget(new OutfitWindUpSuitHelmet(this)); + addGadget(new OutfitWindUpSuitChestplate(this)); + addGadget(new OutfitWindUpSuitLeggings(this)); + addGadget(new OutfitWindUpSuitBoots(this));*/ addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -335,6 +276,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSlime(this, _achievementManager)); addGadget(new MorphTitan(this)); addGadget(new MorphSnowman(this)); + addGadget(new MorphUncleSam(this)); // Particles addGadget(new ParticleFoot(this)); @@ -357,6 +299,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleWingsInfernal(this)); addGadget(new ParticleWingsPixie(this)); addGadget(new ParticleYinYang(this)); + addGadget(new ParticleFreedom(this)); // Arrow Trails @@ -371,8 +314,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailStorm(this)); addGadget(new ArrowTrailBlood(this)); addGadget(new ArrowTrailMusic(this)); - // Removes Lovely Set (Duplicate of Cupid's Love) - //addGadget(new ArrowTrailHearts(this)); + addGadget(new ArrowTrailFreedom(this)); // Death Effect addGadget(new DeathFrostLord(this)); @@ -386,8 +328,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathStorm(this)); addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); - // Removes Lovely Set (Duplicate of Cupid's Love) - //addGadget(new DeathHearts(this)); + addGadget(new DeathFreedom(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -401,20 +342,13 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpStorm(this)); addGadget(new DoubleJumpBlood(this)); addGadget(new DoubleJumpMusic(this)); - // Removes Lovely Set (Duplicate of Cupid's Love) - //addGadget(new DoubleJumpHearts(this)); + addGadget(new DoubleJumpFreedom(this)); // Hat - addGadget(new HatSanta(this)); - addGadget(new HatSnowman(this)); - addGadget(new HatPresent(this)); - addGadget(new HatCoal(this)); - addGadget(new HatRudolph(this)); - addGadget(new HatGrinch(this)); - addGadget(new HatCompanionBlock(this)); - addGadget(new HatLovestruck(this)); - addGadget(new HatSecretPackage(this)); - addGadget(new HatTeddyBear(this)); + for (HatType hatType : HatType.values()) + { + addGadget(new HatItem(this, hatType)); + } //Win Effects addGadget(new WinEffectPodium(this)); @@ -457,12 +391,12 @@ public class GadgetManager extends MiniPlugin addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Knife_M9_Bayonette_Fade, -2)); - //Blue only + //Blue only addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P2000_Fire_Elemental, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.FAMAS_Pulse, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.M4A4_Howl, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Steyr_AUG_Torque, -2)); - //Red only + //Red only addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Glock_18_Fade, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Galil_AR_Eco, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.AK_47_Vulcan, -2)); @@ -470,30 +404,18 @@ public class GadgetManager extends MiniPlugin // Survival Games - // Also not being released in this update - // Beastmaster - //addGadget(new ChickenKitGameModifier(this)); - //addGadget(new MiniGuardianKitGameModifier(this)); - //addGadget(new PigKitGameModifier(this)); - //addGadget(new SquidKitGameModifier(this)); - - // Horseman - //addGadget(new MuleKitGameModifier(this)); - //addGadget(new SkeletonHorseKitGameModifier(this)); - - // Necromancer - //addGadget(new WitherSkeletonKitGameModifier(this)); - - - // Bridges - //addGadget(new PotatoKitGameModifier(this)); - - for(GadgetType type : GadgetType.values()) + /* for (KitModifier kitModifier : KitModifier.values()) { - if(!_gadgets.containsKey(type)) - { - _gadgets.put(type, new ArrayList()); - } + addGadget(new KitGameModifier(this, kitModifier)); + }*/ + + // Balloons + //addGadget(new BabyCowBalloon(this)); + + for (GadgetType gadgetType : GadgetType.values()) + { + if (!_gadgets.containsKey(gadgetType)) + _gadgets.put(gadgetType, new ArrayList<>()); } } @@ -536,7 +458,7 @@ public class GadgetManager extends MiniPlugin private void addGadget(Gadget gadget) { if (!_gadgets.containsKey(gadget.getGadgetType())) - _gadgets.put(gadget.getGadgetType(), new ArrayList()); + _gadgets.put(gadget.getGadgetType(), new ArrayList<>()); _gadgets.get(gadget.getGadgetType()).add(gadget); } @@ -544,37 +466,48 @@ public class GadgetManager extends MiniPlugin @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { + // Fixes win room speed bug event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); - // UnlockCosmetics command fixes this part -// if (_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) -// { -// for (GadgetType gadgetType : _gadgets.keySet()) -// { -// if (gadgetType == GadgetType.Particle && _clientManager.Get(event.getPlayer()).GetRank().has(Rank.ADMIN)) -// { -// for (Gadget gadget : _gadgets.get(gadgetType)) -// { -// _donationManager.Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); -// } -// } -// } -// } + // Loads saved gadgets + _userGadgetPersistence.load(event.getPlayer()); } public List getGadgets(GadgetType gadgetType) { return _gadgets.get(gadgetType); } - - public List getGameModifiers(GameModifierType gameType) + + public List getAllGadgets() { - List list = new ArrayList<>(); - for (Gadget g : getGadgets(GadgetType.GameModifier)) + List gadgets = new ArrayList<>(); + for (GadgetType gadgetType : GadgetType.values()) { - if (g instanceof GadgetGameModifier) + gadgets.addAll(getGadgets(gadgetType)); + } + return gadgets; + } + + public Gadget getGadget(String name, GadgetType gadgetType) + { + List gadgets = getGadgets(gadgetType); + for (Gadget gadget : gadgets) + { + if (gadget.getName().equalsIgnoreCase(name) + || Arrays.asList(gadget.getAlternativePackageNames()).contains(name)) + return gadget; + } + return null; + } + + public List getGameModifiers(GameModifierType gameType) + { + List list = new ArrayList<>(); + for (Gadget g : getGadgets(GadgetType.GAME_MODIFIER)) + { + if (g instanceof GameModifierGadget) { - GadgetGameModifier mod = (GadgetGameModifier) g; + GameModifierGadget mod = (GameModifierGadget) g; if (mod.getGameType() == gameType) list.add(mod); } } @@ -583,18 +516,18 @@ public class GadgetManager extends MiniPlugin public GameModifierMineStrikeSkin getGameModifier(MineStrikeSkin skin) { - for(GadgetGameModifier g : getGameModifiers(GameModifierType.MineStrike)) + for(GameModifierGadget g : getGameModifiers(GameModifierType.MineStrike)) { GameModifierMineStrikeSkin gskin = (GameModifierMineStrikeSkin) g; - if(g.GetName().equals(skin.getSkinName())) return gskin; + if(g.getName().equals(skin.getSkinName())) return gskin; } return null; } - public List getGameModifiers(KitModifierType kitType) + public List getGameModifiers(KitModifierType kitType) { - List list = new ArrayList<>(); - for (GadgetGameModifier gadget : getGameModifiers(kitType.getGameModifierType())) + List list = new ArrayList<>(); + for (GameModifierGadget gadget : getGameModifiers(kitType.getGameModifierType())) { if (gadget instanceof KitGameModifier) { @@ -607,11 +540,11 @@ public class GadgetManager extends MiniPlugin return list; } - public GadgetGameModifier getActiveGameModifier(Player player, GameModifierType gameType, Predicate selector) + public GameModifierGadget getActiveGameModifier(Player player, GameModifierType gameType, Predicate selector) { - for (GadgetGameModifier g : getGameModifiers(gameType)) + for (GameModifierGadget g : getGameModifiers(gameType)) { - if (!g.IsActive(player)) { continue; } + if (!g.isActive(player)) { continue; } if (!selector.test(g)) { continue; } return g; } @@ -619,20 +552,34 @@ public class GadgetManager extends MiniPlugin } // Gets all the Game modifiers that are related to kits - public KitGameModifier getActiveGameModifier(Player player, KitModifierType kitType, Predicate selector) + public KitGameModifier getActiveGameModifier(Player player, KitModifierType kitType, Predicate selector) { - for (GadgetGameModifier g : getGameModifiers(kitType)) + for (GameModifierGadget g : getGameModifiers(kitType)) { - if (!g.IsActive(player)) { continue; } + if (!g.isActive(player)) { continue; } if (!selector.test(g)) { continue; } if (!(g instanceof KitGameModifier)) { continue; } return (KitGameModifier) g; } return null; } + + public HatGadget getHatGadget(HatType type) + { + for (Gadget gadget : getGadgets(GadgetType.HAT)) + { + if(gadget instanceof HatGadget) + { + HatGadget hatGadget = (HatGadget) gadget; + if (type.equals(hatGadget.getHatType())) + return hatGadget; + } + } + return null; + } // Disallows two armor gadgets in same slot. - public void RemoveOutfit(Player player, ArmorSlot slot) + public void removeOutfit(Player player, ArmorSlot slot) { for (GadgetType gadgetType : _gadgets.keySet()) { @@ -642,9 +589,9 @@ public class GadgetManager extends MiniPlugin { OutfitGadget armor = (OutfitGadget) gadget; - if (armor.GetSlot() == slot) + if (armor.getSlot() == slot) { - armor.RemoveArmor(player); + armor.removeArmor(player); } } } @@ -657,11 +604,22 @@ public class GadgetManager extends MiniPlugin if(gadgets == null) return; for(Gadget g : gadgets) { - g.Disable(player); + g.disable(player); + } + } + + public void removeGadgetType(Player player, GadgetType type, Gadget enabled) + { + List gadgets = _gadgets.get(type); + if(gadgets == null) return; + for(Gadget g : gadgets) + { + if (g != enabled) + g.disable(player); } } - public void DisableAll() + public void disableAll() { for (GadgetType gadgetType : _gadgets.keySet()) { @@ -682,36 +640,47 @@ public class GadgetManager extends MiniPlugin if (gadget instanceof WinEffectGadget) continue; - if(gadget instanceof GadgetGameModifier) + if(gadget instanceof GameModifierGadget) continue; for (Player player : UtilServer.getPlayers()) - gadget.Disable(player); + gadget.disable(player); } } } - public void DisableAll(Player player) + public void disableAll(Player player) { for (GadgetType gadgetType : _gadgets.keySet()) { for (Gadget gadget : _gadgets.get(gadgetType)) { - gadget.Disable(player); + gadget.disable(player); } } } - - public void DisableAll(Player player, List dontDisable) + + public void disableAll(Player player, boolean callEvent) { for (GadgetType gadgetType : _gadgets.keySet()) { for (Gadget gadget : _gadgets.get(gadgetType)) { - if (dontDisable.contains(gadget.GetName())) + gadget.disable(player); + } + } + } + + public void disableAll(Player player, List dontDisable) + { + for (GadgetType gadgetType : _gadgets.keySet()) + { + for (Gadget gadget : _gadgets.get(gadgetType)) + { + if (dontDisable.contains(gadget.getName())) continue; - gadget.Disable(player); + gadget.disable(player); } } } @@ -805,21 +774,15 @@ public class GadgetManager extends MiniPlugin } @EventHandler - public void quit(PlayerQuitEvent event) + public void onPlayerQuit(PlayerQuitEvent event) { - DisableAll(event.getPlayer()); + saveGadgets(event.getPlayer()); + disableAll(event.getPlayer(), false); _lastMove.remove(event.getPlayer()); _playerActiveGadgetMap.remove(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); } - - @EventHandler - public void join(PlayerJoinEvent event) - { - event.getPlayer().setWalkSpeed(0.2f); - event.getPlayer().setFlySpeed(0.1f); - } @EventHandler public void death(PlayerDeathEvent event) @@ -873,11 +836,11 @@ public class GadgetManager extends MiniPlugin public void redisplayActiveItem(Player player) { - for (Gadget gadget : _gadgets.get(GadgetType.Item)) + for (Gadget gadget : _gadgets.get(GadgetType.ITEM)) { if (gadget instanceof ItemGadget) { - if (gadget.IsActive(player)) + if (gadget.isActive(player)) { ((ItemGadget)gadget).ApplyItem(player, false); } @@ -887,7 +850,7 @@ public class GadgetManager extends MiniPlugin public boolean canPlaySongAt(Location location) { - for (Gadget gadget : _gadgets.get(GadgetType.MusicDisc)) + for (Gadget gadget : _gadgets.get(GadgetType.MUSIC_DISC)) { if (gadget instanceof MusicGadget) { @@ -916,20 +879,13 @@ public class GadgetManager extends MiniPlugin if (_gadgetsEnabled != enabled) { _gadgetsEnabled = enabled; - DisableAll(); + disableAll(); _mountManager.DisableAll(); } } @EventHandler - public void GadgetActivate(GadgetEnableEvent event) - { - if (!_gadgetsEnabled) - event.setCancelled(true); - } - - @EventHandler - public void MountActivate(MountActivateEvent event) + public void onMountActivate(MountActivateEvent event) { if (!_gadgetsEnabled) event.setCancelled(true); @@ -950,4 +906,141 @@ public class GadgetManager extends MiniPlugin if (event.getPlayer().getName().equalsIgnoreCase("sterling_")) event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.PIG_IDLE, 1f, 1f); } + + @EventHandler + public void onGadgetEnable(GadgetEnableEvent event) + { + if (!_gadgetsEnabled) + event.setCancelled(true); + } + + private void saveGadgets(Player player) + { + if (player.getGameMode() == GameMode.SPECTATOR) + return; + Map cache = new HashMap<>(); + for (Gadget gadget : getAllGadgets()) + { + GadgetType gadgetType = gadget.getGadgetType(); + if (gadget.ownsGadget(player)) + { + switch (gadgetType) + { + case MUSIC_DISC: + case ITEM: + case MORPH: + case BALLOON: + break; + case COSTUME: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (cache.containsKey(key)) + continue; + if (outfitGadget.isActive(player)) + cache.put(key, outfitGadget.getName()); + break; + case GAME_MODIFIER: + GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; + if (gameModifierGadget.canAllowMultiple()) + { + if (cache.containsKey(gadget.getName())) + continue; + cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled"); + } else + { + String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", ""); + if (cache.containsKey(dataKey)) + continue; + if (gadget.isActive(player)) + cache.put(dataKey, gadget.getName()); + } + break; + default: + if (cache.containsKey(gadgetType.getDatabaseKey())) + continue; + if (gadget.isActive(player)) + cache.put(gadgetType.getDatabaseKey(), gadget.getName()); + break; + } + } + } + cache = updateDefaultGadgets(cache); + _userGadgetPersistence.save(player, cache); + } + + private Map updateDefaultGadgets(Map cache) + { + for (GadgetType gadgetType : GadgetType.values()) + { + if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM + || gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON + || gadgetType == GadgetType.GAME_MODIFIER) + continue; + if (!cache.containsKey(gadgetType.getDatabaseKey())) + { + String key = gadgetType.getDatabaseKey(); + if (gadgetType.equals(GadgetType.COSTUME)) + { + for (ArmorSlot armorSlot : ArmorSlot.values()) + { + key = "activeCostume" + armorSlot.getDatabaseKey(); + if (!cache.containsKey(key)) + { + cache.put(key, "disabled"); + } + } + } + else + { + cache.put(key, "disabled"); + } + } + } + return cache; + } + + public boolean isKitModifierActive(KitModifier kitModifier, Player player) + { + for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER)) + { + if (gadget instanceof KitGameModifier) + { + KitGameModifier kitGameModifier = (KitGameModifier) gadget; + if (kitGameModifier.getKitModifier().equals(kitModifier)) + return kitGameModifier.isActive(player); + } + } + return false; + } + + public KitModifier getActiveKitModifier(KitModifierType kitModifierType, Player player) + { + for (KitModifier kitModifier : KitModifier.values()) + { + if (kitModifier.getKitModifierType().equals(kitModifierType)) + if (isKitModifierActive(kitModifier, player)) + return kitModifier; + } + return null; + } + + @EventHandler + public void onVanish(IncognitoStatusChangeEvent event) + { + if (event.getNewState()) + { + for (Gadget gadget : getGadgets(GadgetType.PARTICLE)) + { + if (gadget.isActive(event.getPlayer())) + { + gadget.disable(event.getPlayer()); + } + } + } + } + + public UserGadgetPersistence getUserGadgetPersistence() + { + return _userGadgetPersistence; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java index e7d3bdeff..9135d6f38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java @@ -89,11 +89,11 @@ public class AmmoCommand extends CommandBase try { int ammo = Integer.parseInt(amount); - _plugin.getInventoryManager().addItemToInventory(target, gadget.GetName(), ammo); - UtilPlayer.message(caller, F.main("Ammo", "You gave " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.GetName()) + " to " + F.name(target.getName()) + ".")); + _plugin.getInventoryManager().addItemToInventory(target, gadget.getName(), ammo); + UtilPlayer.message(caller, F.main("Ammo", "You gave " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.getName()) + " to " + F.name(target.getName()) + ".")); if (target != null) { - UtilPlayer.message(target, F.main("Ammo", F.name(caller.getName()) + " gave you " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.GetName()) + ".")); + UtilPlayer.message(target, F.main("Ammo", F.name(caller.getName()) + " gave you " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.getName()) + ".")); } } catch (Exception e) @@ -104,9 +104,9 @@ public class AmmoCommand extends CommandBase private Gadget getGadgetByName(String gadgetName) { - for (Gadget gadget : _plugin.getGadgets(GadgetType.Item)) + for (Gadget gadget : _plugin.getGadgets(GadgetType.ITEM)) { - if (gadget.GetName().equalsIgnoreCase(gadgetName.replaceAll("_", " "))) + if (gadget.getName().equalsIgnoreCase(gadgetName.replaceAll("_", " "))) return gadget; } return null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index 25f03de1d..7137b9def 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -7,6 +7,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.mount.Mount; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase @@ -64,7 +66,7 @@ public class LockCosmeticsCommand extends CommandBase } for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.GetName()); + _plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.getName()); } UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!")); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index 44a2a3643..f55fb3394 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -7,6 +7,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.mount.Mount; +import mineplex.core.mount.MountManager; +import mineplex.core.pet.Pet; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class UnlockCosmeticsCommand extends CommandBase @@ -64,7 +68,7 @@ public class UnlockCosmeticsCommand extends CommandBase } for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); + _plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.getName()); } UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!")); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java new file mode 100644 index 000000000..ca7c38f72 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java @@ -0,0 +1,42 @@ +package mineplex.core.gadget.event; + +import mineplex.core.gadget.types.Gadget; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class GadgetAppliedEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Gadget _gadget; + + public GadgetAppliedEvent(Player player, Gadget gadget) + { + _player = player; + _gadget = gadget; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Gadget getGadget() + { + return _gadget; + } + + public Player getPlayer() + { + return _player; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java index 05112dfbf..cc1050a84 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java @@ -1,7 +1,6 @@ package mineplex.core.gadget.event; import mineplex.core.gadget.types.Gadget; -import mineplex.core.mount.Mount; import org.bukkit.entity.Player; import org.bukkit.event.Event; @@ -13,7 +12,7 @@ public class GadgetEnableEvent extends Event private Player _player; private Gadget _gadget; - + private boolean _showMessage = true; private boolean _cancelled = false; @@ -52,4 +51,14 @@ public class GadgetEnableEvent extends Event { return _cancelled; } + + public void setShowMessage(boolean showMessage) + { + _showMessage = showMessage; + } + + public boolean canShowMessage() + { + return _showMessage; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java index d8b7fc648..71d36ba62 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java @@ -18,7 +18,7 @@ public class Ammo extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java deleted file mode 100644 index 1c9ca8eec..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java +++ /dev/null @@ -1,42 +0,0 @@ -package mineplex.core.gadget.gadgets.arrowtrail; - -import org.bukkit.Material; -import org.bukkit.entity.Arrow; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -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.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ArrowEffectGadget; - -public class ArrowTrailHearts extends ArrowEffectGadget -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public ArrowTrailHearts(GadgetManager manager) - { - super(manager, "Arrows of Cupid", - UtilText.splitLineToArray(C.cGray + "Tether your love to an arrow, then spear someone with it. Maybe they'll fall in love!", LineFormat.LORE), - -6, - Material.APPLE, (byte) 0); - } - - @Override - public void doTrail(Arrow arrow) - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .1F, .1F, .1F, 0F, 1, ViewDist.LONGER); - } - - @Override - public void doHitEffect(Arrow arrow) - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java index d528c4a7c..73010a753 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.candycane; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java index d13aa5f67..813147704 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.cupidslove; import org.bukkit.Color; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java index b7b8a6df2..8592bc16b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.emerald; import mineplex.core.common.util.*; import org.bukkit.Location; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java new file mode 100644 index 000000000..dc7e1ccb2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java @@ -0,0 +1,64 @@ +package mineplex.core.gadget.gadgets.arrowtrail.freedom; + +import java.awt.*; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; +import mineplex.core.gadget.gadgets.particle.unrelated.FreedomFireworkEffect; +import mineplex.core.gadget.types.ArrowEffectGadget; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +public class ArrowTrailFreedom extends ArrowEffectGadget +{ + + private Color _color = Color.RED; + private long _count; + + public ArrowTrailFreedom(GadgetManager manager) + { + super(manager, "Shock and Awe", UtilText.splitLineToArray(UtilText.colorWords("Send freedom directly into the faces of your foes.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + -8, Material.WOOL, + (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), arrow.getLocation().clone().add(0, .5, 0)); + for (int i = 0; i < 7; i++) + { + coloredParticle.setLocation(arrow.getLocation().clone().add(0, .5, 0)); + coloredParticle.display(); + } + _count++; + if (_count % 5 == 0) + { + if (_color == Color.RED) + _color = Color.WHITE; + else if (_color == Color.WHITE) + _color = Color.BLUE; + else + _color = Color.RED; + } + if (_count == Long.MAX_VALUE - 1) + _count = 0; + } + + @Override + public void doHitEffect(Arrow arrow) + { + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(arrow.getLocation(), Manager.getPlugin(), _color); + babyFireworkEffect.start(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java index 3a7c910b5..6ae8d9b43 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.frostlord; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java index 084611017..a3cc14165 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.howlingwinds; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java index 6c6a3006e..d535035af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.music; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java index be2cd9b90..d8f06ce45 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.party; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java index 8db14cbdb..aec688901 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.shadow; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java index e84e26318..57938844b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.titan; import org.bukkit.Material; import org.bukkit.entity.Arrow; @@ -45,7 +45,7 @@ public class ArrowTrailTitan extends ArrowEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java index 180e336de..f54c9ae92 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.vampire; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java index b33723020..00e47e049 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.wisdom; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java new file mode 100644 index 000000000..883957f59 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java @@ -0,0 +1,52 @@ +package mineplex.core.gadget.gadgets.balloons; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.BalloonGadget; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.*; + +public class BabyCowBalloon extends BalloonGadget +{ + + private ArmorStand _entityStand, _playerStand; + private Entity _balloonEntity; + + public BabyCowBalloon(GadgetManager manager) + { + super(manager, "Baby Cow Balloon", new String[]{"placeholder"}, 0, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.COW)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + if (!canSpawnBalloon(player)) + { + // TODO MESSAGE + return; + } + addPlayerBalloon(player); + _entityStand = player.getWorld().spawn(player.getLocation(), ArmorStand.class); + _entityStand.setGravity(false); + _entityStand.setVisible(false); + Cow babyCow = player.getWorld().spawn(player.getLocation(), Cow.class); + babyCow.setBaby(); + _balloonEntity = babyCow; + _entityStand.setPassenger(babyCow); + Location balloonLocation = player.getLocation().add(_random.nextDouble(), getNewHeight(player), _random.nextDouble()); + _entityStand.teleport(balloonLocation); + babyCow.setLeashHolder(player); + // TODO UPDATE BALLOONS + } + + @Override + public void disableCustom(Player player) + { + _entityStand.remove(); + _balloonEntity.remove(); + removePlayerBalloon(player); + // TODO UPDATE PLAYER HEIGHT + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java deleted file mode 100644 index 736fd0a25..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java +++ /dev/null @@ -1,40 +0,0 @@ -package mineplex.core.gadget.gadgets.death; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.blood.BloodEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -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.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.DeathEffectGadget; - -public class DeathHearts extends DeathEffectGadget -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public DeathHearts(GadgetManager manager) - { - super(manager, "Broken Hearted", - UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", - LineFormat.LORE), - -6, Material.APPLE, (byte) 0); - } - - @Override - public void onBlood(Player player, BloodEvent event) - { - event.setCancelled(true); - Location loc = event.getLocation().clone().add(0, .5, 0); - - UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java index 2d100b3fe..45a7028d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.candycane; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java index d0053f9df..1c92abc02 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.cupidslove; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java index 85fb2db18..79ea0b404 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.emerald; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java new file mode 100644 index 000000000..bb2f1e1fb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java @@ -0,0 +1,36 @@ +package mineplex.core.gadget.gadgets.death.freedom; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class DeathFreedom extends DeathEffectGadget +{ + + public DeathFreedom(GadgetManager manager) + { + super(manager, "Price of Freedom", UtilText.splitLineToArray(UtilText.colorWords("Freedom isn't always free, Soldier.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + -8, Material.WOOL, (byte) 0); + } + + @Override + public void onBlood(Player player, BloodEvent event) + { + event.setCancelled(true); + + event.setItem(Material.INK_SACK, (byte) 15); + + Location loc = event.getLocation(); + UtilFirework.playFreedomFirework(loc); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java index 72cd2c3cb..0ce7b546f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.frostlord; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java index c3cf2f0da..00cf6d607 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.howlingwinds; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java index d6c4176ad..2bf566254 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.music; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java index 0adc3dfb8..09ccfe10a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.party; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java index f80b4ad9b..3adb240f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.shadow; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java index b0c4aab37..1d4fd7b3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.titan; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -34,7 +34,7 @@ public class DeathTitan extends DeathEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java index 7101aba36..5365e3e14 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.vampire; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java index 35532906d..7229b155d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.wisdom; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java deleted file mode 100644 index 2b2b7af15..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java +++ /dev/null @@ -1,35 +0,0 @@ -package mineplex.core.gadget.gadgets.doublejump; - -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.DoubleJumpEffectGadget; - -public class DoubleJumpHearts extends DoubleJumpEffectGadget -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public DoubleJumpHearts(GadgetManager manager) - { - super(manager, "Wings of Love", - UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE), - -6, Material.APPLE, (byte) 0); - } - - @Override - public void doEffect(Player player) - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java index 62f3ad6c4..d6a7620c7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.candycane; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java index a7f19b097..f5bda1408 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.cupidslove; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java index f74859c2c..0453e0b57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.emerald; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java new file mode 100644 index 000000000..8caeb35e3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java @@ -0,0 +1,30 @@ +package mineplex.core.gadget.gadgets.doublejump.freedom; + +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class DoubleJumpFreedom extends DoubleJumpEffectGadget +{ + + public DoubleJumpFreedom(GadgetManager manager) + { + super(manager, "Leap of Freedom", UtilText.splitLineToArray(UtilText.colorWords("FREEEEEEEEEEEDOM!", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL, + (byte) 14); + } + + @Override + public void doEffect(Player player) + { + /*FreedomFireworkEffect freedomFireworkEffect = new FreedomFireworkEffect(player, Manager.getPlugin(), 3); + freedomFireworkEffect.start();*/ + UtilFirework.playFreedomFirework(player.getLocation()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java index 64cc9f962..62325731c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.frostlord; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java index 9cd07ef15..6b04d1f00 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.howlingwinds; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java index 2a4d5c1ba..5b7459f0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.music; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java index 65ce9bd80..06ee124f7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.party; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java index c64052bca..005c3403c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.shadow; import mineplex.core.common.util.C; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java index 31cf84cce..2282001f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java @@ -1,10 +1,9 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.titan; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -40,7 +39,7 @@ public class DoubleJumpTitan extends DoubleJumpEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java index 2f910416c..882133687 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.vampire; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java index d9d4db576..ec1120f3b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.wisdom; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java index 85dd1827e..d06bffbe8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java @@ -1,10 +1,8 @@ package mineplex.core.gadget.gadgets.gamemodifiers.kits; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; -import org.bukkit.Material; import org.bukkit.entity.Player; import java.util.function.Predicate; @@ -14,20 +12,18 @@ import java.util.function.Predicate; * * @author LCastr0 */ -public class KitGameModifier extends GadgetGameModifier +public class KitGameModifier extends GameModifierGadget { - private KitModifierType _kitType; - private String _kit; - private String _id; + private KitModifier _kitModifier; + private KitModifierType _kitType; - public KitGameModifier(GadgetManager manager, GameModifierType gameType, KitModifierType kitType, String name, String[] desc, - int cost, Material material, byte data, String kit, String id) + public KitGameModifier(GadgetManager manager, KitModifier kitModifier) { - super(manager, gameType, name, desc, cost, material, data); - _kitType = kitType; - _kit = kit; - _id = id; + super(manager, kitModifier.getKitModifierType().getGameModifierType(), kitModifier.getName(), kitModifier.getLore(), kitModifier.getCost(), + kitModifier.getMaterial(), kitModifier.getData(), false); + _kitModifier = kitModifier; + _kitType = kitModifier.getKitModifierType(); } public KitModifierType getKitType() @@ -35,36 +31,31 @@ public class KitGameModifier extends GadgetGameModifier return _kitType; } - public String getKit() - { - return _kit; - } - - public String getId() - { - return _id; - } + public KitModifier getKitModifier() + { + return _kitModifier; + } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kit)).forEach(g -> g.Disable(player)); + Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kitType)).forEach(g -> g.disable(player)); - super.EnableCustom(player); + super.enableCustom(player, message); } /** - * Filters kit based on name - * @param kitName + * Filters kit based on type + * @param kitModifierType * @return */ - public static Predicate getKitFilter(String kitName) + public static Predicate getKitFilter(KitModifierType kitModifierType) { - return new Predicate() { + return new Predicate() { @Override - public boolean test(GadgetGameModifier g) { + public boolean test(GameModifierGadget g) { if (!(g instanceof KitGameModifier)) { return false; } - return ((KitGameModifier)g).getKit().equalsIgnoreCase(kitName); + return ((KitGameModifier)g).getKitType().equals(kitModifierType); } }; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java new file mode 100644 index 000000000..750b36583 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java @@ -0,0 +1,77 @@ +package mineplex.core.gadget.gadgets.gamemodifiers.kits; + +import mineplex.core.common.util.UtilEnt; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; + +public enum KitModifier +{ + + // Bridges + Bridges_Apple_Potato(KitModifierType.Bridges_AppleKit, "Potato", new String[] {"Placeholder"}, Material.POTATO_ITEM, 0), + + // Survival Games + Survival_Games_Beastmaster_Chicken(KitModifierType.SurvivalGames_BeastmasterKit, "Chicken", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.CHICKEN), 0), + Survival_Games_Beastmaster_Mini_Guardian(KitModifierType.SurvivalGames_BeastmasterKit, "Mini Guardian", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.GUARDIAN), 0), + Survival_Games_Beastmaster_Pig(KitModifierType.SurvivalGames_BeastmasterKit, "Pig", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.PIG), 0), + Survival_Games_Beastmaster_Squid(KitModifierType.SurvivalGames_BeastmasterKit, "Squid", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SQUID), 0), + Survival_Games_Horseman_Mule(KitModifierType.SurvivalGames_HorsemanKit, "Mule", new String[] {"Placeholder"}, Material.CHEST, 0), + Survival_Games_Horseman_Skeleton_Horse(KitModifierType.SurvivalGames_HorsemanKit, "Skeleton Horse", new String[] {"Placeholder"}, Material.BONE, 0), + Survival_Games_Horseman_Zombie_Horse(KitModifierType.SurvivalGames_HorsemanKit, "Zombie Horse", new String[] {"Placeholder"}, Material.ROTTEN_FLESH, 0), + Survival_Games_Horseman_Donkey(KitModifierType.SurvivalGames_HorsemanKit, "Donkey", new String[] {"Placeholder"}, Material.CHEST, 0), + Survival_Games_Necromancer_Wither_Skeleton(KitModifierType.SurvivalGames_NecromancerKit, "Wither Skeleton", new String[] {"Placeholder"}, Material.SKULL_ITEM, (byte) 1, 0), + Survival_Games_Necromancer_Zombie(KitModifierType.SurvivalGames_NecromancerKit, "Zombie", new String[] {"Placeholder"}, Material.SKULL_ITEM, (byte) 2, 0); + + private final KitModifierType _kitModifierType; + private final String _name; + private final String[] _lore; + private final Material _material; + private final byte _data; + private final int _cost; + + KitModifier(KitModifierType kitModifierType, String name, String[] lore, Material material, int cost) + { + this(kitModifierType, name, lore, material, (byte) 0, cost); + } + + KitModifier(KitModifierType kitModifierType, String name, String[] lore, Material material, byte data, int cost) + { + _kitModifierType = kitModifierType; + _name = name; + _lore = lore; + _material = material; + _data = data; + _cost = cost; + } + + public KitModifierType getKitModifierType() + { + return _kitModifierType; + } + + public String getName() + { + return _name; + } + + public String[] getLore() + { + return _lore; + } + + public Material getMaterial() + { + return _material; + } + + public byte getData() + { + return _data; + } + + public int getCost() + { + return _cost; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java deleted file mode 100644 index 5f70403bf..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.bridges; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class PotatoKitGameModifier extends KitGameModifier -{ - - /** - * Game: Bridges - * Kit: Apple - * Changes: Change Apples to Potatoes - * @param manager - */ - - public PotatoKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.Bridges, KitModifierType.Bridges_AppleKit, "Potatoes", new String[]{"Placeholder"}, 0, Material.POTATO_ITEM, - (byte) 0, "Apple", "apple_potato"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java deleted file mode 100644 index 6667c14b3..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class ChickenKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Chickens - * @param manager - */ - - public ChickenKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Chicken", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.CHICKEN), "Beastmaster", "beastmaster_chicken"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java deleted file mode 100644 index f95a1fe6c..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class MiniGuardianKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Mini Guardians - * @param manager - */ - - public MiniGuardianKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Mini Guardian", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.GUARDIAN), "Beastmaster", "beastmaster_mini_guardian"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java deleted file mode 100644 index 37f0142a3..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class PigKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Pigs - * @param manager - */ - - public PigKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Pig", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.PIG), "Beastmaster", "beastmaster_pig"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java deleted file mode 100644 index 201a38a4b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class SquidKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Squids - * @param manager - */ - - public SquidKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Squid", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.SQUID), "Beastmaster", "beastmaster_squid"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java deleted file mode 100644 index 856dee70e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.horseman; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class MuleKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Horseman - * Changes: Change Horses to Mules - * @param manager - */ - - public MuleKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_HorsemanKit, "Mule", new String[]{"Placeholder"}, 0, Material.CHEST, - (byte) 0, "Horseman", "horseman_mule"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java deleted file mode 100644 index d2a2ffc19..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.horseman; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class SkeletonHorseKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Horseman - * Changes: Change Horses to Skeleton Horses - * @param manager - */ - - public SkeletonHorseKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_HorsemanKit, "Skeleton Horse", new String[]{"Placeholder"}, 0, Material.BONE, - (byte) 0, "Horseman", "horseman_skeleton_horse"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java deleted file mode 100644 index a029aa2f8..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.necromancer; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class WitherSkeletonKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Necromancer - * Changes: Change Skeletons to Wither Skeletons - * @param manager - */ - - public WitherSkeletonKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_NecromancerKit, "Wither Skeleton", new String[]{"Placeholder"}, 0, Material.SKULL_ITEM, - (byte) 1, "Necromancer", "necromancer_wither_skeleton"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java index 2b1734ef2..a9f2ebcaf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java @@ -9,13 +9,13 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; /** * A gamemodifier to apply custom skin data to {@link GameModifierType#MineStrike} weapons */ -public class GameModifierMineStrikeSkin extends GadgetGameModifier +public class GameModifierMineStrikeSkin extends GameModifierGadget { private String _weapon; @@ -37,7 +37,7 @@ public class GameModifierMineStrikeSkin extends GadgetGameModifier int cost, Material displayMat, int displayData) { super(manager, GameModifierType.MineStrike, name, - UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData); + UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData, true); _weapon = weaponName; _skinMat = newSkin; _skinData = newSkinData; @@ -83,20 +83,20 @@ public class GameModifierMineStrikeSkin extends GadgetGameModifier } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.Disable(player)); + Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.disable(player)); - super.EnableCustom(player); + super.enableCustom(player, message); } /** - * A simple {@link GadgetGameModifier} filter which filters out {@link GameModifierMineStrikeSkin} gadgets depending on weapon name + * A simple {@link GameModifierGadget} filter which filters out {@link GameModifierMineStrikeSkin} gadgets depending on weapon name * @param weaponName Exact weapon name to test for - * @return Returns a weapon filter which will filter out any {@link GadgetGameModifier} + * @return Returns a weapon filter which will filter out any {@link GameModifierGadget} * which is not instance of {@link GameModifierMineStrikeSkin} and which does not match the provided weapon name */ - public static Predicate getWeaponFilter(String weaponName) + public static Predicate getWeaponFilter(String weaponName) { return g -> g instanceof GameModifierMineStrikeSkin && ((GameModifierMineStrikeSkin)g).getWeaponName().equals(weaponName); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java deleted file mode 100644 index c83e00ed4..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java +++ /dev/null @@ -1,23 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatCoal extends HatGadget -{ - - public HatCoal(GadgetManager manager) - { - super(manager, "Lump of Coal Hat", - UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), - -1, - new ItemStack(Material.COAL_BLOCK)); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java deleted file mode 100644 index 770e16b2a..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatCompanionBlock extends HatGadget -{ - - public HatCompanionBlock(GadgetManager manager) - { - super(manager, "Companion Block", - UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), - -2, SkinData.COMPANION_CUBE.getSkull(), "Companion"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java deleted file mode 100644 index 747d969d0..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatGrinch extends HatGadget -{ - - public HatGrinch(GadgetManager manager) - { - super(manager, "The Grinch", - UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), - -3, - SkinData.THE_GRINCH.getSkull(), "The Grinch Hat"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java new file mode 100644 index 000000000..daea695eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java @@ -0,0 +1,26 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public class HatItem extends HatGadget +{ + + public HatItem(GadgetManager manager, HatType hatType) + { + super(manager, hatType); + } + + public HatItem(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data) + { + super(manager, name, desc, cost, new ItemStack(material, 1, data)); + } + + public HatItem(GadgetManager manager, String name, String[] desc, int cost, String playerName) + { + super(manager, name, desc, cost, playerName); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java deleted file mode 100644 index d5cec5785..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatLovestruck extends HatGadget -{ - - public HatLovestruck(GadgetManager manager) - { - super(manager, "Love Struck", - UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), - -6, SkinData.LOVESTRUCK.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java deleted file mode 100644 index 12ccc8db2..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatPresent extends HatGadget -{ - - public HatPresent(GadgetManager manager) - { - super(manager, "Present", - UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), - -3, - SkinData.PRESENT.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java deleted file mode 100644 index 574508d1e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatRudolph extends HatGadget -{ - - public HatRudolph(GadgetManager manager) - { - super(manager, "Rudolph", - UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), - -3, - SkinData.RUDOLPH.getSkull()); - } - -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java deleted file mode 100644 index 470b69a46..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatSanta extends HatGadget -{ - - public HatSanta(GadgetManager manager) - { - super(manager, "Santa", - UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), - -3, - SkinData.SANTA.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java deleted file mode 100644 index a369043ae..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatSecretPackage extends HatGadget -{ - - public HatSecretPackage(GadgetManager manager) - { - super(manager, "Secret Package", - UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), - -6, SkinData.SECRET_PACKAGE.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java deleted file mode 100644 index 1ebfceab7..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatSnowman extends HatGadget -{ - - public HatSnowman(GadgetManager manager) - { - super(manager, "Snowman Head", - UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), - -2, SkinData.SNOWMAN.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java deleted file mode 100644 index 6a5868d42..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java +++ /dev/null @@ -1,19 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatTeddyBear extends HatGadget -{ - public HatTeddyBear(GadgetManager manager) - { - super(manager, "Teddy Bear", - UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), - -6, - SkinData.TEDDY_BEAR.getSkull()); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java new file mode 100644 index 000000000..7a8fa997b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java @@ -0,0 +1,75 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public enum HatType +{ + + Coal("Lump of Coal Hat", UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, Material.COAL_BLOCK), + Companion_Block("Companion Block", UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), -2, SkinData.COMPANION_CUBE, "Companion"), + Grinch("The Grinch", UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH, "The Grinch Hat"), + Lovestruck("Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), -6, SkinData.LOVESTRUCK, "Love Struck Hat", "Lovestruck"), + Present("Present", UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT), + Rudolph("Rudolph", UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH), + Santa("Santa", UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), -3, SkinData.SANTA), + Secret_Package("Secret Package", UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), -6, SkinData.SECRET_PACKAGE), + Snowman("Snowman Head", UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), -2, SkinData.SNOWMAN), + Teddy_Bear("Teddy Bear", UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), -6, SkinData.TEDDY_BEAR), + Uncle_Sam("Uncle Sam Hat", UtilText.splitLineToArray(UtilText.colorWords("Uncle Sam has a big hat but now you can too.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, SkinData.UNCLE_SAM); + + private final String _name; + private final String[] _lore; + private final int _cost; + private final ItemStack _hat; + private final String[] _altNames; + + HatType(String name, String[] lore, int cost, Material material, String... altNames) + { + _name = name; + _lore = lore; + _cost = cost; + _hat = new ItemStack(material); + _altNames = altNames; + } + + HatType(String name, String[] lore, int cost, SkinData skin, String... altNames) + { + _name = name; + _lore = lore; + _cost = cost; + _hat = skin.getSkull(); + _altNames = altNames; + } + + public String getName() + { + return _name; + } + + public String[] getLore() + { + return _lore; + } + + public int getCost() + { + return _cost; + } + + public ItemStack getHat() + { + return _hat; + } + + public String[] getAltNames() + { + return _altNames; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java index ba436a8b2..a9add458a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java @@ -47,9 +47,9 @@ public class ItemBatGun extends ItemGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - super.DisableCustom(player); + super.disableCustom(player); Clear(player); } @@ -67,7 +67,7 @@ public class ItemBatGun extends ItemGadget _bats.get(player).add(player.getWorld().spawn(player.getEyeLocation(), Bat.class)); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index 71544264e..377c596f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.item; +import mineplex.core.gadget.gadgets.hat.HatType; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; @@ -25,7 +26,6 @@ import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.gadget.gadgets.Ammo; -import mineplex.core.gadget.gadgets.hat.HatCoal; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; @@ -80,14 +80,14 @@ public class ItemCoal extends ItemGadget int goal = -1; //Coal Hat - if (!Manager.getGadget(HatCoal.class).ownsGadget(player)) + if (!Manager.getHatGadget(HatType.Coal).ownsGadget(player)) { goal = _hat; - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _hat) + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) >= _hat) { - Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), 30000, true, true); + Recharge.Instance.recharge(player, getName()); + Recharge.Instance.use(player, getName(), 30000, true, true); Manager.getInventoryManager().addItemToInventory(new Callback() { @@ -101,8 +101,8 @@ public class ItemCoal extends ItemGadget UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 100, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -_hat); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + Manager.getInventoryManager().addItemToInventory(player, getName(), -_hat); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Lump of Coal Hat"); } @@ -121,10 +121,10 @@ public class ItemCoal extends ItemGadget { goal = _pet; - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _pet) + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) >= _pet) { - Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), 30000, true, true); + Recharge.Instance.recharge(player, getName()); + Recharge.Instance.use(player, getName(), 30000, true, true); PetReward reward = new PetReward( Manager.getPetManager(), @@ -143,8 +143,8 @@ public class ItemCoal extends ItemGadget UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1f, 0.0f, 1f, 0, 250, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -_pet); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + Manager.getInventoryManager().addItemToInventory(player, getName(), -_pet); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Apparition"); } @@ -159,10 +159,10 @@ public class ItemCoal extends ItemGadget { goal = _particle; - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _particle) + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) >= _particle) { - Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), 30000, true, true); + Recharge.Instance.recharge(player, getName()); + Recharge.Instance.use(player, getName(), 30000, true, true); Manager.getInventoryManager().addItemToInventory(new Callback() { @@ -176,8 +176,8 @@ public class ItemCoal extends ItemGadget UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1.5f, 0.0f, 1.5f, 0, 500, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -_particle); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + Manager.getInventoryManager().addItemToInventory(player, getName(), -_particle); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Fumes"); } @@ -191,7 +191,7 @@ public class ItemCoal extends ItemGadget } } - goal -= Manager.getInventoryManager().Get(player).getItemCount(GetName()); + goal -= Manager.getInventoryManager().Get(player).getItemCount(getName()); if (goal > 0 && Math.random() > 0.95) { @@ -219,21 +219,21 @@ public class ItemCoal extends ItemGadget if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial())) return; Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); //Stock - if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0) + if (Manager.getInventoryManager().Get(player).getItemCount(getName()) <= 0) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -242,13 +242,13 @@ public class ItemCoal extends ItemGadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; } - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); ActivateCustom(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java index 1f9f69217..7bebd373d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java @@ -109,7 +109,7 @@ public class ItemCoinBomb extends ItemGadget event.setCancelled(true); event.getItem().remove(); - Manager.getDonationManager().RewardCoinsLater(GetName() + " Pickup", event.getPlayer(), 4); + Manager.getDonationManager().RewardCoinsLater(getName() + " Pickup", event.getPlayer(), 4); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java index bb4a64339..09d4499ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java @@ -28,7 +28,7 @@ public class ItemDuelingSword extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM); _active.add(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java index 7f0b83cba..973d2f55d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java @@ -1,8 +1,6 @@ package mineplex.core.gadget.gadgets.item; -import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import org.bukkit.Color; import org.bukkit.FireworkEffect; @@ -10,7 +8,6 @@ import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; @@ -45,9 +42,9 @@ public class ItemEtherealPearl extends ItemGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - super.DisableCustom(player); + super.disableCustom(player); } @Override @@ -60,7 +57,7 @@ public class ItemEtherealPearl extends ItemGadget pearl.setPassenger(player); //Inform - UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(getName()) + ".")); //Dont Collide ((CraftPlayer)player).getHandle().spectating = true; @@ -73,7 +70,7 @@ public class ItemEtherealPearl extends ItemGadget @EventHandler public void teleportCancel(PlayerTeleportEvent event) { - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; if (event.getCause() == TeleportCause.ENDER_PEARL) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java index 597dc0a2a..aaaa6aa50 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java @@ -41,13 +41,13 @@ public class ItemFirework extends ItemGadget { if (block.getTypeId() == 90) { - UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " near Portals.")); + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(getName()) + " near Portals.")); return; } } //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); double r = Math.random(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java index dfb2526eb..4f53d1384 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java @@ -7,7 +7,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -48,7 +47,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); @@ -57,12 +56,12 @@ public class ItemFleshHook extends ItemGadget implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); if (target == null) return; @@ -80,18 +79,18 @@ public class ItemFleshHook extends ItemGadget implements IThrown target.playEffect(EntityEffect.HURT); //Inform - UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(getName()) + ".")); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java index 085a5a5cb..71f6dd3b3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java @@ -5,7 +5,6 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.valentines.event.AttemptGiftEvent; import org.bukkit.Bukkit; @@ -15,7 +14,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; public class ItemFlowerGift extends ItemGadget @@ -43,15 +41,15 @@ public class ItemFlowerGift extends ItemGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; - if (!UtilGear.isMat(player.getItemInHand(), GetDisplayMaterial())) + if (!UtilGear.isMat(player.getItemInHand(), getDisplayMaterial())) return; if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -60,7 +58,7 @@ public class ItemFlowerGift extends ItemGadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; @@ -74,7 +72,7 @@ public class ItemFlowerGift extends ItemGadget } else { - UtilPlayer.message(player, F.main("Gadget", "You used " + F.elem(GetName()) + " on " + F.name(event.getRightClicked().getName()) + ". It's not very effective...")); + UtilPlayer.message(player, F.main("Gadget", "You used " + F.elem(getName()) + " on " + F.name(event.getRightClicked().getName()) + ". It's not very effective...")); } event.setCancelled(true); @@ -87,19 +85,19 @@ public class ItemFlowerGift extends ItemGadget if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), getDisplayMaterial())) return; //Recharge - if (!Recharge.Instance.use(event.getPlayer(), GetName(), GetName(), _recharge, false, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(event.getPlayer(), getName(), getName(), _recharge, false, true, false, true, "Cosmetics")) return; if (!hasAmmo(event.getPlayer())) { - UtilPlayer.message(event.getPlayer(), F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(event.getPlayer(), F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java index b44dfd504..a405ea02c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java @@ -7,7 +7,6 @@ import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.entity.Bat; import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; @@ -61,7 +60,7 @@ public class ItemFootball extends ItemGadget _active.add(bat); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); } @EventHandler @@ -83,7 +82,7 @@ public class ItemFootball extends ItemGadget if (UtilMath.offset(ball, other) > 1.5) continue; - if (!Recharge.Instance.use(other, GetName() + " Bump", 200, false, false)) + if (!Recharge.Instance.use(other, getName() + " Bump", 200, false, false)) continue; @@ -112,10 +111,10 @@ public class ItemFootball extends ItemGadget if (UtilMath.offset(ball, player) > 2) continue; - if (!Recharge.Instance.use(player, GetName() + " Kick", 1000, false, false)) + if (!Recharge.Instance.use(player, getName() + " Kick", 1000, false, false)) return; - Recharge.Instance.useForce(player, GetName() + " Bump", 1000); + Recharge.Instance.useForce(player, getName() + " Bump", 1000); //Velocity UtilAction.velocity(ball, UtilAlg.getTrajectory2d(player, ball), 2, false, 0, 0, 0, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java index 79c8635ad..ce3e899d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.EntityEffect; import org.bukkit.Location; @@ -17,9 +16,6 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -69,7 +65,7 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f); @@ -104,7 +100,7 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown target.playEffect(EntityEffect.HURT); } - smash(data.GetThrown()); + smash(data.getThrown()); } @EventHandler @@ -177,13 +173,13 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown @Override public void Idle(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } public void smash(Entity ent) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java deleted file mode 100644 index 35da6a038..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java +++ /dev/null @@ -1,30 +0,0 @@ -package mineplex.core.gadget.gadgets.item; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.cosmetic.event.ActivateGemBoosterEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.Ammo; -import mineplex.core.gadget.types.ItemGadget; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -public class ItemGemBooster extends ItemGadget -{ - - public static final String NAME = "Gem Booster"; - private static final String[] LORE = UtilText.splitLineToArray(C.cGray + "Get triple gems in any game on this server!", LineFormat.LORE); - - public ItemGemBooster(GadgetManager manager) - { - super(manager, NAME, LORE, 1, Material.EMERALD, (byte) -1, 0, - new Ammo(NAME, NAME, Material.EMERALD, (byte) 0, LORE, -1, 0)); - } - - @Override - public void ActivateCustom(Player player) - { - player.getServer().getPluginManager().callEvent(new ActivateGemBoosterEvent(player)); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java index 1f3346e34..cea21e874 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java @@ -70,19 +70,19 @@ public class ItemLovePotion extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM); _active.add(player); List itemLore = new ArrayList(); - itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.addAll(Arrays.asList(getDescription())); itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName())); + itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(getName())); - player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); if (inform) - UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(getName()) + ".")); } @EventHandler @@ -90,10 +90,10 @@ public class ItemLovePotion extends ItemGadget { Player player = event.getPlayer(); - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), getDisplayMaterial())) return; - if (!IsActive(player)) + if (!isActive(player)) return; if (!Recharge.Instance.use(player, "Interact Love Potion", 1000, false, false)) @@ -104,7 +104,7 @@ public class ItemLovePotion extends ItemGadget //Stock if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -112,7 +112,7 @@ public class ItemLovePotion extends ItemGadget return; } - if (!Recharge.Instance.usable(player, GetName())) + if (!Recharge.Instance.usable(player, getName())) { UtilInv.Update(player); return; @@ -126,11 +126,11 @@ public class ItemLovePotion extends ItemGadget if (gadgetEvent.isCancelled()) return; - Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown + Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); - player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); } @EventHandler @@ -142,12 +142,12 @@ public class ItemLovePotion extends ItemGadget if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial())) return; Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!Recharge.Instance.use(player, "Interact Love Potion", 500, false, false)) @@ -158,7 +158,7 @@ public class ItemLovePotion extends ItemGadget //Stock if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -167,7 +167,7 @@ public class ItemLovePotion extends ItemGadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; @@ -176,9 +176,9 @@ public class ItemLovePotion extends ItemGadget String message = UtilMath.randomElement(DRINK_MESSAGES); UtilPlayer.message(player, F.main("Potion", message)); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); - player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); ActivateCustom(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java index 78269f173..ee0eea7f3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java @@ -60,7 +60,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f); @@ -73,26 +73,26 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown { //Push UtilAction.velocity(target, - UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), + UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()), 1.4, false, 0, 0.8, 1.5, true); //Effect target.playEffect(EntityEffect.HURT); } - smash(data.GetThrown()); + smash(data.getThrown()); } @Override public void Idle(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } public void smash(Entity ent) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java index 790a66d44..0c75b1a81 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java @@ -12,7 +12,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -21,13 +20,11 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.GadgetType; @@ -55,17 +52,17 @@ public class ItemPaintbrush extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM); _active.add(player); List itemLore = new ArrayList(); - itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.addAll(Arrays.asList(getDescription())); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, GetName())); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, getName())); if (inform) - UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(getName()) + ".")); } @Override @@ -82,9 +79,9 @@ public class ItemPaintbrush extends ItemGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyItem(player, true); + ApplyItem(player, message); _brushColor.put(player.getName(), (byte)15); _playerLocation.put(player.getName(), player.getLocation()); @@ -92,7 +89,7 @@ public class ItemPaintbrush extends ItemGadget @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { _brushColor.remove(player.getName()); _brushPrevious.remove(player.getName()); @@ -104,7 +101,7 @@ public class ItemPaintbrush extends ItemGadget @EventHandler public void colorSelect(PlayerInteractEvent event) { - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; Player player = event.getPlayer(); @@ -130,14 +127,14 @@ public class ItemPaintbrush extends ItemGadget for (Player player : UtilServer.getPlayers()) { - if (!GetActive().contains(player)) + if (!getActive().contains(player)) continue; Location loc = _playerLocation.get(player.getName()); if (loc == null || UtilMath.offset(player.getLocation(), loc) > 12) { - Disable(player); + disable(player); } } } @@ -148,7 +145,7 @@ public class ItemPaintbrush extends ItemGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD)) continue; @@ -192,7 +189,7 @@ public class ItemPaintbrush extends ItemGadget @EventHandler public void enableInteract(PlayerInteractEntityEvent event) { - if (IsActive(event.getPlayer())) + if (isActive(event.getPlayer())) return; if (!(event.getRightClicked() instanceof Villager)) @@ -202,7 +199,7 @@ public class ItemPaintbrush extends ItemGadget if (villager.getCustomName() != null && villager.getCustomName().contains("Bob Ross")) { - Enable(event.getPlayer()); + enable(event.getPlayer()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java index c3ea07224..0554acfe2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java @@ -124,20 +124,20 @@ public class ItemPartyPopper extends ItemGadget implements IThrown { for(int type : new int[]{1,2,4,5,6,9,10,11,12,13,14,15}) { - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, type), data.GetThrown().getLocation(), null, 0.4f, 50, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, type), data.getThrown().getLocation(), null, 0.4f, 50, ViewDist.LONG); } - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); + data.getThrown().remove(); /* - if (data.GetThrown() instanceof Item) + if (data.getThrown() instanceof Item) { - Item item = (Item) data.GetThrown(); + Item item = (Item) data.getThrown(); byte b = item.getItemStack().getData().getData(); UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, b), item.getLocation(), 0, 0, 0, 0.2f, 80, ViewDist.LONG); _items.remove(item); } - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); + data.getThrown().remove(); */ } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java index 6584046e5..eecba68e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.item; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -49,7 +48,7 @@ public class ItemTNT extends ItemGadget _tnt.put(tnt, player); //Inform - UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(getName()) + ".")); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index c6a61b789..d8ca2a8eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -13,7 +13,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -21,7 +20,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; 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.UtilEvent; @@ -56,9 +54,9 @@ public class MorphBat extends MorphGadget implements IThrown } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseBat disguise = new DisguiseBat(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -67,7 +65,7 @@ public class MorphBat extends MorphGadget implements IThrown } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -81,13 +79,13 @@ public class MorphBat extends MorphGadget implements IThrown { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 100, false, false, "Cosmetics")) return; //Effect @@ -105,7 +103,7 @@ public class MorphBat extends MorphGadget implements IThrown if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; if (!Recharge.Instance.use(player, "Poop", 4000, true, false, "Cosmetics")) @@ -136,24 +134,24 @@ public class MorphBat extends MorphGadget implements IThrown target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 1), true); //Inform - UtilPlayer.message(target, F.main("Skill", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.skill("Bat Poop") + ".")); + UtilPlayer.message(target, F.main("Skill", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.skill("Bat Poop") + ".")); - UtilPlayer.message(data.GetThrower(), F.main("Skill", "You hit " + F.name(UtilEnt.getName(target)) + " with " + F.skill("Bat Poop") + ".")); + UtilPlayer.message(data.getThrower(), F.main("Skill", "You hit " + F.name(UtilEnt.getName(target)) + " with " + F.skill("Bat Poop") + ".")); } - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @EventHandler @@ -164,7 +162,7 @@ public class MorphBat extends MorphGadget implements IThrown if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -180,7 +178,7 @@ public class MorphBat extends MorphGadget implements IThrown player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+0.5)); //Set Recharge - Recharge.Instance.use(player, GetName(), 40, false, false); + Recharge.Instance.use(player, getName(), 40, false, false); } @EventHandler @@ -189,7 +187,7 @@ public class MorphBat extends MorphGadget implements IThrown if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.getGameMode() == GameMode.CREATIVE) continue; @@ -198,7 +196,7 @@ public class MorphBat extends MorphGadget implements IThrown { player.setAllowFlight(true); } - else if (Recharge.Instance.usable(player, GetName())) + else if (Recharge.Instance.usable(player, getName())) { player.setAllowFlight(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index 1ea72b7e4..57bb92473 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -38,9 +37,9 @@ public class MorphBlaze extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseBlaze disguise = new DisguiseBlaze(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -49,7 +48,7 @@ public class MorphBlaze extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -60,7 +59,7 @@ public class MorphBlaze extends MorphGadget { if (event.getType() == UpdateType.TICK) { - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.isSneaking()) { @@ -85,7 +84,7 @@ public class MorphBlaze extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java index dea95636a..c04d0eba3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java @@ -46,15 +46,15 @@ public class MorphBlock extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); _active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK)); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); @@ -91,7 +91,7 @@ public class MorphBlock extends MorphGadget if (!UtilBlock.solid(event.getClickedBlock())) return; - if (!Recharge.Instance.use(event.getPlayer(), GetName(), 500, false, false)) + if (!Recharge.Instance.use(event.getPlayer(), getName(), 500, false, false)) return; BlockForm form = _active.get(event.getPlayer()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index 215c7a4f1..60bd653e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -65,9 +65,9 @@ public class MorphBunny extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseRabbit disguise = new DisguiseRabbit(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -79,7 +79,7 @@ public class MorphBunny extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { _jumpCharge.remove(player); this.RemoveArmor(player); @@ -95,7 +95,7 @@ public class MorphBunny extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; //Start @@ -145,7 +145,7 @@ public class MorphBunny extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -171,7 +171,7 @@ public class MorphBunny extends MorphGadget UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); - Manager.getDonationManager().RewardCoinsLater(this.GetName() + " Egg Hide", player, -500); + Manager.getDonationManager().RewardCoinsLater(this.getName() + " Egg Hide", player, -500); egg.setPickupDelay(40); @@ -198,7 +198,7 @@ public class MorphBunny extends MorphGadget event.setCancelled(true); event.getItem().remove(); - Manager.getDonationManager().RewardCoinsLater(GetName() + " Egg Pickup", event.getPlayer(), 450); + Manager.getDonationManager().RewardCoinsLater(getName() + " Egg Pickup", event.getPlayer(), 450); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java index 5d989f5e0..34a3cd6b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import org.bukkit.ChatColor; -import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -11,11 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.util.Vector; -import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; @@ -47,9 +43,9 @@ public class MorphChicken extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseChicken disguise = new DisguiseChicken(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -58,7 +54,7 @@ public class MorphChicken extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -72,13 +68,13 @@ public class MorphChicken extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 100, false, false, "Cosmetics")) return; Vector offset = player.getLocation().getDirection(); @@ -101,7 +97,7 @@ public class MorphChicken extends MorphGadget if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -119,7 +115,7 @@ public class MorphChicken extends MorphGadget player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+1)); //Set Recharge - Recharge.Instance.use(player, GetName(), 80, false, false); + Recharge.Instance.use(player, getName(), 80, false, false); //Energy player.setExp(Math.max(0f, player.getExp() - (1f/9f))); @@ -131,7 +127,7 @@ public class MorphChicken extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.getGameMode() == GameMode.CREATIVE) continue; @@ -141,7 +137,7 @@ public class MorphChicken extends MorphGadget player.setExp(0.999f); player.setAllowFlight(true); } - else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) + else if (Recharge.Instance.usable(player, getName()) && player.getExp() > 0) { player.setAllowFlight(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java index 95ce07b35..4cbe53990 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java @@ -31,9 +31,9 @@ public class MorphCow extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseCow disguise = new DisguiseCow(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -42,7 +42,7 @@ public class MorphCow extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -53,13 +53,13 @@ public class MorphCow extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 2500, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index 90478d1eb..fe68c21f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; -import org.bukkit.ChatColor; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -46,9 +45,9 @@ public class MorphCreeper extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseCreeper disguise = new DisguiseCreeper(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -57,7 +56,7 @@ public class MorphCreeper extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -68,7 +67,7 @@ public class MorphCreeper extends MorphGadget { if (event.getType() == UpdateType.TICK) { - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.isSneaking()) { @@ -172,7 +171,7 @@ public class MorphCreeper extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java index b833b52bb..e167ec7c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java @@ -42,9 +42,9 @@ public class MorphEnderman extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseEnderman disguise = new DisguiseEnderman(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -53,7 +53,7 @@ public class MorphEnderman extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -70,7 +70,7 @@ public class MorphEnderman extends MorphGadget if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -80,7 +80,7 @@ public class MorphEnderman extends MorphGadget player.setAllowFlight(false); //Set Recharge - Recharge.Instance.use(player, GetName(), 2000, false, false, "Cosmetics"); + Recharge.Instance.use(player, getName(), 2000, false, false, "Cosmetics"); //Smoke Trail Block lastSmoke = player.getLocation().getBlock(); @@ -153,12 +153,12 @@ public class MorphEnderman extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.getGameMode() == GameMode.CREATIVE) continue; - if (Recharge.Instance.usable(player, GetName())) + if (Recharge.Instance.usable(player, getName())) { player.setAllowFlight(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index 04fa7c32e..b8a94970b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -45,9 +44,9 @@ public class MorphPig extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguisePig disguise = new DisguisePig(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -56,7 +55,7 @@ public class MorphPig extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -67,13 +66,13 @@ public class MorphPig extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 400, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 400, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5)); @@ -85,7 +84,7 @@ public class MorphPig extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.ULTRA)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } @@ -93,7 +92,7 @@ public class MorphPig extends MorphGadget public void Collide(PlayerToggleFlightEvent event) { _double.add(event.getPlayer()); - Recharge.Instance.useForce(event.getPlayer(), GetName() + " Double Jump", 200); + Recharge.Instance.useForce(event.getPlayer(), getName() + " Double Jump", 200); } @EventHandler @@ -102,12 +101,12 @@ public class MorphPig extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { //Grounded if (_double.contains(player)) if (UtilEnt.isGrounded(player)) - if (Recharge.Instance.usable(player, GetName() + " Double Jump")) + if (Recharge.Instance.usable(player, getName() + " Double Jump")) _double.remove(player); double range = 1; @@ -118,7 +117,7 @@ public class MorphPig extends MorphGadget if (player.getVehicle() != null) continue; - if (!Recharge.Instance.usable(player, GetName() + " Collide")) + if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; for (Player other : UtilServer.getPlayers()) @@ -129,7 +128,7 @@ public class MorphPig extends MorphGadget if (other.getVehicle() != null) continue; - if (!Recharge.Instance.usable(other, GetName() + " Collide")) + if (!Recharge.Instance.usable(other, getName() + " Collide")) continue; if (UtilMath.offset(player, other) > range) @@ -139,8 +138,8 @@ public class MorphPig extends MorphGadget continue; //Cooldown - Recharge.Instance.useForce(other, GetName() + " Collide", 200); - Recharge.Instance.useForce(player, GetName() + " Collide", 200); + Recharge.Instance.useForce(other, getName() + " Collide", 200); + Recharge.Instance.useForce(player, getName() + " Collide", 200); double power = 0.4; double height = 0.1; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index ed425a5de..7bed212fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -29,9 +29,9 @@ public class MorphPumpkinKing extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); @@ -47,7 +47,7 @@ public class MorphPumpkinKing extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 7e539bf90..a184823ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -43,9 +43,9 @@ public class MorphSlime extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseSlime disguise = new DisguiseSlime(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -65,7 +65,7 @@ public class MorphSlime extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -76,7 +76,7 @@ public class MorphSlime extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -85,7 +85,7 @@ public class MorphSlime extends MorphGadget if (!UtilEnt.isGrounded(player)) return; - if (!Recharge.Instance.use(player, GetName(), 1000, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.SLIME_ATTACK, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java index 8834023e1..e8b1786ef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -55,9 +55,9 @@ public class MorphSnowman extends MorphGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseSnowman disguise = new DisguiseSnowman(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -66,7 +66,7 @@ public class MorphSnowman extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -75,7 +75,7 @@ public class MorphSnowman extends MorphGadget @EventHandler public void onInteract(PlayerInteractEvent event) { - if(!IsActive(event.getPlayer())) return; + if(!isActive(event.getPlayer())) return; if(!UtilEvent.isAction(event, ActionType.L)) return; @@ -93,7 +93,7 @@ public class MorphSnowman extends MorphGadget if (event.getType() == UpdateType.FASTEST) { - for (Player player : GetActive()) + for (Player player : getActive()) { NautHashMap map = Recharge.Instance.Get(player); if(map == null) continue; @@ -120,7 +120,7 @@ public class MorphSnowman extends MorphGadget if(event.getType() == UpdateType.TICK) { - for (Player player : GetActive()) + for (Player player : getActive()) { if(player.isSneaking() && UtilEnt.isGrounded(player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index aaed71945..558335c68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -55,9 +55,9 @@ public class MorphTitan extends MorphGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseGuardian disguise = new DisguiseGuardian(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -67,7 +67,7 @@ public class MorphTitan extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -85,7 +85,7 @@ public class MorphTitan extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -119,13 +119,13 @@ public class MorphTitan extends MorphGadget //Fake Head UtilEnt.setFakeHead(player, true); - Recharge.Instance.useForce(player, GetName() + " FakeHead", 2000); + Recharge.Instance.useForce(player, getName() + " FakeHead", 2000); } @EventHandler public void lazerEnd(RechargedEvent event) { - if (event.GetAbility().equals(GetName() + " FakeHead")) + if (event.GetAbility().equals(getName() + " FakeHead")) { UtilEnt.setFakeHead(event.GetPlayer(), false); @@ -194,7 +194,7 @@ public class MorphTitan extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (UtilPlayer.isSpectator(player)) continue; @@ -212,7 +212,7 @@ public class MorphTitan extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java new file mode 100644 index 000000000..5c525b591 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java @@ -0,0 +1,74 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.UUID; + +import com.mojang.authlib.GameProfile; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +public class MorphUncleSam extends MorphGadget +{ + + public MorphUncleSam(GadgetManager manager) + { + super(manager, "Uncle Sam Morph", UtilText.splitLinesToArray(new String[] + { + UtilText.colorWords("Turn into Uncle Sam and bring Justice and Freedom with you!", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), + C.blankLine, + "#" + C.cWhite + "Left-click to use Freedom Fireworks", + C.blankLine, + "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "FREEDOM FIREWORKS ARE EXTREMELY PATRIOTIC" + }, LineFormat.LORE), + -8, Material.FIREWORK, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + this.ApplyArmor(player, message); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player); + disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cRed + "Uncle " + C.cBlue + "Sam")); + SkinData uncleSam = SkinData.UNCLE_SAM; + disguisePlayer.setSkinData(uncleSam); + disguisePlayer.setSendSkinDataToSelf(true); + Manager.getDisguiseManager().disguise(disguisePlayer); + } + + @Override + public void disableCustom(Player player) + { + this.RemoveArmor(player); + + Manager.getDisguiseManager().undisguise(player); + } + + @EventHandler + public void firework(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isActive(player)) + return; + + if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) + return; + + if (!Recharge.Instance.use(player, getName(), 2500, false, false, "Cosmetics")) + return; + + int r = (int) (Math.random() * 3); + UtilFirework.playFreedomFirework(player.getLocation().clone().add(0, 2, 0)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index 2b42adfda..9290bd13b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -53,9 +53,9 @@ public class MorphVillager extends MorphGadget implements IThrown } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseVillager disguise = new DisguiseVillager(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -64,7 +64,7 @@ public class MorphVillager extends MorphGadget implements IThrown } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -75,7 +75,7 @@ public class MorphVillager extends MorphGadget implements IThrown { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -87,7 +87,7 @@ public class MorphVillager extends MorphGadget implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), 800, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 800, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f); @@ -100,7 +100,7 @@ public class MorphVillager extends MorphGadget implements IThrown Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true, null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f); - Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20); + Manager.getDonationManager().RewardGems(null, this.getName() + " Throw", player.getName(), player.getUniqueId(), -20); gem.setPickupDelay(40); @@ -114,16 +114,16 @@ public class MorphVillager extends MorphGadget implements IThrown return; if (target instanceof Player) - if (Manager.collideEvent((Player) data.GetThrower(), this, (Player) target)) + if (Manager.collideEvent((Player) data.getThrower(), this, (Player) target)) return; //Pull UtilAction.velocity(target, - UtilAlg.getTrajectory(data.GetThrown().getLocation(), target.getEyeLocation()), + UtilAlg.getTrajectory(data.getThrown().getLocation(), target.getEyeLocation()), 1, false, 0, 0.2, 0.8, true); - UtilAction.velocity(data.GetThrown(), - UtilAlg.getTrajectory(target, data.GetThrown()), + UtilAction.velocity(data.getThrown(), + UtilAlg.getTrajectory(target, data.getThrown()), 0.5, false, 0, 0, 0.8, true); //Effect @@ -150,7 +150,7 @@ public class MorphVillager extends MorphGadget implements IThrown event.setCancelled(true); event.getItem().remove(); - Manager.getDonationManager().RewardGemsLater(GetName() + " Pickup", event.getPlayer(), 16); + Manager.getDonationManager().RewardGemsLater(getName() + " Pickup", event.getPlayer(), 16); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index f5029d34b..aa1f7a03f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -56,9 +56,9 @@ public class MorphWither extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); player.setMaxHealth(300); player.setHealth(300); @@ -73,7 +73,7 @@ public class MorphWither extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -90,13 +90,13 @@ public class MorphWither extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 2500, false, false, "Cosmetics")) return; Vector offset = player.getLocation().getDirection(); @@ -165,7 +165,7 @@ public class MorphWither extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (UtilPlayer.isSpectator(player)) continue; @@ -184,13 +184,13 @@ public class MorphWither extends MorphGadget // TODO HARDCODED Wither Morph Database Item Id - 550 if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { - Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(550, GetName()), 1)); + Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(550, getName()), 1)); } } public void setWitherData(String text, double healthPercent) { - Iterator activeIterator = GetActive().iterator(); + Iterator activeIterator = getActive().iterator(); while (activeIterator.hasNext()) { @@ -200,7 +200,7 @@ public class MorphWither extends MorphGadget if (disguise == null || !(disguise instanceof DisguiseWither)) { - DisableCustom(player); + disableCustom(player); activeIterator.remove(); continue; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java index 8abec4a35..8aa3d98ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.outfit; import java.util.HashMap; +import mineplex.core.gadget.event.GadgetAppliedEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -22,7 +23,6 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; @@ -39,44 +39,45 @@ public class OutfitTeam extends OutfitGadget } @Override - public void Enable(Player player) + public void enable(Player player) { - GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); - + if (gadgetEvent.isCancelled()) { return; } - EnableCustom(player); + enableCustom(player, true); Manager.setActive(player, this); + Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } @Override - public void ApplyArmor(Player player) + public void applyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.MORPH); - Manager.RemoveOutfit(player, _slot); + Manager.removeOutfit(player, _slot); _active.add(player); if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); } @Override - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (!_active.remove(player)) return; @@ -88,16 +89,16 @@ public class OutfitTeam extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyArmor(player); + applyArmor(player, message); colorArmor(player); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); } @EventHandler(priority=EventPriority.LOWEST) @@ -117,20 +118,20 @@ public class OutfitTeam extends OutfitGadget if (args.length < 2) { - Disable(player); + disable(player); return; } //Will only display the message once - if (GetSlot() == ArmorSlot.Legs) + if (getSlot() == ArmorSlot.Legs) { if (!Recharge.Instance.use(player, "Set Team Color", 20000, true, false)) return; } else { - if (!Recharge.Instance.use(player, "Set Team Color " + GetSlot(), 20000, false, false)) + if (!Recharge.Instance.use(player, "Set Team Color " + getSlot(), 20000, false, false)) return; } @@ -139,28 +140,28 @@ public class OutfitTeam extends OutfitGadget { _colorSetting.put(player.getName(), Color.RED); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Red Team Outfit") + "!")); } else if (args[1].equals("yellow")) { _colorSetting.put(player.getName(), Color.YELLOW); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cYellow + "Yellow Team Outfit") + "!")); } else if (args[1].equals("green")) { _colorSetting.put(player.getName(), Color.LIME); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cGreen + "Green Team Outfit") + "!")); } else if (args[1].equals("blue")) { _colorSetting.put(player.getName(), Color.AQUA); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cAqua + "Blue Team Outfit") + "!")); } else @@ -168,7 +169,7 @@ public class OutfitTeam extends OutfitGadget colorArmor(player); - Enable(player); + enable(player); } private void colorArmor(Player player) @@ -179,43 +180,43 @@ public class OutfitTeam extends OutfitGadget //Get Item ItemStack stack; - if (GetSlot() == ArmorSlot.Helmet) + if (getSlot() == ArmorSlot.Helmet) { stack = player.getInventory().getHelmet(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } - else if (GetSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.Chest) { stack = player.getInventory().getChestplate(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } - else if (GetSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.Legs) { stack = player.getInventory().getLeggings(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } - else if (GetSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.Boots) { stack = player.getInventory().getBoots(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java index be7e1cc32..4140410f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java @@ -36,16 +36,16 @@ public class OutfitRaveSuit extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyArmor(player); + applyArmor(player, message); _colorPhase.put(player.getName(), -1); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); _colorPhase.remove(player.getName()); } @@ -57,49 +57,49 @@ public class OutfitRaveSuit extends OutfitGadget for (Player player : UtilServer.getPlayers()) { - if (!IsActive(player)) + if (!isActive(player)) continue; //Get Item ItemStack stack; - if (GetSlot() == ArmorSlot.Helmet) + if (getSlot() == ArmorSlot.Helmet) { stack = player.getInventory().getHelmet(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } - else if (GetSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.Chest) { stack = player.getInventory().getChestplate(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } - else if (GetSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.Legs) { stack = player.getInventory().getLeggings(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } - else if (GetSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.Boots) { stack = player.getInventory().getBoots(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } @@ -167,7 +167,7 @@ public class OutfitRaveSuit extends OutfitGadget if (event.getType() != UpdateType.FAST) return; - if (GetSlot() != ArmorSlot.Helmet) + if (getSlot() != ArmorSlot.Helmet) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java index 2fa6d8dfa..d27a3f56c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java @@ -26,15 +26,15 @@ public class OutfitSpaceSuit extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyArmor(player); + applyArmor(player, message); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); } @EventHandler @@ -43,7 +43,7 @@ public class OutfitSpaceSuit extends OutfitGadget if (event.getType() != UpdateType.FAST) return; - if (GetSlot() != ArmorSlot.Helmet) + if (getSlot() != ArmorSlot.Helmet) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java index fd69b58e1..c67e5a9c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java @@ -19,8 +19,8 @@ import java.util.Iterator; public class OutfitWindUpSuit extends OutfitGadget { - private HashMap _colorPhase = new HashMap(); - private HashMap _percentage = new HashMap(); + private HashMap _colorPhase = new HashMap<>(); + private HashMap _percentage = new HashMap<>(); private OutfitWindUpSuitBoosterManager _boosterManager; @@ -33,17 +33,17 @@ public class OutfitWindUpSuit extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyArmor(player); + applyArmor(player, message); _colorPhase.put(player, 0); _percentage.put(player, 0); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); _colorPhase.remove(player); _percentage.remove(player); @@ -68,7 +68,7 @@ public class OutfitWindUpSuit extends OutfitGadget Player player = event.getPlayer(); // Checks if player is wearing suit - if (!IsActive(player)) + if (!isActive(player)) return; if (!getSet().isActive(player)) @@ -123,7 +123,7 @@ public class OutfitWindUpSuit extends OutfitGadget Player player = event.getPlayer(); // Checks if effect is active - if (!IsActive(player)) + if (!isActive(player)) return; int phase = _colorPhase.get(player); @@ -192,9 +192,9 @@ public class OutfitWindUpSuit extends OutfitGadget return; // Checks if material is the same - if(!UtilGear.isMat(stack, GetDisplayMaterial())) + if(!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } @@ -216,19 +216,19 @@ public class OutfitWindUpSuit extends OutfitGadget { ItemStack stack; - if(GetSlot() == ArmorSlot.Helmet) + if(getSlot() == ArmorSlot.Helmet) { stack = player.getInventory().getHelmet(); } - else if (GetSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.Chest) { stack = player.getInventory().getChestplate(); } - else if (GetSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.Legs) { stack = player.getInventory().getLeggings(); } - else if (GetSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.Boots) { stack = player.getInventory().getBoots(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java index ecfa3af17..63bdd7b12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java @@ -41,5 +41,4 @@ public class ParticleCoalFumes extends ParticleGadget UtilParticle.PlayParticleToAll(type, player.getLocation(), xz, 0, xz, 0, amount, ViewDist.NORMAL); } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java index a941e7113..a72364d41 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java @@ -36,9 +36,9 @@ public class ParticleFairy extends ParticleGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); clean(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java index 7cbbed5b5..da57bfcb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java @@ -56,15 +56,15 @@ public class ParticleKronos extends ParticleGadget /*Until it becomes purchasable*/if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN)) //if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); clean(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java index b52c19002..e1f76d435 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java @@ -42,7 +42,7 @@ public class ParticleLegend extends ParticleGadget // TODO HARDCODED Legendary Aura Database Item Id - 552 if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { - Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(552, GetName()), 1)); + Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(552, getName()), 1)); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java similarity index 73% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java index 3b536a30d..aead78417 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java @@ -1,8 +1,16 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.candycane; import java.util.HashMap; import java.util.UUID; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -10,25 +18,14 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.util.Vector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - public class ParticleCandyCane extends ParticleGadget { - private HashMap _map = new HashMap(); + private HashMap _map = new HashMap<>(); public ParticleCandyCane(GadgetManager manager) { - super(manager, "Crushed Candy Cane", + super(manager, "Crushed Candy Cane", UtilText.splitLineToArray(C.cGray + "There's no such thing as too much Christmas Candy. Don't listen to your dentist.", LineFormat.LORE), -3, Material.INK_SACK, (byte)1); } @@ -64,9 +61,9 @@ public class ParticleCandyCane extends ParticleGadget loc.add(v); } - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java index a969e9495..b10b946f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java @@ -1,59 +1,59 @@ -package mineplex.core.gadget.gadgets.particle; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerQuitEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.LineFormat; -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.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -public class ParticleHeart extends ParticleGadget -{ - - public ParticleHeart(GadgetManager manager) - { - super(manager, "Cupid's Love", - UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE), -2, - Material.APPLE, (byte) 0, "I Heart You", "Cupids Love", "Heartfelt Halo"); - } - - @Override - public void playParticle(Player player, UpdateEvent event) - { - if (event.getType() != UpdateType.FASTEST) return; - - if (Manager.isMoving(player)) - { - if(getSet() == null || !getSet().isActive(player)) return; - - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL); - } - else - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL); - } - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); - } - - @EventHandler - public void quit(PlayerQuitEvent event) - { - } - -} +package mineplex.core.gadget.gadgets.particle.cupidslove; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +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.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleHeart extends ParticleGadget +{ + + public ParticleHeart(GadgetManager manager) + { + super(manager, "Cupid's Love", + UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE), -2, + Material.APPLE, (byte) 0, "I Heart You", "Cupids Love", "Heartfelt Halo"); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) return; + + if (Manager.isMoving(player)) + { + if(getSet() == null || !getSet().isActive(player)) return; + + UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL); + } + else + { + UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL); + } + } + + @Override + public void disableCustom(Player player) + { + if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java index f81361c66..417587dbb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.emerald; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java new file mode 100644 index 000000000..68c253c4a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java @@ -0,0 +1,49 @@ +package mineplex.core.gadget.gadgets.particle.freedom; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.particle.unrelated.FreedomFireworkEffect; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class ParticleFreedom extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + + public ParticleFreedom(GadgetManager manager) + { + super(manager, "Freedom Aura", UtilText.splitLineToArray(UtilText.colorWords("Do you hear that? It's the sound of Freedom swirling around you.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, + Material.WOOL, (byte) 11); + } + + @Override + public void playParticle(Player player, UpdateEvent updateEvent) + { + + } + + @Override + public void startEffect(Player player) + { + _effects.put(player.getUniqueId(), new FreedomFireworkEffect(player, Manager.getPlugin(), true)); + _effects.get(player.getUniqueId()).start(); + } + + @Override + public void stopEffect(Player player) + { + if (_effects.containsKey(player.getUniqueId())) + _effects.get(player.getUniqueId()).stop(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java index a103778cf..62c1388b3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.frostlord; import org.bukkit.Material; import org.bukkit.Sound; @@ -57,7 +57,7 @@ public class ParticleFrostLord extends ParticleGadget UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false)) + if (scale > 0.95 && Recharge.Instance.use(player, getName(), 1000, false, false)) { UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60, ViewDist.NORMAL, UtilServer.getPlayers()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java index 449e7bc45..f463f648d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.howlingwinds; import java.util.ArrayList; import java.util.List; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java index 26344e68f..3422ae096 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.music; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java index 4f2ed6371..eada07e8d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.party; import java.util.Arrays; import java.util.Collections; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java index f3b8d3e3b..e44905184 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.shadow; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java index 6cb6bd816..f2df819c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.titan; import org.bukkit.Location; import org.bukkit.Material; @@ -96,7 +96,7 @@ public class ParticleTitan extends ParticleGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java new file mode 100644 index 000000000..f6914a598 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java @@ -0,0 +1,94 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import java.awt.*; +import java.util.Random; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.common.util.particles.NormalParticle; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +public class BabyFireworkEffect extends Effect +{ + + private Color _fireworkColor; + private Location _fireworkLocation; + private Random _random = new Random(); + private int _count = 0, _fireworkCount = 0; + private boolean _multipleColors = false; + + public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color) + { + super(10, new EffectLocation(location), javaPlugin, 2); + _fireworkColor = color; + _fireworkLocation = location.clone(); + if (color == null) + { + _multipleColors = true; + _fireworkColor = Color.RED; + } + } + + @Override + public void runEffect() + { + if (_count == 0) + { + double randX = _random.nextDouble() * 2 - 1, randY = _random.nextDouble() + .5, + randZ = _random.nextDouble() * 2 - 1; + _fireworkLocation = _fireworkLocation.clone().add(randX, randY, randZ); + } + if (_count < 6 && _count % 2 == 0) + { + NormalParticle normalParticle = new NormalParticle(UtilParticle.ParticleType.FIREWORKS_SPARK, + _fireworkLocation.clone()); + normalParticle.display(); + _fireworkLocation = _fireworkLocation.clone().add(0, .2, 0); + } + // Displays the colored baby firework + else if (_count == 6) + { + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_fireworkColor), _fireworkLocation.clone()); + coloredParticle.display(); + } + else + { + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_fireworkColor), _fireworkLocation.clone()); + // Y UP + coloredParticle.setLocation(_fireworkLocation.clone().add(0, (_fireworkCount * .125), 0)); + coloredParticle.display(); + // Y DOWN + coloredParticle.setLocation(_fireworkLocation.clone().add(0, (_fireworkCount * .125) * -1, 0)); + coloredParticle.display(); + // X POSITIVE + coloredParticle.setLocation(_fireworkLocation.clone().add((_fireworkCount * .125), 0, 0)); + coloredParticle.display(); + // X NEGATIVE + coloredParticle.setLocation(_fireworkLocation.clone().add((_fireworkCount * .125) * -1, 0, 0)); + coloredParticle.display(); + // Z POSITIVE + coloredParticle.setLocation(_fireworkLocation.clone().add(0, 0, (_fireworkCount * .125))); + coloredParticle.display(); + // Z NEGATIVE + coloredParticle.setLocation(_fireworkLocation.clone().add(0, 0, (_fireworkCount * .125) * -1)); + coloredParticle.display(); + _fireworkCount++; + if (_multipleColors) + { + if (_fireworkColor == Color.RED) + _fireworkColor = Color.WHITE; + else if (_fireworkColor == Color.WHITE) + _fireworkColor = Color.BLUE; + else + _fireworkColor = Color.RED; + } + } + + _count++; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java new file mode 100644 index 000000000..3a30b84c2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java @@ -0,0 +1,56 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class Effect +{ + + public int _ticksToRun = 20, _ticks = 0, _task; + public long _delay = 1; + public EffectLocation _effectLocation; + protected JavaPlugin _javaPlugin; + + public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin) + { + _ticksToRun = ticks; + _effectLocation = effectLocation; + _javaPlugin = javaPlugin; + } + + public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin, long delay) + { + _ticksToRun = ticks; + _effectLocation = effectLocation; + _javaPlugin = javaPlugin; + _delay = delay; + } + + public void start() + { + _task = Bukkit.getScheduler().scheduleSyncRepeatingTask(_javaPlugin, new Runnable() + { + @Override + public void run() + { + runEffect(); + update(); + } + }, 1, _delay); + } + + public void stop() + { + Bukkit.getScheduler().cancelTask(_task); + } + + private void update() + { + _ticks++; + if (_ticks == _ticksToRun) + Bukkit.getScheduler().cancelTask(_task); + } + + public abstract void runEffect(); + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java new file mode 100644 index 000000000..81ab19200 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java @@ -0,0 +1,40 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; + +public class EffectLocation +{ + + private Location _location; + private Entity _entity; + + public EffectLocation(Location location) + { + _location = location; + _entity = null; + } + + public EffectLocation(Entity entity) + { + _location = entity.getLocation(); + _entity = entity; + } + + public Location getLocation() + { + if (_entity != null && _entity.isValid() && !_entity.isDead()) + return _entity.getLocation().clone(); + if (_location != null) + return _location.clone(); + return null; + } + + public Location getFixedLocation() + { + if (_location != null) + return _location.clone(); + return null; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java new file mode 100644 index 000000000..5f1558e67 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java @@ -0,0 +1,50 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import java.awt.*; +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.java.JavaPlugin; + +public class FreedomFireworkEffect extends Effect +{ + + private Color _fireworkColor = Color.RED; + private int _count = 0, _max = -1; + private boolean _increaseY; + private Entity _playerEntity; + + public FreedomFireworkEffect(Entity entity, JavaPlugin javaPlugin, boolean increaseY) + { + super(-1, new EffectLocation(entity), javaPlugin, 15); + _increaseY = increaseY; + _playerEntity = entity; + } + + @Override + public void runEffect() + { + if (_playerEntity.isDead() || !_playerEntity.isValid()) + { + this.stop(); + return; + } + if (_count == _max) + { + this.stop(); + return; + } + Location location = _effectLocation.getLocation().clone().add(0, (_increaseY) ? 1 : 0, 0); + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(location, _javaPlugin, _fireworkColor); + babyFireworkEffect.start(); + _count++; + if (_fireworkColor == null) + _fireworkColor = Color.RED; + if (_fireworkColor == Color.RED) + _fireworkColor = Color.WHITE; + else if (_fireworkColor == Color.WHITE) + _fireworkColor = Color.BLUE; + else if (_fireworkColor == Color.BLUE) + _fireworkColor = null; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java new file mode 100644 index 000000000..67b04993a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java @@ -0,0 +1,85 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import java.awt.Color; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import org.bukkit.*; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class FreedomTrailEffect extends Effect +{ + + private Color _color = Color.RED; + private long _count, _jumpingTimer = 0; + private boolean _isJumping = false; + private Entity _entity; + + public FreedomTrailEffect(Entity entity, JavaPlugin javaPlugin) + { + super(-1, new EffectLocation(entity), javaPlugin); + _entity = entity; + } + + @Override + public void runEffect() + { + if (!_entity.isValid() || _entity.isDead()) + { + stop(); + return; + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), _effectLocation.getLocation().clone().add(0, .5, 0)); + for (int i = 0; i < 7; i++) + { + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, 0)); + coloredParticle.display(); + if (_isJumping) + { + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(.25, .5, 0)); + coloredParticle.display(); + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, .25)); + coloredParticle.display(); + } + } + if (_isJumping) + { + _jumpingTimer++; + if (_jumpingTimer >= 30) + { + setJumping(false); + _jumpingTimer = 0; + } + } + _count++; + if (_count % 5 == 0) + { + if (_color == Color.RED) + _color = Color.WHITE; + else if (_color == Color.WHITE) + _color = Color.BLUE; + else + _color = Color.RED; + } + if (_count == Long.MAX_VALUE - 1) + _count = 0; + } + + public void setJumping(boolean jumping) + { + _isJumping = jumping; + if (_isJumping) + { + int r = (int) (Math.random() * 3); + UtilFirework.launchFirework(_effectLocation.getLocation().clone(), FireworkEffect.Type.BALL, (r == 0) ? + org.bukkit.Color.RED : (r == 1) ? org.bukkit.Color.WHITE : org.bukkit.Color.BLUE, false, false, + new Vector(0, 0.01, 0), 1); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java index 40c98ca1a..e7c8d66ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.vampire; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java index 706c32fbd..f8d734e74 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.wisdom; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java index 7813fbbb1..2f630647c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java @@ -21,13 +21,13 @@ public class WinEffectDragonRider extends WinEffectGadget @Override public void play() { - Bukkit.broadcastMessage("Playing effect win effect: " + GetName()); + Bukkit.broadcastMessage("Playing effect win effect: " + getName()); } @Override public void finish() { - Bukkit.broadcastMessage("Playing effect win effect: " + GetName()); + Bukkit.broadcastMessage("Playing effect win effect: " + getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java index 8eec99719..5a4973f1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java @@ -62,19 +62,21 @@ public class WinEffectPodium extends WinEffectGadget } if(event.getType() != UpdateType.FAST) return; + + spawnFirework(event.getTick()); - Location loc = getBaseLocation(); - - for(int i = 0; i < 3; i++) - { - double r = 3; - double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0); - double x = Math.sin(rad) * r; - double z = Math.cos(rad) * r; - - Location l = loc.clone().add(x, 0, z); - UtilFirework.launchFirework(l, Type.BALL, Color.fromRGB(UtilMath.r(255*255*255)), false, true, new Vector(0, 0.01, 0), 1); - } +// Location loc = getBaseLocation(); +// +// for(int i = 0; i < 3; i++) +// { +// double r = 3; +// double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0); +// double x = Math.sin(rad) * r; +// double z = Math.cos(rad) * r; +// +// Location l = loc.clone().add(x, 0, z); +// UtilFirework.launchFirework(l, Type.BALL, Color.fromRGB(UtilMath.r(255*255*255)), false, true, new Vector(0, 0.01, 0), 1); +// } } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java new file mode 100644 index 000000000..b6634219f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -0,0 +1,111 @@ +package mineplex.core.gadget.persistence; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.*; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.F; +import mineplex.core.database.PlayerKeyValueRepository; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GameModifierGadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.OutfitGadget; +import org.bukkit.entity.Player; + +public class UserGadgetPersistence +{ + + private final GadgetManager _manager; + private final PlayerKeyValueRepository _repository; + + public UserGadgetPersistence(GadgetManager manager) + { + _manager = manager; + _repository = new PlayerKeyValueRepository<>("gadgets", PreparedStatement::setString, ResultSet::getString); + } + + public void load(Player player) + { + _repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> { + if (player.isOnline()) + { + boolean enabledGadget = false; + for (Gadget gadget : _manager.getAllGadgets()) + { + if (!gadget.ownsGadget(player)) + continue; + GadgetType gadgetType = gadget.getGadgetType(); + switch (gadgetType) + { + case MUSIC_DISC: + case ITEM: + case MORPH: + case BALLOON: + break; + case COSTUME: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (!values.containsKey(key)) + continue; + if (values.get(key).equals(gadget.getName())) + { + gadget.enable(player, false); + enabledGadget = true; + } + break; + case GAME_MODIFIER: + GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; + if (gameModifierGadget.canAllowMultiple()) + { + if (!values.containsKey(gadget.getName())) + continue; + if (values.get(gadget.getName()).equals("enabled")) + { + gadget.enable(player, false); + enabledGadget = true; + } + } + else + { + String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", ""); + if (!values.containsKey(dataKey)) + continue; + if (values.get(dataKey).equals(gadget.getName())) + { + gadget.enable(player, false); + enabledGadget = true; + } + } + break; + default: + if (!values.containsKey(gadgetType.getDatabaseKey())) + continue; + if (values.get(gadgetType.getDatabaseKey()).equals(gadget.getName())) + { + gadget.enable(player, false); + enabledGadget = true; + } + break; + } + } + if (enabledGadget) + { + player.sendMessage(F.main("Cosmetics", "You enabled all your previously enabled cosmetics!")); + } + } + })); + } + + public void save(Player player, Map values) + { + _repository.putAll(player.getUniqueId(), values); + } + + public void save(Player player, String key, String value) + { + _repository.put(player.getUniqueId(), key, value); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java index bae19a6d2..a9a2bbe0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane; -import mineplex.core.gadget.gadgets.death.DeathCandyCane; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane; -import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; +import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.types.GadgetSet; public class SetCandyCane extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java index 938bf3104..7696abc25 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; +import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; +import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; +import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; +import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.types.GadgetSet; public class SetCupidsLove extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java index 1eec46356..60897253f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.death.DeathEmerald; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.particle.ParticleEmerald; +import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; +import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; +import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; import mineplex.core.gadget.types.GadgetSet; public class SetEmerald extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java new file mode 100644 index 000000000..ce9675b16 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.types.GadgetSet; + +public class SetFreedom extends GadgetSet +{ + + public SetFreedom(GadgetManager manager) + { + super(manager, "Freedom Set", "Coming soon...", + manager.getGadget(ArrowTrailFreedom.class), + manager.getGadget(DeathFreedom.class), + manager.getGadget(DoubleJumpFreedom.class), + manager.getGadget(ParticleFreedom.class)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java index 6907576db..0ced72181 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java @@ -1,13 +1,10 @@ package mineplex.core.gadget.set; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.F; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.death.DeathFrostLord; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; import mineplex.core.gadget.types.GadgetSet; public class SetFrostLord extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java index 9af8fcec4..120a35c95 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java @@ -1,11 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm; -import mineplex.core.gadget.gadgets.death.DeathStorm; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm; -import mineplex.core.gadget.gadgets.particle.ParticleRain; -import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; +import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.types.GadgetSet; public class SetHowlingWinds extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java deleted file mode 100644 index 12a6bf5e2..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.set; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts; -import mineplex.core.gadget.gadgets.death.DeathHearts; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; -import mineplex.core.gadget.types.GadgetSet; - -public class SetLove extends GadgetSet -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public SetLove(GadgetManager manager) - { - super(manager, "Lovely!", "Coming soon...", - manager.getGadget(ArrowTrailHearts.class), - manager.getGadget(DeathHearts.class), - manager.getGadget(DoubleJumpHearts.class), - manager.getGadget(ParticleHeart.class)); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java index 268e16ee9..89022edb4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.death.DeathMusic; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.particle.ParticleMusic; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.death.music.DeathMusic; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.types.GadgetSet; public class SetMusic extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java index 86bb56d14..93370a41f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti; -import mineplex.core.gadget.gadgets.death.DeathPinataBurst; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker; -import mineplex.core.gadget.gadgets.particle.ParticlePartyTime; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.types.GadgetSet; public class SetParty extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java index 80b751d7d..befc2e27c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow; -import mineplex.core.gadget.gadgets.death.DeathShadow; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow; -import mineplex.core.gadget.gadgets.particle.ParticleFoot; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.types.GadgetSet; public class SetShadow extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java index 6a5225603..7c66a8f6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java @@ -1,13 +1,10 @@ package mineplex.core.gadget.set; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.F; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan; -import mineplex.core.gadget.gadgets.death.DeathTitan; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan; -import mineplex.core.gadget.gadgets.particle.ParticleTitan; +import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; +import mineplex.core.gadget.gadgets.death.titan.DeathTitan; +import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.types.GadgetSet; public class SetTitan extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java index 49e5c6f69..25842bb71 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java @@ -1,11 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood; -import mineplex.core.gadget.gadgets.death.DeathBlood; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood; -import mineplex.core.gadget.gadgets.particle.ParticleBlood; -import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.types.GadgetSet; public class SetVampire extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java index a5f82a95e..06858d63f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant; -import mineplex.core.gadget.gadgets.death.DeathEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.particle.ParticleEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; +import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.types.GadgetSet; public class SetWisdom extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java index a32e05163..4d3b5b0d4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java @@ -10,7 +10,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.updater.UpdateType; @@ -22,24 +21,7 @@ public abstract class ArrowEffectGadget extends Gadget public ArrowEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { - super(manager, GadgetType.ArrowTrail, name, desc, cost, mat, data, 1, altNames); - } - - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.ArrowTrail); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); + super(manager, GadgetType.ARROW_TRAIL, name, desc, cost, mat, data, 1, altNames); } public boolean shouldDisplay(Player player) @@ -63,7 +45,7 @@ public abstract class ArrowEffectGadget extends Gadget { if (event.getEntity().getShooter() != null) { - if (GetActive().contains(event.getEntity().getShooter())) + if (getActive().contains(event.getEntity().getShooter())) { _arrows.add((Arrow)event.getEntity()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java new file mode 100644 index 000000000..721282b33 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java @@ -0,0 +1,64 @@ +package mineplex.core.gadget.types; + +import java.util.*; + +import mineplex.core.gadget.GadgetManager; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public abstract class BalloonGadget extends Gadget +{ + + protected static final Map> PLAYER_BALLOONS = new HashMap<>(); + + protected final Random _random; + + public BalloonGadget(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data, String... altNames) + { + super(manager, GadgetType.BALLOON, name, desc, cost, material, data, 1, altNames); + _random = new Random(); + } + + protected boolean canSpawnBalloon(Player player) + { + if (PLAYER_BALLOONS.containsKey(player.getUniqueId())) + { + List balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); + return balloonGadgets.size() < 10; + } + return true; + } + + protected void addPlayerBalloon(Player player) + { + if (canSpawnBalloon(player)) + { + PLAYER_BALLOONS.computeIfAbsent(player.getUniqueId(), list -> new ArrayList<>()); + List balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); + balloonGadgets.add(this); + PLAYER_BALLOONS.put(player.getUniqueId(), balloonGadgets); + } + } + + protected void removePlayerBalloon(Player player) + { + List balloonGadgets = PLAYER_BALLOONS.computeIfPresent(player.getUniqueId(), (uuid, list) -> list); + if (balloonGadgets.contains(this)) + { + balloonGadgets.remove(this); + } + if (balloonGadgets.size() >= 1) + PLAYER_BALLOONS.put(player.getUniqueId(), balloonGadgets); + else + PLAYER_BALLOONS.remove(player.getUniqueId()); + } + + protected double getNewHeight(Player player) + { + List balloonGadgets = PLAYER_BALLOONS.computeIfPresent(player.getUniqueId(), (uuid, list) -> list); + if (balloonGadgets != null) + return balloonGadgets.size() * _random.nextDouble() * (_random.nextInt(1) + 2); + return 3; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java index 0a8979f9a..35eeb4737 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.blood.BloodEvent; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; @@ -13,26 +12,9 @@ public abstract class DeathEffectGadget extends Gadget { public DeathEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... altNames) { - super(manager, GadgetType.Death, name, desc, cost, mat, data, 1, altNames); - } + super(manager, GadgetType.DEATH, name, desc, cost, mat, data, 1, altNames); + } - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.Death); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); - } - public boolean shouldDisplay(Player player) { if (UtilPlayer.isSpectator(player)) @@ -50,7 +32,7 @@ public abstract class DeathEffectGadget extends Gadget if (event.getPlayer() == null) return; - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; if (!shouldDisplay(event.getPlayer())) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java index cfbc93f40..e1076dba7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleFlightEvent; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; @@ -13,24 +12,7 @@ public abstract class DoubleJumpEffectGadget extends Gadget { public DoubleJumpEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... altNames) { - super(manager, GadgetType.DoubleJump, name, desc, cost, mat, data, 1, altNames); - } - - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.DoubleJump); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); + super(manager, GadgetType.DOUBLE_JUMP, name, desc, cost, mat, data, 1, altNames); } public boolean shouldDisplay(Player player) @@ -51,7 +33,7 @@ public abstract class DoubleJumpEffectGadget extends Gadget return; if (!event.getPlayer().isFlying()) - if (IsActive(event.getPlayer())) + if (isActive(event.getPlayer())) { doEffect(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index 11835f1ca..136fd8093 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -7,6 +7,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetDisableEvent; import mineplex.core.shop.item.SalesPackageBase; @@ -74,70 +75,89 @@ public abstract class Gadget extends SalesPackageBase implements Listener return _gadgetType; } - public HashSet GetActive() + public HashSet getActive() { return _active; } - public boolean IsActive(Player player) + public boolean isActive(Player player) { return _active.contains(player); } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void onPlayerQuit(PlayerQuitEvent event) { - Disable(event.getPlayer()); + disable(event.getPlayer()); } - public void Enable(Player player) + public void enable(Player player) { - GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); + enable(player, true); + } + + public void enable(Player player, boolean message) + { + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); + gadgetEvent.setShowMessage(message); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); - + if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", GetName() + " is not enabled.")); + if (message) + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } - + System.out.println(player.getName() + " has activated " + Name); - - EnableCustom(player); + Manager.setActive(player, this); + enableCustom(player, message); + Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } - public void DisableForAll() + public void disableForAll() { for (Player player : UtilServer.getPlayers()) - Disable(player); + disable(player); } - - public void Disable(Player player) + + public void disable(Player player) { - if (IsActive(player)) + if (isActive(player)) { Manager.removeActive(player, this); GadgetDisableEvent event = new GadgetDisableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(event); - DisableCustom(player); + disableCustom(player); } } - public abstract void EnableCustom(Player player); - public abstract void DisableCustom(Player player); + public void enableCustom(Player player, boolean message) + { + Manager.removeGadgetType(player, _gadgetType, this); + _active.add(player); + if (message) + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); + } + + public void disableCustom(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(getName()) + ".")); + } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } public boolean ownsGadget(Player player) { - if(IsFree() || _free) return true; - if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(GetName())) { return true; } - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0) { return true; } + if(isFree() || _free) return true; + if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(getName())) { return true; } + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) > 0) { return true; } for(String alt : _alternativePackageNames) { @@ -157,4 +177,9 @@ public abstract class Gadget extends SalesPackageBase implements Listener { return _set; } + + public String[] getAlternativePackageNames() + { + return _alternativePackageNames; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java index 234bbc2dd..14a138de7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java @@ -41,13 +41,13 @@ public abstract class GadgetSet implements Listener Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); } - public void checkPlayer(Player player, Gadget gadget, boolean enable) + public void checkPlayer(Player player, Gadget gadget, boolean enable, boolean message) { boolean wasActive = isActive(player); for(Gadget g : _gadgets) { - if(!g.IsActive(player) || g.equals(gadget)) + if(!g.isActive(player) || g.equals(gadget)) { if(enable && g.equals(gadget)) continue; @@ -60,20 +60,20 @@ public abstract class GadgetSet implements Listener _active.add(player); if(!wasActive) { - customEnable(player); + customEnable(player, message); } } @EventHandler(priority = EventPriority.MONITOR) public void onActivate(GadgetEnableEvent event) { - checkPlayer(event.getPlayer(), event.getGadget(), true); + checkPlayer(event.getPlayer(), event.getGadget(), true, event.canShowMessage()); } @EventHandler(priority = EventPriority.MONITOR) public void onDeativate(GadgetDisableEvent event) { - checkPlayer(event.getPlayer(), event.getGadget(), false); + checkPlayer(event.getPlayer(), event.getGadget(), false, true); } public boolean isActive(Player player) @@ -81,9 +81,10 @@ public abstract class GadgetSet implements Listener return _active.contains(player); } - public void customEnable(Player player) + public void customEnable(Player player, boolean message) { - player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName()))); + if (message) + player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName()))); } public void customDisable(Player player) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java index 577d0833e..6f06cb54c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java @@ -5,24 +5,27 @@ package mineplex.core.gadget.types; */ public enum GadgetType { - Item("Items"), - Morph("Morphs"), - Particle("Particles"), - MusicDisc("Music Discs"), - Costume("Costumes"), - DoubleJump("Double Jump Effects"), - ArrowTrail("Arrow Trails"), - Death("Death Effects"), - Hat("Hats"), - Taunt("Taunts"), - WinEffect("Win Effects"), - GameModifier("Game Modifiers"); + ITEM("Items", "activeItem"), + MORPH("Morphs", "activeMorph"), + PARTICLE("Particles", "activeParticle"), + MUSIC_DISC("Music Discs", ""), + COSTUME("Costumes", ""), + DOUBLE_JUMP("Double Jump Effects", "activeDoubleJump"), + ARROW_TRAIL("Arrow Trails", "activeArrowTrail"), + DEATH("Death Effects", "activeDeathEffect"), + HAT("Hats", "activeHat"), + TAUNT("Taunts", "activeTaunt"), + WIN_EFFECT("Win Effects", "activeWinEffect"), + GAME_MODIFIER("Game Modifiers", ""), + BALLOON("Balloons", ""); private String _name; + private String _databaseKey; - GadgetType(String name) + GadgetType(String name, String databaseKey) { _name = name; + _databaseKey = databaseKey; } /** @@ -32,4 +35,12 @@ public enum GadgetType { return _name; } + + /** + * Returns the name of the database key used to store the active gadgets + */ + public String getDatabaseKey() + { + return _databaseKey; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java similarity index 64% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java index c7674700d..4962e246c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java @@ -11,10 +11,11 @@ import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; /** * An abstract wrapper for Gadgets of the type GameModifiers */ -public abstract class GadgetGameModifier extends Gadget +public abstract class GameModifierGadget extends Gadget { protected final GameModifierType _type; + private final boolean _allowMultiple; /** * @param manager Normal GadgetManager @@ -25,31 +26,29 @@ public abstract class GadgetGameModifier extends Gadget * @param mat The display material used in GUIs * @param data The display data used in GUIs */ - public GadgetGameModifier(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data) + public GameModifierGadget(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data, boolean allowMultiple) { - super(manager, GadgetType.GameModifier, name, desc, cost, mat, data); + super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data); _type = type; + _allowMultiple = allowMultiple; } public GameModifierType getGameType() { return _type; } + + public boolean canAllowMultiple() + { + return _allowMultiple; + } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - { - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); - } + if (message) + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java index d61339bf8..55c249907 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.types; +import mineplex.core.gadget.gadgets.hat.HatType; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -16,16 +17,23 @@ public abstract class HatGadget extends OutfitGadget { private ItemStack _hat; + private HatType _hatType; - public HatGadget(GadgetManager manager, String name, String[] desc, int cost, ItemStack item, String... altNames) + public HatGadget(GadgetManager manager, HatType type) { - super(manager, name, desc, cost, ArmorSlot.Helmet, item.getType(), item.getData().getData(), altNames); - _hat = item; + super(manager, type.getName(), type.getLore(), type.getCost(), ArmorSlot.Helmet, type.getHat().getType(), type.getHat().getData().getData(), type.getAltNames()); + _hat = type.getHat(); + _hatType = type; ItemMeta im = _hat.getItemMeta(); - im.setDisplayName(C.cGreen + C.Bold + name); + im.setDisplayName(C.cGreen + C.Bold + type.getName()); _hat.setItemMeta(im); } + + public HatGadget(GadgetManager manager, String name, String[] desc, int cost, ItemStack item) + { + super(manager, name, desc, cost, ArmorSlot.Helmet, item.getType(), item.getData().getData()); + } public HatGadget(GadgetManager manager, String name, String[] desc, int cost, String playerName) { @@ -37,25 +45,26 @@ public abstract class HatGadget extends OutfitGadget return _hat.clone(); } - public void ApplyArmor(Player player) + public void applyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.MORPH, this); - Manager.RemoveOutfit(player, _slot); + Manager.removeOutfit(player, _slot); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + ".")); + + if (message) + UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); player.getInventory().setHelmet(getHelmetItem()); } - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (!_active.remove(player)) return; - UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + ".")); player.getInventory().setHelmet(null); } @@ -76,23 +85,25 @@ public abstract class HatGadget extends OutfitGadget @Override public GadgetType getGadgetType() { - return GadgetType.Hat; + return GadgetType.HAT; } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyArmor(player); + applyArmor(player, message); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); } - - + public HatType getHatType() + { + return _hatType; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 9dfa14563..e6125a64f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -34,7 +34,7 @@ public abstract class ItemGadget extends Gadget public ItemGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, long recharge, Ammo ammo) { - super(manager, GadgetType.Item, name, desc, cost, mat, data); + super(manager, GadgetType.ITEM, name, desc, cost, mat, data); _ammo = ammo; _recharge = recharge; @@ -50,48 +50,48 @@ public abstract class ItemGadget extends Gadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyItem(player, true); + ApplyItem(player, message); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { RemoveItem(player); } - public HashSet GetActive() + public HashSet getActive() { return _active; } - public boolean IsActive(Player player) + public boolean isActive(Player player) { return _active.contains(player); } public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM, this); _active.add(player); List itemLore = new ArrayList(); - itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.addAll(Arrays.asList(getDescription())); itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName())); + itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(getName())); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); if (inform) - UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(getName()) + ".")); } @EventHandler public void orderThatChest(PlayerDropItemEvent event) { - if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial()) + if (isActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == getDisplayMaterial()) { if (_preserveStaticItem) return; @@ -104,8 +104,8 @@ public abstract class ItemGadget extends Gadget { if (player.isOnline()) { - player.getInventory().remove(GetDisplayMaterial()); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().remove(getDisplayMaterial()); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); UtilInv.Update(player); } } @@ -119,7 +119,7 @@ public abstract class ItemGadget extends Gadget { player.getInventory().setItem(Manager.getActiveItemSlot(), null); - UtilPlayer.message(player, F.main("Gadget", "You unequipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unequipped " + F.elem(getName()) + ".")); } } @@ -130,7 +130,7 @@ public abstract class ItemGadget extends Gadget public boolean IsItem(Player player) { - return UtilInv.IsItem(player.getItemInHand(), GetDisplayMaterial(), GetDisplayData()); + return UtilInv.IsItem(player.getItemInHand(), getDisplayMaterial(), getDisplayData()); } @EventHandler @@ -142,12 +142,12 @@ public abstract class ItemGadget extends Gadget if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial())) return; Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -156,7 +156,7 @@ public abstract class ItemGadget extends Gadget if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -165,22 +165,22 @@ public abstract class ItemGadget extends Gadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; } - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); ActivateCustom(event.getPlayer()); } public boolean hasAmmo(Player player) { - return Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0; + return Manager.getInventoryManager().Get(player).getItemCount(getName()) > 0; } public abstract void ActivateCustom(Player player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java index 96c19d0ad..3719d5583 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -8,33 +8,33 @@ import org.bukkit.event.entity.PlayerDeathEvent; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.itemstack.ItemStackFactory; public abstract class MorphGadget extends Gadget { public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data) { - super(manager, GadgetType.Morph, name, desc, cost, mat, data); - } + super(manager, GadgetType.MORPH, name, desc, cost, mat, data); + } - public void ApplyArmor(Player player) + public void ApplyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.MORPH, this); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(GetName()) + ".")); + + if (message) + UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(getName()) + ".")); } public void RemoveArmor(Player player) { if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You unmorphed from " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unmorphed from " + F.elem(getName()) + ".")); } @EventHandler public void playerDeath(PlayerDeathEvent event) { - Disable(event.getEntity()); + disable(event.getEntity()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java index c139e85c8..7e103aa6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java @@ -5,13 +5,12 @@ import java.util.Iterator; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.gadgets.SongData; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -32,21 +31,21 @@ public class MusicGadget extends Gadget public MusicGadget(GadgetManager manager, String name, String[] desc, int cost, int id, long duration) { - super(manager, GadgetType.MusicDisc, name, desc, cost, Material.getMaterial(id), (byte)0); + super(manager, GadgetType.MUSIC_DISC, name, desc, cost, Material.getMaterial(id), (byte)0); _id = id; _duration = duration; } @Override - public void Enable(Player player) + public void enable(Player player) { GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", GetName() + " is not enabled.")); + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } @@ -91,18 +90,7 @@ public class MusicGadget extends Gadget player.getWorld().playEffect(player.getLocation(), Effect.RECORD_PLAY, _id); _songs.add(new SongData(player.getLocation().getBlock(), _duration)); - } - - @Override - public void EnableCustom(Player player) - { - - } - - @Override - public void DisableCustom(Player player) - { - + Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index cc9b7fd39..1b0d32d54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -12,55 +12,68 @@ public abstract class OutfitGadget extends Gadget { public enum ArmorSlot { - Helmet, - Chest, - Legs, - Boots + Helmet ("Helmet"), + Chest ("Chestplate"), + Legs ("Leggings"), + Boots ("Boots"); + + private String _databaseKey; + + ArmorSlot(String databaseKey) + { + _databaseKey = databaseKey; + } + + public String getDatabaseKey() + { + return _databaseKey; + } } protected ArmorSlot _slot; public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data, String... altNames) { - super(manager, GadgetType.Costume, name, desc, cost, mat, data, 1, altNames); + super(manager, GadgetType.COSTUME, name, desc, cost, mat, data, 1, altNames); _slot = slot; } - public ArmorSlot GetSlot() + public ArmorSlot getSlot() { return _slot; } - public void ApplyArmor(Player player) + public void applyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.MORPH, this); - Manager.RemoveOutfit(player, _slot); + Manager.removeOutfit(player, _slot); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + ".")); + + if (message) + UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); } - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (!_active.remove(player)) return; - UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + ".")); if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null); else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java index 10766d395..aaaeb60d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java @@ -27,24 +27,27 @@ public abstract class ParticleGadget extends Gadget */ public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { - super(manager, GadgetType.Particle, name, desc, cost, mat, data, 1, altNames); + super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames); } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Particle); - + Manager.removeGadgetType(player, GadgetType.PARTICLE, this); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(GetName()) + ".")); + startEffect(player); + if (message) + UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(getName()) + ".")); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + { + stopEffect(player); + UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); + } } public boolean shouldDisplay(Player player) @@ -61,7 +64,7 @@ public abstract class ParticleGadget extends Gadget @EventHandler public void Caller(UpdateEvent event) { - for (Player player : GetActive()) + for (Player player : getActive()) { if (!shouldDisplay(player)) continue; @@ -76,4 +79,16 @@ public abstract class ParticleGadget extends Gadget * @param event The update event */ public abstract void playParticle(Player player, UpdateEvent event); + + /** + * Called when the effect starts + * @param player The player that activated it + */ + public void startEffect(Player player){} + + /** + * Called when the effect ends + * @param player The player that disabled it + */ + public void stopEffect(Player player){} } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 18cef7df2..b70b8ca49 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -7,16 +7,14 @@ import java.util.List; import java.util.UUID; import mineplex.core.common.util.*; -import org.bukkit.Location; -import org.bukkit.Material; +import org.bukkit.*; +import org.bukkit.Color; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -27,6 +25,7 @@ import mineplex.core.common.block.schematic.UtilSchematic; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; /** * A wrapper for different win effects @@ -67,7 +66,7 @@ public abstract class WinEffectGadget extends Gadget public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... alternativesalepackageNames) { - super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, alternativesalepackageNames); + super(manager, GadgetType.WIN_EFFECT, name, desc, cost, mat, data, 1, alternativesalepackageNames); } /** @@ -78,30 +77,13 @@ public abstract class WinEffectGadget extends Gadget * @param mat The display material of the WinEffect * @param data The display data of the WinEffect * @param free Sets the gadget to be free for all the players by default - * @param alternativesalepackageNames Alternative packet names used to check if the player owns this WinEffect + * @param altName Alternative package names used to check if the player owns this WinEffect */ public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, - boolean free, String... alternativesalepackageNames) + boolean free, String... altName) { - super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, alternativesalepackageNames); + super(manager, GadgetType.WIN_EFFECT, name, desc, cost, mat, data, 1, free, altName); } - - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.WinEffect); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); - } public void runPlay() { @@ -167,6 +149,11 @@ public abstract class WinEffectGadget extends Gadget _other = null; _locked.clear(); _locked = null; + // Loads gadgets back when players are teleported to the arcade hub, after the win effect + for (Player player : UtilServer.getPlayers()) + { + Manager.getUserGadgetPersistence().load(player); + } } /** @@ -273,9 +260,11 @@ public abstract class WinEffectGadget extends Gadget for(Player p : UtilServer.getPlayers()) { lockPlayer(p); UtilPlayer.hideFromAll(p); + p.setGameMode(GameMode.ADVENTURE); p.getInventory().clear(); - p.teleport(loc); + p.teleport(loc.clone().add(.5, 0, .5)); p.setAllowFlight(false); + Manager.disableAll(p, false); } } }; @@ -334,4 +323,38 @@ public abstract class WinEffectGadget extends Gadget } } + public void spawnFirework(int tick, Color fireworkColor) + { + Location loc = getBaseLocation(); + + for(int i = 0; i < 3; i++) + { + double r = 3; + double rad = (((Math.PI * 2) / 3.0) * i) + ((tick % 240) * Math.PI / 120.0); + double x = Math.sin(rad) * r; + double z = Math.cos(rad) * r; + + Location l = loc.clone().add(x, 0, z); + UtilFirework.launchFirework(l, FireworkEffect.Type.BALL, fireworkColor, false, + true, new Vector(0, 0.01, 0), 1); + } + } + + public void spawnFirework(int tick) + { + Location loc = getBaseLocation(); + + for(int i = 0; i < 3; i++) + { + double r = 3; + double rad = (((Math.PI * 2) / 3.0) * i) + ((tick % 240) * Math.PI / 120.0); + double x = Math.sin(rad) * r; + double z = Math.cos(rad) * r; + + Location l = loc.clone().add(x, 0, z); + UtilFirework.launchFirework(l, FireworkEffect.Type.BALL, Color.fromRGB(UtilMath.r(255 * 255 * 255)), false, + true, new Vector(0, 0.01, 0), 1); + } + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java deleted file mode 100644 index 3f4a4775d..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java +++ /dev/null @@ -1,87 +0,0 @@ -package mineplex.core.gamebooster; - -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.cosmetic.ui.page.BoosterPage; -import mineplex.core.donation.DonationManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.DataRepository; -import mineplex.serverdata.redis.RedisDataRepository; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import java.util.Set; -import java.util.UUID; - -/** - * Handles activation of GameBoosters - * - * @author Shaun Bennett - */ -public class GameBoosterManager extends MiniPlugin -{ - // The item name used for InventoryManager - private static final String BOOSTER_INVENTORY_ITEM = "Global.GameBooster"; - - private final CoreClientManager _clientManager; - private final DonationManager _donationManager; - private final InventoryManager _inventoryManager; - - private final DataRepository _boosterRepository; - private BoostGame _activeBoostGame; - - public GameBoosterManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) - { - super("Game Boosters", plugin); - - _clientManager = clientManager; - _donationManager = donationManager; - _inventoryManager = inventoryManager; - - _boosterRepository = new RedisDataRepository(Region.currentRegion(), BoosterData.class, "gemBooster"); - } - - - /** - * Get the number of boosters available for a player for a specific BoostGame. Currently the BoostGame has no - * affect on the output (there aren't separate types of boosters), but we may need to introduce different booster - * items for different games in the future. - * - * @param player The player that owns the boosters - * @param game The game to check for boosters - * @return The amount of unactivated boosters that player owns - */ - public int getAvailableBoosters(Player player, BoostGame game) - { - return _inventoryManager.Get(player).getItemCount(BOOSTER_INVENTORY_ITEM); - } - - /** - * Attempt to activate a booster from a player for a specific game. This will do all the required checks to make sure - * the player has boosters available and removes that booster from the player's account. This will return true if - * the booster was successfully added, or false if it wasn't - * - * @param player The player that owns the booster item - * @param game The game to be boosted - * @return True if the booster has been enabled and removed from the player account, false otherwise - */ - public boolean activateBooster(Player player, BoostGame game) - { - // TODO - return false; - } - - /** - * Return the BoosterData for a specific BoostGame - * @param game The BoostGame we want data for - * @return The BoosterData instance for that game - */ - public BoosterData getBoosterData(BoostGame game) - { - BoosterData data = new BoosterData(game); - data.getBoostQueue().add(new BoosterData.BoostedGame("Phinary", UUID.randomUUID())); - return data; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index 4a768f50a..5e2d8803e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -1,10 +1,6 @@ package mineplex.core.hologram; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.UUID; +import java.util.*; import org.bukkit.Location; import org.bukkit.entity.Entity; @@ -45,6 +41,7 @@ public class Hologram { private boolean _makeDestroyPackets = true; private boolean _makeSpawnPackets = true; private Packet[] _packets1_8; + private Packet[] _packets1_9; private HashSet _playersInList = new HashSet(); private ArrayList _playersTracking = new ArrayList(); private boolean _removeEntityDeath; @@ -58,13 +55,18 @@ public class Hologram { private long _startTime; public Hologram(HologramManager hologramManager, Location location, String... text) { - this(hologramManager, location, -1l, text); + this(hologramManager, location, false, -1l, text); } - public Hologram(HologramManager hologramManager, Location location, long maxLifetime, String... text) { + public Hologram(HologramManager hologramManager, Location location, boolean hideBoundingBox, String... text) { + this(hologramManager, location, hideBoundingBox, -1l, text); + } + + public Hologram(HologramManager hologramManager, Location location, boolean hideBoundingBox, long maxLifetime, String... text) { _hologramManager = hologramManager; _location = location.clone(); _maxLifetime = maxLifetime; + _hideBoundingBox = hideBoundingBox; setText(text); } @@ -163,13 +165,11 @@ public class Hologram { return _playersTracking; } - protected Packet[] getSpawnPackets() { + protected void checkSpawnPackets() { if (_makeSpawnPackets) { makeSpawnPackets(); _makeSpawnPackets = false; } - - return _packets1_8; } /** @@ -228,7 +228,8 @@ public class Hologram { } private void makeSpawnPackets() { - _packets1_8 = new Packet[_hologramText.length * 1]; + _packets1_8 = new Packet[_hologramText.length]; + _packets1_9 = new Packet[_hologramText.length]; if (_entityIds.size() < _hologramText.length) { _makeDestroyPackets = true; @@ -244,22 +245,39 @@ public class Hologram { } } for (int textRow = 0; textRow < _hologramText.length; textRow++) { - Packet[] packets1_8 = makeSpawnPackets1_8(textRow, _entityIds.get(textRow), _hologramText[textRow]); + PacketPlayOutSpawnEntityLiving packet1_8 = makeSpawnPacket1_8(textRow, _entityIds.get(textRow), _hologramText[textRow]); + PacketPlayOutSpawnEntityLiving packet1_9 = makeSpawnPacket1_9(textRow, _entityIds.get(textRow), _hologramText[textRow]); - for (int i = 0; i < packets1_8.length; i++) { - _packets1_8[textRow + i] = packets1_8[i]; - } + _packets1_8[textRow] = packet1_8; + _packets1_9[textRow] = packet1_9; } } - private Packet[] makeSpawnPackets1_8(int textRow, int entityId, String lineOfText) { + /** + * Used for sending 1.9 clients holograms with no bounding boxes + */ + private PacketPlayOutSpawnEntityLiving makeSpawnPacket1_9(int textRow, int entityId, String lineOfText) + { + PacketPlayOutSpawnEntityLiving packet = makeSpawnPacket1_8(textRow, entityId, lineOfText); + + if (_hideBoundingBox) + { + DataWatcher watcher = packet.l; + packet.d = (int) ((getLocation().getY() + ((double) textRow * 0.285)) * 32); + watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); + } + + return packet; + } + + private PacketPlayOutSpawnEntityLiving makeSpawnPacket1_8(int textRow, int entityId, String lineOfText) { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); DataWatcher watcher = new DataWatcher(null); packet.a = entityId; packet.b = 30; packet.c = (int) (getLocation().getX() * 32); - packet.d = (int) ((getLocation().getY() + (_hideBoundingBox ? 0 : -2.1) + ((double) textRow * 0.285)) * 32); + packet.d = (int) ((getLocation().getY() - 2.1 + ((double) textRow * 0.285)) * 32); packet.e = (int) (getLocation().getZ() * 32); packet.l = watcher; packet.uuid = UUID.randomUUID(); @@ -269,18 +287,7 @@ public class Hologram { watcher.a(2, lineOfText, EntityArmorStand.META_CUSTOMNAME, lineOfText); watcher.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); - if (_hideBoundingBox) { - watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); // TODO - // Uncomment - // after - // we - // can - // enforce - // 1.8.3 - } - // Also correct hologram positioning - - return new Packet[] { packet }; + return packet; } /** @@ -352,6 +359,7 @@ public class Hologram { } } itel = canSee.iterator(); + checkSpawnPackets(); while (itel.hasNext()) { Player player = itel.next(); @@ -359,7 +367,7 @@ public class Hologram { _playersTracking.add(player); itel.remove(); - UtilPlayer.sendPacket(player, getSpawnPackets()); + UtilPlayer.sendPacket(player, UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8); } } if (!canSee.isEmpty()) { @@ -452,6 +460,7 @@ public class Hologram { int[] destroy1_8 = new int[0]; ArrayList packets1_8 = new ArrayList(); + ArrayList packets1_9 = new ArrayList<>(); if (_hologramText.length != newText.length) { _makeDestroyPackets = true; @@ -465,7 +474,8 @@ public class Hologram { int entityId = UtilEnt.getNewEntityId(); _entityIds.add(entityId); - packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entityId, newText[i]))); + packets1_8.add(makeSpawnPacket1_8(i, entityId, newText[i])); + packets1_9.add(makeSpawnPacket1_9(i, entityId, newText[i])); } // If less lines than previously else if (i >= newText.length) { @@ -479,29 +489,45 @@ public class Hologram { Integer entityId = _entityIds.get(i); PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata(); + PacketPlayOutEntityMetadata metadata1_9 = new PacketPlayOutEntityMetadata(); metadata1_8.a = entityId; + metadata1_9.a = entityId; DataWatcher watcher1_8 = new DataWatcher(null); + DataWatcher watcher1_9 = new DataWatcher(null); - watcher1_8.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32); - watcher1_8.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]); - watcher1_8.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); - // watcher1_8.a(10, (byte) 16);// TODO Uncomment after we - // can enforce 1.8.3 - // Also correct hologram positioning + { + watcher1_8.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32); + watcher1_8.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]); + watcher1_8.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); + } + { + watcher1_9.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32); + watcher1_9.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]); + watcher1_9.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); + if (_hideBoundingBox) + { + watcher1_9.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); + } + } metadata1_8.b = watcher1_8.c(); + metadata1_9.b = watcher1_9.c(); packets1_8.add(metadata1_8); + packets1_9.add(metadata1_9); } } if (destroy1_8.length > 0) { packets1_8.add(new PacketPlayOutEntityDestroy(destroy1_8)); + packets1_9.add(new PacketPlayOutEntityDestroy(destroy1_8)); } for (Player player : _playersTracking) { - for (Packet packet : packets1_8) { + List packets = UtilPlayer.is1_9(player) ? packets1_9 : packets1_8; + for (Packet packet : packets) + { UtilPlayer.sendPacket(player, packet); } } @@ -532,15 +558,30 @@ public class Hologram { _hologramManager.addHologram(this); _playersTracking.addAll(getNearbyPlayers()); - for (Player player : _playersTracking) { - UtilPlayer.sendPacket(player, getSpawnPackets()); - } + sendPackets(); _lastMovement = new Vector(); } return this; } + private void sendPackets() + { + checkSpawnPackets(); + + for (Player player : _playersTracking) + { + UtilPlayer.sendPacket(player, UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8); + } + } + + public Packet[] getSpawnPackets(Player player) + { + checkSpawnPackets(); + + return UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8; + } + /** * Stop the hologram */ diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java index 3ff9c3a35..618c30f44 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java @@ -116,7 +116,7 @@ public class HologramManager implements Listener, IPacketHandler { hologram.getPlayersTracking().add(player); - UtilPlayer.sendPacket(player, hologram.getSpawnPackets()); + UtilPlayer.sendPacket(player, hologram.getSpawnPackets(player)); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java index 84b27464b..b648ba36b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; public class IncognitoToggleCommand extends CommandBase { + public IncognitoToggleCommand(IncognitoManager plugin) { super(plugin, Rank.HELPER, "incognito", "vanish"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java deleted file mode 100644 index 2431b67c4..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java +++ /dev/null @@ -1,38 +0,0 @@ -package mineplex.core.inventory; - -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.common.CurrencyType; -import mineplex.core.common.util.C; -import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.shop.item.SalesPackageBase; - -public class GemBooster extends SalesPackageBase -{ - public GemBooster(boolean enabled, int gemBoosters) - { - super("20 Gem Booster Pack", Material.EMERALD, (byte)0, new String[] - { - C.cYellow + "1000 Coins", - " ", - (enabled ? C.cGreen + "Left-Click To Use:" : ""), - C.cWhite + "Use these before games start to", - C.cWhite + "boost the amount of Gems earned", - C.cWhite + "for all players in the game!", - " ", - C.cGreen + "Right-Click To Purchase:", - C.cWhite + "20 Gem Boosters for " + C.cYellow + "1000 Coins", - " ", - C.cWhite + "Your Gem Boosters: " + C.cGreen + gemBoosters - }, 1000, 20); - - KnownPackage = false; - OneTimePurchaseOnly = false; - } - - @Override - public void Sold(Player player, CurrencyType currencyType) - { - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java index 9cf933aac..242e21dfa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java @@ -16,7 +16,7 @@ public class DragonMount extends Mount } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { player.leaveVehicle(); player.eject(); @@ -25,7 +25,7 @@ public class DragonMount extends Mount Manager.DeregisterAll(player); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store DragonData dragonData = new DragonData(this, player); @@ -36,7 +36,7 @@ public class DragonMount extends Mount } @Override - public void Disable(Player player) + public void disable(Player player) { DragonData data = _active.remove(player); if (data != null) @@ -45,7 +45,7 @@ public class DragonMount extends Mount data.Chicken.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java index d4267beec..232084feb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java @@ -82,7 +82,7 @@ public class HorseMount extends Mount> } } - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -107,17 +107,17 @@ public class HorseMount extends Mount> if (_armor != null) horse.getInventory().setArmor(new ItemStack(_armor)); - horse.setCustomName(player.getName() + "'s " + GetName()); + horse.setCustomName(player.getName() + "'s " + getName()); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store SingleEntityMountData mount = new SingleEntityMountData(player, horse); _active.put(player, mount); } - public void Disable(Player player) + public void disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) @@ -125,7 +125,7 @@ public class HorseMount extends Mount> mount.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java index ad18c3cc8..b63bea8d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java @@ -36,72 +36,72 @@ public abstract class Mount extends SalesPackageBase implem } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } - public final void Enable(Player player) + public final void enable(Player player) { MountActivateEvent gadgetEvent = new MountActivateEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", GetName() + " is not enabled.")); + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } - EnableCustom(player); + enableCustom(player); Manager.setActive(player, this); } - public abstract void EnableCustom(Player player); - public abstract void Disable(Player player); + public abstract void enableCustom(Player player); + public abstract void disable(Player player); - public void DisableForAll() + public void disableForAll() { for (Player player : UtilServer.getPlayers()) - Disable(player); + disable(player); } @EventHandler - public void PlayerJoin(PlayerJoinEvent event) + public void playerJoin(PlayerJoinEvent event) { if (event.getPlayer().isOp()) _owners.add(event.getPlayer()); } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void playerQuit(PlayerQuitEvent event) { _owners.remove(event.getPlayer()); - Disable(event.getPlayer()); + disable(event.getPlayer()); } - public HashSet GetOwners() + public HashSet getOwners() { return _owners; } - public HashMap GetActive() + public HashMap getActive() { return _active; } - public boolean IsActive(Player player) + public boolean isActive(Player player) { return _active.containsKey(player); } - public boolean HasMount(Player player) + public boolean hasMount(Player player) { return _owners.contains(player); } public T getMountData(Entity ent) { - for(T data : GetActive().values()) + for(T data : getActive().values()) { if(data.isPartOfMount(ent)) return data; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 905a61ba4..07f07b5a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -3,6 +3,7 @@ package mineplex.core.mount; import java.util.ArrayList; import java.util.List; +import mineplex.core.mount.types.*; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -23,17 +24,6 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; -import mineplex.core.mount.types.MountBabyReindeer; -import mineplex.core.mount.types.MountCart; -import mineplex.core.mount.types.MountDragon; -import mineplex.core.mount.types.MountFrost; -import mineplex.core.mount.types.MountMule; -import mineplex.core.mount.types.MountSlime; -import mineplex.core.mount.types.MountSpider; -import mineplex.core.mount.types.MountTitan; -import mineplex.core.mount.types.MountUndead; -import mineplex.core.mount.types.MountValentinesSheep; -import mineplex.core.mount.types.MountZombie; public class MountManager extends MiniPlugin { @@ -72,6 +62,7 @@ public class MountManager extends MiniPlugin _types.add(new MountTitan(this)); _types.add(new MountBabyReindeer(this)); _types.add(new MountValentinesSheep(this)); + _types.add(new MountFreedomHorse(this)); //_types.add(new MountSheep(this)); } @@ -84,7 +75,7 @@ public class MountManager extends MiniPlugin public void DeregisterAll(Player player) { for (Mount mount : _types) - mount.Disable(player); + mount.disable(player); } @EventHandler @@ -125,13 +116,13 @@ public class MountManager extends MiniPlugin { for (Mount mount : _types) for (Player player : UtilServer.getPlayers()) - mount.Disable(player); + mount.disable(player); } public void DisableAll(Player player) { for (Mount mount : _types) - mount.Disable(player); + mount.disable(player); } @EventHandler @@ -200,6 +191,17 @@ public class MountManager extends MiniPlugin return null; } + public Mount getMount(String name) + { + Mount fMount = null; + for (Mount mount : _types) + { + if (mount.getName().equalsIgnoreCase(name)) + fMount = mount; + } + return fMount; + } + public boolean isMount(Entity ent) { return getMount(ent) != null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java index f9d10c5d5..eb97aa560 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java @@ -37,9 +37,9 @@ public class MountBabyReindeer extends HorseMount } @Override - public void EnableCustom(Player player) { - super.EnableCustom(player); - Horse horse = GetActive().get(player).getEntity(); + public void enableCustom(Player player) { + super.enableCustom(player); + Horse horse = getActive().get(player).getEntity(); horse.setBaby(); horse.setMaxHealth(20); } @@ -49,7 +49,7 @@ public class MountBabyReindeer extends HorseMount { if(event.getType() != UpdateType.TICK) return; - for(SingleEntityMountData horse : GetActive().values()) + for(SingleEntityMountData horse : getActive().values()) { if(horse.getEntity().getPassenger() != horse.getOwner()) continue; @@ -66,7 +66,7 @@ public class MountBabyReindeer extends HorseMount @EventHandler public void onClick(PlayerInteractEntityEvent event) { - if(!IsActive(event.getPlayer())) return; + if(!isActive(event.getPlayer())) return; SingleEntityMountDatadata = getMountData(event.getRightClicked()); if(data == null) return; if(data.getOwner() != event.getPlayer()) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index 3af133864..a1f9f5a5b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -1,7 +1,5 @@ package mineplex.core.mount.types; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Minecart; @@ -38,7 +36,7 @@ public class MountCart extends Mount> KnownPackage = false; } - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -49,13 +47,13 @@ public class MountCart extends Mount> SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class)); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store _active.put(player, mount); } - public void Disable(Player player) + public void disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) @@ -63,7 +61,7 @@ public class MountCart extends Mount> mount.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } @@ -90,10 +88,10 @@ public class MountCart extends Mount> @EventHandler public void target(EntityTargetEvent event) { - if (!GetActive().containsKey(event.getTarget())) + if (!getActive().containsKey(event.getTarget())) return; - if (!GetActive().get(event.getTarget()).equals(event.getEntity())) + if (!getActive().get(event.getTarget()).equals(event.getEntity())) event.setCancelled(true); } @@ -104,7 +102,7 @@ public class MountCart extends Mount> return; //Bounce - for (SingleEntityMountData cartData : GetActive().values()) + for (SingleEntityMountData cartData : getActive().values()) { Minecart cart = cartData.getEntity(); @@ -126,7 +124,7 @@ public class MountCart extends Mount> } //Collide - for (SingleEntityMountData cartData : GetActive().values()) + for (SingleEntityMountData cartData : getActive().values()) { Minecart cart = cartData.getEntity(); @@ -138,10 +136,10 @@ public class MountCart extends Mount> Player player = (Player)cart.getPassenger(); - if (!Recharge.Instance.usable(player, GetName() + " Collide")) + if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; - for (SingleEntityMountData otherData : GetActive().values()) + for (SingleEntityMountData otherData : getActive().values()) { Minecart other = otherData.getEntity(); if (other.equals(cart)) @@ -155,15 +153,15 @@ public class MountCart extends Mount> Player otherPlayer = (Player)other.getPassenger(); - if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) + if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide")) continue; //Collide if (UtilMath.offset(cart, other) > 2) continue; - Recharge.Instance.useForce(player, GetName() + " Collide", 500); - Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); + Recharge.Instance.useForce(player, getName() + " Collide", 500); + Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500); UtilAction.velocity(cart, UtilAlg.getTrajectory(other, cart), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(cart, other), 1.2, false, 0, 0.8, 10, true); @@ -180,7 +178,7 @@ public class MountCart extends Mount> @EventHandler public void cancelBreak(VehicleDamageEvent event) { - if (GetActive().values().contains(event.getVehicle())) + if (getActive().values().contains(event.getVehicle())) event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java index 918585528..bf17e7716 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java @@ -38,7 +38,7 @@ public class MountDragon extends DragonMount { if (event.getType() == UpdateType.TICK) { - for (DragonData data : GetActive().values()) + for (DragonData data : getActive().values()) { UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, data.Dragon.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0f, 20, @@ -53,14 +53,14 @@ public class MountDragon extends DragonMount if (event.getType() != UpdateType.TICK) return; - for (DragonData data : GetActive().values()) + for (DragonData data : getActive().values()) data.Move(); HashSet toRemove = new HashSet(); - for (Player player : GetActive().keySet()) + for (Player player : getActive().keySet()) { - DragonData data = GetActive().get(player); + DragonData data = getActive().get(player); if (data == null) { toRemove.add(player); @@ -76,25 +76,25 @@ public class MountDragon extends DragonMount } for (Player player : toRemove) - Disable(player); + disable(player); } @EventHandler public void DragonTargetCancel(EntityTargetEvent event) { - if (GetActive().containsValue(event.getEntity())) + if (getActive().containsValue(event.getEntity())) event.setCancelled(true); } public void SetName(String news) { - for (DragonData dragon : GetActive().values()) + for (DragonData dragon : getActive().values()) dragon.Dragon.setCustomName(news); } public void setHealthPercent(double healthPercent) { - for (DragonData dragon : GetActive().values()) + for (DragonData dragon : getActive().values()) { double health = healthPercent * dragon.Dragon.getMaxHealth(); if (health <= 0.0) @@ -108,7 +108,7 @@ public class MountDragon extends DragonMount { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java new file mode 100644 index 000000000..5f8c2d498 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java @@ -0,0 +1,80 @@ +package mineplex.core.mount.types; + +import java.util.*; +import java.util.List; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.gadgets.particle.unrelated.FreedomTrailEffect; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.recharge.Recharge; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.HorseJumpEvent; +import org.bukkit.inventory.ItemStack; + +public class MountFreedomHorse extends HorseMount +{ + + private Map, FreedomTrailEffect> _trailMap = new HashMap<>(); + + public MountFreedomHorse(MountManager manager) + { + super(manager, "Freedom Mount", + UtilText.splitLineToArray(UtilText.colorWords("The British might be coming, but with this impressive mount you have nothing to fear.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + Material.FIREWORK, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); + } + + @Override + public void enableCustom(Player player) + { + super.enableCustom(player); + SingleEntityMountData horseData = getActive().get(player); + horseData.getEntity().getInventory().setArmor(new ItemStack(Material.DIAMOND_BARDING)); + _trailMap.put(horseData, new FreedomTrailEffect(horseData.getEntity(), Manager.getPlugin())); + _trailMap.get(horseData).start(); + } + + @Override + public void disable(Player player) + { + super.disable(player); + List> toRemove = new ArrayList<>(); + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getOwner().equals(player)) + toRemove.add(horseData); + } + for (SingleEntityMountData horseData : toRemove) + { + _trailMap.get(horseData).stop(); + _trailMap.remove(horseData); + } + } + + @EventHandler + public void horseJump(HorseJumpEvent event) + { + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getEntity().equals(event.getEntity())) + { + if (!Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics")) + { + event.setPower(0f); + event.setCancelled(true); + return; + } + _trailMap.get(horseData).setJumping(true); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java index 5a8617699..d12a76f1b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java @@ -36,7 +36,7 @@ public class MountFrost extends HorseMount public void Trail(UpdateEvent event) { if (event.getType() == UpdateType.TICK) - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), @@ -50,7 +50,7 @@ public class MountFrost extends HorseMount // if (event.getType() != UpdateType.TICK) // return; // -// for (Horse horse : GetActive().values()) +// for (Horse horse : getActive().values()) // { // //Blocks // double duration = 2000; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java index 7cecd08b0..88c444306 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java @@ -1,6 +1,5 @@ package mineplex.core.mount.types; -import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Horse; @@ -37,7 +36,7 @@ public class MountSheep extends HorseMount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -58,7 +57,7 @@ public class MountSheep extends HorseMount Manager.getDisguiseManager().disguise(disguise); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store _active.put(player, mount); @@ -70,7 +69,7 @@ public class MountSheep extends HorseMount if (event.getType() != UpdateType.TICK) return; - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java index 92e90a12b..265601406 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java @@ -1,6 +1,5 @@ package mineplex.core.mount.types; -import org.bukkit.ChatColor; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -38,7 +37,7 @@ public class MountSlime extends Mount> KnownPackage = false; } - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -49,16 +48,16 @@ public class MountSlime extends Mount> SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation(), Slime.class)); mount.getEntity().setSize(2); - mount.getEntity().setCustomName(player.getName() + "'s " + GetName()); + mount.getEntity().setCustomName(player.getName() + "'s " + getName()); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store _active.put(player, mount); } - public void Disable(Player player) + public void disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) @@ -66,7 +65,7 @@ public class MountSlime extends Mount> mount.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } @@ -78,7 +77,7 @@ public class MountSlime extends Mount> if (event.getRightClicked() == null) return; - SingleEntityMountData data = GetActive().get(event.getPlayer()); + SingleEntityMountData data = getActive().get(event.getPlayer()); if(data == null) return; @@ -95,10 +94,10 @@ public class MountSlime extends Mount> @EventHandler public void target(EntityTargetEvent event) { - if (!GetActive().containsKey(event.getTarget())) + if (!getActive().containsKey(event.getTarget())) return; - if (!GetActive().get(event.getTarget()).equals(event.getEntity())) + if (!getActive().get(event.getTarget()).equals(event.getEntity())) event.setCancelled(true); } @@ -109,7 +108,7 @@ public class MountSlime extends Mount> return; //Bounce - for (SingleEntityMountData slimeData : GetActive().values()) + for (SingleEntityMountData slimeData : getActive().values()) { Slime slime = slimeData.getEntity(); @@ -127,7 +126,7 @@ public class MountSlime extends Mount> Player player = (Player)slime.getPassenger(); - if (!Recharge.Instance.use(player, GetName(), 200, false, false)) + if (!Recharge.Instance.use(player, getName(), 200, false, false)) continue; Vector dir = slime.getPassenger().getLocation().getDirection(); @@ -140,7 +139,7 @@ public class MountSlime extends Mount> } //Collide - for (SingleEntityMountData slimeData : GetActive().values()) + for (SingleEntityMountData slimeData : getActive().values()) { Slime slime = slimeData.getEntity(); if (slime.getPassenger() == null) @@ -151,10 +150,10 @@ public class MountSlime extends Mount> Player player = (Player)slime.getPassenger(); - if (!Recharge.Instance.usable(player, GetName() + " Collide")) + if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; - for (SingleEntityMountData otherSlime : GetActive().values()) + for (SingleEntityMountData otherSlime : getActive().values()) { Slime other = otherSlime.getEntity(); @@ -169,15 +168,15 @@ public class MountSlime extends Mount> Player otherPlayer = (Player)other.getPassenger(); - if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) + if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide")) continue; //Collide if (UtilMath.offset(slime, other) > 2) continue; - Recharge.Instance.useForce(player, GetName() + " Collide", 500); - Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); + Recharge.Instance.useForce(player, getName() + " Collide", 500); + Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500); UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 25884d4b2..6f22ffc3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -55,7 +55,7 @@ public class MountSpider extends HorseMount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -82,10 +82,10 @@ public class MountSpider extends HorseMount if (_armor != null) horse.getInventory().setArmor(new ItemStack(_armor)); - horse.setCustomName(player.getName() + "'s " + GetName()); + horse.setCustomName(player.getName() + "'s " + getName()); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store SingleEntityMountData mount = new SingleEntityMountData(player, horse); @@ -105,9 +105,9 @@ public class MountSpider extends HorseMount return; ArrayList used = new ArrayList(); - for (Player player : GetActive().keySet()) + for (Player player : getActive().keySet()) { - Horse horse = GetActive().get(player).getEntity(); + Horse horse = getActive().get(player).getEntity(); used.add(horse); @@ -128,7 +128,7 @@ public class MountSpider extends HorseMount if (event.getType() != UpdateType.TICK) return; - for (Entry> entry : GetActive().entrySet()) + for (Entry> entry : getActive().entrySet()) { Player player = entry.getKey(); Horse horse = entry.getValue().getEntity(); @@ -159,10 +159,10 @@ public class MountSpider extends HorseMount // if (player.getGameMode() == GameMode.CREATIVE) // return; // -// if (!GetActive().containsKey(player)) +// if (!getActive().containsKey(player)) // return; // -// if (GetActive().get(player).getPassenger() != event.getPlayer()) +// if (getActive().get(player).getPassenger() != event.getPlayer()) // return; // // //Chicken Cancel @@ -170,7 +170,7 @@ public class MountSpider extends HorseMount // if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither)) // return; // -// Horse horse = GetActive().get(event.getPlayer()); +// Horse horse = getActive().get(event.getPlayer()); // // if (!UtilEnt.isGrounded(horse)) // return; @@ -194,9 +194,9 @@ public class MountSpider extends HorseMount if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive().keySet()) + for (Player player : getActive().keySet()) { - final Horse horse = GetActive().get(player).getEntity(); + final Horse horse = getActive().get(player).getEntity(); if (horse.getPassenger() != player) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java index 5e9747e8d..5ee7e2377 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -31,11 +31,11 @@ public class MountTitan extends Mount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - if(GetActive().size() >= 3) + if(getActive().size() >= 3) { - UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(GetName()) + " in this lobby has been reached.")); + UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(getName()) + " in this lobby has been reached.")); return; } @@ -46,14 +46,14 @@ public class MountTitan extends Mount Manager.DeregisterAll(player); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store - _active.put(player, new MountTitanData(player, GetName())); + _active.put(player, new MountTitanData(player, getName())); } @Override - public void Disable(Player player) + public void disable(Player player) { MountTitanData data = _active.remove(player); if (data != null) @@ -61,7 +61,7 @@ public class MountTitan extends Mount data.clean(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } @@ -85,7 +85,7 @@ public class MountTitan extends Mount if (event.getRightClicked() == null) return; - for(MountTitanData mount : GetActive().values()) + for(MountTitanData mount : getActive().values()) { if(mount.isPartOfMount(event.getRightClicked())) { @@ -94,10 +94,10 @@ public class MountTitan extends Mount } } - if (!GetActive().containsKey(event.getPlayer())) + if (!getActive().containsKey(event.getPlayer())) return; - if (!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer())) + if (!getActive().get(event.getPlayer()).ownsMount(event.getPlayer())) { UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!")); return; @@ -106,7 +106,7 @@ public class MountTitan extends Mount event.getPlayer().leaveVehicle(); event.getPlayer().eject(); - GetActive().get(event.getPlayer()).mount(event.getPlayer(), event.getRightClicked()); + getActive().get(event.getPlayer()).mount(event.getPlayer(), event.getRightClicked()); } @EventHandler @@ -115,10 +115,10 @@ public class MountTitan extends Mount if (!(event.getEntity() instanceof Player)) return; - if (!GetActive().containsKey(event.getTarget())) + if (!getActive().containsKey(event.getTarget())) return; - if (!GetActive().get(event.getTarget()).ownsMount((Player)event.getEntity())) + if (!getActive().get(event.getTarget()).ownsMount((Player)event.getEntity())) event.setCancelled(true); } @@ -137,7 +137,7 @@ public class MountTitan extends Mount { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java index fead4b102..dcc436651 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java @@ -35,7 +35,7 @@ public class MountUndead extends HorseMount public void Trail(UpdateEvent event) { if (event.getType() == UpdateType.TICK) - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0), @@ -43,7 +43,7 @@ public class MountUndead extends HorseMount } if (event.getType() == UpdateType.FAST) - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java index 5213be86b..c60fc1620 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java @@ -37,11 +37,11 @@ public class MountValentinesSheep extends HorseMount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - super.EnableCustom(player); + super.enableCustom(player); - Horse horse = GetActive().get(player).getEntity(); + Horse horse = getActive().get(player).getEntity(); UtilEnt.silence(horse, true); @@ -54,7 +54,7 @@ public class MountValentinesSheep extends HorseMount @EventHandler public void doAnimations(UpdateEvent event) { - for (SingleEntityMountData ent : GetActive().values()) + for (SingleEntityMountData ent : getActive().values()) { if (!ent.getEntity().isValid()) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java index 551a82d76..93db55bf3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java @@ -160,7 +160,7 @@ public class PersonalServerManager extends MiniPlugin } final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers, - true, false, false, games, "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", ""); + true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", ""); getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java index d96ce9525..251b2827c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -40,7 +40,7 @@ public class Pet extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java index 493d0eb27..162b53a01 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java @@ -29,7 +29,7 @@ public class PetExtra extends SalesPackageBase } - public String GetName() + public String getName() { return _name; } @@ -40,7 +40,7 @@ public class PetExtra extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index ceb014de4..12dbee6b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -10,7 +10,6 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.entity.Entity; @@ -40,7 +39,7 @@ public class ProjectileManager extends MiniPlugin { if (_thrown.containsKey(thrown)) { - return _thrown.get(thrown).GetThrower(); + return _thrown.get(thrown).getThrower(); } return null; @@ -174,14 +173,14 @@ public class ProjectileManager extends MiniPlugin iterator.remove(); continue; } - else if (_thrown.get(cur).Collision()) + else if (_thrown.get(cur).collision()) iterator.remove(); } } //Effects for (ProjectileUser cur : _thrown.values()) - cur.Effect(event); + cur.effect(event); } @EventHandler(priority=EventPriority.LOW) @@ -191,7 +190,7 @@ public class ProjectileManager extends MiniPlugin return; if (_thrown.containsKey(event.getItem())) - if (!_thrown.get(event.getItem()).CanPickup(event.getPlayer())) + if (!_thrown.get(event.getItem()).canPickup(event.getPlayer())) event.setCancelled(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 8a17080cd..31aee43b1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -143,7 +143,7 @@ public class ProjectileUser _canHit = canHit; } - public void Effect(UpdateEvent event) + public void effect(UpdateEvent event) { if (event.getType() != _effectRate) return; @@ -160,7 +160,7 @@ public class ProjectileUser } - public boolean Collision() + public boolean collision() { if (_expireTime != -1 && System.currentTimeMillis() > (_startTime + _expireTime)) { @@ -317,17 +317,17 @@ public class ProjectileUser return _callback; } - public LivingEntity GetThrower() + public LivingEntity getThrower() { return _thrower; } - public Entity GetThrown() + public Entity getThrown() { return _thrown; } - public boolean CanPickup(LivingEntity thrower) + public boolean canPickup(LivingEntity thrower) { if (!thrower.equals(_thrower)) return false; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index d31575cb2..7ff0962ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -5,6 +5,25 @@ import java.util.EnumMap; import java.util.List; import java.util.Random; +import mineplex.core.common.util.banner.CountryFlag; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.hat.*; +import mineplex.core.gadget.gadgets.morph.*; +import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; +import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; +import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; +import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; +import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; +import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; +import mineplex.core.mount.types.*; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -13,42 +32,35 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm; -import mineplex.core.gadget.gadgets.death.DeathBlood; -import mineplex.core.gadget.gadgets.death.DeathCandyCane; -import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart; -import mineplex.core.gadget.gadgets.death.DeathEmerald; -import mineplex.core.gadget.gadgets.death.DeathEnchant; -import mineplex.core.gadget.gadgets.death.DeathFrostLord; -import mineplex.core.gadget.gadgets.death.DeathMusic; -import mineplex.core.gadget.gadgets.death.DeathPinataBurst; -import mineplex.core.gadget.gadgets.death.DeathShadow; -import mineplex.core.gadget.gadgets.death.DeathStorm; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; +import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; +import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.death.music.DeathMusic; +import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; +import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; +import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; -import mineplex.core.gadget.gadgets.hat.HatCompanionBlock; -import mineplex.core.gadget.gadgets.hat.HatGrinch; -import mineplex.core.gadget.gadgets.hat.HatLovestruck; -import mineplex.core.gadget.gadgets.hat.HatPresent; -import mineplex.core.gadget.gadgets.hat.HatSecretPackage; -import mineplex.core.gadget.gadgets.hat.HatSnowman; -import mineplex.core.gadget.gadgets.hat.HatTeddyBear; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -62,14 +74,6 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; -import mineplex.core.gadget.gadgets.morph.MorphBat; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.gadgets.morph.MorphChicken; -import mineplex.core.gadget.gadgets.morph.MorphCow; -import mineplex.core.gadget.gadgets.morph.MorphEnderman; -import mineplex.core.gadget.gadgets.morph.MorphSlime; -import mineplex.core.gadget.gadgets.morph.MorphSnowman; -import mineplex.core.gadget.gadgets.morph.MorphVillager; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -78,23 +82,6 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; -import mineplex.core.gadget.gadgets.particle.ParticleBlood; -import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; -import mineplex.core.gadget.gadgets.particle.ParticleEmerald; -import mineplex.core.gadget.gadgets.particle.ParticleEnchant; -import mineplex.core.gadget.gadgets.particle.ParticleFairy; -import mineplex.core.gadget.gadgets.particle.ParticleFireRings; -import mineplex.core.gadget.gadgets.particle.ParticleFoot; -import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; -import mineplex.core.gadget.gadgets.particle.ParticleMusic; -import mineplex.core.gadget.gadgets.particle.ParticlePartyTime; -import mineplex.core.gadget.gadgets.particle.ParticleRain; -import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; -import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; -import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; -import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; -import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; @@ -106,12 +93,6 @@ import mineplex.core.gadget.types.HatGadget; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.Mount; -import mineplex.core.mount.types.MountBabyReindeer; -import mineplex.core.mount.types.MountCart; -import mineplex.core.mount.types.MountFrost; -import mineplex.core.mount.types.MountMule; -import mineplex.core.mount.types.MountSlime; -import mineplex.core.mount.types.MountUndead; import mineplex.core.pet.Pet; import mineplex.core.pet.PetManager; import mineplex.core.reward.RewardPool.Type; @@ -641,8 +622,8 @@ public class RewardManager // addInventoryReward(Type.VALENTINES_GIFT, getGadget(ItemFlowerGift.class), rarity, 100, 0, 1, 1); // WINTER Gadgets - addGadget(Type.WINTER_HOLIDAY, getGadget(HatPresent.class), rarity, 5); - addGadget(Type.WINTER_HOLIDAY, getGadget(HatSnowman.class), rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5); } @@ -721,10 +702,10 @@ public class RewardManager // VALENTINES //Hats - addGadget(Type.VALENTINES_GIFT, getGadget(HatCompanionBlock.class), rarity, 100, 0); - addGadget(Type.VALENTINES_GIFT, getGadget(HatLovestruck.class), rarity, 100, 0); - addGadget(Type.VALENTINES_GIFT, getGadget(HatSecretPackage.class), rarity, 100, 0); - addGadget(Type.VALENTINES_GIFT, getGadget(HatTeddyBear.class), rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Companion_Block, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Lovestruck, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Secret_Package, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Teddy_Bear, rarity, 100, 0); // WINTER @@ -733,6 +714,12 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(DeathCandyCane.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(DoubleJumpFirecracker.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleCandyCane.class), rarity, 5); + + // FREEDOM + addHat(Type.FREEDOM, HatType.Uncle_Sam, rarity, 100); + addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50); + addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10); + addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75); } public void addLegendary() @@ -801,9 +788,9 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(DeathFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(DoubleJumpFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleFrostLord.class), rarity, 5); - addGadget(Type.WINTER_HOLIDAY, getGadget(HatGrinch.class), rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.Grinch, rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(MorphSnowman.class), rarity, 5); - addMount( Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); + addMount(Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); @@ -815,8 +802,12 @@ public class RewardManager addGadget(Type.VALENTINES_GIFT, getGadget(DeathCupidsBrokenHeart.class), rarity, 100); addGadget(Type.VALENTINES_GIFT, getGadget(DoubleJumpCupidsWings.class), rarity, 100); addGadget(Type.VALENTINES_GIFT, getGadget(ParticleHeart.class), rarity, 100, 0); - - + + + // FREEDOM + addMount(Type.FREEDOM, getMount(MountFreedomHorse.class), rarity, 1); + addGadget(Type.FREEDOM, getGadget(MorphUncleSam.class), rarity, 5); + addGadget(Type.FREEDOM, getGadget(ParticleFreedom.class), rarity, 50); } @@ -828,8 +819,8 @@ public class RewardManager public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight, int shards) { - UnknownPackageReward reward = new UnknownPackageReward(_donationManager, "Mount", mount.GetDisplayName(), mount.GetName(), - new ItemStack(mount.GetDisplayMaterial(), 1, (short) 0, (byte) mount.GetDisplayData()), rarity, weight, shards); + UnknownPackageReward reward = new UnknownPackageReward(_donationManager, "Mount", mount.getDisplayName(), mount.getName(), + new ItemStack(mount.getDisplayMaterial(), 1, (short) 0, (byte) mount.getDisplayData()), rarity, weight, shards); addReward(type, reward); return reward; } @@ -841,9 +832,9 @@ public class RewardManager public UnknownPackageReward addMusicReward(Type type, String musicDisk, RewardRarity rarity, int weight, int shards) { - for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MusicDisc)) + for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MUSIC_DISC)) { - if(gadget.GetName().equals(musicDisk) || gadget.GetName().equals(musicDisk + " Disk")) + if(gadget.getName().equals(musicDisk) || gadget.getName().equals(musicDisk + " Disk")) { return addGadget(type, gadget, rarity, weight, shards); } @@ -854,8 +845,8 @@ public class RewardManager public UnknownPackageReward addHatReward(RewardPool.Type type, HatGadget gadget, RewardRarity rarity, int weight) { UnknownPackageReward reward = - new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), gadget.GetDisplayName(), - gadget.GetName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity)); + new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), gadget.getDisplayName(), + gadget.getName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity)); addReward(type, reward); return reward; } @@ -868,9 +859,17 @@ public class RewardManager public UnknownPackageReward addGadget(RewardPool.Type type, Gadget gadget, String displayName, RewardRarity rarity, int weight, int shards) { + ItemStack display = new ItemStack(gadget.getDisplayMaterial(), 1, (short) 0, gadget.getDisplayData()); + if (type == Type.FREEDOM) + { + if (!displayName.contains("Uncle Sam")) + { + display = CountryFlag.Usa.getBanner(); + } + } UnknownPackageReward reward = new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), displayName, - gadget.GetName(), new ItemStack(gadget.GetDisplayMaterial(), 1, (short) 0, gadget.GetDisplayData()), rarity, + gadget.getName(), display, rarity, weight, shards); addReward(type, reward); return reward; @@ -878,7 +877,7 @@ public class RewardManager public UnknownPackageReward addGadget(RewardPool.Type type, Gadget gadget, RewardRarity rarity, int weight, int shards) { - return addGadget(type, gadget, gadget.GetDisplayName(), rarity, weight, shards); + return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); } public UnknownPackageReward addMineStrikeSkin(Type type, MineStrikeSkin skin, RewardRarity rarity, int weight) @@ -889,7 +888,18 @@ public class RewardManager public UnknownPackageReward addMineStrikeSkin(Type type, MineStrikeSkin skin, RewardRarity rarity, int weight, int shards) { Gadget gadget = _gadgetManager.getGameModifier(skin); - return addGadget(type, gadget, gadget.GetDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards); + return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards); + } + + public UnknownPackageReward addHat(Type type, HatType hatType, RewardRarity rarity, int weight) + { + return addHat(type, hatType, rarity, weight, getShards(rarity)); + } + + public UnknownPackageReward addHat(Type type, HatType hatType, RewardRarity rarity, int weight, int shards) + { + Gadget gadget = _gadgetManager.getHatGadget(hatType); + return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); } public InventoryReward addInventoryReward(RewardPool.Type type, ItemGadget gadget, RewardRarity rarity, int weight) @@ -905,9 +915,9 @@ public class RewardManager public InventoryReward addInventoryReward(RewardPool.Type type, ItemGadget gadget, RewardRarity rarity, int weight, int shards, int minAmmo, int maxAmmo) { - InventoryReward reward = new InventoryReward(_inventoryManager, gadget.GetDisplayName(), - gadget.GetName(), minAmmo, maxAmmo, - new ItemStack(gadget.GetDisplayMaterial(), 1, (short) 0, gadget.GetDisplayData()), rarity, weight, shards); + InventoryReward reward = new InventoryReward(_inventoryManager, gadget.getDisplayName(), + gadget.getName(), minAmmo, maxAmmo, + new ItemStack(gadget.getDisplayMaterial(), 1, (short) 0, gadget.getDisplayData()), rarity, weight, shards); addReward(type, reward); return reward; } @@ -921,7 +931,7 @@ public class RewardManager { Pet pet = _petManager.GetFactory().getPet(entityType); PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, - pet.GetName() + " Pet", pet.GetName(), entityType, rarity, weight, shards); + pet.getName() + " Pet", pet.getName(), entityType, rarity, weight, shards); addReward(type, reward); return reward; } @@ -1007,7 +1017,7 @@ public class RewardManager public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { int amount = 4; - if(type == RewardType.IlluminatedChest) amount = 1; + if(type == RewardType.IlluminatedChest || type == RewardType.FreedomChest) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index cd783ad51..05ecc8971 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -51,6 +51,7 @@ public class RewardPool WINTER_HOLIDAY(true), VALENTINES_GIFT(false), ILLUMINATED(false), + FREEDOM(false), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 04204d25b..c007105be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -12,6 +12,7 @@ public enum RewardType MythicalChest( 0.1, 4, 16, 72), WinterChest( 0, 5, 18, 32), IlluminatedChest( 0, 2, 16, 72), + FreedomChest( 0, 5, 18, 0), ValentinesGift( 0, 7, 20, 20), SpinnerFiller( 0.1, 1, 4, 20), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java new file mode 100644 index 000000000..7dd6903f9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java @@ -0,0 +1,11 @@ +package mineplex.core.shop.confirmation; + +/** + * @author Shaun Bennett + */ +public interface ConfirmationCallback +{ + public void resolve(String message); + + public void reject(String message); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java new file mode 100644 index 000000000..5bcdcfb82 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java @@ -0,0 +1,210 @@ +package mineplex.core.shop.confirmation; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +/** + * @author Shaun Bennett + */ +public class ConfirmationPage> extends ShopPageBase implements Runnable, ConfirmationCallback +{ + private int _taskId; + + private ShopPageBase _returnPage; + private ItemStack _displayItem; + + private ItemStack _progressItem = new ShopItem(Material.LAPIS_BLOCK, (byte)11, ChatColor.BLUE + "Processing", null, 1, false, true); + private int _okSquareSlotStart = 27; + private int _progressCount; + private ConfirmationProcessor _processor; + private boolean _processing; + + public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Player player, ShopPageBase returnPage, ConfirmationProcessor processor, ItemStack displayItem) + { + super(plugin, shop, clientManager, donationManager, "Confirmation", player); + + _returnPage = returnPage; + _displayItem = displayItem; + _processor = processor; + + buildPage(); + } + + @Override + protected void buildPage() + { + setItem(22, _displayItem); + + buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), this::okClicked); + buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), this::cancelClicked); + } + + protected void okClicked(Player player, ClickType clickType) + { + processTransaction(); + } + + protected void cancelClicked(Player player, ClickType clickType) + { + getPlugin().getScheduler().cancelTask(_taskId); + + if (_returnPage != null) + getShop().openPageForPlayer(player, _returnPage); + else + { + player.closeInventory(); + } + + } + + private void buildSquareAt(int slot, ShopItem item, IButton button) + { + addButton(slot, item, button); + addButton(slot + 1, item, button); + addButton(slot + 2, item, button); + + slot += 9; + + addButton(slot, item, button); + addButton(slot + 1, item, button); + addButton(slot + 2, item, button); + + slot += 9; + + addButton(slot, item, button); + addButton(slot + 1, item, button); + addButton(slot + 2, item, button); + } + + private void processTransaction() + { + for (int i=_okSquareSlotStart; i < 54; i++) + { + getButtonMap().remove(i); + clear(i); + } + + _processing = true; + + _processor.process(this); + + _taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L); + } + + private void buildErrorPage(String... message) + { + ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "" + ChatColor.UNDERLINE + "ERROR", message, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + addButton(i, item, this::cancelClicked); + } + + getPlayer().playSound(getPlayer().getLocation(), Sound.BLAZE_DEATH, 1, .1f); + } + + private void buildSuccessPage(String message) + { + ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + message, null, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + addButton(i, item, this::cancelClicked); + } + + getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, .9f); + } + + @Override + public void playerClosed() + { + super.playerClosed(); + + Bukkit.getScheduler().cancelTask(_taskId); + + if (_returnPage != null && getShop() != null) + getShop().setCurrentPageForPlayer(getPlayer(), _returnPage); + } + + @Override + public void run() + { + if (_processing) + { + if (_progressCount == 9) + { + for (int i=45; i < 54; i++) + { + clear(i); + } + + _progressCount = 0; + } + + setItem(45 + _progressCount, _progressItem); + } + else + { + if (_progressCount >= 20) + { + try + { + Bukkit.getScheduler().cancelTask(_taskId); + + if (_returnPage != null && getShop() != null) + { + getShop().openPageForPlayer(getPlayer(), _returnPage); + } + else if (getPlayer() != null) + { + getPlayer().closeInventory(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + finally + { + dispose(); + } + } + } + + _progressCount++; + } + + @Override + public void dispose() + { + super.dispose(); + + Bukkit.getScheduler().cancelTask(_taskId); + } + + @Override + public void resolve(String message) + { + _processing = false; + buildSuccessPage(message); + _progressCount = 0; + } + + @Override + public void reject(String message) + { + _processing = false; + buildErrorPage(message); + _progressCount = 0; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java new file mode 100644 index 000000000..318eead76 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java @@ -0,0 +1,9 @@ +package mineplex.core.shop.confirmation; + +/** + * @author Shaun Bennett + */ +public interface ConfirmationProcessor +{ + public void process(ConfirmationCallback callback); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java index 4dc987a37..3cd7b949f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java @@ -5,8 +5,8 @@ import mineplex.core.donation.repository.GameSalesPackageToken; public interface ICurrencyPackage { - int GetSalesPackageId(); - int GetCost(CurrencyType currencytype); - boolean IsFree(); - void Update(GameSalesPackageToken token); + int getSalesPackageId(); + int getCost(CurrencyType currencytype); + boolean isFree(); + void update(GameSalesPackageToken token); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java index 48e1a5f0a..da067afbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java @@ -4,8 +4,8 @@ import org.bukkit.Material; public interface IDisplayPackage { - String GetName(); - String[] GetDescription(); - Material GetDisplayMaterial(); - byte GetDisplayData(); + String getName(); + String[] getDescription(); + Material getDisplayMaterial(); + byte getDisplayData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java index 8075278d1..51dee3397 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java @@ -53,52 +53,52 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack Quantity = quantity; } - public abstract void Sold(Player player, CurrencyType currencyType); + public abstract void sold(Player player, CurrencyType currencyType); @Override - public String GetName() + public String getName() { return Name; } @Override - public String[] GetDescription() + public String[] getDescription() { return Description; } @Override - public int GetCost(CurrencyType currencyType) + public int getCost(CurrencyType currencyType) { return CurrencyCostMap.containsKey(currencyType) ? CurrencyCostMap.get(currencyType) : 0; } @Override - public int GetSalesPackageId() + public int getSalesPackageId() { return SalesPackageId; } @Override - public boolean IsFree() + public boolean isFree() { return Free; } @Override - public Material GetDisplayMaterial() + public Material getDisplayMaterial() { return _displayMaterial; } @Override - public byte GetDisplayData() + public byte getDisplayData() { return _displayData; } @Override - public void Update(GameSalesPackageToken token) + public void update(GameSalesPackageToken token) { SalesPackageId = token.GameSalesPackageId; Free = token.Free; @@ -114,17 +114,17 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack return Quantity; } - public boolean IsKnown() + public boolean isKnown() { return KnownPackage; } - public boolean OneTimePurchase() + public boolean oneTimePurchase() { return OneTimePurchaseOnly; } - public String GetDisplayName() + public String getDisplayName() { return DisplayName; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java index 50964a274..75102a07b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java @@ -56,7 +56,7 @@ public class ConfirmationPage goldCount) showResultsPage(TransactionResponse.InsufficientFunds); @@ -160,7 +160,7 @@ public class ConfirmationPage() { @@ -168,7 +168,7 @@ public class ConfirmationPage _treasureLocations; - public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) + public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, GadgetManager gadgetManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) { super("Treasure", plugin); @@ -63,7 +64,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(-18, 72, -16); Block chestLoc8 = world.getBlockAt(-16, 72, -18); Location resetLocation = new Location(world, -23.5, 72, -23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } { @@ -77,7 +78,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(18, 72, 16); Block chestLoc8 = world.getBlockAt(16, 72, 18); Location resetLocation = new Location(world, 23.5, 72, 23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } { @@ -91,7 +92,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(18, 72, -16); Block chestLoc8 = world.getBlockAt(16, 72, -18); Location resetLocation = new Location(world, 23.5, 72, -23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } { @@ -105,7 +106,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(-18, 72, 16); Block chestLoc8 = world.getBlockAt(-16, 72, 18); Location resetLocation = new Location(world, -23.5, 72, 23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } for (TreasureLocation treasureLocation : _treasureLocations) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index d197de0af..671ca2ba1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -40,6 +40,14 @@ public enum TreasureStyle ParticleType.WITCH_MAGIC, Sound.ENDERDRAGON_DEATH, Sound.BLAZE_HIT + ), + + FREEDOM( + ParticleType.RED_DUST, + ParticleType.RED_DUST, + ParticleType.RED_DUST, + Sound.FIZZ, + Sound.FIREWORK_TWINKLE2 ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 16617da09..6e424f0b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -16,7 +16,9 @@ public enum TreasureType CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), - ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000); + ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000), + + FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FreedomChest, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 432807504..4ec8090b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -69,6 +69,11 @@ public class BlockChangeAnimation extends Animation mat = Material.PRISMARINE; data = 1; } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + mat = Material.WOOL; + data = 11; + } else continue; @@ -91,6 +96,11 @@ public class BlockChangeAnimation extends Animation mat = Material.PRISMARINE; data = 2; } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + mat = Material.WOOL; + data = 14; + } else continue; @@ -111,6 +121,18 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + for(Block c : _chests) + { + if(c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + b.setType(Material.WOOL); + b.setData((byte) 0); + } + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java index 251db9632..6b723e8f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.animation; +import mineplex.core.common.util.banner.CountryFlag; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -74,7 +75,7 @@ public class ChestOpenAnimation extends Animation { double y = UtilBlock.getSize(_chestData.getBlock(), BlockFace.UP); Location location = _chestData.getBlock().getLocation().add(0.5, y, 0.5); - _itemEntity = location.getWorld().dropItem(location, _rewardData.getDisplayItem()); + _itemEntity = location.getWorld().dropItem(location, _rewardData.getDisplayItem()); _itemEntity.setVelocity(new Vector(0, 0, 0)); _itemEntity.setPickupDelay(Integer.MAX_VALUE); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 199f7954f..29d6a816f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,7 +1,11 @@ package mineplex.core.treasure.animation; +import java.awt.*; import java.util.List; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; @@ -10,6 +14,7 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; import net.minecraft.server.v1_8_R3.BlockPosition; @@ -43,7 +48,10 @@ public class ChestSpawnAnimation extends Animation private double _radialOffset; - public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset) + private JavaPlugin _javaPlugin; + private int _babyFireworks = 0; + + public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { super(treasure); _block = block; @@ -74,6 +82,8 @@ public class ChestSpawnAnimation extends Animation _radialOffset = radialOffset; + + _javaPlugin = javaPlugin; } @Override @@ -140,6 +150,20 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticleToAll(ParticleType.PORTAL, loc, null, 0.55f, 20, ViewDist.NORMAL); } } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + if (_babyFireworks <= 2) + { + Location loc = _centerLocation.clone().add(Vector.getRandom().subtract(Vector.getRandom()).multiply(0.5)); + + int r = (int) (Math.random() * 3); + + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(loc, _javaPlugin, (r == 0) ? + Color.RED : (r == 1) ? Color.WHITE : Color.BLUE); + babyFireworkEffect.start(); + _babyFireworks++; + } + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) @@ -159,15 +183,25 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), loc, 0.7f, 0.7f, 0.7f, 1, 50, ViewDist.NORMAL, UtilServer.getPlayers()); } - + UtilParticle.ParticleType particleType = getTreasure().getTreasureType().getStyle().getChestSpawnParticle(); if (particleType != null) { - UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, - ViewDist.NORMAL, UtilServer.getPlayers()); - + if (getTreasure().getTreasureType() != TreasureType.FREEDOM) + { + UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + int r = (int) (Math.random() * 3); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.RED : (r == 1) ? Color.WHITE : Color.BLUE), + _centerLocation.clone().add(.5, .5, .5)); + coloredParticle.display(); + } } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java new file mode 100644 index 000000000..64f09c1d8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java @@ -0,0 +1,37 @@ +package mineplex.core.treasure.animation; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.treasure.Treasure; +import org.bukkit.Location; + +public class FreedomChestAnimation extends Animation +{ + + private Location _centerLocation; + + public FreedomChestAnimation(Treasure treasure, Location location) + { + super(treasure); + _centerLocation = location; + } + + @Override + protected void tick() + { + if (getTicks() == 2) + { + UtilFirework.playFreedomFirework(_centerLocation); + } + else if (getTicks() >= 60) + { + finish(); + } + } + + @Override + protected void onFinish() + { + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 81ad47721..21bc6b37e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -22,9 +22,10 @@ public class BuyChestButton implements IButton private String _chestName; private Material _chestMat; private int _chestCost; + private TreasureType _chestType; public BuyChestButton(InventoryManager inventoryManager, TreasurePage page, - String chestName, Material chestMat, int chestCost) + String chestName, Material chestMat, int chestCost, TreasureType chestType) { _inventoryManager = inventoryManager; @@ -33,12 +34,14 @@ public class BuyChestButton implements IButton _chestName = chestName; _chestMat = chestMat; _chestCost = chestCost; + _chestType = chestType; } @Override public void onClick(final Player player, ClickType clickType) { - if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player)) + if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player) + && _chestType == TreasureType.ILLUMINATED) { player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index e44327fa2..3b91b09f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -3,6 +3,15 @@ package mineplex.core.treasure.gui; import java.util.ArrayList; import java.util.List; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.morph.MorphUncleSam; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.mount.Mount; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -24,13 +33,15 @@ public class TreasurePage extends ShopPageBase { private TreasureLocation _treasureLocation; private InventoryManager _inventoryManager; + private GadgetManager _gadgetManager; - public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, Player player) + public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, Player player) { super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 54); _treasureLocation = treasureLocation; _inventoryManager = inventoryManager; + _gadgetManager = gadgetManager; buildPage(); } @@ -45,6 +56,7 @@ public class TreasurePage extends ShopPageBase int legendaryCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MYTHICAL.getItemName()); int christmasCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.CHRISTMAS.getItemName()); int illuminatedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ILLUMINATED.getItemName()); + int freedomCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.FREEDOM.getItemName()); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -146,17 +158,39 @@ public class TreasurePage extends ShopPageBase illuminatedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } + List freedomLore = new ArrayList<>(); + freedomLore.add(" "); + freedomLore.add(F.value("Freedom Chests Owned", "" + freedomCount)); + freedomLore.add(" "); + freedomLore.add(C.cGray + "It is said that George Washington"); + freedomLore.add(C.cGray + "carved this chest himself from the wood"); + freedomLore.add(C.cGray + "of the apple tree he cut down..."); + freedomLore.add(" "); + if (freedomCount > 0) + freedomLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + else + { + freedomLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "35000 Treasure Shards"); + freedomLore.add(" "); + freedomLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + freedomLore.add(" "); + freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Treasure", heroicLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Treasure", legendaryLore.toArray(new String[0]), 0, false, false); ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); + ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore); addItem(40, shards); - addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount); - addChest(14, illuminated, TreasureType.ILLUMINATED, illuminatedCount); + addChest(11, christmas, TreasureType.CHRISTMAS, christmasCount); + if (!hasAllFreedomItems(getPlayer())) + addChest(13, freedom, TreasureType.FREEDOM, freedomCount); + addChest(15, illuminated, TreasureType.ILLUMINATED, illuminatedCount); addChest(20, basic, TreasureType.OLD, basicCount); addChest(22, heroic, TreasureType.ANCIENT, heroicCount); addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount); @@ -164,27 +198,60 @@ public class TreasurePage extends ShopPageBase private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) { - boolean testServer = getPlugin().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + //boolean testServer = getPlugin().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - testServer = false; + //testServer = false; // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - if(testServer) + /*if(testServer) { addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); return; - } + }*/ if (owned > 0) { addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); } else if (treasureType.isPurchasable()) { - addButton(slot, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice())); + addButton(slot, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice(), treasureType)); } else { setItem(slot, item); } } + + public boolean hasAllFreedomItems(Player player) + { + return !getPlugin().hasItemsToGivePlayer(TreasureType.FREEDOM.getRewardPool(), player); + } + + public int getFreedomUnlockedAmount(Player player) + { + if (hasAllFreedomItems(player)) + return 7; + int amount = 0; + Gadget[] gadgets = new Gadget[] + { + _gadgetManager.getGadget("Uncle Sam Hat", GadgetType.HAT), + _gadgetManager.getGadget(ParticleFreedom.class), + _gadgetManager.getGadget(ArrowTrailFreedom.class), + _gadgetManager.getGadget(DoubleJumpFreedom.class), + _gadgetManager.getGadget(DeathFreedom.class), + _gadgetManager.getGadget(MorphUncleSam.class) + }; + Mount freedomMount = _gadgetManager.getMountManager().getMount("Freedom Mount"); + if (freedomMount != null) + { + if (freedomMount.hasMount(player)) + amount++; + } + for (Gadget gadget : gadgets) + { + if (gadget.ownsGadget(player)) + amount++; + } + return amount; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java index ac345e064..3a421de6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.gui; +import mineplex.core.gadget.GadgetManager; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; @@ -14,17 +15,19 @@ public class TreasureShop extends ShopBase { private TreasureLocation _treasureLocation; private InventoryManager _inventoryManager; + private GadgetManager _gadgetManager; - public TreasureShop(TreasureManager plugin, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, TreasureLocation treasureLocation) + public TreasureShop(TreasureManager plugin, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, TreasureLocation treasureLocation) { super(plugin, clientManager, donationManager, "Treasure Shop"); _treasureLocation = treasureLocation; _inventoryManager = inventoryManager; + _gadgetManager = gadgetManager; } @Override protected ShopPageBase> buildPagesFor(Player player) { - return new TreasurePage(getPlugin(), this, _treasureLocation, getClientManager(), getDonationManager(), _inventoryManager, player); + return new TreasurePage(getPlugin(), this, _treasureLocation, getClientManager(), getDonationManager(), _inventoryManager, _gadgetManager, player); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java new file mode 100644 index 000000000..fb28e1cba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java @@ -0,0 +1,23 @@ +package mineplex.core.youtube; + +import java.time.LocalDate; + +public class YoutubeClient +{ + private LocalDate _clickDate; + + public YoutubeClient(LocalDate date) + { + this._clickDate = date; + } + + public LocalDate getClickDate() + { + return _clickDate; + } + + public void setClickDate(LocalDate date) + { + _clickDate = date; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java new file mode 100644 index 000000000..45963b9b8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -0,0 +1,75 @@ +package mineplex.core.youtube; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.time.LocalDate; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; + +public class YoutubeManager extends MiniDbClientPlugin +{ + private final YoutubeRepository _repository; + private final DonationManager _donationManager; + + public YoutubeManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super("YoutubeManager", plugin, clientManager); + _donationManager = donationManager; + _repository = new YoutubeRepository(this); + } + + public boolean canYoutube(Player player) + { + YoutubeClient client = Get(player); + LocalDate date = client.getClickDate(); + + if (date == null) + { + return true; + } + + ZonedDateTime utcZoned = ZonedDateTime.now(ZoneOffset.UTC); + LocalDate utc = utcZoned.toLocalDate(); + + return !date.equals(utc); + } + + public void attemptYoutube(Player player) + { + if (!canYoutube(player)) + { + return; + } + YoutubeClient client = Get(player); + client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate()); + _repository.attemptYoutube(player, client, () -> _donationManager.RewardCoinsLater("YouTube", player, 250)); + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + boolean hasRow = resultSet.next(); + if (hasRow) + Set(playerName, new YoutubeClient(resultSet.getDate(1).toLocalDate())); + else + Set(playerName, new YoutubeClient(null)); + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT clicktime FROM youtube WHERE accountId=" + accountId + ";"; + } + + @Override + protected YoutubeClient AddPlayer(String player) + { + return new YoutubeClient(null); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java new file mode 100644 index 000000000..7e437d0cf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java @@ -0,0 +1,43 @@ +package mineplex.core.youtube; + +import mineplex.serverdata.database.DBPool; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class YoutubeRepository +{ + private final YoutubeManager _manager; + + public YoutubeRepository(YoutubeManager manager) + { + _manager = manager; + } + + public void attemptYoutube(Player player, YoutubeClient client, Runnable runnable) + { + int accountId = _manager.getClientManager().Get(player).getAccountId(); + + Bukkit.getScheduler().runTaskAsynchronously(_manager.getPlugin(), () -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement("REPLACE INTO youtube (accountId, clicktime) VALUES (?, ?)"); + statement.setInt(1, accountId); + statement.setDate(2, Date.valueOf(client.getClickDate())); + statement.executeUpdate(); + + runnable.run(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + }); + } + +} diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index c19ccea17..3c569acb1 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -23,7 +23,6 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.gadgets.item.ItemGemBooster; import mineplex.core.inventory.InventoryManager; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; @@ -290,7 +289,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), "Gem Boosters", amount, response); } - }, client.getAccountId(), ItemGemBooster.NAME, amount); + }, client.getAccountId(), "Game Booster", amount); return true; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index 11f7fdf5d..7ec9d898a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -304,10 +304,11 @@ public class ClansGame extends MiniPlugin return; } - // Banners/String + // Banners/String/Heads if (player.getGameMode() != GameMode.CREATIVE && player.getItemInHand() != null) { - if (player.getItemInHand().getType() == Material.BANNER || player.getItemInHand().getType() == Material.STRING) + if (player.getItemInHand().getType() == Material.BANNER || player.getItemInHand().getType() == Material.STRING + || player.getItemInHand().getType() == Material.SKULL_ITEM) { Location destLocation = event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(); ClanTerritory territory = _clans.getClanUtility().getClaim(destLocation); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index e4c59cab3..e4c0c7719 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -89,11 +89,14 @@ import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.mechanics.Weapon; import mineplex.serverdata.commands.ServerCommandManager; +import net.md_5.bungee.api.ChatColor; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -242,6 +245,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _condition = new SkillConditionManager(plugin); _damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition); _damageManager.addCommand(new KillCommand(_damageManager)); + _condition.setDamageManager(_damageManager); _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null); @@ -320,6 +324,19 @@ public class ClansManager extends MiniClientPluginimplements IRelati Material targetType = event.getTargetBlock().getType(); event.setCancelled(targetType == Material.POTATO || targetType == Material.CARROT); } + + @EventHandler + public void on(CustomDamageEvent event) + { + if (event.GetCause() == EntityDamageEvent.DamageCause.CUSTOM + && event.GetDamageInitial() == 0.1 + && event.GetDamageePlayer() != null) + { + Condition poisonShock = _condition.GetActiveCondition(event.GetDamageePlayer(), Condition.ConditionType.POISON_SHOCK); + if (poisonShock != null) + event.SetIgnoreArmor(true); + } + } }); _worldEvent.setFactory(skillManager); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java index 151567dbd..611838bd7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java @@ -1,6 +1,7 @@ package mineplex.game.clans.clans.commands; import mineplex.game.clans.clans.ClansManager; +import mineplex.minecraft.game.classcombat.Skill.Global.Recharge; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; @@ -29,6 +30,11 @@ public class KillCommand extends CommandBase UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in the tutorial.")); return; } + if (mineplex.core.recharge.Recharge.Instance.use(caller, "Suicide", 5000, false, false)) + { + UtilPlayer.message(caller, F.main("Clans", "Please wait a bit before suiciding")); + return; + } UtilPlayer.message(caller, F.main("Clans", "You have imploded.")); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java index 6fe27d3ad..5550d370a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java @@ -62,7 +62,7 @@ public class ClanWhoPage extends ClanPageBase // Basic Clan Info lore.add(C.Reset + C.cYellow + "Founder " + C.cWhite + _lookupClan.getDesc()); - lore.add(C.Reset + C.cYellow + "Formed " + C.cWhite + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT)); + lore.add(C.Reset + C.cYellow + "Formed " + C.cWhite + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT) + " ago on " + UtilTime.when(_lookupClan.getDateCreated().getTime())); lore.add(C.Reset + C.cYellow + "Members " + C.cWhite + _lookupClan.getOnlinePlayerCount() + "/" + _lookupClan.getMembers().size()); lore.add(C.Reset + C.cYellow + "Territory " + C.cWhite + _lookupClan.getClaims() + "/" + _lookupClan.getClaimsMax()); lore.add(C.Reset + C.cYellow + "TNT Protection " + C.cWhite + _lookupClan.getProtected()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java index d103b3139..fc736b4f8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java @@ -488,8 +488,8 @@ public class ItemMapManager extends MiniPlugin } else { - System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %z, z: %s, zoom: %s", - color, scale, startingX, startingZ, x, z, zoom)); +// System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %s, z: %s, zoom: %s", +// color, scale, startingX, startingZ, x, z, zoom)); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java index fe8880d24..bc9be3fff 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java @@ -119,9 +119,9 @@ public class PotatoManager extends MiniPlugin implements IThrown give(player, 1); } - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java index 33c7a5cba..c09ec8f6d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java @@ -530,6 +530,7 @@ public abstract class SiegeWeapon implements Listener new Hologram( _siegeManager.getClansManager().getHologramManager(), _location.clone().add(UtilMath.random(-1, 1),1.4, UtilMath.random(-1, 1)), + false, 3500l, C.cRed + "-" + health) .start(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java index 6f2f53e2e..5c6efc612 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java @@ -1,42 +1,26 @@ package mineplex.game.clans.gameplay; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; -import mineplex.core.packethandler.PacketInfo; import mineplex.game.clans.clans.ClansManager; -import net.minecraft.server.v1_8_R3.BaseBlockPosition; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; -import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Chest; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.InventoryWrapper; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; public class HiddenChestManager implements Listener { - private final Set _locationsToCancel = Collections.synchronizedSet(new HashSet<>()); - private final Set _fine = new HashSet<>(); private final ClansManager _clansManager; public HiddenChestManager(ClansManager clansManager, PacketHandler packetHandler) { this._clansManager = clansManager; - UtilServer.RegisterEvents(this); -// packetHandler.addPacketHandler(this, PacketPlayOutBlockAction.class, PacketPlayOutNamedSoundEffect.class); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -63,49 +47,9 @@ public class HiddenChestManager implements Listener return; } - Location location = event.getClickedBlock().getLocation(); - - if (!_fine.contains(event.getPlayer().getName())) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Clans", "Opening chests while vanished will still make the chest open noise")); - UtilPlayer.message(event.getPlayer(), F.main("Clans", "If you are sure, run /IUnderstandOpeningChestsWillMakeNoise")); - } - -// _locationsToCancel.add(new BaseBlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + Chest chest = (Chest) event.getClickedBlock().getState(); + event.getPlayer().openInventory(new CraftInventory(new InventoryWrapper(chest.getInventory()))); + event.setCancelled(true); + //fixme opened chest has name "container.chest" and that looks bad } - - @EventHandler - public void areYouReallySureYouWantTo(PlayerCommandPreprocessEvent event) - { - if (event.getMessage().equalsIgnoreCase("/IUnderstandOpeningChestsWillMakeNoise")) - { - _fine.add(event.getPlayer().getName()); - event.setCancelled(true); - } - } - -// @Override -// public void handle(PacketInfo packetInfo) -// { -// if (packetInfo.getPacket() instanceof PacketPlayOutBlockAction) -// { -// PacketPlayOutBlockAction blockAction = (PacketPlayOutBlockAction) packetInfo.getPacket(); -// if (_locationsToCancel.contains(blockAction.a)) -// { -// System.out.println(blockAction.b + " " + blockAction.c); -// packetInfo.setCancelled(true); -// if (blockAction.c == 0) -// { -// _locationsToCancel.remove(blockAction.a); -// } -// } -// } -// else if (packetInfo.getPacket() instanceof PacketPlayOutNamedSoundEffect) -// { -// PacketPlayOutNamedSoundEffect soundEffect = (PacketPlayOutNamedSoundEffect) packetInfo.getPacket(); -// -// System.out.println(soundEffect.a); -// } -// } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java index 8d819ff9b..db6fa935f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java @@ -58,7 +58,10 @@ public class SafeLog extends MiniPlugin if (!isSafeLog) { - NPCManager.getInstance().spawnLogoutNpc(player); + if (!_clansManager.getIncognitoManager().Get(player).Status) + { + NPCManager.getInstance().spawnLogoutNpc(player); + } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java index 116cb315c..a16b7529b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java @@ -6,6 +6,9 @@ import java.util.UUID; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemFactory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEvent; @@ -105,7 +108,7 @@ public class CustomItem implements Listener public ItemStack toItemStack(int amount) { - ItemStack item = new ItemStack(_material, amount); + ItemStack item = CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(new ItemStack(_material, amount))); update(item); if (_dullEnchantment) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java index 015ad9280..43849130c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java @@ -2,6 +2,8 @@ package mineplex.game.clans.items; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; @@ -11,6 +13,9 @@ import java.util.Set; import java.util.UUID; import com.google.gson.JsonSyntaxException; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.game.clans.clans.ClansManager; import net.minecraft.server.v1_8_R3.NBTBase; import net.minecraft.server.v1_8_R3.NBTTagByte; import net.minecraft.server.v1_8_R3.NBTTagString; @@ -83,21 +88,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems; */ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { - private static final Field UNHANDLED_TAGS_FIELD; - - static - { - try - { - UNHANDLED_TAGS_FIELD = Class.forName("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem").getDeclaredField("unhandledTags"); - UNHANDLED_TAGS_FIELD.setAccessible(true); - } - catch (Throwable t) - { - throw new RuntimeException("Error getting unhandledTags field", t); - } - } - private static final String ITEM_SERIALIZATION_TAG = "-JSON-"; private static final Gson GSON; @@ -623,7 +613,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return null; } - CraftItemStack originalItem = CraftItemStack.asCraftMirror(item); + CraftItemStack originalItem = CraftItemStack.asCraftMirror(item.cloneItemStack()); ItemMeta originalMeta = originalItem.getItemMeta(); // No need to modify item packets with no lore @@ -658,6 +648,11 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable newLore.add(" "); newLore.add(C.cWhite + "Original Owner: " + C.cYellow + originalOwner); } + if (ci != null) + { + newLore.add(" "); + newLore.add(C.cWhite + "UUID: " + C.cYellow + ci._uuid); + } net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem); CraftItemStack newCopy = CraftItemStack.asCraftMirror(newItem); @@ -672,7 +667,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable List cleansed = new ArrayList<>(); for (String s : input) { - if (!s.startsWith(ITEM_SERIALIZATION_TAG)) + if (s.startsWith(ITEM_SERIALIZATION_TAG)) { cleansed.add(s); } @@ -689,40 +684,35 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable // This will not be persistent if the ItemStack is a block and placed then picked up private static Map getUnhandledTags(ItemStack itemStack) { - ItemMeta itemMeta = itemStack.getItemMeta(); - if (itemMeta == null) + net.minecraft.server.v1_8_R3.ItemStack handle = ((CraftItemStack) itemStack).getHandle(); + if (handle == null) + return Collections.emptyMap(); + + NBTTagCompound tag = handle.getTag(); + + if (tag == null) + return Collections.emptyMap(); + + Map unhandled = new HashMap<>(); + for (String name : tag.c()) { - return null; + unhandled.put(name, tag.get(name)); } - try - { - return (Map) UNHANDLED_TAGS_FIELD.get(itemMeta); - } - catch (IllegalAccessException e) - { - System.out.println("Could not get unhandledTags"); - e.printStackTrace(); - } - return null; + return unhandled; } private static void saveUnhandledTags(ItemStack itemStack, Map map) { - ItemMeta itemMeta = itemStack.getItemMeta(); - if (itemMeta == null) + net.minecraft.server.v1_8_R3.ItemStack handle = ((CraftItemStack) itemStack).getHandle(); + NBTTagCompound tag = handle.getTag(); + + if (tag != null) { - return; + for (String name : map.keySet()) + { + tag.set(name, map.get(name)); + } } - try - { - UNHANDLED_TAGS_FIELD.set(itemMeta, map); - } - catch (IllegalAccessException e) - { - System.out.println("Could not get unhandledTags"); - e.printStackTrace(); - } - itemStack.setItemMeta(itemMeta); } public static void save(ItemStack itemStack, boolean remove) @@ -735,7 +725,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable saveUnhandledTags(itemStack, data); if (remove) { - _customItemCache.remove(item); + _customItemCache.remove(UUID.fromString(item._uuid)); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java index c3bbbf9a8..02ff57e7e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java @@ -16,6 +16,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; @@ -44,7 +45,7 @@ public class ItemListener implements Listener, Runnable public ItemListener(JavaPlugin plugin) { _plugin = plugin; - _plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 20 * 60 * 5, 0); + _plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 0, 20 * 60 * 5); } @Override @@ -65,7 +66,7 @@ public class ItemListener implements Listener, Runnable private void save(Player player, boolean remove) { - for (ItemStack item : UtilInv.getItems(player)) + for (ItemStack item : UtilInv.getItemsUncloned(player)) { GearManager.save(item, remove); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java index f01f68886..f27d909df 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java @@ -13,7 +13,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class LegendaryItem extends CustomItem { - private final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms + private static final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms protected long _lastBlock; // Timestamp of last block from wielder diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyPackage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyPackage.java index dcbe58b56..5cbea79d1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyPackage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyPackage.java @@ -18,7 +18,7 @@ public class EnergyPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 25eec9eb2..e0ab5a259 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -1,6 +1,7 @@ package mineplex.hub; import mineplex.core.brawl.fountain.FountainManager; +import com.avaje.ebean.config.ServerConfig; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -14,9 +15,6 @@ import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.boosters.BoosterManager; import mineplex.core.chat.Chat; -import mineplex.core.chatsnap.SnapshotManager; -import mineplex.core.chatsnap.SnapshotPlugin; -import mineplex.core.chatsnap.publishing.SnapshotPublisher; import mineplex.core.command.CommandCenter; import mineplex.core.common.events.ServerShutdownEvent; import mineplex.core.creature.Creature; @@ -49,8 +47,6 @@ import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; -import mineplex.core.report.ReportManager; -import mineplex.core.report.ReportPlugin; import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.sponsorbranding.BrandingManager; @@ -102,6 +98,7 @@ public class Hub extends JavaPlugin implements IRelation new VelocityFix(this); //Static Modules + new ProfileCacheManager(this); CommandCenter.Initialize(this); CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); CommandCenter.Instance.setClientManager(clientManager); @@ -114,7 +111,7 @@ public class Hub extends JavaPlugin implements IRelation BlockRestore blockRestore = new BlockRestore(this); DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress); - new ServerConfiguration(this, clientManager); + ServerConfiguration serverConfiguration = new ServerConfiguration(this, clientManager); //Other Modules PacketHandler packetHandler = new PacketHandler(this); @@ -155,9 +152,10 @@ public class Hub extends JavaPlugin implements IRelation CustomDataManager customDataManager = new CustomDataManager(this, clientManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); - BoosterManager boosterManager = new BoosterManager(this, clientManager, donationManager, inventoryManager); + String boosterGroup = serverConfiguration.getServerGroup().getBoosterGroup(); + BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, boosterManager); HologramManager hologramManager = new HologramManager(this, packetHandler); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, hologramManager, npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, boosterManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); ServerManager serverManager = new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager, boosterManager); @@ -199,9 +197,7 @@ public class Hub extends JavaPlugin implements IRelation new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true); - - new ProfileCacheManager(this); - + //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index c9f4c0bd1..f53d023f4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,49 +1,4 @@ package mineplex.hub; - -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; - -import mineplex.core.boosters.BoosterManager; -import mineplex.core.brawl.fountain.FountainManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Egg; -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.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerVelocityEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -52,17 +7,10 @@ import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.benefit.BenefitManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.bonuses.BonusManager; +import mineplex.core.boosters.BoosterManager; import mineplex.core.botspam.BotSpamManager; import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.*; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; @@ -105,21 +53,9 @@ import mineplex.core.treasure.TreasureManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.valentines.ValentinesGiftManager; -import mineplex.hub.commands.DisguiseCommand; -import mineplex.hub.commands.ForcefieldRadius; -import mineplex.hub.commands.GadgetToggle; -import mineplex.hub.commands.GameModeCommand; -import mineplex.hub.commands.NewsCommand; -import mineplex.hub.modules.ForcefieldManager; -import mineplex.hub.modules.HubVisibilityManager; -import mineplex.hub.modules.JumpManager; -import mineplex.hub.modules.KothManager; -import mineplex.hub.modules.NewsManager; -import mineplex.hub.modules.ParkourManager; -import mineplex.hub.modules.SoccerManager; -import mineplex.hub.modules.TextManager; -import mineplex.hub.modules.ValentinesManager; -import mineplex.hub.modules.WorldManager; +import mineplex.core.youtube.YoutubeManager; +import mineplex.hub.commands.*; +import mineplex.hub.modules.*; import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.tutorial.TutorialManager; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; @@ -133,6 +69,36 @@ import net.md_5.bungee.api.chat.HoverEvent.Action; import net.md_5.bungee.api.chat.TextComponent; import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityPlayer; +import org.bukkit.*; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Egg; +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.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.*; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Random; public class HubManager extends MiniClientPlugin { @@ -227,11 +193,13 @@ public class HubManager extends MiniClientPlugin _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); - - _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); + YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, boosterManager); + + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); + new SoccerManager(this, _gadgetManager); new KothManager(this, _gadgetManager); @@ -1070,7 +1038,7 @@ public class HubManager extends MiniClientPlugin @EventHandler public void disableMusicChristmas(GadgetEnableEvent event) { - if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc) + if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MUSIC_DISC) { UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!")); event.setCancelled(true); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java index fa0c65c2b..bc34a9e79 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java @@ -1,7 +1,6 @@ package mineplex.hub.commands; import java.lang.reflect.Field; -import java.util.List; import java.util.UUID; import mineplex.core.account.CoreClient; @@ -18,9 +17,7 @@ import mineplex.core.disguise.PlayerUndisguiseEvent; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.punish.Category; import mineplex.core.punish.PunishClient; -import mineplex.core.punish.Punishment; import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -28,15 +25,12 @@ import mineplex.hub.HubManager; import net.minecraft.server.v1_8_R3.ChatComponentText; import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.EnumDifficulty; import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; -import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode; -import net.minecraft.server.v1_8_R3.WorldType; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -219,7 +213,7 @@ public class DisguiseCommand extends CommandBase implements Listener changeName(caller, args[0], true); - Plugin.GetGadget().removeGadgetType(caller, GadgetType.Item); + Plugin.GetGadget().removeGadgetType(caller, GadgetType.ITEM); // Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller)); UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + args[0])); @@ -405,7 +399,7 @@ public class DisguiseCommand extends CommandBase implements Listener @EventHandler public void gadget(GadgetEnableEvent event) { - if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) + if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.MORPH) return; if(_disguisedPlayers.containsKey(event.getPlayer())) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java index 4aec41006..6c0ad0d5b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java @@ -12,7 +12,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerVelocityEvent; import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; @@ -69,7 +68,7 @@ public class KothManager extends MiniPlugin _cp = new CapturePoint(this, "Desert Pyramid", new Location(Manager.GetSpawn().getWorld(), -95.5,72,54.5)); //Store Gadgets - for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume)) + for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { @@ -77,7 +76,7 @@ public class KothManager extends MiniPlugin } } - for (Gadget gadget : gadgets.getGadgets(GadgetType.Item)) + for (Gadget gadget : gadgets.getGadgets(GadgetType.ITEM)) { if (gadget instanceof ItemDuelingSword) { @@ -100,7 +99,7 @@ public class KothManager extends MiniPlugin //All peices are always same color! for (OutfitTeam outfit : _teamArmor) { - if (outfit.IsActive(player)) + if (outfit.isActive(player)) return outfit.getTeamColor(player); } @@ -174,7 +173,7 @@ public class KothManager extends MiniPlugin { if (enabled) { - _kothSword.Enable(player); + _kothSword.enable(player); _active.add(player); @@ -196,13 +195,13 @@ public class KothManager extends MiniPlugin outfit.add("Team Boots"); outfit.add("PvP Sword"); - Manager.GetGadget().DisableAll(player, outfit); + Manager.GetGadget().disableAll(player, outfit); Manager.GetMount().DisableAll(player); Manager.getPetManager().DisableAll(player); } else { - _kothSword.Disable(player); + _kothSword.disable(player); _active.remove(player); UtilPlayer.message(player, F.main("KOTH", "You have exited " + F.elem("KOTH Mode") + ".")); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 1172751de..403d168db 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -30,7 +30,6 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; -import org.bukkit.entity.Wither; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; @@ -450,7 +449,7 @@ public class NewsManager extends MiniPlugin } } - for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.Morph)) + for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.MORPH)) { if (gadget instanceof MorphWither) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java index b5d86f0d6..b357aee34 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java @@ -119,7 +119,7 @@ public class ParkourManager extends MiniPlugin _active.add(player); UtilPlayer.message(player, F.main("Parkour", "You have entered " + F.elem("Parkour Mode") + ".")); - Manager.GetGadget().DisableAll(player); + Manager.GetGadget().disableAll(player); player.setVelocity(new Vector(0,-1,0)); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 9a05b6047..04fb771b8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -11,7 +11,6 @@ import org.bukkit.Sound; import org.bukkit.entity.Bat; import org.bukkit.entity.Entity; import org.bukkit.entity.Firework; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.entity.TNTPrimed; @@ -19,10 +18,8 @@ import org.bukkit.entity.WitherSkull; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.util.Vector; import mineplex.core.MiniPlugin; @@ -114,7 +111,7 @@ public class SoccerManager extends MiniPlugin _cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75); //Store Gadgets - for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume)) + for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { @@ -343,7 +340,7 @@ public class SoccerManager extends MiniPlugin //All peices are always same color! for (OutfitTeam outfit : _teamArmor) { - if (outfit.IsActive(player)) + if (outfit.isActive(player)) return outfit.getTeamColor(player); } @@ -473,7 +470,7 @@ public class SoccerManager extends MiniPlugin outfit.add("Team Pants"); outfit.add("Team Boots"); - Manager.GetGadget().DisableAll(player, outfit); + Manager.GetGadget().disableAll(player, outfit); Manager.GetMount().DisableAll(player); Manager.getPetManager().DisableAll(player); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 532058fa2..4ff70bf32 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -112,7 +112,7 @@ public class StackerManager extends MiniPlugin implements IThrown return; } - if (Manager.GetGadget().getActive(stacker, GadgetType.Morph) instanceof MorphBlock) + if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphBlock) { UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while using the Block Morph.")); return; @@ -302,7 +302,7 @@ public class StackerManager extends MiniPlugin implements IThrown System.out.println("Stacker collide."); //Velocity - UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); + UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); Entity rider = target.getPassenger(); while (rider != null) @@ -315,10 +315,10 @@ public class StackerManager extends MiniPlugin implements IThrown rider = rider.getPassenger(); } - UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); + UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.name(UtilEnt.getName(data.getThrown())))); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); //Portal Delay Manager.SetPortalDelay(target); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index f279bb288..517720f53 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -48,7 +48,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Memorize Gwen the Guardian's builds", C.Reset + "Then recreate them in a short amount of time.", C.Reset + "The least correct builder is eliminated.", - }, "SB", "SpeedBuilders", new SelectSBButton(this)); + }, "SB", "Speed_Builders", new SelectSBButton(this)); add(4, Material.BOOK_AND_QUILL, C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary", new String[] { @@ -57,7 +57,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Players take turns at drawing a random", C.Reset + "word. Whoever guesses it within the time", C.Reset + "limit gets some points!", - }, "DMT", "DrawMyThing", new SelectDMTButton(this)); + }, "DMT", "Draw_My_Thing", new SelectDMTButton(this)); add(6, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[] { @@ -75,7 +75,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Then the bridges drop, and all hell", C.Reset + "breaks loose as you battle to the", C.Reset + "death with the other teams.", - }, "BR", "Bridge", new SelectBRButton(this)); + }, "BR", "Bridges", new SelectBRButton(this)); add(11, Material.DIAMOND_SWORD, (byte) 0, C.cYellowB + "Survival Games " + C.cGray + "Solo/Team Survival", new String[] { @@ -83,7 +83,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Search for chests to find loot and ", C.Reset + "fight others to be the last man standing. ", C.Reset + "Stay away from the borders!", - }, new String[] {"HG", "SG2"}, "SurvivalGames", new SelectSGButton(this)); + }, new String[] {"HG", "SG2"}, "Survival_Games", new SelectSGButton(this)); add(13, Material.FEATHER, (byte) 0, C.cYellowB + "Skywars " + C.cGray + "Solo/Team Survival", new String[] { @@ -93,7 +93,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Find weapons to take your enemies down!", C.Reset + "Up in the skies, death looming if you fall..", C.Reset + "Win! Fight! Send enemies flying in Skywars!", - }, new String[] {"SKY", "SKY2"}, "SkyWars", new SelectSKYButton(this)); + }, new String[] {"SKY", "SKY2"}, "Skywars", new SelectSKYButton(this)); add(15, Material.GOLDEN_APPLE, C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[] { @@ -133,7 +133,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Customize one of five exciting champions", C.Reset + "and battle with the opposing team to the", C.Reset + "last man standing.", - }, "TDM", "TeamDeathMatch", new SelectTDMButton(this)); + }, "TDM", "Team_Deathmatch", new SelectTDMButton(this)); add(24, Material.DIAMOND_CHESTPLATE, C.cYellowB + "Castle Siege " + C.cGray + "Team Game", new String[] { @@ -141,7 +141,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Defenders must protect King Sparklez", C.Reset + "from the endless waves of Undead", C.Reset + "until the sun rises!", - }, "CS", "CastleSiege", new SelectCSButton(this)); + }, "CS", "Castle_Siege", new SelectCSButton(this)); add(26, Material.GRASS, C.cYellowB + "Block Hunt " + C.cGray + "Cat and Mouse", new String[] { @@ -149,7 +149,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Hide as blocks/animals, upgrade your ", C.Reset + "weapon and fight to survive against", C.Reset + "the Hunters!", - }, "BH", "BlockHunt", new SelectBHButton(this)); + }, "BH", "Block_Hunt", new SelectBHButton(this)); add(28, Material.TNT, C.cYellowB + "MineStrike " + C.cGray + "Team Survival", new String[] { @@ -159,7 +159,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "and blow them up!", }, "MS", "MineStrike", new SelectMSButton(this)); - add(30, _superSmashCycle.get(_ssmIndex).clone(), null, null, new String[] {"SSM", "SSM2"}, "SmashMobs", new SelectSSMButton(this)); + add(30, _superSmashCycle.get(_ssmIndex).clone(), null, null, new String[] {"SSM", "SSM2"}, "Smash_Mobs", new SelectSSMButton(this)); String[] games = new String[] {"MIN", "DR", "DE", "PB", "TF", "RUN", "SN", "DT", "SQ", "SA", "SS", "OITQ", "BB", "MB", "EVO", "GLD", "BL"}; @@ -171,7 +171,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Players are given a Build Theme and ", C.Reset + "must use blocks, monsters and more", C.Reset + "to create a masterpiece!", - }, "BLD", "MasterBuilders", new SelectBLDButton(this)); + }, "BLD", "Master_Builders", new SelectBLDButton(this)); add(39, Material.SKULL_ITEM, (byte) 3, C.cYellowB + "Player Servers " + C.cGray + "Player Hosted Games", new String[] { @@ -188,7 +188,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Equip custom skills and builds", C.Reset + "and join your clan to destroy", C.Reset + "and raid others!", - }, "Clans", "Clans", new SelectCLANSButton(this)); + }, "Clans", null, new SelectCLANSButton(this)); add(41, Material.BREWING_STAND_ITEM, C.cYellowB + "Monster Maze " + C.cGray + "Snow Sprint", new String[] { @@ -197,29 +197,30 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Run along a maze avoiding", C.Reset + "evil monsters. Get to the", C.Reset + "Safe-Pad or be killed!", - }, "BETA", "Beta", new SelectBETAButton(this)); + }, "BETA", null, new SelectBETAButton(this)); } - private void add(int slot, Material material, String title, String[] lore, String serverTag, String serverGroup, IButton button) + private void add(int slot, Material material, String title, String[] lore, String serverTag, String boosterGroup, IButton button) { - add(slot, material, (byte) 0, title, lore, serverTag == null ? null : new String[]{serverTag}, serverGroup, button); + add(slot, material, (byte) 0, title, lore, serverTag == null ? null : new String[]{serverTag}, boosterGroup, button); } - private void add(int slot, Material material, byte data, String title, String[] lore, String[] serverTags, String serverGroup, IButton button) + private void add(int slot, Material material, byte data, String title, String[] lore, String[] serverTags, String boosterGroup, IButton button) { - add(slot, new ItemBuilder(material, 1, data), title, lore, serverTags, serverGroup, button); + add(slot, new ItemBuilder(material, 1, data), title, lore, serverTags, boosterGroup, button); } - private void add(int slot, ItemBuilder builder, String title, String[] lore, String[] serverTags, String serverGroup, IButton button) + private void add(int slot, ItemBuilder builder, String title, String[] lore, String[] serverTags, String boosterGroup, IButton button) { // Boosters - if (serverGroup != null) + if (boosterGroup != null) { - Booster booster = getPlugin().getBoosterManager().getActiveBoosterFromCache(serverGroup); + Booster booster = getPlugin().getBoosterManager().getActiveBooster(boosterGroup); if (booster != null) { // append to start of lore - builder.getLore().add(0, C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName() + C.cGreen + " - " + C.cWhite + booster.getTimeRemainingString()); + builder.getLore().add(0, C.cWhite + "Amplified by " + C.cGreen + booster.getPlayerName() + C.cWhite + " - " + C.cGreen + booster.getTimeRemainingString()); + builder.getLore().add(1, C.cWhite + "All players earn " + C.cGreen + "2x Gems" + C.cWhite + " and " + C.cAqua + "2x Shards"); builder.setGlow(true); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java index 488942a3e..ff31e7c64 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java @@ -1,14 +1,11 @@ package mineplex.minecraft.game.classcombat.Class; import java.util.HashSet; -import java.util.concurrent.ConcurrentHashMap; import mineplex.core.common.util.Callback; import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.types.GadgetType; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Skill.ISkill; @@ -198,7 +195,7 @@ public class PvpClass implements IPvpClass continue; } - if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null) + if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.COSTUME) != null) continue; Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index 82cd557fd..a87c6fc53 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -143,7 +143,7 @@ public class Illusion extends SkillActive if (Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK) == null || !UtilPlayer.isBlocking(cur) || - //!Factory.Energy().Use(cur, GetName(), 0.625 - (getLevel(cur) * 0.025), true, true) || + //!Factory.Energy().Use(cur, getName(), 0.625 - (getLevel(cur) * 0.025), true, true) || skel == null || !skel.isValid()) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java index dc3fd9dde..1918c5cf4 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java @@ -88,6 +88,10 @@ public class Recall extends Skill return; Factory.runSync(() -> { + if (player.isDead()) + { + return; + } //Heal double newHealth = Math.min(health.getLast(), player.getHealth() + 3 + level); player.setHealth(newHealth); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index c25d056b8..800547f8b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -37,7 +37,6 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.classcombat.Skill.SkillCharge; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; -import mineplex.minecraft.game.classcombat.Skill.event.BlockTossEvent; import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent; import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; @@ -281,19 +280,19 @@ public class BlockToss extends SkillCharge implements IThrown if (target == null) return; - int level = getLevel(data.GetThrower()); + int level = getLevel(data.getThrower()); //Damage Event - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.CUSTOM, data.GetThrown().getVelocity().length() * (3 + 0.6 * level), true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, + DamageCause.CUSTOM, data.getThrown().getVelocity().length() * (3 + 0.6 * level), true, true, false, + UtilEnt.getName(data.getThrower()), GetName()); //Block to Item - if (data.GetThrown() instanceof FallingBlock) + if (data.getThrown() instanceof FallingBlock) { - FallingBlock thrown = (FallingBlock) data.GetThrown(); + FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData()); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData()); newThrown.setDropItem(false); //Remove Old @@ -301,8 +300,8 @@ public class BlockToss extends SkillCharge implements IThrown thrown.remove(); //Add New - if (data.GetThrower() instanceof Player) - _falling.put(newThrown, (Player)data.GetThrower()); + if (data.getThrower() instanceof Player) + _falling.put(newThrown, (Player)data.getThrower()); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java index ca77c5908..373caea1f 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Brute; 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; @@ -126,13 +125,13 @@ public class FleshHook extends SkillActiveCharge implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Remove - double velocity = data.GetThrown().getVelocity().length(); - data.GetThrown().remove(); + double velocity = data.getThrown().getVelocity().length(); + data.getThrown().remove(); - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); @@ -172,13 +171,13 @@ public class FleshHook extends SkillActiveCharge implements IThrown public void Idle(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java index 28d3b0f24..f9a230fd9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java @@ -191,7 +191,7 @@ public class Pistol extends SkillActive if (damage > 0) return; - //UtilPlayer.Damage(hit, attacker, damage, GetName(), true, true, false); + //UtilPlayer.Damage(hit, attacker, damage, getName(), true, true, false); */ } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java index 957f53cb0..bf2d6aa75 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Knight; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -27,7 +26,6 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Skill.SkillActive; @@ -100,33 +98,33 @@ public class AxeThrow extends SkillActive implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; - int level = getLevel(data.GetThrower()); + int level = getLevel(data.getThrower()); if (level <= 0) return; double damage = 5.5 + 0.5 * level; //Damage Event - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java index 80d60b3ca..db14f198a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java @@ -105,7 +105,7 @@ public class BullsCharge extends SkillActive Factory.Condition().EndCondition(damager, ConditionType.SPEED, GetName()); //Damage - //event.AddMod(damager.getName(), GetName(), level, true); + //event.AddMod(damager.getName(), getName(), level, true); event.SetKnockback(false); //Effect diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java index d77e626db..9d9bbb165 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java @@ -111,7 +111,7 @@ public class DefensiveStance extends SkillActive if (damagee.getLocation().getDirection().subtract(from).length() > 1.4) { - //event.AddMod(damagee.getName(), GetName(), -0.5 - (0.5 * level), true); + //event.AddMod(damagee.getName(), getName(), -0.5 - (0.5 * level), true); return; } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java index b78b0c96e..ba21f4252 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java @@ -100,23 +100,23 @@ public class FreezingBlast extends SkillActive implements IThrown public void Action(LivingEntity target, ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 79); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 79); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); //Thrower - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); if (level == 0) return; //Snow Spread - HashMap blocks = UtilBlock.getInRadius(data.GetThrown().getLocation(), 4d); + HashMap blocks = UtilBlock.getInRadius(data.getThrown().getLocation(), 4d); for (Block cur : blocks.keySet()) { if (UtilBlock.airFoliage(cur) && UtilBlock.solid(cur.getRelative(BlockFace.DOWN))) @@ -127,7 +127,7 @@ public class FreezingBlast extends SkillActive implements IThrown } //Slow Players - for (Player curPlayer : UtilPlayer.getNearby(data.GetThrown().getLocation(), 4)) + for (Player curPlayer : UtilPlayer.getNearby(data.getThrown().getLocation(), 4)) Factory.Condition().Factory().Slow(GetName(), curPlayer, player, 2.9, 0, false, true, true, true); if (target == null) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java index 9a8450374..7f9f0b6a7 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java @@ -7,17 +7,14 @@ import org.bukkit.block.Block; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; @@ -83,38 +80,38 @@ public class GlacialBlade extends SkillActive implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); if (target == null) return; //Damage - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3.5, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java index f2201330b..2c2c0f118 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java @@ -101,22 +101,22 @@ public class IcePrison extends SkillActive implements IThrown public void Action(LivingEntity target, ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 79); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 79); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); //Thrower - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); if (level == 0) return; - Block block = data.GetThrown().getLocation().getBlock(); + Block block = data.getThrown().getLocation().getBlock(); //Sphere HashMap blocks = UtilBlock.getInRadius(block, 3.8d); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java index 17cea9ff8..027fee62a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java @@ -132,20 +132,20 @@ public class LightningOrb extends SkillActive implements IThrown public void Strike(LivingEntity target, ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); //Thrower - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); if (level == 0) return; - HashMap hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level); + HashMap hit = UtilEnt.getInRadius(data.getThrown().getLocation(), 3 + 0.5 * level); List struck = new ArrayList<>(); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java index 90f2d9519..468e6f58e 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java @@ -107,7 +107,7 @@ public class Fletcher extends Skill cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, "Fletched Arrow")); //Inform - //UtilPlayer.message(cur, F.main(GetName(), "You crafted a " + F.item("Fletched Arrow") + ".")); + //UtilPlayer.message(cur, F.main(getName(), "You crafted a " + F.item("Fletched Arrow") + ".")); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java index c8a3503bb..bfa6fcadf 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java @@ -61,7 +61,7 @@ // { // if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) // { -// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); +// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(getName()) + " in water.")); // return false; // } // @@ -75,7 +75,7 @@ // _active.add(player); // // //Inform -// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); +// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(getName(level)) + ".")); // // //Effect // player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); @@ -96,7 +96,7 @@ // return; // // //Inform -// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + ".")); +// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(getName(getLevel(player))) + ".")); // // _arrows.add(event.getProjectile()); // event.getProjectile().setFireTicks(200); @@ -128,10 +128,10 @@ // if (level == 0) return; // // //Ignite -// Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true); +// Factory.Condition().Factory().Ignite(getName(), damagee, damager, 2 + level, true, true); // // //Damage -// event.AddMod(damager.getName(), GetName(), 0, true); +// event.AddMod(damager.getName(), getName(), 0, true); // // //Effect // damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java index 363173009..77218628b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java @@ -140,7 +140,7 @@ public class Sharpshooter extends Skill // // if (player != null) // if (_hitCount.remove(player) != null) -// UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits"))); +// UtilPlayer.message(player, F.main(GetClassType().name(), getName() + ": " + F.elem("0 Consecutive Hits"))); // } // } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java index de226ba57..08d800a16 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java @@ -56,18 +56,18 @@ public class Apple extends ItemUsable return; //Damage Event - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 2, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); //Re-Drop - if (data.GetThrown() instanceof Item) - data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(((Item)data.GetThrown()).getItemStack().getType())).setPickupDelay(60); + if (data.getThrown() instanceof Item) + data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(((Item)data.getThrown()).getItemStack().getType())).setPickupDelay(60); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java index a28023c2b..adead9093 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java @@ -168,7 +168,7 @@ public class Pistol extends ItemUsable if (damage > 1) return; - //UtilPlayer.Damage(hit, attacker, damage, GetName(), true, true, false); + //UtilPlayer.Damage(hit, attacker, damage, getName(), true, true, false); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java index 111d15db7..08293d5a7 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java @@ -39,24 +39,24 @@ public class PoisonBall extends ItemUsable @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; - Factory.Condition().Factory().Poison(GetName(), target, data.GetThrower(), 6, 0, false, true, true); + Factory.Condition().Factory().Poison(GetName(), target, data.getThrower(), 6, 0, false, true, true); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java index a6895deda..017f6c5fe 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java @@ -1,7 +1,6 @@ package mineplex.minecraft.game.classcombat.item.Throwable; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import org.bukkit.Bukkit; @@ -79,33 +78,33 @@ public class ProximityExplosive extends ItemUsable public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Idle(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Expire(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java index 3a3c22886..3076b403b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java @@ -1,12 +1,10 @@ package mineplex.minecraft.game.classcombat.item.Throwable; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import org.bukkit.Bukkit; import org.bukkit.Effect; -import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -77,33 +75,33 @@ public class ProximityZapper extends ItemUsable public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Idle(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Expire(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java index 347755706..99361e426 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java @@ -80,17 +80,17 @@ public class WaterBottle extends ItemUsable public void Break(ProjectileUser data) { //Splash - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 8); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SPLASH, 1f, 1.4f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 8); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.SPLASH, 1f, 1.4f); //Extinguish - Factory.Fire().RemoveNear(data.GetThrown().getLocation(), 3); + Factory.Fire().RemoveNear(data.getThrown().getLocation(), 3); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); - for (Player player : UtilPlayer.getNearby(data.GetThrown().getLocation(), 3)) + for (Player player : UtilPlayer.getNearby(data.getThrown().getLocation(), 3)) { //Extinguish player.setFireTicks(-20); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java index a765748d7..023afeb5c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java @@ -7,7 +7,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -47,27 +46,27 @@ public class Web extends ItemUsable { if (target != null) { - double distance = UtilMath.offset(target.getLocation(), data.GetThrown().getLocation()); + double distance = UtilMath.offset(target.getLocation(), data.getThrown().getLocation()); if (distance > .75) { - data.GetThrown().teleport(data.GetThrown().getLocation().add(new Vector(0, -distance / 2, 0))); + data.getThrown().teleport(data.getThrown().getLocation().add(new Vector(0, -distance / 2, 0))); } } - CreateWeb(data.GetThrown()); + CreateWeb(data.getThrown()); } @Override public void Idle(ProjectileUser data) { - CreateWeb(data.GetThrown()); + CreateWeb(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - CreateWeb(data.GetThrown()); + CreateWeb(data.getThrown()); } public void CreateWeb(Entity ent) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java index 31fa6c1c0..60025020b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java @@ -434,28 +434,28 @@ public class SkillPage extends ShopPageBase ClientClass clientClass = getPlugin().GetClassManager().Get(player); /* - if (item.GetName().contains("Sword") || item.GetName().contains("Axe") || item.GetName().contains("Bow")) + if (item.getName().contains("Sword") || item.getName().contains("Axe") || item.getName().contains("Bow")) { - if (clientClass.GetSavingCustomBuild().hasItem(item.GetType(), item.GetName())) + if (clientClass.GetSavingCustomBuild().hasItem(item.GetType(), item.getName())) { PlayDenySound(player); System.out.println("Denying because of matching material and name."); return; } - if (item.GetName().contains("Sword")) + if (item.getName().contains("Sword")) { System.out.println("Sword"); if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Sword")) index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Sword"); } - else if (item.GetName().contains("Axe")) + else if (item.getName().contains("Axe")) { System.out.println("Axe"); if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Axe")) index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Axe"); } - else if (item.GetName().contains("Bow")) + else if (item.getName().contains("Bow")) { System.out.println("Bow"); if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Bow")) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java index 0f2bd8f1a..d30d81984 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java @@ -18,7 +18,7 @@ public class ItemSalesPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java index c6c980711..fe3873a3d 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java @@ -18,7 +18,7 @@ public class SkillSalesPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java index f0ba4026a..a41376eae 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java @@ -258,7 +258,7 @@ public abstract class EventCreature implements Listener @EventHandler public void onChunkUnload(ChunkUnloadEvent event) { - if (_entity.getLocation().getChunk().equals(event.getChunk())) + if (_entity != null && _entity.getLocation().getChunk().equals(event.getChunk())) event.setCancelled(true); } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java index 2675c0530..d77b039ef 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java @@ -109,27 +109,27 @@ public class RocketAbility extends SlimeAbility implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { // Bukkit.broadcastMessage("COLLIDE " + target); - UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, UtilParticle.ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, UtilParticle.ViewDist.LONG, UtilServer.getPlayers()); target.getLocation().getWorld().playSound(target.getLocation(), Sound.SPLASH, 1, 2); getSlime().getEvent().getDamageManager().NewDamageEvent(target, getSlime().getEntity(), null, EntityDamageEvent.DamageCause.PROJECTILE, 3 + getSlime().getSize() * 3, true, true, false, getSlime().getName(), "Slime Rocket"); - data.GetThrown().remove(); + data.getThrown().remove(); _rocketsHit++; } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); _rocketsHit++; } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); _rocketsHit++; } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java index ec57283bb..3135945b0 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.core.boss.spider.attacks; import org.bukkit.Material; 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.entity.EntityDamageEvent.DamageCause; @@ -12,7 +11,6 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.minecraft.game.core.boss.EventCreature; @@ -53,9 +51,9 @@ public class SpiderPoison implements IThrown private void burst(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); - UtilParticle.PlayParticle(ParticleType.ICON_CRACK.getParticle(Material.SLIME_BALL, 0), data.GetThrown().getLocation(), + UtilParticle.PlayParticle(ParticleType.ICON_CRACK.getParticle(Material.SLIME_BALL, 0), data.getThrown().getLocation(), 0.3F, 0.3F, 0.3F, 0, 30, ViewDist.NORMAL, UtilServer.getPlayers()); } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index fd4c81dc0..7e40bed4c 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java @@ -51,6 +51,7 @@ public class ServerGroup private String _games; private String _modes; + private String _boosterGroup; private String _serverType; private boolean _addNoCheat; private boolean _addWorldEdit; @@ -89,6 +90,7 @@ public class ServerGroup _generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions")); _games = data.get("games"); _modes = data.get("modes"); + _boosterGroup = data.get("boosterGroup"); _serverType = data.get("serverType"); _addNoCheat = Boolean.valueOf(data.get("addNoCheat")); _addWorldEdit = Boolean.valueOf(data.get("addWorldEdit")); @@ -119,7 +121,7 @@ public class ServerGroup } public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath - , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin + , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String boosterGroup, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin , boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats , boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region , String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName) @@ -143,6 +145,7 @@ public class ServerGroup _tournamentPoints = tournamentPoints; _games = games; _modes = modes; + _boosterGroup = boosterGroup; _serverType = serverType; _addNoCheat = noCheat; _addWorldEdit = worldEdit; @@ -214,6 +217,8 @@ public class ServerGroup public String getGames() { return _games; } public String getModes() { return _modes; } + public String getBoosterGroup() { return _boosterGroup; } + public String getServerType() { return _serverType; } public boolean getAddNoCheat() { return _addNoCheat; } public boolean getAddWorldEdit() { return _addWorldEdit; } @@ -383,6 +388,8 @@ public class ServerGroup _dataMap.put("host", _host); _dataMap.put("region", _region.name()); _dataMap.put("teamServerKey", _teamServerKey); + _dataMap.put("modes", _modes); + _dataMap.put("boosterGroup", _boosterGroup); _dataMap.put("portalBottomCornerLocation", _portalBottomCornerLocation); _dataMap.put("portalTopCornerLocation", _portalTopCornerLocation); _dataMap.put("npcName", _npcName); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 33570939f..1842ee5e4 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -17,6 +17,8 @@ import mineplex.core.donation.DonationManager; import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.TransactionToken; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.mount.Mount; import mineplex.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; @@ -127,7 +129,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int winterChestsReceived = 0; int illuminatedChestsReceived = 0; int valentinesGiftsReceived = 0; - + int boostersReceived = 0; + int freedomChestsReceived = 0; + for (CoinTransactionToken transaction : donor.getCoinTransactions()) { if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase")) @@ -194,6 +198,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + if (transaction.SalesPackageName.startsWith("Freedom Treasure")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + freedomChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + freedomChestsReceived += 1; + } + + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { if (transaction.Coins == 0 && transaction.Gems == 0) @@ -205,6 +220,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + if (transaction.SalesPackageName.startsWith("Game Booster")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + boostersReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + boostersReceived += 1; + } + + } } // Strutt20 asked me to remove some stuff from the menu @@ -213,6 +239,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); + caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); + caller.sendMessage(C.cBlue + "Freedom Chests Received: " + C.cYellow + freedomChestsReceived); caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):"); if (_accountBonusLog.containsKey(client.getAccountId())) @@ -226,7 +254,15 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _salesPackageManager.displaySalesPackages(caller, playerName); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - + caller.sendMessage(C.cBlue + "Freedom Mount: " + getLockedFreedomStr(playerName, "Freedom Mount")); + caller.sendMessage(C.cBlue + "Uncle Sam Morph: " + getLockedFreedomStr(playerName, "Uncle Sam Morph")); + caller.sendMessage(C.cBlue + "Freedom Aura: " + getLockedFreedomStr(playerName, "Freedom Aura")); + caller.sendMessage(C.cBlue + "Shock and Awe: " + getLockedFreedomStr(playerName, "Shock and Awe")); + caller.sendMessage(C.cBlue + "Leap of Freedom: " + getLockedFreedomStr(playerName, "Leap of Freedom")); + caller.sendMessage(C.cBlue + "Price of Freedom: " + getLockedFreedomStr(playerName, "Price of Freedom")); + caller.sendMessage(C.cBlue + "Uncle Sam Hat: " + getLockedFreedomStr(playerName, "Uncle Sam Hat")); + caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + _accountBonusLog.remove(client.getAccountId()); } }); @@ -277,4 +313,13 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable if (accountId != 0) _accountBonusLog.put(accountId, log); } + + private String getLockedFreedomStr(String player, String name) + { + if (_donationManager.Get(player).OwnsUnknownPackage(name)) + { + return C.cGreen + C.Bold + "Unlocked"; + } + return C.cRed + C.Bold + "Locked"; + } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 1637cc111..65f25a186 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -50,6 +50,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new AncientChest(this)); AddSalesPackage(new MythicalChest(this)); AddSalesPackage(new IlluminatedChest(this)); + AddSalesPackage(new FreedomChest(this)); //AddSalesPackage(new ValentinesGift(this)); AddSalesPackage(new FrostLord(this)); AddSalesPackage(new EasterBunny(this)); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java new file mode 100644 index 000000000..214495bd4 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java @@ -0,0 +1,21 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class FreedomChest extends SalesPackageBase +{ + + public FreedomChest(SalesPackageManager manager) + { + super(manager, "1 Freedom Treasure"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Freedom Treasure", "Give 1 Freedom Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 290aa9c95..c3d42ffeb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -11,11 +11,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; import mineplex.core.PacketsInteractionFix; -import mineplex.core.chatsnap.publishing.SnapshotPublisher; import mineplex.core.customdata.CustomDataManager; -import mineplex.core.chatsnap.SnapshotManager; -import mineplex.core.chatsnap.SnapshotPlugin; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import net.minecraft.server.v1_8_R3.BiomeBase; import net.minecraft.server.v1_8_R3.MinecraftServer; @@ -37,7 +33,6 @@ import mineplex.core.elo.EloManager; import mineplex.core.friend.FriendManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.give.Give; -import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; import mineplex.core.incognito.IncognitoManager; @@ -58,8 +53,6 @@ import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; -import mineplex.core.report.ReportManager; -import mineplex.core.report.ReportPlugin; import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; @@ -70,7 +63,6 @@ import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; -import nautilus.game.arcade.broadcast.BroadcastManager; import nautilus.game.arcade.game.GameServerConfig; public class Arcade extends JavaPlugin @@ -106,6 +98,7 @@ public class Arcade extends JavaPlugin CommandCenter.Initialize(this); _clientManager = new CoreClientManager(this, webServerAddress); CommandCenter.Instance.setClientManager(_clientManager); + new ProfileCacheManager(this); ItemStackFactory.Initialize(this, false); @@ -127,6 +120,7 @@ public class Arcade extends JavaPlugin incognito.setPreferencesManager(preferenceManager); + Creature creature = new Creature(this); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager); @@ -165,16 +159,16 @@ public class Arcade extends JavaPlugin PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager); - BoosterManager boosterManager = new BoosterManager(this, _clientManager, _donationManager, inventoryManager); + BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); - cosmeticManager.setInterfaceSlot(7); + cosmeticManager.setInterfaceSlot(6); cosmeticManager.disableTeamArmor(); CustomDataManager customDataManager = new CustomDataManager(this, _clientManager); //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish, eloManager); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish, eloManager, boosterManager); new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, _gameManager.getBonusManager().getRewardManager()); @@ -185,8 +179,6 @@ public class Arcade extends JavaPlugin new PacketsInteractionFix(this, packetHandler); new FoodDupeFix(this); - new ProfileCacheManager(this); - //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); @@ -219,6 +211,7 @@ public class Arcade extends JavaPlugin try { config.ServerGroup = _serverConfiguration.getServerGroup().getName(); + config.BoosterGroup = _serverConfiguration.getServerGroup().getBoosterGroup(); config.HostName = _serverConfiguration.getServerGroup().getHost(); config.ServerType = _serverConfiguration.getServerGroup().getServerType(); config.MinPlayers = _serverConfiguration.getServerGroup().getMinPlayers(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index f2de6934c..02245e363 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -6,6 +6,7 @@ import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; import mineplex.core.bonuses.BonusManager; +import mineplex.core.boosters.BoosterManager; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; import mineplex.core.common.util.*; @@ -49,6 +50,7 @@ import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.valentines.ValentinesGiftManager; +import mineplex.core.youtube.YoutubeManager; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -64,6 +66,13 @@ import mineplex.minecraft.game.core.fire.Fire; import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.TeamArmorAddon; import nautilus.game.arcade.addons.compass.CompassAddon; +import nautilus.game.arcade.booster.GameBoosterManager; +import nautilus.game.arcade.command.DisguiseCommand; +import nautilus.game.arcade.command.GameCmdModeCommand; +import nautilus.game.arcade.command.GameCommand; +import nautilus.game.arcade.command.KitUnlockCommand; +import nautilus.game.arcade.command.RequiredRankCommand; +import nautilus.game.arcade.command.WriteCommand; import nautilus.game.arcade.command.*; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; @@ -80,6 +89,9 @@ import nautilus.game.arcade.shop.ArcadeShop; import net.minecraft.server.v1_8_R3.EntityLiving; import org.bukkit.*; import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.block.Chest; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; @@ -88,17 +100,11 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.*; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.*; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; @@ -165,6 +171,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private BonusManager _bonusManager; private KitProgressionManager _kitProgressionManager; private ProgressingKitManager _progressionKitManager; + private BoosterManager _boosterManager; private IncognitoManager _incognitoManager; @@ -192,11 +199,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation private boolean _gameCommandMode; public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, - CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, - StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, - Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, - CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, - NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager) + CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, + StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, + Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, + NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, BoosterManager boosterManager) { super("Game Manager", plugin); @@ -217,6 +224,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _brandingManager = new BrandingManager(plugin); + _boosterManager = boosterManager; + //Dont see a reason to ever just use the normal one // if (serverConfig.GameList.contains(GameType.ChampionsDominate) // || serverConfig.GameList.contains(GameType.ChampionsTDM) @@ -278,7 +287,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _gameTournamentManager = new GameTournamentManager(this); new GameStatManager(this); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager()); + YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), boosterManager); new GameLootManager(this, petManager, _bonusManager.getRewardManager()); new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); @@ -290,6 +300,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); new PlayerDisguiseManager(plugin, _clientManager); + new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, npcManager, serverConfig.BoosterGroup); // Game Addons new CompassAddon(plugin, this); @@ -1003,9 +1014,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation GetDisguise().undisguise(player); - Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph); - if (morph != null && morph.IsActive(player)) - morph.Disable(player); + Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH); + if (morph != null && morph.isActive(player)) + morph.disable(player); } public ArrayList LoadFiles(String gameName) @@ -1425,6 +1436,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _youtube.contains(player); } + public BoosterManager getBoosterManager() + { + return _boosterManager; + } + public void toggleUnlockKits(Player caller) { if (_youtube.remove(caller)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index ec3f1e5bb..0e44d3a63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -218,7 +218,7 @@ public enum GameType Pair[] _resourcePacks; Class _gameClass; - GameMode[] _gameModes; + private GameMode[] _gameModes; private boolean _gameMaps; private int _gameId; // Unique identifying id for this gamemode (used for statistics) @@ -322,16 +322,15 @@ public enum GameType return _display.getGameCategory(); } - public String GetKitGameName() + public String GetKitGameName(Game game) { + if (hasGamemodes()) + { + return getModeGameType(game.getClass())._display.getKitGameName(); + } return _display.getKitGameName(); } - public boolean isUsingGameModes() - { - return _gameMaps; - } - public GameType getModeGameType(Class game) { for (GameMode mode : getGameModes()) @@ -343,4 +342,14 @@ public enum GameType } return null; } + + public boolean isUsingGameModesMaps() + { + return _gameMaps; + } + + public boolean hasGamemodes() + { + return _gameModes.length != 0; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index ef66228fe..8c6139b9f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -1,29 +1,34 @@ package nautilus.game.arcade.booster; -import com.mojang.authlib.GameProfile; import mineplex.core.MiniPlugin; import mineplex.core.boosters.Booster; import mineplex.core.boosters.event.BoosterActivateEvent; -import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterExpireEvent; import mineplex.core.boosters.tips.BoosterTipManager; import mineplex.core.common.util.*; import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; -import mineplex.core.profileCache.ProfileCacheManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.npc.Npc; +import mineplex.core.npc.NpcManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.database.tables.records.NpcsRecord; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; +import java.util.HashSet; + /** * @author Shaun Bennett */ @@ -32,51 +37,67 @@ public class BoosterPodium extends MiniPlugin private GameBoosterManager _gameBoosterManager; private DisguiseManager _disguiseManager; private HologramManager _hologramManager; + private NpcManager _npcManager; private Location _podiumLocation; private Booster _activeBooster; + private Npc _npc; + private boolean _npcAlive; + private Location _npcLocation; private ArmorStand _activeArmorStand; private Hologram _hologram; - public BoosterPodium(JavaPlugin plugin, GameBoosterManager gameBoosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, Location podiumLocation) + public BoosterPodium(JavaPlugin plugin, GameBoosterManager gameBoosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, NpcManager npcManager, Location podiumLocation) { super("Booster Podium - " + podiumLocation.toString(), plugin); _gameBoosterManager = gameBoosterManager; _disguiseManager = disguiseManager; _hologramManager = hologramManager; + _npcManager = npcManager; _podiumLocation = podiumLocation; + _npcLocation = podiumLocation.clone().add(0, 1, 0); - addPodium(); + NpcsRecord npcsRecord = new NpcsRecord(); + npcsRecord.setServer(_npcManager.getServerName()); + npcsRecord.setName(C.cGreen + "Game Amplifiers"); + npcsRecord.setWorld(_npcLocation.getWorld().getName()); + npcsRecord.setX(_npcLocation.getX()); + npcsRecord.setY(_npcLocation.getY()); + npcsRecord.setZ(_npcLocation.getZ()); + npcsRecord.setRadius(0D); + npcsRecord.setEntityType(EntityType.VILLAGER.name()); + npcsRecord.setAdult(true); + _npcAlive = false; + _npc = new Npc(npcManager, npcsRecord); + + setPodium(_podiumLocation, Material.EMERALD_BLOCK.getId(), (byte) 0); updateNpcs(); } - public void addPodium() - { - for(int x = 0; x < 2; x++) - { - for (int z = 0; z < 2; z++) - { - Location location = _podiumLocation.clone().add(x - 0.5, 0, z - 0.5); - location.getBlock().setType(Material.STEP); - } - } - } - public void updateNpcs() { - System.out.println("Updating Npcs."); Booster activeBooster = _gameBoosterManager.getActiveBooster(); - System.out.println("Active booster: " + activeBooster); if (activeBooster != null) { + if (_npcAlive) + { + _npcManager.removeFakeNpc(_npc); + _npcAlive = false; + } + if (_activeArmorStand != null) { _activeArmorStand.remove(); } - Location armorStandLocation = _podiumLocation.clone(); - ArmorStand armorStand = _podiumLocation.getWorld().spawn(armorStandLocation, ArmorStand.class); + if (_hologram == null) + { + _hologram = new Hologram(_hologramManager, _npcLocation.clone().add(0, 2.5, 0), true, getHologramText(activeBooster)); + _hologram.start(); + } + + ArmorStand armorStand = _podiumLocation.getWorld().spawn(_npcLocation, ArmorStand.class); armorStand.setVisible(true); armorStand.setCustomNameVisible(false); armorStand.setCustomName(""); @@ -85,18 +106,11 @@ public class BoosterPodium extends MiniPlugin armorStand.setBasePlate(true); armorStand.setRemoveWhenFarAway(false); - armorStand.setHelmet(UtilSkull.getPlayerHead(activeBooster.getPlayerName(), activeBooster.getPlayerName(), null)); - armorStand.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); - armorStand.setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); - armorStand.setBoots(new ItemStack(Material.GOLD_BOOTS)); - armorStand.setItemInHand(new ItemStack(Material.EMERALD)); - - if (_hologram == null) - { - _hologram = new Hologram(_hologramManager, armorStandLocation.clone().add(0, 2, 0), getHologramText(activeBooster)); - _hologram.start(); - } + armorStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.LIME).build()); + armorStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.LIME).build()); + armorStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.LIME).build()); +// armorStand.setItemInHand(); /* runAsync(() -> { @@ -135,6 +149,13 @@ public class BoosterPodium extends MiniPlugin _hologram.stop(); _hologram = null; } + + if (!_npcAlive) + { + _npcManager.spawnNpc(_npc); + _npcManager.addFakeNpc(_npc); + _npcAlive = true; + } } } @@ -148,15 +169,15 @@ public class BoosterPodium extends MiniPlugin private String getNameString(Booster booster) { - return C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName() + C.cGreen + " - " + C.cWhite + booster.getTimeRemainingString(); + return C.cGreen + "Amplified by " + C.cWhite + booster.getPlayerName() + C.cGreen + " - " + C.cWhite + booster.getTimeRemainingString(); } private String[] getHologramText(Booster booster) { return new String[] { - C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName(), + C.cGreen + "Amplified by " + C.cWhite + booster.getPlayerName(), C.cWhite + booster.getTimeRemainingString() + " Remaining", - C.cAqua + "Right Click to Tip. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards" + C.cAqua + "Click to Thank. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards" }; } @@ -183,13 +204,13 @@ public class BoosterPodium extends MiniPlugin } @EventHandler - public void onBoosterDisable(BoosterDeactivateEvent event) + public void onBoosterDisable(BoosterExpireEvent event) { updateNpcs(); } @EventHandler - public void onInteract(PlayerInteractAtEntityEvent event) + public void one(PlayerInteractAtEntityEvent event) { if (event.getRightClicked().equals(_activeArmorStand)) { @@ -207,4 +228,66 @@ public class BoosterPodium extends MiniPlugin event.setCancelled(true); } } + + public void setPodium(Location loc, int id, byte data) + { + HashSet blockSet = new HashSet<>(); + //Coloring + Block block = loc.clone().add( 0.5, 0, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add(-0.5, 0, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add( 0.5, 0, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add(-0.5, 0, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + //Top + block = loc.clone().add( 0.5, 1, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add(-0.5, 1, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add( 0.5, 1, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add(-0.5, 1, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + //Floor + for (int x=-2 ; x<2 ; x++) + { + for (int z=-2 ; z<2 ; z++) + { + block = loc.clone().add(x + 0.5, -1, z + 0.5).getBlock(); + blockSet.add(block); + + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + } + } + + //Outline + for (int x=-3 ; x<3 ; x++) + { + for (int z=-3 ; z<3 ; z++) + { + block = loc.clone().add(x + 0.5, -1, z + 0.5).getBlock(); + if (blockSet.contains(block)) continue; + + MapUtil.QuickChangeBlockAt(block.getLocation(), 35, (byte)15); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 55c9c67aa..5fe291f44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -4,7 +4,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.boosters.Booster; import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.event.BoosterActivateEvent; -import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterExpireEvent; import mineplex.core.boosters.tips.BoosterTipManager; import mineplex.core.boosters.tips.TipAddResult; import mineplex.core.common.CurrencyType; @@ -13,38 +13,40 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilWorld; import mineplex.core.disguise.DisguiseManager; import mineplex.core.hologram.HologramManager; -import nautilus.game.arcade.game.GameServerConfig; +import mineplex.core.npc.NpcManager; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; -import java.util.List; - /** * @author Shaun Bennett */ public class GameBoosterManager extends MiniPlugin { - private GameServerConfig _gameServerConfig; + private String _boosterGroup; private BoosterManager _boosterManager; private BoosterPodium _boosterPodium; - public GameBoosterManager(JavaPlugin plugin, BoosterManager boosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, GameServerConfig gameServerConfig) + public GameBoosterManager(JavaPlugin plugin, BoosterManager boosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, NpcManager npcManager, String boosterGroup) { super("Arcade Boosters", plugin); - _gameServerConfig = gameServerConfig; + _boosterGroup = boosterGroup; _boosterManager = boosterManager; - _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -12)); + if (boosterGroup != null && boosterGroup.length() > 0) + { + _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, npcManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -15)); + } } public Booster getActiveBooster() { - return _boosterManager.getActiveBoosterFromCache(_gameServerConfig.ServerGroup); + return _boosterManager.getActiveBooster(_boosterGroup); } public void attemptTip(Player player) @@ -53,21 +55,21 @@ public class GameBoosterManager extends MiniPlugin if (active == null) { - UtilPlayer.message(player, F.main("Tip", "There is no active booster to tip!")); + UtilPlayer.message(player, F.main("Thanks", "There is no active booster to Thank!")); return; } _boosterManager.getTipManager().addTip(player, active, result -> { if (result == TipAddResult.SUCCESS) { - UtilPlayer.message(player, F.main("Tip", "Thanks for your tip! You earned " - + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER))); - } - else + UtilPlayer.message(player, F.main("Tip", "You thanked " + F.name(active.getPlayerName()) + ". They earned " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got " + + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!"); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + } else { if (result.getFriendlyMessage() != null) { - UtilPlayer.message(player, F.main("Tip", result.getFriendlyMessage())); + UtilPlayer.message(player, F.main("Thanks", result.getFriendlyMessage())); } } }); @@ -76,14 +78,13 @@ public class GameBoosterManager extends MiniPlugin @EventHandler public void onActivate(BoosterActivateEvent event) { - System.out.println("booster activate: " + event.getBooster()); Booster booster = event.getBooster(); - Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster for " + booster.getMultiplier() + "x Gems!" )); - } - - @EventHandler - public void onDeactivate(BoosterDeactivateEvent event) - { - System.out.println("booster deactivate: " + event.getBooster()); + if (event.getBoosterGroup().equals(_boosterGroup)) + { + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier for " + booster.getMultiplier() + "x Gems and Shards!")); + } else + { + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup().replaceAll("_", " ")) + "!")); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java index 632317ab5..118be3200 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.command; import java.lang.reflect.Field; -import java.util.List; import java.util.UUID; import mineplex.core.account.CoreClient; @@ -18,9 +17,7 @@ import mineplex.core.disguise.PlayerUndisguiseEvent; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.punish.Category; import mineplex.core.punish.PunishClient; -import mineplex.core.punish.Punishment; import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -29,15 +26,12 @@ import nautilus.game.arcade.game.Game.GameState; import net.minecraft.server.v1_8_R3.ChatComponentText; import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.EnumDifficulty; import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; -import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode; -import net.minecraft.server.v1_8_R3.WorldType; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -222,7 +216,7 @@ public class DisguiseCommand extends CommandBase implements Liste changeName(caller, args[0], true); - Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.Item); + Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.ITEM); // Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller)); UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + args[0])); @@ -431,7 +425,7 @@ public class DisguiseCommand extends CommandBase implements Liste @EventHandler public void gadget(GadgetEnableEvent event) { - if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) + if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.MORPH) return; if(_disguisedPlayers.containsKey(event.getPlayer())) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 5f358ddd0..531b5045f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -22,10 +22,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.*; import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.scoreboard.GameScoreboard; @@ -462,7 +459,7 @@ public abstract class Game implements Listener } } - if (GetType().isUsingGameModes()) + if (GetType().isUsingGameModesMaps()) { GameType mode = GetType().getModeGameType(getClass()); @@ -880,10 +877,6 @@ public abstract class Game implements Listener if (announce) { player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); - if (kit instanceof ProgressingKit && ((ProgressingKit) kit).isDefault(player.getUniqueId())) - { - player.sendMessage(F.main("Kit", "Loaded default kit " + F.elem(kit.GetFormattedName()))); - } UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); } @@ -891,6 +884,10 @@ public abstract class Game implements Listener { kit.ApplyKit(player); } + else if (!(kit instanceof ChampionsKit)) + { + player.closeInventory(); + } } public Kit GetKit(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java index d2fa87db2..f2b60267d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java @@ -9,6 +9,7 @@ public class GameServerConfig { public String ServerGroup = null; public String ServerType = null; + public String BoosterGroup = null; public int MinPlayers = -1; public int MaxPlayers = -1; public ArrayList GameList = new ArrayList(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java index c4b3dde6c..12e76f397 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java @@ -48,7 +48,7 @@ public class AbsorptionFix implements Listener { player.removePotionEffect(PotionEffectType.ABSORPTION); player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); - player.setHealth(player.getMaxHealth()); + player.setHealth(player.getHealth() + 4); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java index a81bdfde5..7627cc3ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; @@ -21,6 +22,7 @@ import org.bukkit.potion.Potion; import org.bukkit.potion.PotionType; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import nautilus.game.arcade.ArcadeManager; @@ -49,6 +51,8 @@ public class OverpoweredBridge extends Bridge WorldBoundaryKill = true; + Manager.GetDamage().SetEnabled(false); + new AbsorptionFix(this); } @@ -128,6 +132,10 @@ public class OverpoweredBridge extends Bridge public void supplyChest(PlayerPrepareTeleportEvent event) { Location chestLoc = event.GetPlayer().getLocation().clone().add(0, 0, 1); + + while (chestLoc.getBlock().getType() == Material.CHEST) + chestLoc.add(2, 0, 0); + _starterChests.put(event.GetPlayer(), chestLoc); Block block = chestLoc.getBlock(); @@ -136,8 +144,9 @@ public class OverpoweredBridge extends Bridge Chest chest = (Chest) block.getState(); - event.GetPlayer().getLocation().getBlock().setType(Material.WALL_SIGN); - Sign sign = (Sign) event.GetPlayer().getLocation().getBlock().getState(); + Block signBlock = chestLoc.clone().add(0, 0, -1).getBlock(); + signBlock.setType(Material.WALL_SIGN); + Sign sign = (Sign) signBlock.getState(); sign.setLine(0, "§b============="); sign.setLine(1, "§4§l" + event.GetPlayer().getName() + ChatColor.RESET + "§4's"); sign.setLine(2, "§4Supply Chest"); @@ -182,20 +191,20 @@ public class OverpoweredBridge extends Bridge if (event.getClickedBlock().getType() != Material.CHEST) return; - for (Player player : _starterChests.keySet()) - { - if (player == event.getPlayer()) - continue; - - if (_starterChests.get(player).getBlock().getLocation() - .equals(event.getClickedBlock().getLocation())) - { - event.setCancelled(true); - break; - } - } + if (disallow(event.getPlayer(), event.getClickedBlock())) + event.setCancelled(true); } } + + @EventHandler + public void placeChest(BlockPlaceEvent event) + { + if (event.getBlockPlaced().getType() != Material.CHEST) + return; + + if (disallow(event.getPlayer(), event.getBlock())) + event.setCancelled(true); + } @EventHandler public void CheatChestBreak(BlockBreakEvent event) @@ -219,6 +228,32 @@ public class OverpoweredBridge extends Bridge } } } + + private boolean disallow(Player clicker, Block block) + { + for (Player player : _starterChests.keySet()) + { + System.out.println("test4"); + if (player == clicker) + continue; + + System.out.println("test2"); + Location chest = _starterChests.get(player); + + if (chest.getBlock().getLocation().equals(block.getLocation())) + { + System.out.println("test1"); + return true; + } + + for (Block surround : UtilBlock.getSurrounding(block, false)) + { + if(chest.getBlock().getLocation().equals(surround.getLocation())) + return true; + } + } + return false; + } @Override public void ParseOre(ArrayList teamOre) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index f737f6790..e5aab2079 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -1505,6 +1505,11 @@ public class Build extends Game { Player player = ((Player) event.getWhoClicked()); + if (_buildGameState == 2 || _buildGameState == 3) + { + event.setCancelled(true); + } + if (IsLive() && IsAlive(player)) { BuildData buildData = _data.get(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index cc2f238b6..c6cead608 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -632,8 +632,15 @@ public class DragonEscape extends SoloGame @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { + if (!IsLive()) + return; + + if (event.getClickedBlock() == null) + return; + if(event.getClickedBlock().getType() != Material.TRAP_DOOR) return; + // Stops players using trap doors in game. event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index f90b48ed1..9543fa0b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -14,7 +14,6 @@ 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.UtilEvent; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -28,7 +27,6 @@ import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.give.Give; import mineplex.core.mount.Mount; import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.recharge.Recharge; @@ -42,7 +40,6 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.event.kits.KitPlayer; -import nautilus.game.arcade.game.games.sheep.kits.KitBrute; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.GameHostManager; @@ -61,7 +58,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; @@ -69,7 +65,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; @@ -1060,7 +1055,7 @@ public class EventGame extends Game UtilPlayer.message(player, F.main("Event", "Gadgets for area " + area.ID)); for(SalesPackageBase gadget : area.GadgetsEnabled) - UtilPlayer.message(player, F.oo(gadget.GetName(), true)); + UtilPlayer.message(player, F.oo(gadget.getName(), true)); } } @@ -1132,15 +1127,15 @@ public class EventGame extends Game { for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) { - if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[3])) + if (gadget.getName().replaceAll(" ", "").equalsIgnoreCase(args[3])) { if (_customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.remove(gadget)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget for area " + args[1], F.ed(false)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget for area " + args[1], F.ed(false)))); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget for area " + args[1], F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget for area " + args[1], F.ed(true)))); _customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.add(gadget); } @@ -1152,15 +1147,15 @@ public class EventGame extends Game //Mounts for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) { - if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[3])) + if (mount.getName().replaceAll(" ", "").equalsIgnoreCase(args[3])) { if (_customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.remove(mount)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget for area " + args[1], F.ed(false)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget for area " + args[1], F.ed(false)))); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget for area " + args[1], F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget for area " + args[1], F.ed(true)))); _customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.add(mount); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 379833f82..9f19b1475 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -15,7 +15,6 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilSystem; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilEvent.ActionType; @@ -29,16 +28,13 @@ import mineplex.core.give.Give; import mineplex.core.mount.Mount; 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.events.PlayerDeathOutEvent; import nautilus.game.arcade.game.games.bridge.Bridge; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.GameMode; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; @@ -61,7 +57,6 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -878,7 +873,7 @@ public class EventModule extends MiniPlugin if (!((EventGame) Manager.GetGame()).isAllowGadget()) { Manager.getCosmeticManager().getMountManager().DisableAll(); - Manager.getCosmeticManager().getGadgetManager().DisableAll(); + Manager.getCosmeticManager().getGadgetManager().disableAll(); } Manager.GetGame().Announce(F.main("Inventory", F.value("Allow All Gadgets", F.ed(((EventGame) Manager.GetGame()).isAllowGadget())))); @@ -903,7 +898,7 @@ public class EventModule extends MiniPlugin for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) { - items += color + gadget.GetName().replaceAll(" ", "") + " "; + items += color + gadget.getName().replaceAll(" ", "") + " "; color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA); } @@ -914,7 +909,7 @@ public class EventModule extends MiniPlugin String mounts = C.Bold + "Mount Gadgets> "; for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) { - mounts += color + mount.GetName().replaceAll(" ", "") + " "; + mounts += color + mount.getName().replaceAll(" ", "") + " "; color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA); } UtilPlayer.message(player, mounts); @@ -929,16 +924,16 @@ public class EventModule extends MiniPlugin { for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) { - if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1])) + if (gadget.getName().replaceAll(" ", "").equalsIgnoreCase(args[1])) { if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(gadget)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(false)))); - gadget.DisableForAll(); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget", F.ed(false)))); + gadget.disableForAll(); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget", F.ed(true)))); ((EventGame) Manager.GetGame()).getGadgetWhitelist().add(gadget); } @@ -950,16 +945,16 @@ public class EventModule extends MiniPlugin //Mounts for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) { - if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1])) + if (mount.getName().replaceAll(" ", "").equalsIgnoreCase(args[1])) { if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(mount)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(false)))); - mount.DisableForAll(); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget", F.ed(false)))); + mount.disableForAll(); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget", F.ed(true)))); ((EventGame) Manager.GetGame()).getGadgetWhitelist().add(mount); } @@ -1936,7 +1931,7 @@ public class EventModule extends MiniPlugin if (!Manager.GetGame().IsAlive(event.getPlayer())) return; - if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph) instanceof MorphBlock) + if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH) instanceof MorphBlock) { UtilPlayer.message(player, F.main("Stacker", "You cannot stack while using the Block Morph.")); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index e1d90d398..1ed85835a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -175,24 +175,24 @@ public class PerkBlockTossEVO extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.PROJECTILE, data.GetThrown().getVelocity().length() * 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, + DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 4, true, true, false, + UtilEnt.getName(data.getThrower()), GetName()); //Block to Item - if (data.GetThrown() instanceof FallingBlock) + if (data.getThrown() instanceof FallingBlock) { - FallingBlock thrown = (FallingBlock) data.GetThrown(); + FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte)0); //Remove Old _falling.remove(thrown); thrown.remove(); //Add New - if (data.GetThrower() instanceof Player) - _falling.put(newThrown, (Player)data.GetThrower()); + if (data.getThrower() instanceof Player) + _falling.put(newThrown, (Player)data.getThrower()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index 504ee6d9a..4baac10db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -103,9 +103,9 @@ public class PerkSulphurBombEVO extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 5, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -122,10 +122,10 @@ public class PerkSulphurBombEVO extends Perk implements IThrown public void Explode(ProjectileUser data) { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index a1ef621a3..a23144570 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -85,7 +85,7 @@ public class PerkWebEVO extends Perk implements IThrown { if (Manager.GetGame().IsAlive((Player)target)) { - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.CUSTOM, 8, false, false, false, "Web Shot", "Webbed Net"); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 8, false, false, false, "Web Shot", "Webbed Net"); target.playEffect(EntityEffect.HURT); } else @@ -112,9 +112,9 @@ public class PerkWebEVO extends Perk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); + Location loc = data.getThrown().getLocation(); - data.GetThrown().remove(); + data.getThrown().remove(); if (loc.getBlock().getType() != Material.AIR) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java index 9ffc569ae..61f38d12e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java @@ -21,7 +21,7 @@ public class HotbarInventory { Inventory inv = UtilServer.getServer().createInventory(null, 36, "Hotbar Editor"); - for (int slot : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26)) + for (int slot : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 33, 34, 35)) { inv.setItem(slot, getGlass(slot)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java index 736de92df..ead613383 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java @@ -8,12 +8,21 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; /** * Created by William (WilliamTiger). @@ -27,7 +36,7 @@ public class HotbarPageListener implements Listener { _editor = editor; } - + @EventHandler public void onClick(InventoryClickEvent e) { @@ -140,4 +149,51 @@ public class HotbarPageListener implements Listener i.remove(); } + + @EventHandler + public void updateInv(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Player player : UtilServer.GetPlayers()) + { + if (player.getOpenInventory() == null) + continue; + + if (player.getOpenInventory().getTopInventory() == null) + continue; + + if (!player.getOpenInventory().getTopInventory().getName().equals("Hotbar Editor")) + continue; + + for (Material mat : new Material[]{Material.DIAMOND_SWORD, Material.BOW, Material.FISHING_ROD, Material.ARROW}) + { + boolean founditem = false; + for (ItemStack item : player.getOpenInventory().getTopInventory().getContents()) + { + if (item != null && item.getType() == mat) + { + founditem = true; + } + } + if (player.getItemOnCursor() != null) + { + if (player.getItemOnCursor().getType() == mat) + founditem = true; + } + + if (!founditem) + { + player.getOpenInventory().getTopInventory().addItem(new ItemStack(mat)); + } + + + if (UtilInv.contains(player, null, mat, (byte) 0, 1, false, true, false)) + { + UtilInv.removeAll(player, mat, (byte) 0); + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 93d9bb2bd..10b5abe6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -566,26 +566,26 @@ public class BombLobbers extends TeamGame implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (!(data.GetThrown() instanceof TNTPrimed)) + if (!(data.getThrown() instanceof TNTPrimed)) return; - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; if (!(target instanceof Player)) return; - if (GetTeam((Player) target) == GetTeam((Player) data.GetThrower())) + if (GetTeam((Player) target) == GetTeam((Player) data.getThrower())) return; - data.GetThrown().setVelocity(new Vector()); + data.getThrown().setVelocity(new Vector()); if (target != null) - UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); + UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 10.0, false, false, false, "Throwing TNT", "Throwing TNT Direct Hit"); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 10.0, false, false, false, "Throwing TNT", "Throwing TNT Direct Hit"); - AddGems((Player) data.GetThrower(), 4.0, "Direct Hit", true, true); + AddGems((Player) data.getThrower(), 4.0, "Direct Hit", true, true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 90550c8c4..89a415a4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -7,6 +7,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; @@ -76,6 +77,11 @@ public class PerkWaller extends Perk return; } + if (!Recharge.Instance.usable(event.getPlayer(), "Waller")) + return; + + Recharge.Instance.use(event.getPlayer(), "Waller", 100, false, false); + UtilInv.remove(event.getPlayer(), Material.STONE_SPADE, (byte) 0, 1); _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java index 538f3aeb5..77e965310 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java @@ -225,7 +225,7 @@ public class TowerManager implements Listener { public void run() { - UtilTextMiddle.display("", towerBase.getTeam().GetColor() + towerBase.getTeam().GetName() + " Team ores have been replenished!", UtilServer.getPlayers()); + UtilTextMiddle.display("", towerBase.getTeam().GetColor() + towerBase.getTeam().getName() + " Team ores have been replenished!", UtilServer.getPlayers()); } }, 20 * 5);*/ //_mapZone.get(towerBase).setValid(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 19073efd4..33e1bd360 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -431,7 +431,7 @@ public class MineStrike extends TeamGame { mat = knifeSkin.getSkinMaterial(); data = knifeSkin.getSkinData(); - name = knifeSkin.GetName(); + name = knifeSkin.getName(); } ItemStack knife = ItemStackFactory.Instance.CreateStack(mat, data, 1, name); @@ -1552,9 +1552,9 @@ public class MineStrike extends TeamGame int kills = GetStats().get(killer).get("") ItemStack item = killer.getInventory().getItem(2); ItemMeta im = item.getItemMeta(); - im.setDisplayName(C.cYellow + C.Bold + knifeSkin.GetName() + " - Kills: " + kills); + im.setDisplayName(C.cYellow + C.Bold + knifeSkin.getName() + " - Kills: " + kills); - AddStat(killer, "Knife." + knifeSkin.GetName() + ".Kills", 1, false, false); + AddStat(killer, "Knife." + knifeSkin.getName() + ".Kills", 1, false, false); } } */ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index 3a9cfc761..cabfdcf94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -453,7 +453,7 @@ public class Gun extends StrikeItem if(skin == null) return; setSkin(skin.getSkinMaterial(), skin.getSkinData()); - _activeSkinName = skin.GetName(); + _activeSkinName = skin.getName(); owner.getInventory().setItem(_slot, getStack()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index f863678e3..672a55872 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -312,8 +312,8 @@ public class PerkPaintballSniper extends Perk implements IPacketHandler if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName()); -// if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) -// Manager.GetCondition().EndCondition(player, ConditionType.JUMP, GetName()); +// if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, getName())) +// Manager.GetCondition().EndCondition(player, ConditionType.JUMP, getName()); } private void addEffects(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 257a83e85..893db786b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -315,18 +315,18 @@ public class Runner extends SoloGame implements IThrown return; } - if (target.getLocation().getY() > data.GetThrown().getLocation().getY() + 0.5) + if (target.getLocation().getY() > data.getThrown().getLocation().getY() + 0.5) { return; } } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.ENTITY_ATTACK, 6, true, true, false, "Falling Block", "Falling Block"); - BlockSmash(data.GetThrown()); + BlockSmash(data.getThrown()); } public HashMap getBlocks() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java index ebb419815..5fc2ba8df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java @@ -214,13 +214,13 @@ public class SearchAndDestroy extends TeamGame /* if (getBombs().size() == 1) { GameTeam winning = getBombs().get(0).getTeam(); - Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team's" + ChatColor.RESET - + ChatColor.GOLD + " bomb exploded! " + winning.GetColor() + winning.GetName() + Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.getName() + " Team's" + ChatColor.RESET + + ChatColor.GOLD + " bomb exploded! " + winning.GetColor() + winning.getName() + ChatColor.RESET + ChatColor.GOLD + " wins!"); } else { - Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team was defeated!"); + Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.getName() + " Team was defeated!"); }*/ } if (timeLeft > 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 019d23f96..a99565c9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -674,8 +674,7 @@ public abstract class Skywars extends Game Player player = e.getPlayer(); if (is.getType() == Material.TNT) { - e.setCancelled(true); - _tntGen.pickup(player, e.getItem()); + e.setCancelled(_tntGen.pickup(player, e.getItem())); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java index ebff5b18f..cd05c76e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java @@ -76,23 +76,23 @@ public class TNTGenerator .trail(true).build()); } - public void pickup(Player player, Item item) + public boolean pickup(Player player, Item item) { if (_ent == null) - return; + return false; if (!_ent.equals(item)) - return; + return false; if (!Host.IsAlive(player)) - return; + return true; if (Host.Manager.isSpectator(player)) - return; + return true; GameTeam team = Host.GetTeam(player); if (team == null) - return; + return true; // Remove _ent.remove(); @@ -124,6 +124,7 @@ public class TNTGenerator player.playSound(player.getLocation(), Sound.ENDERDRAGON_HIT, 3F, 1F); Bukkit.getPluginManager().callEvent(new TNTPickupEvent(player)); + return true; } public String getScoreboardInfo() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 75c3bf46d..2ce62d81c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -1,17 +1,7 @@ package nautilus.game.arcade.game.games.smash; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - import mineplex.core.common.block.BlockData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.*; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -24,40 +14,11 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.smash.kits.KitBlaze; -import nautilus.game.arcade.game.games.smash.kits.KitChicken; -import nautilus.game.arcade.game.games.smash.kits.KitCow; -import nautilus.game.arcade.game.games.smash.kits.KitCreeper; -import nautilus.game.arcade.game.games.smash.kits.KitEnderman; -import nautilus.game.arcade.game.games.smash.kits.KitGolem; -import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; -import nautilus.game.arcade.game.games.smash.kits.KitPig; -import nautilus.game.arcade.game.games.smash.kits.KitSheep; -import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse; -import nautilus.game.arcade.game.games.smash.kits.KitSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; -import nautilus.game.arcade.game.games.smash.kits.KitSlime; -import nautilus.game.arcade.game.games.smash.kits.KitSnowman; -import nautilus.game.arcade.game.games.smash.kits.KitSpider; -import nautilus.game.arcade.game.games.smash.kits.KitWitch; -import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitWolf; -import nautilus.game.arcade.game.games.smash.kits.KitZombie; +import nautilus.game.arcade.game.games.smash.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.stats.FreeKitWinStatTracker; -import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.OneVThreeStatTracker; -import nautilus.game.arcade.stats.RecoveryMasterStatTracker; -import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; +import org.bukkit.*; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.Player; @@ -72,6 +33,9 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import java.util.HashMap; +import java.util.HashSet; + public abstract class SuperSmash extends Game { private HashMap _lives = new HashMap(); @@ -375,6 +339,7 @@ public abstract class SuperSmash extends Game if (announce) { + player.closeInventory(); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); kit.ApplyKit(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java index 29fd02576..6ca0a54e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java @@ -173,26 +173,26 @@ public class PerkFishFlurry extends SmashPerk implements IThrown if (target != null) { //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 93fd43c1e..99bd044f1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -170,14 +170,14 @@ public class Stacker extends SoloGame implements IThrown hit = hit.getVehicle(); //Hit Own Stack > Rethrow - if (hit.equals(data.GetThrower())) + if (hit.equals(data.getThrower())) { - Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, -1, true, false, true, false, 1f); + Manager.GetProjectile().AddThrow(data.getThrown(), data.getThrower(), this, -1, true, false, true, false, 1f); return; } //Velocity on base component - UtilAction.velocity(hit, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); + UtilAction.velocity(hit, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); //Shuffle Up Entity top = target; @@ -192,10 +192,10 @@ public class Stacker extends SoloGame implements IThrown rider = rider.getPassenger(); } - UtilPlayer.message(target, F.main("Game", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); + UtilPlayer.message(target, F.main("Game", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.name(UtilEnt.getName(data.getThrown())))); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 37e1ab59a..f59a36d02 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -37,6 +37,7 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -240,7 +241,7 @@ public abstract class SurvivalGames extends Game BlockBreakAllow.add(Material.VINE.getId()); BlockBreakAllow.add(Material.WATER_LILY.getId()); - // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", + // Manager.GetStatsManager().addTable(getName(), "kills", "deaths", // "chestsOpened"); setupLoot(); @@ -1922,7 +1923,7 @@ public abstract class SurvivalGames extends Game if (killer != null && !killer.equals(killed)) { - // Manager.GetStatsManager().addStat(killer, GetName(), "kills", + // Manager.GetStatsManager().addStat(killer, getName(), "kills", // 1); } } @@ -1931,11 +1932,20 @@ public abstract class SurvivalGames extends Game { if (killed != null) { - // Manager.GetStatsManager().addStat(killed, GetName(), + // Manager.GetStatsManager().addStat(killed, getName(), // "deaths", 1); } } } + + @EventHandler + public void craftedItems(CraftItemEvent event) + { + if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem())) + { + UtilItem.makeUnbreakable(event.getCurrentItem()); + } + } @EventHandler public void UpdateNametagVisibility(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 9222cd907..f9ce3f31e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -251,7 +251,7 @@ public class SurvivalGamesTeams extends TeamGame System.out.println("==================="); System.out.println("CREEP TYPE: " + _spreadName); System.out.println("==================="); - //Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened"); + //Manager.GetStatsManager().addTable(getName(), "kills", "deaths", "chestsOpened"); //Tournament if (Manager.IsTournamentServer()) @@ -1554,7 +1554,7 @@ public class SurvivalGamesTeams extends TeamGame if (killer != null && !killer.equals(killed)) { - //Manager.GetStatsManager().addStat(killer, GetName(), "kills", 1); + //Manager.GetStatsManager().addStat(killer, getName(), "kills", 1); } } @@ -1562,7 +1562,7 @@ public class SurvivalGamesTeams extends TeamGame { if (killed != null) { - //Manager.GetStatsManager().addStat(killed, GetName(), "deaths", 1); + //Manager.GetStatsManager().addStat(killed, getName(), "deaths", 1); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 6eaba6e26..0999ecd4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1,8 +1,13 @@ package nautilus.game.arcade.game.games.uhc; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -35,6 +40,19 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_8_R3.BiomeCache; +import net.minecraft.server.v1_8_R3.ChunkCoordIntPair; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.EmptyChunk; +import net.minecraft.server.v1_8_R3.ExceptionWorldConflict; +import net.minecraft.server.v1_8_R3.FileIOThread; +import net.minecraft.server.v1_8_R3.IChunkLoader; +import net.minecraft.server.v1_8_R3.IChunkProvider; +import net.minecraft.server.v1_8_R3.LongHashMap; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; +import net.minecraft.server.v1_8_R3.WorldChunkManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -46,6 +64,9 @@ import org.bukkit.WorldBorder; import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.generator.NormalChunkGenerator; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -86,19 +107,21 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; +import org.spigotmc.WatchdogThread; public class UHC extends TeamGame { private NautHashMap _teamReqs = new NautHashMap(); - + private NautHashMap _deathTime = new NautHashMap(); // private NautHashMap _combatTime = new NautHashMap(); - private boolean _mapLoaded = false; - private double _mapLoadPercent = 0; - private int _chunksPerTick = 1; + private volatile boolean _mapLoaded = false; + private volatile double _mapLoadPercent = 0; + private volatile int _chunksPerTick = 1; + private volatile boolean stopGen = false; + private int _chunkTotal; - private Chunk _chunk = null; private int _chunkX = 0; private int _chunkZ = 0; private int _chunksLoaded = 0; @@ -111,7 +134,7 @@ public class UHC extends TeamGame private long _createTime; private long _serverTime; - + private boolean xrayDebug = false; @@ -139,21 +162,21 @@ public class UHC extends TeamGame { super(manager, type, - new Kit[] - { - new KitUHC(manager) - }, + new Kit[] + { + new KitUHC(manager) + }, - new String[] - { - "10 minutes of no PvP", "Only Golden Apples restore health", "Ores can only be found in caves", - "Borders shrink over time", "Last player/team alive wins!" - }); + new String[] + { + "10 minutes of no PvP", "Only Golden Apples restore health", "Ores can only be found in caves", + "Borders shrink over time", "Last player/team alive wins!" + }); this.HideTeamSheep = true; - + this.StrictAntiHack = true; - + AnnounceStay = false; this.GameTimeout = 10800000; @@ -203,7 +226,7 @@ public class UHC extends TeamGame this.GadgetsDisabled = true; WorldTimeSet = -1; - + CraftRecipes(); // Disable Custom Mob Drops (and EXP Disable) @@ -225,8 +248,8 @@ public class UHC extends TeamGame @Override public void ParseData() { - WorldData.World.setDifficulty(Difficulty.HARD); - + WorldData.World.setDifficulty(Difficulty.HARD); + _chunkX = (int) -(_currentBorder / 16); _chunkZ = (int) -(_currentBorder / 16); _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); @@ -368,84 +391,6 @@ public class UHC extends TeamGame return borders; } - @EventHandler - public void loadMap(UpdateEvent event) - { - if (_mapLoaded) - return; - - if (WorldData.World == null) - return; - - if (GetState() != GameState.Recruit) - return; - - // Print Debug - if (event.getType() == UpdateType.SLOWER) - { - Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); - - TimingManager.endTotal("UHC Generation", true); - return; - } - - if (event.getType() != UpdateType.TICK) - return; - - // Timings - TimingManager.startTotal("UHC Generation"); - - for (int i = 0; i < _chunksPerTick ; i++) - { - // Unload Previous -// if (_chunk != null) -// _chunk.unload(true); - - // Load Chunks - _chunk = WorldData.World.getChunkAt(_chunkX, _chunkZ); - _chunk.load(true); - - // Scan Map - if (_chunkX < _currentBorder / 16) - { - _chunkX++; - } - else if (_chunkZ < _currentBorder / 16) - { - _chunkX = (int) -(_currentBorder / 16); - _chunkZ++; - } - else - { - _mapLoaded = true; - System.out.println("Map Loading Finished!"); - generateSpawns(); - break; - } - - _chunksLoaded++; - } - - _mapLoadPercent = (double)_chunksLoaded / (double)_chunkTotal; - - // Timings - TimingManager.stopTotal("UHC Generation"); - } - - @EventHandler - public void chunkUnload(ChunkUnloadEvent event) - { - //Allow unloading after players in - if (IsLive()) - return; - - if (WorldData.World != null && event.getWorld().equals(WorldData.World)) - { - System.out.println("Disallowing Unload of World"); - event.setCancelled(true); - } - } - public void generateSpawns() { // Wipe Spawns @@ -467,7 +412,7 @@ public class UHC extends TeamGame double dist = (2 * _currentBorder) / (Math.sqrt(this.GetPlayers(true).size()) + 3); // Ensure distance between Teams - 500 Attempts - for (int i=0 ; i<500 ; i++) + for (int i = 0; i < 500; i++) { boolean clash = false; @@ -500,7 +445,7 @@ public class UHC extends TeamGame double dist = (2 * _currentBorder) / (Math.sqrt(GetTeamList().size()) + 3); // Ensure distance between Teams - 500 Attempts - for (int i=0 ; i<500 ; i++) + for (int i = 0; i < 500; i++) { boolean clash = false; @@ -622,63 +567,183 @@ public class UHC extends TeamGame } } - /*@EventHandler - public void WorldBoundaryCheck(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - for (Player player : GetPlayers(true)) - { - //Damage - if (Math.abs(player.getLocation().getX()) > _borderSize || Math.abs(player.getLocation().getZ()) > _borderSize) - { - player.damage(0.75); - } - } - } - @EventHandler - public void WorldBoundaryShrink(UpdateEvent event) + public void generateWorld(GameStateChangeEvent event) { - if (!IsLive()) + if (event.GetState() == GameState.Dead) + { + stopGen = true; return; + } - if (event.getType() == UpdateType.SLOW) - if (_borderSize > 16) - _borderSize--; - } - - //@EventHandler - public void WorldBoundarySet(GameStateChangeEvent event) - { if (event.GetState() != GameState.Recruit) + { return; + } - long time = System.currentTimeMillis(); - - this.WorldData.MinX = -_borderSize; - this.WorldData.MaxX = _borderSize; - this.WorldData.MinZ = -_borderSize; - this.WorldData.MaxZ = _borderSize; - - this.WorldData.MinY = -1000; - this.WorldData.MaxY = 1000; - - //Find Y Max - for (int x=-16 ; x<16 ; x++) - for (int z=-16 ; z<16 ; z++) + new Thread(() -> + { + try { - int y = UtilBlock.getHighest(WorldData.World, x, z).getY(); + Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); + fileIOThreadB.setAccessible(true); - if (y > _yMax) - _yMax = y; + // This list is the list of chunks to be saved on the File IO Thread + List list = (List) fileIOThreadB.get(FileIOThread.a()); + + net.minecraft.server.v1_8_R3.WorldServer worldServer = ((CraftWorld) WorldData.World).getHandle(); + + WorldChunkManager manager = worldServer.getWorldChunkManager(); + + Field biomeCacheField = manager.getClass().getDeclaredField("d"); + biomeCacheField.setAccessible(true); + + // A thread safe BiomeCache + // The implementation is literally a copy/paste from the original BiomeCache, but with some synchronization + // Reason being while the server is ticking the world (for some reason, if you want to dig through the entire Arcade codebase go for it) + // it stores stuff in the BiomeCache, and chunk gen needs that BiomeCache info too + // Causing desynchronization in the cache + biomeCacheField.set(manager, new BiomeCache(manager) + { + private final Object _lock = new Object(); + + private long _lastCleanTime; // b -> _lastCleanTime + private Map _blockByCoord = new HashMap<>(); // LongHashMap -> HashMap, c -> _blockByCoord + private List _blocks = new ArrayList<>(); // d -> _blocks + + @Override + public BiomeCache.BiomeCacheBlock a(int x, int z) + { + x >>= 4; + z >>= 4; + long var3 = hash(x, z); + BiomeCache.BiomeCacheBlock var5 = this._blockByCoord.get(var3); + if (var5 == null) + { + var5 = new BiomeCache.BiomeCacheBlock(x, z); + synchronized (_lock) + { + this._blockByCoord.put(var3, var5); + this._blocks.add(var5); + } + } + + var5.e = MinecraftServer.az(); + return var5; + } + + @Override + public void a() + { + long currentTime = MinecraftServer.az(); + long deltaTime = currentTime - this._lastCleanTime; + if (deltaTime > 7500L || deltaTime < 0L) + { + this._lastCleanTime = currentTime; + + synchronized (_lock) + { + for (int i = 0; i < this._blocks.size(); ++i) + { + BiomeCache.BiomeCacheBlock biomeCacheBlock = (BiomeCache.BiomeCacheBlock) this._blocks.get(i); + long var7 = currentTime - biomeCacheBlock.e; + if (var7 > 30000L || var7 < 0L) + { + this._blocks.remove(i--); + this._blockByCoord.remove(hash(biomeCacheBlock.c, biomeCacheBlock.d)); + } + } + } + } + } + + private long hash(int x, int z) + { + return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; + } + }); + + ChunkProviderServer cps = worldServer.chunkProviderServer; + IChunkProvider icp = cps.chunkProvider; + System.out.println("Using chunk provider " + icp.getClass()); + + TimingManager.start("Map Generation"); + + long start = System.currentTimeMillis(); + long last = start; + + while (!stopGen) + { + long now = System.currentTimeMillis(); + if ((now - last) >= 4000) + { + Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); + last = now; + } + + long hash = LongHash.toLong(_chunkX, _chunkZ); + + // This is just a shortcut to how the Minecraft server would have generated a chunk if it doesn't exist. + // This should always create a chunk because we're not loading any chunks beforehand... + // /me looks at new maintainer + net.minecraft.server.v1_8_R3.Chunk chunk = icp.getOrCreateChunk(_chunkX, _chunkZ); + + // Run the copypasted code for chunk saving. + cps.saveChunk(chunk); + cps.saveChunkNOP(chunk); + cps.unloadQueue.remove(_chunkX, _chunkZ); + cps.chunks.remove(hash); + + if (_chunkX < _currentBorder / 16) + { + _chunkX++; + } + else if (_chunkZ < _currentBorder / 16) + { + _chunkX = (int) -(_currentBorder / 16); + _chunkZ++; + } + else + { + _mapLoaded = true; + System.out.println("Map Loading Finished! Took " + TimeUnit.MILLISECONDS.toSeconds(now - start) + " seconds"); + break; + } + + _chunksLoaded++; + + // Clamp it so we don't get 101% + _mapLoadPercent = UtilMath.clamp((double) _chunksLoaded / (double) _chunkTotal, 0.0, 1.0); + _chunksPerTick = (int) (_chunksLoaded / ((now - start) / 50.0)); + } + + TimingManager.stop("Map Generation"); + + if (stopGen) + { + return; + } + + TimingManager.start("Map Saving"); + + // Wait for all the chunks to save (but do we need this?) + while (!list.isEmpty()) + { + Thread.sleep(100); + } + + TimingManager.stop("Map Saving"); + + getArcadeManager().runSync(this::generateSpawns); } - - System.out.println("Y Max: " + _yMax); - - System.out.println("Time: " + UtilTime.MakeStr(System.currentTimeMillis() - time)); - }*/ + catch (Throwable t) + { + // todo proper exception handling + // maybe force shutdown? + t.printStackTrace(); + } + }, "WorldGen Thread").start(); + } @EventHandler public void WorldBoundaryYLimit(BlockPlaceEvent event) @@ -865,45 +930,6 @@ public class UHC extends TeamGame event.setLeaveMessage(null); } - /* - @EventHandler(priority = EventPriority.LOWEST) - public void PlayerQuit(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - GameTeam team = GetTeam(player); - if (team == null) return; - - if (!team.IsAlive(player)) - return; - - team.RemovePlayer(player); - - if (player.isDead()) - return; - - - if (true) - { - //Announcement - Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting."); - - player.damage(5000); - return; - } - - - if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000)) - { - //Announcement - Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat."); - - player.damage(5000); - return; - } - } - */ - @EventHandler public void CreatureCull(UpdateEvent event) { @@ -1074,37 +1100,6 @@ public class UHC extends TeamGame } } - /* - @EventHandler - public void HeadEat(PlayerInteractEvent event) - { - if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.SKULL_ITEM)) - { - UtilPlayer.message(event.getPlayer(), "You ate " + event.getPlayer().getItemInHand().getItemMeta().getDisplayName() + ChatColor.RESET + "."); - - (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer()); - (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer()); - - event.getPlayer().setItemInHand(null); - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.MONITOR) - public void DamageHealCancel(EntityDamageEvent event) - { - if (event.isCancelled()) - return; - - if (event.getEntity() instanceof Player) - { - Player player = (Player)event.getEntity(); - player.removePotionEffect(PotionEffectType.REGENERATION); - - UtilPlayer.message(player, "You took damage and lost " + F.elem(C.cGreen + "Regeneration") + ChatColor.RESET + "."); - } - }*/ - @EventHandler public void ConsumeHeadApple(PlayerItemConsumeEvent event) { @@ -1139,30 +1134,6 @@ public class UHC extends TeamGame { if (event.getMessage().startsWith("/kill")) event.setCancelled(true); - - // if (event.getMessage().startsWith("/uhc time day")) - // { - // this.WorldTimeSet = 4000; - // event.setCancelled(true); - // - // Announce(event.getPlayer().getName() + " set time to Always Day!"); - // } - // - // if (event.getMessage().startsWith("/uhc time night")) - // { - // this.WorldTimeSet = 16000; - // event.setCancelled(true); - // - // Announce(event.getPlayer().getName() + " set time to Always Night!"); - // } - // - // if (event.getMessage().startsWith("/uhc time cycle")) - // { - // this.WorldTimeSet = -1; - // event.setCancelled(true); - // - // Announce(event.getPlayer().getName() + " set time to Day and Night!"); - // } } @EventHandler(priority = EventPriority.LOWEST) @@ -1228,8 +1199,17 @@ public class UHC extends TeamGame if (teamsAlive.size() <= 1) { if (teamsAlive.size() > 0) + { for (Player player : teamsAlive.get(0).GetPlayers(false)) - AddGems(player, 8000, "Winning Team", false, false); + { + long ingameTime = getPlayerIngameTime(player); + if (ingameTime == 0) + ingameTime = GetStateTime(); + + int gems = Math.round((System.currentTimeMillis() - ingameTime)/1000); + AddGems(player, gems, "Winning Team", false, false); + } + } AnnounceEnd(teamsAlive.get(0)); SetState(GameState.End); @@ -1640,27 +1620,27 @@ public class UHC extends TeamGame return _mapLoaded; } - public String getMapLoadPercent() + public String getMapLoadPercent() { - return (int)(_mapLoadPercent * 100) + "%"; + return (int) (_mapLoadPercent * 100) + "%"; } - - public String getMapLoadETA() + + public String getMapLoadETA() { int chunksToGo = _chunkTotal - _chunksLoaded; - - return UtilTime.MakeStr((long) ((double)chunksToGo / (double)(_chunksPerTick * 20) * 1000d), 1); + + return UtilTime.MakeStr((long) ((double) chunksToGo / (double) (_chunksPerTick * 20) * 1000d), 1); } - + @EventHandler(priority = EventPriority.HIGH) public void teamSelectInteract(PlayerInteractEntityEvent event) { if (GetState() != GameState.Recruit) return; - + if (event.getRightClicked() == null) return; - + if (!(event.getRightClicked() instanceof Player)) return; @@ -1673,34 +1653,34 @@ public class UHC extends TeamGame return; } - selectTeamMate(player, (Player)event.getRightClicked()); + selectTeamMate(player, (Player) event.getRightClicked()); } - + @EventHandler public void teamSelectCommand(PlayerCommandPreprocessEvent event) { if (GetState() != GameState.Recruit) return; - + if (!event.getMessage().toLowerCase().startsWith("/team ")) return; - + event.setCancelled(true); - + Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true); if (target == null) return; - + //Observer if (Manager.IsObserver(event.getPlayer())) { UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games.")); return; } - + if (event.getPlayer().equals(target)) return; - + selectTeamMate(event.getPlayer(), target); } @@ -1712,28 +1692,28 @@ public class UHC extends TeamGame //Remove Prefs _teamReqs.remove(player); _teamReqs.remove(ally); - + //Inform UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!")); UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!")); - + //Leave Old Teams if (GetTeam(player) != null) GetTeam(player).DisbandTeam(); - + if (GetTeam(ally) != null) GetTeam(ally).DisbandTeam(); - + //Get Team GameTeam team = getEmptyTeam(); if (team == null) return; - - team.setDisplayName(player.getName() + " & " + ally.getName()); - + + team.setDisplayName(player.getName() + " & " + ally.getName()); + //Join Team SetPlayerTeam(player, team, true); - SetPlayerTeam(ally, team, true); + SetPlayerTeam(ally, team, true); } //Send Invite else @@ -1742,33 +1722,33 @@ public class UHC extends TeamGame if (GetTeam(player) != null) if (GetTeam(player).HasPlayer(ally)) return; - + //Inform Player UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!")); - + //Inform Target if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false)) { UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!")); UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!")); } - + //Add Pref _teamReqs.put(player, ally); } } - + @EventHandler public void teamQuit(PlayerQuitEvent event) { if (GetState() != GameState.Recruit) return; - + Player player = event.getPlayer(); - + if (GetTeam(player) != null) GetTeam(player).DisbandTeam(); - + Iterator teamIter = _teamReqs.keySet().iterator(); while (teamIter.hasNext()) { @@ -1777,7 +1757,7 @@ public class UHC extends TeamGame teamIter.remove(); } } - + public GameTeam getEmptyTeam() { for (GameTeam team : GetTeamList()) @@ -1785,7 +1765,7 @@ public class UHC extends TeamGame if (team.GetPlayers(false).isEmpty()) return team; } - + return null; } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java index 9e8024a27..586b126e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java @@ -22,7 +22,7 @@ public class KitHumanArcher extends ProgressingKit "Skilled in the art of long range combat", "", receiveArrowString(1, 4, 4), - "Your arrows give Blindness for" + C.cGreen + 4 + C.cWhite + " seconds", + "Your arrows give Blindness for " + C.cGreen + 4 + C.cWhite + " seconds", C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump" }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index 9ab574b9b..6ab2f5018 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -18,6 +18,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -955,7 +956,10 @@ public class Wizards extends SoloGame containsSpell = true; UtilInv.addDullEnchantment(item); } - + + if (UtilItem.isArmor(item)) + UtilItem.makeUnbreakable(item); + inv.setItem(UtilMath.r(inv.getSize()), item); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java index baabb5ae0..8fdab34d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java @@ -67,7 +67,7 @@ public class SpellIcePrison extends Spell implements SpellClick, IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (target != data.GetThrower()) + if (target != data.getThrower()) { IcePrison(data); } @@ -81,11 +81,11 @@ public class SpellIcePrison extends Spell implements SpellClick, IThrown public void IcePrison(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); HashMap blocks = UtilBlock.getInRadius(loc.getBlock(), - data.GetThrown().getMetadata("PrisonStrength").get(0).asDouble(), true); + data.getThrown().getMetadata("PrisonStrength").get(0).asDouble(), true); for (Block block : blocks.keySet()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java index 94181f076..aad833881 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java @@ -85,7 +85,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown // Damage Event Wizards.getArcadeManager() .GetDamage() - .NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true, + .NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true, false, "Ice Shard", "Ice Shard"); } @@ -95,8 +95,8 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown private void handleShard(ProjectileUser data) { - data.GetThrown().remove(); - Location loc = data.GetThrown().getLocation(); + data.getThrown().remove(); + Location loc = data.getThrown().getLocation(); UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0.3F, 0.3F, 0.3F, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); @@ -118,7 +118,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown } } - _lastParticles.remove(data.GetThrown()); + _lastParticles.remove(data.getThrown()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java index 73e1f544b..567078d29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java @@ -19,7 +19,6 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public class SpellWebShot extends Spell implements SpellClick, IThrown { @@ -67,9 +66,9 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (target != data.GetThrower()) + if (target != data.getThrower()) { - Location loc = data.GetThrown().getLocation(); + Location loc = data.getThrown().getLocation(); if (target != null) { @@ -94,7 +93,7 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown // Damage Event /* Wizards.getArcadeManager() .GetDamage() - .NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false, + .NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 2, false, false, false, "Web Shot", "Web Shot");*/ } @@ -149,18 +148,18 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown @Override public void Idle(ProjectileUser data) { - Web(data, data.GetThrown().getLocation()); + Web(data, data.getThrown().getLocation()); } @Override public void Expire(ProjectileUser data) { - Web(data, data.GetThrown().getLocation()); + Web(data, data.getThrown().getLocation()); } public void Web(ProjectileUser data, Location loc) { - data.GetThrown().remove(); + data.getThrown().remove(); Block block = getValidLocation(loc); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index 609d3ba39..4985238d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -292,7 +292,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit if (this.GetAvailability() == KitAvailability.Free || Manager.hasKitsUnlocked(player) || (this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) || - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + this.GetName()) || + donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) || Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament) { @@ -306,7 +306,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit { Manager.GetGame().SetKit(player, this, true); } - }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), this), CurrencyType.GEM, player)); + }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this), CurrencyType.GEM, player)); } else if (this.GetAvailability() == KitAvailability.Achievement) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java index 139b0c22f..a277c147e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java @@ -5,6 +5,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -117,6 +118,19 @@ public abstract class SmashKit extends ProgressingKit UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + _superName, 5, 50, 5, UtilServer.getPlayers()); } } + + @EventHandler + public void onEnd(GameStateChangeEvent event) + { + Iterator superIter = _superActive.keySet().iterator(); + + while (superIter.hasNext()) + { + Player player = superIter.next(); + superIter.remove(); + deactivateSuper(player); + } + } @EventHandler public void expireSuper(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java index 116183c92..21af9546c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java @@ -4,6 +4,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -51,10 +52,10 @@ public class PerkApple extends Perk implements IThrown if (!Manager.GetGame().IsAlive(player)) continue; - if (!Recharge.Instance.use(player, "Apple Spawn", 10000, false, false)) + if (!Recharge.Instance.use(player, getMessage(player), 10000, false, false)) continue; - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(260)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(getMaterial(player))); player.playSound(player.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); } } @@ -68,7 +69,7 @@ public class PerkApple extends Perk implements IThrown if (event.getPlayer().getItemInHand() == null) return; - if (event.getPlayer().getItemInHand().getType() != Material.APPLE) + if (event.getPlayer().getItemInHand().getType() != getMaterial(event.getPlayer())) return; Player player = event.getPlayer(); @@ -78,10 +79,10 @@ public class PerkApple extends Perk implements IThrown event.setCancelled(true); - UtilInv.remove(player, Material.APPLE, (byte)0, 1); + UtilInv.remove(player, getMaterial(player), (byte)0, 1); UtilInv.Update(player); - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)); + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(getMaterial(player))); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f); } @@ -94,25 +95,25 @@ public class PerkApple extends Perk implements IThrown if (target instanceof Player) { - if (!Manager.GetGame().IsAlive((Player)target)) + if (!Manager.GetGame().IsAlive(target)) { return; } } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); //Re-Drop - if (data.GetThrown() instanceof Item) - data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)).setPickupDelay(60); + if (data.getThrown() instanceof Item && data.getThrown() instanceof Player) + data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(getMaterial((Player) data.getThrower()))).setPickupDelay(60); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override @@ -126,4 +127,22 @@ public class PerkApple extends Perk implements IThrown { } + + private Material getMaterial(Player player) + { + if (Manager.getCosmeticManager().getGadgetManager().isKitModifierActive(KitModifier.Bridges_Apple_Potato, player)) + { + return Material.POTATO_ITEM; + } + return Material.APPLE; + } + + private String getMessage(Player player) + { + if (Manager.getCosmeticManager().getGadgetManager().isKitModifierActive(KitModifier.Bridges_Apple_Potato, player)) + { + return "Potato Spawn"; + } + return "Apple Spawn"; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java index b2b49cb86..5f4aab77b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java @@ -74,7 +74,7 @@ public class PerkAxeThrower extends Perk implements IThrown if (!Manager.GetGame().IsAlive((Player)target)) return; - Item item = (Item)data.GetThrown(); + Item item = (Item)data.getThrown(); int damage = 4; if (item.getItemStack().getType() == Material.STONE_AXE) damage = 5; @@ -82,18 +82,18 @@ public class PerkAxeThrower extends Perk implements IThrown else if (item.getItemStack().getType() == Material.DIAMOND_AXE) damage = 7; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.6f); //Re-Drop - data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(item.getItemStack().getType())).setPickupDelay(60); + data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(item.getItemStack().getType())).setPickupDelay(60); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java index 89ff68f52..a24bec73d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java @@ -89,9 +89,9 @@ public class PerkBaconBlast extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 6, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -109,8 +109,8 @@ public class PerkBaconBlast extends Perk implements IThrown public void Explode(ProjectileUser data) { // for whatever reason, you can't put a location in createExplosion if you don't want it to break blocks >.> - Location loc = data.GetThrown().getLocation(); - data.GetThrown().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0.5f, false, false); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0.5f, false, false); + data.getThrown().remove(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java index 16e17e38d..c4c754d8f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java @@ -66,19 +66,19 @@ public class PerkBlockRestorer extends Perk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - restore(data.GetThrown()); + restore(data.getThrown()); } @Override public void Idle(ProjectileUser data) { - restore(data.GetThrown()); + restore(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - restore(data.GetThrown()); + restore(data.getThrown()); } public void restore(Entity entity) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java index f74e03053..83870c9d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java @@ -166,24 +166,24 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.PROJECTILE, data.GetThrown().getVelocity().length() * 10, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, + DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 10, true, true, false, + UtilEnt.getName(data.getThrower()), GetName()); //Block to Item - if (data.GetThrown() instanceof FallingBlock) + if (data.getThrown() instanceof FallingBlock) { - FallingBlock thrown = (FallingBlock) data.GetThrown(); + FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte)0); //Remove Old _falling.remove(thrown); thrown.remove(); //Add New - if (data.GetThrower() instanceof Player) - _falling.put(newThrown, (Player)data.GetThrower()); + if (data.getThrower() instanceof Player) + _falling.put(newThrown, (Player)data.getThrower()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java index 3bee3341d..4a5790f73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java @@ -141,12 +141,12 @@ public class PerkBoneRush extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); if (target == null) return; - Player damager = (Player)data.GetThrower(); + Player damager = (Player)data.getThrower(); double damage = 0.7; String reason = GetName(); @@ -158,23 +158,23 @@ public class PerkBoneRush extends SmashPerk implements IThrown } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, false, true, false, - UtilEnt.getName(data.GetThrower()), reason); + UtilEnt.getName(data.getThrower()), reason); - UtilAction.velocity(target, data.GetThrown().getVelocity()); + UtilAction.velocity(target, data.getThrown().getVelocity()); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java index e3461cd2f..535dc0ca5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java @@ -96,9 +96,9 @@ public class PerkCowBomb extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -116,11 +116,11 @@ public class PerkCowBomb extends Perk implements IThrown public void Explode(ProjectileUser data) { //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); - data.GetThrown().getWorld().createExplosion(data.GetThrown().getLocation(), 0.5f); - data.GetThrown().remove(); + data.getThrown().getWorld().createExplosion(data.getThrown().getLocation(), 0.5f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java index e9759b073..c1d93f7b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java @@ -27,7 +27,6 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashPerk; public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown @@ -99,9 +98,9 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 7, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -118,10 +117,10 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown public void Explode(ProjectileUser data) { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java index 94b7376bd..969e5120b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java @@ -94,7 +94,7 @@ public class PerkFlameDash extends Perk _data.add(new FireflyData(player)); Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false); - //Manager.GetCondition().Factory().Invisible(GetName(), player, player, 2.5, 0, false, false, true); + //Manager.GetCondition().Factory().Invisible(getName(), player, player, 2.5, 0, false, false, true); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java index 6abfaf5d1..10c87bc33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java @@ -130,7 +130,7 @@ public class PerkHammerThrow extends Perk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; @@ -140,21 +140,21 @@ public class PerkHammerThrow extends Perk implements IThrown damage = 8; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.LIGHTNING, damage, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 676bec0f5..49a85e0a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -1,49 +1,42 @@ package nautilus.game.arcade.kit.perks; -import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.Bukkit; +import mineplex.core.common.Rank; +import mineplex.core.common.util.*; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Entity; +import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Player; -import org.bukkit.entity.Horse; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.ItemStack; -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.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; +import java.util.Iterator; public class PerkHorsePet extends Perk { private HashMap _horseMap = new HashMap(); private HashMap _deathTime = new HashMap(); - public PerkHorsePet() + public PerkHorsePet() { super("Horse Master", new String[] { C.cGray + "You have a loyal horse companion.", }); - - //Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); } @Override @@ -65,7 +58,32 @@ public class PerkHorsePet extends Perk horse.setAgeLock(true); horse.setColor(Color.BROWN); horse.setStyle(Style.NONE); - horse.setVariant(Variant.HORSE); + KitModifier kitModifier = getHorseType(player); + if (kitModifier != null) + { + switch (getHorseType(player)) + { + case Survival_Games_Horseman_Mule: + horse.setVariant(Variant.MULE); + break; + case Survival_Games_Horseman_Skeleton_Horse: + horse.setVariant(Variant.SKELETON_HORSE); + break; + case Survival_Games_Horseman_Zombie_Horse: + horse.setVariant(Variant.UNDEAD_HORSE); + break; + case Survival_Games_Horseman_Donkey: + horse.setVariant(Variant.DONKEY); + break; + default: + horse.setVariant(Variant.HORSE); + break; + } + } + else + { + horse.setVariant(Variant.HORSE); + } horse.setOwner(player); horse.setMaxDomestication(1); horse.setJumpStrength(1); @@ -254,4 +272,10 @@ public class PerkHorsePet extends Perk return; } } + + private KitModifier getHorseType(Player player) + { + GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager(); + return gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_HorsemanKit, player); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index fee34747e..bc40a81ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.kit.perks; -import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -118,9 +117,9 @@ public class PerkInkBlast extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePerBullet, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } @@ -139,8 +138,8 @@ public class PerkInkBlast extends SmashPerk implements IThrown public void Explode(ProjectileUser data) { - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index e629b7d8d..d938dd3d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -77,13 +77,13 @@ public class PerkIronHook extends Perk implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Remove - double velocity = data.GetThrown().getVelocity().length(); - data.GetThrown().remove(); + double velocity = data.getThrown().getVelocity().length(); + data.getThrown().remove(); - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); if (target == null) return; @@ -109,14 +109,14 @@ public class PerkIronHook extends Perk implements IThrown public void Idle(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java index 0c2b37ecf..b34c6daa6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; @@ -19,6 +20,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; +import org.bukkit.event.player.PlayerQuitEvent; public class PerkLeap extends Perk { @@ -126,4 +128,22 @@ public class PerkLeap extends Perk PerkLeapEvent leapEvent = new PerkLeapEvent(player); UtilServer.getServer().getPluginManager().callEvent(leapEvent); } + + @EventHandler + public void removeDataOnQuit(PlayerQuitEvent event) + { + _uses.remove(event.getPlayer().getName()); + } + + @EventHandler + public void removeDataOnDeath(PlayerDeathEvent event) + { + _uses.remove(event.getEntity().getName()); + } + + @Override + public void unregisteredEvents() + { + _uses.clear(); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java index 0d8d8acb0..cc9ddc0f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java @@ -164,9 +164,9 @@ public class PerkMadScientist extends Perk implements IThrown if (target != null) { - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 1.5D, true, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @@ -189,28 +189,28 @@ public class PerkMadScientist extends Perk implements IThrown public void spawnMobs(ProjectileUser data) { - data.GetThrown() + data.getThrown() .getWorld() - .playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, + .playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.6f); - UtilParticle.PlayParticle(ParticleType.EXPLODE, data.GetThrown() + UtilParticle.PlayParticle(ParticleType.EXPLODE, data.getThrown() .getLocation(), 0F, 0F, 0F, 1F, 5, ViewDist.SHORT, UtilServer .getPlayers()); - data.GetThrown().remove(); + data.getThrown().remove(); Manager.GetGame().CreatureAllowOverride = true; - Zombie zombie = (Zombie) data.GetThrown().getWorld() - .spawn(data.GetThrown().getLocation(), Zombie.class); + Zombie zombie = (Zombie) data.getThrown().getWorld() + .spawn(data.getThrown().getLocation(), Zombie.class); zombie.setRemoveWhenFarAway(false); zombie.setMaxHealth(10.0D); zombie.setHealth(10.0D); UtilEnt.silence(zombie, true); //Name - zombie.setCustomName(C.cAqua + UtilEnt.getName(data.GetThrower()) + "'s Minion"); + zombie.setCustomName(C.cAqua + UtilEnt.getName(data.getThrower()) + "'s Minion"); zombie.setCustomNameVisible(true); // double r = Math.random(); @@ -240,13 +240,13 @@ public class PerkMadScientist extends Perk implements IThrown // // if (disguise instanceof DisguiseInsentient) // { -// if (((Player) data.GetThrower()).getName().toLowerCase().endsWith("s")) +// if (((Player) data.getThrower()).getName().toLowerCase().endsWith("s")) // { -// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.GetThrower()) + "' Minion"); +// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.getThrower()) + "' Minion"); // } // else // { -// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.GetThrower()) + "' Minion"); +// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.getThrower()) + "' Minion"); // } // // ((DisguiseInsentient)disguise).setCustomNameVisible(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java index 8b5d15ddc..6e6685993 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java @@ -105,7 +105,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; @@ -123,24 +123,24 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); - Item item = (Item)data.GetThrown(); + Item item = (Item)data.getThrown(); item.setItemStack(new ItemStack(Material.GRILLED_PORK)); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java index 022e13315..37dabb0f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java @@ -147,22 +147,22 @@ public class PerkRevealer extends Perk implements IThrown { // Workaround to make firework effect always visible for (int i = 0; i < 3; i++) - UtilFirework.playFirework(data.GetThrown().getLocation(), REVEALER_FIREWORK_EFFECT); + UtilFirework.playFirework(data.getThrown().getLocation(), REVEALER_FIREWORK_EFFECT); - data.GetThrown().getLocation().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f); + data.getThrown().getLocation().getWorld().playSound(data.getThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f); for (Player player : Manager.GetGame().GetPlayers(true)) { - if (player == data.GetThrower()) + if (player == data.getThrower()) continue; - if (player.getLocation().getWorld() == data.GetThrown().getWorld() && player.getLocation().distanceSquared(data.GetThrown().getLocation()) <= 12 * 12) + if (player.getLocation().getWorld() == data.getThrown().getWorld() && player.getLocation().distanceSquared(data.getThrown().getLocation()) <= 12 * 12) { RevealedPlayerInfo info = getRevealedPlayers().get(player); if (info == null) { - Bukkit.getPluginManager().callEvent(new PlayerRevealEvent(player, data.GetThrower())); + Bukkit.getPluginManager().callEvent(new PlayerRevealEvent(player, data.getThrower())); info = new RevealedPlayerInfo(Manager.GetDisguise().getDisguise(player)); getRevealedPlayers().put(player, info); @@ -175,7 +175,7 @@ public class PerkRevealer extends Perk implements IThrown } } - data.GetThrown().remove(); + data.getThrown().remove(); } public Map getRevealedPlayers() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index f8fae47de..4e7075481 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -2,24 +2,38 @@ package nautilus.game.arcade.kit.perks; import mineplex.core.common.Rank; import mineplex.core.common.util.*; -import mineplex.core.updater.*; -import mineplex.core.updater.event.*; -import mineplex.minecraft.game.core.combat.event.*; -import mineplex.minecraft.game.core.damage.*; -import nautilus.game.arcade.kit.*; -import net.minecraft.server.v1_8_R3.*; - -import org.bukkit.*; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; +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.kit.Perk; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; +import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.entity.*; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSkeleton; import org.bukkit.entity.Entity; -import org.bukkit.entity.*; -import org.bukkit.event.*; -import org.bukkit.event.entity.*; -import org.bukkit.event.player.*; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerEvent; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; public class PerkSkeletons extends Perk { @@ -64,7 +78,6 @@ public class PerkSkeletons extends Perk { C.cGray + "Killing an opponent summons a skeletal minion." }); - _name = name; } @@ -113,6 +126,29 @@ public class PerkSkeletons extends Perk skel.getEquipment().setLeggingsDropChance(1f); skel.getEquipment().setBootsDropChance(1f); + KitModifier kitModifier = getSkeletonType(killer); + if (kitModifier != null) + { + switch (kitModifier) + { + case Survival_Games_Necromancer_Wither_Skeleton: + skel.setSkeletonType(Skeleton.SkeletonType.WITHER); + break; + case Survival_Games_Necromancer_Zombie: + skel.setSkeletonType(Skeleton.SkeletonType.NORMAL); + DisguiseZombie disguiseZombie = new DisguiseZombie(skel); + Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseZombie); + break; + default: + skel.setSkeletonType(Skeleton.SkeletonType.NORMAL); + break; + } + } + else + { + skel.setSkeletonType(Skeleton.SkeletonType.NORMAL); + } + if (_name) { skel.setCustomName("Skeletal " + UtilEnt.getName(event.GetEvent().getEntity())); @@ -120,7 +156,7 @@ public class PerkSkeletons extends Perk } if (!_minions.containsKey(killer)) - _minions.put(killer, new ArrayList()); + _minions.put(killer, new ArrayList<>()); _minions.get(killer).add(skel); @@ -317,4 +353,10 @@ public class PerkSkeletons extends Perk { return _minions.get(player); } + + private KitModifier getSkeletonType(Player player) + { + GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager(); + return gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_NecromancerKit, player); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index 1371ddc1d..345f425d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -221,10 +221,10 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown if (target == null) return; - if (!(data.GetThrown() instanceof Slime)) + if (!(data.getThrown() instanceof Slime)) return; - Slime slime = (Slime)data.GetThrown(); + Slime slime = (Slime)data.getThrown(); if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.GetThrower() instanceof Player) { @@ -239,9 +239,9 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java index cabf76c7d..0364e5719 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java @@ -95,7 +95,7 @@ public class PerkSmokebomb extends Perk //Action Manager.GetCondition().Factory().Cloak(GetName(), player, player, 1.2, false, false); - //Manager.GetCondition().Factory().Vulnerable(GetName(), player, player, 6, 3, false, false, true); + //Manager.GetCondition().Factory().Vulnerable(getName(), player, player, 6, 3, false, false, true); //Blind for (Entity other : player.getNearbyEntities(5, 5, 5)) @@ -110,7 +110,7 @@ public class PerkSmokebomb extends Perk LivingEntity living = (LivingEntity) other; Manager.GetCondition().Factory().Blind(GetName() + " Effect", living, player, getEffectDuration(), 0, false, false, true); - //Manager.GetCondition().Factory().Slow(GetName() + " Effect", living, player, getEffectDuration(), 0, false, false, true, false); + //Manager.GetCondition().Factory().Slow(getName() + " Effect", living, player, getEffectDuration(), 0, false, false, true, false); } //Effects diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java index 7beb2494c..0157bf271 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java @@ -136,9 +136,9 @@ public class PerkSquidRifle extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 50, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -155,13 +155,13 @@ public class PerkSquidRifle extends Perk implements IThrown public void Explode(ProjectileUser data) { - if (!(data.GetThrown() instanceof Firework)) + if (!(data.getThrown() instanceof Firework)) { - data.GetThrown().remove(); + data.getThrown().remove(); return; } - Firework fw = (Firework)data.GetThrown(); + Firework fw = (Firework)data.getThrown(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java index cb51926b9..797468967 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java @@ -145,14 +145,14 @@ public class PerkSquidShotgun extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 12, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Recharge - if (data.GetThrower() instanceof Player) + if (data.getThrower() instanceof Player) { - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); Recharge.Instance.recharge(player, GetName()); player.playSound(player.getLocation(), Sound.NOTE_STICKS, 3f, 1f); } @@ -172,13 +172,13 @@ public class PerkSquidShotgun extends Perk implements IThrown public void Explode(ProjectileUser data) { - if (!(data.GetThrown() instanceof Firework)) + if (!(data.getThrown() instanceof Firework)) { - data.GetThrown().remove(); + data.getThrown().remove(); return; } - Firework fw = (Firework)data.GetThrown(); + Firework fw = (Firework)data.getThrown(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java index 687869ecc..96b38e418 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java @@ -136,14 +136,14 @@ public class PerkSquidSniper extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 50, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Recharge - if (data.GetThrower() instanceof Player) + if (data.getThrower() instanceof Player) { - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); Recharge.Instance.recharge(player, GetName()); player.playSound(player.getLocation(), Sound.NOTE_STICKS, 3f, 1f); } @@ -163,13 +163,13 @@ public class PerkSquidSniper extends Perk implements IThrown public void Explode(ProjectileUser data) { - if (!(data.GetThrown() instanceof Firework)) + if (!(data.getThrown() instanceof Firework)) { - data.GetThrown().remove(); + data.getThrown().remove(); return; } - Firework fw = (Firework)data.GetThrown(); + Firework fw = (Firework)data.getThrown(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java index a9cf87a76..839267354 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java @@ -97,21 +97,21 @@ public class PerkThrower extends Perk implements IThrown } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 6, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Bounce - Vector dir = UtilAlg.getTrajectory(data.GetThrown(), target); + Vector dir = UtilAlg.getTrajectory(data.getThrown(), target); if (dir.getY() < 0) dir.setY(0); UtilAction.velocity(target, dir, 1.2, false, 0, 0.4, 1, true); - dir = UtilAlg.getTrajectory(target, data.GetThrown()); + dir = UtilAlg.getTrajectory(target, data.getThrown()); if (dir.getY() < 0) dir.setY(0); - UtilAction.velocity(data.GetThrown(), dir, 0.2, false, 0, 0.2, 1, true); + UtilAction.velocity(data.getThrown(), dir, 0.2, false, 0, 0.2, 1, true); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java index 2e40fe70d..dcaa8df8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java @@ -131,8 +131,8 @@ public class PerkWeb extends Perk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 4000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java index cbe999d59..7103f5ca7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java @@ -91,14 +91,14 @@ public class PerkWebShot extends SmashPerk implements IThrown { if (target != null) { - data.GetThrown().remove(); + data.getThrown().remove(); Manager.GetBlockRestore().add(target.getLocation().getBlock(), 30, (byte) 0, 3000); //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 6, false, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); UtilAction.zeroVelocity(target); @@ -122,10 +122,10 @@ public class PerkWebShot extends SmashPerk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); - if (data.GetThrown().getTicksLived() > 3) + if (data.getThrown().getTicksLived() > 3) Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java index 9e270d6f5..d643727a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java @@ -98,10 +98,10 @@ public class PerkWitherWeb extends Perk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); - if (data.GetThrown().getTicksLived() > 3) + if (data.getThrown().getTicksLived() > 3) Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 3000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index 4a52f0362..4914d7264 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -1,21 +1,28 @@ package nautilus.game.arcade.kit.perks; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - +import mineplex.core.common.Rank; +import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguiseAnimalBase; +import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.disguise.disguises.DisguiseSquid; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.DyeColor; import org.bukkit.EntityEffect; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wolf; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityTargetEvent; @@ -24,36 +31,28 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; -import mineplex.core.common.Rank; -import mineplex.core.common.util.*; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.Navigation; -import net.minecraft.server.v1_8_R3.NavigationAbstract; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; public class PerkWolfPet extends Perk { - private HashMap> _wolfMap = new HashMap>(); + private HashMap> _petMap = new HashMap<>(); - private HashMap _tackle = new HashMap(); + private HashMap _tackle = new HashMap<>(); private int _spawnRate; private int _max; private boolean _baby; private boolean _name; - public PerkWolfPet(int spawnRate, int max, boolean baby, boolean name) + public PerkWolfPet(int spawnRate, int max, boolean baby, boolean name) { super("Wolf Master", new String[] { C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".", C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Cub Strike", }); - _spawnRate = spawnRate; _max = max; _baby = baby; @@ -67,7 +66,7 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubSpawn(UpdateEvent event) + public void cubSpawn(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; @@ -83,16 +82,14 @@ public class PerkWolfPet extends Perk if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false, false)) continue; - if (!_wolfMap.containsKey(cur)) - _wolfMap.put(cur, new ArrayList()); + if (!_petMap.containsKey(cur)) + _petMap.put(cur, new ArrayList<>()); - if (_wolfMap.get(cur).size() >= _max) + if (_petMap.get(cur).size() >= _max) continue; Manager.GetGame().CreatureAllowOverride = true; Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; - SpigotUtil.setOldOwner_RemoveMeWhenSpigotFixesThis(wolf, cur); wolf.setOwner(cur); wolf.setCollarColor(DyeColor.GREEN); @@ -108,33 +105,33 @@ public class PerkWolfPet extends Perk { wolf.setCustomName(cur.getName() + "'s Wolf"); } - - - _wolfMap.get(cur).add(wolf); - + _petMap.get(cur).add(wolf); + Manager.GetGame().CreatureAllowOverride = false; cur.playSound(cur.getLocation(), Sound.WOLF_HOWL, 1f, 1f); + disguise(wolf, cur); } } @EventHandler - public void CubTargetCancel(EntityTargetEvent event) + public void cubTargetCancel(EntityTargetEvent event) { - if (!_wolfMap.containsKey(event.getTarget())) + if (!_petMap.containsKey(event.getTarget())) return; - if (_wolfMap.get(event.getTarget()).contains(event.getEntity())) + if (_petMap.get(event.getTarget()).contains(event.getEntity())) event.setCancelled(true); } + // Note: Why are there 4 different update event handlers? @EventHandler - public void CubUpdate(UpdateEvent event) + public void cubUpdate(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - for (Player player : _wolfMap.keySet()) + for (Player player : _petMap.keySet()) { - Iterator wolfIterator = _wolfMap.get(player).iterator(); + Iterator wolfIterator = _petMap.get(player).iterator(); while (wolfIterator.hasNext()) { @@ -151,7 +148,7 @@ public class PerkWolfPet extends Perk if (player.isSneaking()) { - ((CraftWolf)wolf).getHandle().setGoalTarget(null); + ((CraftWolf) wolf).getHandle().setGoalTarget(null); } //Return to Owner @@ -169,7 +166,7 @@ public class PerkWolfPet extends Perk speed = 1.4f; //Move - EntityCreature ec = ((CraftCreature)wolf).getHandle(); + EntityCreature ec = ((CraftCreature) wolf).getHandle(); NavigationAbstract nav = ec.getNavigation(); nav.a(target.getX(), target.getY(), target.getZ(), speed); @@ -180,7 +177,7 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubStrikeTrigger(PlayerInteractEvent event) + public void cubStrikeTrigger(PlayerInteractEvent event) { if (event.isCancelled()) return; @@ -202,7 +199,7 @@ public class PerkWolfPet extends Perk if (!Kit.HasKit(player)) return; - if (!_wolfMap.containsKey(player) || _wolfMap.get(player).isEmpty()) + if (!_petMap.containsKey(player) || _petMap.get(player).isEmpty()) { UtilPlayer.message(player, F.main("Game", "You have no Wolf Cubs.")); return; @@ -211,7 +208,7 @@ public class PerkWolfPet extends Perk if (!Recharge.Instance.use(player, "Cub Strike", 4000, true, true)) return; - Wolf wolf = _wolfMap.get(player).get(UtilMath.r(_wolfMap.get(player).size())); + Wolf wolf = _petMap.get(player).get(UtilMath.r(_petMap.get(player).size())); UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); @@ -227,7 +224,7 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubStrikeEnd(UpdateEvent event) + public void cubStrikeEnd(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; @@ -246,7 +243,7 @@ public class PerkWolfPet extends Perk if (other.equals(wolf.getOwner())) continue; - CubStrikeHit((Player)wolf.getOwner(), other, wolf); + cubStrikeHit((Player)wolf.getOwner(), other, wolf); wolfIterator.remove(); return; } @@ -261,11 +258,11 @@ public class PerkWolfPet extends Perk } } - public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) + public void cubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) { //Damage Event ((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle(), EntityTargetEvent.TargetReason.CUSTOM, false); - + //Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f); @@ -278,12 +275,12 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubHeal(UpdateEvent event) + public void cubHeal(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - for (ArrayList wolves : _wolfMap.values()) + for (ArrayList wolves : _petMap.values()) { for (Wolf wolf : wolves) { @@ -319,14 +316,14 @@ public class PerkWolfPet extends Perk } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void playerQuit(PlayerQuitEvent event) { despawnWolf(event.getPlayer()); } private void despawnWolf(Player player) { - ArrayList wolves = _wolfMap.remove(player); + ArrayList wolves = _petMap.remove(player); if (wolves == null) return; @@ -337,9 +334,9 @@ public class PerkWolfPet extends Perk wolves.clear(); } - public boolean IsMinion(Entity ent) + public boolean isMinion(Entity ent) { - for (ArrayList minions : _wolfMap.values()) + for (ArrayList minions : _petMap.values()) { for (Wolf minion : minions) { @@ -354,12 +351,12 @@ public class PerkWolfPet extends Perk } @EventHandler - public void Damage(CustomDamageEvent event) + public void damage(CustomDamageEvent event) { if (event.GetDamagerEntity(true) == null) return; - if (!IsMinion(event.GetDamagerEntity(true))) + if (!isMinion(event.GetDamagerEntity(true))) return; double damage = 3; @@ -367,4 +364,47 @@ public class PerkWolfPet extends Perk event.AddMod("Wolf Minion", "Negate", -event.GetDamageInitial(), false); event.AddMod("Wolf Minion", "Damage", damage, false); } + + private void disguise(Entity wolf, Player player) + { + EntityType entityType = getDisguiseType(player); + if (entityType != null) + { + if (entityType.equals(EntityType.GUARDIAN)) + { + DisguiseGuardian disguiseGuardian = new DisguiseGuardian(wolf); + Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseGuardian); + return; + } + else if (entityType.equals(EntityType.SQUID)) + { + DisguiseSquid disguiseSquid = new DisguiseSquid(wolf); + Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseSquid); + return; + } + DisguiseAnimalBase disguiseAnimal = new DisguiseAnimalBase(entityType, wolf); + Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseAnimal); + } + } + + private EntityType getDisguiseType(Player player) + { + GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager(); + KitModifier kitModifier = gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_BeastmasterKit, player); + if (kitModifier != null) + { + switch (kitModifier) + { + case Survival_Games_Beastmaster_Chicken: + return EntityType.CHICKEN; + case Survival_Games_Beastmaster_Mini_Guardian: + return EntityType.GUARDIAN; + case Survival_Games_Beastmaster_Pig: + return EntityType.PIG; + case Survival_Games_Beastmaster_Squid: + return EntityType.SQUID; + } + } + return null; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 5f692fb5d..436db672e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -241,27 +241,27 @@ public class PerkWoolBomb extends Perk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - solidify(data.GetThrower(), false); + solidify(data.getThrower(), false); if (target == null) return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { - solidify(data.GetThrower(), false); + solidify(data.getThrower(), false); } @Override public void Expire(ProjectileUser data) { - solidify(data.GetThrower(), false); + solidify(data.getThrower(), false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java index 116cd0add..adb0f1455 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -133,7 +133,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); if (target == null) return; @@ -143,23 +143,23 @@ public class PerkZombieBile extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 281d33288..182fcb7ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -180,10 +180,11 @@ public class GameGemManager implements Listener } //Gem Boooster - /* - if (game.GemBoosterEnabled && game.getGemBooster() != null) - total += (int)(earned * game.getGemBooster().getMultiplier()); - */ + Booster booster = Manager.getBoosterManager().getActiveBooster(); + if (game.GemBoosterEnabled && booster != null) + { + total *= booster.getMultiplier(); + } int shards = total; @@ -313,16 +314,14 @@ public class GameGemManager implements Listener int totalGems = earnedGems; //Gem Booster - /* - Booster gemBooster = game.getGemBooster(); - if (game.GemBoosterEnabled && gemBooster != null) + Booster booster = Manager.getBoosterManager().getActiveBooster(); + if (game.GemBoosterEnabled && booster != null) { - UtilPlayer.message(player, F.elem(C.cGreen + "+" + (int) (earnedGems * gemBooster.getMultiplier()) + " Gems") + " for gem booster from " - + F.name(gemBooster.getPlayerName())); + int addedGems = (int) (earnedGems * booster.getMultiplier()) - earnedGems; + UtilPlayer.message(player, F.elem(C.cGreen + "+" + addedGems + " Gems") + " for " + F.elem(booster.getPlayerName() + "'s Game Amplifier" + C.cGreen + " +" + booster.getIncreasePercent() + "%")); - totalGems += earnedGems * gemBooster.getMultiplier(); + totalGems *= booster.getMultiplier(); } - */ int shards = totalGems; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 3f57172cf..220745fb7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -57,8 +57,6 @@ public class GameLobbyManager implements Listener private Location spawn; - private Location _boosterLocation; - private NautHashMap _kits = new NautHashMap(); private NautHashMap _kitBlocks = new NautHashMap(); @@ -1177,7 +1175,7 @@ public class GameLobbyManager implements Listener Manager.hasKitsUnlocked(player) || //YouTube (ent.GetKit().GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, ent.GetKit().getAchievementRequirement())) || //Achievement - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + ent.GetKit().GetName()) || //Green + donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(game) + " " + ent.GetKit().GetName()) || //Green Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) Manager.GetServerConfig().Tournament) //Tournament @@ -1312,6 +1310,7 @@ public class GameLobbyManager implements Listener //Cosmetic Menu Manager.getCosmeticManager().giveInterfaceItem(player); + Manager.getBoosterManager().giveInterfaceItem(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 4e3f110ac..b57c40277 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -175,7 +175,7 @@ public class GameManager implements Listener } } - for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(GadgetType.Morph)) + for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(GadgetType.MORPH)) { if (gadget instanceof MorphWither) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java index 347730a4d..2bb9542fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java @@ -310,7 +310,7 @@ public class GameChatManager implements Listener { if (!_manager.GetGame().GetStats().containsKey(player)) { - temp.add(new AbstractMap.SimpleEntry(C.cGray + "Retrieving stats..", "")); + temp.add(new AbstractMap.SimpleEntry(C.cGray + "Retrieving stats...", "")); break; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java index c9ae60414..ce8c403eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java @@ -146,11 +146,11 @@ public class GameScoreboard //Team Groups for (GameTeam team : Game.GetTeamList()) { - System.out.println("Scoreboard Team: " + team.GetName().toUpperCase()); + System.out.println("Scoreboard Team: " + team.getName().toUpperCase()); for (Rank rank : Rank.values()) { - _scoreboard.registerNewTeam(ParseTeamName(rank.Name + team.GetName().toUpperCase())).setPrefix(team.GetColor() + ""); + _scoreboard.registerNewTeam(ParseTeamName(rank.Name + team.getName().toUpperCase())).setPrefix(team.GetColor() + ""); } } */ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java index b471f22ea..7ff7bdae3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java @@ -16,7 +16,7 @@ public class KitPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java index 3180ab90c..c042363d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java @@ -34,7 +34,7 @@ public class AssistsStatTracker extends StatTracker addStat(player, "Assists", 1, false, false); // if (getGame().GetKit(player) != null) -// addStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false); +// addStat(player, getGame().GetKit(player).getName() + " Assists", 1, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java index 6dc38aaa7..37865c91b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java @@ -25,6 +25,6 @@ public class DamageDealtStatTracker extends StatTracker addStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false); // if (getGame().GetKit(damager) != null) -// addStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false); +// addStat(damager, getGame().GetKit(damager).getName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java index ae6a9650f..32f278f72 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java @@ -28,10 +28,10 @@ public class DamageTakenStatTracker extends StatTracker // if (getGame().GetKit(damagee) != null) // { -// addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false); +// addStat(damagee, getGame().GetKit(damagee).getName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false); // // if (event.GetDamagerPlayer(true) != null) -// addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken PvP ", (int) Math.round(event.GetDamage()), false, false); +// addStat(damagee, getGame().GetKit(damagee).getName() + " Damage Taken PvP ", (int) Math.round(event.GetDamage()), false, false); // } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java index eb12b09fc..739a4e618 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java @@ -34,6 +34,6 @@ public class DeathsStatTracker extends StatTracker addStat(player, "Deaths", 1, false, false); // if (getGame().GetKit(player) != null) -// addStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false); +// addStat(player, getGame().GetKit(player).getName() + " Deaths", 1, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java index 90ae84bce..1e4316316 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java @@ -72,7 +72,7 @@ public class ExperienceStatTracker extends StatTracker //Game Time = 1 Exp per 3 Seconds long time = System.currentTimeMillis(); long playerJoin = getGame().getPlayerIngameTime(player); - + if (playerJoin == 0) playerJoin = _startTime; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java index d0fa7196a..a384daf3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java @@ -34,6 +34,6 @@ public class KillsStatTracker extends StatTracker addStat(player, "Kills", 1, false, false); // if (getGame().GetKit(player) != null) -// addStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false); +// addStat(player, getGame().GetKit(player).getName() + " Kills", 1, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java index 6fa5033f7..5f12714ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java @@ -39,7 +39,7 @@ public class LoseStatTracker extends StatTracker addStat(loser, "Losses", 1, false, false); // if (getGame().GetKit(loser) != null) -// addStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false); +// addStat(loser, getGame().GetKit(loser).getName() + " Losses", 1, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java index 382b6bbd0..345539360 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java @@ -33,7 +33,7 @@ public class WinStatTracker extends StatTracker addStat(winner, "Wins", 1, false, false); // if (getGame().GetKit(winner) != null) -// addStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false); +// addStat(winner, getGame().GetKit(winner).getName() + " Wins", 1, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java index bb64219f1..922a164d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java @@ -37,8 +37,8 @@ public class WinEffectManager _game.CreatureAllowOverride = true; for(Player p : UtilServer.getPlayers()) { - Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.Item); - if(g != null) g.Disable(p); + Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.ITEM); + if(g != null) g.disable(p); } playEffect(); } @@ -74,7 +74,7 @@ public class WinEffectManager public WinEffectGadget getWinEffect() { GadgetManager manager = _game.getArcadeManager().getCosmeticManager().getGadgetManager(); - Gadget gadget = manager.getActive(_winner, GadgetType.WinEffect); + Gadget gadget = manager.getActive(_winner, GadgetType.WIN_EFFECT); if(gadget == null) gadget = manager.getGadget(WinEffectPodium.class); return (WinEffectGadget) gadget; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index 3117bbcbd..63b45effa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -416,6 +416,10 @@ public class WorldData public boolean LoadChunks(long maxMilliseconds) { + if (Host instanceof UHC) + { + return true; + } long startTime = System.currentTimeMillis(); for (; CurX <= MaxX; CurX += 16)