diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java index 7ec401ed6..e89e491af 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java @@ -45,21 +45,25 @@ public class Pair implements Serializable { return getLeft().toString() + ":" + getRight().toString(); } - @SuppressWarnings("rawtypes") + @Override - public boolean equals(Object obj) + public boolean equals(Object o) { - if (this == obj) - return true; - if (!(obj instanceof Pair)) - return false; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; - Pair localPair = (Pair) obj; + Pair pair = (Pair) o; - if (getLeft() != null ? !getLeft().equals(localPair.getLeft()) : localPair.getLeft() != null) - return false; - if (getRight() != null ? !getRight().equals(localPair.getRight()) : localPair.getRight() != null) - return false; - return true; + if (left != null ? !left.equals(pair.left) : pair.left != null) return false; + return right != null ? right.equals(pair.right) : pair.right == null; + + } + + @Override + public int hashCode() + { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; } } \ No newline at end of file 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/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..d4e48144f --- /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/MiniClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java index 391e86a54..d90d08fe5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java @@ -35,7 +35,7 @@ public abstract class MiniClientPlugin extends MiniPlug synchronized (_clientDataLock) { if (!_clientData.containsKey(name)) - _clientData.put(name, AddPlayer(name)); + _clientData.put(name, addPlayer(name)); return _clientData.get(name); } @@ -66,5 +66,5 @@ public abstract class MiniClientPlugin extends MiniPlug } } - protected abstract DataType AddPlayer(String player); + protected abstract DataType addPlayer(String player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index f2c320b74..e025133f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -57,7 +57,14 @@ public class CoreClientManager extends MiniPlugin private static AtomicInteger _clientsConnecting = new AtomicInteger(0); private static AtomicInteger _clientsProcessing = new AtomicInteger(0); + private final Rank WHITELIST_BYPASS; + public CoreClientManager(JavaPlugin plugin, String webServer) + { + this(plugin, webServer, Rank.MODERATOR); + } + + public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass) { super("Client Manager", plugin); @@ -65,6 +72,7 @@ public class CoreClientManager extends MiniPlugin _repository = new AccountRepository(plugin, webServer); _clientList = new NautHashMap(); _duplicateLoginGlitchPreventionList = new HashSet(); + WHITELIST_BYPASS = whitelistBypass; } public AccountRepository getRepository() @@ -195,7 +203,7 @@ public class CoreClientManager extends MiniPlugin _clientsProcessing.decrementAndGet(); } - if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(Rank.MODERATOR)) + if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(WHITELIST_BYPASS)) { for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java index 045d6f42f..804ba1931 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java @@ -67,7 +67,7 @@ public class BenefitManager extends MiniDbClientPlugin } @Override - protected BenefitData AddPlayer(String player) + protected BenefitData addPlayer(String player) { return new BenefitData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 4c9081b52..45736c3d6 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; @@ -984,7 +989,7 @@ public class BonusManager extends MiniClientPlugin implements I } @Override - protected BonusClientData AddPlayer(String player) + protected BonusClientData addPlayer(String player) { return new BonusClientData(); } @@ -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..dd741b450 --- /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, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").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..4254f6594 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -1,31 +1,65 @@ 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.BoosterItemGiveEvent; +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.common.util.UtilServer; 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 +67,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 +89,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 +109,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 +122,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 +134,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 +293,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 +303,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 +311,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 +347,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 +356,42 @@ 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)) + { + BoosterItemGiveEvent event = new BoosterItemGiveEvent(player); + UtilServer.CallEvent(event); + if (event.isCancelled()) + return; + + 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/BoosterItemGiveEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterItemGiveEvent.java new file mode 100644 index 000000000..90636623b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterItemGiveEvent.java @@ -0,0 +1,48 @@ +package mineplex.core.boosters.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * Called when a player is about to receive a booster gem. If cancelled the player will not receive said gem + */ +public class BoosterItemGiveEvent extends Event implements Cancellable +{ + private Player _player; + private boolean _cancelled; + + public BoosterItemGiveEvent(Player player) + { + this._player = player; + } + + public Player getPlayer() + { + return this._player; + } + + public boolean isCancelled() + { + return this._cancelled; + } + + public void setCancelled(boolean cancelled) + { + this._cancelled = cancelled; + } + + 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/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..be7f28ca9 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; @@ -110,7 +110,7 @@ public class BoosterTipManager extends MiniDbClientPlugin } @Override - protected PlayerTipData AddPlayer(String player) + protected PlayerTipData addPlayer(String player) { return new PlayerTipData(); } 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 802b81b5d..11e4cf821 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java @@ -51,7 +51,7 @@ public class FountainManager extends MiniPlugin World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5 - int goal = !new File("eu.dat").exists() ? 300000000 : 5000000; + int goal = !new File("eu.dat").exists() ? 200000000 : 20000000; _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", goal, this, clientManager, donationManager, _hologramManager, _statsManager); } 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..8da12b5d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -178,9 +178,9 @@ public class CosmeticManager extends MiniPlugin public void disableItemsForGame() { - _gadgetManager.DisableAll(); + _gadgetManager.disableAll(); _mountManager.DisableAll(); - _petManager.DisableAll(); + _petManager.disableAll(); } public void setHideParticles(boolean b) @@ -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/PetSorter.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java index 8d339374e..64de96efc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java @@ -8,7 +8,7 @@ public class PetSorter implements Comparator { public int compare(Pet a, Pet b) { - if (a.GetPetType().getTypeId() < b.GetPetType().getTypeId()) + if (a.getPetType().getTypeId() < b.getPetType().getTypeId()) return -1; return 1; 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 86% 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..61539e368 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; @@ -23,7 +23,7 @@ public class ActivatePetButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation()); + _page.getPlugin().getPetManager().addPetOwner(player, _pet.getPetType(), player.getLocation()); _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/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 86% 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..1fc5c2af1 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; @@ -21,7 +21,7 @@ public class DeactivatePetButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _petManager.RemovePet(player, true); + _petManager.removePet(player, true); _page.refresh(); } } 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 85% 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..a8ac5e906 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; @@ -24,7 +24,7 @@ public class OpenPets implements IButton else { _menu.playAcceptSound(player); - _menu.getPlugin().getPetManager().RemovePet(player, true); + _menu.getPlugin().getPetManager().removePet(player, true); _menu.refresh(); } } 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..b56d4cf8e 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,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.banner.CountryFlag; +import mineplex.core.gadget.event.GadgetChangeEvent; 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 +21,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 +48,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 +84,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 +93,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 +105,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 +175,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 +199,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 +214,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 +239,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 +277,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 +363,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 +376,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 +386,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 +394,12 @@ public class GadgetPage extends ShopPageBase // } playAcceptSound(player); - gadget.Enable(player); + gadget.enable(player); + GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, + GadgetChangeEvent.GadgetState.ENABLED); + UtilServer.getPluginManager().callEvent(gadgetChangeEvent); - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + refresh(); } public void handleRightClick(Player player, Gadget gadget) @@ -360,7 +413,10 @@ public class GadgetPage extends ShopPageBase public void deactivateGadget(Player player, Gadget gadget) { playAcceptSound(player); - gadget.Disable(player); + gadget.disable(player); + GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, + GadgetChangeEvent.GadgetState.DISABLED); + UtilServer.getPluginManager().callEvent(gadgetChangeEvent); 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..51ed4dd84 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().getName()).OwnsUnknownPackage(mount.getName())) { mountOwned++; } @@ -123,49 +110,49 @@ public class Menu extends ShopPageBase int petOwned = 0; int petMax = 0; - for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets()) + for (Pet pet : getPlugin().getPetManager().getFactory().GetPets()) { - NautHashMap pets = getPlugin().getPetManager().Get(getPlayer()).GetPets(); - if (pets != null && pets.containsKey(pet.GetPetType())) + NautHashMap pets = getPlugin().getPetManager().Get(getPlayer()).getPets(); + if (pets != null && pets.containsKey(pet.getPetType())) { petOwned++; } petMax++; } - Creature petActive = getPlugin().getPetManager().GetPet(getPlayer()); + 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..8ecd60944 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; @@ -49,7 +49,7 @@ public class PetPage extends ShopPageBase { int slot = 19; - List pets = new ArrayList(getPlugin().getPetManager().GetFactory().GetPets()); + List pets = new ArrayList(getPlugin().getPetManager().getFactory().GetPets()); Collections.sort(pets, new PetSorter()); @@ -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 (!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"); @@ -113,21 +113,21 @@ public class PetPage extends ShopPageBase } //Owned - if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) + if (getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType())) { - String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType()); + 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()) + if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.getPetType()) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), - pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", + addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(), + pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); addGlow(slot); @@ -137,37 +137,37 @@ public class PetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), - pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", + addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(), + pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); } } //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)); + 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."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } } @@ -178,18 +178,23 @@ public class PetPage extends ShopPageBase } slot = 49; - for (PetExtra petExtra : getPlugin().getPetManager().GetFactory().GetPetExtras()) + for (PetExtra petExtra : getPlugin().getPetManager().getFactory().GetPetExtras()) { List itemLore = new ArrayList(); 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++; @@ -228,7 +233,7 @@ public class PetPage extends ShopPageBase public void deactivatePet(Player player) { playAcceptSound(player); - getPlugin().getPetManager().RemovePet(player, true); + getPlugin().getPetManager().removePet(player, true); refresh(); } } \ No newline at end of file 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..27997f3a8 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); @@ -108,8 +108,8 @@ public class PetTagPage extends ShopPageBase token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId(); token.Name = getPlayer().getName(); - token.PetType = _pet.GetPetType().toString(); - token.PetId = _pet.GetPetType().ordinal(); + token.PetType = _pet.getPetType().toString(); + token.PetId = _pet.getPetType().ordinal(); token.PetName = _tagName; PetToken petToken = new PetToken(); @@ -117,16 +117,16 @@ public class PetTagPage extends ShopPageBase if (_petPurchase) { - getPlugin().getPetManager().GetRepository().AddPet(token); - getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.GetPetType()); + getPlugin().getPetManager().getRepository().AddPet(token); + getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType()); } else { - getPlugin().getPetManager().GetRepository().UpdatePet(token); + getPlugin().getPetManager().getRepository().UpdatePet(token); getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName); } - getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName); + getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer())); } 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/customdata/CustomDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java index 26652d24a..45893a07d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java @@ -43,7 +43,7 @@ public class CustomDataManager extends MiniDbClientPlugin } @Override - protected PlayerCustomData AddPlayer(String player) + protected PlayerCustomData addPlayer(String player) { return new PlayerCustomData(_repository); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java b/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java index da5c6c7c0..d407ec093 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java @@ -58,7 +58,7 @@ public class DelayedTask extends MiniClientPlugin } @Override - protected DelayedTaskClient AddPlayer(String player) + protected DelayedTaskClient addPlayer(String player) { return new DelayedTaskClient(Bukkit.getPlayer(player)); } 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/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index b5708c16e..fd0862c9d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -518,7 +518,7 @@ public class DonationManager extends MiniDbClientPlugin } @Override - protected Donor AddPlayer(String player) + protected Donor addPlayer(String player) { return new Donor(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 4ba9e6932..cbfec07b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -114,7 +114,7 @@ public class EloManager extends MiniDbClientPlugin } @Override - protected EloClientData AddPlayer(String player) + protected EloClientData addPlayer(String player) { return new EloClientData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java index 313bde55d..51849c397 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java @@ -137,7 +137,7 @@ public class Energy extends MiniClientPlugin } @Override - protected ClientEnergy AddPlayer(String player) + protected ClientEnergy addPlayer(String player) { return new ClientEnergy(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java b/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java index 054ac2c79..4f1e56d17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java @@ -106,7 +106,7 @@ public class FacebookManager extends MiniDbClientPlugin } @Override - protected FacebookClient AddPlayer(String player) + protected FacebookClient addPlayer(String player) { return new FacebookClient(false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index 4e64f95b1..355aa3407 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -70,7 +70,7 @@ public class FriendManager extends MiniDbClientPlugin } @Override - protected FriendData AddPlayer(String player) + protected FriendData addPlayer(String player) { return new FriendData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index f7dc9d8b7..f4f95e586 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,16 +1,28 @@ 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.GadgetChangeEvent; +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 +36,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 +46,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 +101,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 +110,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 +146,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 +154,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 +180,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 +201,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 +214,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 +251,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 +277,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 +300,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 +315,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 +329,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 +343,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 +392,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 +405,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 +459,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 +467,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 +517,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 +541,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 +553,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 +590,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 +605,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 +641,51 @@ 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, boolean winRooms) + { + for (GadgetType gadgetType : _gadgets.keySet()) + { + if (gadgetType == GadgetType.WIN_EFFECT && winRooms) + { + continue; + } + for (Gadget gadget : _gadgets.get(gadgetType)) + { + gadget.disable(player); } } } - public void DisableAll(Player player, List dontDisable) + public void disableAll(Player player, List dontDisable) { for (GadgetType gadgetType : _gadgets.keySet()) { for (Gadget gadget : _gadgets.get(gadgetType)) { - if (dontDisable.contains(gadget.GetName())) + if (dontDisable.contains(gadget.getName())) continue; - gadget.Disable(player); + gadget.disable(player); } } } @@ -805,18 +779,14 @@ public class GadgetManager extends MiniPlugin } @EventHandler - public void quit(PlayerQuitEvent event) + public void onPlayerQuit(PlayerQuitEvent event) { - DisableAll(event.getPlayer()); - _lastMove.remove(event.getPlayer()); - _playerActiveGadgetMap.remove(event.getPlayer()); + //saveGadgets(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); - } - - @EventHandler - public void join(PlayerJoinEvent event) - { + disableAll(event.getPlayer(), false); + _lastMove.remove(event.getPlayer()); + _playerActiveGadgetMap.remove(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); } @@ -873,11 +843,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 +857,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 +886,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 +913,109 @@ 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); + } + + @EventHandler + private void saveGadget(GadgetChangeEvent event) + { + Gadget gadget = event.getGadget(); + if (gadget != null) + { + String value = "disabled", key = ""; + GadgetType gadgetType = gadget.getGadgetType(); + switch (gadgetType) + { + case MUSIC_DISC: + case ITEM: + case MORPH: + case BALLOON: + return; + case COSTUME: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) + { + value = outfitGadget.getName(); + } + break; + case GAME_MODIFIER: + GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; + if (gameModifierGadget.canAllowMultiple()) + { + key = gameModifierGadget.getName(); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) + { + value = "enabled"; + } + } + else + { + key = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", ""); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) + { + value = gameModifierGadget.getName(); + } + } + break; + default: + key = gadgetType.getDatabaseKey(); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) + { + value = gadget.getName(); + } + } + _userGadgetPersistence.save(event.getPlayer(), key, value); + } + } + + 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..1fc07c933 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -2,11 +2,18 @@ package mineplex.core.gadget.commands; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.inventory.ClientItem; +import mineplex.core.inventory.data.Item; +import mineplex.core.mount.Mount; +import mineplex.core.pet.Pet; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase @@ -26,7 +33,7 @@ public class LockCosmeticsCommand extends CommandBase // Removes all cosmetic types if (args.length == 0) { - addCosmetics(null, caller); + lockCosmetics(null, caller); } // Removes specific type else @@ -34,8 +41,16 @@ public class LockCosmeticsCommand extends CommandBase String type = args[0]; if (type.equalsIgnoreCase("all")) { - addCosmetics(null, caller); + lockCosmetics(null, caller); } + else if (type.equalsIgnoreCase("pet")) + { + lockPets(caller); + } + else if (type.equalsIgnoreCase("mount")) + { + lockMounts(caller); + } else { GadgetType gadgetType = GadgetType.valueOf(type); @@ -45,27 +60,74 @@ public class LockCosmeticsCommand extends CommandBase } else { - addCosmetics(gadgetType, caller); + lockCosmetics(gadgetType, caller); } } } } - private void addCosmetics(GadgetType gadgetType, Player caller) + private void lockCosmetics(GadgetType gadgetType, Player caller) { if (gadgetType == null) { for (GadgetType type : GadgetType.values()) { - addCosmetics(type, caller); + lockCosmetics(type, caller); } + lockMounts(caller); + lockPets(caller); return; } + int removed = 0; for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.GetName()); + if (gadget.getGadgetType() == GadgetType.ITEM) + continue; + if (gadget.ownsGadget(caller)) + { + Item clientItem = _plugin.getInventoryManager().getItem(gadget.getName()); + if (clientItem == null) + continue; + _plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1)); + removed++; + } } - UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!")); + UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() + .replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("item", removed) + ")")); } + + private void lockMounts(Player caller) + { + int removed = 0; + for (Mount mount : _plugin.getMountManager().getMounts()) + { + if (mount.hasMount(caller)) + { + Item clientItem = _plugin.getInventoryManager().getItem(mount.getName()); + if (clientItem == null) + continue; + _plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1)); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("mount", removed) + "!")); + } + + private void lockPets(Player caller) + { + int removed = 0; + for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) + { + if (_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType())) + { + _plugin.getPetManager().Get(caller).getPets().remove(pet.getPetType()); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("pet", removed) + "!")); + } } \ No newline at end of file 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..36a279711 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -2,11 +2,15 @@ package mineplex.core.gadget.commands; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; 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.pet.Pet; import org.bukkit.entity.Player; public class UnlockCosmeticsCommand extends CommandBase @@ -36,6 +40,14 @@ public class UnlockCosmeticsCommand extends CommandBase { addCosmetics(null, caller); } + else if (type.equalsIgnoreCase("pet")) + { + addPets(caller); + } + else if (type.equalsIgnoreCase("mount")) + { + addMounts(caller); + } else { GadgetType gadgetType = GadgetType.valueOf(type); @@ -60,12 +72,54 @@ public class UnlockCosmeticsCommand extends CommandBase { addCosmetics(type, caller); } + addMounts(caller); + addPets(caller); return; } + int added = 0; + int amount = 1; for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); + if (gadgetType == GadgetType.ITEM) + amount = 20; + if (!gadget.ownsGadget(caller)) + { + _plugin.getInventoryManager().addItemToInventory(caller, gadget.getName(), amount); + added++; + } } - UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!")); + UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name().toLowerCase() + .replace("_", " ") + "! (Added " + C.cRed + added + C.cGray + " " + + UtilText.plural("item", added) + ")")); } + + private void addMounts(Player caller) + { + int added = 0; + for (Mount mount : _plugin.getMountManager().getMounts()) + { + if (!mount.hasMount(caller)) + { + _plugin.getInventoryManager().addItemToInventory(caller, mount.getName(), 1); + added++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " + + UtilText.plural("mount", added) + "!")); + } + + private void addPets(Player caller) + { + int added = 0; + for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) + { + if (!_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType())) + { + _plugin.getPetManager().Get(caller).getPets().put(pet.getPetType(), pet.getName()); + added++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " + + UtilText.plural("pet", added) + "!")); + } } 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/GadgetChangeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java new file mode 100644 index 000000000..d983cabe6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java @@ -0,0 +1,60 @@ +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; + +/** + * Called when a player enables or disables a gadget manually, + * allowing it to be saved when the player changes a gadget, instead of + * when they quit or join a server + */ +public class GadgetChangeEvent extends Event +{ + + public enum GadgetState + { + ENABLED, + DISABLED + } + + private static final HandlerList handlers = new HandlerList(); + + private final Player _player; + private final Gadget _gadget; + private final GadgetState _gadgetState; + + public GadgetChangeEvent(Player player, Gadget gadget, GadgetState gadgetState) + { + _player = player; + _gadget = gadget; + _gadgetState = gadgetState; + } + + public Player getPlayer() + { + return _player; + } + + public Gadget getGadget() + { + return _gadget; + } + + public GadgetState getGadgetState() + { + return _gadgetState; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} 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/event/GadgetSelectLocationEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetSelectLocationEvent.java new file mode 100644 index 000000000..fefbff7eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetSelectLocationEvent.java @@ -0,0 +1,84 @@ +package mineplex.core.gadget.event; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.gadget.types.Gadget; + +/** + * This event is called when a gadget selects a location for a specific effect to be shown. + */ +public class GadgetSelectLocationEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Gadget _gadget; + private Location _location; + private boolean _showMessage = true; + private boolean _cancelled = false; + + public GadgetSelectLocationEvent(Player player, Gadget gadget, Location location) + { + _player = player; + _gadget = gadget; + _location = location; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Gadget getGadget() + { + return _gadget; + } + + public Player getPlayer() + { + return _player; + } + + public Location getLocation() + { + return _location; + } + + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } + + public boolean isCancelled() + { + return _cancelled; + } + + /** + * Whether or not a cancellation message should be displayed. + * + * @param showMessage True for the message to be shown and false for the message to be hidden/ignored. + */ + public void setShowMessage(boolean showMessage) + { + _showMessage = showMessage; + } + + /** + * Returns whether or not a cancellation message can be shown. + * + * @return True if the message can be shown and false if the message should be hidden/ignored. + */ + public boolean canShowMessage() + { + return _showMessage; + } +} 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..f031776d3 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"); } @@ -117,14 +117,14 @@ public class ItemCoal extends ItemGadget } //Coal Apparition - if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE)) + if (!Manager.getPetManager().Get(player).getPets().containsKey(EntityType.PIG_ZOMBIE)) { 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..9881ffa93 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 @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -17,6 +18,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.Rank; 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; @@ -32,6 +34,7 @@ import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; @@ -55,9 +58,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 +70,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 +88,7 @@ public class MorphTitan extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -105,6 +108,19 @@ public class MorphTitan extends MorphGadget Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc); + Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent); + + if (gadgetSelectLocationEvent.isCancelled()) + { + if (gadgetSelectLocationEvent.canShowMessage()) + { + UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!")); + } + + return; + } + ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class); stand.setVisible(false); @@ -119,13 +135,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 +210,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 +228,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/WinEffectLavaTrap.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java index 93262ead7..0f05294b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java @@ -146,7 +146,7 @@ public class WinEffectLavaTrap extends WinEffectGadget Location loc = getBaseLocation().add(UtilAlg.getRight(dir).multiply(5)).add(0, 2, 0).subtract(dir); loc.setDirection(getBaseLocation().subtract(loc).toVector()); - teleport(loc); + super.teleport(loc); } } 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..76b052693 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -2,21 +2,22 @@ package mineplex.core.gadget.types; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; import mineplex.core.common.util.*; -import org.bukkit.Location; -import org.bukkit.Material; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +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.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -27,6 +28,8 @@ 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; +import org.spigotmc.event.entity.EntityDismountEvent; /** * A wrapper for different win effects @@ -52,8 +55,8 @@ public abstract class WinEffectGadget extends Gadget protected List _nonTeam; /** All players on the team that didn't win + spectators which were not in the game at all. */ protected List _other; - /** All locked players */ - protected List _locked; + /** All the players that were teleported to the winroom */ + protected List _allPlayers; /** * @param manager The normal GadgetManager @@ -67,7 +70,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,85 +81,23 @@ 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() { this._finish = _start + 1000*12; play(); } - - /** - * Lock the player. Disabling any jump or walk movement - * @param p The player to lock in place - */ - public void lockPlayer(Player p) - { - _locked.add(p); - p.setWalkSpeed(0); - p.setFlySpeed(0); - } - - /** - * Unlock the player, allowing the player to walk and jump as normal again. - * @param p The player to unlock - */ - public void unlockPlayer(Player p) - { - if (_locked.contains(p)) - _locked.remove(p); - p.setWalkSpeed(0.2f); - p.setFlySpeed(0.1f); - } - - @EventHandler - public void onMove(PlayerMoveEvent event) - { - for(PotionEffect p : event.getPlayer().getActivePotionEffects()) - { - if(p.getType().equals(PotionEffectType.JUMP)) - { - if(p.getAmplifier() == 250) - { - if(event.getTo().clone().subtract(event.getFrom()).lengthSquared() > 0) - { - Location loc = event.getPlayer().getLocation().getBlock().getLocation().add(0.5, 0, 0.5); - loc.setDirection(event.getTo().getDirection()); - event.setTo(loc); - } - return; - } - } - } - } - + public void runFinish() { finish(); - UtilServer.getPlayersCollection().forEach(p -> {unlockPlayer(p); UtilPlayer.showForAll(p); }); _player = null; _baseLocation = null; _team.clear(); @@ -165,8 +106,13 @@ public abstract class WinEffectGadget extends Gadget _nonTeam = null; _other.clear(); _other = null; - _locked.clear(); - _locked = null; + _allPlayers.clear(); + _allPlayers = 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); + } } /** @@ -234,7 +180,8 @@ public abstract class WinEffectGadget extends Gadget _other.remove(player); _other.removeAll(team); - _locked = new ArrayList<>(); + _allPlayers = new ArrayList<>(); + _allPlayers.addAll(UtilServer.getPlayersCollection()); this._start = System.currentTimeMillis(); this._baseLocation = loc.clone(); @@ -258,30 +205,64 @@ public abstract class WinEffectGadget extends Gadget */ public void teleport(Location loc) { - loc.getBlock().setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.UP).setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.EAST).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.WEST).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.NORTH).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.clone().add(0, 2, 0).getBlock().setType(Material.BARRIER); + createBarriers(loc); BukkitRunnable bRunnable = new BukkitRunnable() { @Override public void run() { for(Player p : UtilServer.getPlayers()) { - lockPlayer(p); UtilPlayer.hideFromAll(p); + p.teleport(loc); + p.setGameMode(GameMode.ADVENTURE); + p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10 * 20, 1, false, false)); p.getInventory().clear(); - p.teleport(loc); p.setAllowFlight(false); + p.setHealth(p.getMaxHealth()); + p.setFoodLevel(20); + Manager.disableAll(p, true); } } }; bRunnable.runTaskLater(UtilServer.getPlugin(), 10l); } - + + /** + * Updates players inventory + * @param event + */ + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!isRunning()) + return; + + for (Player player : _allPlayers) + { + player.getInventory().clear(); + } + } + + @EventHandler + public void onFoodLevelChange(FoodLevelChangeEvent event) + { + if (isRunning()) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onPlayerDamage(EntityDamageEvent event) + { + if (isRunning()) + { + event.setCancelled(true); + } + } + /** * Build the win room, by default this will paste the scheamtic. Do any major setup here. This is called before the players are * teleported. @@ -334,4 +315,103 @@ 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); + } + } + + private void createBarriers(Location baseLocation) + { + // FLOOR + Location floorBase = baseLocation.clone().subtract(0, 1, 0); + setBarrierBlock(floorBase); + setBarrierBlock(floorBase.clone().add(1, 0, 0)); + setBarrierBlock(floorBase.clone().add(0, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 0)); + setBarrierBlock(floorBase.clone().subtract(0, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, -1)); + setBarrierBlock(floorBase.clone().add(-1, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 1)); + + // WALLS + floorBase.add(0, 2, 0); + setBarrierBlock(floorBase.clone().add(2, 0, 0)); + setBarrierBlock(floorBase.clone().add(2, 0, 1)); + setBarrierBlock(floorBase.clone().add(2, 0, -1)); + + setBarrierBlock(floorBase.clone().subtract(2, 0, 0)); + setBarrierBlock(floorBase.clone().subtract(2, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(2, 0, -1)); + + setBarrierBlock(floorBase.clone().add(0, 0, 2)); + setBarrierBlock(floorBase.clone().add(1, 0, 2)); + setBarrierBlock(floorBase.clone().add(-1, 0, 2)); + + setBarrierBlock(floorBase.clone().subtract(0, 0, 2)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 2)); + setBarrierBlock(floorBase.clone().subtract(-1, 0, 2)); + + // CEILING + floorBase.add(0, 2, 0); + setBarrierBlock(floorBase); + setBarrierBlock(floorBase.clone().add(1, 0, 0)); + setBarrierBlock(floorBase.clone().add(0, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 0)); + setBarrierBlock(floorBase.clone().subtract(0, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, -1)); + setBarrierBlock(floorBase.clone().add(-1, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 1)); + + // CHANGES MIDDLE TO AIR + floorBase.subtract(1, 3, 1); + for (int x = 0; x < 3; x++) + { + for (int y = 0; y < 3; y++) + { + for (int z = 0; z < 3; z++) + { + floorBase.clone().add(x, y, z).getBlock().setType(Material.AIR); + } + } + } + + } + + private void setBarrierBlock(Location blockLocation) + { + if (blockLocation.getBlock().getType() == Material.AIR) + blockLocation.getBlock().setType(Material.BARRIER); + } + } 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/giveaway/GiveawayManager.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java index bfcfa4981..9d86ffa9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java @@ -173,7 +173,7 @@ public class GiveawayManager extends MiniDbClientPlugin } @Override - protected PlayerGiveawayData AddPlayer(String player) + protected PlayerGiveawayData addPlayer(String player) { return new PlayerGiveawayData(); } 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/ignore/IgnoreManager.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java index a4735a7a4..15c0fca39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java @@ -80,7 +80,7 @@ public class IgnoreManager extends MiniDbClientPlugin } @Override - protected IgnoreData AddPlayer(String player) + protected IgnoreData addPlayer(String player) { return new IgnoreData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java index 92a1cb641..2594b4188 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java @@ -191,7 +191,7 @@ public class IncognitoManager extends MiniDbClientPlugin UtilPlayer.message(player, " "); } - protected IncognitoClient AddPlayer(String player) + protected IncognitoClient addPlayer(String player) { return new IncognitoClient(); } 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/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 72a33d939..43a1d22e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -342,7 +342,7 @@ public class InventoryManager extends MiniDbClientPlugin } @Override - protected ClientInventory AddPlayer(String player) + protected ClientInventory addPlayer(String player) { return new ClientInventory(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 6d437d2d1..3faaee528 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -87,7 +87,7 @@ public class MessageManager extends MiniClientPlugin } @Override - protected ClientMessage AddPlayer(String player) + protected ClientMessage addPlayer(String player) { Set(player, new ClientMessage()); return Get(player); 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/movement/Movement.java b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java index 9f801a28c..40d547a39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java @@ -40,7 +40,7 @@ public class Movement extends MiniClientPlugin } @Override - protected ClientMovement AddPlayer(String player) + protected ClientMovement addPlayer(String player) { return new ClientMovement(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index 3018daa85..d8076b1cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -1,12 +1,8 @@ package mineplex.core.packethandler; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - +import com.mineplex.spigot.PacketProcessor; +import mineplex.core.MiniPlugin; import net.minecraft.server.v1_8_R3.Packet; - import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -15,16 +11,22 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -import com.mineplex.spigot.PacketProcessor; - -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.NautHashMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; public class PacketHandler extends MiniPlugin { - private NautHashMap _playerVerifierMap = new NautHashMap(); - private HashMap> _forceMainThread = new HashMap>(); - private HashMap> _packetHandlers = new HashMap>(); + private Map _playerVerifierMap = new HashMap<>(); + + private Map, Set> _forceMainThread = new HashMap<>(); + private Map, Map>> _packetHandlers = new HashMap<>(); public PacketHandler(JavaPlugin plugin) { @@ -40,18 +42,6 @@ public class PacketHandler extends MiniPlugin .get(event.getPlayer())); } - public boolean handlePacket(Player player, Packet packet) - { - if (!_playerVerifierMap.containsKey(player)) - { - return true; - } - - PacketVerifier verifier = _playerVerifierMap.get(player); - - return handlePacket(new PacketInfo(player, packet, verifier)); - } - public boolean handlePacket(PacketInfo packetInfo) { if (!_packetHandlers.containsKey(packetInfo.getPacket().getClass())) @@ -60,15 +50,18 @@ public class PacketHandler extends MiniPlugin return true; } - for (IPacketHandler handler : _packetHandlers.get(packetInfo.getPacket().getClass())) + for (Entry> entry : _packetHandlers.get(packetInfo.getPacket().getClass()).entrySet()) { - try + for (IPacketHandler handler : entry.getValue()) { - handler.handle(packetInfo); - } - catch (Exception ex) - { - ex.printStackTrace(); + try + { + handler.handle(packetInfo); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } } @@ -90,72 +83,106 @@ public class PacketHandler extends MiniPlugin @SafeVarargs public final void addPacketHandler(IPacketHandler packetHandler, Class... packetsToListen) { - if (packetsToListen.length == 0) - { - throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); - } - - addPacketHandler(packetHandler, false, packetsToListen); + addPacketHandler(packetHandler, ListenerPriority.NORMAL, false, packetsToListen); } - /** - * This should only be used for incoming packets - */ - public void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, - Class... packetsToListen) + @SafeVarargs + public final void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, Class... packetsToListen) { if (packetsToListen.length == 0) { throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); } - for (Class c : packetsToListen) + addPacketHandler(packetHandler, ListenerPriority.NORMAL, forceMainThread, packetsToListen); + } + + @SafeVarargs + public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, Class... packetsToListen) + { + if (packetsToListen.length == 0) + { + throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); + } + + addPacketHandler(packetHandler, priority, false, packetsToListen); + } + + /** + * This should only be used for incoming packets + */ + @SafeVarargs + public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, boolean forceMainThread, + Class... packetsToListen) + { + if (packetsToListen.length == 0) + { + throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); + } + + for (Class c : packetsToListen) { if (forceMainThread) { - if (!_forceMainThread.containsKey(c)) - { - _forceMainThread.put(c, new ArrayList()); - } - - _forceMainThread.get(c).add(packetHandler); + _forceMainThread + .computeIfAbsent(c, key -> new HashSet<>()) + .add(packetHandler); } - if (!_packetHandlers.containsKey(c)) - { - _packetHandlers.put(c, new ArrayList()); - } + _packetHandlers + .computeIfAbsent(c, key -> new TreeMap<>()) + .computeIfAbsent(priority, key -> new ArrayList<>()) + .add(packetHandler); - _packetHandlers.get(c).add(packetHandler); PacketProcessor.addPacket(c, forceMainThread || _forceMainThread.containsKey(c)); } } public void removePacketHandler(IPacketHandler packetHandler) { - Iterator>> itel = _packetHandlers.entrySet().iterator(); + Iterator, Map>>> itel = _packetHandlers.entrySet().iterator(); while (itel.hasNext()) { - Entry> entry = itel.next(); + Entry, Map>> entry = itel.next(); - if (entry.getValue().remove(packetHandler)) + Set removedFrom = new HashSet<>(); + + for (Entry> ent : entry.getValue().entrySet()) { - if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler)) + if (ent.getValue().remove(packetHandler)) { - if (_forceMainThread.get(entry.getKey()).isEmpty()) - { - _forceMainThread.remove(entry.getKey()); - PacketProcessor.addPacket(entry.getKey(), false); - } + removedFrom.add(ent.getKey()); } + } - if (entry.getValue().isEmpty()) + for (ListenerPriority priority : removedFrom) + { + if (entry.getValue().get(priority).isEmpty()) { - PacketProcessor.removePacket(entry.getKey()); - itel.remove(); + entry.getValue().remove(priority); } } + + if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler)) + { + if (_forceMainThread.get(entry.getKey()).isEmpty()) + { + _forceMainThread.remove(entry.getKey()); + PacketProcessor.addPacket(entry.getKey(), false); + } + } + + if (entry.getValue().isEmpty()) + { + PacketProcessor.removePacket(entry.getKey()); + itel.remove(); + } } } + + public enum ListenerPriority + { + HIGH, NORMAL, LOW + } } 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..0ae459e78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -24,23 +24,23 @@ public class Pet extends SalesPackageBase KnownPackage = false; } - public EntityType GetPetType() + public EntityType getPetType() { return _petType; } - public void Update(PetSalesToken petToken) + public void update(PetSalesToken petToken) { _name = petToken.Name; } - public String GetPetName() + public String getPetName() { return _name; } @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/PetClient.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java index 5aa25843a..e24136065 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java @@ -11,7 +11,7 @@ public class PetClient private NautHashMap _pets; private int _petNameTagCount; - public void Load(ClientPetToken token) + public void load(ClientPetToken token) { _pets = new NautHashMap(); @@ -26,7 +26,7 @@ public class PetClient _petNameTagCount = Math.max(0, token.PetNameTagCount); } - public NautHashMap GetPets() + public NautHashMap getPets() { return _pets; } 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/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 4e609930f..d5f48d43b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -128,7 +128,7 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - AddPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation()); + addPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation()); } } @@ -160,24 +160,24 @@ public class PetManager extends MiniClientPlugin if (rank.has(Rank.LEGEND)) { - if (!Get(p).GetPets().containsKey(EntityType.WITHER)) - Get(p).GetPets().put(EntityType.WITHER, "Widder"); + if (!Get(p).getPets().containsKey(EntityType.WITHER)) + Get(p).getPets().put(EntityType.WITHER, "Widder"); } if (rank.has(Rank.TITAN)) { - if (!Get(p).GetPets().containsKey(EntityType.SKELETON)) - Get(p).GetPets().put(EntityType.SKELETON, "Guardian"); + if (!Get(p).getPets().containsKey(EntityType.SKELETON)) + Get(p).getPets().put(EntityType.SKELETON, "Guardian"); } } - public void AddPetOwner(Player player, EntityType entityType, Location location) + public void addPetOwner(Player player, EntityType entityType, Location location) { if (_activePetOwners.containsKey(player.getName())) { if (_activePetOwners.get(player.getName()).getType() != entityType) { - RemovePet(player, true); + removePet(player, true); } else return; @@ -214,10 +214,10 @@ public class PetManager extends MiniClientPlugin } //Named Pet - if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0) + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) { //pet.setCustomNameVisible(true); - pet.setCustomName(Get(player).GetPets().get(entityType)); + pet.setCustomName(Get(player).getPets().get(entityType)); } if (pet instanceof Zombie) @@ -245,9 +245,9 @@ public class PetManager extends MiniClientPlugin DisguiseGuardian disguise = new DisguiseGuardian(pet); - if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0) + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) { - disguise.setName(Get(player).GetPets().get(entityType)); + disguise.setName(Get(player).getPets().get(entityType)); } _disguiseManager.disguise(disguise); @@ -265,12 +265,12 @@ public class PetManager extends MiniClientPlugin UtilEnt.Vegetate(pet); } - public Creature GetPet(Player player) + public Creature getPet(Player player) { return _activePetOwners.get(player.getName()); } - public void RemovePet(final Player player, boolean removeOwner) + public void removePet(final Player player, boolean removeOwner) { if (_activePetOwners.containsKey(player.getName())) { @@ -303,7 +303,7 @@ public class PetManager extends MiniClientPlugin @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - RemovePet(event.getPlayer(), true); + removePet(event.getPlayer(), true); } @EventHandler @@ -336,7 +336,7 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - RemovePet(player, true); + removePet(player, true); } } } @@ -438,25 +438,25 @@ public class PetManager extends MiniClientPlugin } @EventHandler - public void OnClientWebResponse(ClientWebResponseEvent event) + public void onClientWebResponse(ClientWebResponseEvent event) { ClientPetTokenWrapper token = new Gson().fromJson(event.GetResponse(), ClientPetTokenWrapper.class); - Get(token.Name).Load(token.DonorToken); + Get(token.Name).load(token.DonorToken); } @Override - protected PetClient AddPlayer(String player) + protected PetClient addPlayer(String player) { return new PetClient(); } - public PetFactory GetFactory() + public PetFactory getFactory() { return _petFactory; } - public PetRepository GetRepository() + public PetRepository getRepository() { return _repository; } @@ -471,15 +471,15 @@ public class PetManager extends MiniClientPlugin return _activePetOwners.get(name); } - public void DisableAll() + public void disableAll() { for (Player player : UtilServer.getPlayers()) - RemovePet(player, true); + removePet(player, true); } - public void DisableAll(Player player) + public void disableAll(Player player) { - RemovePet(player, true); + removePet(player, true); } public Collection getPets() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java index a2d5298b0..64abfc3cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java @@ -51,7 +51,7 @@ public class PollManager extends MiniDbClientPlugin } @Override - protected PlayerPollData AddPlayer(String player) + protected PlayerPollData addPlayer(String player) { return new PlayerPollData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java index 5622bdef6..07592704a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java @@ -59,7 +59,7 @@ public class PreferencesManager extends MiniDbClientPlugin } @Override - protected UserPreferences AddPlayer(String player) + protected UserPreferences addPlayer(String player) { return new UserPreferences(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java index 35511ac6a..4c3a962ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java @@ -33,7 +33,7 @@ public class KitProgressionManager extends MiniClientPlugin @Override - protected PlayerKit AddPlayer(String player) + protected PlayerKit addPlayer(String player) { return null; } 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..508a59d2c 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; } @@ -919,9 +929,9 @@ public class RewardManager public PetReward addPetReward(Type type, EntityType entityType, RewardRarity rarity, int weight, int shards) { - Pet pet = _petManager.GetFactory().getPet(entityType); + 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/reward/rewards/PetReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java index d3dba4662..9589502eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java @@ -50,8 +50,8 @@ public class PetReward extends UnknownPackageReward PetToken petToken = new PetToken(); petToken.PetType = token.PetType; - _petManager.GetRepository().AddPet(token); - _petManager.Get(player).GetPets().put(_petEntity, token.PetName); + _petManager.getRepository().AddPet(token); + _petManager.Get(player).getPets().put(_petEntity, token.PetName); _inventoryManager.addItemToInventory(player, _petEntity.toString(), 1); @@ -67,6 +67,6 @@ public class PetReward extends UnknownPackageReward return false; } - return !_petManager.Get(player).GetPets().containsKey(_petEntity); + return !_petManager.Get(player).getPets().containsKey(_petEntity); } } 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 } @Override - protected PlayerStats AddPlayer(String player) + protected PlayerStats addPlayer(String player) { return new PlayerStats(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java index 0427cb53e..ef09c15cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java @@ -49,7 +49,7 @@ public class TaskManager extends MiniDbClientPlugin } @Override - protected TaskClient AddPlayer(String playerName) + protected TaskClient addPlayer(String playerName) { return new TaskClient(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java b/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java index d5bdf1a0b..4166c6a36 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java @@ -80,7 +80,7 @@ public class TournamentManager extends MiniDbClientPlugin } @Override - protected ClientTournamentData AddPlayer(String player) + protected ClientTournamentData addPlayer(String player) { return new ClientTournamentData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/ChestPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/ChestPackage.java index ef550b390..8ab2aa019 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/ChestPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/ChestPackage.java @@ -17,7 +17,7 @@ public class ChestPackage 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/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index df12ec920..3540a8c96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -1,5 +1,7 @@ package mineplex.core.treasure; +import java.awt.*; +import java.awt.Color; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; @@ -8,22 +10,20 @@ import java.util.Random; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Bukkit; -import org.bukkit.Effect; -import org.bukkit.Material; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.treasure.animation.*; +import org.bukkit.*; import org.bukkit.block.Block; +import org.bukkit.block.Skull; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Player; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.hologram.HologramManager; import mineplex.core.reward.RankRewardData; import mineplex.core.reward.Reward; @@ -32,15 +32,6 @@ import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardType; import mineplex.core.status.ServerStatusManager; import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; -import mineplex.core.treasure.animation.Animation; -import mineplex.core.treasure.animation.BlockChangeAnimation; -import mineplex.core.treasure.animation.ChestOpenAnimation; -import mineplex.core.treasure.animation.ChestSpawnAnimation; -import mineplex.core.treasure.animation.LootLegendaryAnimation; -import mineplex.core.treasure.animation.LootMythicalAnimation; -import mineplex.core.treasure.animation.LootRareAnimation; -import mineplex.core.treasure.animation.LootUncommonAnimation; -import mineplex.core.treasure.animation.TreasureRemoveAnimation; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; @@ -138,7 +129,7 @@ public class Treasure if (_tickCount % 10 == 0 && _currentChest < _chestData.length) { - ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this,_chestData[_currentChest].getBlock(), _chestBlockInfo, _centerBlock, _currentChest); + ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this,_chestData[_currentChest].getBlock(), _chestBlockInfo, _centerBlock, _currentChest, _statusManager.getPlugin()); _animations.add(chestSpawn); _currentChest++; } @@ -185,6 +176,15 @@ public class Treasure UtilParticle.PlayParticleToAll(type, block.getLocation().add(0.5, 0.0, 0.5), 0.1f, 0.1f, 0.1f, 0.05f, 4, ViewDist.NORMAL); } + else if (_treasureType == TreasureType.FREEDOM) + { + int r = (int) (Math.random() * 3); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.RED : (r == 1) ? Color.WHITE : Color.BLUE), + block.getLocation().add(.5 + rX, .7, .5 + rX)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, @@ -256,6 +256,10 @@ public class Treasure _animations.add(chestOpenTask); // Extra effects based off the rarity of the treasure + if (_treasureType == TreasureType.FREEDOM) + { + _animations.add(new FreedomChestAnimation(Treasure.this, data.getBlock().getLocation().add(.5, .5, .5))); + } if (rewardData.getRarity() == RewardRarity.UNCOMMON) { _animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock())); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureKey.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureKey.java index 801921c0d..06ecab631 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureKey.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureKey.java @@ -21,7 +21,7 @@ public class TreasureKey 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/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 07a9e25bf..a2cc71f46 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -2,6 +2,7 @@ package mineplex.core.treasure; import java.util.List; +import mineplex.core.gadget.GadgetManager; import mineplex.core.reward.RewardPool; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -57,7 +58,7 @@ public class TreasureLocation implements Listener private TreasureShop _shop; private Location _resetLocation; - public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, ServerStatusManager statusManager) + public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, GadgetManager gadgetManager, ServerStatusManager statusManager) { _treasureManager = treasureManager; _resetLocation = resetLocation; @@ -83,7 +84,7 @@ public class TreasureLocation implements Listener } }); setHoloChestVisible(true); - _shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, this); + _shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, gadgetManager, this); } @EventHandler @@ -118,23 +119,11 @@ public class TreasureLocation implements Listener public void run(Boolean success) { - boolean testServer = _treasureManager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - testServer = false; - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - if (!success) { player.sendMessage(F.main("Treasure", "You don't have any chests to open!")); - if (testServer) - { - player.sendMessage("But like, lets just ignore that for now though ;)"); - } - else - { - return; - } + return; } @@ -145,8 +134,8 @@ public class TreasureLocation implements Listener _inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1); return; } - - if(treasureType == TreasureType.ILLUMINATED) + + if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { @@ -162,8 +151,8 @@ public class TreasureLocation implements Listener if(r == null) { reset(); - player.sendMessage(F.main("Treasure", "There are no available items in this chest for you")); - player.sendMessage(F.main("Treasure", "to open")); + player.sendMessage(F.main("Treasure", "There are no available items in this chest for you to open")); + _inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1); return; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 65cc5f9db..2b82b9779 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -3,6 +3,7 @@ package mineplex.core.treasure; import java.util.ArrayList; import java.util.List; +import mineplex.core.gadget.GadgetManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -38,7 +39,7 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _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..f62bd83cc 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,27 @@ 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 (_chestType == TreasureType.FREEDOM) + { + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } + else + { + player.sendMessage(F.main("Treasure", "This chest is no longer available for purchases!")); + return; + } + } + 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..c05c9a774 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -3,7 +3,17 @@ 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.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -24,13 +34,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 +57,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 +159,42 @@ 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 && !hasAllFreedomItems(getPlayer())) + freedomLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + else + { + freedomLore.add(C.cRed + "This item is no longer available!"); + } + 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()) && freedomCount >= 1) + addChest(13, freedom, TreasureType.FREEDOM, freedomCount); + else + { + freedom = new ShopItem(Material.INK_SACK, DyeColor.SILVER.getData(), C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore.toArray(new String[0]), 0, true, false); + 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 +202,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..5683c4b20 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -0,0 +1,83 @@ +package mineplex.core.youtube; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import org.bukkit.Bukkit; +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 static final int REWARD_MESSAGE_DELAY_SECONDS = 30; + 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); + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + }); + } + + @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 314623f33..08157bd5d 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; @@ -321,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); @@ -984,7 +1000,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati } @Override - protected ClientClan AddPlayer(String player) + protected ClientClan addPlayer(String player) { return new ClientClan(); } 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/murder/MurderManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java index 8f10f9f0b..49143cff6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java @@ -204,7 +204,7 @@ public class MurderManager extends MiniClientPlugin } @Override - protected ClientMurder AddPlayer(String player) + protected ClientMurder addPlayer(String player) { return new ClientMurder(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java index 52c3dfeba..c64fd698a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java @@ -45,7 +45,7 @@ public class Playtime extends MiniClientPlugin @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - Set(event.getPlayer(), AddPlayer(event.getPlayer().getName())); + Set(event.getPlayer(), addPlayer(event.getPlayer().getName())); } @EventHandler @@ -73,7 +73,7 @@ public class Playtime extends MiniClientPlugin } @Override - protected PlayingClient AddPlayer(String player) + protected PlayingClient addPlayer(String player) { return new PlayingClient(Bukkit.getPlayer(player), TaskManager.Instance); } 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/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 21befc0b9..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; @@ -86,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; @@ -626,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 @@ -680,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); } @@ -697,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) @@ -743,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..37a50cbb3 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 { @@ -169,6 +135,7 @@ public class HubManager extends MiniClientPlugin private IncognitoManager _incognito; private ValentinesManager _valentinesManager; private BonusManager _bonusManager; + private JumpManager _jumpManager; // private HalloweenSpookinessManager _halloweenManager; // private TrickOrTreatManager _trickOrTreatManager; @@ -215,7 +182,7 @@ public class HubManager extends MiniClientPlugin _parkour = new ParkourManager(this, donationManager, taskManager); new WorldManager(this); - new JumpManager(this); + _jumpManager = new JumpManager(this); //new TournamentInviter(this); @@ -227,11 +194,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); @@ -818,7 +787,7 @@ public class HubManager extends MiniClientPlugin } @Override - protected HubClient AddPlayer(String player) + protected HubClient addPlayer(String player) { return new HubClient(player); } @@ -1070,7 +1039,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); @@ -1104,4 +1073,9 @@ public class HubManager extends MiniClientPlugin { return _incognito; } + + public JumpManager getJumpManager() + { + return _jumpManager; + } } 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/mail/MailManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java index a5fd6ebb4..a31b07381 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java @@ -27,7 +27,7 @@ public class MailManager extends MiniClientPlugin implements Not } @Override - protected PlayerMailData AddPlayer(String player) + protected PlayerMailData addPlayer(String player) { return new PlayerMailData(); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java index e0367bdba..afa61a5a1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java @@ -1,11 +1,13 @@ package mineplex.hub.modules; -import org.bukkit.Bukkit; +import java.util.HashSet; + import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.util.Vector; @@ -28,6 +30,7 @@ import mineplex.hub.HubManager; public class JumpManager extends MiniPlugin { public HubManager Manager; + private HashSet _preparedDoubleJump = new HashSet<>(); public JumpManager(HubManager manager) { @@ -66,8 +69,9 @@ public class JumpManager extends MiniPlugin vec.setY(Math.abs(vec.getY())); //Velocity + _preparedDoubleJump.add(player.getName()); UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true); - + //Sound player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); @@ -105,8 +109,20 @@ public class JumpManager extends MiniPlugin { player.setAllowFlight(true); player.setFlying(false); + _preparedDoubleJump.remove(player.getName()); } } } } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + _preparedDoubleJump.remove(event.getPlayer().getName()); + } + + public boolean hasDoubleJumped(Player player) + { + return _preparedDoubleJump.contains(player.getName()); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java index 4aec41006..0787e225b 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); + 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..fed5f2501 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -3,15 +3,14 @@ package mineplex.hub.modules; import java.util.ArrayList; import java.util.HashSet; +import org.bukkit.Color; import org.bukkit.EntityEffect; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Color; import org.bukkit.Location; 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,13 +18,12 @@ 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; +import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -40,8 +38,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.event.StackerEvent; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -53,8 +53,8 @@ import mineplex.hub.HubManager; public class SoccerManager extends MiniPlugin { - public HubManager Manager; - + private HubManager _hubManager; + private HashSet _active = new HashSet(); private ArrayList _teamArmor = new ArrayList(); @@ -74,10 +74,10 @@ public class SoccerManager extends MiniPlugin private Location _cornerBlueGoalA; private Location _cornerBlueGoalB; - int _blueGoals = 0; - int _redGoals = 0; + private int _blueGoals = 0; + private int _redGoals = 0; - int _insideGoalTicks = 0; + private int _insideGoalTicks = 0; private Slime _ball; private Vector _ballVel; @@ -92,29 +92,29 @@ public class SoccerManager extends MiniPlugin protected Location _lastLoc; protected ArrayList _velHistory = new ArrayList(); - public SoccerManager(HubManager manager, GadgetManager gadgets) + public SoccerManager(HubManager hubManager, GadgetManager gadgetManager) { - super("Football Manager", manager.getPlugin()); + super("Football Manager", hubManager.getPlugin()); - Manager = manager; + _hubManager = hubManager; + + _cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), 28.5,70,-27.5); + _cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 50.5,100,-65.5); - _cornerFieldPlayerA = new Location(Manager.GetSpawn().getWorld(), 28.5,70,-27.5); - _cornerFieldPlayerB = new Location(Manager.GetSpawn().getWorld(), 50.5,100,-65.5); + _cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), 35.5,70,-24.5); + _cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 43.5,100,-68.5); - _cornerGoalPlayerA = new Location(Manager.GetSpawn().getWorld(), 35.5,70,-24.5); - _cornerGoalPlayerB = new Location(Manager.GetSpawn().getWorld(), 43.5,100,-68.5); + _cornerFieldA = new Location(hubManager.GetSpawn().getWorld(), 29.75,70,-28.75); + _cornerFieldB = new Location(hubManager.GetSpawn().getWorld(), 49.25,100,-64.25); - _cornerFieldA = new Location(Manager.GetSpawn().getWorld(), 29.75,70,-28.75); - _cornerFieldB = new Location(Manager.GetSpawn().getWorld(), 49.25,100,-64.25); + _cornerRedGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-64.25); + _cornerRedGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-67.25); - _cornerRedGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-64.25); - _cornerRedGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-67.25); - - _cornerBlueGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-25.75); - _cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75); + _cornerBlueGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-25.75); + _cornerBlueGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-28.75); //Store Gadgets - for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume)) + for (Gadget gadget : gadgetManager.getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { @@ -343,7 +343,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); } @@ -355,7 +355,7 @@ public class SoccerManager extends MiniPlugin return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) || UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB); } - + @EventHandler public void clean(UpdateEvent event) { @@ -473,9 +473,9 @@ public class SoccerManager extends MiniPlugin outfit.add("Team Pants"); outfit.add("Team Boots"); - Manager.GetGadget().DisableAll(player, outfit); - Manager.GetMount().DisableAll(player); - Manager.getPetManager().DisableAll(player); + _hubManager.GetGadget().disableAll(player, outfit); + _hubManager.GetMount().DisableAll(player); + _hubManager.getPetManager().disableAll(player); } else { @@ -484,11 +484,11 @@ public class SoccerManager extends MiniPlugin } } - public boolean isSoccerMode(Player player) + public boolean isSoccerMode(Entity entity) { - return _active.contains(player); + return _active.contains(entity); } - + @EventHandler public void disableGadgets(GadgetEnableEvent event) { @@ -513,6 +513,35 @@ public class SoccerManager extends MiniPlugin event.setCancelled(true); } + @EventHandler + public void disableStacker(StackerEvent event) + { + if (isSoccerMode(event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void disableGuardianLazer(GadgetSelectLocationEvent event) + { + if (UtilAlg.inBoundingBox(event.getLocation(), _cornerFieldA, _cornerFieldB)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void disableVelocity(PlayerVelocityEvent event) + { + // Disable velocity but allow double jumping. + + if (isSoccerMode(event.getPlayer()) && !_hubManager.getJumpManager().hasDoubleJumped(event.getPlayer())) + { + event.setCancelled(true); + } + } + @EventHandler public void playerQuit(PlayerQuitEvent event) { 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/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index da26f23fd..a92a99b2e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -948,7 +948,7 @@ public class ServerManager extends MiniDbClientPlugin implement } @Override - protected SimpleClanToken AddPlayer(String player) + protected SimpleClanToken addPlayer(String player) { return new SimpleClanToken(); } 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/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java index da87fc2da..4bc36c039 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -322,7 +322,7 @@ public class ClassManager extends MiniClientPlugin implements IClas } @Override - protected ClientClass AddPlayer(String player) + protected ClientClass addPlayer(String player) { return new ClientClass(this, _skillFactory, _itemFactory, _clientManager.Get(player), _donationManager.Get(player), null); } 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/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/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.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java index dbac07668..54b6e7437 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java @@ -402,6 +402,18 @@ public class ConditionManager extends MiniPlugin return false; } + + public boolean HasCondition(LivingEntity target, ConditionType type) + { + if (!_conditions.containsKey(target)) + return false; + + for (Condition cond : _conditions.get(target)) + if (type == null || cond.GetType() == type) + return true; + + return false; + } public WeakHashMap> GetActiveConditions() { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index 8f2788e66..ec3781d43 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -44,6 +44,7 @@ public class CustomDamageEvent extends Event implements Cancellable private boolean _damageeBrute = false; private boolean _damageToLevel = true; private boolean _arrowShow = true; + private boolean _projectileDamageSelf = false; public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource, @@ -169,6 +170,27 @@ public class CustomDamageEvent extends Event implements Cancellable return _projectile; } + public boolean getProjectileDamageSelf() + { + return _projectileDamageSelf; + } + + public void setProjectileDamageSelf(boolean projectileDamageSelf) + { + _projectileDamageSelf = projectileDamageSelf; + if(!projectileDamageSelf) + { + _cancellers.remove("Self Projectile Damage"); + } + else + { + if(!_cancellers.contains("Self Projectile Damage")) + { + _cancellers.add("Self Projectile Damage"); + } + } + } + public void setShowArrows(boolean show) { _arrowShow = show; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index daba8449a..304394625 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -3,26 +3,11 @@ package mineplex.minecraft.game.core.damage; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.npc.NpcManager; -import mineplex.minecraft.game.core.combat.CombatManager; -import mineplex.minecraft.game.core.condition.ConditionManager; -import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; -import net.minecraft.server.v1_8_R3.DamageSource; -import net.minecraft.server.v1_8_R3.EntityHuman; -import net.minecraft.server.v1_8_R3.EntityLiving; - import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Location; @@ -45,6 +30,24 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.npc.NpcManager; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; +import net.minecraft.server.v1_8_R3.DamageSource; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityLiving; + public class DamageManager extends MiniPlugin { private CombatManager _combatManager; @@ -57,6 +60,9 @@ public class DamageManager extends MiniPlugin public boolean DisableDamageChanges = false; private boolean _enabled = true; + + private final HashMap _protectionTypeModifiers = new HashMap(); + private final HashMap _protectionCauses = new HashMap(); public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager, ConditionManager conditionManager) { @@ -79,6 +85,102 @@ public class DamageManager extends MiniPlugin } registerEvents(new NpcProtectListener(npcManager)); + + _protectionTypeModifiers.put(Enchantment.PROTECTION_ENVIRONMENTAL.getName(), 1); + _protectionTypeModifiers.put(Enchantment.PROTECTION_FIRE.getName(), 2); + _protectionTypeModifiers.put(Enchantment.PROTECTION_EXPLOSIONS.getName(), 2); + _protectionTypeModifiers.put(Enchantment.PROTECTION_PROJECTILE.getName(), 2); + _protectionTypeModifiers.put(Enchantment.PROTECTION_FALL.getName(), 3); + + _protectionCauses.put(Enchantment.PROTECTION_ENVIRONMENTAL.getName(), new DamageCause[] {DamageCause.BLOCK_EXPLOSION, DamageCause.CONTACT, DamageCause.CUSTOM, DamageCause.DROWNING, DamageCause.ENTITY_ATTACK, DamageCause.ENTITY_EXPLOSION, DamageCause.FALL, DamageCause.FALLING_BLOCK, DamageCause.FIRE, DamageCause.FIRE_TICK, DamageCause.LAVA, DamageCause.LIGHTNING, DamageCause.PROJECTILE, DamageCause.SUFFOCATION, DamageCause.THORNS}); + _protectionCauses.put(Enchantment.PROTECTION_FIRE.getName(), new DamageCause[] {DamageCause.FIRE, DamageCause.FIRE_TICK, DamageCause.LAVA}); + _protectionCauses.put(Enchantment.PROTECTION_EXPLOSIONS.getName(), new DamageCause[] {DamageCause.BLOCK_EXPLOSION, DamageCause.ENTITY_EXPLOSION}); + _protectionCauses.put(Enchantment.PROTECTION_PROJECTILE.getName(), new DamageCause[] {DamageCause.PROJECTILE}); + _protectionCauses.put(Enchantment.PROTECTION_FALL.getName(), new DamageCause[] {DamageCause.FALL}); + } + + private int getHighestLevel(Enchantment ench, ItemStack[] items) + { + int level = 0; + + for (ItemStack item : items) + { + if (item == null && item.getType() == Material.AIR) + { + continue; + } + if (!item.containsEnchantment(ench)) + { + continue; + } + if (item.getEnchantmentLevel(ench) <= level) + { + continue; + } + level = item.getEnchantmentLevel(ench); + } + + return level; + } + + private int getTotalEPF(Enchantment ench, ItemStack[] items) + { + if (!_protectionTypeModifiers.containsKey(ench.getName())) + { + return 0; + } + if (!_protectionCauses.containsKey(ench.getName())) + { + return 0; + } + + int epf = 0; + + for (ItemStack item : items) + { + if (item == null || item.getType() == Material.AIR) + { + continue; + } + if (!item.containsEnchantment(ench)) + { + continue; + } + if (item.getEnchantmentLevel(ench) <= 0) + { + continue; + } + + epf += (item.getEnchantmentLevel(ench) * _protectionTypeModifiers.get(ench.getName())); + } + + return Math.min(20, epf); + } + + private double getTotalEnchantReduction(ItemStack[] armor, DamageCause cause) + { + int epf = 0; + + for (Enchantment ench : Enchantment.values()) + { + if (!_protectionTypeModifiers.containsKey(ench.getName())) + { + continue; + } + if (!_protectionCauses.containsKey(ench.getName())) + { + continue; + } + if (!Arrays.asList(_protectionCauses.get(ench.getName())).contains(cause)) + { + continue; + } + + epf += getTotalEPF(ench, armor); + } + + epf = Math.max(0, Math.min(20, epf)); + return new BigDecimal(1).subtract(new BigDecimal(epf).divide(new BigDecimal(25))).doubleValue(); } @EventHandler(priority = EventPriority.HIGHEST) @@ -129,24 +231,42 @@ public class DamageManager extends MiniPlugin @EventHandler public void onEntityCombust(EntityCombustByEntityEvent event) { + if (!_enabled) + return; + if (!(event.getCombuster() instanceof Player || event.getCombuster() instanceof Arrow)) return; event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) - public void removeDemArrowsCrazyMan(EntityDamageEvent event) + /** + * Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled. + */ + @EventHandler(priority = EventPriority.MONITOR) + public void removeArrows(EntityDamageEvent event) { - if (event.isCancelled()) - { - Projectile projectile = GetProjectile(event); + Projectile projectile = GetProjectile(event); - if (projectile instanceof Arrow) - { - projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0)); - projectile.remove(); - } + if (projectile instanceof Arrow) + { + projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0)); + projectile.remove(); + } + } + + /** + * Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled. + */ + @EventHandler(priority = EventPriority.MONITOR) + public void removeArrows(CustomDamageEvent event) + { + Projectile projectile = event.GetProjectile(); + + if (projectile instanceof Arrow) + { + projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0)); + projectile.remove(); } } /* @@ -213,6 +333,12 @@ public class DamageManager extends MiniPlugin event.SetCancelled("0 Health"); return; } + + if (event.GetProjectile() != null && event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) && !event.getProjectileDamageSelf()) + { + event.SetCancelled("Self Projectile Damage"); + return; + } if (event.GetDamageePlayer() != null) { @@ -273,35 +399,13 @@ public class DamageManager extends MiniPlugin Player damagee = event.GetDamageePlayer(); if (damagee != null) { - for (ItemStack stack : damagee.getInventory().getArmorContents()) + if (event.GetDamage() <= 0) { - if (stack == null) - continue; - - Map enchants = stack.getEnchantments(); - for (Enchantment e : enchants.keySet()) - { - if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL)) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_FIRE) && - event.GetCause() == DamageCause.FIRE && - event.GetCause() == DamageCause.FIRE_TICK && - event.GetCause() == DamageCause.LAVA) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_FALL) && - event.GetCause() == DamageCause.FALL) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) && - event.GetCause() == DamageCause.ENTITY_EXPLOSION) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_PROJECTILE) && - event.GetCause() == DamageCause.PROJECTILE) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); - } + return; + } + if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0) + { + event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false); } } @@ -324,8 +428,15 @@ public class DamageManager extends MiniPlugin else if (e.equals(Enchantment.FIRE_ASPECT)) if (_conditionManager != null) + { + double reduce = 0; + if (damagee != null) + { + reduce = (15 * getHighestLevel(Enchantment.PROTECTION_FIRE, damagee.getInventory().getArmorContents())) * (4 * (double)enchants.get(e)); + } _conditionManager.Factory().Ignite("Ench Fire", event.GetDamageeEntity(), damager, - 4 * (double)enchants.get(e), false, false); + (4 * (double)enchants.get(e)) - reduce, false, false); + } } } @@ -349,6 +460,8 @@ public class DamageManager extends MiniPlugin Player player = event.GetDamagerPlayer(true); if (player != null) { + if (player.equals(event.GetDamageeEntity()) && !event.getProjectileDamageSelf()) return; + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f); } } @@ -373,6 +486,11 @@ public class DamageManager extends MiniPlugin if (event.GetDamageeEntity().getHealth() <= 0) return; + if (event.GetProjectile() != null && + event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) && + !event.getProjectileDamageSelf()) + return; + //Player Conditions if (event.GetDamageePlayer() != null) { @@ -427,14 +545,21 @@ public class DamageManager extends MiniPlugin origin = event.GetDamagerEntity(true).getLocation(); if (event.getKnockbackOrigin() != null) origin = event.getKnockbackOrigin(); - else if (event.GetProjectile() != null) - origin = event.GetProjectile().getLocation(); //Vec Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation()); trajectory.multiply(0.6 * knockback); trajectory.setY(Math.abs(trajectory.getY())); - + + //Special handling for projectiles + if(event.GetProjectile() != null && event.getKnockbackOrigin() == null) + { + trajectory = event.GetProjectile().getVelocity(); + trajectory.setY(0); + trajectory.multiply(0.6 * knockback / trajectory.length()); + trajectory.setY(0.5); + } + //Apply double vel = 0.2 + trajectory.length() * 0.8; diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index cbf80c7b1..d2fbc5f38 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; } @@ -384,6 +389,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/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 5a58758c7..282933d23 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -7,6 +7,7 @@ import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; +import mineplex.core.common.Rank; import mineplex.core.creature.Creature; import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; @@ -48,7 +49,7 @@ public class StaffServer extends JavaPlugin //Static Modules CommandCenter.Initialize(this); - CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); + CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER); CommandCenter.Instance.setClientManager(clientManager); Recharge.Initialize(this); @@ -83,15 +84,15 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("57791647-93b1-4980-8835-7fddadd20eb8"), "xTheOnlyOreOx")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); - ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); new ProfileCacheManager(this); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 33570939f..c91f53c0e 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; @@ -55,9 +57,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable @EventHandler public void Join(PlayerJoinEvent event) { - if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) + if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.SUPPORT)) { - event.getPlayer().kickPlayer("Only for staff."); + event.getPlayer().kickPlayer("Only for support staff."); return; } @@ -117,7 +119,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cDGreen + C.Strike + "============================================="); caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName); caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name))); - caller.sendMessage(C.cBlue + "Coins: " + C.cYellow + donor.getCoins()); + caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getCoins()); caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems()); int enjinCoinsReceived = 0; @@ -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,14 +220,27 @@ 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 - caller.sendMessage(C.cBlue + "Enjin Coin Total Received: " + C.cYellow + enjinCoinsReceived); + caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived); caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived); 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..67dea4d96 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)); @@ -93,7 +94,7 @@ public class SalesPackageManager extends MiniPlugin public void displaySalesPackages(Player caller, String playerName) { - JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue"); + JsonMessage coinBuilder = new JsonMessage("Shards : ").color("blue"); JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue"); JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue"); @@ -103,7 +104,7 @@ public class SalesPackageManager extends MiniPlugin { coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } - else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest) + else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java index 02dd85695..3ced1fbc3 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java @@ -17,7 +17,7 @@ public class CoinCommand extends CommandBase { public CoinCommand(SalesPackageManager plugin) { - super(plugin, Rank.MODERATOR, "coin"); + super(plugin, Rank.MODERATOR, "coin", "shard", "shards"); } @Override @@ -43,11 +43,11 @@ public class CoinCommand extends CommandBase { if (completed) { - caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " shards to " + playerName + "'s account!")); } else { - UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Coins") + " to " + F.name(playerName) + ".")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Shards") + " to " + F.name(playerName) + ".")); } } }, caller.getName(), playerName, client.getAccountId(), amount); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java index 1091a16fd..51c79115d 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java @@ -10,13 +10,13 @@ public class Coins extends SalesPackageBase public Coins(SalesPackageManager manager, int amount) { - super(manager, amount + " Coins"); + super(manager, amount + " Shards"); _amount = amount; } public void displayToAgent(Player agent, String playerName) { - addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Coins."); + addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Shards."); agent.sendMessage(" "); addBackButton(agent, playerName); } 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/pom.xml b/Plugins/Nautilus.Game.Arcade/pom.xml index 6c69780d2..f23ada168 100644 --- a/Plugins/Nautilus.Game.Arcade/pom.xml +++ b/Plugins/Nautilus.Game.Arcade/pom.xml @@ -19,5 +19,9 @@ mineplex-minecraft-game-classcombat ${project.version} + + fr.neatmonster + nocheatplus + 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..75aea7dfa 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,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation private BonusManager _bonusManager; private KitProgressionManager _kitProgressionManager; private ProgressingKitManager _progressionKitManager; + private BoosterManager _boosterManager; + private GameSpectatorManager _spectatorManager; private IncognitoManager _incognitoManager; @@ -192,11 +200,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 +225,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,9 +288,10 @@ 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); + _spectatorManager = new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); new MiscManager(this); _hologramManager = hologramManager; @@ -290,6 +301,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 +1015,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 +1437,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)) @@ -1689,4 +1706,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation { return _kitProgressionManager; } + + public GameSpectatorManager getGameSpectatorManager() + { + return _spectatorManager; + } } 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 f42b6170c..4d0e94361 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -252,7 +252,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) @@ -364,8 +364,12 @@ 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(); } @@ -390,6 +394,11 @@ public enum GameType { return getGameMode(game).getType(); } + + public boolean isUsingGameModesMaps() + { + return _gameMaps; + } public boolean hasGamemodes() { 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 6e48814bf..b596c47d9 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,8 @@ 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.game.modules.Module; +import nautilus.game.arcade.kit.*; import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.scoreboard.GameScoreboard; @@ -314,8 +312,6 @@ public abstract class Game implements Listener public boolean AllowEntitySpectate = true; - public boolean PlayerTeamSelection = false; - public boolean TeamMode = false; public boolean TeamPerSpawn = false; @@ -335,6 +331,8 @@ public abstract class Game implements Listener private NautHashMap _teamReqs = new NautHashMap(); public WinEffectManager WinEffectManager = new WinEffectManager(); + private Map, Module> _modules = new HashMap<>(); + public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) { Manager = manager; @@ -421,6 +419,20 @@ public abstract class Game implements Listener System.out.println("Loading " + GetName() + "..."); } + public void registerModule(Module module) + { + if (!_modules.containsKey(module.getClass())) + { + module.initialize(this); + _modules.put(module.getClass(), module); + UtilServer.RegisterEvents(module); + } + else + { + throw new IllegalStateException("Module " + module.getClass() + " is already registered"); + } + } + public void setKits(Kit[] kits) { _kits = kits; @@ -462,7 +474,7 @@ public abstract class Game implements Listener } } - if (GetType().isUsingGameModes()) + if (GetType().isUsingGameModesMaps()) { GameType mode = GetType().getModeGameType(getClass()); @@ -892,7 +904,7 @@ public abstract class Game implements Listener { kit.ApplyKit(player); } - else + else if (!(kit instanceof ChampionsKit)) { player.closeInventory(); } @@ -925,7 +937,7 @@ public abstract class Game implements Listener if (GetKit(player) == null) return false; - return GetKit(player).equals(kit); + return GetKit(player).GetName().equals(kit.GetName()); } public boolean SetPlayerState(Player player, PlayerState state) @@ -1905,157 +1917,6 @@ public abstract class Game implements Listener } } - @EventHandler(priority = EventPriority.HIGH) - public void teamSelectInteract(PlayerInteractEntityEvent event) - { - if (!PlayerTeamSelection) - return; - - if (GetState() != GameState.Recruit) - return; - - if (event.getRightClicked() == null) - return; - - if (!(event.getRightClicked() instanceof Player)) - return; - - Player player = event.getPlayer(); - - //Observer - if (Manager.IsObserver(player)) - { - UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); - return; - } - - selectTeamMate(player, (Player) event.getRightClicked()); - } - - @EventHandler - public void teamSelectCommand(PlayerCommandPreprocessEvent event) - { - if (!PlayerTeamSelection) - return; - - 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); - } - - public void selectTeamMate(Player player, Player ally) - { - //Accept Invite - if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player)) - { - //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; - - //Join Team - SetPlayerTeam(player, team, true); - SetPlayerTeam(ally, team, true); - } - //Send Invite - else - { - //Already on Team with Target - 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 (!PlayerTeamSelection) - return; - - if (GetState() != GameState.Recruit) - return; - - Player player = event.getPlayer(); - - if (GetTeam(player) != null) - GetTeam(player).DisbandTeam(); - - Iterator teamIter = _teamReqs.keySet().iterator(); - while (teamIter.hasNext()) - { - Player sender = teamIter.next(); - if (sender.equals(player) || _teamReqs.get(sender).equals(player)) - teamIter.remove(); - } - } - - public GameTeam getEmptyTeam() - { - for (GameTeam team : GetTeamList()) - { - if (team.GetPlayers(false).isEmpty()) - return team; - } - - return null; - } - @EventHandler public void CustomTeamGeneration(GameStateChangeEvent event) { @@ -2279,4 +2140,17 @@ public abstract class Game implements Listener { } + public void cleanupModules() + { + for (Module module : this._modules.values()) + { + module.cleanup(); + HandlerList.unregisterAll(module); + } + } + + public T getModule(Class clazz) + { + return clazz.cast(_modules.get(clazz)); + } } 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/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 256771fdb..701dfe0cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -24,6 +24,7 @@ import org.bukkit.Location; import org.bukkit.entity.Creature; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Team; public class GameTeam { @@ -192,7 +193,11 @@ public class GameTeam { for(Player other : UtilServer.getPlayers()) { - other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player); + Team team = other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()); + if (team != null) + { + team.removePlayer(player); + } other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player); } UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded.")); @@ -268,11 +273,18 @@ public class GameTeam return GetColor() + "§l" + GetName(); } - public void SpawnTeleport(Player player) - { + public Location SpawnTeleport(Player player) + { + Location l = GetSpawn(); + player.teleport(l); + return l; + } + + public void SpawnTeleport(Player player, Location location) + { player.leaveVehicle(); player.eject(); - player.teleport(GetSpawn()); + player.teleport(location); } public void SpawnTeleport() 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 3f356ea96..7fcf95f0e 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); _starterItems = new HashMap<>(); @@ -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/build/modes/TeamBuild.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java index e2abb1537..0fb700e65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import nautilus.game.arcade.game.modules.TeamModule; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; @@ -40,7 +41,9 @@ public class TeamBuild extends Build super(manager, GameType.Brawl); TeamMode = true; - PlayerTeamSelection = true; + + registerModule(new TeamModule()); + TeamPerSpawn = true; FillTeamsInOrderToCount = 2; 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/GunModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java index a52237f21..a809959f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.minestrike; import java.lang.reflect.Field; -import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -32,7 +31,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.ProjectileHitEvent; @@ -72,7 +70,6 @@ import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin; -import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; @@ -93,7 +90,6 @@ import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType; import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor; import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade; import nautilus.game.arcade.game.games.minestrike.items.guns.Gun; -import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats; import nautilus.game.arcade.game.games.minestrike.items.guns.GunType; import net.minecraft.server.v1_8_R3.EntityArrow; 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 7fa92ed36..fb42cbfdb 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 @@ -258,7 +258,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); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java index 12a7dcd36..f7cce0ca3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java @@ -52,7 +52,13 @@ public class HighExplosive extends Grenade continue; // Damage Event - game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(), + Player damager = null; + if (game.IsAlive(_thrower)) + { + damager = _thrower; + } + + game.Manager.GetDamage().NewDamageEvent(player, damager, null, ent.getLocation(), DamageCause.CUSTOM, 1 + (players.get(player) * 18), true, true, false, _thrower.getName(), getName()); 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 77228c28c..550d4df3f 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 @@ -466,7 +466,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/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index d52c5039b..dc3538511 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -48,6 +48,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.scoreboard.Team; public class MonsterMaze extends SoloGame @@ -60,6 +62,9 @@ public class MonsterMaze extends SoloGame private Location _center; private HashMap _launched = new HashMap(); + + private static final int JUMP_POTION_AMPLIFIER = -10; + private int _potionMult = JUMP_POTION_AMPLIFIER; @SuppressWarnings("unchecked") public MonsterMaze(ArcadeManager manager) @@ -260,6 +265,36 @@ public class MonsterMaze extends SoloGame } } + @EventHandler + public void onDebug(PlayerCommandPreprocessEvent event) + { + if (!event.getPlayer().isOp()) + return; + + if (event.getMessage().toLowerCase().contains("/setmult ")) + { + event.setCancelled(true); + Integer mult = Integer.parseInt(event.getMessage().toLowerCase().replace("/setmult ", "")); + _potionMult = mult; + + for (Player pl : GetPlayers(true)) + { + Manager.GetCondition().Clean(pl); + } + } + } + + @EventHandler + public void onBreakJumper(InventoryClickEvent event) + { + if (!InProgress()) + return; + if (!IsAlive(event.getWhoClicked())) + return; + + event.setCancelled(true); + } + @EventHandler public void PotionEffects(UpdateEvent event) { @@ -276,7 +311,7 @@ public class MonsterMaze extends SoloGame else { if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null)) - Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false); + Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, _potionMult, true, false, false); } // if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java index 22c4d31a7..32841361a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java @@ -42,7 +42,7 @@ public class KitJumper extends ProgressingKit @Override public void GiveItems(Player player) { - player.getInventory().setItem(4, PLAYER_ITEMS[4]); - player.getInventory().setItem(8, PLAYER_ITEMS[8]); + player.getInventory().setItem(4, PLAYER_ITEMS[0]); + player.getInventory().setItem(8, PLAYER_ITEMS[1]); } } 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/quiver/kits/KitEnchanter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java index fcfce7584..1b38cfa92 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java @@ -4,6 +4,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; @@ -11,6 +12,7 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkArrowRebound; + import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -31,7 +33,7 @@ public class KitEnchanter extends ProgressingKit private static final ItemStack IN_HAND = new ItemStack(Material.BOW); private static final ItemStack[] PLAYER_ITEMS = { - ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), + new ItemBuilder(Material.STONE_SWORD).setGlow(true).build(), ItemStackFactory.Instance.CreateStack(Material.BOW) }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java index c67f789fa..f12ed6a8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java @@ -31,7 +31,7 @@ public class KitLeaper extends ProgressingKit private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD); private static final ItemStack[] PLAYER_ITEMS = { - ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), ItemStackFactory.Instance.CreateStack(Material.BOW) }; 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 76c3fd91c..22bdc6d79 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 @@ -679,8 +679,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/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index ba2949dd2..2b470ce33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -19,6 +19,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker; import nautilus.game.arcade.stats.SkywarsTNTStatTracker; @@ -78,10 +79,11 @@ public class TeamSkywars extends Skywars DamageTeamSelf = false; DontAllowOverfill = true; - - PlayerTeamSelection = true; + TeamMode = true; TeamPerSpawn = true; + + registerModule(new TeamModule()); } @Override 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/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 3757bf8ee..3fb05c19c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -15,6 +15,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.FreeKitWinStatTracker; import nautilus.game.arcade.stats.KillFastStatTracker; @@ -55,7 +56,8 @@ public class TeamSuperSmash extends SuperSmash DontAllowOverfill = true; TeamMode = true; - PlayerTeamSelection = true; + + registerModule(new TeamModule()); registerStatTrackers( new WinWithoutDyingStatTracker(this, "MLGPro"), 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/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index da4406b2c..0c02a2c71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -55,7 +55,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.ArmorStand; @@ -1541,6 +1540,13 @@ public class SpeedBuilders extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } + else + { + if (liquid.getType() == Material.STATIONARY_WATER || liquid.getType() == Material.WATER) + { + event.setCancelled(true); + } + } } @EventHandler @@ -1694,6 +1700,39 @@ public class SpeedBuilders extends SoloGame UtilAction.velocity(event.getPlayer(), new Vector(0, 1, 0)); } + + @EventHandler + public void fixDoorToggling(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuildersState.BUILDING) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (_perfectBuild.containsKey(event.getPlayer())) + { + event.setCancelled(true); + return; + } + + if (event.getPlayer().getItemInHand() == null) + { + event.setCancelled(true); + return; + } + + Block block = event.getClickedBlock().getRelative(event.getBlockFace()); + + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); + } + } @Override public void EndCheck() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 268434338..2bf2488c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -324,6 +324,12 @@ public class RecreationData score++; } + //Fix for glowing redstone ore + if ((expectedState.getType() == Material.REDSTONE_ORE && currentBlock.getType() == Material.GLOWING_REDSTONE_ORE) || (expectedState.getType() == Material.GLOWING_REDSTONE_ORE && currentBlock.getType() == Material.REDSTONE_ORE)) + { + score++; + } + //Fix for corner stair shape if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) { 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 9283c81a4..d357ced98 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; @@ -243,7 +244,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(); @@ -1925,7 +1926,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); } } @@ -1934,11 +1935,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/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 286426457..99d49393b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -17,6 +17,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker; @@ -59,7 +60,8 @@ public class TeamSurvivalGames extends SurvivalGames DontAllowOverfill = true; TeamMode = true; - PlayerTeamSelection = true; + + registerModule(new TeamModule()); registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"), 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 d46f2f7f6..e4af92f98 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,17 +1,15 @@ 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 com.mineplex.spigot.ChunkPreLoadEvent; +import fr.neatmonster.nocheatplus.checks.CheckType; +import fr.neatmonster.nocheatplus.checks.access.IViolationInfo; +import fr.neatmonster.nocheatplus.hooks.NCPHook; +import fr.neatmonster.nocheatplus.hooks.NCPHookManager; +import mineplex.core.account.CoreClient; +import mineplex.core.boosters.event.BoosterItemGiveEvent; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -30,52 +28,46 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatLog; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import mineplex.serverdata.Utility; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GamePrepareCountdownCommence; import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.uhc.helpers.ChunkLoadingThread; +import nautilus.game.arcade.game.games.uhc.helpers.WorldGenThread; +import nautilus.game.arcade.game.modules.TeamModule; 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.Chunk; +import net.minecraft.server.v1_8_R3.MathHelper; 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 net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Chunk; import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.WorldBorder; import org.bukkit.World.Environment; +import org.bukkit.WorldBorder; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; 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.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.Ghast; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; 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.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -84,13 +76,12 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPortalEvent; @@ -107,36 +98,48 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; -import org.spigotmc.WatchdogThread; +import org.spigotmc.ActivationRange; -public class UHC extends TeamGame +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; + +public class UHC extends TeamGame implements NCPHook { - private NautHashMap _teamReqs = new NautHashMap(); + // The view distance of UHC. The amount of time and ram needed grows polynomially + public static final int VIEW_DISTANCE = 5; - private NautHashMap _deathTime = new NautHashMap(); - // private NautHashMap _combatTime = new NautHashMap(); + // The number of threads to use for reading chunks from disk + public static final int THREADS_FOR_CHUNK_LOADING = 4; - private volatile boolean _mapLoaded = false; - private volatile double _mapLoadPercent = 0; - private volatile int _chunksPerTick = 1; - private volatile boolean stopGen = false; + // The number of minutes after which PVP should be enabled + public static final int SAFE_TIME_IN_MINUTES = 11; - private int _chunkTotal; - private int _chunkX = 0; - private int _chunkZ = 0; - private int _chunksLoaded = 0; + // The thread responsible for generating the world + private final WorldGenThread _worldGenThread = new WorldGenThread(this); - private int _gameMinutes = 0; - private int _safeTime = 11; - private long _lastMinute = System.currentTimeMillis(); + // The thread responsible for loading and decorating the world + private final ChunkLoadingThread _chunkLoadingThread = new ChunkLoadingThread(this); - private Objective _scoreObj; + // The number of minutes passed in this game + private int _minutesSinceStart = 0; - private long _createTime; - private long _serverTime; + // The Objective representing the tab list health display + private Objective _healthObjective; + // The number of players which have been teleported + private int _teleportedPlayers = -1; + // The total number of players to teleport + private int _totalPlayers = 0; + // Whether players are teleporting currently + private volatile boolean _isTeleporting = false; - private boolean xrayDebug = false; + private boolean xrayDebug; // Border private int _secondsSinceStart; @@ -157,7 +160,7 @@ public class UHC extends TeamGame DamageDealt ); } - + public UHC(ArcadeManager manager, GameType type) { super(manager, type, @@ -213,8 +216,6 @@ public class UHC extends TeamGame this.WorldBoundaryKill = false; - this.TickPerTeleport = 3; - this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; @@ -227,6 +228,8 @@ public class UHC extends TeamGame WorldTimeSet = -1; + this.WorldLeavesDecay = true; + CraftRecipes(); // Disable Custom Mob Drops (and EXP Disable) @@ -238,11 +241,12 @@ public class UHC extends TeamGame // Damage Settings Manager.GetDamage().SetEnabled(false); - _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Health", "health"); - _scoreObj.setDisplaySlot(DisplaySlot.PLAYER_LIST); + _healthObjective = Scoreboard.GetScoreboard().registerNewObjective("Health", "health"); + _healthObjective.setDisplaySlot(DisplaySlot.PLAYER_LIST); - _createTime = System.currentTimeMillis(); - _serverTime = Utility.currentTimeMillis(); + NCPHookManager.addHook(CheckType.ALL, this); + + registerModule(new TeamModule()); } @Override @@ -250,10 +254,6 @@ public class UHC extends TeamGame { WorldData.World.setDifficulty(Difficulty.HARD); - _chunkX = (int) -(_currentBorder / 16); - _chunkZ = (int) -(_currentBorder / 16); - _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); - WorldData.MinX = -1000; WorldData.MinZ = -1000; WorldData.MaxX = 1000; @@ -274,23 +274,6 @@ public class UHC extends TeamGame border.setWarningTime(-99); } - @EventHandler - public void onDamage(CustomDamageEvent event) - { - if (!IsLive()) - return; - - if (UtilTime.elapsed(getGameLiveTime(), 20000)) - return; - - if (!(event.GetDamageeEntity() instanceof Player)) - return; - - event.SetCancelled("Spawn Invincibility"); - event.GetDamageeEntity().setFireTicks(0); - - } - @EventHandler public void onSecond(UpdateEvent event) { @@ -479,6 +462,28 @@ public class UHC extends TeamGame } TimingManager.stop("UHC Spawn Generation"); + + Location spawn = GetRandomSpawn(WorldData.World.getSpawnLocation()); + WorldData.World.setSpawnLocation(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()); + + WorldServer worldServer = ((CraftWorld) WorldData.World).getHandle(); + + // Update view distance + worldServer.spigotConfig.viewDistance = VIEW_DISTANCE; + worldServer.getPlayerChunkMap().a(VIEW_DISTANCE); + + if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 1536) + { + Announce(C.cGreen + C.Bold + "Skipping spawn pregeneration", false); + // Allow game to start + _chunkLoadingThread.flagDone(); + return; + } + + // Ensures the server does not tick us + worldServer.getMinecraftServer().worlds.remove(worldServer); + + _chunkLoadingThread.start(); } @EventHandler @@ -494,20 +499,16 @@ public class UHC extends TeamGame if (!IsLive()) return; - if (event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.MIN_01) return; - if (!UtilTime.elapsed(_lastMinute, 60000)) - return; + _minutesSinceStart++; - _gameMinutes++; - _lastMinute = System.currentTimeMillis(); - - if (_gameMinutes < _safeTime) + if (_minutesSinceStart < SAFE_TIME_IN_MINUTES) { - UtilTextMiddle.display(null, "PvP enabled in " + (_safeTime - _gameMinutes) + " minutes.", 5, 80, 5); + UtilTextMiddle.display(null, "PvP enabled in " + (SAFE_TIME_IN_MINUTES - _minutesSinceStart) + " minutes.", 5, 80, 5); } - else if (_gameMinutes == _safeTime) + else if (_minutesSinceStart == SAFE_TIME_IN_MINUTES) { UtilTextMiddle.display(null, "PvP has been enabled!", 5, 80, 5); @@ -572,7 +573,14 @@ public class UHC extends TeamGame { if (event.GetState() == GameState.Dead) { - stopGen = true; + _worldGenThread.flagStop(); + _chunkLoadingThread.flagStop(); + if (!_chunkLoadingThread.isDone()) + { + MinecraftServer.getServer().worlds.add(((CraftWorld) WorldData.World).getHandle()); + } + HandlerList.unregisterAll(_chunkLoadingThread); + NCPHookManager.removeHook(this); return; } @@ -581,168 +589,236 @@ public class UHC extends TeamGame return; } - new Thread(() -> + _worldGenThread.start(); + } + + @EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = false) + public void on(ChunkUnloadEvent event) + { + if (IsLive()) { - try + event.setCancelled(false); + } + else + { + event.setCancelled(true); + } + } + + @EventHandler + public void on(ChunkPreLoadEvent event) + { + if (_isTeleporting) + { + System.out.println("WARNING: TRIED TO LOAD CHUNK WHILE TELEPORTING: " + event.getX() + " " + event.getZ()); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void on(PlayerKickEvent event) + { + // Don't kick players while teleporting. Probably NCP trying to kick for fly or something + if (_isTeleporting) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PlayerPrepare(GameStateChangeEvent event) + { + final Game game = event.GetGame(); + + if (event.GetState() != GameState.Prepare) + return; + + + Manager.GetChat().Silence(1000 * 120, false); + + _isTeleporting = true; + + List players = game.GetPlayers(true); + + Location zero = WorldData.World.getSpawnLocation(); + + for (Player player : players) + { + player.teleport(zero); + player.hidePlayer(player); + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); + } + + Announce(C.cGreen + C.Bold + "Please wait, you will be teleported soon", false); + + _totalPlayers = players.size(); + + Map teleportedLocations = new HashMap<>(); + + AtomicInteger id = new AtomicInteger(); + id.set(UtilServer.getServer().getScheduler().runTaskTimer(Manager.getPlugin(), () -> + { + _teleportedPlayers++; + if (_teleportedPlayers >= players.size()) { - Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); - fileIOThreadB.setAccessible(true); - - // 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) + Announce(C.cGreen + C.Bold + "The game will start in 5 seconds", false); + Manager.runSyncLater(() -> { - 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) + try { - x >>= 4; - z >>= 4; - long var3 = hash(x, z); - BiomeCache.BiomeCacheBlock var5 = this._blockByCoord.get(var3); - if (var5 == null) + for (Player player : players) { - var5 = new BiomeCache.BiomeCacheBlock(x, z); - synchronized (_lock) + GameTeam team = game.GetTeam(player); + if (team != null) { - 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) + if (teleportedLocations.get(player.getUniqueId()) != null) { - 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)); - } + team.SpawnTeleport(player, teleportedLocations.get(player.getUniqueId())); } } + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); } - } - private long hash(int x, int z) + teleportedLocations.clear(); + } + finally { - return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; + game.AnnounceGame(); + game.StartPrepareCountdown(); + + //Event + GamePrepareCountdownCommence gamePrepareCountdownCommence = new GamePrepareCountdownCommence(game); + UtilServer.getServer().getPluginManager().callEvent(gamePrepareCountdownCommence); + + _isTeleporting = false; + + Manager.runSyncLater(() -> + { + for (Player player : players) + { + player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); + player.removePotionEffect(PotionEffectType.REGENERATION); + } + + WorldData.World.setAutoSave(true); + + int x = 0; + for (org.bukkit.Chunk chunk : WorldData.World.getLoadedChunks()) + { + if (WorldData.World.unloadChunkRequest(chunk.getX(), chunk.getZ())) + { + System.out.println("Requesting unload of chunk #" + (++x) + " " + chunk.getX() + " " + chunk.getZ()); + } + } + }, 10 * 20L); } - }); - - 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); + }, 5 * 20L); + Bukkit.getServer().getScheduler().cancelTask(id.get()); + return; } - catch (Throwable t) + + Player player = players.get(_teleportedPlayers); + GameTeam team = game.GetTeam(player); + + // This could happen if the player left (and rejoined) while teleporting + // Team maps based on player as a key + if (team != null) { - // todo proper exception handling - // maybe force shutdown? - t.printStackTrace(); + // Save where they teleported + teleportedLocations.put(player.getUniqueId(), team.SpawnTeleport(player)); + + // Update scoreboard + _healthObjective.getScore(player).setScore((int) player.getMaxHealth()); + + game.addPlayerInTime(player); + + Manager.Clear(player); + UtilInv.Clear(player); + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); + + + game.ValidateKit(player, game.GetTeam(player)); + + if (game.GetKit(player) != null) + game.GetKit(player).ApplyKit(player); + + //Event + PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); + UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); } - }, "WorldGen Thread").start(); + }, 5 * 20L, 5L).getTaskId()); + + //Spectators Move + for (Player player : UtilServer.getPlayers()) + { + if (Manager.GetGame().IsAlive(player)) + continue; + + Manager.addSpectator(player, true); + } + } + + @Override + public Location GetSpectatorLocation() + { + if (SpectatorSpawn != null) + { + return SpectatorSpawn; + } + + SpectatorSpawn = WorldData.World.getSpawnLocation(); + + // Move Up - Out Of Blocks + while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) + || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + } + + int Up = 0; + + // Move Up - Through Air + for (int i = 0; i < 15; i++) + { + if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + Up++; + } + else + { + break; + } + } + + // Move Down - Out Of Blocks + while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) + || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.subtract(0, 1, 0); + Up--; + } + + SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5); + + while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0) + SpectatorSpawn.add(0, 1, 0); + + return SpectatorSpawn; } @EventHandler @@ -758,10 +834,14 @@ public class UHC extends TeamGame public Location GetRandomSpawn(Location around) { + // Sometimes getting a random spawn at 0,0 hangs forever + int tries = 0; + Location loc = null; while (loc == null) { + tries++; Block block = null; // Get Team Location @@ -776,8 +856,8 @@ public class UHC extends TeamGame // Get Radius Location else { - block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 4 + UtilMath.r(8), around.getBlockZ() - 4 - + UtilMath.r(8), null); + block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 4 + UtilMath.r(tries < 10 ? 8 : 30), around.getBlockZ() - 4 + + UtilMath.r(tries < 10 ? 8 : 30), null); } // Check Validity @@ -786,6 +866,9 @@ public class UHC extends TeamGame if (block.getRelative(BlockFace.DOWN).isLiquid()) continue; + if (!block.getRelative(BlockFace.DOWN).getType().isSolid()) + continue; + // Suffocated if (block.getType() != Material.AIR || block.getRelative(BlockFace.UP).getType() != Material.AIR) continue; @@ -865,9 +948,6 @@ public class UHC extends TeamGame long timeAlive = System.currentTimeMillis() - GetStateTime(); AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false); } - - // Time - _deathTime.put(player.getName(), System.currentTimeMillis()); } @EventHandler(priority = EventPriority.HIGH) @@ -906,21 +986,21 @@ public class UHC extends TeamGame } @EventHandler - public void PlayerDeathTimeKick(UpdateEvent event) + public void on(EntityTargetLivingEntityEvent event) { - if (event.getType() != UpdateType.SEC) - return; - - for (Player player : UtilServer.getPlayers()) + if (event.getEntity() instanceof ExperienceOrb) { - if (!_deathTime.containsKey(player.getName())) - continue; + if (event.getTarget() instanceof Player) + { + Player player = (Player) event.getTarget(); - if (!UtilTime.elapsed(_deathTime.get(player.getName()), 20000)) - continue; + Game game = Manager.GetGame(); - _deathTime.remove(player.getName()); - // XXX Need this ? Manager.GetPortal().SendPlayerToServer(player, "Lobby"); + if (game == null || !game.IsAlive(player) || game.GetState() != GameState.Live) + { + event.setCancelled(true); + } + } } } @@ -1136,6 +1216,21 @@ public class UHC extends TeamGame event.setCancelled(true); } + @EventHandler + public void on(InventoryClickEvent event) + { + Player clicker = (Player) event.getWhoClicked(); + if (!IsAlive(clicker)) + event.setCancelled(true); + } + + @EventHandler + public void on(BoosterItemGiveEvent event) + { + if (IsAlive(event.getPlayer())) + event.setCancelled(true); + } + @EventHandler(priority = EventPriority.LOWEST) public void clearCreeperExplode(EntityExplodeEvent event) { @@ -1202,7 +1297,11 @@ public class UHC extends TeamGame { for (Player player : teamsAlive.get(0).GetPlayers(false)) { - int gems = Math.round((System.currentTimeMillis() - getPlayerIngameTime(player))/1000); + long ingameTime = getPlayerIngameTime(player); + if (ingameTime == 0) + ingameTime = GetStateTime(); + + int gems = Math.round((System.currentTimeMillis() - ingameTime) / 1000); AddGems(player, gems, "Winning Team", false, false); } } @@ -1269,8 +1368,18 @@ public class UHC extends TeamGame } Scoreboard.WriteBlank(); - Scoreboard.Write(C.cYellow + C.Bold + "Time"); - Scoreboard.Write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime())); + if (GetState() == GameState.Prepare) + { + Scoreboard.Write(C.cYellow + C.Bold + "Status"); + int players = _teleportedPlayers + 1; + if (players > _totalPlayers) players = _totalPlayers; + Scoreboard.Write("Teleporting Players (" + players + "/" + _totalPlayers + ")"); + } + else + { + Scoreboard.Write(C.cYellow + C.Bold + "Time"); + Scoreboard.Write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime())); + } Scoreboard.WriteBlank(); Scoreboard.Write(C.cYellow + C.Bold + "Borders"); @@ -1281,19 +1390,7 @@ public class UHC extends TeamGame public int GetHealth(Player player) { - int health = (int) player.getHealth(); - - if (player.getHealth() % 1d != 0) - { - health += 1; - } - - return health; - } - - public long getServerTime() - { - return _serverTime + (System.currentTimeMillis() - _createTime); + return (int) Math.ceil(player.getHealth()); } @Override @@ -1424,15 +1521,221 @@ public class UHC extends TeamGame return ChatColor.YELLOW + "In Progress"; } - // Not Loaded (but still joinable) - if (!_mapLoaded) + if (!_worldGenThread.isMapLoaded()) { - return ChatColor.GREEN + "Generating Map (" + C.cWhite + getMapLoadETA() + C.cGreen + ")"; + return ChatColor.GREEN + "Generating Map (" + C.cWhite + _worldGenThread.getProgress() + C.cGreen + ")"; + } + + if (!_chunkLoadingThread.isDone()) + { + return ChatColor.GREEN + "Generating Spawns (" + C.cWhite + _chunkLoadingThread.getProgress() + C.cGreen + ")"; } return ChatColor.GREEN + "Recruiting"; } + public boolean isMapLoaded() + { + return _worldGenThread.isMapLoaded() && _chunkLoadingThread.isDone(); + } + + public String getObjectiveName(boolean _colorTick) + { + if (!_worldGenThread.isMapLoaded()) + { + return _worldGenThread.getProgress() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"; + } + else + { + return _chunkLoadingThread.getProgress() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Spawns"; + } + } + + @Override + public String getHookName() + { + return "UHC Hook"; + } + + @Override + public String getHookVersion() + { + return "0.0.1"; + } + + @Override + public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo iViolationInfo) + { + if (GetState() == GameState.Prepare) + { + return false; + } + return true; + } + + @EventHandler + public void on(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equals("/uhcentities")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + for (Entity entity : event.getPlayer().getNearbyEntities(5.0, 5.0, 5.0)) + { + net.minecraft.server.v1_8_R3.Entity nms = ((CraftEntity) entity).getHandle(); + String debug = "Entity: " + entity.getType() + " id:" + nms.getId() + " inac:" + ActivationRange.checkIfActive(nms); + debug += " at:" + nms.activatedTick + " dac:" + nms.defaultActivationState; + + int x = MathHelper.floor(nms.locX); + int z = MathHelper.floor(nms.locZ); + + net.minecraft.server.v1_8_R3.Chunk chunk = nms.world.getChunkIfLoaded(x >> 4, z >> 4); + debug += " c:" + chunk + " il:" + (chunk != null ? chunk.areNeighborsLoaded(1) : "null"); + event.getPlayer().sendMessage(debug); + } + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcchunk")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftChunk) event.getPlayer().getLocation().getChunk()).getHandle(); + try + { + Field neighbors = chunk.getClass().getDeclaredField("neighbors"); + neighbors.setAccessible(true); + int n = neighbors.getInt(chunk); + + for (int x = -1; x < 2; x++) + { + for (int z = -1; z < 2; z++) + { + if (x == 0 && z == 0) + { + continue; + } + + int mask = 0x1 << (x * 5 + z + 12); + + boolean should = chunk.world.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z) != null; + boolean is = (n & mask) == mask; + if (is && should) + { + event.getPlayer().sendMessage(ChatColor.GREEN + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is a neighbor"); + } + else if (is && !should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is a neighbor but should not be"); + } + else if (!is && should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is not a neighbor but should be"); + } + else if (!is && !should) + { + event.getPlayer().sendMessage(ChatColor.GREEN + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is not a neighbor"); + } + } + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcgc")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + System.gc(); + event.getPlayer().sendMessage("Cleaned up"); + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcallchunks")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + for (Chunk chunk : ((CraftWorld) event.getPlayer().getWorld()).getHandle().chunkProviderServer.chunks.values()) + { + try + { + Field neighbors = chunk.getClass().getDeclaredField("neighbors"); + neighbors.setAccessible(true); + int n = neighbors.getInt(chunk); + + for (int x = -1; x < 2; x++) + { + for (int z = -1; z < 2; z++) + { + if (x == 0 && z == 0) + { + continue; + } + + int mask = 0x1 << (x * 5 + z + 12); + + boolean should = chunk.world.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z) != null; + boolean is = (n & mask) == mask; + if (is && !should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") relative to " + (chunk.locX) + "," + chunk.locZ + " is a neighbor but should not be"); + } + else if (!is && should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") relative to " + (chunk.locX) + "," + chunk.locZ + " is not a neighbor but should be"); + } + } + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + event.getPlayer().sendMessage("Done"); + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcworlds")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + MinecraftServer minecraftServer = MinecraftServer.getServer(); + + int nms = minecraftServer.worlds.size(); + int bukkit = Bukkit.getWorlds().size(); + + if (nms != bukkit) + { + event.getPlayer().sendMessage(ChatColor.RED + "Bukkit and NMS world counts don't match: " + nms + " vs " + bukkit); + } + + for (org.bukkit.World world : Bukkit.getWorlds()) + { + WorldServer worldServer = ((CraftWorld) world).getHandle(); + event.getPlayer().sendMessage("Bukkit world: " + worldServer.getWorldData().getName() + " loaded chunks: " + worldServer.chunkProviderServer.chunks.size() + " saving: " + worldServer.savingDisabled + " unload queue: " + worldServer.chunkProviderServer.unloadQueue.size()); + } + + for (WorldServer worldServer : minecraftServer.worlds) + { + event.getPlayer().sendMessage("NMS world: " + worldServer.getWorldData().getName() + " loaded chunks: " + worldServer.chunkProviderServer.chunks.size() + " saving: " + worldServer.savingDisabled + " unload queue: " + worldServer.chunkProviderServer.unloadQueue.size()); + } + + event.setCancelled(true); + } + } + } + @EventHandler(priority = EventPriority.MONITOR) public void xrayBlockBreak(BlockBreakEvent event) { @@ -1580,8 +1883,8 @@ public class UHC extends TeamGame if (visible) break; } - - if(visible) + + if (visible) setOreType(vein); // Remove Vein @@ -1605,163 +1908,9 @@ public class UHC extends TeamGame } } } - + public void setOreType(ArrayList blocks) { - - } - public boolean isMapLoaded() - { - return _mapLoaded; - } - - public String getMapLoadPercent() - { - return (int) (_mapLoadPercent * 100) + "%"; - } - - public String getMapLoadETA() - { - int chunksToGo = _chunkTotal - _chunksLoaded; - - 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; - - Player player = event.getPlayer(); - - //Observer - if (Manager.IsObserver(player)) - { - UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); - return; - } - - 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); - } - - public void selectTeamMate(Player player, Player ally) - { - //Accept Invite - if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player)) - { - //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()); - - //Join Team - SetPlayerTeam(player, team, true); - SetPlayerTeam(ally, team, true); - } - //Send Invite - else - { - //Already on Team with Target - 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()) - { - Player sender = teamIter.next(); - if (sender.equals(player) || _teamReqs.get(sender).equals(player)) - teamIter.remove(); - } - } - - public GameTeam getEmptyTeam() - { - for (GameTeam team : GetTeamList()) - { - 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/uhc/helpers/ChunkLoadingThread.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java new file mode 100644 index 000000000..7521c0360 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java @@ -0,0 +1,385 @@ +package nautilus.game.arcade.game.games.uhc.helpers; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.timing.TimingManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.uhc.UHC; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.ChunkRegionLoader; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.WorldServer; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.spigotmc.AsyncCatcher; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import static nautilus.game.arcade.game.games.uhc.UHC.VIEW_DISTANCE; + +public class ChunkLoadingThread extends Thread implements Listener +{ + private Game _game; + + private volatile boolean _isDecorating = false; + private AtomicInteger _actual = new AtomicInteger(); + private AtomicInteger _expected = new AtomicInteger(23000); // Most likely it'll be around 23000 + + private Set _entities = new HashSet<>(); + + public ChunkLoadingThread(Game game) + { + super("Chunk Loader"); + this._game = game; + UtilServer.RegisterEvents(this); + } + + public void run() + { + WorldServer worldServer = ((CraftWorld) _game.WorldData.World).getHandle(); + Location spawn = _game.WorldData.World.getSpawnLocation(); + + Map loaded = new ConcurrentHashMap<>(); + Map compounds = new ConcurrentHashMap<>(); + + try + { + TimingManager.start("UHC Chunk Loading"); + + ChunkProviderServer chunkProviderServer = worldServer.chunkProviderServer; + + Field chunkLoaderField = chunkProviderServer.getClass().getDeclaredField("chunkLoader"); + chunkLoaderField.setAccessible(true); + + ChunkRegionLoader loader = (ChunkRegionLoader) chunkLoaderField.get(chunkProviderServer); + + // Step 1: Read all the required chunks from the disk + // We're going to read all the required chunks from disk async + { + Set coordPairs = new HashSet<>(); + + // Special case for 0, 0 + { + int x = spawn.getBlockX() >> 4; + int z = spawn.getBlockZ() >> 4; + + for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) + { + for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) + { + coordPairs.add(LongHash.toLong(x + dx, z + dz)); + } + } + } + + // All the team spawns + { + for (int i = 0; i < _game.GetTeamList().size(); i++) + { + GameTeam team = _game.GetTeamList().get(i); + for (Location l : team.GetSpawns()) + { + int x = l.getChunk().getX(); + int z = l.getChunk().getZ(); + + for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) + { + for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) + { + coordPairs.add(LongHash.toLong(x + dx, z + dz)); + } + } + } + } + } + + AtomicBoolean lockCompleted = new AtomicBoolean(false); + Object lock = new Object(); + + // Hop back onto the main thread + _game.getArcadeManager().runSync(() -> + { + for (Chunk chunk : new ArrayList<>(chunkProviderServer.chunks.values())) + { + chunk.bukkitChunk.unload(true, false); + } + lockCompleted.set(true); + synchronized(lock) + { + lock.notifyAll(); + } + }); + if (!lockCompleted.get()) + { + synchronized (lock) + { + lock.wait(); + } + } + if (!lockCompleted.get()) + { + throw new IllegalStateException("Lock was not completed"); + } + + + // Sigh... I don't want this to be here but it needs to be set somewhere... + // Multiply by 3 because there are 3 stages + _expected.set(coordPairs.size() * 3); + + // Load them now + ExecutorService chunkLoaders = Executors.newFixedThreadPool(UHC.THREADS_FOR_CHUNK_LOADING); + + for (long coord : coordPairs) + { + chunkLoaders.submit(() -> + { + int x = LongHash.msw(coord); + int z = LongHash.lsw(coord); + try + { + Object[] data = loader.loadChunk(worldServer, x, z); + if (data != null) + { + NBTTagCompound compound = (NBTTagCompound) data[1]; + net.minecraft.server.v1_8_R3.Chunk chunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; + loaded.put(coord, chunk); + compounds.put(coord, compound); + } + else + { + System.out.println("Failed to load chunk " + x + "," + z); + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + finally + { + _actual.getAndIncrement(); + } + }); + } + + chunkLoaders.shutdown(); + + // We've got plenty of time to wait + System.out.println("Finished submitting tasks to executor, waiting..."); + chunkLoaders.awaitTermination(1, TimeUnit.DAYS); + + System.out.println("Loaded: " + loaded.size() + " and coords: " + coordPairs.size()); + coordPairs.clear(); + } + + // Step 2: Recreate structures, update neighbors, load entities + // This step should be super quick so there's no point in scheduling it elsewhere + // Code is plain copypasted from ChunkIOProvider + { + for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) + { + NBTTagCompound compound = compounds.get(LongHash.toLong(chunk.locX, chunk.locZ)); + loader.loadEntities(chunk, compound.getCompound("Level"), worldServer); + chunk.setLastSaved(chunkProviderServer.world.getTime()); + if (chunkProviderServer.chunkProvider != null) + { + chunkProviderServer.chunkProvider.recreateStructures(chunk, chunk.locX, chunk.locZ); + } + + for (int x = -2; x < 3; ++x) + { + for (int z = -2; z < 3; ++z) + { + if (x != 0 || z != 0) + { + net.minecraft.server.v1_8_R3.Chunk neighbor = loaded.get(LongHash.toLong(chunk.locX + x, chunk.locZ + z)); + if (neighbor != null) + { + neighbor.setNeighborLoaded(-x, -z); + chunk.setNeighborLoaded(x, z); + } + } + } + } + _actual.getAndIncrement(); + } + } + + AtomicBoolean lockCompleted = new AtomicBoolean(false); + Object lock = new Object(); + + // Hop back onto the main thread + _game.getArcadeManager().runSync(() -> + { + // We want to add all the chunks to the chunkmap so that the server is not out of sync + for (Map.Entry ent : loaded.entrySet()) + { + ent.getValue().addEntities(); + chunkProviderServer.chunks.put(ent.getKey(), ent.getValue()); + ChunkLoadEvent event = new ChunkLoadEvent(ent.getValue().bukkitChunk, true); + UtilServer.CallEvent(event); + } + lockCompleted.set(true); + synchronized (lock) + { + lock.notifyAll(); + } + }); + + if (!lockCompleted.get()) + { + synchronized (lock) + { + lock.wait(); + } + } + if (!lockCompleted.get()) + { + throw new IllegalStateException("Lock was not completed"); + } + + + // Step 3: Decorate the chunks. This step must be performed async as otherwise the server lags way too hard + // Notes: Do not allow the server to tick the world. If this is allowed EntityTracker will raise CME + // NextTickList will also raise errors + // And worst case the server will crash + { + // Live life on the edge + AsyncCatcher.enabled = false; + _isDecorating = true; + int ct = 0; + for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) + { + chunk.loadNearby(chunkProviderServer, chunkProviderServer, chunk.locX, chunk.locZ); + ct++; + if (ct % 100 == 0) + { + System.out.println(ct); + } + _actual.getAndIncrement(); + } + + TimingManager.stop("UHC Chunk Loading"); + _isDecorating = false; + AsyncCatcher.enabled = true; + + System.out.println("Expected: " + _expected.get() + ", actual: " + _actual.get()); + + _game.getArcadeManager().runSync(() -> + { + + for (Chunk chunk : chunkProviderServer.chunks.values()) + { + // Clear + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + if (x == 0 && z == 0) { + continue; + } + chunk.setNeighborUnloaded(x, z); + } + } + } + + for (Chunk chunk : chunkProviderServer.chunks.values()) + { + // Refresh + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + if (x == 0 && z == 0) { + continue; + } + + Chunk neighbor = chunkProviderServer.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z); + if (neighbor != null) { + neighbor.setNeighborLoaded(-x, -z); + chunk.setNeighborLoaded(x, z); + } + } + } + } + + for (net.minecraft.server.v1_8_R3.Entity entity : _entities) + { + entity.dead = false; + worldServer.addEntity(entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN); + } + + _entities.clear(); + + // You may tick again + worldServer.getMinecraftServer().worlds.add(worldServer); + + // Well, if they're not equal, not much we can do. We've hit the end + _actual.set(_expected.get()); + }); + } + + loaded.clear(); + compounds.clear(); + + UtilServer.Unregister(this); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + @EventHandler + public void on(EntitySpawnEvent event) + { + // Don't allow entity spawns while decorating, period + if (_isDecorating) + { + if (event.getLocation().getWorld().getUID() == _game.WorldData.World.getUID()) + { + _entities.add(((CraftEntity) event.getEntity()).getHandle()); + event.setCancelled(true); + } + } + } + + public void flagDone() + { + _actual.set(_expected.get()); + } + + public boolean isDone() + { + return _actual.get() == _expected.get(); + } + + public int getPercentageComplete() + { + return UtilMath.clamp((int) ((_actual.get() * 1.0 / _expected.get()) * 100), 0, 100); + } + + public String getProgress() + { + return getPercentageComplete() + "%"; + } + + public void flagStop() + { + this.interrupt(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java new file mode 100644 index 000000000..39012869c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java @@ -0,0 +1,239 @@ +package nautilus.game.arcade.game.games.uhc.helpers; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.timing.TimingManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.uhc.UHC; +import net.minecraft.server.v1_8_R3.BiomeCache; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.FileIOThread; +import net.minecraft.server.v1_8_R3.IChunkProvider; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.WorldChunkManager; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +public class WorldGenThread extends Thread +{ + private UHC _game; + + private volatile boolean _mapLoaded = false; + private volatile int _chunksPerTick = 1; + private volatile boolean _stopGen = false; + + private int _chunkTotal; + private int _chunkX = 0; + private int _chunkZ = 0; + private int _chunksLoaded = 0; + + private int _currentBorder = 1000; + + + public WorldGenThread(UHC game) + { + super("WorldGen Thread"); + this._game = game; + + + _chunkX = (int) -(_currentBorder / 16); + _chunkZ = (int) -(_currentBorder / 16); + _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); + } + + public void run() + { + try + { + Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); + fileIOThreadB.setAccessible(true); + + // 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) _game.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) >= 10 * 1000) + { + _game.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++; + + _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"); + + _game.getArcadeManager().runSync(_game::generateSpawns); + } + catch (Throwable t) + { + // todo proper exception handling + // maybe force shutdown? + t.printStackTrace(); + } + } + + public void flagStop() + { + this._stopGen = true; + } + + public String getMapLoadETA() + { + int chunksToGo = _chunkTotal - _chunksLoaded; + + return UtilTime.MakeStr((long) ((double) chunksToGo / (double) (_chunksPerTick * 20) * 1000d), 1); + } + + public boolean isMapLoaded() + { + return this._mapLoaded; + } + + public int getPercentageComplete() + { + return UtilMath.clamp((int) ((_chunksLoaded * 1.0 / _chunkTotal) * 100), 0, 100); + } + + public String getProgress() + { + return getPercentageComplete() + "%"; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index d85536b2a..20e743fc8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -633,7 +633,12 @@ public class WitherGame extends TeamGame implements IBlockRestorer { speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006; } - + + if (speed < 0.01) //This is to stop players having negative speed when they go under the map + { + speed = 0.01; + } + player.setFlySpeed((float) Math.min(1, speed)); // Bump 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/game/modules/Module.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java new file mode 100644 index 000000000..0279e0da6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java @@ -0,0 +1,29 @@ +package nautilus.game.arcade.game.modules; + +import nautilus.game.arcade.game.Game; +import org.bukkit.event.Listener; + +public abstract class Module implements Listener +{ + // The game this module belongs to + private Game _game; + + public void initialize(Game game) + { + if (_game != null) + { + throw new IllegalArgumentException("Attempting to initialize module which has already been initialized for " + _game); + } + this._game = game; + } + + public void cleanup() + { + + } + + public Game getGame() + { + return this._game; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java new file mode 100644 index 000000000..60fb19d7d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java @@ -0,0 +1,164 @@ +package nautilus.game.arcade.game.modules; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import java.util.UUID; + +public class TeamModule extends Module +{ + private BiMap _teamReqs = HashBiMap.create(); + + @EventHandler(priority = EventPriority.HIGH) + public void teamSelectInteract(PlayerInteractEntityEvent event) + { + if (getGame().GetState() != Game.GameState.Recruit) + return; + + if (event.getRightClicked() == null) + return; + + if (!(event.getRightClicked() instanceof Player)) + return; + + Player player = event.getPlayer(); + + //Observer + if (getGame().getArcadeManager().IsObserver(player)) + { + UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); + return; + } + + selectTeamMate(player, (Player) event.getRightClicked()); + } + + @EventHandler + public void teamSelectCommand(PlayerCommandPreprocessEvent event) + { + if (!event.getMessage().toLowerCase().startsWith("/team ")) + return; + + event.setCancelled(true); + + if (getGame().GetState() != Game.GameState.Recruit) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot send team requests while the game is live")); + return; + } + + //Observer + if (getGame().getArcadeManager().IsObserver(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games.")); + return; + } + + Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true); + + if (target == null) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "That player is not online")); + return; + } + + if (event.getPlayer().equals(target)) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You can't team with yourself!")); + return; + } + + selectTeamMate(event.getPlayer(), target); + } + + private void selectTeamMate(Player player, Player ally) + { + //Accept Invite + if (_teamReqs.containsKey(ally.getUniqueId()) && _teamReqs.get(ally.getUniqueId()).equals(player.getUniqueId())) + { + //Remove Prefs + _teamReqs.remove(player.getUniqueId()); + _teamReqs.remove(ally.getUniqueId()); + + //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 (getGame().GetTeam(player) != null) + getGame().GetTeam(player).DisbandTeam(); + + if (getGame().GetTeam(ally) != null) + getGame().GetTeam(ally).DisbandTeam(); + + //Get Team + GameTeam team = getEmptyTeam(); + if (team == null) + return; + + team.setDisplayName(player.getName() + " & " + ally.getName()); + + //Join Team + getGame().SetPlayerTeam(player, team, true); + getGame().SetPlayerTeam(ally, team, true); + } + //Send Invite + else + { + //Already on Team with Target + if (getGame().GetTeam(player) != null) + if (getGame().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.getUniqueId(), ally.getUniqueId()); + } + } + + @EventHandler + public void teamQuit(PlayerQuitEvent event) + { + if (getGame().GetState() != Game.GameState.Recruit) + return; + + Player player = event.getPlayer(); + + if (getGame().GetTeam(player) != null) + getGame().GetTeam(player).DisbandTeam(); + + _teamReqs.remove(player.getUniqueId()); + _teamReqs.inverse().remove(player.getUniqueId()); + } + + private GameTeam getEmptyTeam() + { + for (GameTeam team : getGame().GetTeamList()) + { + if (team.GetPlayers(false).isEmpty()) + return team; + } + + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java index c2f6f2817..c6cf102d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java @@ -44,7 +44,12 @@ public abstract class PlayerPage extends BasePage players = new ArrayList<>(); for (String s : _players) { - players.add(Bukkit.getPlayer(s)); + Player player = Bukkit.getPlayer(s); + + if (!_plugin.isVanished(player)) + { + players.add(player); + } } } else @@ -56,7 +61,7 @@ public abstract class PlayerPage extends BasePage int slot = 9; for (Player player : players) { - if (showPlayer(player)) + if (showPlayer(player) && !_plugin.isVanished(player)) { ItemStack head = getPlayerHead(player.getName(), C.cGreen + C.Bold + player.getName(), new String[]{ ChatColor.RESET + C.cGray + getDisplayString(player) }); addButton(slot, head, new Button(slot, player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java index d2f170f5f..c1f189998 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java @@ -41,18 +41,7 @@ public class SpectatorButton implements IButton if(clickType == ClickType.RIGHT) { _player.closeInventory(); - _player.teleport(_target.getLocation().add(0, 1, 0)); - _arcadeManager.runSyncLater(new Runnable() - { - @Override - public void run() - { - _player.setGameMode(GameMode.SPECTATOR); - _player.setSpectatorTarget(_target); - UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(_target.getName()), player); - UtilPlayer.message(_player, F.main("Game", "Sneak to stop spectating")); - } - }, 3); + _arcadeManager.getGameSpectatorManager().setSpectating(_player, _target); } else { 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/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/PerkBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java index 95ca01a94..98bb50f9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java @@ -127,6 +127,15 @@ public class PerkBomber extends Perk UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing TNT") + ".")); } + @EventHandler (ignoreCancelled = true) + public void on(BlockPlaceEvent event) + { + if (!isThrowingTnt(event.getItemInHand())) + return; + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot place " + F.item("Throwing TNT") + ".")); + } + @EventHandler public void TNTDeathRemove(PlayerDeathEvent event) { @@ -139,6 +148,7 @@ public class PerkBomber extends Perk int oldAmount = _tntCount.get(event.getEntity()).get(); if (oldAmount < remove.size()) { + // fixme If you die with someone else's tnt, then this will occur System.out.println("Strange.... expected " + oldAmount + " of tnt for " + event.getEntity().getName() + " but removed " + remove.size() + " instead"); _tntCount.get(event.getEntity()).set(0); } 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..bdef9e25b 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 @@ -30,6 +30,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkBoneRush extends SmashPerk implements IThrown @@ -141,16 +142,28 @@ 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(); + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.getThrower(); + + if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + { + return; + } + } + if (isSuperActive(damager)) { damage = 3; @@ -158,23 +171,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/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java index c9054de14..0b6ae7d62 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java @@ -39,10 +39,7 @@ public class PerkCreeperElectricity extends Perk if (event.IsCancelled()) return; - if (event.GetCause() == DamageCause.ENTITY_ATTACK) - return; - - if (event.GetCause() == DamageCause.FIRE_TICK) + if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION) return; Player damagee = event.GetDamageePlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java index 5a97d8a8f..fee25dd52 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java @@ -21,8 +21,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.SmashPerk; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -165,6 +167,15 @@ public class PerkCreeperExplode extends SmashPerk if (UtilMath.offset(player.getLocation(), spawn) < 14) spawnIterator.remove(); } + + //If all spawns have been destroyed revert to using the spectator spawn + for (GameTeam team : Manager.GetGame().GetTeamList()) + { + if (team.GetSpawns().isEmpty()) + { + team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation()); + } + } } //Damage 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/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index 5b8a4d23a..df7e17b2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -3,11 +3,8 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; import java.util.Iterator; -import org.bukkit.Color; import org.bukkit.EntityEffect; -import org.bukkit.FireworkEffect; import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; @@ -19,7 +16,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; @@ -30,7 +26,6 @@ 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 nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.perks.data.FireflyData; @@ -93,7 +88,7 @@ public class PerkFirefly extends SmashPerk if (event.getType() != UpdateType.TICK) return; - _tick = (_tick + 1)%1000; + _tick++; Iterator dataIterator = _data.iterator(); @@ -147,8 +142,8 @@ public class PerkFirefly extends SmashPerk continue; other.playEffect(EntityEffect.HURT); - - if (_tick == 0) + + if (_tick % 12 == 0) { if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false)) { @@ -166,7 +161,7 @@ public class PerkFirefly extends SmashPerk { dataIterator.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/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java index ecf9b4bff..afba15ebd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java @@ -20,7 +20,8 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkInferno extends SmashPerk @@ -119,4 +120,23 @@ public class PerkInferno extends SmashPerk } } + @EventHandler + public void onCustomDamage(CustomDamageEvent event) + { + if (Manager.GetGame() instanceof TeamSuperSmash) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + if (smash.GetTeam(event.GetDamagerPlayer(true)).equals(smash.GetTeam(event.GetDamageePlayer()))) + { + event.GetDamageeEntity().setFireTicks(0); + event.SetCancelled("Team Damage"); + } + } + } } 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 f971ae57a..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; @@ -13,11 +14,13 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilPlayer; 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 { @@ -72,7 +75,7 @@ public class PerkLeap extends Perk if (event.getPlayer().getItemInHand() == null) return; - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + if (!UtilItem.isAxe(event.getPlayer().getItemInHand())) return; Player player = event.getPlayer(); @@ -94,7 +97,7 @@ public class PerkLeap extends Perk } //Energy - if (!Recharge.Instance.use(player, _name, _recharge, true, true)) + if (!Recharge.Instance.use(player, _name, _recharge, false, true)) return; //Use Use @@ -125,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/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index 64dcdc9b7..9f0bcc8c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -13,8 +13,6 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAlg; @@ -22,6 +20,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; @@ -126,6 +125,16 @@ public class PerkNightLivingDead extends SmashPerk { if (data.Zombies.contains(event.getEntity())) { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } if (data.Player.equals(event.getTarget())) { event.setCancelled(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 cff63ed81..195717459 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 @@ -33,6 +33,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkPigBaconBounce extends SmashPerk implements IThrown @@ -104,30 +105,42 @@ 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; + + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.getThrower(); + + if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + { + return; + } + } //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 1b16508b9..0bf4780f1 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 @@ -33,6 +33,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown @@ -208,6 +209,17 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown if (!_owner.containsKey(event.getEntity())) return; + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } + if (_owner.get(event.getEntity()).equals(event.getTarget())) { event.setCancelled(true); @@ -220,15 +232,27 @@ 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) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.getThrower(); + + if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + { + return; + } + } + //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 @@ -275,6 +299,16 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown //if (owner != null) // event.SetDamager(owner); This gives knockback from wrong direction :( + if (Manager.GetGame() instanceof TeamSuperSmash) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + + if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer()))) + { + event.SetCancelled("Team Damage"); + return; + } + } if (owner != null && owner.equals(event.GetDamageeEntity())) { 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/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index 5a7fccc01..28011f7ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -2,6 +2,17 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.kit.SmashPerk; import org.bukkit.Location; import org.bukkit.Material; @@ -17,20 +28,10 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; - public class PerkWitherImage extends SmashPerk { - private HashMap _images = new HashMap(); + private HashMap _ownerToSkeleton = new HashMap(); + private HashMap _skeletonToOwner = new HashMap(); public PerkWitherImage() { @@ -67,7 +68,7 @@ public class PerkWitherImage extends SmashPerk if (!Kit.HasKit(player)) return; - if (!_images.containsKey(player)) + if (!_ownerToSkeleton.containsKey(player)) { if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) return; @@ -94,7 +95,8 @@ public class PerkWitherImage extends SmashPerk UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); - _images.put(player, skel); + _ownerToSkeleton.put(player, skel); + _skeletonToOwner.put(skel, player); Recharge.Instance.use(player, "Wither Swap", 500, false, false); @@ -109,7 +111,7 @@ public class PerkWitherImage extends SmashPerk if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false)) return; - Skeleton skel = _images.get(player); + Skeleton skel = _ownerToSkeleton.get(player); Location loc = skel.getLocation(); skel.teleport(player.getLocation()); @@ -126,9 +128,23 @@ public class PerkWitherImage extends SmashPerk @EventHandler public void entityTarget(EntityTargetEvent event) { - if (_images.containsKey(event.getTarget())) - if (_images.get(event.getTarget()).equals(event.getEntity())) - event.setCancelled(true); + if (_skeletonToOwner.containsKey(event.getEntity())) + { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if(smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } + if (_ownerToSkeleton.get(event.getTarget()).equals(event.getEntity())) + { + event.setCancelled(true); + } + } } @EventHandler @@ -137,13 +153,13 @@ public class PerkWitherImage extends SmashPerk Player damagee = event.GetDamageePlayer(); if (damagee == null) return; - if (!_images.containsKey(damagee)) + if (!_ownerToSkeleton.containsKey(damagee.getUniqueId())) return; LivingEntity damager = event.GetDamagerEntity(false); if (damager == null) return; - if (_images.get(damagee).equals(damager)) + if (_ownerToSkeleton.get(damagee.getUniqueId()).equals(damager)) event.SetCancelled("Wither Image"); } @@ -153,12 +169,12 @@ public class PerkWitherImage extends SmashPerk LivingEntity damager = event.GetDamagerEntity(true); if (damager == null) return; - if (!_images.containsValue(damager)) + if (!_ownerToSkeleton.containsValue(damager)) return; - for (Player player : _images.keySet()) + for (Player player : _ownerToSkeleton.keySet()) { - if (_images.get(player).equals(damager)) + if (_ownerToSkeleton.get(player).equals(damager)) { event.SetDamager(player); event.setKnockbackOrigin(damager.getLocation()); @@ -173,12 +189,12 @@ public class PerkWitherImage extends SmashPerk if (event.getType() != UpdateType.FAST) return; - Iterator playerIterator = _images.keySet().iterator(); + Iterator playerIterator = _ownerToSkeleton.keySet().iterator(); while (playerIterator.hasNext()) { Player player = playerIterator.next(); - Skeleton skel = _images.get(player); + Skeleton skel = _ownerToSkeleton.get(player); if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160) { @@ -195,7 +211,8 @@ public class PerkWitherImage extends SmashPerk @EventHandler(priority = EventPriority.LOWEST) public void clean(PlayerDeathEvent event) { - Skeleton skel = _images.remove(event.getEntity()); + Skeleton skel = _ownerToSkeleton.remove(event.getEntity()); + _skeletonToOwner.remove(skel); if (skel != null) { 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/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 8bffd0acc..9b47ccc27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -108,6 +108,7 @@ public class GameCreationManager implements Listener { Game game = gameIterator.next(); + game.cleanupModules(); game.disable(); HandlerList.unregisterAll(game); 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..87c345881 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(); @@ -950,7 +948,8 @@ public class GameLobbyManager implements Listener public void Combust(EntityCombustEvent event) { for (LobbyEnt ent : _kits.values()) - if (event.getEntity().equals(ent.GetEnt())) + if (event.getEntity().getWorld().getUID().equals(ent.GetEnt().getWorld().getUID()) && + event.getEntity().equals(ent.GetEnt())) { event.setCancelled(true); return; @@ -1050,7 +1049,7 @@ public class GameLobbyManager implements Listener { if (Manager.GetGame() instanceof UHC && !((UHC)Manager.GetGame()).isMapLoaded()) { - objective.setDisplayName(((UHC)Manager.GetGame()).getMapLoadPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"); + objective.setDisplayName(((UHC) Manager.GetGame()).getObjectiveName(_colorTick)); } else { @@ -1177,7 +1176,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 +1311,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..cc517cbf9 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) { @@ -741,6 +741,10 @@ public class GameManager implements Listener if (event.GetState() != GameState.Prepare) return; + // Sir, I'll handle this. + if (game instanceof UHC) + return; + final ArrayList players = game.GetPlayers(true); //Prepare Players diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index 899786190..cef0c62ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -1,12 +1,19 @@ package nautilus.game.arcade.managers; +import java.util.ArrayList; + import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTabTitle; +import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -16,6 +23,8 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.ProgressingKit; + +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; @@ -32,11 +41,12 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.scheduler.BukkitRunnable; -import java.util.ArrayList; - public class GamePlayerManager implements Listener { ArcadeManager Manager; + private static final long PLAYER_VISIBILITY_REFRESH_RATE = 30000; + private static final int VIEW_DISTANCE_BLOCK_VALUE = 8; + private long _lastVisibilityRefresh = 0; public GamePlayerManager(ArcadeManager manager) { @@ -44,6 +54,34 @@ public class GamePlayerManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } + + @EventHandler + public void onRefreshVisibility(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + if (UtilTime.elapsed(_lastVisibilityRefresh, PLAYER_VISIBILITY_REFRESH_RATE)) + { + _lastVisibilityRefresh = System.currentTimeMillis(); + if (Manager.GetGame() == null) + { + return; + } + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player)) + { + for (Player viewer : Bukkit.getOnlinePlayers()) + { + if (UtilMath.offset2d(viewer, player) <= (Bukkit.getViewDistance() * VIEW_DISTANCE_BLOCK_VALUE)) + { + viewer.showPlayer(player); + } + } + } + } + } + } @EventHandler(priority = EventPriority.HIGH) public void PlayerDeath(CombatDeathEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index b067a806d..defc9f325 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -1,8 +1,22 @@ package nautilus.game.arcade.managers; +import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.UUID; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.NetworkManager; +import net.minecraft.server.v1_8_R3.PacketPlayOutCamera; +import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.WorldSettings; import org.bukkit.GameMode; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -10,6 +24,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; @@ -26,8 +41,10 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -public class GameSpectatorManager implements Listener +public class GameSpectatorManager implements Listener, IPacketHandler { + private Set _pendingSpectate = Collections.synchronizedSet(new HashSet<>()); + ArcadeManager Manager; public GameSpectatorManager(ArcadeManager manager) @@ -35,11 +52,13 @@ public class GameSpectatorManager implements Listener Manager = manager; Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); + + Manager.getPacketHandler().addPacketHandler(this, PacketHandler.ListenerPriority.HIGH, PacketPlayOutNamedEntitySpawn.class); } - + @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void interactCancel(PlayerInteractEvent event) - { + { if (Manager.GetGame() == null) return; @@ -47,30 +66,30 @@ public class GameSpectatorManager implements Listener if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); - + processClick(player, event.getAction()); } - + public void processClick(Player player, Action action) { if (Manager.GetGame() == null) return; - + if(!Manager.GetGame().AllowEntitySpectate) return; - + if(!Manager.GetGame().IsLive()) return; - + if(player.getGameMode() != GameMode.SPECTATOR) return; - + if(player.getSpectatorTarget() == null) return; - + if(!(player.getSpectatorTarget() instanceof Player)) return; - + List players = Manager.GetGame().GetPlayers(true); int currentPlayer = 0; for(Player otherPlayer : players) @@ -79,32 +98,32 @@ public class GameSpectatorManager implements Listener if(((Player) player.getSpectatorTarget()) == otherPlayer) break; } - + if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) currentPlayer = currentPlayer - 2; else return; - + if(currentPlayer < 0) currentPlayer = players.size() - 1; - + if(currentPlayer >= players.size()) currentPlayer = 0; - + if(players.get(currentPlayer) == null) return; - + Player specPlayer = players.get(currentPlayer); - + setSpectating(player, specPlayer); } - + @EventHandler(priority = EventPriority.LOW) public void interactEntityCancel(PlayerInteractEntityEvent event) { if (Manager.GetGame() == null) return; - + Player player = event.getPlayer(); if (Manager.GetGame().GetState() == GameState.Recruit) @@ -114,7 +133,7 @@ public class GameSpectatorManager implements Listener return; } } - + if (!Manager.GetGame().IsAlive(player)) { event.setCancelled(true); @@ -127,7 +146,7 @@ public class GameSpectatorManager implements Listener } } } - + @EventHandler public void updateSpecEntitys(UpdateEvent event) { @@ -136,7 +155,7 @@ public class GameSpectatorManager implements Listener if(Manager.GetGame() == null) return; - + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) { if(Manager.GetGame().AllowEntitySpectate) @@ -158,13 +177,13 @@ public class GameSpectatorManager implements Listener } } } - + @EventHandler(priority = EventPriority.LOW) public void spectatedEntityDeath(PlayerDeathEvent event) { if(Manager.GetGame() == null) return; - + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) { if(Manager.GetGame().AllowEntitySpectate) @@ -191,13 +210,13 @@ public class GameSpectatorManager implements Listener } } } - + @EventHandler(priority = EventPriority.LOW) public void dismountEntity(PlayerToggleSneakEvent event) { if(Manager.GetGame() == null) return; - + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) { if(Manager.GetGame().AllowEntitySpectate) @@ -213,41 +232,53 @@ public class GameSpectatorManager implements Listener } } } - - private void setSpectating(Player player, Entity target) - { - player.setGameMode(GameMode.SURVIVAL); - player.teleport(target.getLocation().add(0, 1, 0)); - player.getInventory().setHeldItemSlot(5); - Manager.runSyncLater(new Runnable() - { - @Override - public void run() - { - if (Manager.GetGame().IsAlive(player)) - return; - Player ptarget = null; - if (target instanceof Player) - ptarget = (Player) target; - - if (ptarget != null) - { - if (!Manager.GetGame().IsAlive(ptarget)) - return; - } - - player.setGameMode(GameMode.SPECTATOR); - player.setSpectatorTarget(target); - - if (ptarget != null) - UtilTextBottom.display(C.cGray + "You are spectating " + F.elem(Manager.GetGame().GetTeam(ptarget).GetColor() + ptarget.getName()) + ".", player); - - UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating.")); + public void setSpectating(Player player, Entity target) + { + if (Manager.GetGame().IsAlive(player)) + { + return; + } + + Player playerTarget = null; + + if (target instanceof Player) + { + playerTarget = (Player) target; + if (!Manager.GetGame().IsAlive(playerTarget)) + { + return; } - }, 1); + } + + _pendingSpectate.add(target.getUniqueId()); + + player.teleport(target.getLocation().add(0, 1, 0)); + + // If the player already has the entity loaded, we have to set it now + + // todo + // In the future, we could do some really cool stuff where we listen to all incoming and outgoing + // spawn/destroy packets and track whether the client has loaded the entity in memory + // However, that approach has the risk of desynchronization at which point we're screwed + player.setGameMode(GameMode.SPECTATOR); + player.setSpectatorTarget(target); + + if (playerTarget != null) + UtilTextBottom.display(C.cGray + "You are spectating " + F.elem(Manager.GetGame().GetTeam(playerTarget).GetColor() + playerTarget.getName()) + ".", player); + + UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating.")); + + // And if the player did have the entity loaded, we also need to clean up after ourselves + // 20 ticks should be more than enough time considering we're just waiting for the server to attempt to + // send the packet + // and even if the server was lagging, the scheduler should be lagging too + Manager.runSyncLater(() -> + { + _pendingSpectate.remove(target.getUniqueId()); + }, 20L); } - + @EventHandler(priority = EventPriority.LOW) public void vehicleDamage(VehicleDamageEvent event) { @@ -256,10 +287,57 @@ public class GameSpectatorManager implements Listener if (!(event.getAttacker() instanceof Player)) return; - + Player player = (Player)event.getAttacker(); if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); } + + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn) + { + PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket(); + if (_pendingSpectate.remove(packet.b)) + { + // Handle Minestrike spam race condition + if (Manager.GetGame().IsAlive(packetInfo.getPlayer())) + { + return; + } + + packetInfo.setCancelled(true); + + EntityPlayer ep = ((CraftPlayer) packetInfo.getPlayer()).getHandle(); + NetworkManager manager = ep.playerConnection.networkManager; + + manager.a(packet, future -> + { + Manager.runSync(() -> + { + PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(packetInfo.getPlayer(), GameMode.SPECTATOR); + UtilServer.CallEvent(event); + if(event.isCancelled()) { + return; + } + + ep.playerInteractManager.setGameMode(WorldSettings.EnumGamemode.getById(GameMode.SPECTATOR.getValue())); + ep.fallDistance = 0.0F; + manager.a(new PacketPlayOutCamera(ep), future1 -> + { + manager.a(new PacketPlayOutGameStateChange(3, (float)GameMode.SPECTATOR.getValue()), future2 -> + { + PacketPlayOutCamera p1 = new PacketPlayOutCamera(); + p1.a = packet.a; + manager.handle(p1); + }); + + }); + }); + }); + } + } + } } 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..6500f6308 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() + ""); } } */ @@ -250,7 +250,7 @@ public class GameScoreboard if (i >= _chars.length) break; - String str = ChatColor.COLOR_CHAR + "" + _chars[i]; + String str = ChatColor.COLOR_CHAR + "" + _chars[i] + C.Reset; Score score = GetObjectiveSide().getScore(str); 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..35362f78f 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,9 +74,15 @@ public class WinEffectManager public WinEffectGadget getWinEffect() { GadgetManager manager = _game.getArcadeManager().getCosmeticManager().getGadgetManager(); - Gadget gadget = manager.getActive(_winner, GadgetType.WinEffect); - if(gadget == null) gadget = manager.getGadget(WinEffectPodium.class); - return (WinEffectGadget) gadget; + Gadget winEffect = manager.getGadget(WinEffectPodium.class); + for (Gadget gadget : manager.getGadgets(GadgetType.WIN_EFFECT)) + { + if (gadget.isActive(_winner)) + { + winEffect = gadget; + } + } + return (WinEffectGadget) winEffect; } }