diff --git a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilMath.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilMath.java
index 5e37e0ac5..1b3b40835 100644
--- a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilMath.java
+++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilMath.java
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
@@ -13,6 +14,8 @@ import org.bukkit.util.Vector;
public class UtilMath
{
+ public static final double TAU = Math.PI * 2D;
+
public static double trim(int degree, double d)
{
String format = "#.#";
@@ -332,4 +335,119 @@ public class UtilMath
return min;
}
+
+ /**
+ * Creates an array of points, arranged in a circle normal to a vector.
+ *
+ * @param center The center of the circle.
+ * @param normal A vector normal to the circle.
+ * @param radius The radius of the circle.
+ * @param points How many points to make up the circle.
+ *
+ * @return An array of points of the form double[point #][x=0, y=1, z=3]
.
+ */
+ public static double[][] normalCircle(Location center, Vector normal, double radius, int points)
+ {
+ return normalCircle(center.toVector(), normal, radius, points);
+ }
+
+ /**
+ * Creates an array of points, arranged in a circle normal to a vector.
+ *
+ * @param center The center of the circle.
+ * @param normal A vector normal to the circle.
+ * @param radius The radius of the circle.
+ * @param points How many points to make up the circle.
+ *
+ * @return An array of points of the form double[point #][x=0, y=1, z=3]
.
+ */
+ public static double[][] normalCircle(Vector center, Vector normal, double radius, int points)
+ {
+ Vector n = normal.clone().normalize();
+ Vector a = n.clone().add(new Vector(1, 1, 1)).crossProduct(n).normalize();
+ Vector b = n.getCrossProduct(a).normalize();
+
+ double[][] data = new double[points][3];
+
+ double interval = TAU / points;
+ double theta = 0;
+
+ for (int i = 0; i < points; i++)
+ {
+ data[i][0] = center.getX() + (radius * ((Math.cos(theta) * a.getX()) + (Math.sin(theta) * b.getX())));
+ data[i][1] = center.getY() + (radius * ((Math.cos(theta) * a.getY()) + (Math.sin(theta) * b.getY())));
+ data[i][2] = center.getZ() + (radius * ((Math.cos(theta) * a.getZ()) + (Math.sin(theta) * b.getZ())));
+ theta += interval;
+ }
+
+ return data;
+ }
+
+ /**
+ * Slightly randomize a location with a standard deviation of one.
+ *
+ * @param location The location to randomize.
+ *
+ * @return The original location, now gaussian-randomized.
+ */
+ public static Location gauss(Location location)
+ {
+ return gauss(location, 1, 1, 1);
+ }
+
+ /**
+ * Slightly randomize a vector with a standard deviation of one.
+ *
+ * @param vector The location to randomize.
+ *
+ * @return The randomized vector, now gaussian-randomized.
+ */
+ public static Vector gauss(Vector vector)
+ {
+ return gauss(vector, 1, 1, 1);
+ }
+
+ /**
+ * Slightly randomize a location with a standard deviation of one.
+ *
+ * This method only accepts positive values for all of its arguments.
+ *
+ * A good parameter set for small offsets is (loc, 10, 10, 10).
+ *
+ * @param location The location to randomize.
+ * @param x A granularity control for the x-axis, higher numbers = less randomness
+ * @param y A granularity control for the y-axis, higher numbers = less randomness
+ * @param z A granularity control for the z-axis, higher numbers = less randomness
+ *
+ * @return The original location, now gaussian-randomized
+ */
+ public static Location gauss(Location location, double x, double y, double z)
+ {
+ return location.clone().add(
+ x <= 0 ? 0 : (ThreadLocalRandom.current().nextGaussian() / x),
+ y <= 0 ? 0 : (ThreadLocalRandom.current().nextGaussian() / y),
+ z <= 0 ? 0 : (ThreadLocalRandom.current().nextGaussian() / z));
+ }
+
+ /**
+ * Slightly randomize a vector with a standard deviation of one.
+ *
+ * This method only accepts positive values for all of its arguments.
+ *
+ * A good parameter set for small offsets is (loc, 10, 10, 10).
+ *
+ * @param vector The location to randomize.
+ * @param x A granularity control for the x-axis, higher numbers = less randomness
+ * @param y A granularity control for the y-axis, higher numbers = less randomness
+ * @param z A granularity control for the z-axis, higher numbers = less randomness
+ *
+ * @return The randomized vector, now gaussian-randomized
+ */
+ public static Vector gauss(Vector vector, double x, double y, double z)
+ {
+ return vector.clone().add(new Vector(
+ x <= 0 ? 0 : (ThreadLocalRandom.current().nextGaussian() / x),
+ y <= 0 ? 0 : (ThreadLocalRandom.current().nextGaussian() / y),
+ z <= 0 ? 0 : (ThreadLocalRandom.current().nextGaussian() / z)));
+ }
}
diff --git a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java
index b0d4bd9bc..696cf72d3 100644
--- a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java
+++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java
@@ -11,7 +11,6 @@ import org.bukkit.World.Environment;
import org.bukkit.WorldBorder;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
import com.google.common.collect.Lists;
@@ -22,6 +21,11 @@ public class UtilWorld
{
return Bukkit.getServer().getWorld(world);
}
+
+ public static boolean isInChunk(Location location, Chunk chunk)
+ {
+ return location.getChunk().getX() == chunk.getX() && location.getChunk().getZ() == chunk.getZ() && chunk.getWorld().equals(location.getChunk().getWorld());
+ }
public static boolean areChunksEqual(Location first, Location second)
{
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java
index 3c9a78a56..4026dad3f 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java
@@ -166,7 +166,40 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
"0$#######$0",
"$#########$"
};
-
+
+ public static final String[] MAPLE_LEAF = new String[]
+ {
+ "000000000000000000000000000$000000000000000000000000000",
+ "00000000000000000000000000$$$00000000000000000000000000",
+ "0000000000000000000000000$$#$$0000000000000000000000000",
+ "000000000000000000000000$$###$$000000000000000000000000",
+ "00000000000000000000000$$#####$$00000000000000000000000",
+ "0000000000000000$$$000$$#######$$000$$$0000000000000000",
+ "0000000000000000$#$$$$$#########$$$$$#$0000000000000000",
+ "0000000000000000$$###################$$0000000000000000",
+ "00000000000000000$###################$00000000000000000",
+ "00000000000$$0000$$#################$$0000$$00000000000",
+ "0$$$000000$$$$$000$#################$000$$$$$000000$$$0",
+ "00$$$$$$$$$###$$$0$$###############$$0$$$###$$$$$$$$$00",
+ "00$$############$$$$###############$$$$############$$00",
+ "000$$#############$$###############$$#############$$000",
+ "0000$$###########################################$$0000",
+ "00$$$#############################################$$$00",
+ "$$$#################################################$$$",
+ "00$$$$###########################################$$$$00",
+ "00000$$$#######################################$$$00000",
+ "00000000$$$$###############################$$$$00000000",
+ "00000000000$$$###########################$$$00000000000",
+ "0000000000000$$#########################$$0000000000000",
+ "0000000000000$$#########################$$0000000000000",
+ "0000000000000$##$$$$$$$$$$$#$$$$$$$$$$$##$0000000000000",
+ "000000000000$$$$$000000000$#$000000000$$$$$000000000000",
+ "00000000000000000000000000$#$00000000000000000000000000",
+ "00000000000000000000000000$#$00000000000000000000000000",
+ "00000000000000000000000000$#$00000000000000000000000000",
+ "00000000000000000000000000$#$00000000000000000000000000",
+ "00000000000000000000000000$$$00000000000000000000000000"
+ };
/**
* Default rotation to give the wings a little tilt when displayed on players for instance
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 f803154ce..9b84839e4 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
@@ -78,6 +78,19 @@ public class SkinData
public static final SkinData LARISSA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjE0MTUxMzQsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYThjNDRhOWVmZTY3NzExMDYzMjM5ODEwNDRmOTdjYmM1OWJmZmRlOGI1ODdlMGQzMWE4N2ViMDhhMmExZiJ9fX0=", "Lyac51CrnMK/CI2dWgGQLowAm/ZnQMpf0Ict/gqVrUgJVlGWDIVG77Rd1JyMQDEeESvTmoyivH+usiO0ePW95qjisqT3R43YEmLi85CqctGYqLKeSYpGYwYRz8Euw57LwJAALKOMLhVc2s4h2Or9nTecunG8KSmkCuZc4H1qh3frU+ltuV4HLqgdFUULbIHTggyvqiINov2tBqkkXeEjT7sOcTJCJNgNYU2O7//qg5kJmhso2CKHlRLpmy9LsaUK/Z+BzUmoRbwQgSwr3mz7dFAdlVWWKvKNcgX3nt1et0DIig3JKYmrnQX2Fprg+kWcr3nuizzLgjVwAlADC48P3DN0s/VBty2AYoWie16VNPIM+CV4BF2JRQ34GxZ8XceXbCKURrOjoCBgLGHvIhRW35eicoh26xp3/mwLvk5anPi5StJ/qEuzWJALeWcNbLsnt21m2MZp9h/MxaY6ftWOTzjTr5CYVd/teJyscMnGK4+lcV1dlt12lhbDMv6I+iz8iG9NIzuW5OvGkax90dA/Gq+Cd9FXVThPY4ufxWttHcTqgPB64GfMn6rywRm1B0eO1pJpYc/KlJZlW/PuaO8L1assyJs5KkOypBSy3zc6TO6pzgeOZv+VpQfA/UWpogv6ofmTpgdtwpjLFGSzIKTDXvF6FftALKVlYypG0fYbssA=");
public static final SkinData ROWENA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0Njk1MTcxOTgsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jNDY1OGExODY4YzNhNjhhZWVhZmZkOTUxZDQyYmZkN2QxYTRjNGZjNDJjZDI2YTlmYzhkNTNmOTkxMTM1ZCJ9fX0=", "OqXMyH9SMmQ/Pwmb21In29YnCxbsN6yqUxfudN6KNgDwRUK6y072XhW6TIoTh9JQLAUKftpeVB53tk0LxHIxnsuBMrIHvETPDQFysIc/6xq3ABogs+zqFzcp5jk6S73HiD78JxLq5pzfUzhgDPMPuZP5Q/u2q1rYbe6B9lVEJ5sUcxBLUTossgucoR4qXYAlWVQdHRhq85Ol8a+OU7ruw3HackNGto6wt6u2MigCtiHVTt9XhJ/AJE4ScodQ3XwW4L6urpl/lV2OMCsr3mCjjjEz2EMhDbCWxrAorQ9aPpMbDkHBS+4TC1tbMGUlKhj5n+EZBYVaeLr4NGPACPSdT35p/2Zra49+DXn9Xn+681yNEB0ghTdsnsgwXg76+HVPHPqRHQMuTBQGQyGZaaTX/zE0tFjH+osMElLdb8dmz3dC7kQA4A13B2phj3YbMSF1FoU4GvnPKIQn6JIuEd6hd+pRLUW7Y+mgYIHHX1FT0ihrXAyVO6lQQ6rs92gSQr7sxC7tnhPSMFcmh7OcJYcbRpn97GMubthPLanOhVy7CKqjmwIkEVtYgP28idigKwNJ+sJuUONrOu7nMKl1UTD5EEapOacc/np6UhdSw8yW+LnWD/x9ueYz9ksnyRrJgcOa41izo/WCbjPK/j3JVezr9Q3x1yveWuFmdl7CGYdXngw=");
public static final SkinData BIFF = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjEzMDQzNjYsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9mOWMyMTE3ZDY0ZWE0ZmUxMWZiY2NhZmE2YzU5YzhlZjY3NDVkZjVkMTZjM2QwMmI4NmI2OTlmZWJjNTA0OGI1In19fQ==", "mJMpEvQ4A02z0S/chgLm5bKrrrd+zmp7A0012AB7b3KlyIHoLKEDDz+ZJgJtvN6skOqed3P+yNVqkxitugXaZZP8Af9J+/TseHn+vOy6CTK5tykRSY3Zb8Zmw1kn36v/SARAVtDIHD53yuPgJayYSAbVB7aknj1Q8XBQGUmZRMRxWWxeD7rQTOwgRYI4YJeKFf4UL9i6zxvOJuHsOAouJ7scu7VohG8vgR77Js/Z8rSu8/aSG+O9AQdzP6h9ixYNFkkQOHm7DseK/5tsWKHM4FYBgjIDKt3ApQokSbhThzGB55BA1qjXZkfCoOb13y1nOMC8WoIL6Ees1qzxG3VloGx2WAZLh+Q+/irwrFDMxk1zeU5fIRuj1c/UIM2HKdxxWgoRdrZ8ww/Jrll6maiOBx7geMn/0aOUbJ2U7gkTif6RG6YNS5YN9ZQDLh72l/akJMxF3SlmuAPmLs2kBghQ6eD2YQKuxWR/Hf1yS1YXtogFVNsGnzC1nda7F48EGL3zI+kCajbDlAGQ32aRt0btbEQ+Gj575kir3Aa53qiZ0YOIYQlhgZdOsTN2NE2s8uuy/15Rgc6K3ydgEmSZfdqyMyW0Dy7pE5TfVL8DumKRVRXdOceT5WfnW7MyqSmdorP5ab1fw2wLOnAVzhJmW8oXXNSs77WJ1/PURclxOWB4IF8=");
+ public static final SkinData CANADA_HAT = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg2MDE5MDYwNzYsInByb2ZpbGVJZCI6IjdkYTJhYjNhOTNjYTQ4ZWU4MzA0OGFmYzNiODBlNjhlIiwicHJvZmlsZU5hbWUiOiJHb2xkYXBmZWwiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2M2MTExNTNmODdmMjZjMzRmOTdkODIxM2ZmOTk1ZGJlNjcyZWJkNGM0NjRkNGFkNzM5MWFlNDNjMWU3YTllIn19fQ", "QMw6e1FXl/Xrt+BbfPKsz3OHyOxL9CEPffS9grxRLD6gbLbMD84OT3+bge5V9lBFn9PPnTyID+WTF24qHj4ADTTgK94ykNedCEO6R1wS0FZKPI1UjwOxMhIG5ZeVr7+HxITgGU4Xz94IigBkvW//f2ZGelMvS0GLCrm4iCovEBMUzyYJ2dZ4xgzFSH6v+9efK4/SBAJaj8mHjXpDxU58/vskTGI3T9t5sWlZLXgId9vHcMj0GH3Un6yvUXiMkh38V/rAEM8/R8q08xUVyW0e2R38qWQV2+eKvsG8GmJmgkU/78wA9cKGZdrEz0pnr80eGNCbvXqQvC/czYhEhDapgxfndcHLX8q/Zk3I8msNr340E4ZrQL61Yl7KcVC1qEUQVu3cosq5A6ckXLGvv//HSwXVO8M9ThUbuEC8QjiS/fMFufnVa18lHrVulnfb/2KQ4yPsoCHK/zvGtRkWtD1sLOIfehN+sxCLiaz80ILBiwN0oHITfNHpJzoa4kF/OrxxCualp4Sv5o5TXBv7aWsO18v9ixb9o9CmJKKE8MUl5xmRVz4HQD4dyOfcwtPuxmfcYjJrxqBijdQMrcgLzqqMs+DUqcZZlxM7M5GaNUoEvL9tJNGpZaB2OrBw0DTk5wx15XfANCH4egx8X4+Iy2RUoFthHX3BsVazG7fjSiDnUtI=");
+ public static final SkinData AMERICA_HAT = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg2MDI3MjMyODgsInByb2ZpbGVJZCI6IjNlMjZiMDk3MWFjZDRjNmQ5MzVjNmFkYjE1YjYyMDNhIiwicHJvZmlsZU5hbWUiOiJOYWhlbGUiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzYzMjI0MDhkYzBiZjMxNjU4N2RiNDJiN2Q5ZmViZTUwYWQ4MGY0OGU4Njc5YzI0NTFkOTk3MTdjZmVjNTdkYWQifX19","oRo6DIuhOTaXDkFsgwJ488LWqx5d1QpwtglwG1SdEvkbX1aCMGdZyDm9YIopQRjfBg0uYKQFetOZ1ZkdMmc/aKC5/dm0+Ema7g8AUzjwf4OaSLH1r4C1UJ4ruaNG5diBxNTkYnMa7yT8zvyEr22CA7lUOIgTh8ymBfSGK35RPhsn8jM0hDjdhjemBAlxKpiioByfmAQbwokNBOrXfh/PnKq+iJYg4WpMSZ1zo5Rr0CzLXwu+/T3dvrb6mg7qry7J3Lj5/qn6iIdBcjJBeyvy1sCo45jQ3Rzc6oL/84Vu5Dpn395EqUK8Sa7mdpVpATTcj56TCjkNNtDapXNqyO/IIQuzU4wnBKNQmZefaxRl6LV0DhZ8n8YQaPj6hH/mr2oDsd23+jejjqu6Y95ReTyukp06mIGqgekmrdZV2etML2oMAOTv9ieVvqtfo5gEomYs+NFAL7rMmzjAlhd17VOgqNRMpmJazAHWOYKl8KdOH99wGDe5XcyKHysh+qyHKMvhPJztIeAEaosynF/aGHghH2PM354KCuUVNmdR5G7UZUoG9ZA5ZU3EzZ854jeqxcqw3jzb6qL7A83QNuFqOsb87ugL/jO3QEDdQ9drdf3WAQauQGkU3nYBrls5wxoMrQ+Ceth+FtZw9a1v7dc+DEWOeJKCtOAIskb29pv6OcRe0Wk=");
+ public static final SkinData REVOLUTIONARY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg3ODQ5Mzk3NjAsInByb2ZpbGVJZCI6ImIwZDRiMjhiYzFkNzQ4ODlhZjBlODY2MWNlZTk2YWFiIiwicHJvZmlsZU5hbWUiOiJZZWxlaGEiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2I4NTBkZDNkYWQ0MjkxYzFhYmU4NGU2OTM2ZmQ3MDM0ZWVlZTk1OTk2MWI3YjE5NDZhODIxYWRlMTFiODI2YjIifX19","U2xBG+ryUacvZq3WreWF2J4QnQERuvp1okqdlkAYECqvVHz0cars78usPuZYD4s3HyOM0eGASzS4zkQERF6Hk8crnG+ZtqvML5kL+TkxK8gEbn2j5qB+YDG0qTx635mYGC77sGaqE/CsZAlhRYU6lyXILW2616Af8B8orOlpyCMRytijp/OfJREK0bC4I1QnB7AJ2QmBYuZJ9l8473858fJOlCVHjbsC/WRcUvepPSYYxvl8Z5NwayyIVnnz3tGVN6hnM7tzil/gQmsmDwGhlSyify/MEGssvd0sHLTlccA7XX98tyUFHXU84L5MJuNKg/uXTYz+9cRPIgJaptJNfqCoEa/ape+YHlOlK2lm5qRvubvp931X+VwFbcrEuaIFgbqr9cof5JW6DYfpVKvcngi9+K9IzgtPG59Jro5kxb70IfQhZcDkcHGo1pz5Tj7cdJdD7crBeIBaE/EoKU6iaSOrUFoILEdpcWQfaToRnk4L/JMet7zPXBNE/D/vEgQLGLNX7byofdCXSD9njtjLWmHg4rCzwuUqaiWnTCYIkkdg/mFuRQ3oTRRTzdlLXsK90Pz0XU9N6gBhWA9pxhzDJR7YK+mdXODALuMXE6zcCsbVuWhqbnN+EByGdjT9X1QPSN+/5iV9d5JyweiJrF7arf2PmxgEIb9OSjePNKRmHoo=");
+ public static final SkinData MELON_PERSON = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjA2OTU5MDgsInByb2ZpbGVJZCI6ImNiZDIwN2M3ZDNkZDQwYTg5NTBiZGQ4ZTU4M2IyYjY1IiwicHJvZmlsZU5hbWUiOiJBbGVzc2FuZHJvQ2Vydm8iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzNiNDQwYjc5NWY3ZGNjZGNiODY3MzBjYzMyYzE0MGQ4NzM2NmRjNDU2YWZhZjA4Y2VkNjE1OTEyOWViMCJ9fX0=","U5yXWm6A0R4gzZRFWeeI0IUwOlpjOUogDIJyPX1b9ItcT1CMkKF/oc2IKmbMJGhwktzV8U3YKh8J3IHHomJYMiZN6WH8QNyzAiw4uaaWd2JFtG5LYRLFI7DPiaXrRW0Wdz4IffFBZ5yyDOIOLcGCExLrxyeKAO7yNah6IMgEbtY8wX6uZYFWkxRx7Orbici2zsDakghXUFcnvNE+plmK3Gxjb45RtYfWeurGzcsCEEjkRK/aQ4aohvCkx5sc4Bl3ObWiDVJ9FvHzPSd09zjnIpL9jyxKQTscbeRFKasjtbJLEbq/yq5cAjI9uGYbPkBG9C1JgmWDZBz9a0bCwRokihKtYJbDAs1417qcyzoH0ylLt85fz+XM7G+MIHba8hZ3aJFZughyslsCg/+5jAm+Ci9yQJgYFf3yHFUrmVktHz+dsWdgrfDqIMXKJWXVKccvHMD0u+yKCMxW6C4RxZmOgnAqYfvPUJqTrAW4FpbFuPBTpFsGYF7QfgIekib8aXsUr0hCh1HqEYqICVXT8Jr38A4ySMZ1NKnbRzEsDwL/4gE5YDtza+qcanY2Ewl906Z+m3uMXXXKM7uYq47RyOYWYyOcyJhr9n7C1pEbyoaTt1m4+u9j9TEMX/8oN7qCSvDhkBH5M+XIt6OJhu7bJObW0HjqUo6yADUx3srK9cX9Rpw=");
+
+ public static final SkinData APPLE = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjMzODU3NzAsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zNWUyZTA5NTk3MTJkY2QzMzU3Y2MzY2VhODVmOTliM2ZkODA5Nzg1NWM3NTRiOWIxNzFmOTYzNTE0MjI1ZCJ9fX0=", "tK+zKZp42fBhSLoXyFMwJ7AYubID12WUhhp9At4YA7A6SuYHj022IrkxWjsl8e7stsd+gmMsPbr25HMHH8JXRQhzH+5qRa3PBVqhYFUHWI7jrrmTk7krhwZOg+Ozw0+TU4nqyRZGeZxwKiy0DcpO7tsgcFQtbJTG27jh4ZGlkqANDHYsqi8BiOXVz51yquuf8x8Bgml+0wyuCrkgUo2a0iXB5la9zs/HnxFJbHi/IHn+a2+RqGa49JhgMCykKkohsgPEqcuCBuUbqs8pxdnUHTqCxmZ/XKjgXq3NpFkfp2RYynDTW5RfZdEbo+D+cbivZgrehBtJatJd8vZu+kmuxwxYR0mdre4MrlRcgn1CpSvPk5/EJrkst8TVv1iEtUeR2l82umw+QfemNOgrOP3K/DT+JX6faRskrLP7J6JAIWP04dEuDI83t1Y7UPX/tSsGOrA2PO/VR8670dwCMS5Wc60RLhT98PKs0ctFaPK4RQRp4XbOw7jtWiNUZ+iy7JOUFLKcoTZNOFqoXs1IVs2JZ/nHJHkzLXkvaHzeM5KlYiq8igCy3XF5CQvVrTsFYX+PELkq+2wpyVgSHITqhUZl96mDAWMFm8IepE0JEkTfp8VrTTXeym3LL5Ecu7Azeoh7SiKf5lSKyLro3hp2N+JvN8l0BPB8qpZAjs4VJd79dns=");
+ public static final SkinData MELON = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjMzNTc0MjcsInByb2ZpbGVJZCI6ImJiMDgwOTFhOTJlZDQzYWQ5NGYxZWRmZDc0NmIwYTJjIiwicHJvZmlsZU5hbWUiOiJJcDRuZHgiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzFjNDA4MWM4ZjRmY2RjODE5Y2VjZDZmOTRmM2ViZmFiZTBkMDMxMTVkZjJjNjYyODIwYTdhZWJhODljMmUifX19", "qHvPSsGfSDapqJlLxk1BQb2cVFbjggbDbQWCaHkzpfCx7yTojSR29ywqg0F5rLabZ7Q13wG7l2CUkdCsK4urO1qx2MpSK3iVL/mG2x2O3m3Hg7FUU6fcaupP9T8V36n8HNag5uM3lbtnzoNmhwuCS6EbzRbgk5cL38jRwPod4Bxea/UKOBFmrl506Y2pjg0gi3nZVHPmnweNC3kV8FwmHHfFUt2T6QrvULKANLfxTYmIJj9jrG5CZ3oGQj6vnHo0iA5NpMpUYAqLSKrAV2GTVZ8U7SEcTkUgLkXfd7UnNKGWVoH93LUtRyti71fwtx5q591xfqdbRiMQZBz5r5U0kUg9HrCuz8nUaCX4ox9vPJp3TktlRT8cqRyadm+bqVHPccnS0Wt/7HTMC85X1VhB+5EawHdx8umkky404mEJbPcWZZlXfbsDchASMq2tgfeZZufgJX/DY/qyVz8L1Pmp9IXuqnzvV2CaUwjKtyc8gd6ZrOGOmYovhth/IgvRUaChB248Wwh2qe3sQz0PYxAuFMP0D3mf8ctLFmVyR3bPKtxJYW6vrLiZ8a6lg1houf/pQMF4q5HQSzW7Nbic7gR766TXgy5dRxavyToPRuFkCnI3EQwmleeYg88pazcGRWGOEueAM1/4dbNjNsAoif8fCSI3/1UT7lgvcCAinDJe6AE=");
+ public static final SkinData ORANGE = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjU4OTA3MDMsInByb2ZpbGVJZCI6ImNhYjI4ODVkMTUxNjQ1OTNhZmI2MDkwODJlOTE2NmU3IiwicHJvZmlsZU5hbWUiOiJGYW5jeV9MdWR3aWciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzU5ZTNlMGUxOTZjY2I3MjRhMjI1NzRmYzdjNjdhNmM2OGVlNDIwZjE3ZWM5MzI3YTUyNjYxZDcyNGQ5OGU1YzcifX19", "Bjj4N79wGgpPDV4oBDtB6B2dva3gN6pP+siJ9r309oJ1LXqPB9kbBIe7bquTKXAJgrNWuK2phASVoFdvJUbc7pazpk5h2ZDdPqWCnP8H7Oq2BtRpCJuvOnINZFGURzkdhbrfnvgoN7WEm3MsdZ6I702ZHrC15rVwTvimKV0bD3kq5W18nYZL446SxdBqKilK1Uly4582ZuEajZ3xsJfdVohPFNDKKu5z3HWPkcPu6jIi4/ACMsxSk7SYic3ZnwN+ULgHAoWymfcta3zmHeNDqYn+68iJRE1+WYHvkXlrO3gdgDqWD2MIyDCvFkLPuPZ/W93zr6V+WAXpH1Pgh6+Sw24EiIKnHR1paCo7eJI+1c4BlYgAwctj36pyRHh7N8Po5GSi7vQKrzoMLoBBJqRVKK5gbIVOWxBBKnhK+q2va5ZVoYPhBb808i4HA538dLk3qeAhVKX/x0uyAGtKgIKa4OlxcBk40LKQ1a/NnC7vOSB6lWLE1PiVoZ8yhe2pJQKy+7nztWehrO1g0IcwLYZSjraAiZ17Zx1fFHYp+4qnjncYewvGDXrcIofG7EEpSCNzY/HsagykPZMyPPSDcwuDZHI08JIPTRkwXTzae2BDggkF4d6PxyLryZE3BnG7lSb6yMKYvsDqpkhuqsUPI4put1DKJEFx+hIlT0I5kVI3rQc=");
+ public static final SkinData STRAWBERRY = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjU4NjE1MTEsInByb2ZpbGVJZCI6ImFkMWM2Yjk1YTA5ODRmNTE4MWJhOTgyMzY0OTllM2JkIiwicHJvZmlsZU5hbWUiOiJGdXJrYW5iejAwIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS82NmE4ZDlmM2YxOWNmZDZlZGNmNzFjOWM0ZjNhZDA5OGYzZTk1OWE5OTBkNjEyZjQ5YzI1MTgxNzM1M2JjYmUxIn19fQ==", "wxroo0ThDSb1B69kNyZsdtpg5qPxjWSt+LX3hg3KvgxziiNhMVmsLVks6+yz2vaeHPDyqckFO+eaVyb1wCuczFCOxLCKBHVhhBFKEbaF5NZTS0HOK6fvY6jxxETX93TmANgWm9MzrcVMGKvBck/gOI40+kxcVJKUg0Jb3yGQcuY820thGB95qznHDLIbnnTaB3mJr4yog2intDOqSF7I0fnd5U0Qceaor2u0WWiXaVr+SKvA8D9xvOfrc+IGYV55EHuQu1o3fl5qfK1mBASG9xWACCyTdoOkt06MsJCTxxo60ZE1nnL5m3a27XJ5HeiVNKjjrMOqlTfieBN8H0sWxfzMJ5gjFmGjxq6qhnAjn8Gr/SyhDbnTHILOTbh/V8XdZCwqYD7XI/3///LyPCEfoLmPsFnMd9M8V3DIiDJ3GvD8qTQd54vYHnUw6yR/mA6ONx1OxHBHprIaP5urq9MNIljg2PtVtOzSWypObpf3kR+ZhUC0t8hqiapsLAvpzkb7FO12db0Hwr+4NIbZQ8ZYTe0ds2Zb8Iq1BMWOZ16ffwnDnaqulhQN+nIAA+61Q4k5y2sa60lmvr23yX3AV3Ywop13k1Gvc/amrA+ni66i5ezXMa4+V22fUEAqb+VrEF6IMg4Vac50HIbvIpM1QaWP4fqoHE5lHjCRwmqGjEL9WXQ=");
+ public static final SkinData PINEAPPLE = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjU5Mjc3OTMsInByb2ZpbGVJZCI6ImJiMDgwOTFhOTJlZDQzYWQ5NGYxZWRmZDc0NmIwYTJjIiwicHJvZmlsZU5hbWUiOiJJcDRuZHgiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMjVlYmI5NmE3YWYzZTg3ZThiNmNhOWE4YzE5ZTllOWVlZDgxYjU4Y2RhZWUzNTIyMTg2NTc0YzgyN2Y0In19fQ==", "wrrEvFHwXhSivSnSN1VbXwjfZ7JrdizB4kAGCpOgYu090M087cJUoWan5KfjMN4N9DjmxmWt6M/yE25+47iu3grzaxnsIAUY+b7HzYzk1nrII3R9LLRbOF6cr6ug2c9scQ1wTsWHpul8y5U/vNekTN8+rRBBurmzUR+50M/wXh+mVFhVFtI2QFwDOZZWz4Tz/mPqGiRAtfT1UcPmGS9d5qETqWQlOAbtdlhuYQADNKSf3pIizRvbJKrEtDI6+deqzzGj35L7LdnsOO+k0qFz5m75AdbOty0l11ID1XGXf604iOocvNk/mO4oO+C7Na2jdwazgd7TJ0H+7qAz2suXflco+ALGcRJob3ysBleHBY2l1IpCWH6SPQG+mQvyOfi356dS4HM/QnPBswLJZ+q7rpkAyW8nArLP49/s+ou0PRs75EiFM61xzFoQRt1fLhx7X+IP2QYy7KIMWw5oRJvLKedu2bDTilMq5lyj6o7I7mfKIou8+O4P30eOwBFTPpjPe3BLMws7/Muwqh4TeSdTIuEkTca8qxb8RUv136DJkmkMJTYiZg7kNHLRL0oP8Hz1o8sCX9w6MElyHeRv/h+sE6PHP3zApjr3+wAun6CFBnLvtVcOA5/zvYQcNbzN2sdwWf7V+djN5Eqq78FduhK1MqiYXpJq9pM/cM3beM1rXE4=");
+ public static final SkinData GREEN_APPLE = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjU4MTM1MzIsInByb2ZpbGVJZCI6ImE5MGI4MmIwNzE4NTQ0ZjU5YmE1MTZkMGY2Nzk2NDkwIiwicHJvZmlsZU5hbWUiOiJJbUZhdFRCSCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjY3OGNmNjAzOTg2ZTM4NDcwNjkyZjgwYWJlNDE4ZjM5YTJjYWQ3N2Q4Nzc4YWY4NTc0NmU5MTkzMzdjZmQ2In19fQ==", "xAm3i+xi9OynV2uaqdF0VTws0qCsH3SP3zeEa5gUZejbhzXA7/i4JZC2+Ag9ULj4AaTbZhc1mFMB9+XAozmrWr+BEQjaD8/sbyQIirzUAk/X6ZTCKkp7Xk46mFlKjd4IVvoUSopCa/HCTRZTugjqJrPbdy232/UVC9JBShAcMq7pD7rmH5+O/vVtMcrtT8MjY95vnlhyXyNpDwYhCW9YlmZcG5fS5nPaq8k8mCaNe/fILVf2T/hQqqMTuZiqQk53L+5C8aiU4nySrGATB3UK1OwVTB7t3gen4MQtUT0ursOKoLLbxWboQWjsFYOxycfDeccOcB50iHfqCW8UmARt8mUT17RfWQvwIqlv1uThdnKsFZjx3LAodPAzcqyIoyR8EbCEeV82pDtYG5X7gT/pV/inYDgrLT7ZmONRk2x1TzTC3PicKNXu40OcOU63yaB/nvQY3FURNVCpvWXwPD1QyZBYfKtO4no1/TfPoZPcdGz9E1Xor74AlDAUJTlGQ5+OlQldJiwHvmPxTPJKdgOJLXRVUHcFLV32VtWnmrBRq9pm3qO3MTEVytB4XVaGmsf3zqcwrVur910CpPxDjyXqe1NvxN2I/43FAQInL3iX/NqOpwsx7alSIUe3ZhdqP6l8SSTDK0Sp+1GtvGrvRiX/8dStDfAsNCN0HxvxQQUVM2w=");
+ public static final SkinData PLUM = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjQyMzY0NjMsInByb2ZpbGVJZCI6IjBiZTU2MmUxNzIyODQ3YmQ5MDY3MWYxNzNjNjA5NmNhIiwicHJvZmlsZU5hbWUiOiJ4Y29vbHgzIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWIzZjU5NzlhNWVhMGI4MmM4NTUyNmZkYjg0ZjI2YTY4YmY1YTI1NDQ5YzRiNTk2NWU5Y2IxYzQ5NDM5YWY0In19fQ==", "jC6e7Cy7wGmvqSUjIYXwPXQZjAVxnOMoST+IKy/m/g4uklandxhBT9HJskBI+rtVjz67psyLmY941gAtqIbLkRxEhAeT/Qc3iRMV9MN7Ac7b3UaQsnO5gnY3IBZZxSTJhX8oxyTXD+c9k4lsjladzxXA3DcmEn0Cqp0t0oFQA5mEYpa1qGB6NCoXvi5deXNID3PQJjj+PLkohoLKhsDEqbYb3djwGTDKWYGFAwuF7KnA3cuPXa5KN6sPbM7qdjnF3Gke9bkinTn8F7cXVxEpcqAxiUyv8Wv/umHRaEBuDf9yxrDaberkRQu+YIqK6fw805QwcxQePiG/qMU9yZAOuPoolp/SUROHF69pjN9lI8O5Vs08f/K3rSIpgyU16K+lUmE1XIPukUBjNsK2mRTLfJgv8csilzS5jWmVzjr859l0Inr51tGtfQ3VEyUJtIowcOh9GfZWTvaYeDnyGhRUaEpPOmCo1QLIbedAbq51+gYykeQMTmRc+joxxN9SBlF252d7ncOcVAChHxmcFWbPbhV2lMfSTxGmKAx1T9dmw22Z0WTM0NkMG7EsG7wFz1U8f0OY4lyrtVUM7Oy8pc8RuRPhOgQGAvuhA58k6DLgmOpMOVBuEkoOFpZaJKWgVMQI+u9g6COC7WRTF/Z3EW//BFQ09L+uSAPaeyD8rzFqbCo=");
+
// 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
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
index 7af6ab2dd..07a2058c5 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
@@ -1025,14 +1025,15 @@ public class UtilEnt
}
// Nicer than doing entity.getMetadata(key).get(0);
- public static Object GetMetadata(Entity entity, String key)
+ @SuppressWarnings("unchecked")
+ public static T GetMetadata(Entity entity, String key)
{
if (!entity.hasMetadata(key))
{
return null;
}
- return entity.getMetadata(key).get(0).value();
+ return (T) entity.getMetadata(key).get(0).value();
}
public static void removeMetadata(Entity entity, String key)
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 a87bb2565..cc58f5d0d 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
@@ -418,4 +418,22 @@ public class UtilParticle
PlayParticleToAll(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist);
}
+ public static void playColoredParticle(java.awt.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(java.awt.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/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java
index 63b55feab..5fa174eea 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
@@ -9,6 +9,7 @@ import mineplex.serverdata.Region;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.Sound;
+import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -43,14 +44,7 @@ public class UtilServer
public static List getSortedPlayers()
{
- return getSortedPlayers(new Comparator()
- {
- @Override
- public int compare(Player o1, Player o2)
- {
- return o1.getName().compareTo(o2.getName());
- }
- });
+ return getSortedPlayers(Comparator.comparing(HumanEntity::getName));
}
public static List getSortedPlayers(Comparator comparator)
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
index d4e48144f..e5ea8f1af 100644
--- 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
@@ -1,70 +1,1124 @@
package mineplex.core.common.util.banner;
import org.bukkit.DyeColor;
+import org.bukkit.Material;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.BannerMeta;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.bukkit.DyeColor.*;
+import static org.bukkit.block.banner.PatternType.*;
+
+/**
+ * Banner patterns for country (and related) flags.
+ */
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));
+ MINEPLEX("Mineplex", "Mineplex", BLACK,
+ new Pattern(ORANGE, TRIANGLE_TOP),
+ new Pattern(BLACK, TRIANGLES_TOP),
+ new Pattern(ORANGE, STRIPE_LEFT),
+ new Pattern(ORANGE, STRIPE_RIGHT),
+ new Pattern(BLACK, BORDER),
+ new Pattern(BLACK, STRIPE_BOTTOM)),
- private DyeColor _baseColor;
- private Pattern[] _patterns;
+ AFGHANISTAN("Afghanistan", "Afghanistani", RED,
+ new Pattern(BLACK, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_BOTTOM),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
- CountryFlag(DyeColor baseColor, Pattern... patterns){
+ ALBANIA("Albania", "Albanian", RED,
+ new Pattern(BLACK, FLOWER),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(RED, BORDER),
+ new Pattern(RED, STRIPE_SMALL),
+ new Pattern(BLACK, CIRCLE_MIDDLE)),
+
+ ALGERIA("Algeria", "Algerian", GREEN,
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(WHITE, TRIANGLE_BOTTOM)),
+
+ ANGOLA("Angola", "Angolan", RED,
+ new Pattern(BLACK, HALF_VERTICAL),
+ new Pattern(YELLOW, FLOWER),
+ new Pattern(BLACK, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_RIGHT)),
+
+ ARGENTINA("Argentina", "Argentinian", WHITE,
+ new Pattern(LIGHT_BLUE, STRIPE_LEFT),
+ new Pattern(LIGHT_BLUE, STRIPE_RIGHT),
+ new Pattern(YELLOW, CIRCLE_MIDDLE)),
+
+ ARMENIA("Armenia", "Armenian", RED,
+ new Pattern(ORANGE, HALF_VERTICAL),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER)),
+
+ AUSTRALIA("Australia", "Australian", WHITE,
+ new Pattern(BLUE, CROSS),
+ new Pattern(BLUE, STRAIGHT_CROSS),
+ new Pattern(BLUE, CURLY_BORDER),
+ new Pattern(RED, SQUARE_TOP_RIGHT)),
+
+ AUSTRIA("Austria", "Austrian", RED,
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER)),
+
+ AZERBAIJAN("Azerbaijan", "Azerbaijani", RED,
+ new Pattern(WHITE, FLOWER),
+ new Pattern(WHITE, FLOWER),
+ new Pattern(WHITE, FLOWER),
+ new Pattern(RED, DIAGONAL_LEFT_MIRROR),
+ new Pattern(RED, DIAGONAL_RIGHT_MIRROR),
+ new Pattern(LIGHT_BLUE, STRIPE_RIGHT),
+ new Pattern(GREEN, STRIPE_LEFT)),
+
+ BAHRAIN("Bahrain", "Bahraini", RED,
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP)),
+
+ BANGLADESH("Bangladesh", "Bangladeshi", GREEN,
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ BELARUS("Belarus", "Belarusian", RED,
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(WHITE, TRIANGLES_TOP)),
+
+ BELGIUM("Belgium", "Belgian", YELLOW,
+ new Pattern(BLACK, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ BERMUDA("Bermuda", "Bermudian", BLUE,
+ new Pattern(WHITE, BRICKS),
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, STRIPE_MIDDLE)),
+
+ BHUTAN("Bhutan", "Bhutanese", YELLOW,
+ new Pattern(ORANGE, DIAGONAL_LEFT_MIRROR),
+ new Pattern(WHITE, RHOMBUS_MIDDLE)),
+
+ BOLIVIA("Bolivia", "Bolivian", RED,
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(LIGHT_BLUE, CIRCLE_MIDDLE),
+ new Pattern(LIGHT_BLUE, CIRCLE_MIDDLE),
+ new Pattern(LIGHT_BLUE, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ BOSNIA_AND_HERZEGOVINA("Bosnia and Herzegovina", "Bosnia and Herzegovinian", BLUE,
+ new Pattern(WHITE, STRIPE_DOWNLEFT),
+ new Pattern(BLUE, BRICKS),
+ new Pattern(YELLOW, DIAGONAL_RIGHT),
+ new Pattern(BLUE, STRIPE_BOTTOM)),
+
+ BRAZIL("Brazil", "Brazilian", LIME,
+ new Pattern(YELLOW, RHOMBUS_MIDDLE),
+ new Pattern(YELLOW, RHOMBUS_MIDDLE),
+ new Pattern(YELLOW, RHOMBUS_MIDDLE),
+ new Pattern(BLUE, CIRCLE_MIDDLE),
+ new Pattern(BLUE, CIRCLE_MIDDLE)),
+
+ BRUNEI("Brunei", "Bruneian", YELLOW,
+ new Pattern(WHITE, STRIPE_DOWNLEFT),
+ new Pattern(WHITE, STRIPE_DOWNLEFT),
+ new Pattern(WHITE, STRIPE_DOWNLEFT),
+ new Pattern(BLACK, CROSS),
+ new Pattern(YELLOW, DIAGONAL_LEFT),
+ new Pattern(YELLOW, SQUARE_BOTTOM_RIGHT),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ BULGARIA("Bulgaria", "Bulgarian", WHITE,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(GREEN, STRIPE_CENTER),
+ new Pattern(GREEN, STRIPE_CENTER),
+ new Pattern(GREEN, STRIPE_CENTER)),
+
+ CAMBODIA("Cambodia", "Cambodian", RED,
+ new Pattern(WHITE, FLOWER),
+ new Pattern(BLUE, STRIPE_LEFT),
+ new Pattern(BLUE, STRIPE_RIGHT)),
+
+ CAMEROON("Cameroon", "Cameroonian", RED,
+ new Pattern(YELLOW, CIRCLE_MIDDLE),
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(YELLOW, STRIPE_BOTTOM)),
+
+ CANADA("Canada", "Canadian", WHITE,
+ new Pattern(RED, CROSS),
+ new Pattern(WHITE, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_MIDDLE),
+ new Pattern(WHITE, BORDER),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ CHILE("Chile", "Chilean", BLUE,
+ new Pattern(WHITE, CROSS),
+ new Pattern(BLUE, TRIANGLES_TOP),
+ new Pattern(BLUE, RHOMBUS_MIDDLE),
+ new Pattern(BLUE, BORDER),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(RED, HALF_VERTICAL)),
+
+ CHINA("China", "Chinese", RED,
+ new Pattern(YELLOW, SQUARE_TOP_RIGHT),
+ new Pattern(RED, PatternType.STRIPE_SMALL),
+ new Pattern(RED, BORDER),
+ new Pattern(RED, BRICKS)),
+
+ COLOMBIA("Colombia", "Colombian", RED,
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(YELLOW, HALF_VERTICAL_MIRROR)),
+
+ COSTA_RICA("Costa Rica", "Costa Rican", WHITE,
+ new Pattern(BLUE, STRIPE_SMALL),
+ new Pattern(BLUE, STRIPE_SMALL),
+ new Pattern(BLUE, STRIPE_SMALL),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER)),
+
+ CROATIA("Croatia", "Croatian", RED,
+ new Pattern(WHITE, FLOWER),
+ new Pattern(BLUE, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ CUBA("Cuba", "Cuban", BLUE,
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(RED, TRIANGLE_TOP)),
+
+ CYPRUS("Cyprus", "Cyprus", WHITE,
+ new Pattern(ORANGE, FLOWER),
+ new Pattern(ORANGE, FLOWER),
+ new Pattern(ORANGE, FLOWER),
+ new Pattern(ORANGE, CIRCLE_MIDDLE),
+ new Pattern(WHITE, DIAGONAL_LEFT_MIRROR),
+ new Pattern(WHITE, CURLY_BORDER),
+ new Pattern(WHITE, CURLY_BORDER),
+ new Pattern(WHITE, CURLY_BORDER)),
+
+ CZECH_REPUBLIC("Czech Republic", "Czech Republic", true, WHITE,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(BLUE, TRIANGLE_TOP)),
+
+ DENMARK("Denmark", "Danish", WHITE,
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, STRIPE_CENTER)),
+
+ DOMINICAN_REPUBLIC("Dominican Republic", "Dominican", true, WHITE,
+ new Pattern(BLUE, SQUARE_TOP_RIGHT),
+ new Pattern(BLUE, SQUARE_BOTTOM_LEFT),
+ new Pattern(RED, SQUARE_TOP_LEFT),
+ new Pattern(RED, SQUARE_BOTTOM_RIGHT),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(GREEN, CIRCLE_MIDDLE)),
+
+ ECUADOR("Ecuador", "Ecuadorian", RED,
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(YELLOW, HALF_VERTICAL_MIRROR),
+ new Pattern(LIGHT_BLUE, CIRCLE_MIDDLE)),
+
+ EGYPT("Egypt", "Egyptian", WHITE,
+ new Pattern(YELLOW, CIRCLE_MIDDLE),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(BLACK, STRIPE_LEFT)),
+
+ EL_SALVADOR("El Salvador", "El Salvadorian", BLUE,
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(GREEN, CIRCLE_MIDDLE)),
+
+ ENGLAND("England", "English", WHITE,
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(RED, STRAIGHT_CROSS)),
+
+ ESTONIA("Estonia", "Estonian", BLUE,
+ new Pattern(WHITE, HALF_VERTICAL),
+ new Pattern(BLACK, STRIPE_CENTER),
+ new Pattern(BLACK, STRIPE_CENTER),
+ new Pattern(BLACK, STRIPE_CENTER)),
+
+ ETHIOPIA("Ethiopia", "Ethiopian", GREEN,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(BLUE, CIRCLE_MIDDLE),
+ new Pattern(BLUE, CIRCLE_MIDDLE),
+ new Pattern(BLUE, CIRCLE_MIDDLE)),
+
+ EU("European Union", "European Union", true, BLUE,
+ new Pattern(YELLOW, CROSS),
+ new Pattern(YELLOW, STRIPE_MIDDLE),
+ new Pattern(BLUE, BORDER),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, STRIPE_BOTTOM),
+ new Pattern(BLUE, CIRCLE_MIDDLE)),
+
+ FAROE_ISLANDS("Faroe Islands", "Faroese", true, RED,
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER)),
+
+ FINLAND("Finland", "Finnish", BLUE,
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, STRIPE_CENTER)),
+
+ FRANCE("France", "French", WHITE,
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ GABON("Gabon", "Gabonese", GREEN,
+ new Pattern(BLUE, HALF_VERTICAL),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER)),
+
+ GEORGIA("Georgia", "Georgian", WHITE,
+ new Pattern(RED, TRIANGLES_TOP),
+ new Pattern(RED, TRIANGLES_TOP),
+ new Pattern(RED, TRIANGLES_TOP),
+ new Pattern(RED, TRIANGLES_BOTTOM),
+ new Pattern(RED, TRIANGLES_BOTTOM),
+ new Pattern(RED, TRIANGLES_BOTTOM),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(RED, STRAIGHT_CROSS)),
+
+ GERMANY("Germany", "German", BLACK,
+ new Pattern(YELLOW, HALF_VERTICAL),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER)),
+
+ GHANA("Ghana", "Ghanaian", YELLOW,
+ new Pattern(BLACK, CROSS),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(GREEN, STRIPE_LEFT)),
+
+ GREECE("Greece", "Greek", BLUE,
+ new Pattern(BLUE, HALF_VERTICAL),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(BLUE, SQUARE_TOP_RIGHT)),
+
+ GUATEMALA("Guatemala", "Guatemalan", WHITE,
+ new Pattern(LIGHT_BLUE, STRIPE_TOP),
+ new Pattern(LIGHT_BLUE, STRIPE_BOTTOM),
+ new Pattern(GREEN, CIRCLE_MIDDLE)),
+
+ HONDURAS("Honduras", "Honduran", WHITE,
+ new Pattern(BLUE, FLOWER),
+ new Pattern(WHITE, STRIPE_LEFT),
+ new Pattern(WHITE, STRIPE_LEFT),
+ new Pattern(WHITE, STRIPE_LEFT),
+ new Pattern(WHITE, STRIPE_RIGHT),
+ new Pattern(WHITE, STRIPE_RIGHT),
+ new Pattern(WHITE, STRIPE_RIGHT),
+ new Pattern(WHITE, STRAIGHT_CROSS),
+ new Pattern(WHITE, STRAIGHT_CROSS),
+ new Pattern(WHITE, STRAIGHT_CROSS),
+ new Pattern(BLUE, STRIPE_LEFT),
+ new Pattern(BLUE, STRIPE_RIGHT)),
+
+ HONG_KONG("Hong Kong", "Hong Kongese", RED,
+ new Pattern(WHITE, FLOWER)),
+
+ HUNGARY("Hungary", "Hungarian", RED,
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER)),
+
+ ICELAND("Iceland", "Icelandic", RED,
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER)),
+
+ INDIA("India", "Indian", WHITE,
+ new Pattern(ORANGE, STRIPE_LEFT),
+ new Pattern(GREEN, STRIPE_RIGHT),
+ new Pattern(BLUE, CIRCLE_MIDDLE)),
+
+ INDONESIA("Indonesia", "Indonesian", WHITE,
+ new Pattern(RED, HALF_VERTICAL_MIRROR)),
+
+ IRAN("Iran", "Iranian", WHITE,
+ new Pattern(GREEN, STRIPE_RIGHT),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(BLACK, CIRCLE_MIDDLE),
+ new Pattern(BLACK, CIRCLE_MIDDLE),
+ new Pattern(BLACK, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ IRAQ("Iraq", "Iraqi", WHITE,
+ new Pattern(GREEN, FLOWER),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(BLACK, STRIPE_LEFT)),
+
+ IRELAND("Ireland", "Irish", WHITE,
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(ORANGE, STRIPE_BOTTOM)),
+
+ ISLE_OF_MAN("Isle of Man", "Isle of Man", true, RED,
+ new Pattern(WHITE, SKULL),
+ new Pattern(WHITE, FLOWER),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_RIGHT)),
+
+ ISRAEL("Israel", "Israeli", WHITE,
+ new Pattern(BLUE, STRIPE_LEFT),
+ new Pattern(BLUE, STRIPE_RIGHT),
+ new Pattern(BLUE, FLOWER)),
+
+ ITALY("Italy", "Italian", WHITE,
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ IVORY_COAST("Ivory Coast", "Ivory Coast", true, WHITE,
+ new Pattern(ORANGE, STRIPE_TOP),
+ new Pattern(ORANGE, STRIPE_TOP),
+ new Pattern(ORANGE, STRIPE_TOP),
+ new Pattern(LIME, STRIPE_BOTTOM),
+ new Pattern(LIME, STRIPE_BOTTOM),
+ new Pattern(LIME, STRIPE_BOTTOM)),
+
+ JAMAICA("Jamaica", "Jamaican", GREEN,
+ new Pattern(YELLOW, STRIPE_DOWNLEFT),
+ new Pattern(YELLOW, STRIPE_DOWNLEFT),
+ new Pattern(YELLOW, STRIPE_DOWNLEFT),
+ new Pattern(YELLOW, STRIPE_DOWNRIGHT),
+ new Pattern(YELLOW, STRIPE_DOWNRIGHT),
+ new Pattern(YELLOW, STRIPE_DOWNRIGHT),
+ new Pattern(BLACK, TRIANGLE_TOP),
+ new Pattern(BLACK, TRIANGLE_BOTTOM)),
+
+ JAPAN("Japan", "Japanese", WHITE,
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ JORDAN("Jordan", "Jordanian", BLACK,
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(RED, TRIANGLE_TOP),
+ new Pattern(RED, TRIANGLE_TOP),
+ new Pattern(RED, TRIANGLE_TOP)),
+
+ KAZAKHSTAN("Kazakhstan", "Kazakhstani", LIGHT_BLUE,
+ new Pattern(YELLOW, CREEPER),
+ new Pattern(LIGHT_BLUE, HALF_VERTICAL),
+ new Pattern(YELLOW, TRIANGLES_TOP)),
+
+ KENYA("Kenya", "Kenyan", WHITE,
+ new Pattern(BLACK, STRIPE_RIGHT),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(WHITE, FLOWER),
+ new Pattern(BLACK, CIRCLE_MIDDLE),
+ new Pattern(BLACK, CIRCLE_MIDDLE),
+ new Pattern(BLACK, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ KUWAIT("Kuwait", "Kuwaiti", GREEN,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(BLACK, TRIANGLE_TOP),
+ new Pattern(WHITE, CIRCLE_MIDDLE)),
+
+ KYRGYZSTAN("Kyrgyzstan", "Kyrgyzstani", RED,
+ new Pattern(YELLOW, CIRCLE_MIDDLE)),
+
+ LATVIA("Latvia", "Latvian", RED,
+ new Pattern(WHITE, STRIPE_CENTER)),
+
+ LEBANON("Lebanon", "Lebanese", WHITE,
+ new Pattern(GREEN, FLOWER),
+ new Pattern(GREEN, FLOWER),
+ new Pattern(GREEN, FLOWER),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(GREEN, CIRCLE_MIDDLE)),
+
+ LIBYA("Libya", "Libyan", BLACK,
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(BLACK, FLOWER),
+ new Pattern(BLACK, TRIANGLE_TOP),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(GREEN, STRIPE_LEFT)),
+
+ LITHUANIA("Lithuania", "Lithuanian", YELLOW,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(GREEN, STRIPE_CENTER),
+ new Pattern(GREEN, STRIPE_CENTER),
+ new Pattern(GREEN, STRIPE_CENTER)),
+
+ LUXEMBOURG("Luxembourg", "Luxembourg", RED,
+ new Pattern(LIGHT_BLUE, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER)),
+
+ MACAU("Macau", "Macau", GREEN,
+ new Pattern(YELLOW, BRICKS),
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(WHITE, FLOWER),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(GREEN, STRIPE_RIGHT),
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_BOTTOM)),
+
+ MACEDONIA("Macedonia", "Macedonian", RED,
+ new Pattern(YELLOW, CROSS),
+ new Pattern(YELLOW, STRAIGHT_CROSS),
+ new Pattern(RED, RHOMBUS_MIDDLE),
+ new Pattern(YELLOW, CIRCLE_MIDDLE)),
+
+ MALAYSIA("Malaysia", "Malaysian", RED,
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(BLUE, SQUARE_TOP_RIGHT),
+ new Pattern(YELLOW, TRIANGLES_TOP)),
+
+ MALTA("Malta", "Maltese", WHITE,
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(GRAY, SQUARE_TOP_RIGHT),
+ new Pattern(WHITE, SQUARE_TOP_RIGHT)),
+
+ MEXICO("Mexico", "Mexican", WHITE,
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(BROWN, CIRCLE_MIDDLE),
+ new Pattern(BROWN, CIRCLE_MIDDLE),
+ new Pattern(YELLOW, CIRCLE_MIDDLE)),
+
+ MOLDOVA("Moldova", "Moldovan", YELLOW,
+ new Pattern(BROWN, CIRCLE_MIDDLE),
+ new Pattern(YELLOW, STRIPE_LEFT),
+ new Pattern(YELLOW, STRIPE_RIGHT),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ MONGOLIA("Mongolia", "Mongolian", BLUE,
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(YELLOW, TRIANGLES_TOP)),
+
+ MONTENEGRO("Montenegro", "Montenegrin", RED,
+ new Pattern(YELLOW, FLOWER),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(YELLOW, BORDER)),
+
+ MOROCCO("Morocco", "Moroccan", RED,
+ new Pattern(GREEN, CROSS),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ MOZAMBIQUE("Mozambique", "Mozambique", WHITE,
+ new Pattern(CYAN, STRIPE_RIGHT),
+ new Pattern(YELLOW, STRIPE_LEFT),
+ new Pattern(BLACK, STRIPE_CENTER),
+ new Pattern(RED, TRIANGLE_TOP)),
+
+ NEPAL("Nepal", "Nepali", RED,
+ new Pattern(BLUE, BORDER),
+ new Pattern(BLUE, BORDER),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(RED, FLOWER)),
+
+ NETHERLANDS("Netherlands", "Dutch", true, WHITE,
+ new Pattern(RED, PatternType.STRIPE_RIGHT),
+ new Pattern(RED, PatternType.STRIPE_RIGHT),
+ new Pattern(BLUE, PatternType.STRIPE_LEFT),
+ new Pattern(BLUE, PatternType.STRIPE_LEFT)),
+
+ NEW_ZEALAND("New Zealand", "New Zealand", RED,
+ new Pattern(BLUE, CROSS),
+ new Pattern(BLUE, STRAIGHT_CROSS),
+ new Pattern(BLUE, CURLY_BORDER),
+ new Pattern(WHITE, SQUARE_TOP_RIGHT)),
+
+ NIGERIA("Nigeria", "Nigerian", WHITE,
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_BOTTOM)),
+
+ NORWAY("Norway", "Norwegian", BLUE,
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER)),
+
+ OMAN("Oman", "Omani", WHITE,
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(RED, TRIANGLES_TOP),
+ new Pattern(RED, SQUARE_TOP_LEFT)),
+
+ PAKISTAN("Pakistan", "Pakistani", GREEN,
+ new Pattern(WHITE, FLOWER),
+ new Pattern(GREEN, TRIANGLE_BOTTOM),
+ new Pattern(GREEN, TRIANGLE_BOTTOM),
+ new Pattern(GREEN, TRIANGLE_BOTTOM),
+ new Pattern(GREEN, BORDER),
+ new Pattern(GREEN, BORDER),
+ new Pattern(GREEN, BORDER),
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_BOTTOM),
+ new Pattern(GREEN, STRIPE_BOTTOM),
+ new Pattern(GREEN, STRIPE_BOTTOM),
+ new Pattern(WHITE, STRIPE_TOP)),
+
+ PANAMA("Panama", "Panamanian", WHITE,
+ new Pattern(BLUE, SQUARE_TOP_RIGHT),
+ new Pattern(RED, SQUARE_BOTTOM_LEFT),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, CURLY_BORDER),
+ new Pattern(RED, SQUARE_BOTTOM_RIGHT),
+ new Pattern(BLUE, SQUARE_TOP_LEFT)),
+
+ PARAGUAY("Paraguay", "Paraguayan", RED,
+ new Pattern(BLUE, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE)),
+
+ PERU("Peru", "Peruvian", WHITE,
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(YELLOW, CIRCLE_MIDDLE),
+ new Pattern(YELLOW, CIRCLE_MIDDLE),
+ new Pattern(YELLOW, CIRCLE_MIDDLE),
+ new Pattern(GREEN, CIRCLE_MIDDLE)),
+
+ PHILIPPINES("Philippines", "Philippine", true, BLUE,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(WHITE, TRIANGLE_TOP)),
+
+ POLAND("Poland", "Polish", WHITE,
+ new Pattern(RED, HALF_VERTICAL)),
+
+ PORTUGAL("Portugal", "Portuguese", RED,
+ new Pattern(GREEN, STRIPE_BOTTOM),
+ new Pattern(YELLOW, CREEPER),
+ new Pattern(YELLOW, SKULL),
+ new Pattern(RED, HALF_HORIZONTAL)),
+
+ PUERTO_RICO("Puerto Rico", "Puerto Rican", RED,
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(BLUE, TRIANGLE_TOP)),
+
+ QATAR("Qatar", "Qatari", RED,
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, TRIANGLES_TOP)),
+
+ ROMANIA("Romania", "Romanian", YELLOW,
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ RUSSIA("Germany", "German", WHITE,
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER)),
+
+ RWANDA("Rwanda", "Rwandan", LIGHT_BLUE,
+ new Pattern(YELLOW, TRIANGLES_TOP),
+ new Pattern(LIGHT_BLUE, BORDER),
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER),
+ new Pattern(YELLOW, STRIPE_CENTER)),
+
+ SAUDI_ARABIA("Saudi Arabia", "Saudi Arabian", GREEN,
+ new Pattern(WHITE, SKULL),
+ new Pattern(WHITE, MOJANG),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(GREEN, STRIPE_CENTER),
+ new Pattern(GREEN, BORDER)),
+
+ SCOTLAND("Scotland", "Scottish", BLUE,
+ new Pattern(WHITE, CROSS),
+ new Pattern(WHITE, CROSS)),
+
+ SENEGAL("Senegal", "Senegalese", YELLOW,
+ new Pattern(GREEN, CROSS),
+ new Pattern(YELLOW, STRIPE_BOTTOM),
+ new Pattern(YELLOW, STRIPE_BOTTOM),
+ new Pattern(YELLOW, STRIPE_TOP),
+ new Pattern(YELLOW, STRIPE_TOP),
+ new Pattern(YELLOW, STRIPE_TOP),
+ new Pattern(GREEN, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ SERBIA("Serbia", "Serbian", RED,
+ new Pattern(WHITE, HALF_VERTICAL),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(RED, CIRCLE_MIDDLE),
+ new Pattern(WHITE, CIRCLE_MIDDLE)),
+
+ SINGAPORE("Singapore", "Singaporean", RED,
+ new Pattern(WHITE, FLOWER),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(WHITE, HALF_VERTICAL)),
+
+ SLOVAKIA("Slovakia", "Slovakian", BLUE,
+ new Pattern(RED, SKULL),
+ new Pattern(WHITE, BRICKS),
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(WHITE, STRIPE_RIGHT),
+ new Pattern(WHITE, STRIPE_RIGHT),
+ new Pattern(WHITE, STRIPE_RIGHT),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_LEFT)),
+
+ SLOVENIA("Slovenia", "Slovenian", WHITE,
+ new Pattern(BLUE, CROSS),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER)),
+
+ SOLOMON_ISLANDS("Solomon Islands", "Solomon Islands", true, BLUE,
+ new Pattern(WHITE, BRICKS),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(BLUE, BORDER),
+ new Pattern(BLUE, CURLY_BORDER),
+ new Pattern(BLUE, RHOMBUS_MIDDLE),
+ new Pattern(BLUE, HALF_VERTICAL),
+ new Pattern(GREEN, DIAGONAL_LEFT_MIRROR),
+ new Pattern(BLACK, STRIPE_DOWNRIGHT),
+ new Pattern(BLACK, STRIPE_DOWNRIGHT)),
+
+ SOMALIA("Somalia", "Somalian", LIGHT_BLUE,
+ new Pattern(WHITE, CROSS),
+ new Pattern(LIGHT_BLUE, STRIPE_TOP),
+ new Pattern(LIGHT_BLUE, STRIPE_BOTTOM)),
+
+ SOUTH_AFRICA("South Africa", "South African", WHITE,
+ new Pattern(GREEN, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(YELLOW, TRIANGLE_TOP),
+ new Pattern(YELLOW, TRIANGLE_TOP),
+ new Pattern(YELLOW, TRIANGLE_TOP),
+ new Pattern(BLACK, TRIANGLE_TOP)),
+
+ SOUTH_KOREA("South Korea", "South Korean", RED,
+ new Pattern(BLUE, DIAGONAL_LEFT_MIRROR),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, CURLY_BORDER),
+ new Pattern(WHITE, STRIPE_BOTTOM),
+ new Pattern(BLACK, TRIANGLES_TOP),
+ new Pattern(BLACK, TRIANGLES_TOP),
+ new Pattern(BLACK, TRIANGLES_TOP),
+ new Pattern(BLACK, TRIANGLES_BOTTOM),
+ new Pattern(BLACK, TRIANGLES_BOTTOM),
+ new Pattern(BLACK, TRIANGLES_BOTTOM),
+ new Pattern(WHITE, TRIANGLES_BOTTOM),
+ new Pattern(WHITE, TRIANGLES_TOP),
+ new Pattern(WHITE, BORDER),
+ new Pattern(WHITE, BORDER)),
+
+ SOUTH_SUDAN("South Sudan", "South Sudanese", WHITE,
+ new Pattern(BLACK, STRIPE_RIGHT),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_CENTER),
+ new Pattern(BLUE, TRIANGLE_TOP)),
+
+ SPAIN("Spain", "Spanish", YELLOW,
+ new Pattern(BROWN, FLOWER),
+ new Pattern(YELLOW, HALF_HORIZONTAL_MIRROR)),
+
+ SRI_LANKA("Sri Lanka", "Sri Lankan", RED,
+ new Pattern(YELLOW, STRIPE_MIDDLE),
+ new Pattern(YELLOW, CREEPER),
+ new Pattern(ORANGE, HALF_HORIZONTAL),
+ new Pattern(LIME, STRIPE_TOP),
+ new Pattern(YELLOW, BORDER)),
+
+ SUDAN("Sudan", "Sudanese", RED,
+ new Pattern(BLACK, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(GREEN, TRIANGLE_TOP)),
+
+ SURINAME("Suriname", "Surinamese", WHITE,
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(YELLOW, FLOWER),
+ new Pattern(YELLOW, SKULL),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(GREEN, STRIPE_RIGHT)),
+
+ SWEDEN("Sweden", "Swedish", YELLOW,
+ new Pattern(BLUE, STRIPE_TOP),
+ new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
+ new Pattern(YELLOW, STRIPE_CENTER)),
+
+ SWITZERLAND("Switzerland", "Swiss", RED,
+ new Pattern(WHITE, STRAIGHT_CROSS),
+ new Pattern(WHITE, STRAIGHT_CROSS),
+ new Pattern(WHITE, STRAIGHT_CROSS),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(RED, STRIPE_BOTTOM),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, BORDER),
+ new Pattern(RED, BORDER),
+ new Pattern(RED, BORDER)),
+
+ SYRIA("Syria", "Syrian", WHITE,
+ new Pattern(GREEN, FLOWER),
+ new Pattern(GREEN, FLOWER),
+ new Pattern(GREEN, FLOWER),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(RED, STRIPE_RIGHT),
+ new Pattern(BLACK, STRIPE_LEFT),
+ new Pattern(BLACK, STRIPE_LEFT),
+ new Pattern(BLACK, STRIPE_LEFT)),
+
+ TAIWAN("Taiwan", "Taiwanese", BLUE,
+ new Pattern(WHITE, CROSS),
+ new Pattern(BLUE, CURLY_BORDER),
+ new Pattern(BLUE, FLOWER),
+ new Pattern(BLUE, CIRCLE_MIDDLE),
+ new Pattern(BLUE, RHOMBUS_MIDDLE),
+ new Pattern(RED, HALF_VERTICAL),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR),
+ new Pattern(RED, HALF_HORIZONTAL_MIRROR)),
+
+ TAJIKISTAN("Tajikistan", "Tajikistani", WHITE,
+ new Pattern(YELLOW, CROSS),
+ new Pattern(WHITE, STRIPE_TOP),
+ new Pattern(WHITE, STRIPE_BOTTOM),
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_RIGHT)),
+
+ TANZANIA("Tanzania", "Tanzanian", LIGHT_BLUE,
+ new Pattern(LIME, DIAGONAL_RIGHT),
+ new Pattern(YELLOW, STRIPE_DOWNRIGHT),
+ new Pattern(YELLOW, STRIPE_DOWNRIGHT),
+ new Pattern(YELLOW, STRIPE_DOWNRIGHT)),
+
+ THAILAND("Thailand", "Thai", WHITE,
+ new Pattern(RED, STRIPE_SMALL),
+ new Pattern(RED, STRIPE_SMALL),
+ new Pattern(RED, STRIPE_SMALL),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER),
+ new Pattern(BLUE, STRIPE_CENTER)),
+
+ TUNISIA("Tunisia", "Tunisian", RED,
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(RED, FLOWER),
+ new Pattern(RED, TRIANGLE_BOTTOM)),
+
+ TURKEY("Turkey", "Turkish", RED,
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(RED, FLOWER),
+ new Pattern(RED, TRIANGLE_BOTTOM)),
+
+ UAE("United Arab Emirates", "United Arab Emirates", true, GREEN,
+ new Pattern(BLACK, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_TOP)),
+
+ UGANDA("Uganda", "Ugandan", RED,
+ new Pattern(BLACK, STRIPE_LEFT),
+ new Pattern(BLACK, STRIPE_RIGHT),
+ new Pattern(YELLOW, STRIPE_SMALL),
+ new Pattern(RED, BORDER)),
+
+ UK("United Kingdom", "British", true, BLUE,
+ new Pattern(WHITE, STRIPE_DOWNLEFT),
+ new Pattern(WHITE, STRIPE_DOWNLEFT),
+ new Pattern(WHITE, STRIPE_DOWNRIGHT),
+ new Pattern(WHITE, STRIPE_DOWNRIGHT),
+ new Pattern(RED, CROSS),
+ new Pattern(RED, CROSS),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(WHITE, STRIPE_MIDDLE),
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(RED, STRAIGHT_CROSS),
+ new Pattern(RED, STRAIGHT_CROSS)),
+
+ UKRAINE("Ukraine", "Ukrainian", BLUE,
+ new Pattern(YELLOW, HALF_VERTICAL)),
+
+ URUGUAY("Uruguay", "Uruguayan", WHITE,
+ new Pattern(BLUE, STRIPE_SMALL),
+ new Pattern(YELLOW, SQUARE_TOP_RIGHT)),
+
+ USA("United States of America", "American", true, RED,
+ new Pattern(WHITE, STRIPE_SMALL),
+ new Pattern(BLUE, SQUARE_TOP_RIGHT),
+ new Pattern(BLUE, SQUARE_TOP_RIGHT),
+ new Pattern(BLUE, SQUARE_TOP_RIGHT)),
+
+ UZBEKISTAN("Uzbekistan", "Uzbekistani", RED,
+ new Pattern(GREEN, STRIPE_LEFT),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(LIGHT_BLUE, STRIPE_RIGHT)),
+
+ VENEZUELA("Venezuela", "Venezuelan", BLUE,
+ new Pattern(WHITE, CIRCLE_MIDDLE),
+ new Pattern(BLUE, STRAIGHT_CROSS),
+ new Pattern(YELLOW, STRIPE_RIGHT),
+ new Pattern(YELLOW, STRIPE_RIGHT),
+ new Pattern(YELLOW, STRIPE_RIGHT),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_LEFT),
+ new Pattern(RED, STRIPE_LEFT)),
+
+ VIETNAM("Vietnam", "Vietnamese", RED,
+ new Pattern(YELLOW, CROSS),
+ new Pattern(RED, STRIPE_TOP),
+ new Pattern(RED, STRIPE_BOTTOM)),
+
+ WALES("Wales", "Welsh", WHITE,
+ new Pattern(GREEN, HALF_VERTICAL),
+ new Pattern(RED, MOJANG),
+ new Pattern(RED, MOJANG),
+ new Pattern(RED, SKULL)),
+
+ YEMEN("Yemen", "Yemeni", RED,
+ new Pattern(BLACK, HALF_VERTICAL),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER),
+ new Pattern(WHITE, STRIPE_CENTER)),
+
+ ZAMBIA("Zambia", "Zambian", LIME,
+ new Pattern(YELLOW, FLOWER),
+ new Pattern(RED, STRIPE_MIDDLE),
+ new Pattern(BLACK, HALF_HORIZONTAL_MIRROR),
+ new Pattern(ORANGE, STRIPE_BOTTOM)),
+
+ ZIMBABWE("Zimbabwe", "Zimbabwean", RED,
+ new Pattern(BLACK, STRAIGHT_CROSS),
+ new Pattern(YELLOW, STRIPE_LEFT),
+ new Pattern(YELLOW, STRIPE_RIGHT),
+ new Pattern(GREEN, BORDER),
+ new Pattern(WHITE, TRIANGLE_TOP)),
+
+ ;
+
+ private final boolean _article;
+ private final String _country;
+ private final String _adjective;
+ private final DyeColor _baseColor;
+ private final Pattern[] _patterns;
+
+ /**
+ * Create a country flag banner.
+ *
+ * @param country Country name.
+ * @param adjective Country name as an adjective.
+ * @param baseColor base color of the banner.
+ * @param patterns List of patterns to apply to the banner.
+ */
+ CountryFlag(String country, String adjective, DyeColor baseColor, Pattern... patterns)
+ {
+ this(country, adjective, false, baseColor, patterns);
+ }
+
+ /**
+ * Create a country flag banner for a country with a name often preceded with "The".
+ *
+ * @param country Country name.
+ * @param adjective Country name as an adjective.
+ * @param article Whether the country name should be preceded with "The".
+ * @param baseColor base color of the banner.
+ * @param patterns List of patterns to apply to the banner.
+ */
+ CountryFlag(String country, String adjective, boolean article, DyeColor baseColor, Pattern... patterns)
+ {
+ _country = country;
+ _adjective = adjective;
+ _article = article;
_baseColor = baseColor;
_patterns = patterns;
}
+ /**
+ * @return a flag banner item.
+ */
public ItemStack getBanner()
{
- return UtilBanner.createBanner(_baseColor, _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;
+ }
+
+ /**
+ * @return the name of the country.
+ */
+ public String getCountryName()
+ {
+ return (_article ? "The " : "") + _country;
+ }
+
+ /**
+ * @return the name of the country without a possible article before the country name.
+ */
+ public String getCountryNameRaw()
+ {
+ return _country;
+ }
+
+ /**
+ * @return the name of the country written in an adjectival manner.
+ */
+ public String getCountryAdjective()
+ {
+ return _adjective;
+ }
+
+ /**
+ * @return the banner color.
+ */
+ public DyeColor getBaseColor()
+ {
+ return _baseColor;
+ }
+
+ /**
+ * @return the patterns applied to the banner.
+ */
+ public List getPatterns()
+ {
+ return Arrays.asList(_patterns);
}
}
diff --git a/Plugins/Mineplex.Core/pom.xml b/Plugins/Mineplex.Core/pom.xml
index 50bfe79f3..b89d67002 100644
--- a/Plugins/Mineplex.Core/pom.xml
+++ b/Plugins/Mineplex.Core/pom.xml
@@ -48,7 +48,7 @@
com.mineplex
anticheat
- 1.5
+ 1.6
org.tukaani
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java
index 379dc217d..71c935918 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java
@@ -45,7 +45,7 @@ public class CoreClient
public UUID getUniqueId()
{
- return this._uuid;
+ return _uuid;
}
public String getName()
@@ -134,20 +134,20 @@ public class CoreClient
public void undisguise()
{
- this._disguisedName = null;
- this._disguisedSkin = null;
- this._disguisedRank = null;
- this._disguisedUUID = null;
+ _disguisedName = null;
+ _disguisedSkin = null;
+ _disguisedRank = null;
+ _disguisedUUID = null;
}
public String getDisguisedAs()
{
- return this._disguisedName;
+ return _disguisedName;
}
public String getDisguisedSkin()
{
- return this._disguisedSkin;
+ return _disguisedSkin;
}
public Rank getDisguisedRank()
@@ -157,32 +157,32 @@ public class CoreClient
public UUID getDisguisedAsUUID()
{
- return this._disguisedUUID;
+ return _disguisedUUID;
}
public boolean isDisguised()
{
- if (this._disguisedName == null)
+ if (_disguisedName == null)
{
return false;
}
- return !this._name.equalsIgnoreCase(this._disguisedName);
+ return !_name.equalsIgnoreCase(_disguisedName);
}
public void disguise(String name, UUID uuid, Rank rank)
{
- this._disguisedName = name;
- this._disguisedUUID = uuid;
- this._disguisedRank = rank;
+ _disguisedName = name;
+ _disguisedUUID = uuid;
+ _disguisedRank = rank;
}
public Rank getRealOrDisguisedRank()
{
- if (this._disguisedRank != null)
+ if (_disguisedRank != null)
{
- return this._disguisedRank;
+ return _disguisedRank;
}
- return this.GetRank();
+ return GetRank();
}
public void setNetworkSessionLoginTime(long loginTime)
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
index ba8c69ffa..da9f6343f 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
@@ -92,7 +92,7 @@ public class UpdateRank extends CommandBase
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
Plugin.Get(p).resetTemp();
- OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
+ OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, false);
Plugin.Get(p).SetRank(rank, false);
Bukkit.getPluginManager().callEvent(event);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
index 0b392ed76..670007c27 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
@@ -462,6 +462,15 @@ public enum Achievement
new String[]{"Novice I", "Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"},
AchievementCategory.CASTLE_ASSAULT),
+ CASTLE_ASSAULT_ALCHEMIST_KIT("Alchemist", 0,
+ new String[]{"Castle Assault.AlchemistKitKills", "Castle Assault TDM.AlchemistKitKills"},
+ new String[]{"Kill opponents while wearing the Alchemist Kit"},
+ new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}},
+ new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000},
+ "Initiate",
+ new String[]{"Novice I", "Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"},
+ AchievementCategory.CASTLE_ASSAULT),
+
CASTLE_ASSAULT_WINNER("Assault", 0,
new String[]{"Castle Assault.Wins", "Castle Assault TDM.Wins"},
new String[]{"Win games of Castle Assault"},
@@ -1226,7 +1235,62 @@ public enum Achievement
new String[]{"Gem Hunters.ChestsOpened"},
new String[]{"+1 for each chest opened"},
new int[]{50,100,200,400,1000},
- AchievementCategory.GEM_HUNTERS);
+ AchievementCategory.GEM_HUNTERS),
+
+ MOBA_GOLD_EARNED("Gold Farmer", 0,
+ new String[]{"Heroes of GWEN.GoldEarned"},
+ new String[]{"Earn Gold"},
+ new int[][] {new int[] {0,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
+ new int[]{100000,500000,1000000,2500000,5000000},
+ "I",
+ new String[] {"II","III","IV","V","X"},
+ AchievementCategory.MOBA),
+
+ MOBA_KILLS("Champion Slayer", 0,
+ new String[]{"Heroes of GWEN.Kills"},
+ new String[]{"Kill players"},
+ new int[][] {new int[] {0,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
+ new int[]{100,250,500,1000,5000},
+ "I",
+ new String[] {"II","III","IV","V","X"},
+ AchievementCategory.MOBA),
+
+ MOBA_WINS_ASSASSIN("Assassin Victor", 0,
+ new String[]{"Heroes of GWEN.Assassin.Wins"},
+ new String[]{"Win Games as an Assassin"},
+ new int[][] {new int[] {0,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
+ new int[]{10,50,100,250,500},
+ "I",
+ new String[] {"II","III","IV","V","X"},
+ AchievementCategory.MOBA),
+
+ MOBA_WINS_HUNTER("Hunter Victor", 0,
+ new String[]{"Heroes of GWEN.Hunter.Wins"},
+ new String[]{"Win Games as a Hunter"},
+ new int[][] {new int[] {0,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
+ new int[]{10,50,100,250,500},
+ "I",
+ new String[] {"II","III","IV","V","X"},
+ AchievementCategory.MOBA),
+
+ MOBA_WINS_MAGE("Mage Victor", 0,
+ new String[]{"Heroes of GWEN.Mage.Wins"},
+ new String[]{"Win Games as a Mage"},
+ new int[][] {new int[] {0,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
+ new int[]{10,50,100,250,500},
+ "I",
+ new String[] {"II","III","IV","V","X"},
+ AchievementCategory.MOBA),
+
+ MOBA_WINS_WARRIOR("Warrior Victor", 0,
+ new String[]{"Heroes of GWEN.Warrior.Wins"},
+ new String[]{"Win Games as a Warrior"},
+ new int[][] {new int[] {0,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
+ new int[]{10,50,100,250,500},
+ "I",
+ new String[] {"II","III","IV","V","X"},
+ AchievementCategory.MOBA),
+ ;
private String _name;
private String[] _desc;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java
index 885bf7939..fd7adbe9b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java
@@ -43,7 +43,7 @@ public enum AchievementCategory
StatDisplay.fromGame("Wins", GameDisplay.SkywarsTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkywarsTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SkywarsTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkywarsTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SkywarsTeams, "GemsEarned") },
- Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit", false, GameDisplay.Skywars.getGameId(), GameDisplay.SkywarsTeams.getGameId()),
+ Material.FEATHER, 0, GameCategory.SURVIVAL, "Earth Kit", false, GameDisplay.Skywars.getGameId(), GameDisplay.SkywarsTeams.getGameId()),
UHC("Ultra Hardcore", null,
new StatDisplay[] {
@@ -220,7 +220,7 @@ public enum AchievementCategory
Material.EMERALD, 0, GameCategory.SURVIVAL, null, false, GameDisplay.GemHunters.getGameId()),
MOBA("Heroes of GWEN", null,
- new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, StatDisplay.fromGame("Gold Earned", GameDisplay.MOBA, "GoldEarned")},
+ new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, StatDisplay.fromGame("Gold Earned", GameDisplay.MOBA, "GoldEarned")},
Material.PRISMARINE_SHARD, 0, GameCategory.CLASSICS, null, false, GameDisplay.MOBA.getGameId());
private String _name;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java
index 3915059e8..d68117cf7 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java
@@ -31,7 +31,7 @@ import mineplex.core.stats.StatsManager;
public class AchievementPage extends ShopPageBase
{
- private static int ACHIEVEMENT_MIDDLE_INDEX = 31;
+ private static final int ACHIEVEMENT_MIDDLE_INDEX = 31;
private AchievementCategory _category;
private StatsManager _statsManager;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
index 97cdfe07c..e3a6df469 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
@@ -1,6 +1,5 @@
package mineplex.core.antihack;
-import javax.xml.bind.DatatypeConverter;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
@@ -10,11 +9,7 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
-import net.md_5.bungee.api.ChatColor;
-import net.md_5.bungee.api.chat.BaseComponent;
-import net.md_5.bungee.api.chat.ClickEvent;
-import net.md_5.bungee.api.chat.ComponentBuilder;
-import net.md_5.bungee.api.chat.HoverEvent;
+import javax.xml.bind.DatatypeConverter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -48,6 +43,7 @@ import com.mineplex.anticheat.checks.combat.KillauraTypeF;
import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll;
import com.mineplex.anticheat.checks.move.Speed;
+import com.mineplex.anticheat.checks.move.Timer;
import com.mineplex.anticheat.checks.move.Toggle;
import com.mineplex.anticheat.checks.player.BadPackets;
@@ -76,6 +72,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilTime;
import mineplex.core.preferences.Preference;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.punish.Category;
@@ -84,11 +81,16 @@ import mineplex.core.punish.PunishClient;
import mineplex.core.punish.Punishment;
import mineplex.core.punish.PunishmentResponse;
import mineplex.serverdata.commands.ServerCommandManager;
+import net.md_5.bungee.api.ChatColor;
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.api.chat.ClickEvent;
+import net.md_5.bungee.api.chat.ComponentBuilder;
+import net.md_5.bungee.api.chat.HoverEvent;
@ReflectivelyCreateMiniPlugin
public class AntiHack extends MiniPlugin
{
- private static final Map, CheckThresholds> CHECKS = ImmutableMap., CheckThresholds>builder()
+ public static final Map, CheckThresholds> CHECKS = ImmutableMap., CheckThresholds>builder()
.put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 25, 45, 60))
.put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE))
.put(KillauraTypeC.class, new CheckThresholds("Reach", 25, Integer.MAX_VALUE, Integer.MAX_VALUE))
@@ -100,11 +102,12 @@ public class AntiHack extends MiniPlugin
.put(Speed.class, new CheckThresholds("Speed", 1000, 2000, 3500))
.put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 1000))
.put(Toggle.class, new CheckThresholds("AutoSneak", 100, 200, 300))
+ .put(Timer.class, new CheckThresholds("Timer", 1000, 2000, 3000))
.build();
private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
- private static final Map, AntiHackAction> ACTIONS = ImmutableMap., AntiHackAction>builder()
+ public static final Map, AntiHackAction> ACTIONS = ImmutableMap., AntiHackAction>builder()
.put(KillauraTypeA.class, new ImmediateBanAction(200))
.put(KillauraTypeD.class, new BanwaveAction(1500))
.put(KillauraTypeF.class, new BanwaveAction(600))
@@ -112,6 +115,7 @@ public class AntiHack extends MiniPlugin
.put(Speed.class, new ImmediateBanAction(10000))
.put(HeadRoll.class, new ImmediateBanAction(2000))
.put(Toggle.class, new ImmediateBanAction(500))
+ .put(Timer.class, new ImmediateBanAction(15000))
.put(BadPackets.class, new GEPBanAction(300))
.put(KillauraTypeB.class, new GEPBanAction(100))
.build();
@@ -158,7 +162,7 @@ public class AntiHack extends MiniPlugin
require(GuardianManager.class);
_banWaveManager = require(BanWaveManager.class);
- Bukkit.getServicesManager().register(MineplexLink.class, new MineplexLinkImpl(), this._plugin, ServicePriority.Normal);
+ Bukkit.getServicesManager().register(MineplexLink.class, new MineplexLinkImpl(), _plugin, ServicePriority.Normal);
ServerCommandManager.getInstance().registerCommandType(MajorViolationCommand.class, violation ->
{
@@ -167,9 +171,13 @@ public class AntiHack extends MiniPlugin
for (Player player : Bukkit.getOnlinePlayers())
{
if (_detailedMessages.contains(player.getName()))
+ {
player.spigot().sendMessage(detailed);
+ }
else if (_clientManager.Get(player).GetRank().has(Rank.HELPER) && (violation.getOriginatingServer().equals(_thisServer) || _preferences.get(player).isActive(Preference.GLOBAL_GWEN_REPORTS)))
+ {
player.spigot().sendMessage(minimal);
+ }
}
});
@@ -222,12 +230,19 @@ public class AntiHack extends MiniPlugin
{
Consumer> doPunish = after ->
{
- runAsync(() ->
- {
- new GwenBanNotification(_thisServer, player.getName(), player.getUniqueId().toString(), coreClient.GetRank().name(), CheckManager.getCheckSimpleName(cause), id, gep).publish();
- });
+ runAsync(() ->
+ {
+ new GwenBanNotification(_thisServer, player.getName(), player.getUniqueId().toString(), coreClient.GetRank().name(), CheckManager.getCheckSimpleName(cause), id, gep).publish();
+ });
- _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, hoursBanned, true, after);
+ _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, hoursBanned, true, after);
+ if (UtilServer.getGroup().equals("Clans"))
+ {
+ _punish.getClansPunish().loadClient(coreClient.getUniqueId(), client ->
+ {
+ _punish.getClansPunish().ban(client, null, AntiHack.NAME, UtilTime.convert(90L, UtilTime.TimeUnit.DAYS, UtilTime.TimeUnit.MILLISECONDS), ChatColor.stripColor(finalMessage).replace("\n", ""), null, ban -> {});
+ });
+ }
};
if (coreClient.GetRank().has(Rank.TWITCH))
@@ -241,17 +256,18 @@ public class AntiHack extends MiniPlugin
else
{
runBanAnimation(player, () ->
- doPunish.accept(result ->
+ {
+ doPunish.accept(result ->
+ {
+ if (result == PunishmentResponse.Punished)
{
- if (result == PunishmentResponse.Punished)
- {
- announceBan(player);
- _banned.add(player.getUniqueId());
- _banWaveManager.flagDone(coreClient);
- }
- _pendingBan.remove(player);
- })
- );
+ announceBan(player);
+ _banned.add(player.getUniqueId());
+ _banWaveManager.flagDone(coreClient);
+ }
+ _pendingBan.remove(player);
+ });
+ });
}
}, custom);
}
@@ -266,14 +282,21 @@ public class AntiHack extends MiniPlugin
Consumer> doPunish = after ->
{
- _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getHoursBanned(player), true, after);
+ final int hoursBanned = getHoursBanned(player);
+ _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, hoursBanned, true, after);
+ String[] serverSplit = info.getServer().split("-");
+ if (serverSplit.length > 0 && serverSplit[0].equals("Clans"))
+ {
+ _punish.getClansPunish().loadClient(coreClient.getUniqueId(), client ->
+ {
+ _punish.getClansPunish().ban(client, null, AntiHack.NAME, UtilTime.convert(90L, UtilTime.TimeUnit.DAYS, UtilTime.TimeUnit.MILLISECONDS), ChatColor.stripColor(info.getMessage()).replace("\n", ""), null, ban -> {});
+ });
+ }
};
if (coreClient.GetRank().has(Rank.TWITCH))
{
- doPunish.accept(response ->
- {
- });
+ doPunish.accept(response -> {});
}
else
{
@@ -332,14 +355,18 @@ public class AntiHack extends MiniPlugin
public void on(EntityDamageEvent event)
{
if (_pendingBan.contains(event.getEntity()))
+ {
event.setCancelled(true);
+ }
}
@EventHandler(priority = EventPriority.LOWEST)
public void on(EntityDamageByEntityEvent event)
{
if (_pendingBan.contains(event.getDamager()))
+ {
event.setCancelled(true);
+ }
}
public int getPunishments(Player player)
@@ -414,7 +441,9 @@ public class AntiHack extends MiniPlugin
}
if (_ignoredChecks.contains(event.getCheckClass()))
+ {
return;
+ }
ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event);
@@ -434,7 +463,7 @@ public class AntiHack extends MiniPlugin
MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage());
ServerCommandManager.getInstance().publishCommand(command);
- this._cooldown.put(key, event.getViolations());
+ _cooldown.put(key, event.getViolations());
}
}
@@ -525,6 +554,6 @@ public class AntiHack extends MiniPlugin
public void setStrict(boolean strict)
{
- this._strict = strict;
+ _strict = strict;
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveInfo.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveInfo.java
index 2c471cd07..d9ff6e428 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveInfo.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveInfo.java
@@ -116,4 +116,4 @@ public class BanWaveInfo
{
return Objects.hash(_accountId, _timeToBan, _hackType, _message, _vl, _server);
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java
index 7123a383c..9c56787e6 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java
@@ -62,7 +62,7 @@ public class BanWaveManager extends MiniPlugin
CoreClient client = _clientManager.Get(player);
- if (this._repository.insertBanWaveInfo(client.getAccountId(), timeToBan, CheckManager.getCheckSimpleName(checkClass), newMessage, vl, server))
+ if (_repository.insertBanWaveInfo(client.getAccountId(), timeToBan, CheckManager.getCheckSimpleName(checkClass), newMessage, vl, server))
{
runAsync(() ->
{
@@ -81,4 +81,4 @@ public class BanWaveManager extends MiniPlugin
{
_repository.flagDone(client.getAccountId());
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java
index 087b68d3c..721abb330 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java
@@ -5,7 +5,6 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import mineplex.core.common.util.UtilTasks;
-import mineplex.core.database.MinecraftRepository;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
@@ -45,4 +44,4 @@ public class AnticheatDatabase extends RepositoryBase
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java
index dc015a66a..9ae46926e 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java
@@ -20,4 +20,4 @@ public abstract class AnticheatMetadata implements Listener
public abstract JsonElement build(UUID player);
public abstract void remove(UUID player);
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java
index 5b56687d8..6d0be3f48 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java
@@ -28,7 +28,12 @@ public class PartyInfoMetadata extends AnticheatMetadata
@Override
public JsonElement build(UUID player)
{
- Party party = require(PartyManager.class).getPartyByPlayer(player);
+ PartyManager pm = require(PartyManager.class);
+ if (pm == null)
+ {
+ return JsonNull.INSTANCE;
+ }
+ Party party = pm.getPartyByPlayer(player);
if (party != null)
{
JsonObject partyData = new JsonObject();
@@ -52,4 +57,4 @@ public class PartyInfoMetadata extends AnticheatMetadata
{
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java
index 479db70d2..509561a76 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java
@@ -48,4 +48,4 @@ public class PlayerInfoMetadata extends AnticheatMetadata
{
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java
index 7376a6d3e..2b838a9cc 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java
@@ -35,4 +35,4 @@ public class ServerInfoMetadata extends AnticheatMetadata
{
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java
index da2ee4278..69685a46c 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java
@@ -9,6 +9,7 @@ import java.util.UUID;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
@@ -49,6 +50,8 @@ public class ViolationInfoMetadata extends AnticheatMetadata
private static final String KEY_Z = "z";
private static final String KEY_YAW = "yaw";
private static final String KEY_PITCH = "pitch";
+ private static final String KEY_PING = "ping";
+ private static final String KEY_SERVER_TPS = "server-tps";
private static final JsonObject VAL_CHECK_DISABLED;
@@ -143,12 +146,14 @@ public class ViolationInfoMetadata extends AnticheatMetadata
location.addProperty(KEY_PITCH, MUTABLE_LOCATION.getPitch());
playerInfo.add(KEY_LOCATION, location);
+ playerInfo.addProperty(KEY_PING, Math.min(((CraftPlayer) event.getPlayer()).getHandle().ping, 1000));
JsonObject data = new JsonObject();
data.add(KEY_CURRENT_TIME, currentTime);
data.add(KEY_VIOLATION_INFO, violationInfo);
data.add(KEY_PLAYER_INFO, playerInfo);
+ data.addProperty(KEY_SERVER_TPS, MinecraftServer.getServer().recentTps[0]);
violations.add(data);
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java
index 2bdd967f5..ef84b512f 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java
@@ -149,7 +149,6 @@ public class BonusManager extends MiniClientPlugin implements I
private int _visualTick;
private ArrayList _voteList;
- private List> _youtubers;
private String _creeperName;
@@ -182,18 +181,8 @@ public class BonusManager extends MiniClientPlugin implements I
{
_voteList.add("http://vote1.mineplex.com");
_voteList.add("http://vote2.mineplex.com");
- _voteList.add("http://vote3.mineplex.com");
}
- _youtubers = new ArrayList<>();
- if (!ClansBonus)
- {
- _youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
- _youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
- _youtubers.add(Pair.create("RustyDawgT", "https://www.youtube.com/user/RustyDawgT?sub_confirmation=1"));
- }
- _youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
-
_creeperName = "Carl";
updateOffSet();
@@ -240,18 +229,8 @@ public class BonusManager extends MiniClientPlugin implements I
{
_voteList.add("http://vote1.mineplex.com");
_voteList.add("http://vote2.mineplex.com");
- _voteList.add("http://vote3.mineplex.com");
}
_canVote = true;
-
- _youtubers = new ArrayList<>();
- if (!ClansBonus)
- {
- _youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
- _youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
- _youtubers.add(Pair.create("RustyDawgT", "https://www.youtube.com/user/RustyDawgT?sub_confirmation=1"));
- }
- _youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
if (npcManager != null)
{
@@ -1005,7 +984,6 @@ public class BonusManager extends MiniClientPlugin implements I
if (canVote(player)) availableRewards++;
if (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) availableRewards++;
if (_youtubeManager.canYoutube(player)) availableRewards++;
- if (_youtubeManager.canSpecificYoutube(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++;
@@ -1165,7 +1143,7 @@ public class BonusManager extends MiniClientPlugin implements I
{
if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false))
{
- if (_pollManager.hasPoll(player) || canVote(player) || _youtubeManager.canSpecificYoutube(player) || _youtubeManager.canYoutube(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
+ if (_pollManager.hasPoll(player) || canVote(player) || _youtubeManager.canYoutube(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
{
if (_showCarl.containsKey(player.getName()))
{
@@ -1186,23 +1164,6 @@ public class BonusManager extends MiniClientPlugin implements I
int index = date % _voteList.size();
return _voteList.get(index);
}
-
- public Pair getSpecificCreator()
- {
- long sqlTime = getSqlTime();
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(sqlTime);
- int date = calendar.get(Calendar.DAY_OF_YEAR);
- if (_youtubers.size() >= 1)
- {
- int index = date % _youtubers.size();
- return _youtubers.get(index);
- }
- else
- {
- return Pair.create("MineplexGames", "http://youtube.com/mineplexgamesofficial?sub_confirmation=1");
- }
- }
/**
* Used for disabling rank rewards during first month of release
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 ea4c1a099..413816698 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java
@@ -12,7 +12,6 @@ import mineplex.core.bonuses.gui.buttons.PlayWireButton;
import mineplex.core.bonuses.gui.buttons.PollButton;
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
import mineplex.core.bonuses.gui.buttons.RankBonusButton;
-import mineplex.core.bonuses.gui.buttons.SpecificChannelButton;
import mineplex.core.bonuses.gui.buttons.TwitterButton;
import mineplex.core.bonuses.gui.buttons.VoteButton;
import mineplex.core.bonuses.gui.buttons.YoutubeButton;
@@ -33,10 +32,9 @@ public class BonusGui extends SimpleGui
private final int CLAIM_TIPS_SLOT = 30;
private final int POWER_PLAY_SLOT = 16;
private final int CARL_SPINNER_SLOT = 14;
- private final int YOUTUBE_SLOT = 22;
+ private final int YOUTUBE_SLOT = 24;
private final int TWITTER_SLOT = 34;
private final int PLAY_WIRE_SLOT = 32;
- private final int SPECIFIC_YOUTUBE_SLOT = 24;
private static final int INV_SIZE = 54;
@@ -65,8 +63,6 @@ public class BonusGui extends SimpleGui
setItem(CARL_SPINNER_SLOT, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
setItem(PLAY_WIRE_SLOT, new PlayWireButton(playWireManager, player));
-
- setItem(SPECIFIC_YOUTUBE_SLOT, new SpecificChannelButton(player, youtubeManager));
}
@Override
@@ -74,4 +70,4 @@ public class BonusGui extends SimpleGui
{
super.finalize();
}
-}
\ No newline at end of file
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java
index 1edafc35d..f04a6f2b3 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java
@@ -34,7 +34,7 @@ public class SpecificChannelButton implements GuiItem
@Override
public void setup()
{
- _channel = Managers.get(BonusManager.class).getSpecificCreator();
+ _channel = Pair.create("", "");
if (_youtubeManager.canSpecificYoutube(_player))
{
_item = new ItemBuilder(Material.APPLE)
@@ -111,4 +111,4 @@ public class SpecificChannelButton implements GuiItem
{
return _item;
}
-}
\ No newline at end of file
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java
index 63087f2f9..3949ff3fe 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java
@@ -377,7 +377,25 @@ public class Chat extends MiniPlugin
}
if (!event.isCancelled())
+ {
+ String oldMessage = event.getMessage();
+ if (!_clientManager.Get(sender).GetRank().has(Rank.ADMIN))
+ {
+ int capsCount = 0;
+ for (char c : oldMessage.toCharArray())
+ {
+ if (Character.isUpperCase(c))
+ {
+ capsCount++;
+ }
+ }
+ if (capsCount > 30)
+ {
+ event.setMessage(oldMessage.toLowerCase());
+ }
+ }
_playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage()));
+ }
for (Function filter : _lowPriorityFilters)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java
index 02709a26f..264fe539f 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java
@@ -63,7 +63,7 @@ public abstract class CommandBase implements ICom
public void setRequiredRank(Rank rank)
{
- this._requiredRank = rank;
+ _requiredRank = rank;
}
public Rank[] GetSpecificRanks()
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java
index d1ae7b491..7cb686de7 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java
@@ -1,5 +1,6 @@
package mineplex.core.cosmetic;
+import mineplex.core.punish.Punish;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -41,19 +42,23 @@ import mineplex.core.twofactor.TwoFactorAuth;
public class CosmeticManager extends MiniPlugin
{
private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class);
- private InventoryManager _inventoryManager;
- private GadgetManager _gadgetManager;
- private MountManager _mountManager;
- private PetManager _petManager;
- private TreasureManager _treasureManager;
- private BoosterManager _boosterManager;
+ private final InventoryManager _inventoryManager;
+ private final GadgetManager _gadgetManager;
+ private final MountManager _mountManager;
+ private final PetManager _petManager;
+ private final TreasureManager _treasureManager;
+ private final BoosterManager _boosterManager;
+ private final Punish _punish;
private CosmeticShop _shop;
private boolean _showInterface = true;
private int _interfaceSlot = 4;
- public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, TreasureManager treasureManager, BoosterManager boosterManager)
+ public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
+ InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager,
+ PetManager petManager, TreasureManager treasureManager, BoosterManager boosterManager,
+ Punish punish)
{
super("Cosmetic Manager", plugin);
@@ -63,6 +68,7 @@ public class CosmeticManager extends MiniPlugin
_petManager = petManager;
_treasureManager = treasureManager;
_boosterManager = boosterManager;
+ _punish = punish;
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName);
}
@@ -242,6 +248,11 @@ public class CosmeticManager extends MiniPlugin
{
return _boosterManager;
}
+
+ public Punish getPunishManager()
+ {
+ return _punish;
+ }
public void displayUI(Player player)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenFlags.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenFlags.java
new file mode 100644
index 000000000..d54ad3b10
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenFlags.java
@@ -0,0 +1,25 @@
+package mineplex.core.cosmetic.ui.button.open;
+
+import mineplex.core.cosmetic.ui.page.FlagPage;
+import mineplex.core.cosmetic.ui.page.HatPage;
+import mineplex.core.cosmetic.ui.page.Menu;
+import mineplex.core.gadget.types.Gadget;
+import org.bukkit.entity.Player;
+
+/**
+ * @author J Teissler
+ * @date 6/26/17
+ */
+public class OpenFlags extends OpenPageButton
+{
+ public OpenFlags(Menu menu, Gadget active)
+ {
+ super(menu, active);
+ }
+
+ @Override
+ protected void leftClick(Player player)
+ {
+ getMenu().getShop().openPageForPlayer(player, new FlagPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Flags - 1", 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 80db4bcd6..e4d1333f9 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
@@ -33,12 +33,16 @@ public class ArrowTrailPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ARROW_TRAIL) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
- if (slot == 17)
- slot += 2;
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/BalloonsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java
index fd0b3cf08..3208e5a05 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java
@@ -32,12 +32,16 @@ public class BalloonsPage extends GadgetPage
addGadget(gadget, slot);
if (gadget.isActive(getPlayer()))
+ {
addGlow(slot);
+ }
slot++;
- if (slot == 17 || slot == 26)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
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/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java
index 73af59a89..c1a606358 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
@@ -22,9 +22,6 @@ import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
-/**
- * Created by shaun on 14-09-15.
- */
public class CostumePage extends GadgetPage
{
public CostumePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
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 07dbee136..a54b7f840 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
@@ -33,12 +33,16 @@ public class DeathEffectPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DEATH) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
- if (slot == 17)
- slot += 2;
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/DoubleJumpPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java
index f9748cb06..8ecddc541 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
@@ -33,12 +33,16 @@ public class DoubleJumpPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DOUBLE_JUMP) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
-
- if (slot == 17)
- slot += 2;
+
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/FlagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/FlagPage.java
new file mode 100644
index 000000000..34009c2b7
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/FlagPage.java
@@ -0,0 +1,106 @@
+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;
+
+import java.util.List;
+
+public class FlagPage extends GadgetPage
+{
+ private int _page;
+
+ public FlagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
+ Player player)
+ {
+ this(plugin, shop, clientManager, donationManager, name, player, 0);
+ }
+
+ public FlagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
+ Player player, int page)
+ {
+ super(plugin, shop, clientManager, donationManager, name, player, false);
+ _page = page;
+ buildPage();
+ }
+
+ @Override
+ protected void buildPage()
+ {
+ // chose a beginning slot
+ int slot = 10;
+
+ // grab all flags
+ List list = getPlugin().getGadgetManager().getGadgets(GadgetType.FLAG);
+
+ if(list != null)
+ {
+ int size = list.size();
+ int limit = (_page + 1) * 28;
+
+ // loop through the flags for a specific page
+ for (int i = _page * 28; i < limit && i < size; ++i)
+ {
+ Gadget gadget = list.get(i);
+
+ addGadget(gadget, slot);
+
+ if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.FLAG) == gadget)
+ {
+ addGlow(slot);
+ }
+
+ slot++;
+
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
+ }
+
+ // back arrow
+ if (size > 28)
+ {
+ if (_page > 0)
+ {
+ addButton(45, new ShopItem(Material.ARROW, C.cGreen + "â—€ Previous Page (" + C.cWhite + _page + C.cGreen + ")", new String[]{}, 1, false),
+ (player, clickType) ->
+ {
+ FlagPage page = new FlagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Flags - " + (_page), player, _page - 1);
+ getShop().openPageForPlayer(player, page);
+ });
+ }
+
+ // next arrow
+ if (_page < (size - 1) / 28)
+ {
+ addButton(53, new ShopItem(Material.ARROW, C.cGreen + "(" + C.cWhite + (_page + 2) + C.cGreen + ") Next Page â–º", new String[]{}, 1, false),
+ (player, clickType) ->
+ {
+ FlagPage page = new FlagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Flags - " + (_page + 2), player, _page + 1);
+ getShop().openPageForPlayer(player, page);
+
+
+ });
+ }
+ }
+ }
+
+ 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/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java
index 657d98b30..913844276 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
@@ -12,7 +12,6 @@ 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;
@@ -21,7 +20,6 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
-import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.GadgetButton;
@@ -42,10 +40,18 @@ import mineplex.core.shop.page.ShopPageBase;
public class GadgetPage extends ShopPageBase
{
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
+ {
+ this(plugin, shop, clientManager, donationManager, name, player, true);
+ }
+
+ public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, boolean build)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
- buildPage();
+ if (build)
+ {
+ buildPage();
+ }
}
protected void buildPage()
@@ -60,12 +66,16 @@ public class GadgetPage extends ShopPageBase
addGadget(gadget, slot);
if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getDisplayName()) > 0)
+ {
addGlow(slot);
+ }
slot++;
- if (slot == 17 || slot == 26)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
@@ -366,19 +376,6 @@ public class GadgetPage extends ShopPageBase
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(GlobalCurrency.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
@@ -389,19 +386,6 @@ public class GadgetPage extends ShopPageBase
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(GlobalCurrency.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);
- }
- }
-
/*if (gadget instanceof MorphStray)
{
gadgetItemStack = UtilItem.getVersionSpecificItem(_player, UtilPlayer.PlayerVersion._1_9, gadgetItemStack);
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 37f472616..a21f31cea 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
@@ -38,12 +38,16 @@ public class HatPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.HAT) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
-
- if (slot == 17)
- slot += 2;
+
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/KitSelectorPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitSelectorPage.java
index 26b399783..6ce7f5ebd 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitSelectorPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitSelectorPage.java
@@ -31,12 +31,16 @@ public class KitSelectorPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.KIT_SELECTOR) == gadget)
+ {
addGlow(slot);
+ }
slot++;
- if (slot == 17 || slot == 26 || slot == 35)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
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/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java
index 8a27df36e..ab57f6835 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
@@ -5,6 +5,9 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Map;
+import mineplex.core.common.util.banner.CountryFlag;
+import mineplex.core.cosmetic.ui.button.open.OpenFlags;
+import mineplex.core.itemstack.ItemBuilder;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -14,7 +17,6 @@ import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
-import mineplex.core.common.util.UtilUI;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.open.OpenArrowTrails;
@@ -40,6 +42,9 @@ import mineplex.core.mount.Mount;
import mineplex.core.pet.PetType;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.BannerMeta;
public class Menu extends ShopPageBase
{
@@ -64,35 +69,46 @@ public class Menu extends ShopPageBase
List shardLore = new ArrayList();
shardLore.add(" ");
- shardLore.add(C.cGray + "This seems like it might come in");
- shardLore.add(C.cGray + "handy. Maybe I can collect more!");
+ shardLore.add(C.cGray + "These seem like they might come in");
+ shardLore.add(C.cGray + "handy. Maybe I should collect more!");
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
- // Cosmetic Items
- int[] slots = UtilUI.getIndicesFor(15, 0, 5, 1);
- /*int particleSlot = 9;//slots[0];
- int arrowSlot = 11;//slots[1];
- int jumpSlot = 13;//slots[2];
- int deathSlot = 15;//slots[3];
- int gadgetSlot = 27;//slots[4];
- int morphSlot = 29;//slots[5];
- int mountSlot = 31;//slots[6];
- int petSlot = 33;//slots[7];
- int hatSlot = 35;//slots[8];
- int costumeSlot = 45;//slots[9];
- int musicSlot = 47;//slots[10];
- int tauntSlot = 49;//slots[11];
- int winEffectSlot = 51;
- int gameModifierSlot = 53;*/
- int particleSlot = slots[0], arrowSlot = slots[1], jumpSlot = slots[2],
- deathSlot = slots[3], gadgetSlot = slots[4], morphSlot = slots[5],
- mountSlot = slots[6], petSlot = slots[7], hatSlot = slots[8],
- costumeSlot = slots[9], musicSlot = slots[10], tauntSlot = slots[11],
- winEffectSlot = slots[12], gameModifierSlot = slots[13], balloonsSlot = slots[14],
- kitSelectorSlot = balloonsSlot + 4;
+ int deathSlot = 19;
+ int jumpSlot = 28;
+ int particleSlot = 1;
+ int winEffectSlot = 13;
+ int shardSlot = 22;
+ int arrowSlot = 10;
+ int tauntSlot = 31;
+ int gameModifierSlot = 21;
+ int kitSelectorSlot = 23;
+ int musicSlot = 48;
+ int mountSlot = 50;
+ int balloonsSlot = 47;
+ int petSlot = 51;
+ int gadgetSlot = 49;
+ int hatSlot = 7;
+ int flagSlot = 34;
+ int morphSlot = 25;
+ int costumeSlot = 16;
+
+ addItem(shardSlot, shards);
+
+ ItemStack pane = new ItemBuilder(Material.STAINED_GLASS_PANE).setData((byte)15).setTitle(C.cBlack).build();
+ for (int i = 0; i <= 45; i += 9) addItem(i, pane.clone());
+ for (int i = 8; i <= 53; i += 9) addItem(i, pane.clone());
+ for (int i = 37; i <= 43; ++i) addItem(i, pane.clone());
+ for (int i = 2; i <= 6; ++i) addItem(i, pane.clone());
+ for (int i = 11; i <= 29; i += 9) addItem(i, pane.clone());
+ for (int i = 15; i <= 33; i += 9) addItem(i, pane.clone());
+ addItem(12, pane.clone());
+ addItem(14, pane.clone());
+ addItem(30, pane.clone());
+ addItem(32, pane.clone());
+ addItem(46, pane.clone());
+ addItem(52, pane.clone());
- addItem(kitSelectorSlot + 2, shards);
EnumMap ownedCount = new EnumMap<>(GadgetType.class);
EnumMap maxCount = new EnumMap<>(GadgetType.class);
@@ -187,13 +203,13 @@ public class Menu extends ShopPageBase
if (petActive != null) addGlow(petSlot);
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.", VISIBILITY_HUB, enabled.get(type));
+ lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the others.", VISIBILITY_HUB, 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;
// -4 Fixes more than the real costumes being counted (Happens because of the hub games costumes
- lore = getLore(ownedCount.get(type) - 4, maxCount.get(type) - 4, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", VISIBILITY_HUB, enabled.get(type));
+ lore = getLore(ownedCount.get(type), maxCount.get(type) - 4, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", VISIBILITY_HUB, 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);
@@ -227,6 +243,19 @@ public class Menu extends ShopPageBase
lore = getLore(ownedCount.get(type), maxCount.get(type), "Click here to select different particles to indicate which kit you have selected!", VISIBILITY_GAME_HUB, enabled.get(type));
addButton(kitSelectorSlot, new ShopItem(Material.LEVER, "Kit Selector Particles", lore, 1, false), new OpenKitSelector(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(kitSelectorSlot);
+
+ type = GadgetType.FLAG;
+ lore = getLore(ownedCount.get(type), maxCount.get(type), "Show off your country's flag!", VISIBILITY_HUB, enabled.get(type));
+ addButton(flagSlot, new ShopItem(Material.BANNER, "Flags", lore, 1, false), new OpenFlags(this, enabled.get(type)));
+ if (enabled.containsKey(type)) addGlow(flagSlot);
+
+ // Copy over banner design
+ BannerMeta banner = (BannerMeta) CountryFlag.MINEPLEX.getBanner().getItemMeta();
+ BannerMeta meta = ((BannerMeta) getItem(flagSlot).getItemMeta());
+ meta.setBaseColor(banner.getBaseColor());
+ meta.setPatterns(banner.getPatterns());
+ meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
+ getItem(flagSlot).setItemMeta(meta);
}
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)
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 682140891..0689b3f07 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
@@ -32,13 +32,19 @@ public class MorphPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget)
- if (!(gadget instanceof MorphBlock))
- addGlow(slot);
+ {
+ if (!(gadget instanceof MorphBlock))
+ {
+ addGlow(slot);
+ }
+ }
slot++;
- if (slot == 17 || slot == 26 || slot == 35)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
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/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java
index 6e670effc..0c2b2cd60 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
@@ -46,8 +46,10 @@ public class MountPage extends ShopPageBase
addMount(mount, slot);
slot++;
- if (slot == 17 || slot == 26)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
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/cosmetic/ui/page/MusicPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java
index 54ff244d7..49fa65cf7 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
@@ -14,9 +14,6 @@ import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.IButton;
-/**
- * Created by shaun on 14-09-15.
- */
public class MusicPage extends GadgetPage
{
public MusicPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
@@ -34,8 +31,10 @@ public class MusicPage extends GadgetPage
slot++;
- if (slot == 17)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
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/cosmetic/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java
index a488c922c..168741d0a 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
@@ -31,12 +31,16 @@ public class ParticlePage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.PARTICLE) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
-
- if (slot == 17 || slot == 26 || slot == 35)
- slot += 2;
+
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java
index e7bf684cb..264f73dbe 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
@@ -231,16 +231,23 @@ public class PetPage extends ShopPageBase
slot++;
- if (slot == 17 || slot == 26)
+ if (slot % 9 == 8)
+ {
slot += 2;
+ }
}
slot = 49;
for (PetExtra petExtra : PetExtra.values())
{
List itemLore = new ArrayList();
-
- if (!getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
+
+ if (getPlugin().getPunishManager().GetClient(_player.getName()).IsMuted())
+ {
+ itemLore.add(C.cRed + "You may not rename pets while muted!");
+ 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().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());
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 687516e0f..63ef90b24 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
@@ -38,12 +38,16 @@ public class TauntPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.TAUNT) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
-
- if (slot == 26)
- slot += 2;
+
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/WinEffectPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java
index cc116cbac..e66674be4 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
@@ -49,12 +49,16 @@ public class WinEffectPage extends GadgetPage
}
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget)
- addGlow(slot);
+ {
+ addGlow(slot);
+ }
slot++;
-
- if (slot == 17 || slot == 26)
- slot += 2;
+
+ if (slot % 9 == 8)
+ {
+ slot += 2;
+ }
}
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/cosmetic/ui/page/custompet/name/CustomPetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java
index 774ecf2d0..2350f8eba 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java
@@ -1,9 +1,14 @@
package mineplex.core.cosmetic.ui.page.custompet.name;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.UtilItem;
+import mineplex.core.itemstack.ItemBuilder;
+import mineplex.core.punish.PunishClient;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Items;
import org.bukkit.ChatColor;
+import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
@@ -34,6 +39,7 @@ public class CustomPetTagPage extends ShopPageBase
}
argHandle.add(arg);
}
+
+ else if (arg.equalsIgnoreCase("wither"))
+ {
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof Skeleton)
+ {
+ ((Skeleton) ent).setSkeletonType(SkeletonType.WITHER);
+ }
+ }
+
+ argHandle.add(arg);
+ }
}
for (String arg : argHandle)
argSet.remove(arg);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java
index 89c28093f..59783273d 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java
@@ -228,6 +228,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
if (!spawnedIn)
{
refreshTrackers(disguise.getEntity().getBukkitEntity());
+ } else
+ {
+ disguise.markSpawnedIn();
}
disguise.onDisguise(true);
@@ -360,6 +363,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
final Packet packet = packetInfo.getPacket();
final Player owner = packetInfo.getPlayer();
final PacketVerifier packetVerifier = packetInfo.getVerifier();
+ final int protocol = ((CraftPlayer) owner).getHandle().getProtocol();
if (packet instanceof PacketPlayOutPlayerInfo)
{
@@ -406,7 +410,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
{
packetInfo.setCancelled(true);
- handleSpawnPackets(packetInfo.getVerifier(), latestDisguise);
+ handleSpawnPackets(packetInfo.getVerifier(), latestDisguise, protocol);
}
else if (latestDisguise.isHideIfNotDisguised())
{
@@ -436,7 +440,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
if (latestDisguise != null && containsSpawnDisguise(owner, latestDisguise) && owner.getEntityId() != entityId)
{
packetInfo.setCancelled(true);
- handlePacket(latestDisguise.getMetadataPacket(), packetVerifier);
+ handlePacket(latestDisguise.modifyMetaPacket(protocol, latestDisguise.getMetadataPacket()), packetVerifier);
}
}
else if (packet instanceof PacketPlayOutEntityEquipment)
@@ -475,7 +479,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
_handlingPacket = false;
}
- private void handleSpawnPackets(PacketVerifier packetVerifier, DisguiseBase disguise)
+ private void handleSpawnPackets(PacketVerifier packetVerifier, DisguiseBase disguise, int protocol)
{
if (disguise instanceof DisguisePlayer)
{
@@ -493,14 +497,14 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
handlePacket(infoPacket, packetVerifier);
}
- handlePacket(pDisguise.getSpawnPacket(), packetVerifier);
+ handlePacket(pDisguise.modifySpawnPacket(protocol, pDisguise.getSpawnPacket()), packetVerifier);
for (Packet packet : pDisguise.getEquipmentPackets())
{
handlePacket(packet, packetVerifier);
}
- handlePacket(pDisguise.getMetadataPacket(), packetVerifier);
+ handlePacket(pDisguise.modifyMetaPacket(protocol, pDisguise.getMetadataPacket()), packetVerifier);
if (pDisguise.getSleepingDirection() != null)
{
@@ -556,7 +560,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
}
else
{
- handlePacket(disguise.getSpawnPacket(), packetVerifier);
+ handlePacket(disguise.modifySpawnPacket(protocol, disguise.getSpawnPacket()), packetVerifier);
if (disguise instanceof DisguiseLiving)
{
@@ -644,10 +648,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
{
if (tester.test(player))
{
- if (disguise.getEntity() == ((CraftPlayer) player).getHandle())
+ EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
+ if (disguise.getEntity() == nmsPlayer)
continue;
- UtilPlayer.sendPacket(player, disguise.getMetadataPacket());
+ int protocol = nmsPlayer.getProtocol();
+ UtilPlayer.sendPacket(player, disguise.modifyMetaPacket(protocol, disguise.getMetadataPacket()));
}
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java
index 2d0334abc..e6e02767b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java
@@ -1,26 +1,21 @@
package mineplex.core.disguise.disguises;
-import mineplex.core.common.DummyEntity;
-import mineplex.core.common.util.UtilPlayer;
-import net.minecraft.server.v1_8_R3.DataWatcher;
-import net.minecraft.server.v1_8_R3.Entity;
-import net.minecraft.server.v1_8_R3.EntityPlayer;
-import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
-import net.minecraft.server.v1_8_R3.IntHashMap;
-import net.minecraft.server.v1_8_R3.MinecraftServer;
-import net.minecraft.server.v1_8_R3.Packet;
-import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
-import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
-import net.minecraft.server.v1_8_R3.WorldServer;
-import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+import net.minecraft.server.v1_8_R3.*;
+
+import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+
+import mineplex.core.common.DummyEntity;
+import mineplex.core.common.util.UtilPlayer;
public abstract class DisguiseBase
{
@@ -37,6 +32,8 @@ public abstract class DisguiseBase
*/
private boolean _hideIfNotDisguised = false;
+ protected boolean _spawnedIn = false;
+
public DisguiseBase(EntityType entityType, org.bukkit.entity.Entity entity)
{
if (entity == null)
@@ -72,15 +69,7 @@ public abstract class DisguiseBase
DataWatcher.watch(1, getEntity().getDataWatcher().getShort(1), net.minecraft.server.v1_8_R3.Entity.META_AIR, (int) getEntity().getDataWatcher().getShort(1));
}
- public abstract Packet getSpawnPacket();
-
- public Packet getMetadataPacket()
- {
- UpdateDataWatcher();
- return new PacketPlayOutEntityMetadata(getEntity().getId(), DataWatcher, true);
- }
-
- public void resendMetadata()
+ protected void sendToWatchers(Predicate protocolPredicate, Supplier supplier)
{
if (getEntity() == null || !getEntity().getBukkitEntity().isValid() || !(getEntity().world instanceof WorldServer))
return;
@@ -90,14 +79,57 @@ public abstract class DisguiseBase
if (tracker.get(getEntity().getId()) == null)
return;
- Packet packet = getMetadataPacket();
+ Packet packet = supplier.get();
+ if (packet == null)
+ return;
for (EntityPlayer player : tracker.get(getEntity().getId()).trackedPlayers)
{
- UtilPlayer.sendPacket(player.getBukkitEntity(), packet);
+ int protocol = player.getProtocol();
+ if (!protocolPredicate.test(protocol))
+ continue;
+
+ if (packet instanceof PacketPlayOutEntityMetadata)
+ {
+ player.playerConnection.sendPacket(modifyMetaPacket(protocol, packet));
+ } else if (packet instanceof PacketPlayOutSpawnEntityLiving)
+ {
+ player.playerConnection.sendPacket(modifySpawnPacket(protocol, packet));
+ } else
+ {
+ player.playerConnection.sendPacket(packet);
+ }
}
}
+ protected void sendToWatchers(Supplier supplier)
+ {
+ sendToWatchers(x -> true, supplier);
+ }
+
+ public abstract Packet getSpawnPacket();
+
+ public Packet modifySpawnPacket(int protocol, Packet packet)
+ {
+ return packet;
+ }
+
+ public Packet getMetadataPacket()
+ {
+ UpdateDataWatcher();
+ return new PacketPlayOutEntityMetadata(getEntity().getId(), DataWatcher, true);
+ }
+
+ public void resendMetadata()
+ {
+ sendToWatchers(this::getMetadataPacket);
+ }
+
+ public Packet modifyMetaPacket(int protocol, Packet packet)
+ {
+ return packet;
+ }
+
public void setSoundDisguise(DisguiseBase soundDisguise)
{
_soundDisguise = soundDisguise;
@@ -182,6 +214,11 @@ public abstract class DisguiseBase
}
+ public void markSpawnedIn()
+ {
+ _spawnedIn = true;
+ }
+
public void setHideIfNotDisguised(boolean hideIfNotDisguised)
{
this._hideIfNotDisguised = hideIfNotDisguised;
@@ -197,7 +234,7 @@ public abstract class DisguiseBase
return this._disguiseType;
}
- public void setEntity(net.minecraft.server.v1_8_R3.Entity entity)
+ public void setEntity(Entity entity)
{
_entity.clear();
_entity = new WeakReference<>(entity);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java
index d477ab3bc..290d321f1 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java
@@ -1,9 +1,16 @@
package mineplex.core.disguise.disguises;
-import net.minecraft.server.v1_8_R3.MathHelper;
-import net.minecraft.server.v1_8_R3.Packet;
-import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
-import org.bukkit.entity.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.mineplex.MetadataRewriter;
+import com.mineplex.ProtocolVersion;
+
+import net.minecraft.server.v1_8_R3.*;
+import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
+
+import org.bukkit.entity.EntityType;
public abstract class DisguiseCreature extends DisguiseInsentient
{
@@ -18,9 +25,9 @@ public abstract class DisguiseCreature extends DisguiseInsentient
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = getEntity().getId();
packet.b = (byte) getDisguiseType().getTypeId();
- packet.c = (int) MathHelper.floor(getEntity().locX*32D);
- packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
- packet.e = (int) MathHelper.floor(getEntity().locZ*32D);
+ packet.c = MathHelper.floor(getEntity().locX * 32.0D);
+ packet.d = MathHelper.floor(getEntity().locY * 32.0D);
+ packet.e = MathHelper.floor(getEntity().locZ * 32.0D);
packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
@@ -70,4 +77,97 @@ public abstract class DisguiseCreature extends DisguiseInsentient
return packet;
}
+
+ // ---- Metadata processing
+
+ // This WON'T be post-processed by the Spigot metadata processor
+
+ @Override
+ public Packet modifySpawnPacket(int protocol, Packet packet)
+ {
+ if (protocol >= ProtocolVersion.v1_10_PRE)
+ {
+ PacketPlayOutSpawnEntityLiving newSpawn = (PacketPlayOutSpawnEntityLiving) getSpawnPacket();
+
+ // Allow the entity type to be changed (needed on 1.11+)
+ newSpawn.b = getTypeId(protocol >= ProtocolVersion.v1_11);
+
+ boolean hasArms = false;
+ List meta = DataWatcher.b();
+
+ if (meta != null)
+ {
+ // Run the meta through our Spigot rewriter
+ meta = MetadataRewriter.rewrite(getTypeId(false), protocol, meta).objects;
+
+ // Remove indexes >= 12 on 1.11+
+ if (protocol >= ProtocolVersion.v1_11)
+ {
+ Iterator iter = meta.iterator();
+ while (iter.hasNext())
+ {
+ WatchableObject next = iter.next();
+ if (next.getIndex().a() == 6)
+ {
+ hasArms = true;
+ } else if (next.getIndex().a() >= 12)
+ {
+ iter.remove();
+ }
+ }
+ }
+ } else
+ {
+ meta = new ArrayList<>();
+ }
+
+ if (!hasArms)
+ {
+ WatchableObject arms = new WatchableObject<>(0, 0, null,
+ new DataIndex<>(6, DataType.BYTE), (byte) 0);
+ meta.add(arms);
+ }
+
+ newSpawn.m = meta;
+ return newSpawn;
+ }
+
+ return packet;
+ }
+
+ protected int getTypeId(boolean separate)
+ {
+ return getDisguiseType().getTypeId();
+ }
+
+ // This WILL be post-processed by Spigot's metadata processor
+
+ @Override
+ public Packet modifyMetaPacket(int protocol, Packet packet)
+ {
+ if (protocol >= ProtocolVersion.v1_10_PRE)
+ {
+ PacketPlayOutEntityMetadata newMeta = new PacketPlayOutEntityMetadata();
+ newMeta.a = getEntityId();
+
+ List meta = MetadataRewriter.rewrite(getTypeId(false), protocol, DataWatcher.c()).objects;
+
+ for (int i = 0; i < meta.size(); i++)
+ {
+ WatchableObject object = meta.get(i);
+ int index = object.getIndex().a();
+ if (index >= 6)
+ {
+ index--;
+ meta.set(i, new WatchableObject(0, 0, null,
+ new DataIndex(index, object.getIndex().b()), object.getValue()));
+ }
+ }
+
+ newMeta.b = meta;
+ return newMeta;
+ }
+
+ return packet;
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGuardian.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGuardian.java
index af05e67bb..1f40da543 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGuardian.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseGuardian.java
@@ -1,11 +1,17 @@
package mineplex.core.disguise.disguises;
-import org.bukkit.entity.*;
-
import net.minecraft.server.v1_8_R3.EntityGuardian;
-public class DisguiseGuardian extends DisguiseCreature
+import org.bukkit.entity.EntityType;
+
+public class DisguiseGuardian extends DisguiseMutable
{
+ private static final int GUARDIAN_ID = 68;
+ private static final int ELDER_GUARDIAN_ID = 4;
+
+ private int target = 0;
+ private boolean elder = false;
+
public DisguiseGuardian(org.bukkit.entity.Entity entity)
{
super(EntityType.GUARDIAN, entity);
@@ -15,17 +21,31 @@ public class DisguiseGuardian extends DisguiseCreature
public void setTarget(int target)
{
+ this.target = target;
+
DataWatcher.watch(17, target, EntityGuardian.META_TARGET, target);
}
public void setElder(boolean elder)
{
- DataWatcher.watch(16, Integer.valueOf(DataWatcher.getInt(16) | 4), EntityGuardian.META_ELDER, (byte) (DataWatcher.getInt(16) | 4));
+ this.elder = elder;
+
+ int oldValue = DataWatcher.getInt(16);
+ int newValue = elder ? oldValue | 4 : oldValue & ~4;
+
+ DataWatcher.watch(16, Integer.valueOf(newValue), EntityGuardian.META_ELDER, (byte) newValue);
+
+ mutate();
}
public boolean isElder()
{
- return (this.DataWatcher.getInt(16) & 4) != 0;
+ return elder;
+ }
+
+ public int getTarget()
+ {
+ return target;
}
protected String getHurtSound()
@@ -37,4 +57,10 @@ public class DisguiseGuardian extends DisguiseCreature
return "mob.guardian.hit";
}
+
+ @Override
+ protected int getTypeId(boolean separate)
+ {
+ return separate && isElder() ? ELDER_GUARDIAN_ID : GUARDIAN_ID;
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java
index cbd7ee097..b306a76b6 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java
@@ -2,14 +2,24 @@ package mineplex.core.disguise.disguises;
import java.util.UUID;
-import net.minecraft.server.v1_8_R3.EntityHorse;
-
-import org.bukkit.entity.*;
-
import com.google.common.base.Optional;
-public class DisguiseHorse extends DisguiseAnimal
+import net.minecraft.server.v1_8_R3.EntityAgeable;
+import net.minecraft.server.v1_8_R3.EntityHorse;
+
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Horse;
+
+public class DisguiseHorse extends DisguiseMutable
{
+ private static final int HORSE_ID = 100;
+ private static final int DONKEY_ID = 31;
+ private static final int MULE_ID = 32;
+ private static final int ZOMBIE_HORSE_ID = 29;
+ private static final int SKELETON_HORSE_ID = 28;
+
+ private Horse.Variant variant = Horse.Variant.HORSE;
+
public DisguiseHorse(org.bukkit.entity.Entity entity)
{
super(EntityType.HORSE, entity);
@@ -19,11 +29,25 @@ public class DisguiseHorse extends DisguiseAnimal
DataWatcher.a(20, Integer.valueOf(0), EntityHorse.META_VARIANT, 0);
DataWatcher.a(21, String.valueOf(""), EntityHorse.META_OWNER, Optional. absent());
DataWatcher.a(22, Integer.valueOf(0), EntityHorse.META_ARMOR, 0);
+
+ DataWatcher.a(12, new Byte((byte)0), EntityAgeable.META_BABY, false);
+ }
+
+ public boolean isBaby()
+ {
+ return DataWatcher.getByte(12) < 0;
+ }
+
+ public void setBaby()
+ {
+ DataWatcher.watch(12, new Byte((byte) ( -1 )), EntityAgeable.META_BABY, true);
}
public void setType(Horse.Variant horseType)
{
DataWatcher.watch(19, Byte.valueOf((byte) horseType.ordinal()), EntityHorse.META_TYPE, horseType.ordinal());
+ this.variant = horseType;
+ mutate();
}
public Horse.Variant getType()
@@ -72,4 +96,23 @@ public class DisguiseHorse extends DisguiseAnimal
{
DataWatcher.watch(22, Integer.valueOf(i), EntityHorse.META_ARMOR, i);
}
+
+ // 1.11 and up require separate entity ids
+ @Override
+ protected int getTypeId(boolean separate)
+ {
+ if (separate && variant != Horse.Variant.HORSE)
+ {
+ switch (variant)
+ {
+ case DONKEY: return DONKEY_ID;
+ case MULE: return MULE_ID;
+ case UNDEAD_HORSE: return ZOMBIE_HORSE_ID;
+ case SKELETON_HORSE: return SKELETON_HORSE_ID;
+ default: return HORSE_ID;
+ }
+ }
+
+ return HORSE_ID;
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java
index 904835bba..e06a56b17 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java
@@ -1,95 +1,15 @@
package mineplex.core.disguise.disguises;
-import net.minecraft.server.v1_8_R3.EntitySlime;
-import net.minecraft.server.v1_8_R3.MathHelper;
-import net.minecraft.server.v1_8_R3.Packet;
-import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
-public class DisguiseMagmaCube extends DisguiseInsentient
+/**
+ * Magma cubes are essentially identical to slimes for disguise purposes
+ */
+public class DisguiseMagmaCube extends DisguiseSlime
{
- public DisguiseMagmaCube(org.bukkit.entity.Entity entity)
+ public DisguiseMagmaCube(Entity entity)
{
super(EntityType.MAGMA_CUBE, entity);
-
- DataWatcher.a(16, new Byte((byte) 1), EntitySlime.META_SIZE, 1);
}
-
- public void SetSize(int i)
- {
- DataWatcher.watch(16, new Byte((byte) i), EntitySlime.META_SIZE, i);
- }
-
- public int GetSize()
- {
- return DataWatcher.getByte(16);
- }
-
- public Packet getSpawnPacket()
- {
- PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
- packet.a = getEntity().getId();
- packet.b = (byte) 62;
- packet.c = (int) MathHelper.floor(getEntity().locX * 32D);
- packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
- packet.e = (int) MathHelper.floor(getEntity().locZ * 32D);
- packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
- packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
- packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
- packet.uuid = getEntity().getUniqueID();
-
- double var2 = 3.9D;
- double var4 = 0;
- double var6 = 0;
- double var8 = 0;
-
- if (var4 < -var2)
- {
- var4 = -var2;
- }
-
- if (var6 < -var2)
- {
- var6 = -var2;
- }
-
- if (var8 < -var2)
- {
- var8 = -var2;
- }
-
- if (var4 > var2)
- {
- var4 = var2;
- }
-
- if (var6 > var2)
- {
- var6 = var2;
- }
-
- if (var8 > var2)
- {
- var8 = var2;
- }
-
- packet.f = (int) (var4 * 8000.0D);
- packet.g = (int) (var6 * 8000.0D);
- packet.h = (int) (var8 * 8000.0D);
-
- packet.l = DataWatcher;
- packet.m = DataWatcher.b();
-
- return packet;
- }
-
- protected String getHurtSound()
- {
- return "mob.slime." + (GetSize() > 1 ? "big" : "small");
- }
-
- protected float getVolume()
- {
- return 0.4F * (float) GetSize();
- }
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMutable.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMutable.java
new file mode 100644
index 000000000..d3ff2216c
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMutable.java
@@ -0,0 +1,40 @@
+package mineplex.core.disguise.disguises;
+
+import java.util.function.Predicate;
+
+import com.mineplex.ProtocolVersion;
+
+import net.minecraft.server.v1_8_R3.Packet;
+import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+
+/**
+ * Represents a disguise that can "mutate" from one entity type to another.
+ */
+public abstract class DisguiseMutable extends DisguiseCreature
+{
+ public DisguiseMutable(EntityType disguiseType, Entity entity)
+ {
+ super(disguiseType, entity);
+ }
+
+ protected void mutate()
+ {
+// if (!_spawnedIn)
+// return;
+
+ Predicate pred = v -> v >= ProtocolVersion.v1_11;
+ sendToWatchers(pred, this::getDestroyPacket);
+ sendToWatchers(pred, this::getSpawnPacket);
+ sendToWatchers(pred, this::getMetadataPacket);
+ }
+
+ private Packet getDestroyPacket()
+ {
+ return new PacketPlayOutEntityDestroy(new int[] { getEntityId() });
+ }
+
+ protected abstract int getTypeId(boolean separate);
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java
index 122490073..34dd47cc0 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSkeleton.java
@@ -2,11 +2,16 @@ package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntitySkeleton;
-import org.bukkit.entity.*;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton.SkeletonType;
-public class DisguiseSkeleton extends DisguiseMonster
+public class DisguiseSkeleton extends DisguiseMutable
{
+ private static final int SKELETON_ID = 51;
+ private static final int WITHER_SKELETON_ID = 5;
+
+ private SkeletonType type = SkeletonType.NORMAL;
+
public DisguiseSkeleton(org.bukkit.entity.Entity entity)
{
super(EntityType.SKELETON, entity);
@@ -17,15 +22,24 @@ public class DisguiseSkeleton extends DisguiseMonster
public void SetSkeletonType(SkeletonType skeletonType)
{
DataWatcher.watch(13, Byte.valueOf((byte) skeletonType.getId()), EntitySkeleton.META_TYPE, skeletonType.getId());
+ this.type = skeletonType;
+ mutate();
}
- public int GetSkeletonType()
+ public SkeletonType getSkeletonType()
{
- return DataWatcher.getByte(13);
+ return type;
}
protected String getHurtSound()
{
return "mob.skeleton.hurt";
}
+
+ // 1.11 and up require separate entity ids
+ @Override
+ protected int getTypeId(boolean separate)
+ {
+ return separate && type == SkeletonType.WITHER ? WITHER_SKELETON_ID : SKELETON_ID;
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java
index 96bb78cd9..6a0cb2a34 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java
@@ -4,14 +4,26 @@ import net.minecraft.server.v1_8_R3.EntitySlime;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
+
+import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
-public class DisguiseSlime extends DisguiseInsentient
+/**
+ * Slimes have an odd type hierarchy, but they're essentially creatures as far as disguises are concerned.
+ */
+public class DisguiseSlime extends DisguiseCreature
{
- public DisguiseSlime(org.bukkit.entity.Entity entity)
+ public DisguiseSlime(Entity entity)
{
- super(EntityType.SLIME, entity);
+ this(EntityType.SLIME, entity);
+ }
+ /**
+ * For magma cubes
+ */
+ protected DisguiseSlime(EntityType type, Entity entity)
+ {
+ super(type, entity);
DataWatcher.a(16, new Byte((byte) 1), EntitySlime.META_SIZE, 1);
}
@@ -25,63 +37,6 @@ public class DisguiseSlime extends DisguiseInsentient
return DataWatcher.getByte(16);
}
- public Packet getSpawnPacket()
- {
- PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
- packet.a = getEntity().getId();
- packet.b = (byte) 55;
- packet.c = (int) MathHelper.floor(getEntity().locX * 32D);
- packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
- packet.e = (int) MathHelper.floor(getEntity().locZ * 32D);
- packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
- packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
- packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
- packet.uuid = getEntity().getUniqueID();
-
- double var2 = 3.9D;
- double var4 = 0;
- double var6 = 0;
- double var8 = 0;
-
- if (var4 < -var2)
- {
- var4 = -var2;
- }
-
- if (var6 < -var2)
- {
- var6 = -var2;
- }
-
- if (var8 < -var2)
- {
- var8 = -var2;
- }
-
- if (var4 > var2)
- {
- var4 = var2;
- }
-
- if (var6 > var2)
- {
- var6 = var2;
- }
-
- if (var8 > var2)
- {
- var8 = var2;
- }
-
- packet.f = (int) (var4 * 8000.0D);
- packet.g = (int) (var6 * 8000.0D);
- packet.h = (int) (var8 * 8000.0D);
- packet.l = DataWatcher;
- packet.m = DataWatcher.b();
-
- return packet;
- }
-
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java
index e0c544659..4b53402cb 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java
@@ -37,11 +37,9 @@ public class DisguiseCommand extends CommandBase implemen
return;
}
- Plugin.runAsync(() ->
- {
- new PlayerDisguiseNotification(realName, currentUUID, args[0], args.length > 1 ? args[1] : args[0]).publish();
- });
-
- Plugin.disguise(caller, args[0], args.length > 1 ? args[1] : args[0]);
+ String skin = args.length > 1 ? args[1] : args[0];
+ Plugin.tryDisguise(caller, args[0], skin, () -> // onComplete
+ Plugin.runAsync(() -> // task
+ new PlayerDisguiseNotification(realName, currentUUID, args[0], skin).publish()));
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/ExpiringSet.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/ExpiringSet.java
new file mode 100644
index 000000000..12aa1d0ca
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/ExpiringSet.java
@@ -0,0 +1,96 @@
+package mineplex.core.disguise.playerdisguise;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+/**
+ * Set with contents that expire after X amount of time units. Essentially HashSet reimplemented with a Cache instead of HashMap.
+ * @author Dan
+ */
+public class ExpiringSet extends AbstractSet implements Set
+{
+ private transient Cache cache;
+
+ private static final Object DUMMY = new Object();
+
+ public ExpiringSet(long duration, TimeUnit unit)
+ {
+ this.cache = CacheBuilder.newBuilder().expireAfterWrite(duration, unit).build();
+ }
+
+ @Override
+ public Iterator iterator()
+ {
+ return cache.asMap().keySet().iterator();
+ }
+
+ @Override
+ public void forEach(Consumer super E> action)
+ {
+ cache.asMap().keySet().forEach(action);
+ }
+
+ @Override
+ public boolean removeIf(Predicate super E> filter)
+ {
+ return cache.asMap().keySet().removeIf(filter);
+ }
+
+ @Override
+ public Spliterator spliterator()
+ {
+ return cache.asMap().keySet().spliterator();
+ }
+
+ @Override
+ public Stream stream()
+ {
+ return cache.asMap().keySet().stream();
+ }
+
+ @Override
+ public Stream parallelStream()
+ {
+ return cache.asMap().keySet().parallelStream();
+ }
+
+ @Override
+ public int size()
+ {
+ return (int) cache.size();
+ }
+
+ @Override
+ public boolean contains(Object o)
+ {
+ return cache.getIfPresent(o) != null;
+ }
+
+ @Override
+ public boolean add(E e)
+ {
+ boolean contained = contains(e);
+ cache.put(e, DUMMY);
+ return contained;
+ }
+
+ @Override
+ public boolean remove(Object o)
+ {
+ boolean contained = contains(o);
+ cache.invalidate(o);
+ return contained;
+ }
+
+ @Override
+ public void clear()
+ {
+ cache.invalidateAll();
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java
index a650df7ec..30de25c49 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java
@@ -1,14 +1,8 @@
package mineplex.core.disguise.playerdisguise;
import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import net.minecraft.server.v1_8_R3.MinecraftServer;
@@ -86,7 +80,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
ILLEGAL_USERNAMES = ImmutableSet.copyOf(Arrays.asList("hypixel", "chiss", "dctr", "blondebug", "dooskee",
"tomcallister", "jessiemarcia", "spu_", "sp614x", "deadmau5", "gwen", "mineplex", "samczsun", "sethbling",
- "xisuma", "cubehamster", "natet_bird", "qwertyuiopthepie"
+ "xisuma", "cubehamster", "natet_bird", "qwertyuiopthepie", "hitler", "adolfhitler"
));
VERY_SPECIAL_PEOPLE = ImmutableSet.copyOf(Arrays.asList(
@@ -121,14 +115,15 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
private CoreClientManager _clients = require(CoreClientManager.class);
private DisguiseManager _disguise = require(DisguiseManager.class);
private Punish _punish = require(Punish.class);
- private CosmeticManager _cosmetics = require(CosmeticManager.class);
+ // private CosmeticManager _cosmetics = require(CosmeticManager.class);
private PreferencesManager _prefs = require(PreferencesManager.class);
private RedisDataRepository _redis;
// The list of usernames which cannot join because someone else is joining
- private Set _cannotJoin = Collections.synchronizedSet(new HashSet<>());
- private Set _loggingIn = Collections.synchronizedSet(new HashSet<>());
+ // Values expire in 30 seconds if they haven't been properly cleaned up
+ private Set _cannotJoin = Collections.synchronizedSet(new ExpiringSet<>(1, TimeUnit.MINUTES));
+ private Set _loggingIn = Collections.synchronizedSet(new ExpiringSet<>(1, TimeUnit.MINUTES));
private Set _pendingDisguise1 = new HashSet<>();
@@ -164,7 +159,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
if (disguisePlayer.getProfile().getName().equalsIgnoreCase(event.getPlayer().getName()))
{
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
- event.setKickMessage("Failed to login: The authentication servers are currently down for maintainence");
+ event.setKickMessage("Failed to login: The authentication servers are currently down for maintenance");
return;
}
}
@@ -172,7 +167,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
if (_cannotJoin.contains(event.getPlayer().getName().toLowerCase()))
{
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
- event.setKickMessage("Failed to login: The authentication servers are currently down for maintainence");
+ event.setKickMessage("Failed to login: The authentication servers are currently down for maintenance");
return;
}
@@ -231,7 +226,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
runSyncLater(() ->
{
UtilPlayer.message(event.getPlayer(), F.main(getName(), "Attempting to disguise you as " + bean.getGameProfile().getName()));
- disguise(event.getPlayer(), bean.getGameProfile());
+ tryDisguise(event.getPlayer(), bean.getGameProfile(), () -> { });
}, 1);
}
}
@@ -423,10 +418,26 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
DisguisePlayer disguise = _disguises.remove(caller.getUniqueId());
+ undisguise(caller, disguise);
+
+ _mapping.remove(disguise.getName().toLowerCase());
+
+ UtilPlayer.message(caller, F.main("Disguise", "You are no longer disguised!"));
+ getPluginManager().callEvent(new PlayerUndisguisedEvent(caller));
+ removeDisguiseData(caller);
+ }
+
+ public void undisguise(Player caller, DisguisePlayer disguise)
+ {
GameProfile originalProfile = disguise.getOriginalProfile();
GameProfile currentProfile = ((CraftPlayer) caller).getProfile();
+ boolean sameName = caller.getName().equals(currentProfile.getName());
+
+ if (!sameName)
+ {
+ require(ScoreboardManager.class).handlePlayerQuit(disguise.getName());
+ }
- require(ScoreboardManager.class).handlePlayerQuit(disguise.getName());
try
{
UtilGameProfile.changeName(currentProfile, originalProfile.getName());
@@ -447,7 +458,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
return;
}
- getDisguiseManager().undisguise(caller);
+ getDisguiseManager().undisguise(disguise);
GameProfile disguisedProfile = disguise.getProfile();
@@ -458,25 +469,21 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
require(FriendManager.class).updatePlayerStatus(originalProfile.getId(), new PlayerStatus(originalProfile.getId(), originalProfile.getName(), _serverName));
getPreferencesManager().handlePlayerJoin(caller, true);
- require(ScoreboardManager.class).handlePlayerJoin(disguise.getOriginalProfile().getName());
-
-
- _mapping.remove(disguise.getName().toLowerCase());
-
- UtilPlayer.message(caller, F.main("Disguise", "You are no longer disguised!"));
- getPluginManager().callEvent(new PlayerUndisguisedEvent(caller));
- removeDisguiseData(caller);
+ if (!sameName)
+ {
+ require(ScoreboardManager.class).handlePlayerJoin(disguise.getOriginalProfile().getName());
+ }
}
- public void disguise(Player caller, GameProfile requestedProfile)
+ public void tryDisguise(Player caller, GameProfile requestedProfile, Runnable onComplete)
{
if (getDisguiseManager().isDisguised(caller))
{
if (isDisguised(caller))
{
- UtilPlayer.message(caller, F.main("Disguise", "You are already disguised. Please undisguise by using /disguise"));
- }
- else
+ UtilPlayer.message(caller,
+ F.main("Disguise", "You are already disguised. Please undisguise by using /disguise"));
+ } else
{
UtilPlayer.message(caller, F.main("Disguise", "You are already disguised. Perhaps you are morphed?"));
}
@@ -485,134 +492,75 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
if (isDisguised(caller))
{
- UtilPlayer.message(caller, F.main("Disguise", "You are already disguised. Please undisguise by using /disguise"));
- return;
- }
-
- String requestedUsername = requestedProfile.getName();
-
- if (!requestedUsername.equalsIgnoreCase(caller.getName()))
- {
- _cannotJoin.add(requestedUsername.toLowerCase());
- for (Player other : UtilServer.getPlayersCollection())
- {
- if (other.getName().equalsIgnoreCase(requestedUsername))
- {
- UtilPlayer.message(caller, C.cRed + F.main("Disguise", "This name is already in use!"));
- _cannotJoin.remove(requestedUsername.toLowerCase());
- return;
- }
- }
- }
-
- if (!_pendingDisguise.add(requestedUsername.toLowerCase()))
- {
- UtilPlayer.message(caller, F.main("Disguise", "Someone is already disguising as that user"));
- return;
- }
-
- PlayerPreDisguiseEvent playerPreDisguiseEvent = new PlayerPreDisguiseEvent(caller, requestedUsername);
- UtilServer.CallEvent(playerPreDisguiseEvent);
- if (playerPreDisguiseEvent.isCancelled())
- {
- UtilPlayer.message(caller, F.main(getName(), "Your disguise was cancelled by something"));
- _pendingDisguise.remove(requestedUsername.toLowerCase());
+ UtilPlayer.message(caller,
+ F.main("Disguise", "You are already disguised. Please undisguise by using /disguise"));
return;
}
CoreClient callerClient = getClientManager().Get(caller);
- if (!requestedUsername.equalsIgnoreCase(caller.getName()))
+ String requestedUsername = requestedProfile.getName();
+ if (requestedUsername.equalsIgnoreCase(caller.getName()))
{
- getClientManager().getOrLoadClient(requestedUsername, other ->
+ if (doDisguise(caller, requestedProfile, callerClient, callerClient))
{
- Rank otherRank = other != null ? other.GetRank() : Rank.ALL;
+ onComplete.run();
+ }
+ return;
+ }
+ for (Player other : UtilServer.getPlayersCollection())
+ {
+ if (other.getName().equalsIgnoreCase(requestedUsername))
+ {
+ UtilPlayer.message(caller, C.cRed + F.main("Disguise", "This name is already in use!"));
+ return;
+ }
+ }
+
+ if (_pendingDisguise.contains(requestedUsername.toLowerCase()))
+ {
+ UtilPlayer.message(caller, F.main("Disguise", "Someone is already disguising as that user"));
+ return;
+ }
+
+ getClientManager().getOrLoadClient(requestedUsername, other ->
+ {
+ if (other != null)
+ {
+ Rank otherRank = other.GetRank();
if (otherRank.has(Rank.TWITCH))
{
- UtilPlayer.message(caller, F.main("Disguise", "You can't disguise as staff, YouTubers or Twitchers!"));
+ UtilPlayer.message(caller,
+ F.main("Disguise", "You can't disguise as staff, YouTubers or Twitchers!"));
return;
}
- if (other != null)
+ PunishClient pclient = getPunishManager().GetClient(requestedUsername);
+ if (pclient != null && (pclient.IsBanned() || pclient.IsMuted()))
{
- PunishClient pclient = getPunishManager().GetClient(requestedUsername);
- if (pclient != null && (pclient.IsBanned() || pclient.IsMuted()))
- {
- UtilPlayer.message(caller, F.main("Disguise", "You can't disguise as players who are banned/muted!"));
- return;
- }
+ UtilPlayer.message(caller,
+ F.main("Disguise", "You can't disguise as players who are banned/muted!"));
+ return;
}
+ }
- callerClient.disguise(requestedUsername, requestedProfile.getId(), otherRank);
+ if (doDisguise(caller, requestedProfile, callerClient, other))
+ {
+ onComplete.run();
+ }
+ });
+ }
- _mapping.put(callerClient.getDisguisedAs().toLowerCase(), callerClient.getName());
+ public boolean doDisguise(Player caller, GameProfile requestedProfile, CoreClient callerClient, CoreClient otherClient)
+ {
+ String requestedUsername = requestedProfile.getName();
+ _pendingDisguise.add(requestedUsername.toLowerCase());
- System.out.println("=================");
- System.out.println("Disguising " + caller.getName() + " as:");
- System.out.println(requestedProfile.getName() + " id " + requestedProfile.getId());
- System.out.println("Properties:");
- for (Map.Entry p : requestedProfile.getProperties().entries())
- {
- System.out.println("\t" + p.getKey() + " " + p.getValue().getName());
- System.out.println("\t" + p.getValue().getValue());
- System.out.println("\t" + p.getValue().getSignature());
- }
- System.out.println("=================");
-
- DisguisePlayer disguisePlayer = new DisguisePlayer(caller, requestedProfile);
- disguisePlayer.showInTabList(true, 0);
- allow(caller);
- getDisguiseManager().disguise(disguisePlayer, () ->
- {
- GameProfile callerProfile = ((CraftPlayer) caller).getProfile();
-
- require(ScoreboardManager.class).handlePlayerQuit(disguisePlayer.getOriginalProfile().getName());
-
- try
- {
- UtilGameProfile.changeName(callerProfile, disguisePlayer.getProfile().getName());
- UtilGameProfile.changeId(callerProfile, disguisePlayer.getProfile().getId());
-
- Field playersByName = PlayerList.class.getDeclaredField("playersByName");
- playersByName.setAccessible(true);
- Map map = (Map) playersByName.get(MinecraftServer.getServer().getPlayerList());
- map.remove(disguisePlayer.getOriginalProfile().getName());
- map.put(disguisePlayer.getProfile().getName(), disguisePlayer.getEntity());
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- }
-
- require(ScoreboardManager.class).handlePlayerJoin(disguisePlayer.getName());
-
- callerProfile.getProperties().clear();
- callerProfile.getProperties().putAll(disguisePlayer.getProfile().getProperties());
-
- callerProfile.getProperties().removeAll(ORIGINAL_UUID_KEY);
- callerProfile.getProperties().put(ORIGINAL_UUID_KEY, new Property(ORIGINAL_UUID_KEY, caller.getUniqueId().toString()));
-
- require(FriendManager.class).updatePlayerStatus(disguisePlayer.getOriginalProfile().getId(), null);
- require(FriendManager.class).updatePlayerStatus(disguisePlayer.getProfile().getId(), new PlayerStatus(disguisePlayer.getProfile().getId(), requestedUsername, _serverName));
-
- getPreferencesManager().handlePlayerJoin(caller, true);
-
- _disguises.put(caller.getUniqueId(), disguisePlayer);
-
- UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + requestedUsername));
-
- UtilServer.CallEvent(new PlayerDisguisedEvent(caller));
-
- storeDisguiseData(caller, requestedUsername, requestedProfile);
-
- _pendingDisguise.remove(requestedUsername.toLowerCase());
-
- _cannotJoin.remove(requestedUsername.toLowerCase());
- });
- });
- }
- else
+ if (!requestedUsername.equalsIgnoreCase(caller.getName()))
+ {
+ _cannotJoin.add(requestedUsername.toLowerCase());
+ } else
{
DisguisePlayer disguisePlayer = new DisguisePlayer(caller, requestedProfile);
disguisePlayer.showInTabList(true, 0);
@@ -629,10 +577,93 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
_pendingDisguise.remove(requestedUsername.toLowerCase());
});
+
+ return true;
}
+
+ PlayerPreDisguiseEvent playerPreDisguiseEvent = new PlayerPreDisguiseEvent(caller, requestedUsername);
+ UtilServer.CallEvent(playerPreDisguiseEvent);
+ if (playerPreDisguiseEvent.isCancelled())
+ {
+ UtilPlayer.message(caller, F.main(getName(), "Your disguise was cancelled by something"));
+ _pendingDisguise.remove(requestedUsername.toLowerCase());
+ _cannotJoin.remove(requestedUsername.toLowerCase());
+ return false;
+ }
+
+ Rank otherRank = otherClient != null ? otherClient.GetRank() : Rank.ALL;
+ callerClient.disguise(requestedUsername, requestedProfile.getId(), otherRank);
+
+ _mapping.put(callerClient.getDisguisedAs().toLowerCase(), callerClient.getName());
+
+ System.out.println("=================");
+ System.out.println("Disguising " + caller.getName() + " as:");
+ System.out.println(requestedProfile.getName() + " id " + requestedProfile.getId());
+ System.out.println("Properties:");
+ for (Map.Entry p : requestedProfile.getProperties().entries())
+ {
+ System.out.println("\t" + p.getKey() + " " + p.getValue().getName());
+ System.out.println("\t" + p.getValue().getValue());
+ System.out.println("\t" + p.getValue().getSignature());
+ }
+ System.out.println("=================");
+
+ DisguisePlayer disguisePlayer = new DisguisePlayer(caller, requestedProfile);
+ disguisePlayer.showInTabList(true, 0);
+ allow(caller);
+ getDisguiseManager().disguise(disguisePlayer, () ->
+ {
+ GameProfile callerProfile = ((CraftPlayer) caller).getProfile();
+
+ require(ScoreboardManager.class).handlePlayerQuit(disguisePlayer.getOriginalProfile().getName());
+
+ try
+ {
+ UtilGameProfile.changeName(callerProfile, disguisePlayer.getProfile().getName());
+ UtilGameProfile.changeId(callerProfile, disguisePlayer.getProfile().getId());
+
+ Field playersByName = PlayerList.class.getDeclaredField("playersByName");
+ playersByName.setAccessible(true);
+ Map map = (Map) playersByName.get(MinecraftServer.getServer().getPlayerList());
+ map.remove(disguisePlayer.getOriginalProfile().getName());
+ map.put(disguisePlayer.getProfile().getName(), disguisePlayer.getEntity());
+ } catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
+
+ require(ScoreboardManager.class).handlePlayerJoin(disguisePlayer.getName());
+
+ callerProfile.getProperties().clear();
+ callerProfile.getProperties().putAll(disguisePlayer.getProfile().getProperties());
+
+ callerProfile.getProperties().removeAll(ORIGINAL_UUID_KEY);
+ callerProfile.getProperties()
+ .put(ORIGINAL_UUID_KEY, new Property(ORIGINAL_UUID_KEY, caller.getUniqueId().toString()));
+
+ require(FriendManager.class).updatePlayerStatus(disguisePlayer.getOriginalProfile().getId(), null);
+ require(FriendManager.class).updatePlayerStatus(disguisePlayer.getProfile().getId(),
+ new PlayerStatus(disguisePlayer.getProfile().getId(), requestedUsername, _serverName));
+
+ getPreferencesManager().handlePlayerJoin(caller, true);
+
+ _disguises.put(caller.getUniqueId(), disguisePlayer);
+
+ UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + requestedUsername));
+
+ UtilServer.CallEvent(new PlayerDisguisedEvent(caller));
+
+ storeDisguiseData(caller, requestedUsername, requestedProfile);
+
+ _pendingDisguise.remove(requestedUsername.toLowerCase());
+
+ _cannotJoin.remove(requestedUsername.toLowerCase());
+ });
+
+ return true;
}
- public void disguise(Player caller, String requestedUsername, String requestedSkin)
+ public void tryDisguise(Player caller, String requestedUsername, String requestedSkin, Runnable onComplete)
{
if (!validateUsername(caller, requestedUsername, true)) return;
if (!validateUsername(caller, requestedSkin, false)) return;
@@ -655,7 +686,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
requestedProfile.getProperties().clear();
requestedProfile.getProperties().put("textures", skinData.getProperty());
- disguise(caller, requestedProfile);
+ tryDisguise(caller, requestedProfile, onComplete);
};
if (!requestedUsername.equalsIgnoreCase(requestedSkin))
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
index e0d211e34..2e871dcc8 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
@@ -10,7 +10,19 @@ import java.util.Set;
import java.util.UUID;
import java.util.function.Predicate;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailRedWhite;
+import mineplex.core.gadget.gadgets.death.DeathMapleLeaf;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMaple;
+import mineplex.core.gadget.gadgets.flag.FlagType;
import mineplex.core.gadget.gadgets.morph.MorphBobRoss;
+import mineplex.core.gadget.gadgets.morph.MorphFreedomFighter;
+import mineplex.core.gadget.gadgets.morph.MorphMelonHead;
+import mineplex.core.gadget.gadgets.particle.freedom.ParticleAuraNiceness;
+import mineplex.core.gadget.gadgets.particle.freedom.ParticleCanadian;
+import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedomFireworks;
+import mineplex.core.gadget.gadgets.particle.freedom.ParticleStarSpangled;
+import mineplex.core.gadget.set.SetCanadian;
+import mineplex.core.gadget.types.FlagGadget;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -47,50 +59,50 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
import mineplex.core.gadget.event.TauntCommandEvent;
-import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
-import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
-import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
-import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
-import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord;
-import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween;
-import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm;
-import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
-import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
-import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
-import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring;
-import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan;
-import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
-import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFreedom;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailSpring;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant;
import mineplex.core.gadget.gadgets.balloons.BalloonItem;
import mineplex.core.gadget.gadgets.balloons.BalloonType;
-import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane;
-import mineplex.core.gadget.gadgets.death.christmas.DeathPresentDanger;
-import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart;
-import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald;
-import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
-import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord;
-import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
-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.spring.DeathSpring;
-import mineplex.core.gadget.gadgets.death.titan.DeathTitan;
-import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
-import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
-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.freedom.DoubleJumpFreedom;
-import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord;
-import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween;
-import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm;
-import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
-import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
-import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
-import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring;
-import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan;
-import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
-import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
+import mineplex.core.gadget.gadgets.death.DeathCandyCane;
+import mineplex.core.gadget.gadgets.death.DeathPresentDanger;
+import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart;
+import mineplex.core.gadget.gadgets.death.DeathEmerald;
+import mineplex.core.gadget.gadgets.death.DeathFreedom;
+import mineplex.core.gadget.gadgets.death.DeathFrostLord;
+import mineplex.core.gadget.gadgets.death.DeathStorm;
+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.DeathSpring;
+import mineplex.core.gadget.gadgets.death.DeathTitan;
+import mineplex.core.gadget.gadgets.death.DeathBlood;
+import mineplex.core.gadget.gadgets.death.DeathEnchant;
+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.DoubleJumpFreedom;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpSpring;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GameModifierMount;
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType;
@@ -185,19 +197,19 @@ import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
-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.ParticleCandyCane;
+import mineplex.core.gadget.gadgets.particle.ParticleHeart;
+import mineplex.core.gadget.gadgets.particle.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.ParticleFrostLord;
+import mineplex.core.gadget.gadgets.particle.ParticleRain;
+import mineplex.core.gadget.gadgets.particle.ParticleMusic;
+import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
+import mineplex.core.gadget.gadgets.particle.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
-import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan;
-import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
-import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
+import mineplex.core.gadget.gadgets.particle.ParticleTitan;
+import mineplex.core.gadget.gadgets.particle.ParticleBlood;
+import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt;
import mineplex.core.gadget.gadgets.taunts.EternalTaunt;
import mineplex.core.gadget.gadgets.taunts.RainbowTaunt;
@@ -366,6 +378,7 @@ public class GadgetManager extends MiniPlugin
addSet(new SetMusic(this));
addSet(new SetFreedom(this));
addSet(new SetSpring(this));
+ addSet(new SetCanadian(this));
}
private void createGadgets()
@@ -456,34 +469,45 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphGoldPot(this));
addGadget(new MorphAwkwardRabbit(this));
addGadget(new MorphBobRoss(this, _hologramManager));
+ addGadget(new MorphFreedomFighter(this));
+ addGadget(new MorphMelonHead(this));
// Particles
addGadget(new ParticleFoot(this));
- addGadget(new ParticleFireRings(this));
- addGadget(new ParticleFairy(this));
- addGadget(new ParticleLegend(this));
- addGadget(new ParticleFrostLord(this));
- addGadget(new ParticleTitan(this));
- addGadget(new ParticleCandyCane(this));
- addGadget(new ParticleCoalFumes(this));
- addGadget(new ParticlePartyTime(this));
- addGadget(new ParticleHeart(this));
addGadget(new ParticleEmerald(this));
- addGadget(new ParticleWingsDemons(this));
- addGadget(new ParticleEnchant(this));
addGadget(new ParticleRain(this));
addGadget(new ParticleBlood(this));
+ addGadget(new ParticleEnchant(this));
addGadget(new ParticleMusic(this));
- addGadget(new ParticleWingsAngel(this));
- addGadget(new ParticleWingsInfernal(this));
- addGadget(new ParticleWingsPixie(this));
+ addGadget(new ParticlePartyTime(this));
+
+ addGadget(new ParticleHeart(this));
+ addGadget(new ParticleCandyCane(this));
+ addGadget(new ParticleFrostLord(this));
+ addGadget(new ParticleLegend(this));
+ addGadget(new ParticleTitan(this));
addGadget(new ParticleYinYang(this));
- addGadget(new ParticleFreedom(this));
- addGadget(new ParticleChristmasTree(this));
+ addGadget(new ParticleKing(this, _castleManager));
+
+ addGadget(new ParticleWingsPixie(this));
+ addGadget(new ParticleWingsDemons(this));
+ addGadget(new ParticleWingsInfernal(this));
+ addGadget(new ParticleWingsAngel(this));
addGadget(new ParticleWingsLove(this));
+ addGadget(new ParticleFireRings(this));
+ addGadget(new ParticleFairy(this));
+
+ addGadget(new ParticleChristmasTree(this));
+ addGadget(new ParticleCoalFumes(this));
addGadget(new ParticleSpringHalo(this));
addGadget(new ParticleWingsBee(this));
- addGadget(new ParticleKing(this, _castleManager));
+
+ addGadget(new ParticleFreedom(this));
+ addGadget(new ParticleFreedomFireworks(this));
+ addGadget(new ParticleStarSpangled(this));
+ addGadget(new ParticleAuraNiceness(this));
+ addGadget(new ParticleCanadian(this));
+
// Arrow Trails
addGadget(new ArrowTrailFrostLord(this));
@@ -500,6 +524,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ArrowTrailFreedom(this));
addGadget(new ArrowTrailHalloween(this));
addGadget(new ArrowTrailSpring(this));
+ addGadget(new ArrowTrailRedWhite(this));
// Death Effect
addGadget(new DeathFrostLord(this));
@@ -516,6 +541,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new DeathFreedom(this));
addGadget(new DeathPresentDanger(this));
addGadget(new DeathSpring(this));
+ addGadget(new DeathMapleLeaf(this));
// Double Jump
addGadget(new DoubleJumpFrostLord(this));
@@ -532,6 +558,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new DoubleJumpFreedom(this));
addGadget(new DoubleJumpHalloween(this));
addGadget(new DoubleJumpSpring(this));
+ addGadget(new DoubleJumpMaple(this));
// Hat
for (HatType hatType : HatType.values())
@@ -625,6 +652,11 @@ public class GadgetManager extends MiniPlugin
addGadget(new BlowAKissTaunt(this));
addGadget(new RainbowTaunt(this));
+ // Flags
+ addGadget(new FlagGadget(this, FlagType.CANADA));
+ addGadget(new FlagGadget(this, FlagType.USA));
+
+
// Kit Selectors
addGadget(new WaterWingsKitSelector(this));
addGadget(new HaloKitSelector(this));
@@ -830,6 +862,23 @@ public class GadgetManager extends MiniPlugin
return null;
}
+ public FlagGadget getFlagGadget(FlagType type)
+ {
+ for (Gadget gadget : getGadgets(GadgetType.FLAG))
+ {
+ if(gadget instanceof FlagGadget)
+ {
+ FlagGadget flagGadget = (FlagGadget) gadget;
+
+ if (type.equals(flagGadget.getFlagType()))
+ {
+ return flagGadget;
+ }
+ }
+ }
+ return null;
+ }
+
public BalloonGadget getBalloonGadget(BalloonType balloonType)
{
for (Gadget gadget : getGadgets(GadgetType.BALLOON))
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java
index fef74b9fd..d57b89228 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java
@@ -9,19 +9,19 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.gadget.GadgetManager;
-import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
-import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord;
-import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane;
-import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord;
-import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
-import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
+import mineplex.core.gadget.gadgets.death.DeathCandyCane;
+import mineplex.core.gadget.gadgets.death.DeathFrostLord;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
import mineplex.core.gadget.gadgets.hat.HatType;
import mineplex.core.gadget.gadgets.item.ItemCoal;
import mineplex.core.gadget.gadgets.item.ItemFreezeCannon;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
-import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
+import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.mount.Mount;
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 43e1a4756..69e6f863d 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java
@@ -41,13 +41,30 @@ public class UnlockCosmeticsCommand extends CommandBase
{
addCosmetics(null, caller);
}
- else if (args.length == 1)
+ else if (args.length >= 1)
{
- Player player = Bukkit.getPlayer(args[0]);
- if (player != null)
+ if (args[0].equalsIgnoreCase("all"))
{
- addCosmetics(null, player);
- UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
+ for (Player player : UtilServer.getPlayers())
+ {
+ if (player != null)
+ {
+ addCosmetics(null, player);
+ UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < args.length; ++i)
+ {
+ Player player = Bukkit.getPlayer(args[i]);
+ if (player != null)
+ {
+ addCosmetics(null, player);
+ UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
+ }
+ }
}
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java
index f54c9ae92..180e336de 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.vampire;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java
index d45b1b023..58cbee4d9 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.candycane;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java
index d8f06ce45..be2cd9b90 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.party;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java
index c10562f6d..4249c19c3 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.cupidslove;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Color;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java
index 8592bc16b..b7b8a6df2 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.emerald;
+package mineplex.core.gadget.gadgets.arrowtrail;
import mineplex.core.common.util.*;
import org.bukkit.Location;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java
index 00e47e049..b33723020 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.wisdom;
+package mineplex.core.gadget.gadgets.arrowtrail;
import java.util.HashMap;
import java.util.Iterator;
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/ArrowTrailFreedom.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFreedom.java
index 8921b26cc..fa5f7ade2 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFreedom.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.freedom;
+package mineplex.core.gadget.gadgets.arrowtrail;
import java.awt.Color;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java
index 6ae8d9b43..3a7c910b5 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.frostlord;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java
index 112f272ad..bd5b62563 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.halloween;
+package mineplex.core.gadget.gadgets.arrowtrail;
import java.awt.Color;
import java.util.HashMap;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java
index d535035af..6c6a3006e 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.music;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailRedWhite.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailRedWhite.java
new file mode 100644
index 000000000..37934c81f
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailRedWhite.java
@@ -0,0 +1,77 @@
+package mineplex.core.gadget.gadgets.arrowtrail;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.LineFormat;
+import mineplex.core.common.util.UtilAlg;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.common.util.banner.CountryFlag;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.types.ArrowEffectGadget;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Arrow;
+import org.bukkit.util.Vector;
+
+import java.awt.Color;
+
+/**
+ * Trails a red and white double helix behind the arrow.
+ */
+public class ArrowTrailRedWhite extends ArrowEffectGadget
+{
+ public ArrowTrailRedWhite(GadgetManager manager)
+ {
+ super(manager, "Red & White Arrows",
+ UtilText.splitLineToArray(C.cRed + "Killing you nicely.", LineFormat.LORE),
+ -8, Material.WOOL, (byte)0);
+
+ setDisplayItem(CountryFlag.CANADA.getBanner());
+ }
+
+ @Override
+ public void doTrail(Arrow arrow)
+ {
+ Vector v = arrow.getVelocity();
+ Vector up = UtilAlg.getUp(v);
+ Vector left = UtilAlg.getLeft(v);
+
+ Location loc = arrow.getLocation();
+
+ double amount = 2;
+ double ticks = 15;
+
+ for(int i = 0; i < amount; i++)
+ {
+ double rad = Math.PI*2.0;
+ rad += i/amount * rad;
+ rad += Math.PI*2*(arrow.getTicksLived()%ticks)/ticks;
+ double l = -Math.sin(rad);
+ double u = Math.cos(rad);
+
+ Vector vel = v.clone().add(up.clone().multiply(u)).add(left.clone().multiply(l));
+ vel.multiply(0.4);
+
+ if (i == 0)
+ {
+ for(int j = 0; j < 3; ++j)
+ {
+ UtilParticle.playColoredParticleToAll(Color.RED, UtilParticle.ParticleType.RED_DUST, loc.clone().add(vel), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ else
+ {
+ for(int j = 0; j < 3; ++j)
+ {
+ UtilParticle.playColoredParticleToAll(Color.WHITE, UtilParticle.ParticleType.RED_DUST, loc.clone().add(vel), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void doHitEffect(Arrow arrow)
+ {
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.EXPLODE, arrow.getLocation(), 0, 0, 0, 0, 3, UtilParticle.ViewDist.NORMAL);
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java
index aec688901..8db14cbdb 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.shadow;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailSpring.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailSpring.java
index c335ce062..59cb064c4 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailSpring.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.spring;
+package mineplex.core.gadget.gadgets.arrowtrail;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java
index a3cc14165..084611017 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.howlingwinds;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java
index 956055929..29c39b7d0 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.arrowtrail.titan;
+package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java
index 5365e3e14..7101aba36 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.vampire;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java
index 45a7028d0..2d100b3fe 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.candycane;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java
index 1c92abc02..d0053f9df 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.cupidslove;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java
similarity index 93%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java
index 79ea0b404..85fb2db18 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.emerald;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java
index 7229b155d..35532906d 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.wisdom;
+package mineplex.core.gadget.gadgets.death;
import java.util.HashMap;
import java.util.Iterator;
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/DeathFreedom.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFreedom.java
index 24d43eb0b..137b68207 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFreedom.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.freedom;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.ChatColor;
import org.bukkit.Location;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java
similarity index 93%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java
index 0ce7b546f..72cd2c3cb 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.frostlord;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMapleLeaf.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMapleLeaf.java
new file mode 100644
index 000000000..3cfeeb034
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMapleLeaf.java
@@ -0,0 +1,45 @@
+package mineplex.core.gadget.gadgets.death;
+
+import mineplex.core.blood.BloodEvent;
+import mineplex.core.common.shape.ShapeWings;
+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.banner.CountryFlag;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.types.DeathEffectGadget;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+/**
+ * Displays a giant maple leaf at the point of death.
+ */
+public class DeathMapleLeaf extends DeathEffectGadget
+{
+ /** height off the ground of the leaf */
+ private static final double HEIGHT = 3;
+
+ private final ShapeWings _leafOuter = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1.0, 1.0, 1.0), 1, 0, false, 0, ShapeWings.MAPLE_LEAF);
+ private final ShapeWings _leafInner = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.7, 0, 0), 1, 0, false, 0, ShapeWings.MAPLE_LEAF);
+
+ public DeathMapleLeaf(GadgetManager manager)
+ {
+ super(manager, "Fallen Maple Leaf",
+ UtilText.splitLineToArray(C.cGray + "When you die in " + C.cRed + "Canada" + C.cGray + " you die in real life.", LineFormat.LORE),
+ -8, Material.WOOL, (byte) 0);
+
+ setDisplayItem(CountryFlag.CANADA.getBanner());
+ }
+
+ @Override
+ public void onBlood(Player player, BloodEvent event)
+ {
+ event.setCancelled(true);
+ Location loc = player.getLocation().add(0, HEIGHT, 0);
+ _leafOuter.display(loc);
+ _leafInner.display(loc);
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java
index 2bf566254..d6c4176ad 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.music;
+package mineplex.core.gadget.gadgets.death;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java
index 09ccfe10a..0adc3dfb8 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.party;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPresentDanger.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPresentDanger.java
index e8db5ed6a..c1b07ce33 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPresentDanger.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.christmas;
+package mineplex.core.gadget.gadgets.death;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java
index 3adb240f2..f80b4ad9b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.shadow;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathSpring.java
similarity index 98%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathSpring.java
index eb15f5986..bae34473b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathSpring.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.spring;
+package mineplex.core.gadget.gadgets.death;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java
index 00cf6d607..c3cf2f0da 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.howlingwinds;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java
index 00b64eace..0e56f8308 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.death.titan;
+package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java
index 882133687..2f910416c 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.vampire;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java
similarity index 91%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java
index d6a7620c7..209da4b7c 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.candycane;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -30,7 +30,7 @@ public class DoubleJumpCandyCane extends DoubleJumpEffectGadget
Location loc = player.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
- UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
+ UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java
index 71a7b66b5..81884a52b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.cupidslove;
+package mineplex.core.gadget.gadgets.doublejump;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java
index 0453e0b57..f74859c2c 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.emerald;
+package mineplex.core.gadget.gadgets.doublejump;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java
index ec1120f3b..d9d4db576 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.wisdom;
+package mineplex.core.gadget.gadgets.doublejump;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java
similarity index 95%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java
index 06ee124f7..65ce9bd80 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.party;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
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/DoubleJumpFreedom.java
similarity index 92%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFreedom.java
index 7f887e345..820ccd155 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFreedom.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.freedom;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -18,7 +18,7 @@ public class DoubleJumpFreedom extends DoubleJumpEffectGadget
{
super(manager, "Leap of Freedom", UtilText.splitLineToArray(UtilText.colorWords("FREEEEEEEEEEEDOM!",
ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL,
- (byte) 14);
+ (byte) 0);
setDisplayItem(CountryFlag.USA.getBanner());
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java
index 62325731c..64cc9f962 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.frostlord;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java
index 10155afbd..0f2cc13e8 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.halloween;
+package mineplex.core.gadget.gadgets.doublejump;
import java.awt.Color;
import java.util.HashMap;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMaple.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMaple.java
new file mode 100644
index 000000000..4b9d08338
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMaple.java
@@ -0,0 +1,110 @@
+package mineplex.core.gadget.gadgets.doublejump;
+
+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.UtilText;
+import mineplex.core.common.util.banner.CountryFlag;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.types.DoubleJumpEffectGadget;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class DoubleJumpMaple extends DoubleJumpEffectGadget
+{
+ /**
+ * Amount of particles played per tick as a player flies through the air.
+ */
+ private static final int PARTICLES = 50;
+
+ /**
+ * Vertical offset of the animation's center from the player's location.
+ */
+ private static final float Y_OFFSET = 0.95f;
+
+ /**
+ * Divisor of the gaussian distribution of particles as the player flies through the air.
+ */
+ private static final int DISTRIBUTION = 2;
+
+ /**
+ * Particle ring count when a player launches from the ground.
+ */
+ private static final int LAUNCH_RINGS = 6;
+
+ /**
+ * The distance between launch rings.
+ */
+ private static final float RING_SPACING = 0.4f;
+
+ /**
+ * Particles played per 1 unit radius.
+ */
+ private static final int RING_DENSITY = 8;
+
+ private HashMap _playerMap = new HashMap<>();
+
+ public DoubleJumpMaple(GadgetManager manager)
+ {
+ super(manager, "Maple Leap",
+ UtilText.splitLineToArray(C.cGray + "Jump higher than the maple trees!", LineFormat.LORE),
+ -8, Material.WOOL, (byte)0);
+ setDisplayItem(CountryFlag.CANADA.getBanner());
+ }
+
+ @Override
+ public void doEffect(Player player)
+ {
+ _playerMap.put(player, System.currentTimeMillis() + 1000);
+
+ float limit = (LAUNCH_RINGS * RING_SPACING) + RING_SPACING;
+
+ for (float r = RING_SPACING; r < limit; r++)
+ {
+ double[][] points = UtilMath.normalCircle(player.getLocation(), player.getVelocity(), r, Math.round(RING_DENSITY * r));
+
+ for (int i = 0; i < points.length; i++)
+ {
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.EXPLODE, new Location(player.getWorld(), points[i][0], points[i][1], points[i][2]),
+ null, 0, 1, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+
+ @EventHandler
+ public void onUpdate(UpdateEvent event)
+ {
+ if(event.getType() != UpdateType.FASTEST)
+ {
+ return;
+ }
+
+ for(Iterator> it = _playerMap.entrySet().iterator(); it.hasNext();)
+ {
+ Map.Entry e = it.next();
+
+ if(e.getValue() <= System.currentTimeMillis())
+ {
+ it.remove();
+ continue;
+ }
+
+ Location loc = e.getKey().getLocation().add(0, Y_OFFSET, 0);
+
+ for (int i = 0; i < PARTICLES; ++i)
+ {
+ UtilParticle.playColoredParticleToAll(java.awt.Color.RED, UtilParticle.ParticleType.RED_DUST,
+ UtilMath.gauss(loc, DISTRIBUTION, DISTRIBUTION, DISTRIBUTION), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java
index 5b7459f0d..2a4d5c1ba 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.music;
+package mineplex.core.gadget.gadgets.doublejump;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java
index 005c3403c..c64052bca 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.shadow;
+package mineplex.core.gadget.gadgets.doublejump;
import mineplex.core.common.util.C;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpSpring.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpSpring.java
index 63dabdaf9..527b44b0f 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpSpring.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.spring;
+package mineplex.core.gadget.gadgets.doublejump;
import java.util.ArrayList;
import java.util.Iterator;
@@ -38,7 +38,7 @@ public class DoubleJumpSpring extends DoubleJumpEffectGadget
{
for (int i = 50; i < 60; i++)
{
- Item sunflower = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
+ Item sunflower = player.getWorld().dropItem(player.getLocation().add(0.0, 0.2, 0.0), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
_items.add(sunflower);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java
similarity index 94%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java
index 6b04d1f00..9cd07ef15 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.howlingwinds;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java
index 336aaa5bc..9c81a3309 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.doublejump.titan;
+package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/flag/FlagType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/flag/FlagType.java
new file mode 100644
index 000000000..f51cf2ab6
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/flag/FlagType.java
@@ -0,0 +1,171 @@
+package mineplex.core.gadget.gadgets.flag;
+
+import mineplex.core.common.util.banner.CountryFlag;
+
+/**
+ * Cosmetic flags representing countries.
+ */
+public enum FlagType
+{
+ AFGHANISTAN(CountryFlag.AFGHANISTAN, -1),
+ ALBANIA(CountryFlag.ALBANIA, -1),
+ ALGERIA(CountryFlag.ALGERIA, -1),
+ ANGOLA(CountryFlag.ANGOLA, -1),
+ ARGENTINA(CountryFlag.ARGENTINA, -1),
+ ARMENIA(CountryFlag.ARMENIA, -1),
+ AUSTRALIA(CountryFlag.AUSTRALIA, -1),
+ AUSTRIA(CountryFlag.AUSTRIA, -1),
+ AZERBAIJAN(CountryFlag.AZERBAIJAN, -1),
+ BAHRAIN(CountryFlag.BAHRAIN, -1),
+ BANGLADESH(CountryFlag.BANGLADESH, -1),
+ BELARUS(CountryFlag.BELARUS, -1),
+ BELGIUM(CountryFlag.BELGIUM, -1),
+ BERMUDA(CountryFlag.BERMUDA, -1),
+ BHUTAN(CountryFlag.BHUTAN, -1),
+ BOLIVIA(CountryFlag.BOLIVIA, -1),
+ BOSNIA_AND_HERZEGOVINA(CountryFlag.BOSNIA_AND_HERZEGOVINA, -1),
+ BRAZIL(CountryFlag.BRAZIL, -1),
+ BRUNEI(CountryFlag.BRUNEI, -1),
+ BULGARIA(CountryFlag.BULGARIA, -1),
+ CAMBODIA(CountryFlag.CAMBODIA, -1),
+ CAMEROON(CountryFlag.CAMEROON, -1),
+ CANADA(CountryFlag.CANADA, -8),
+ CHILE(CountryFlag.CHILE, -1),
+ CHINA(CountryFlag.CHINA, -1),
+ COLOMBIA(CountryFlag.COLOMBIA, -1),
+ COSTA_RICA(CountryFlag.COSTA_RICA, -1),
+ CROATIA(CountryFlag.CROATIA, -1),
+ CUBA(CountryFlag.CUBA, -1),
+ CYPRUS(CountryFlag.CYPRUS, -1),
+ CZECH_REPUBLIC(CountryFlag.CZECH_REPUBLIC, -1),
+ DENMARK(CountryFlag.DENMARK, -1),
+ DOMINICAN_REPUBLIC(CountryFlag.DOMINICAN_REPUBLIC, -1),
+ ECUADOR(CountryFlag.ECUADOR, -1),
+ EGYPT(CountryFlag.EGYPT, -1),
+ EL_SALVADOR(CountryFlag.EL_SALVADOR, -1),
+ ENGLAND(CountryFlag.ENGLAND, -1),
+ ESTONIA(CountryFlag.ESTONIA, -1),
+ ETHIOPIA(CountryFlag.ETHIOPIA, -1),
+ EU(CountryFlag.EU, -1),
+ FAROE_ISLANDS(CountryFlag.FAROE_ISLANDS, -1),
+ FINLAND(CountryFlag.FINLAND, -1),
+ FRANCE(CountryFlag.FRANCE, -1),
+ GABON(CountryFlag.GABON, -1),
+ GEORGIA(CountryFlag.GEORGIA, -1),
+ GERMANY(CountryFlag.GERMANY, -1),
+ GHANA(CountryFlag.GHANA, -1),
+ GREECE(CountryFlag.GREECE, -1),
+ GUATEMALA(CountryFlag.GUATEMALA, -1),
+ HONDURAS(CountryFlag.HONDURAS, -1),
+ HONG_KONG(CountryFlag.HONG_KONG, -1),
+ HUNGARY(CountryFlag.HUNGARY, -1),
+ ICELAND(CountryFlag.ICELAND, -1),
+ INDIA(CountryFlag.INDIA, -1),
+ INDONESIA(CountryFlag.INDONESIA, -1),
+ IRAN(CountryFlag.IRAN, -1),
+ IRAQ(CountryFlag.IRAQ, -1),
+ IRELAND(CountryFlag.IRELAND, -1),
+ ISLE_OF_MAN(CountryFlag.ISLE_OF_MAN, -1),
+ ISRAEL(CountryFlag.ISRAEL, -1),
+ ITALY(CountryFlag.ITALY, -1),
+ IVORY_COAST(CountryFlag.IVORY_COAST, -1),
+ JAMAICA(CountryFlag.JAMAICA, -1),
+ JAPAN(CountryFlag.JAPAN, -1),
+ JORDAN(CountryFlag.JORDAN, -1),
+ KAZAKHSTAN(CountryFlag.KAZAKHSTAN, -1),
+ KENYA(CountryFlag.KENYA, -1),
+ KUWAIT(CountryFlag.KUWAIT, -1),
+ KYRGYZSTAN(CountryFlag.KYRGYZSTAN, -1),
+ LATVIA(CountryFlag.LATVIA, -1),
+ LEBANON(CountryFlag.LEBANON, -1),
+ LIBYA(CountryFlag.LIBYA, -1),
+ LITHUANIA(CountryFlag.LITHUANIA, -1),
+ LUXEMBOURG(CountryFlag.LUXEMBOURG, -1),
+ MACAU(CountryFlag.MACAU, -1),
+ MACEDONIA(CountryFlag.MACEDONIA, -1),
+ MALAYSIA(CountryFlag.MALAYSIA, -1),
+ MALTA(CountryFlag.MALTA, -1),
+ MEXICO(CountryFlag.MEXICO, -1),
+ MOLDOVA(CountryFlag.MOLDOVA, -1),
+ MONGOLIA(CountryFlag.MONGOLIA, -1),
+ MONTENEGRO(CountryFlag.MONTENEGRO, -1),
+ MOROCCO(CountryFlag.MOROCCO, -1),
+ MOZAMBIQUE(CountryFlag.MOZAMBIQUE, -1),
+ NEPAL(CountryFlag.NEPAL, -1),
+ NETHERLANDS(CountryFlag.NETHERLANDS, -1),
+ NEW_ZEALAND(CountryFlag.NEW_ZEALAND, -1),
+ NIGERIA(CountryFlag.NIGERIA, -1),
+ NORWAY(CountryFlag.NORWAY, -1),
+ OMAN(CountryFlag.OMAN, -1),
+ PAKISTAN(CountryFlag.PAKISTAN, -1),
+ PANAMA(CountryFlag.PANAMA, -1),
+ PARAGUAY(CountryFlag.PARAGUAY, -1),
+ PERU(CountryFlag.PERU, -1),
+ PHILIPPINES(CountryFlag.PHILIPPINES, -1),
+ POLAND(CountryFlag.POLAND, -1),
+ PORTUGAL(CountryFlag.PORTUGAL, -1),
+ PUERTO_RICO(CountryFlag.PUERTO_RICO, -1),
+ QATAR(CountryFlag.QATAR, -1),
+ ROMANIA(CountryFlag.ROMANIA, -1),
+ RUSSIA(CountryFlag.RUSSIA, -1),
+ RWANDA(CountryFlag.RWANDA, -1),
+ SAUDI_ARABIA(CountryFlag.SAUDI_ARABIA, -1),
+ SCOTLAND(CountryFlag.SCOTLAND, -1),
+ SENEGAL(CountryFlag.SENEGAL, -1),
+ SERBIA(CountryFlag.SERBIA, -1),
+ SINGAPORE(CountryFlag.SINGAPORE, -1),
+ SLOVAKIA(CountryFlag.SLOVAKIA, -1),
+ SLOVENIA(CountryFlag.SLOVENIA, -1),
+ SOLOMON_ISLANDS(CountryFlag.SOLOMON_ISLANDS, -1),
+ SOMALIA(CountryFlag.SOMALIA, -1),
+ SOUTH_AFRICA(CountryFlag.SOUTH_AFRICA, -1),
+ SOUTH_KOREA(CountryFlag.SOUTH_KOREA, -1),
+ SOUTH_SUDAN(CountryFlag.SOUTH_SUDAN, -1),
+ SPAIN(CountryFlag.SPAIN, -1),
+ SRI_LANKA(CountryFlag.SRI_LANKA, -1),
+ SUDAN(CountryFlag.SUDAN, -1),
+ SURINAME(CountryFlag.SURINAME, -1),
+ SWEDEN(CountryFlag.SWEDEN, -1),
+ SWITZERLAND(CountryFlag.SWITZERLAND, -1),
+ SYRIA(CountryFlag.SYRIA, -1),
+ TAIWAN(CountryFlag.TAIWAN, -1),
+ TAJIKISTAN(CountryFlag.TAJIKISTAN, -1),
+ TANZANIA(CountryFlag.TANZANIA, -1),
+ THAILAND(CountryFlag.THAILAND, -1),
+ TUNISIA(CountryFlag.TUNISIA, -1),
+ TURKEY(CountryFlag.TURKEY, -1),
+ UAE(CountryFlag.UAE, -1),
+ UGANDA(CountryFlag.UGANDA, -1),
+ UK(CountryFlag.UK, -1),
+ UKRAINE(CountryFlag.UKRAINE, -1),
+ URUGUAY(CountryFlag.URUGUAY, -1),
+ USA(CountryFlag.USA, -8),
+ UZBEKISTAN(CountryFlag.UZBEKISTAN, -1),
+ VENEZUELA(CountryFlag.VENEZUELA, -1),
+ VIETNAM(CountryFlag.VIETNAM, -1),
+ WALES(CountryFlag.WALES, -1),
+ YEMEN(CountryFlag.YEMEN, -1),
+ ZAMBIA(CountryFlag.ZAMBIA, -1),
+ ZIMBABWE(CountryFlag.ZIMBABWE, -1),
+
+ ;
+
+ private final CountryFlag _flag;
+ private final int _cost;
+
+ FlagType(CountryFlag flag, int cost)
+ {
+ _flag = flag;
+ _cost = cost;
+ }
+
+ public CountryFlag getFlag()
+ {
+ return _flag;
+ }
+
+ public int getCost()
+ {
+ return _cost;
+ }
+}
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
index c6f623e20..cabad2568 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java
@@ -22,7 +22,11 @@ public enum HatType
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),
- PUMPKIN("Pumpkin Hat", UtilText.splitLineToArray(C.cGray + "Pumpkin on the head, don't end up dead!", LineFormat.LORE), -9, Material.PUMPKIN);
+ PUMPKIN("Pumpkin Hat", UtilText.splitLineToArray(C.cGray + "Pumpkin on the head, don't end up dead!", LineFormat.LORE), -9, Material.PUMPKIN),
+ CANADA("Warm Canadian Hat", UtilText.splitLineToArray(C.cGray + "Keep your ears nice and warm while up north.", LineFormat.LORE), -8, SkinData.CANADA_HAT),
+ AMERICA("Patriotic American Hat", UtilText.splitLineToArray(C.cGray + "Careful not to get a big head.", LineFormat.LORE), -8, SkinData.AMERICA_HAT),
+
+ ;
private final String _name;
private final String[] _lore;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphFreedomFighter.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphFreedomFighter.java
new file mode 100644
index 000000000..f2af2f184
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphFreedomFighter.java
@@ -0,0 +1,266 @@
+package mineplex.core.gadget.gadgets.morph;
+
+import com.mojang.authlib.GameProfile;
+import mineplex.core.blockrestore.BlockRestore;
+import mineplex.core.common.skin.SkinData;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.LineFormat;
+import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.common.util.banner.CountryFlag;
+import mineplex.core.disguise.disguises.DisguisePlayer;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
+import mineplex.core.gadget.types.MorphGadget;
+import mineplex.core.recharge.Recharge;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.core.utils.UtilGameProfile;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.World;
+import org.bukkit.block.Banner;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+
+import java.time.Month;
+import java.time.YearMonth;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Freedom fighter morph, capable of planting flags by crouching.
+ */
+public class MorphFreedomFighter extends MorphGadget
+{
+ /** How long it takes to plant a flag */
+ private static final long FLAG_DELAY = 3500;
+
+ /** How long between flag plantings */
+ private static final long FLAG_COOLDOWN = 25000;
+
+ /** Recharge key for planting flags */
+ private static final String RECHARGE_KEY = "Plant Flag";
+
+ /** Design for beacon base */
+ private static final int[][] BEACON_BASE = {
+ { 0, -2, 0}, {1, -2, 0}, {0, -2, 1}, {1, -2, 1},
+ {-1, -2, 0}, {0, -2, -1}, {-1,-2,-1}, {0, -2, 1},
+ {-1, -2, 1}, {1, -2, -1}
+ };
+
+ /** Active timers for players planting flags */
+ private final Map _flagTimers = new HashMap<>();
+
+ /** Active timers for players that have planted flags */
+ private final Map _flagCooldowns = new HashMap<>();
+
+ public MorphFreedomFighter(GadgetManager manager)
+ {
+ super(manager, "Freedom Fighter", UtilText.splitLinesToArray(new String[] {
+ C.cGray + "Fight for your freedom from tyranny and oppressors!",
+ "",
+ C.cGreen + "Hold sneak" + C.cWhite + " to plant a flag of freedom!",
+ }, LineFormat.LORE), -14, Material.CHAINMAIL_CHESTPLATE, (byte) 0, YearMonth.of(2017, Month.JULY));
+ }
+
+ /**
+ * Sets the player's skin.
+ */
+ @Override
+ public void enableCustom(Player player, boolean message)
+ {
+ applyArmor(player, message);
+
+ GameProfile profile = UtilGameProfile.getGameProfile(player);
+ profile.getProperties().clear();
+ profile.getProperties().put("textures", SkinData.REVOLUTIONARY.getProperty());
+
+ DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
+ disguisePlayer.showInTabList(true, 0);
+ UtilMorph.disguise(player, disguisePlayer, Manager);
+
+ }
+
+ /**
+ * Restores the player's skin
+ */
+ @Override
+ public void disableCustom(Player player, boolean message)
+ {
+ removeArmor(player);
+ UtilMorph.undisguise(player, Manager.getDisguiseManager());
+ }
+
+ @EventHandler
+ public void onUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FASTEST)
+ {
+ return;
+ }
+
+ // Clear cooldown timers
+ if (event.getType() == UpdateType.SEC)
+ {
+ Iterator> itr = _flagCooldowns.entrySet().iterator();
+
+ while (itr.hasNext())
+ {
+ Map.Entry entry = itr.next();
+
+ if (entry.getValue() + FLAG_COOLDOWN < System.currentTimeMillis())
+ {
+ itr.remove();
+ }
+ }
+ }
+
+ // For all active cosmetics
+ for (Player player : getActive())
+ {
+ UUID uuid = player.getUniqueId();
+
+ // If the player is attempting to place a flag
+ if (_flagTimers.containsKey(uuid) && !_flagCooldowns.containsKey(uuid))
+ {
+ // Mark them as no longer attempting to place if not sneaking
+ if (!player.isSneaking())
+ {
+ _flagTimers.remove(uuid);
+ continue;
+ }
+
+ // If the players has waiting long enough to place the flag
+ if (_flagTimers.get(uuid) + FLAG_DELAY < System.currentTimeMillis())
+ {
+ boolean flag = false;
+ Location location = player.getLocation().subtract(0, 0.5, 0);
+
+ // Make sure the ground is flat enough to place the flag
+ for (int i = 0; i < BEACON_BASE.length; ++i)
+ {
+ Block b = location.clone().add(BEACON_BASE[i][0], 0, BEACON_BASE[i][2]).getBlock();
+
+ if (b.isEmpty())
+ {
+ flag = true;
+ break;
+ }
+ }
+
+ if (flag)
+ {
+ _flagTimers.remove(uuid);
+ player.sendMessage(F.main("Morphs", C.cRed + "You must plant your flag on flatter ground."));
+ }
+ else
+ {
+ // handle placing the flag
+ if (Recharge.Instance.use(player, RECHARGE_KEY, FLAG_COOLDOWN, true, false))
+ {
+ _flagTimers.remove(uuid);
+ _flagCooldowns.put(uuid, System.currentTimeMillis());
+ buildStructure(player);
+ }
+ }
+ }
+ else
+ {
+ // Play particles leading up to placing the flag
+ int particleCount = (int) ((System.currentTimeMillis() - _flagTimers.get(uuid)) / 40);
+ UtilParticle.playParticleFor(player, UtilParticle.ParticleType.FIREWORKS_SPARK,
+ UtilMath.gauss(player.getLocation().add(0, 1, 0), 2, 6, 2), null, 0, particleCount, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ else // if the player is not attempting to or has already placed a flag
+ {
+ if (player.isSneaking())
+ {
+ if (_flagCooldowns.containsKey(uuid))
+ {
+ if (Recharge.Instance.usable(player, RECHARGE_KEY, true))
+ {
+ _flagCooldowns.remove(uuid);
+ }
+ }
+ else
+ {
+ _flagTimers.put(uuid, System.currentTimeMillis());
+ _flagCooldowns.remove(uuid);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Builds the structure and beacon by the player.
+ */
+ private void buildStructure(Player player)
+ {
+ World world = player.getWorld();
+ BlockRestore restore = Manager.getBlockRestore();
+ int r = ThreadLocalRandom.current().nextInt(3);
+ byte data = r == 0 ? (byte) 14 : r == 1 ? (byte) 0 : 11;
+ Location point = player.getLocation().subtract(0, 0.5, 0);
+
+ while (point.getY() > 1 && !(UtilBlock.fullSolid(point.getBlock()) || UtilBlock.airFoliage(point.getBlock())))
+ {
+ point.setY(point.getY() - 1);
+ }
+
+ Block glass = point.getBlock().getRelative(BlockFace.UP);
+ restore.add(glass, Material.STAINED_GLASS.getId(), data, FLAG_COOLDOWN);
+ glass = glass.getRelative(BlockFace.UP);
+ restore.add(glass, Material.STAINED_GLASS.getId(), data, FLAG_COOLDOWN);
+
+ BlockFace[] faces = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.WEST, BlockFace.EAST };
+ Block[] blocks = { glass.getRelative(BlockFace.NORTH), glass.getRelative(BlockFace.SOUTH),
+ glass.getRelative(BlockFace.WEST), glass.getRelative(BlockFace.EAST) };
+
+ restore.add(glass.getRelative(BlockFace.UP), Material.CARPET.getId(), data, FLAG_COOLDOWN - 50);
+
+ for (int i = 0; i < 4; ++i)
+ {
+ restore.add(blocks[i], Material.WALL_BANNER.getId(), (byte) i, blocks[i].getTypeId(), blocks[i].getData(), FLAG_COOLDOWN - 100);
+ }
+
+ for (int i = 0; i < 4; ++i)
+ {
+ Banner state = ((Banner) blocks[i].getState());
+ org.bukkit.material.Banner stateData = (org.bukkit.material.Banner) state.getData();
+ stateData.setFacingDirection(faces[i]);
+ CountryFlag flag = i < 2 ? CountryFlag.USA : CountryFlag.CANADA;
+ state.setBaseColor(flag.getBaseColor());
+ state.setPatterns(flag.getPatterns());
+ state.update();
+ }
+
+ restore.add(point.getBlock(), Material.PISTON_BASE.getId(), (byte) 0, FLAG_COOLDOWN);
+
+ point.subtract(0, 1, 0);
+ restore.add(point.getBlock(), Material.PISTON_BASE.getId(), (byte) 0, FLAG_COOLDOWN);
+
+ restore.add(point.getBlock().getRelative(BlockFace.DOWN), Material.BEACON.getId(), (byte) 0, FLAG_COOLDOWN);
+
+ for (int i = 0; i < BEACON_BASE.length; ++i)
+ {
+ restore.add(world.getBlockAt(point.clone().add(BEACON_BASE[i][0], BEACON_BASE[i][1], BEACON_BASE[i][2])),
+ Material.IRON_BLOCK.getId(), (byte) 0, FLAG_COOLDOWN);
+ }
+
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.HUGE_EXPLOSION, player.getLocation(), null, 0, 1, UtilParticle.ViewDist.NORMAL);
+ player.playSound(player.getLocation(), Sound.EXPLODE, 1.0f, 1.0f);
+ player.teleport(player.getLocation().add(0, 2.5, 0));
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMelonHead.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMelonHead.java
new file mode 100644
index 000000000..4b2ce16c6
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMelonHead.java
@@ -0,0 +1,168 @@
+package mineplex.core.gadget.gadgets.morph;
+
+import com.mojang.authlib.GameProfile;
+import mineplex.core.common.skin.SkinData;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.LineFormat;
+import mineplex.core.common.util.UtilFirework;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.disguise.disguises.DisguisePlayer;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
+import mineplex.core.gadget.types.MorphGadget;
+import mineplex.core.utils.UtilGameProfile;
+import org.apache.commons.lang3.tuple.Pair;
+import org.bukkit.Bukkit;
+import org.bukkit.Color;
+import org.bukkit.FireworkEffect;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.inventory.ItemStack;
+
+import java.time.Month;
+import java.time.YearMonth;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * PPC Reward for month of August 2017. Allows users to turn other player's heads into various fruits.
+ */
+public class MorphMelonHead extends MorphGadget
+{
+ /** Fruit head texture options */
+ private static final Pair[] TEXTURES = {
+ Pair.of(SkinData.APPLE, C.cDRedB + "Apple Head"),
+ Pair.of(SkinData.MELON, C.cDGreenB + "Melon Head"),
+ Pair.of(SkinData.ORANGE, C.cGoldB + "Orange Head"),
+ Pair.of(SkinData.STRAWBERRY, C.cRedB + "Berry Head"),
+ Pair.of(SkinData.PINEAPPLE, C.cYellowB + "Pineapple Head"),
+ Pair.of(SkinData.GREEN_APPLE, C.cGreenB + "Apple Head"),
+ Pair.of(SkinData.PLUM, C.cPurpleB + "Plum Head")
+ };
+
+ /** Ticks that a fruit head change lasts */
+ private static final long TIME = 240;
+
+ /** Map of players to their current fruit heads */
+ private final Map _heads = new HashMap<>();
+
+ public MorphMelonHead(GadgetManager manager)
+ {
+ super(manager, "Melonhead Morph", UtilText.splitLinesToArray(new String[] {
+ C.cGray + "Transform yourself into a melon.",
+ C.cGray + "Tag other players to build your melon army!",
+ "",
+ C.cGreen + "Left click" + C.cWhite + " players to turn their heads to fruit."
+ }, LineFormat.LORE), -14, Material.MELON, (byte) 0, YearMonth.of(2017, Month.AUGUST));
+ }
+
+ /**
+ * Sets the player's skin to a Melon texture.
+ */
+ @Override
+ public void enableCustom(Player player, boolean message)
+ {
+ applyArmor(player, message);
+
+ GameProfile profile = UtilGameProfile.getGameProfile(player);
+ profile.getProperties().clear();
+ profile.getProperties().put("textures", SkinData.MELON_PERSON.getProperty());
+
+ DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
+ disguisePlayer.showInTabList(true, 0);
+ UtilMorph.disguise(player, disguisePlayer, Manager);
+ }
+
+ /**
+ * Restores the player's skin.
+ */
+ @Override
+ public void disableCustom(Player player, boolean message)
+ {
+ removeArmor(player);
+ UtilMorph.undisguise(player, Manager.getDisguiseManager());
+ }
+
+ /**
+ * Detect when a player punches another player.
+ */
+ @EventHandler
+ public void handlePlayerInteract(EntityDamageByEntityEvent event)
+ {
+ // Check it's two players interacting
+ if (event.getDamager() instanceof Player && event.getEntity() instanceof Player)
+ {
+ if (!isActive((Player) event.getDamager()))
+ {
+ return;
+ }
+
+ Player player = (Player) event.getEntity();
+
+ // do nothing if the player has a helmet already
+ if (player.getInventory().getHelmet() != null)
+ {
+ return;
+ }
+
+ // do nothing if the player is supposed to already have a fruit helmet
+ if (_heads.containsKey(player.getUniqueId()))
+ {
+ return;
+ }
+
+ // select a head skin and name it
+ Pair data = TEXTURES[ThreadLocalRandom.current().nextInt(TEXTURES.length)];
+ ItemStack head = data.getLeft().getSkull(data.getRight(), new ArrayList<>());
+
+ // equip the head and notify the player of the action
+ _heads.put(player.getUniqueId(), head);
+ player.getInventory().setHelmet(head);
+ player.getWorld().playSound(player.getEyeLocation(), Sound.CHICKEN_EGG_POP, 1, 0);
+ UtilFirework.playFirework(player.getEyeLocation(), FireworkEffect.builder().withColor(Color.LIME).with(FireworkEffect.Type.BALL).build());
+ player.sendMessage(F.main("Melonhead", C.cYellow + "Wham! " + C.cGray + "You just got " + C.cGreen + "MELON'D!"));
+
+ // schedule the head to be removed later
+ Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), () ->
+ {
+ // don't do anything if the player has logged off
+ if (_heads.containsKey(player.getUniqueId()))
+ {
+ ItemStack item = _heads.remove(player.getUniqueId());
+
+ // don't remove the helmet if it has already been changed.
+ if (player.getInventory().getHelmet() != null && player.getInventory().getHelmet().equals(item))
+ {
+ player.getInventory().setHelmet(null);
+
+ }
+ }
+
+ }, TIME);
+ }
+ }
+
+
+ /**
+ * Clean hash maps on player disconnect.
+ */
+ @EventHandler
+ public void onPlayerDisconnect(PlayerQuitEvent event)
+ {
+ if (isActive(event.getPlayer()))
+ {
+ if (_heads.containsKey(event.getPlayer().getUniqueId()))
+ {
+ _heads.remove(event.getPlayer().getUniqueId());
+ }
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java
index a33078067..0c3c3546a 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.vampire;
+package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java
similarity index 93%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java
index 4d8b223fc..e9e572f19 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.candycane;
+package mineplex.core.gadget.gadgets.particle;
import java.util.HashMap;
import java.util.UUID;
@@ -63,7 +63,7 @@ public class ParticleCandyCane extends ParticleGadget
UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL);
UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL);
- UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL);
+ UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL);
}
@EventHandler
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 236bc1e8a..651993fb9 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
@@ -1,5 +1,6 @@
package mineplex.core.gadget.gadgets.particle;
+import mineplex.core.common.util.UtilMath;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@@ -27,7 +28,7 @@ public class ParticleCoalFumes extends ParticleGadget
@Override
public void playParticle(Player player, UpdateEvent event)
{
- if(event.getType() != UpdateType.TICK) return;
+ if(event.getType() != UpdateType.FASTER) return;
float xz = 1;
int amount = 5;
@@ -39,6 +40,6 @@ public class ParticleCoalFumes extends ParticleGadget
amount = 2;
}
- UtilParticle.playParticleFor(player, type, player.getLocation(), xz, 0, xz, 0, amount, ViewDist.NORMAL);
+ UtilParticle.playParticleFor(player, type, UtilMath.gauss(player.getLocation(), 2, 6, 2), xz, 0, xz, 0, amount, ViewDist.NORMAL);
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java
index 417587dbb..f81361c66 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.emerald;
+package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java
index f8d734e74..706c32fbd 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.wisdom;
+package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Material;
import org.bukkit.entity.Player;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java
similarity index 98%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java
index 9c3b8be54..fd315fc04 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.shadow;
+package mineplex.core.gadget.gadgets.particle;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java
similarity index 97%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java
index 62c1388b3..32f947e47 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.frostlord;
+package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Material;
import org.bukkit.Sound;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java
similarity index 84%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java
index dea6a85aa..c48b0ddb4 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java
@@ -1,5 +1,6 @@
-package mineplex.core.gadget.gadgets.particle.cupidslove;
+package mineplex.core.gadget.gadgets.particle;
+import mineplex.core.common.util.UtilMath;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -37,11 +38,11 @@ public class ParticleHeart extends ParticleGadget
{
if(getSet() == null || !getSet().isActive(player)) return;
- UtilParticle.playParticleFor(player, ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL);
+ UtilParticle.playParticleFor(player, ParticleType.HEART, player.getLocation().add(0, 1.2, 0), null, 0, 1, ViewDist.NORMAL);
}
else
{
- UtilParticle.playParticleFor(player, ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL);
+ UtilParticle.playParticleFor(player, ParticleType.HEART, UtilMath.gauss(player.getLocation(), 1, 3, 1).add(0, 1.2, 0), null, 0, 1, ViewDist.NORMAL);
}
}
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 f99338a75..9f1a9afa4 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
@@ -1,6 +1,8 @@
package mineplex.core.gadget.gadgets.particle;
-import org.bukkit.Effect;
+import java.awt.*;
+
+import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -9,6 +11,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.Rank;
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.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
@@ -19,10 +23,36 @@ import mineplex.core.updater.event.UpdateEvent;
public class ParticleLegend extends ParticleGadget
{
+ private static final double PI = Math.PI;
+ private static final int BASE_PILLARS = 9;
+ private static final int PILLAR_VARIANCE = 8;
+ private static final int MOVING_PARTICLES = 8;
+ private static final double VERTICAL_SPEED = 0.1;
+ private static final double HEIGHT_VARIANCE = 0.8;
+ private static final double ROTATIONAL_SPEED = .03;
+ private static final double RADIAL_VARIANCE = 0.09;
+ private static final double BASE_RADIUS = 1.30;
+ private static final double HEIGHT_MODIFIER_BASE = 0.1;
+ private static final double HEIGHT_MODIFIER_MAX = 1.3;
+ private static final double HEIGHT_MODIFIER_INTERVAL = 0.15;
+ private static final Color[] SELECTABLE_COLORS = {
+ new Color(60, 170, 25),
+ new Color(33, 92, 13),
+ new Color(0, 0, 0)
+ };
+
+ private final int _pillars = pillars();
+ private final Color[] _colors = colors();
+ private final double[] _heights = heights();
+ private final double[] _verticals = verticals();
+ private final double[] _variance = variances();
+ private final double[] _thetas = thetas();
+ private final double[] _radii = radii();
+
public ParticleLegend(GadgetManager manager)
{
super(manager, "Legendary Aura",
- UtilText.splitLineToArray(C.cGray + "This particle will be updated soon! Yay!", LineFormat.LORE),
+ UtilText.splitLineToArray(C.cGray + "Legendary energy protects you.", LineFormat.LORE),
-1,
Material.ENDER_PORTAL_FRAME, (byte)0);
}
@@ -31,11 +61,150 @@ public class ParticleLegend extends ParticleGadget
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
+ {
return;
+ }
- player.getWorld().playEffect(player.getLocation().add(0, 1, 0), Effect.ENDER_SIGNAL, 0);
+ if (Manager.isMoving(player))
+ {
+
+ for (int i = 0; i < MOVING_PARTICLES; i++)
+ {
+ if (_colors[i % _colors.length].getGreen() == 0)
+ {
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SMOKE,
+ UtilMath.gauss(player.getLocation(), 8, 4, 8), null, 0, 1, UtilParticle.ViewDist.NORMAL);
+ }
+ else
+ {
+ UtilParticle.playColoredParticleToAll(_colors[i % _colors.length], UtilParticle.ParticleType.RED_DUST,
+ UtilMath.gauss(player.getLocation(), 8, 4, 8), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+ else
+ {
+ if (event.getTick() % (ROTATIONAL_SPEED * 100) == 0)
+ {
+ for (int i = 0; i < _pillars; i++)
+ {
+ _thetas[i] = rollover(_thetas[i], ROTATIONAL_SPEED);
+ _heights[i] = rollover(_heights[i], _verticals[i]);
+
+ double x = (_radii[i] * Math.cos(_thetas[i])) + player.getLocation().getX();
+ double z = (_radii[i] * Math.sin(_thetas[i])) + player.getLocation().getZ();
+ double y = (Math.sin(_heights[i]) * _variance[i]) + player.getLocation().getY();
+
+ for (double h = HEIGHT_MODIFIER_BASE; h <= HEIGHT_MODIFIER_MAX; h+= HEIGHT_MODIFIER_INTERVAL)
+ {
+ if (_colors[i].getGreen() == 0)
+ {
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SMOKE,
+ new Location(player.getWorld(), x, y + h, z), null, 0, 1, UtilParticle.ViewDist.NORMAL);
+ }
+ else
+ {
+ UtilParticle.playColoredParticleToAll(_colors[i], UtilParticle.ParticleType.RED_DUST,
+ new Location(player.getWorld(), x, y + h, z), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+ }
+ }
}
-
+
+ private double[] heights()
+ {
+ double[] array = new double[_pillars];
+
+ for (int i = 0; i < _pillars; i++)
+ {
+ array[i] = 6.28 * Math.random();
+ }
+
+ return array;
+ }
+
+ private double[] variances()
+ {
+ double[] array = new double[_pillars];
+
+ for (int i = 0; i < _pillars; i++)
+ {
+ array[i] = Math.random() * HEIGHT_VARIANCE;
+ }
+
+ return array;
+ }
+
+ private double[] verticals()
+ {
+ double[] array = new double[_pillars];
+
+ for (int i = 0; i < _pillars; i++)
+ {
+ array[i] = Math.random() * VERTICAL_SPEED;
+ }
+
+ return array;
+ }
+
+ private double[] thetas()
+ {
+ double[] array = new double[_pillars];
+ double theta = 0;
+ double interval = (2 * PI) / _pillars;
+
+ for (int i = 0; i < _pillars; i++)
+ {
+ array[i] = theta;
+ theta += interval;
+ }
+
+ return array;
+ }
+
+ private double[] radii()
+ {
+ double[] array = new double[_pillars];
+
+ for (int i = 0; i < _pillars; i++)
+ {
+ array[i] = BASE_RADIUS + (Math.random() * RADIAL_VARIANCE);
+ }
+
+ return array;
+ }
+
+ private Color[] colors()
+ {
+ Color[] array = new Color[_pillars];
+
+ for (int i = 0; i < _pillars; i++)
+ {
+ array[i] = SELECTABLE_COLORS[i % SELECTABLE_COLORS.length];
+ }
+
+ return array;
+ }
+
+ private int pillars()
+ {
+ return BASE_PILLARS + (int) ((Math.random() * PILLAR_VARIANCE) - (PILLAR_VARIANCE / 2));
+ }
+
+ private double rollover(double value, double additive)
+ {
+ value += additive;
+
+ if (value >= 2 * PI)
+ {
+ value = value - (2 * PI);
+ }
+
+ return value;
+ }
+
@EventHandler
public void legendOwner(PlayerJoinEvent event)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java
similarity index 98%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java
index 04874fffc..e0bbb3537 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.music;
+package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java
similarity index 98%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java
index 3aab6f928..a3944317c 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.party;
+package mineplex.core.gadget.gadgets.particle;
import java.util.Arrays;
import java.util.Collections;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java
similarity index 96%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java
index f2c45007c..4311666c0 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.howlingwinds;
+package mineplex.core.gadget.gadgets.particle;
import java.util.ArrayList;
import java.util.List;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java
similarity index 98%
rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java
rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java
index b5f02de23..7d062f713 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java
@@ -1,4 +1,4 @@
-package mineplex.core.gadget.gadgets.particle.titan;
+package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleAuraNiceness.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleAuraNiceness.java
new file mode 100644
index 000000000..2e68270e5
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleAuraNiceness.java
@@ -0,0 +1,194 @@
+package mineplex.core.gadget.gadgets.particle.freedom;
+
+import mineplex.core.arcadeevents.CoreGameStartEvent;
+import mineplex.core.arcadeevents.CoreGameStopEvent;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.LineFormat;
+import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilShapes;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.common.util.banner.CountryFlag;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.types.ParticleGadget;
+import mineplex.core.treasure.event.TreasureFinishEvent;
+import mineplex.core.treasure.event.TreasureStartEvent;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.block.BlockPhysicsEvent;
+
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Collectors;
+
+/**
+ * Places flowers around the player with poofs of red and white
+ */
+public class ParticleAuraNiceness extends ParticleGadget
+{
+ /** Radius within which flowers not allowed near treasure chests */
+ private static final int TREASURE_RADIUS = 4;
+
+ /** Horizontal offset for particle spawns */
+ private static final double H_FIELD = 0.5;
+
+ /** Vertical offset for particle spawns */
+ private static final double V_FIELD = 0.35;
+
+ /** How likely a flower is to be spawned (1/n) */
+ private static final int ROSE_PROBABILITY = 40;
+
+ /** Radius in which flowers are spawned */
+ private static final double ROSE_RADIUS = 2.5;
+
+ /** How many particles accompany each flower spawn */
+ private static final int PARTICLE_COUNT = 20;
+
+ /** List of blocks that have flowers in them */
+ private final Set _blocks = new HashSet<>();
+
+ /** Milliseconds for which flowers persist */
+ private final long DURATION = 5000;
+
+ /** Locations at which treasure is currently being opened */
+ private final Map _openingTreasure = new HashMap<>();
+
+ /** Whether flowers can be spawned in addition to particles */
+ private boolean _enabled = true;
+
+ public ParticleAuraNiceness(GadgetManager manager)
+ {
+ super(manager, "Aura of Niceness",
+ UtilText.splitLineToArray(C.cGray + "Canadians are always nice online.", LineFormat.LORE), -8, Material.WOOL,
+ (byte) 0);
+
+ setDisplayItem(CountryFlag.CANADA.getBanner());
+ }
+
+ @Override
+ public void playParticle(Player player, UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FASTER)
+ {
+ return;
+ }
+
+ for (Location location : _openingTreasure.values())
+ {
+ if (location.toVector().isInSphere(player.getLocation().toVector(), TREASURE_RADIUS))
+ {
+ return;
+ }
+ }
+
+ UtilShapes.getCircle(player.getLocation().subtract(0, 0.5, 0), false, ROSE_RADIUS).stream().map(Location::getBlock)
+ .collect(Collectors.toSet()).forEach(block ->
+ {
+ if (ThreadLocalRandom.current().nextInt(ROSE_PROBABILITY) == 0)
+ {
+ Block b = block.getRelative(BlockFace.UP);
+
+ if (b.isEmpty() && UtilBlock.fullSolid(block) && !UtilBlock.bottomSlab(block))
+ {
+ Location loc = b.getLocation().add(H_FIELD, V_FIELD, H_FIELD);
+
+ if (_enabled)
+ {
+ byte data = ThreadLocalRandom.current().nextInt(2) == 0 ? (byte) 4 : 6;
+
+ _blocks.add(b);
+ Manager.getBlockRestore().add(b, Material.RED_ROSE.getId(), data, DURATION);
+ }
+
+ for (int i = 0; i < PARTICLE_COUNT; ++i)
+ {
+ UtilParticle.playColoredParticleToAll(Color.RED, UtilParticle.ParticleType.RED_DUST, UtilMath.gauss(loc, 4, 4, 4), 0, UtilParticle.ViewDist.NORMAL);
+ UtilParticle.playColoredParticleToAll(Color.WHITE, UtilParticle.ParticleType.RED_DUST, UtilMath.gauss(loc, 4, 4, 4), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+ });
+
+ for(Iterator it = _blocks.iterator(); it.hasNext();)
+ {
+ Block b = it.next();
+
+ if (b.getType() != Material.RED_ROSE)
+ {
+ it.remove();
+ Location loc = b.getLocation().add(H_FIELD, V_FIELD, H_FIELD);
+ for (int i = 0; i < PARTICLE_COUNT / 2; ++i)
+ {
+ UtilParticle.playColoredParticleToAll(Color.RED, UtilParticle.ParticleType.RED_DUST, UtilMath.gauss(loc, 6, 6, 6), 0, UtilParticle.ViewDist.NORMAL);
+ UtilParticle.playColoredParticleToAll(Color.WHITE, UtilParticle.ParticleType.RED_DUST, UtilMath.gauss(loc, 6, 6, 6), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+ }
+
+ /**
+ * Stop flowers from popping off of blocks
+ */
+ @EventHandler
+ public void onBlockFade(BlockPhysicsEvent event)
+ {
+ if (_blocks.contains(event.getBlock()))
+ {
+ event.setCancelled(true);
+ }
+ }
+
+ /**
+ * Disable flowers in the area around treasure being opened.
+ */
+ @EventHandler(priority = EventPriority.LOW)
+ public void disableOnTreasureStart(TreasureStartEvent event)
+ {
+ _openingTreasure.put(event.getPlayer().getUniqueId(), event.getPlayer().getLocation());
+ Manager.getBlockRestore().restoreBlockAround(Material.CARPET, event.getPlayer().getLocation(), TREASURE_RADIUS);
+ }
+
+ /**
+ * Enable flowers in the area around treasure no longer being opened.
+ */
+ @EventHandler(priority = EventPriority.HIGH)
+ public void enableOnTreasureFinish(TreasureFinishEvent event)
+ {
+ if (_openingTreasure.containsKey(event.getPlayer().getUniqueId()))
+ {
+ _openingTreasure.remove(event.getPlayer().getUniqueId());
+ }
+ }
+
+ /**
+ * Disable flowers on game start
+ */
+ @EventHandler
+ public void onGameStart(CoreGameStartEvent event)
+ {
+ _enabled = false;
+ }
+
+ /**
+ * Enable flowers on game end
+ */
+ @EventHandler
+ public void onGameEnd(CoreGameStopEvent event)
+ {
+ _enabled = true;
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleCanadian.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleCanadian.java
new file mode 100644
index 000000000..4770908b9
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleCanadian.java
@@ -0,0 +1,71 @@
+package mineplex.core.gadget.gadgets.particle.freedom;
+
+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.banner.CountryFlag;
+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;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.BannerMeta;
+
+import java.awt.Color;
+
+/**
+ * Leaves a trail behind the player with the colors of the Canadian flag.
+ */
+public class ParticleCanadian extends ParticleGadget
+{
+ /** # of lines of particles */
+ private static final int STRAND_COUNT = 9;
+
+ /** How far apart each line of particles is */
+ private static final double STRAND_SPACING = 0.124;
+
+ /** How far off the floor the particles begin */
+ private static final double DISTANCE_FROM_FLOOR = 0.43;
+
+ public ParticleCanadian(GadgetManager manager)
+ {
+ super(manager, "Canadian Trail",
+ UtilText.splitLineToArray(C.cGray + "Lead the way to freedom!", LineFormat.LORE),
+ -8, Material.WOOL, (byte) 0);
+
+ setDisplayItem(CountryFlag.CANADA.getBanner());
+ }
+
+ @Override
+ public void playParticle(Player player, UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.TICK)
+ {
+ return;
+ }
+
+ Location center = player.getLocation().subtract(player.getLocation().getDirection().multiply(0.4))
+ .subtract(0, 0.1, 0).add(0, DISTANCE_FROM_FLOOR, 0);
+
+ if (Manager.isMoving(player))
+ {
+ for (int i = 0; i < STRAND_COUNT; i++)
+ {
+ if (i < 3 || i > 5)
+ {
+ UtilParticle.playColoredParticleToAll(Color.RED, UtilParticle.ParticleType.RED_DUST,
+ center.add(0, STRAND_SPACING, 0), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ else
+ {
+ UtilParticle.playColoredParticleToAll(Color.WHITE, UtilParticle.ParticleType.RED_DUST,
+ center.add(0, STRAND_SPACING, 0), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedomFireworks.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedomFireworks.java
new file mode 100644
index 000000000..a7a18702e
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedomFireworks.java
@@ -0,0 +1,59 @@
+package mineplex.core.gadget.gadgets.particle.freedom;
+
+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.UtilText;
+import mineplex.core.common.util.banner.CountryFlag;
+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;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Small fireworks which explode around the player
+ */
+public class ParticleFreedomFireworks extends ParticleGadget
+{
+ /** Block types to source for particles */
+ private static final Material[] BLOCKTYPES = {
+ Material.REDSTONE_BLOCK,
+ Material.LAPIS_BLOCK,
+ Material.QUARTZ_BLOCK
+ };
+
+ /** Amount of particles for each firework */
+ private static final int PARTICLE_COUNT = 20;
+
+ public ParticleFreedomFireworks(GadgetManager manager)
+ {
+ super(manager, "Freedom Fireworks",
+ UtilText.splitLineToArray(C.cGray + "Keep your patriotism close.", LineFormat.LORE),
+ -8, Material.WOOL, (byte) 0);
+
+ setDisplayItem(CountryFlag.USA.getBanner());
+ }
+
+ @Override
+ public void playParticle(Player player, UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ {
+ return;
+ }
+
+ String particle = UtilParticle.ParticleType.BLOCK_CRACK.getParticle(BLOCKTYPES[ThreadLocalRandom.current().nextInt(0, BLOCKTYPES.length)], 0);
+ Location location = UtilMath.gauss(player.getEyeLocation(), 1, 1, 1);
+
+ for (int i = 0; i < PARTICLE_COUNT; ++i)
+ {
+ UtilParticle.PlayParticleToAll(particle, location, null, 3.0f, 1, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleStarSpangled.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleStarSpangled.java
new file mode 100644
index 000000000..7ad601f9a
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleStarSpangled.java
@@ -0,0 +1,81 @@
+package mineplex.core.gadget.gadgets.particle.freedom;
+
+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.banner.CountryFlag;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.types.ParticleGadget;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import net.minecraft.server.v1_8_R3.MinecraftServer;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+
+import java.awt.*;
+
+
+/**
+ * @author J Teissler
+ * @date 6/26/17
+ */
+public class ParticleStarSpangled extends ParticleGadget
+{
+ private static final int STRAND_COUNT = 9;
+ private static final double STRAND_SPACING = 0.124;
+ private static final double DISTANCE_FROM_FLOOR = 0.43;
+
+ private static final Color BLUE = new Color(29, 26, 120);
+
+ public ParticleStarSpangled(GadgetManager manager)
+ {
+ super(manager, "Star Spangled Stripe",
+ UtilText.splitLineToArray(C.cGray + "Blaze a trail of freedom!", LineFormat.LORE),
+ -8, Material.WOOL, (byte) 0);
+ setDisplayItem(CountryFlag.USA.getBanner());
+ }
+
+ @Override
+ public void playParticle(Player player, UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.TICK)
+ {
+ return;
+ }
+
+ Location center = player.getLocation().subtract(player.getLocation().getDirection().multiply(0.4))
+ .subtract(0, 0.1, 0).add(0, DISTANCE_FROM_FLOOR, 0);
+
+ if (Manager.isMoving(player))
+ {
+ for (int i = 0; i < STRAND_COUNT; i++)
+ {
+ if (i == 3 || i == 7)
+ {
+ if (player.getTicksLived() % 3 == 0)
+ {
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FIREWORKS_SPARK,
+ center.add(0, STRAND_SPACING, 0), 0f, 0f, 0f, 0f, 0, UtilParticle.ViewDist.NORMAL);
+ continue;
+ }
+ }
+ else if (i == 5)
+ {
+ if (player.getTicksLived() + 1 % 3 == 0)
+ {
+ UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FIREWORKS_SPARK,
+ center.add(0, STRAND_SPACING, 0), 0f, 0f, 0f, 0f, 0, UtilParticle.ViewDist.NORMAL);
+ continue;
+ }
+ }
+
+ UtilParticle.playColoredParticleToAll(BLUE, UtilParticle.ParticleType.RED_DUST,
+ center.add(0, STRAND_SPACING, 0), 0, UtilParticle.ViewDist.NORMAL);
+ }
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java
index fdc5da288..c246b2975 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java
@@ -35,10 +35,12 @@ public class BlowAKissTaunt extends TauntGadget
}
@Override
- public void onStart(Player player)
+ public boolean onStart(Player player)
{
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
- return;
+ {
+ return false;
+ }
HashSet ignore = new HashSet<>();
ignore.add(Material.AIR);
@@ -46,6 +48,8 @@ public class BlowAKissTaunt extends TauntGadget
BlowAKissEffect blowAKissEffect = new BlowAKissEffect(player, loc, this);
blowAKissEffect.start();
+
+ return true;
}
@Override
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java
index 103efacd2..6e0a7e133 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java
@@ -6,6 +6,8 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import mineplex.core.disguise.disguises.DisguiseBase;
+import mineplex.core.game.GameDisplay;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
@@ -28,9 +30,7 @@ import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.events.EnableArcadeSpawnEvent;
import mineplex.core.gadget.GadgetManager;
-import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.TauntGadget;
-import mineplex.core.game.GameDisplay;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@@ -41,7 +41,8 @@ public class EternalTaunt extends TauntGadget
private static final int COOLDOWN = 30000;
private static final int PVP_COOLDOWN = 10000;
- private Map> _clocks = new HashMap<>();
+ private final Map> _clocks = new HashMap<>();
+ private final Map _disguises = new HashMap<>();
public EternalTaunt(GadgetManager manager)
{
@@ -50,33 +51,48 @@ public class EternalTaunt extends TauntGadget
C.cWhite + "Use /taunt in game to show how long you've been waiting.",
C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE),
-15, Material.WATCH, (byte) 0);
+
setCanPlayWithPvp(false);
setPvpCooldown(PVP_COOLDOWN);
setShouldPlay(true);
setEventType(UpdateType.FAST);
- addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination);
+ addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination, GameDisplay.SmashTraining);
}
@Override
- public void onStart(Player player)
+ public boolean onStart(Player player)
{
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
- return;
+ {
+ return false;
+ }
+
UtilFirework.playFirework(player.getLocation(), FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.fromRGB(255, 175, 175)).withFade(Color.RED).build());
_clocks.put(player.getUniqueId(), new ArrayList<>());
Bukkit.broadcastMessage(F.main("Taunt", F.name(player.getName()) + " waited so long they turned to bones."));
- DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player);
- UtilMorph.disguise(player, disguiseSkeleton, Manager);
+ if (!Manager.getDisguiseManager().isDisguised(player))
+ {
+ DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player);
+ disguiseSkeleton.setName(player.getName());
+ disguiseSkeleton.setCustomNameVisible(true);
+ disguiseSkeleton.showArmor();
+ Manager.getDisguiseManager().disguise(disguiseSkeleton);
+ _disguises.put(player.getUniqueId(), disguiseSkeleton);
+ }
+
+ return true;
}
@Override
public void onPlay(Player player)
{
if (!_clocks.containsKey(player.getUniqueId()))
+ {
return;
+ }
int i = getPlayerTicks(player);
@@ -114,7 +130,11 @@ public class EternalTaunt extends TauntGadget
@Override
public void onFinish(Player player)
{
- UtilMorph.undisguise(player, Manager.getDisguiseManager());
+ if (_disguises.containsKey(player.getUniqueId()))
+ {
+ Manager.getDisguiseManager().undisguise(_disguises.remove(player.getUniqueId()));
+ }
+
if (_clocks.containsKey(player.getUniqueId()))
{
_clocks.get(player.getUniqueId()).forEach(c -> c.remove());
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java
index de81b6a1b..6a49fe8c4 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java
@@ -36,10 +36,12 @@ public class RainbowTaunt extends TauntGadget
}
@Override
- public void onStart(Player player)
+ public boolean onStart(Player player)
{
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
- return;
+ {
+ return false;
+ }
Vector dir = player.getLocation().getDirection();
Vector sideA = dir.clone().setX(-dir.getZ()).setZ(dir.getX());
@@ -51,6 +53,8 @@ public class RainbowTaunt extends TauntGadget
RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(start, Manager.getPlugin());
rainbowTauntEffect.setTargetLocation(new EffectLocation(end));
rainbowTauntEffect.start();
+
+ return true;
}
@Override
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCanadian.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCanadian.java
new file mode 100644
index 000000000..0b18eca18
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCanadian.java
@@ -0,0 +1,22 @@
+package mineplex.core.gadget.set;
+
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailRedWhite;
+import mineplex.core.gadget.gadgets.death.DeathMapleLeaf;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMaple;
+import mineplex.core.gadget.gadgets.particle.freedom.ParticleCanadian;
+import mineplex.core.gadget.types.GadgetSet;
+
+public class SetCanadian extends GadgetSet
+{
+
+ public SetCanadian(GadgetManager manager)
+ {
+ super(manager, "Canadian", "2x Holiday Points while active (Titles)",
+ manager.getGadget(ArrowTrailRedWhite.class),
+ manager.getGadget(DeathMapleLeaf.class),
+ manager.getGadget(DoubleJumpMaple.class),
+ manager.getGadget(ParticleCanadian.class));
+ }
+
+}
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 e6f6f5707..c9b059480 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.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.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.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 ccbaf0863..dca2f191c 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.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.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.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 b34a8f88e..26df2fd6f 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.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.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.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
index 6196a145b..a64e2caf3 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java
@@ -1,10 +1,10 @@
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.gadgets.arrowtrail.ArrowTrailFreedom;
+import mineplex.core.gadget.gadgets.death.DeathFreedom;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFreedom;
+import mineplex.core.gadget.gadgets.particle.freedom.ParticleStarSpangled;
import mineplex.core.gadget.types.GadgetSet;
public class SetFreedom extends GadgetSet
@@ -16,7 +16,7 @@ public class SetFreedom extends GadgetSet
manager.getGadget(ArrowTrailFreedom.class),
manager.getGadget(DeathFreedom.class),
manager.getGadget(DoubleJumpFreedom.class),
- manager.getGadget(ParticleFreedom.class));
+ manager.getGadget(ParticleStarSpangled.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 6112655a0..311600e5e 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java
@@ -1,10 +1,10 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
-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.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.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 120a35c95..668503111 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java
@@ -1,10 +1,10 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
-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.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.GadgetSet;
public class SetHowlingWinds extends GadgetSet
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 9e606f0e2..50eef82a0 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.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.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.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 f9debaef0..f22ce959e 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.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.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.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 befc2e27c..80b751d7d 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.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.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.types.GadgetSet;
public class SetShadow extends GadgetSet
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java
index 77727b480..fb21b5f9e 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java
@@ -1,9 +1,9 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
-import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring;
-import mineplex.core.gadget.gadgets.death.spring.DeathSpring;
-import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring;
+import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailSpring;
+import mineplex.core.gadget.gadgets.death.DeathSpring;
+import mineplex.core.gadget.gadgets.doublejump.DoubleJumpSpring;
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
import mineplex.core.gadget.types.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 7c66a8f6c..360d86270 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java
@@ -1,10 +1,10 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
-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.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.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 b070122de..1a5541085 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java
@@ -1,10 +1,10 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
-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.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.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 2d2ff0693..5bbae55da 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.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.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.types.GadgetSet;
public class SetWisdom extends GadgetSet
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/FlagGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/FlagGadget.java
new file mode 100644
index 000000000..3dabbad32
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/FlagGadget.java
@@ -0,0 +1,93 @@
+package mineplex.core.gadget.types;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.LineFormat;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.gadgets.flag.FlagType;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+/**
+ * Flags which sit upon players head.
+ */
+public class FlagGadget extends Gadget
+{
+ private final FlagType _flag;
+
+ public FlagGadget(GadgetManager manager, FlagType flag)
+ {
+ super(manager, GadgetType.FLAG, "Flag of " + flag.getFlag().getCountryName(),
+ UtilText.splitLineToArray(C.cGray + "Fly the " + flag.getFlag().getCountryAdjective() + " flag atop your head!", LineFormat.LORE),
+ flag.getCost(), Material.WOOL, (byte) 0, 1, flag.getFlag().getCountryAdjective() + " Flag");
+
+ setDisplayItem(flag.getFlag().getBanner());
+ _flag = flag;
+ }
+
+ public void applyArmor(Player player, boolean message)
+ {
+ Manager.removeGadgetType(player, GadgetType.MORPH, this);
+ Manager.removeGadgetType(player, GadgetType.FLAG, this);
+ Manager.removeGadgetType(player, GadgetType.HAT, this);
+ Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET);
+
+ _active.add(player);
+
+ if (message)
+ {
+ UtilPlayer.message(player, F.main("Gadget", "You unfurled the " + F.elem(getName()) + "."));
+ }
+ }
+
+ public void removeArmor(Player player)
+ {
+ if (_active.remove(player))
+ {
+ UtilPlayer.message(player, F.main("Gadget", "You took down the " + F.elem(getName()) + "."));
+ }
+ }
+
+ @Override
+ public void enableCustom(Player player, boolean message)
+ {
+ applyArmor(player, message);
+ ItemStack flag = _flag.getFlag().getBanner();
+ ItemMeta meta = flag.getItemMeta();
+ meta.setDisplayName(C.cGreenB + getDisplayName());
+ meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
+ flag.setItemMeta(meta);
+ player.getInventory().setHelmet(flag);
+ player.updateInventory();
+ }
+
+ @Override
+ public void disableCustom(Player player, boolean message)
+ {
+ removeArmor(player);
+ player.getInventory().setHelmet(new ItemStack(Material.AIR));
+ player.updateInventory();
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void playerDeath(PlayerDeathEvent event)
+ {
+ disable(event.getEntity());
+ }
+
+ /**
+ * @return The specific gadget which this represents.
+ */
+ public FlagType getFlagType()
+ {
+ return _flag;
+ }
+}
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 edc823e6d..386f764a4 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java
@@ -18,7 +18,8 @@ public enum GadgetType
WIN_EFFECT("Win Effects", "activeWinEffect"),
GAME_MODIFIER("Game Modifiers", ""),
BALLOON("Balloons", ""),
- KIT_SELECTOR("Kit Selectors", "activeKitSelector");
+ KIT_SELECTOR("Kit Selectors", "activeKitSelector"),
+ FLAG("Flags", "activeFlag");
private String _name;
private String _databaseKey;
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 b6becadc1..38df4c367 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java
@@ -47,7 +47,7 @@ public abstract class HatGadget extends OutfitGadget
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.MORPH, this);
-
+ Manager.removeGadgetType(player, GadgetType.FLAG, this);
Manager.removeOutfit(player, _slot);
_active.add(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 4fb2b5ed9..7240ed1d5 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java
@@ -26,7 +26,8 @@ public abstract class MorphGadget extends Gadget
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.MORPH, this);
- Manager.removeGadgetType(player, GadgetType.COSTUME);
+ Manager.removeGadgetType(player, GadgetType.COSTUME, this);
+ Manager.removeGadgetType(player, GadgetType.FLAG, this);
_active.add(player);
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 6ce4d70b7..78471a943 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java
@@ -60,7 +60,12 @@ public abstract class OutfitGadget extends Gadget
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.MORPH, this);
-
+
+ if (_slot == ArmorSlot.HELMET)
+ {
+ Manager.removeGadgetType(player, GadgetType.FLAG, this);
+ }
+
Manager.removeOutfit(player, _slot);
_active.add(player);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java
index 991a7425b..c0b11870d 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java
@@ -76,11 +76,13 @@ public abstract class TauntGadget extends Gadget
public void start(Player player)
{
- onStart(player);
- _ticksPerPlayer.put(player.getUniqueId(), 0);
+ if (onStart(player))
+ {
+ _ticksPerPlayer.put(player.getUniqueId(), 0);
+ }
}
- public abstract void onStart(Player player);
+ public abstract boolean onStart(Player player);
public void play(Player player)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java
index 413dbbc8f..ac7c74b16 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java
@@ -107,6 +107,8 @@ public enum GameDisplay
MOBA("Heroes of GWEN", Material.PRISMARINE, (byte)0, GameCategory.CLASSICS, 70, true),
MOBATraining("Heroes of GWEN Training", Material.PRISMARINE, (byte)0, GameCategory.CLASSICS, 70, false),
+ BattleRoyale("Battle Royale", Material.DIAMOND_SWORD, (byte)0, GameCategory.EVENT, 72, false),
+
GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.SURVIVAL, 71, false),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999, false),
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/CustomItemFrames.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/CustomItemFrames.java
new file mode 100644
index 000000000..9bd70c7db
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/CustomItemFrames.java
@@ -0,0 +1,132 @@
+package mineplex.core.imagemap;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import net.minecraft.server.v1_8_R3.DataWatcher;
+import net.minecraft.server.v1_8_R3.EntityItemFrame;
+import net.minecraft.server.v1_8_R3.ItemStack;
+import net.minecraft.server.v1_8_R3.MinecraftServer;
+import net.minecraft.server.v1_8_R3.Packet;
+import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
+import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
+
+import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItemFrame;
+import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.entity.Player;
+
+import com.google.common.base.Optional;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.ReflectivelyCreateMiniPlugin;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.packethandler.IPacketHandler;
+import mineplex.core.packethandler.PacketHandler;
+import mineplex.core.packethandler.PacketInfo;
+
+@ReflectivelyCreateMiniPlugin
+public class CustomItemFrames extends MiniPlugin implements IPacketHandler
+{
+
+ private final List _ourPackets;
+ private final Map> _frameData;
+
+ private CustomItemFrames()
+ {
+ super("CustomItemFrames");
+
+ _ourPackets = new ArrayList<>();
+ _frameData = new HashMap<>();
+ }
+
+ @Override
+ public void enable()
+ {
+ require(PacketHandler.class).addPacketHandler(this, PacketPlayOutEntityMetadata.class, PacketPlayInUseEntity.class);
+ }
+
+ @Override
+ public void disable()
+ {
+ require(PacketHandler.class).removePacketHandler(this);
+ }
+
+ @Override
+ public void handle(PacketInfo packetInfo)
+ {
+ if (packetInfo.getPacket() instanceof PacketPlayOutEntityMetadata)
+ {
+ if (_ourPackets.remove(packetInfo.getPacket()))
+ {
+ return;
+ }
+
+ PacketPlayOutEntityMetadata packet = (PacketPlayOutEntityMetadata) packetInfo.getPacket();
+ Map map = _frameData.get(packet.a);
+
+ if (map != null)
+ {
+ UUID uuid = packetInfo.getPlayer().getUniqueId();
+ ItemStack item = map.get(uuid);
+
+ if (item != null)
+ {
+ for (DataWatcher.WatchableObject meta : packet.b)
+ {
+ if (meta.getIndex().a() == 8)
+ {
+ meta.a(item, Optional.fromNullable(item));
+ break;
+ }
+ }
+ }
+ }
+ }
+ else if (packetInfo.getPacket() instanceof PacketPlayInUseEntity)
+ {
+ PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket();
+
+ if (_frameData.containsKey(packet.a))
+ {
+ packetInfo.setCancelled(true);
+ }
+ }
+ }
+
+ public void setItem(Player player, ItemFrame frame, org.bukkit.inventory.ItemStack item)
+ {
+ ItemStack nmsItem = CraftItemStack.asNMSCopy(item.clone());
+
+ DataWatcher.WatchableObject> frameMetaItem = new DataWatcher.WatchableObject<>(5, 8, nmsItem, EntityItemFrame.META_ITEM, Optional.fromNullable(nmsItem));
+
+ PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
+ packet.a = frame.getEntityId();
+ packet.b = Collections.singletonList(frameMetaItem);
+
+ _ourPackets.add(packet);
+
+ UtilPlayer.sendPacket(player, packet);
+
+ _frameData.computeIfAbsent(frame.getEntityId(), HashMap::new).put(player.getUniqueId(), nmsItem);
+ }
+
+ public void removeItems(ItemFrame frame)
+ {
+ _frameData.remove(frame.getEntityId());
+
+ ItemStack nmsItem = null;
+ EntityItemFrame nmsEntity = ((CraftItemFrame) frame).getHandle();
+
+ DataWatcher watcher = new DataWatcher(nmsEntity);
+ watcher.add(8, 5, EntityItemFrame.META_ITEM, Optional.fromNullable(nmsItem));
+
+ PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(frame.getEntityId(), watcher, true);
+
+ MinecraftServer.getServer().getPlayerList().players.forEach(player -> player.playerConnection.sendPacket(packet));
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/ImageMapManager.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/ImageMapManager.java
new file mode 100644
index 000000000..4cfc9486b
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/ImageMapManager.java
@@ -0,0 +1,256 @@
+package mineplex.core.imagemap;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.ReflectivelyCreateMiniPlugin;
+import mineplex.core.common.util.UtilBlock;
+import mineplex.core.imagemap.objects.PlayerMapBoard;
+import mineplex.core.imagemap.objects.PlayerMapImage;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@ReflectivelyCreateMiniPlugin
+public class ImageMapManager extends MiniPlugin
+{
+
+ private static final String IMAGE_DIR = ".." + File.separator + ".." + File.separator + "update" + File.separator + "files";
+ private static final int PIXELS_PER_MAP = 128;
+
+ public static int getMapDimension()
+ {
+ return PIXELS_PER_MAP;
+ }
+
+ private final CustomItemFrames _itemFrames;
+
+ private final Map _imageCache;
+ private List _boards;
+
+ private ImageMapManager()
+ {
+ super("Image Map");
+
+ _itemFrames = require(CustomItemFrames.class);
+
+ _imageCache = new HashMap<>();
+ _boards = new ArrayList<>();
+ }
+
+ @EventHandler
+ public void playerJoin(PlayerJoinEvent event)
+ {
+ Player player = event.getPlayer();
+
+ runSyncLater(() -> _boards.forEach(board -> board.onPlayerJoin(player)), 40);
+ }
+
+ @EventHandler
+ public void playerQuit(PlayerQuitEvent event)
+ {
+ Player player = event.getPlayer();
+
+ _boards.forEach(board -> board.onPlayerQuit(player));
+ }
+
+ @EventHandler
+ public void refreshBoards(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.TWOSEC)
+ {
+ return;
+ }
+
+ _boards.forEach(PlayerMapBoard::onRefresh);
+ }
+
+ public PlayerMapBoard createPlayerBoard(Location topLeft, BlockFace direction, int width, int height, String... images)
+ {
+ BufferedImage[] bufferedImages = new BufferedImage[images.length];
+
+ for (int i = 0; i < images.length; i++)
+ {
+ bufferedImages[i] = getImage(new File(IMAGE_DIR + File.separator + images[i]));
+ }
+
+ return createPlayerBoard(topLeft, direction, width, height, bufferedImages);
+ }
+
+ public PlayerMapBoard createPlayerBoard(Location topLeft, BlockFace direction, int width, int height, File... images)
+ {
+ BufferedImage[] bufferedImages = new BufferedImage[images.length];
+
+ for (int i = 0; i < images.length; i++)
+ {
+ bufferedImages[i] = getImage(images[i]);
+ }
+
+ return createPlayerBoard(topLeft, direction, width, height, bufferedImages);
+ }
+
+ public PlayerMapBoard createPlayerBoard(Location topLeft, BlockFace direction, int width, int height, URL... images)
+ {
+ BufferedImage[] bufferedImages = new BufferedImage[images.length];
+
+ for (int i = 0; i < images.length; i++)
+ {
+ bufferedImages[i] = getImage(images[i]);
+ }
+
+ return createPlayerBoard(topLeft, direction, width, height, bufferedImages);
+ }
+
+ public PlayerMapBoard createPlayerBoard(Location topLeft, BlockFace direction, int width, int height, BufferedImage... images)
+ {
+ List itemFrames = createItemFrames(topLeft, direction, width, height);
+ List mapImageList = new ArrayList<>();
+
+ for (BufferedImage image : images)
+ {
+ PlayerMapImage mapImage = new PlayerMapImage(_itemFrames, image, itemFrames, width, height);
+ mapImage.create();
+
+ mapImageList.add(mapImage);
+ }
+
+ PlayerMapBoard board = new PlayerMapBoard(topLeft, mapImageList);
+
+ runSyncLater(() -> Bukkit.getOnlinePlayers().forEach(board::onPlayerJoin), 50);
+
+ _boards.add(board);
+ return board;
+ }
+
+ private List createItemFrames(Location topLeft, BlockFace direction, int width, int height)
+ {
+ List itemFrames = new ArrayList<>();
+
+ for (int x = 0; x < width; x++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ Location location = modLocation(topLeft, direction, x, y);
+
+ Block opposite = location.getBlock().getRelative(direction.getOppositeFace());
+
+ if (!UtilBlock.solid(opposite))
+ {
+ opposite.setType(Material.SMOOTH_BRICK);
+ }
+
+ ItemFrame itemFrame = location.getWorld().spawn(location, ItemFrame.class);
+ itemFrame.setFacingDirection(direction, true);
+ itemFrames.add(itemFrame);
+ }
+ }
+
+ return itemFrames;
+ }
+
+ private Location modLocation(Location location, BlockFace direction, int x, int y)
+ {
+ int modX = 0;
+ int modZ = 0;
+
+ switch (direction)
+ {
+ case NORTH:
+ modX = -x;
+ break;
+ case SOUTH:
+ modX = x;
+ break;
+ case WEST:
+ modZ = x;
+ break;
+ case EAST:
+ modZ = -x;
+ break;
+ }
+
+ return new Location(location.getWorld(), location.getBlockX() + modX, location.getBlockY() - y, location.getBlockZ() + modZ);
+ }
+
+ private BufferedImage getImage(File file)
+ {
+ if (_imageCache.containsKey(file.getName()))
+ {
+ return _imageCache.get(file.getName());
+ }
+
+ try
+ {
+ BufferedImage image = ImageIO.read(file);
+ _imageCache.put(file.getName(), image);
+ return image;
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private BufferedImage getImage(URL url)
+ {
+ if (_imageCache.containsKey(url.toString()))
+ {
+ return _imageCache.get(url.toString());
+ }
+
+ try
+ {
+ BufferedImage image = ImageIO.read(url);
+ _imageCache.put(url.toString(), image);
+ return image;
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void cleanupBoard(PlayerMapBoard board)
+ {
+ _boards.remove(board);
+
+ //TODO Fix when multiple boards are needed at one time
+ File dataDir = new File(board.getLocation().getWorld().getName() + File.separator + "data");
+ if (dataDir.isDirectory())
+ {
+ File[] files = dataDir.listFiles();
+
+ if (files != null)
+ {
+ for (File file : files)
+ {
+ if (file.getName().startsWith("map"))
+ {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ board.cleanup();
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/ImageMapRenderer.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/ImageMapRenderer.java
new file mode 100644
index 000000000..7d83fe199
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/ImageMapRenderer.java
@@ -0,0 +1,41 @@
+package mineplex.core.imagemap;
+
+import org.bukkit.entity.Player;
+import org.bukkit.map.MapCanvas;
+import org.bukkit.map.MapRenderer;
+import org.bukkit.map.MapView;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class ImageMapRenderer extends MapRenderer
+{
+
+ private Image _image;
+ private boolean _rendered;
+
+ public ImageMapRenderer(BufferedImage image, int x1, int y1)
+ {
+ int startX = Math.min(x1 * ImageMapManager.getMapDimension(), image.getWidth());
+ startX = Math.max(image.getMinX(), startX);
+ int startY = Math.min(y1 * ImageMapManager.getMapDimension(), image.getHeight());
+ startY = Math.max(image.getMinY(), startY);
+
+ if (startX + ImageMapManager.getMapDimension() > image.getWidth() || startY + ImageMapManager.getMapDimension() > image.getHeight())
+ {
+ return;
+ }
+
+ _image = image.getSubimage(startX, startY, ImageMapManager.getMapDimension(), ImageMapManager.getMapDimension());
+ }
+
+ @Override
+ public void render(MapView view, MapCanvas canvas, Player player)
+ {
+ if (_image != null && !_rendered)
+ {
+ canvas.drawImage(0, 0, _image);
+ _rendered = true;
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/MapBoardSelector.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/MapBoardSelector.java
new file mode 100644
index 000000000..c0a57e7c2
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/MapBoardSelector.java
@@ -0,0 +1,146 @@
+package mineplex.core.imagemap.objects;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.UtilEnt;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilParticle.ParticleType;
+import mineplex.core.common.util.UtilParticle.ViewDist;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.recharge.Recharge;
+import org.bukkit.Location;
+import org.bukkit.Sound;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Slime;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
+public class MapBoardSelector implements Listener
+{
+
+ private final PlayerMapBoard _board;
+ private ArmorStand _goNext;
+ private Slime _goNextBox;
+ private ArmorStand _goBack;
+ private Slime _goBackBox;
+
+ public MapBoardSelector(PlayerMapBoard board)
+ {
+ _board = board;
+
+ UtilServer.RegisterEvents(this);
+ }
+
+ public void createHolograms(Location goNext, Location goBack)
+ {
+ _goNext = createArmourStand(goNext);
+ _goNext.setCustomName(C.cGreen + "Next Page");
+
+ _goNextBox = createSlimeBox(goNext);
+
+ _goBack = createArmourStand(goBack);
+ _goBack.setCustomName(C.cGreen + "Previous Page");
+
+ _goBackBox = createSlimeBox(goBack);
+ }
+
+ private ArmorStand createArmourStand(Location location)
+ {
+ ArmorStand stand = location.getWorld().spawn(location.clone().subtract(0, 0.5, 0), ArmorStand.class);
+
+ UtilEnt.vegetate(stand);
+ UtilEnt.ghost(stand, true, false);
+
+ stand.setCustomNameVisible(true);
+ stand.setVisible(false);
+ stand.setGravity(false);
+ stand.setRemoveWhenFarAway(false);
+
+ return stand;
+ }
+
+ private Slime createSlimeBox(Location location)
+ {
+ Slime slime = location.getWorld().spawn(location.clone().add(0, 1, 0), Slime.class);
+
+ UtilEnt.vegetate(slime);
+ UtilEnt.ghost(slime, true, false);
+ UtilEnt.setFakeHead(slime, true);
+ UtilEnt.silence(slime, true);
+
+ slime.setSize(5);
+ slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0, false, false));
+ slime.setRemoveWhenFarAway(false);
+
+ return slime;
+ }
+
+ public void cleanup()
+ {
+ _goNext.remove();
+ _goNextBox.remove();
+ _goBack.remove();
+ _goBackBox.remove();
+ UtilServer.Unregister(this);
+ }
+
+ @EventHandler
+ public void onClick(PlayerInteractAtEntityEvent event)
+ {
+ if (onClick(event.getPlayer(), event.getRightClicked()))
+ {
+ event.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onClick(EntityDamageByEntityEvent event)
+ {
+ if (onClick(event.getDamager(), event.getEntity()))
+ {
+ event.setCancelled(true);
+ }
+ }
+
+ private boolean onClick(Entity clicker, Entity clicked)
+ {
+ if (!(clicker instanceof Player))
+ {
+ return false;
+ }
+
+ Player player = (Player) clicker;
+ boolean action = false;
+
+ if (!Recharge.Instance.use(player, "Change Page", 500, false, false))
+ {
+ return true;
+ }
+
+ if (_goNextBox != null && _goNextBox.equals(clicked))
+ {
+ _board.goTo(player, true);
+ action = true;
+ }
+ else if (_goBackBox != null && _goBackBox.equals(clicked))
+ {
+ _board.goTo(player, false);
+ action = true;
+ }
+
+ if (action)
+ {
+ UtilParticle.PlayParticle(ParticleType.CRIT, clicked.getLocation().add(0, 1.5, 0), 0.25F, 0.25F, 0.25F, 0.2F, 15, ViewDist.SHORT, player);
+ player.playSound(clicked.getLocation(), Sound.WOOD_CLICK, 1, 1);
+ }
+
+ return action;
+ }
+
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/MapImage.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/MapImage.java
new file mode 100644
index 000000000..37c6d315f
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/MapImage.java
@@ -0,0 +1,56 @@
+package mineplex.core.imagemap.objects;
+
+import mineplex.core.imagemap.ImageMapRenderer;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.map.MapView;
+
+import java.awt.image.BufferedImage;
+import java.util.List;
+
+public class MapImage
+{
+
+ protected final BufferedImage _image;
+ protected final List _itemFrames;
+ protected final int _width, _height;
+
+ public MapImage(BufferedImage image, List itemFrames, int width, int height)
+ {
+ _image = image;
+ _itemFrames = itemFrames;
+ _width = width;
+ _height = height;
+ }
+
+ public void create()
+ {
+ int i = 0;
+
+ for (int x = 0; x < _width; x++)
+ {
+ for (int y = 0; y < _height; y++)
+ {
+ ItemFrame frame = _itemFrames.get(i++);
+
+ frame.setItem(getMapItem(frame.getWorld(), x, y));
+ }
+ }
+ }
+
+ protected ItemStack getMapItem(World world, int x, int y)
+ {
+ ItemStack item = new ItemStack(Material.MAP);
+
+ MapView map = Bukkit.getServer().createMap(world);
+ map.getRenderers().forEach(map::removeRenderer);
+
+ map.addRenderer(new ImageMapRenderer(_image, x, y));
+ item.setDurability(map.getId());
+
+ return item;
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/PlayerMapBoard.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/PlayerMapBoard.java
new file mode 100644
index 000000000..fb58bd7ac
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/PlayerMapBoard.java
@@ -0,0 +1,90 @@
+package mineplex.core.imagemap.objects;
+
+import mineplex.core.common.util.UtilMath;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PlayerMapBoard
+{
+
+ private static final int VIEW_DIST_SQUARED = 28 * 28;
+
+ private final Location _location;
+ private final List _images;
+ private final Map _viewers;
+
+ public PlayerMapBoard(Location location, List images)
+ {
+ _location = location;
+ _images = images;
+ _viewers = new HashMap<>();
+ }
+
+ public void goTo(Player player, boolean next)
+ {
+ if (!_viewers.containsKey(player))
+ {
+ return;
+ }
+
+ int index = _viewers.get(player);
+
+ if (next && _images.size() - 1 == index)
+ {
+ index = -1;
+ }
+ else if (!next && index == 0)
+ {
+ index = _images.size();
+ }
+
+ int newIndex = next ? index + 1 : index - 1;
+ _viewers.put(player, newIndex);
+ _images.get(newIndex).addViewer(player, true);
+ }
+
+ public void onPlayerJoin(Player player)
+ {
+ _viewers.put(player, 0);
+ _images.get(0).addViewer(player, true);
+ }
+
+ public void onPlayerQuit(Player player)
+ {
+ _viewers.remove(player);
+ }
+
+ public void onRefresh()
+ {
+ Bukkit.getOnlinePlayers().forEach(player ->
+ {
+ if (player.getWorld().equals(_location.getWorld()) && UtilMath.offset2dSquared(player.getLocation(), _location) < VIEW_DIST_SQUARED && _viewers.containsKey(player))
+ {
+ int index = _viewers.get(player);
+ _images.get(index).addViewer(player, false);
+ }
+ });
+ }
+
+ public void cleanup()
+ {
+ _viewers.clear();
+ _images.forEach(image ->
+ {
+ image.getItemFrames().forEach(Entity::remove);
+ image.getItemFrames().clear();
+ });
+ }
+
+ public Location getLocation()
+ {
+ return _location;
+ }
+
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/PlayerMapImage.java b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/PlayerMapImage.java
new file mode 100644
index 000000000..2f21cd59b
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/imagemap/objects/PlayerMapImage.java
@@ -0,0 +1,69 @@
+package mineplex.core.imagemap.objects;
+
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.imagemap.CustomItemFrames;
+import org.bukkit.World;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlayerMapImage extends MapImage
+{
+
+ private final CustomItemFrames _itemFramesManager;
+ private final List _itemMaps;
+
+ public PlayerMapImage(CustomItemFrames itemFramesManager, BufferedImage image, List itemFrames, int width, int height)
+ {
+ super(image, itemFrames, width, height);
+
+ _itemFramesManager = itemFramesManager;
+ _itemMaps = new ArrayList<>();
+ }
+
+ @Override
+ public void create()
+ {
+ World world = _itemFrames.get(0).getWorld();
+
+ for (int x = 0; x < _width; x++)
+ {
+ for (int y = 0; y < _height; y++)
+ {
+ _itemMaps.add(getMapItem(world, x, y));
+ }
+ }
+ }
+
+ public List getItemFrames()
+ {
+ return _itemFrames;
+ }
+
+ public void addViewer(Player player, boolean sendMap)
+ {
+ if (sendMap)
+ {
+ //FIXME
+ int slot = 8;
+ for (ItemStack itemStack : _itemMaps)
+ {
+ player.getInventory().setItem(slot++, itemStack);
+ }
+
+ UtilServer.runSyncLater(() -> player.getInventory().removeItem(_itemMaps.toArray(new ItemStack[0])), 5);
+ }
+
+ for (int i = 0; i < _itemMaps.size(); i++)
+ {
+ ItemFrame itemFrame = _itemFrames.get(i);
+ ItemStack itemStack = _itemMaps.get(i);
+
+ _itemFramesManager.setItem(player, itemFrame, itemStack);
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java
index c90639b66..fd72e005b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java
@@ -15,13 +15,13 @@ import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType;
public class Leaderboard
{
- private String _display;
- private Pair _statDisplay;
- private String[] _statNames;
- private int[] _statIds;
- private int _size, _start;
- private LeaderboardSQLType _type;
- private Location _loc;
+ private final String _display;
+ private final Pair _statDisplay;
+ private final String[] _statNames;
+ private final int[] _statIds;
+ private final int _size, _start;
+ private final LeaderboardSQLType _type;
+ private final Location _loc;
private Hologram _holo;
public Leaderboard(String display, Pair statDisplayNames, String[] statNames, LeaderboardSQLType type, Location displayLoc, int size)
@@ -37,6 +37,7 @@ public class Leaderboard
_statIds = new int[_statNames.length];
_type = type;
_size = size;
+ _start = start;
_loc = displayLoc;
update(new LinkedHashMap<>());
@@ -52,12 +53,15 @@ public class Leaderboard
return _start;
}
+ /**
+ * The returned array is not safe for mutation
+ */
public String[] getStatNames()
{
return _statNames;
}
- public int[] getStatIds()
+ public synchronized int[] getStatIds()
{
return _statIds;
}
@@ -89,6 +93,14 @@ public class Leaderboard
_holo = new Hologram(Managers.get(LeaderboardManager.class).getHologramManager(), _loc, display.toArray(new String[display.size()])).start();
}
+ public synchronized void setStatId(int index, int id)
+ {
+ if (_statIds.length > index && index >= 0)
+ {
+ _statIds[index] = id;
+ }
+ }
+
public void deconstruct()
{
if (_holo != null)
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardManager.java
index 88a84c29d..e2849a5d0 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardManager.java
@@ -120,7 +120,7 @@ public class LeaderboardManager extends MiniPlugin
final int index = i;
Managers.get(StatsManager.class).loadStatId(board.getStatNames()[index], id ->
{
- board.getStatIds()[index] = id.intValue();
+ board.setStatId(index, id.intValue());
});
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardRepository.java
index f9b286039..4ef0e86cf 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardRepository.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/LeaderboardRepository.java
@@ -90,73 +90,79 @@ public class LeaderboardRepository extends RepositoryBase
public void insertStats(int accountId, Map stats)
{
- try (
- Connection c = getConnection();
- PreparedStatement updateStat = c.prepareStatement(UPDATE_STAT);
- PreparedStatement insertStat = c.prepareStatement(INSERT_STAT);
- )
+ UtilServer.runAsync(() ->
{
- for (Integer statId : stats.keySet())
+ try (
+ Connection c = getConnection();
+ PreparedStatement updateStat = c.prepareStatement(UPDATE_STAT);
+ PreparedStatement insertStat = c.prepareStatement(INSERT_STAT);
+ )
{
- updateStat.setLong(1, stats.get(statId));
- updateStat.setInt(2, accountId);
- updateStat.setInt(3, statId);
- updateStat.addBatch();
- }
- int[] rowsAffected = updateStat.executeBatch();
- int i = 0;
- for (Integer statId : stats.keySet())
- {
- if (rowsAffected[i] < 1)
+ for (Integer statId : stats.keySet())
{
- insertStat.setInt(1, accountId);
- insertStat.setInt(2, statId);
- insertStat.setLong(3, stats.get(statId));
- insertStat.addBatch();
+ updateStat.setLong(1, stats.get(statId));
+ updateStat.setInt(2, accountId);
+ updateStat.setInt(3, statId);
+ updateStat.addBatch();
}
- i++;
+ int[] rowsAffected = updateStat.executeBatch();
+ int i = 0;
+ for (Integer statId : stats.keySet())
+ {
+ if (rowsAffected[i] < 1)
+ {
+ insertStat.setInt(1, accountId);
+ insertStat.setInt(2, statId);
+ insertStat.setLong(3, stats.get(statId));
+ insertStat.addBatch();
+ }
+ i++;
+ }
+ insertStat.executeBatch();
}
- insertStat.executeBatch();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
+ });
}
public void loadLeaderboard(Leaderboard board, Consumer