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 f53e986b2..ebc0fdb1b 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 @@ -28,6 +28,10 @@ public class SkinData public final static SkinData PRESENT = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3MDIxNjIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2YzRkZWQwNTdjMjhiMTU0NjVkYzQzNmFmODIyYTNkZTY4NzgyZTZjMzgyOGMzMmFhYWE4ZjRiOTIzOWVjIn19fQ==","rJNlxTqHHmOoWwbXdMQLcj0P9w/PIr/hWKXH0nbhm/S2CFo/zfefffZlnQmpKCgn1Y8tXvcRwLGQ4CLpm9m2ZrKprSWRhrnOtZWYabrhExQESEammS3TY81VoNt+4On0pAGBippz/bRfWLuDne2rDbhuljnqvxjROmxpky7gRCU06VMlm2WLFC5XYJkiAaOXBqzpiHMMRPNnCvtcbtpILKi/Luj302eyN8nRKjHHbbiDmttwvlshxZ8UxJHvALtM506IUHba10Q6QX2zCeDAU5/WYRKa6e19r8plROcgGbKYFSq8JW5cWuWT3/rveZM6FnU6ABn9DWsCyfQ5wr2jdBd+xaevGTAScRHA5J493GqL1bBZYKj9yhQFtxJHCAf0++raAVPCZgyPtwTth4TAQisn8gnhM5R+txnW6xK+oflLy0dwEN1YdPLN/h7yuDnyjSMDe9RZT2NKMjok2C6Kux4WBI0KFXKC5Gqwa3Htku4v3WEOWMaVoWOtchQ9BzpQ/etD0ylmzjALQLB+HtndEEm1Jd3tmob42X4hBE8hCce7C3EtGINB33dlx4CK1xBqyGTJEqi69DJRzVL99u98+7kJ1Db9+MaPOfI4B2RY3XbvnSYwecandY//A3bb19FGSdl299ZXbp4zpm8fivzeB1rUAhhmtaA3Iwu/nEQNMkU="); public final static SkinData RUDOLPH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk1NjgxODIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzZjdlMjhiNTJkZjJjZjhlZWM2NDk2ZmM0NWFlMGQ2NTM0Njc5OGIxYWRjNzM3ZDcxYzBmOTRlNDIyMSJ9fX0=","uUBOTe63CL+qRvtsb2g4AjB2YzxE3N6AUqIsTv8n0jYyPsuXpuOmZPSMEdgDVONywEJ1L4XRx05sjnGu56A8vuXmGI/uHQWuMZzbOSjiFfT3DkEm8zEl5AWpH9dz/t8nZ1WYUIwy0pN5VrZqIr1DAkF6AMh/Qy+FGDw1GG9ReRr80eJ0JiRskpkCpCZIGGjrgwNKAM8JOuNZ4gCQOTRC3etrcfls3qmUMFcVlhuB4bydxSR01i2w0A4b5KpufsJjLKw4InWn2+m/druo8hl9sYuusTeItW0MQmZqCAqXCc9YBnRPQ0hDXFgnPxOh3RwGWiZvL4MnWUVmLwZWh/Fk9QmyVbd7zVao0lxS8YNsKtP8j5B+hs4l9qNohhf0A07bt4oPeTtd5fQeOU5N87fUGuUAcpC4gP9U5WpVY5FFPBvLvGbXdV5jpuAQz4lLSoo1grsP9baR2IBvdN/0awjQWoPJfGOttegubkBHwz3LNcVqvZLtX/M13IDHZa6zQZEX0wsnMX60LeWgBWfTON1l2cSgaPTerHFS2EifJ2LvTBife3s9/4XR6Zth3FLFqxI3MSlqT2hVFRPLke6rBqfqPoWOj2MCykQ70IAwb3oTHcJDJ86V2DdNaU2bZ8V4TjaP+nRobsLJOImoPYEPq23MP36X8gbXEIjmuu8S5xRlrrc="); public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ="); + public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); + public final static SkinData COMPANION_CUBE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDk5NjI0NjEsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyMTVkYmRhNTY1ZjVjYjhlYjEyZjU1NWY1ZTNkYTBlYTVmNTUxOTg5MWNjNWM1ZDY3NmZkODJjNjIifX19", "vaAQbhnhnTOs64ToFWLg7o4JmqkIl07HWJ6l7xibfISaOcU4BvYBxsfGvmoxlVdsUeCunAJ8/05qVLl5zZYd8Dt+To6JSY0RlqV8piRaaj3FztYWV2ZvG3YZxPxiD3HRJTAQnDobSuxHyPa1e3khjAFp9xJo4q1oqQ28oI2WDuoT+IHqxwkKVbGzO7UD5lzz5chjQC46E8SxddNKp9aqwbbccrkHYT4gteoonOXu4MFxZniJN12LqUCb6+G15rU8MijlBkWx0xE5NMUloeTGuJZItbHun9fysLk/+HE5xJOKYtpZNMuWX+DB/O5ds9dXrOoSAg+Vn0QU4CZbwcxzLii5ILOfEEBtePuEAgzROri+iCKp59CqlEMBrCsd3Um0MCdbuOfvkXGBHBz+bqX7VJY1ujlSdMefmbJtHAkDANnsaaVb+eli9Dk6139041sptsLytD+EfJzaitX6crBwKZ2WDx2P6LHo8B+iSOzOJxjf/08zlXqFw1vsk62IN6lisuZ89QyZw23RvOx3obLAGYs1GxAlMl9qQdpXcmuE1+lPR3g8gZ0BfnTeYwflC2wbR1tuwGG98lyUGCvGLyqNKAQTN87XV4IFQWR81mi1c5CcasoWhKf9D9nAik9aK7A915fEE5IvpeuUdZseDxDVVN5dBIs5q2PIHFAS0rDsDBc="); + public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); + public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas="); private Property _skinProperty; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index d01556e40..744cc2462 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -255,6 +255,25 @@ public class UtilAlg return vec; } + + public static Entity findClosest(Entity mid, ArrayList locs) + { + Entity bestLoc = null; + double bestDist = 0; + + for (Entity loc : locs) + { + double dist = UtilMath.offset(mid, loc); + + if (bestLoc == null || dist < bestDist) + { + bestLoc = loc; + bestDist = dist; + } + } + + return bestLoc; + } public static Location findClosest(Location mid, ArrayList locs) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 3acb09f70..871a1c9b7 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -1408,6 +1408,11 @@ public class UtilBlock case ANVIL: itemStack.setDurability((short) (itemStack.getDurability() / 4)); break; + case QUARTZ_BLOCK: + if (itemStack.getDurability() == 4 || itemStack.getDurability() == 3) + itemStack.setDurability((short) 2); + + break; } return itemStacks; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index ab07c5147..db14687ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -29,7 +29,21 @@ public enum Achievement "during Christmas 2015!"}, new int[]{200}, AchievementCategory.HOLIDAY), - + + GLOBAL_GIFT_GIVER_2016("2016 Gift Giver", 2000, + new String[]{"Global.Valentines2016.GiftsGiven"}, + new String[]{"Give 50 Valentines Gifts", + "during Valentines 2016!"}, + new int[]{50}, + AchievementCategory.HOLIDAY), + + GLOBAL_GIFT_GETTER_2016("2016 People Love Me", 2000, + new String[]{"Global.Valentines2016.GiftsReceived"}, + new String[]{"Receive 10 Gifts", + "during Valentines 2016!"}, + new int[]{10}, + AchievementCategory.HOLIDAY), + //Bridges BRIDGES_WINS("Bridge Champion", 600, new String[]{"The Bridges.Wins"}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 8f5879b6f..d2ec49e6e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -31,7 +31,6 @@ import mineplex.core.database.DBPool; import mineplex.core.donation.DonationManager; import mineplex.core.donation.GiveDonorData; import mineplex.core.facebook.FacebookManager; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; @@ -65,7 +64,9 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -167,7 +168,7 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, GiveawayManager giveawayManager, FacebookManager facebookManager) + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -177,7 +178,7 @@ public class BonusManager extends MiniClientPlugin implements I _hologramManager = hologramManager; _inventoryManager = inventoryManager; - _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, 100, 250, 500, 1000, 4000, 6000, @@ -818,8 +819,8 @@ public class BonusManager extends MiniClientPlugin implements I } } - @EventHandler - public void openGui(PlayerInteractEntityEvent event) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void openGui(PlayerInteractAtEntityEvent event) { if (!_enabled) return; @@ -848,7 +849,7 @@ public class BonusManager extends MiniClientPlugin implements I } } } - + public static long getNextVoteTime(long time) { Calendar calendar = Calendar.getInstance(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index eca038bb7..839b0b015 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -243,7 +243,10 @@ public class Chat extends MiniPlugin event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage())); } } - + + /** + * This should only be called from an async thread! + */ public String getFilteredMessage(Player player, String originalMessage) { final String playerName = player.getUniqueId().toString(); 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 264411b62..db83190df 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -57,8 +56,8 @@ public class GadgetPage extends ShopPageBase slot++; - if (slot == 26) - slot = 28; + if (slot == 26 || slot == 35) + slot += 2; } addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() @@ -86,16 +85,16 @@ public class GadgetPage extends ShopPageBase if (gadget.getSet() != null) { itemLore.add(C.cBlack); - itemLore.add(C.cWhite + gadget.getSet().getName() + " Set;"); + itemLore.add(C.cWhite + gadget.getSet().getName() + " Set"); //Elements for (Gadget cur : gadget.getSet().getGadgets()) - itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen + '▪' : C.cDRed + '▪' ) + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName()); + itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "▪ " + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName()); itemLore.add(C.cBlack); //Bonus - itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus;"); + itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus"); for (String bonus : gadget.getSet().getBonus()) itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus); } @@ -127,6 +126,17 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } + else if (gadget.GetCost(CurrencyType.Coins) == -6) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Valentines Gifts"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -7) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Purchased from shop.mineplex.com"); + } + //Rank Unlocks else if (gadget.GetCost(CurrencyType.Coins) == -10) { @@ -180,11 +190,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Left-Click to Enable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } else { - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } return; @@ -206,7 +216,7 @@ public class GadgetPage extends ShopPageBase im.setLore(itemLore); item.setItemMeta(im); - addButton(slot, new ShopItem(item, false, false), new DeactivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(item, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); } else { @@ -215,7 +225,7 @@ public class GadgetPage extends ShopPageBase im.setLore(itemLore); item.setItemMeta(im); - addButton(slot, new ShopItem(item, false, false), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(item, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } } else @@ -231,18 +241,18 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } else if (gadget.GetCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } } @@ -257,14 +267,14 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); } else { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } } else @@ -280,18 +290,18 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } else if (gadget.GetCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } } } 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 356635962..12475e8d9 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 @@ -87,6 +87,11 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } + else if (mount.GetCost(CurrencyType.Coins) == -6) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure"); + } //Rank Unlocks else if (mount.GetCost(CurrencyType.Coins) == -10) { @@ -110,7 +115,6 @@ public class MountPage extends ShopPageBase } } - if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) { if (mount.GetActive().containsKey(getPlayer())) @@ -141,18 +145,18 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); } else if (mount.GetCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } else { - setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java index 3aace24ed..06fe8388a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java @@ -239,7 +239,7 @@ public class Explosion extends MiniPlugin } Block block = cur.getLocation().getBlock(); - block.setTypeIdAndData(0, (byte)0, true); + //block.setTypeIdAndData(0, (byte)0, true); //Block Replace if (_enableDebris) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 449a4e52f..9ee33c6d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -5,6 +5,11 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import mineplex.core.gadget.gadgets.hat.HatCompanion; +import mineplex.core.gadget.gadgets.hat.HatLovestruck; +import mineplex.core.gadget.gadgets.hat.HatSecretPackage; +import mineplex.core.gadget.gadgets.hat.HatTeddyBear; +import mineplex.core.gadget.gadgets.item.*; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -32,16 +37,64 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; -import mineplex.core.gadget.gadgets.arrowtrail.*; -import mineplex.core.gadget.gadgets.death.*; -import mineplex.core.gadget.gadgets.doublejump.*; -import mineplex.core.gadget.gadgets.hat.*; -import mineplex.core.gadget.gadgets.item.*; -import mineplex.core.gadget.gadgets.morph.*; -import mineplex.core.gadget.gadgets.outfit.*; -import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan; +import mineplex.core.gadget.gadgets.death.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.DeathFrostLord; +import mineplex.core.gadget.gadgets.death.DeathHearts; +import mineplex.core.gadget.gadgets.death.DeathTitan; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.hat.HatCoal; +import mineplex.core.gadget.gadgets.hat.HatGrinch; +import mineplex.core.gadget.gadgets.hat.HatPresent; +import mineplex.core.gadget.gadgets.hat.HatRudolph; +import mineplex.core.gadget.gadgets.hat.HatSanta; +import mineplex.core.gadget.gadgets.hat.HatSnowman; +import mineplex.core.gadget.gadgets.morph.MorphBat; +import mineplex.core.gadget.gadgets.morph.MorphBlaze; +import mineplex.core.gadget.gadgets.morph.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphBunny; +import mineplex.core.gadget.gadgets.morph.MorphChicken; +import mineplex.core.gadget.gadgets.morph.MorphCow; +import mineplex.core.gadget.gadgets.morph.MorphCreeper; +import mineplex.core.gadget.gadgets.morph.MorphEnderman; +import mineplex.core.gadget.gadgets.morph.MorphPig; +import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; +import mineplex.core.gadget.gadgets.morph.MorphSlime; +import mineplex.core.gadget.gadgets.morph.MorphSnowman; +import mineplex.core.gadget.gadgets.morph.MorphTitan; +import mineplex.core.gadget.gadgets.morph.MorphVillager; +import mineplex.core.gadget.gadgets.morph.MorphWither; +import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitBoots; +import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitLeggings; +import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitBoots; +import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitLeggings; +import mineplex.core.gadget.gadgets.outfit.OutfitTeam; +import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; +import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; +import mineplex.core.gadget.gadgets.particle.ParticleEnchant; +import mineplex.core.gadget.gadgets.particle.ParticleFairy; +import mineplex.core.gadget.gadgets.particle.ParticleFireRings; +import mineplex.core.gadget.gadgets.particle.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; +import mineplex.core.gadget.gadgets.particle.ParticleGreen; +import mineplex.core.gadget.gadgets.particle.ParticleHeart; +import mineplex.core.gadget.gadgets.particle.ParticleHelix; +import mineplex.core.gadget.gadgets.particle.ParticleLegend; +import mineplex.core.gadget.gadgets.particle.ParticleRain; +import mineplex.core.gadget.gadgets.particle.ParticleTitan; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetFrostLord; +import mineplex.core.gadget.set.SetLove; import mineplex.core.gadget.set.SetRaveSuit; import mineplex.core.gadget.set.SetSpaceSuit; import mineplex.core.gadget.set.SetTitan; @@ -59,6 +112,7 @@ import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.MountManager; import mineplex.core.mount.event.MountActivateEvent; +import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; @@ -75,6 +129,7 @@ public class GadgetManager extends MiniPlugin private ProjectileManager _projectileManager; private AchievementManager _achievementManager; private MountManager _mountManager; + private PacketHandler _packetManager; private NautHashMap> _gadgets; @@ -89,7 +144,8 @@ public class GadgetManager extends MiniPlugin public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, - DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager) + DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager, + PacketHandler packetHandler) { super("Gadget Manager", plugin); @@ -102,6 +158,7 @@ public class GadgetManager extends MiniPlugin _blockRestore = blockRestore; _projectileManager = projectileManager; _achievementManager = achievementManager; + _packetManager = packetHandler; _mountManager = mountManager; CreateGadgets(); @@ -114,6 +171,7 @@ public class GadgetManager extends MiniPlugin addSet(new SetFrostLord(this)); addSet(new SetCandyCane(this)); addSet(new SetTitan(this)); + addSet(new SetLove(this)); //Costumes addSet(new SetRaveSuit(this)); @@ -139,6 +197,9 @@ public class GadgetManager extends MiniPlugin addGadget(new ItemCoal(this)); addGadget(new ItemFreezeCannon(this)); addGadget(new ItemSnowball(this)); + addGadget(new ItemBow(this)); + addGadget(new ItemLovePotion(this)); + addGadget(new ItemFlowerGift(this)); // Costume addGadget(new OutfitRaveSuitHelmet(this)); @@ -192,16 +253,19 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailFrostLord(this)); addGadget(new ArrowTrailTitan(this)); addGadget(new ArrowTrailCandyCane(this)); + addGadget(new ArrowTrailHearts(this)); // Death Effect addGadget(new DeathFrostLord(this)); addGadget(new DeathTitan(this)); addGadget(new DeathCandyCane(this)); + addGadget(new DeathHearts(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); addGadget(new DoubleJumpTitan(this)); addGadget(new DoubleJumpCandyCane(this)); + addGadget(new DoubleJumpHearts(this)); // Hat addGadget(new HatSanta(this)); @@ -210,6 +274,10 @@ public class GadgetManager extends MiniPlugin addGadget(new HatCoal(this)); addGadget(new HatRudolph(this)); addGadget(new HatGrinch(this)); + addGadget(new HatLovestruck(this)); + addGadget(new HatSecretPackage(this)); + addGadget(new HatTeddyBear(this)); + addGadget(new HatCompanion(this)); // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); @@ -407,9 +475,9 @@ public class GadgetManager extends MiniPlugin return _inventoryManager; } - public boolean collideEvent(Gadget gadget, Player other) + public boolean collideEvent(Player shooter, Gadget gadget, Player other) { - GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(gadget, other); + GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(shooter, gadget, other); Bukkit.getServer().getPluginManager().callEvent(collideEvent); @@ -420,6 +488,11 @@ public class GadgetManager extends MiniPlugin { return _blockRestore; } + + public PacketHandler getPacketManager() + { + return _packetManager; + } @EventHandler public void setMoving(PlayerMoveEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetCollideEntityEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetCollideEntityEvent.java index a30648983..0fab27166 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetCollideEntityEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetCollideEntityEvent.java @@ -1,22 +1,25 @@ package mineplex.core.gadget.event; -import mineplex.core.gadget.types.Gadget; - import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import mineplex.core.gadget.types.Gadget; + public class GadgetCollideEntityEvent extends Event { private static final HandlerList handlers = new HandlerList(); + private Player _gadgetHolder; private Gadget _gadget; private Entity _other; private boolean _cancelled = false; - public GadgetCollideEntityEvent(Gadget gadget, Entity other) + public GadgetCollideEntityEvent(Player player, Gadget gadget, Entity other) { + _gadgetHolder = player; _gadget = gadget; _other = other; } @@ -30,6 +33,11 @@ public class GadgetCollideEntityEvent extends Event { return handlers; } + + public Player getPlayer() + { + return _gadgetHolder; + } public Gadget getGadget() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java new file mode 100644 index 000000000..1c9ca8eec --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java @@ -0,0 +1,42 @@ +package mineplex.core.gadget.gadgets.arrowtrail; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; + +public class ArrowTrailHearts extends ArrowEffectGadget +{ + /** + * Created by: Mysticate + * Timestamp: February 4, 2016 + */ + + public ArrowTrailHearts(GadgetManager manager) + { + super(manager, "Arrows of Cupid", + UtilText.splitLineToArray(C.cGray + "Tether your love to an arrow, then spear someone with it. Maybe they'll fall in love!", LineFormat.LORE), + -6, + Material.APPLE, (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .1F, .1F, .1F, 0F, 1, ViewDist.LONGER); + } + + @Override + public void doHitEffect(Arrow arrow) + { + UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java new file mode 100644 index 000000000..abdc9e191 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java @@ -0,0 +1,53 @@ +package mineplex.core.gadget.gadgets.death; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; + +public class DeathHearts extends DeathEffectGadget +{ + /** + * Created by: Mysticate + * Timestamp: February 4, 2016 + */ + + public DeathHearts(GadgetManager manager) + { + super(manager, "Broken Hearted", + UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE), + -6, Material.APPLE, (byte) 0); + } + + @EventHandler + public void onBlood(BloodEvent event) + { + if (IsActive(event.getPlayer())) + event.setItem(Material.AIR, (byte) 0); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onParticles(BloodEvent event) + { + if (event.isCancelled()) + return; + + if (IsActive(event.getPlayer())) + { + Location loc = event.getLocation().clone().add(0, .5, 0); + + UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java new file mode 100644 index 000000000..2b2b7af15 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java @@ -0,0 +1,35 @@ +package mineplex.core.gadget.gadgets.doublejump; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; + +public class DoubleJumpHearts extends DoubleJumpEffectGadget +{ + /** + * Created by: Mysticate + * Timestamp: February 4, 2016 + */ + + public DoubleJumpHearts(GadgetManager manager) + { + super(manager, "Wings of Love", + UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE), + -6, Material.APPLE, (byte) 0); + } + + @Override + public void doEffect(Player player) + { + UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanion.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanion.java new file mode 100644 index 000000000..e3191207f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanion.java @@ -0,0 +1,19 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatCompanion extends HatGadget +{ + public HatCompanion(GadgetManager manager) + { + super(manager, "Companion", + UtilText.splitLineToArray(C.cGray + "The Enrichment Center reminds you that the Weighted Companion Cube will never threaten to stab you and, in fact, cannot speak", LineFormat.LORE), + -6, + SkinData.COMPANION_CUBE.getSkull()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java new file mode 100644 index 000000000..87a2ea0ee --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java @@ -0,0 +1,19 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatLovestruck extends HatGadget +{ + public HatLovestruck(GadgetManager manager) + { + super(manager, "Lovestruck", + UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), + -6, + SkinData.LOVESTRUCK.getSkull()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java new file mode 100644 index 000000000..d6b4ca66b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java @@ -0,0 +1,19 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatSecretPackage extends HatGadget +{ + public HatSecretPackage(GadgetManager manager) + { + super(manager, "Secret Package", + UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), + -6, + SkinData.SECRET_PACKAGE.getSkull()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java new file mode 100644 index 000000000..6a5868d42 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java @@ -0,0 +1,19 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatTeddyBear extends HatGadget +{ + public HatTeddyBear(GadgetManager manager) + { + super(manager, "Teddy Bear", + UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), + -6, + SkinData.TEDDY_BEAR.getSkull()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java index 9a8096e9b..ba436a8b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java @@ -110,7 +110,7 @@ public class ItemBatGun extends ItemGadget if (UtilEnt.hitBox(bat.getLocation(), other, 2, null)) { - if (Manager.collideEvent(this, other)) + if (Manager.collideEvent(cur, this, other)) continue; //Damage Event diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBow.java new file mode 100644 index 000000000..16e78ec14 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBow.java @@ -0,0 +1,220 @@ +package mineplex.core.gadget.gadgets.item; + +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Creeper; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; + +public class ItemBow extends ItemGadget +{ + /** + * Created by: Mysticate + * Timestamp: February 4, 2016 + */ + + private HashSet _arrows = new HashSet(); + private boolean _spawning = false; + + private String[] _responses = new String[] + { + "Do you feel the love?", + "Are you in love?", + "(I think they like you!)", + "Ahhh. Young love!", + "Maybe they'll bring you a rose!", + "You should go say Hi to them.", + "They look nice.", + "I love love!", + "Go get 'em, tiger!", + "Don't be TOO flirty, now.", + "That was one of my good arrows!", + "Do you believe in love at first sight?", + "Never gunna give you up, never gunna let you down.", + "I approve this message!", + }; + + private IPacketHandler _packetHandler = new IPacketHandler() + { + @Override + public void handle(PacketInfo packetInfo) + { + if (_spawning) + { + packetInfo.setCancelled(true); + return; + } + + PacketPlayOutSpawnEntity packet = (PacketPlayOutSpawnEntity) packetInfo.getPacket(); + + for (Snowball arrow : _arrows) + { + if (arrow.getEntityId() == packet.a) + { + packetInfo.setCancelled(true); + return; + } + } + } + }; + + @SuppressWarnings("unchecked") + public ItemBow(GadgetManager manager) + { + super(manager, "Cupid's Arrows", + UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE), + -6, Material.BOW, (byte) 0, 1000, new Ammo("Cupid Arrow", "Cupid's Arrows", Material.ARROW, (byte) 0, UtilText.splitLineToArray(C.cGray + "Use these arrows to shoot love into people's hearts!", LineFormat.LORE), -6, 15)); + + Manager.getPacketManager().addPacketHandler(_packetHandler, PacketPlayOutSpawnEntity.class); + } + + @Override + public void ActivateCustom(Player player) + { + _spawning = true; + Snowball arrow = player.launchProjectile(Snowball.class); + _spawning = false; + + _arrows.add(arrow); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + for (Snowball arrow : new HashSet(_arrows)) + { + if (!arrow.isValid()) + { + _arrows.remove(arrow); + continue; + } + + UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), 0F, 0F, 0F, 0F, 1, ViewDist.LONGER); + } + } + } + + @EventHandler + public void onHit(ProjectileHitEvent event) + { + if (!(event.getEntity() instanceof Snowball)) + return; + + Snowball arrow = (Snowball) event.getEntity(); + + if (!_arrows.contains(arrow)) + return; + + Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + if (_arrows.remove(arrow)) + { + arrow.remove(); + UtilPlayer.message((Player) arrow.getShooter(), F.main(C.cRed + "Cupid", "You missed the shot!")); + } + } + }, 1); + } + + @EventHandler + public void onDamage(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Snowball)) + return; + + Snowball arrow = (Snowball) event.getDamager(); + + if (!_arrows.contains(arrow)) + return; + + _arrows.remove(arrow); + arrow.remove(); + + Player shooter = (Player) arrow.getShooter(); + + if (event.getEntity() instanceof Creeper && event.getEntity().getCustomName().equalsIgnoreCase(C.cGreenB + "Carl the Creeper")) + { + UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "Nobody will ever replace Carla.")); + return; + } + + // Effects + if (event.getEntity() instanceof Player) + { + if (event.getEntity() == shooter) + { + UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "We've all been there.")); + return; + } + + UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "You hit " + F.name(UtilEnt.getName(event.getEntity())) + " with an arrow! I wonder how they're feeling...")); + + ((Player) event.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 40, false, false)); + UtilPlayer.message(event.getEntity(), F.main(C.cRed + "Cupid", F.name(UtilEnt.getName(shooter)) + " hit you with an arrow! " + UtilMath.randomElement(_responses))); + } + + UtilParticle.PlayParticleToAll(ParticleType.HEART, event.getEntity().getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); + + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), event.getEntity().getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), event.getEntity().getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL); + + shooter.playSound(shooter.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f); + +// Entity damaged = event.getEntity(); +// AxisAlignedBB bb = ((CraftEntity) damaged).getHandle().getBoundingBox(); +// +// final Location loc = damaged.getLocation().clone(); +// final AxisAlignedBB bounding = new AxisAlignedBB(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f); // Clone it +// +// int i = 0; +// for (double rise = bounding.b ; rise < bounding.e ; rise += .2) +// { +// i++; +// +// final float y = (float) (rise - bounding.b); +// final float x = (float) (Math.sin(y) * 2); +// final float z = (float) (Math.cos(y) * 2); +// +// Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() +// { +// @Override +// public void run() +// { +// UtilParticle.PlayParticleToAll(ParticleType.HEART, loc.clone().add(x, y, z), 0F, 0F, 0F, 0F, 1, ViewDist.LONGER); +// } +// }, i); +// } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index 4ef0da13d..71544264e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -69,7 +69,7 @@ public class ItemCoal extends ItemGadget , -1, Material.COAL, (byte) 0, 1000, new Ammo("Coal", "1 Piece of Coal", Material.COAL, (byte) 0, new String[] { C.cDGray + "Exclusive Coal!", - C.cDGray + "Earned by beeing naughty" + C.cDGray + "Earned by being naughty" } , -1, 1)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java index a35ab819d..dfb2526eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java @@ -68,7 +68,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown return; if (target instanceof Player) - if (Manager.collideEvent(this, (Player) target)) + if (Manager.collideEvent(player, this, (Player) target)) return; //Pull diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java new file mode 100644 index 000000000..085a5a5cb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java @@ -0,0 +1,115 @@ +package mineplex.core.gadget.gadgets.item; + +import mineplex.core.common.util.*; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.valentines.event.AttemptGiftEvent; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class ItemFlowerGift extends ItemGadget +{ + public ItemFlowerGift(GadgetManager manager) + { + super(manager, + "Valentines Gift", + UtilText.splitLineToArray(C.cGray + "Maybe if Sigils and Phinary used these they wouldn't be so alone", LineFormat.LORE), + -7, + Material.RED_ROSE, + (byte) 0, + 6000, + new Ammo("Valentines Gift", "Valentines Gift", Material.RED_ROSE, (byte) 0, UtilText.splitLineToArray(C.cGray + "Maybe if Sigils and Phinary used these they wouldn't be so alone", LineFormat.LORE), -7, 10)); + } + + @Override + public void ActivateCustom(Player player) + { + + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInteract(PlayerInteractAtEntityEvent event) + { + Player player = event.getPlayer(); + + if (!IsActive(player)) + return; + + if (!UtilGear.isMat(player.getItemInHand(), GetDisplayMaterial())) + return; + + if (!hasAmmo(player)) + { + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + + ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); + Bukkit.getServer().getPluginManager().callEvent(ammoEvent); + + return; + } + + //Recharge + if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + { + UtilInv.Update(player); + return; + } + + if (event.getRightClicked() instanceof Player) + { + Player to = ((Player) event.getRightClicked()); + AttemptGiftEvent giftEvent = new AttemptGiftEvent(player, to); + Bukkit.getPluginManager().callEvent(giftEvent); + } + else + { + UtilPlayer.message(player, F.main("Gadget", "You used " + F.elem(GetName()) + " on " + F.name(event.getRightClicked().getName()) + ". It's not very effective...")); + } + + event.setCancelled(true); + } + + @Override + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (!IsActive(event.getPlayer())) + return; + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial())) + return; + + //Recharge + if (!Recharge.Instance.use(event.getPlayer(), GetName(), GetName(), _recharge, false, true, false, true, "Cosmetics")) + return; + + if (!hasAmmo(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Gadget", "You do not have any " + GetName() + " left.")); + + ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); + Bukkit.getServer().getPluginManager().callEvent(ammoEvent); + + return; + } + + event.setCancelled(true); + + // Logic is handled in onInteract (so we can cancel interact events on npc's) + UtilPlayer.message(event.getPlayer(), F.main("Gift", "Nothing happened... Maybe I should try giving this to someone?!")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java new file mode 100644 index 000000000..1f3346e34 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java @@ -0,0 +1,191 @@ +package mineplex.core.gadget.gadgets.item; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +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.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; + +public class ItemLovePotion extends ItemGadget +{ + private static final String[] DRINK_MESSAGES = { + "YUCK! This does not taste like it was meant for humans.", + "Gross! Why do I keep drinking this stuff... ", + "BAAAAA BAAAAAAAA. Weird, that made me feel a bit sheepish." + }; + + /** + * Created by: Mysticate + * Timestamp: February 6, 2016 + */ + + public ItemLovePotion(GadgetManager manager) + { + super( + manager, + "Love Potion", + UtilText.splitLineToArray(C.cGray + "It doesn't seem to affect humans..? What kind of love potion is this!?", LineFormat.LORE), + -6, + Material.POTION, + (byte) 8233, + 20000, + + new Ammo( + "Love Potion", + "Love Potion", + Material.POTION, + (byte) 8233, + UtilText.splitLineToArray(C.cGray + "It doesn't seem to affect humans..? What kind of love potion is this!?", LineFormat.LORE), + -6, + 16) + ); + } + + @Override + public void ApplyItem(Player player, boolean inform) + { + Manager.removeGadgetType(player, GadgetType.Item); + + _active.add(player); + + List itemLore = new ArrayList(); + itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.add(C.cBlack); + itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName())); + + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + + if (inform) + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + } + + @EventHandler + public void onInteract(PlayerInteractEntityEvent event) + { + Player player = event.getPlayer(); + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial())) + return; + + if (!IsActive(player)) + return; + + if (!Recharge.Instance.use(player, "Interact Love Potion", 1000, false, false)) + return; + + event.setCancelled(true); + + //Stock + if (!hasAmmo(player)) + { + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + + ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); + Bukkit.getServer().getPluginManager().callEvent(ammoEvent); + + return; + } + + if (!Recharge.Instance.usable(player, GetName())) + { + UtilInv.Update(player); + return; + } + + GadgetCollideEntityEvent gadgetEvent = new GadgetCollideEntityEvent(player, this, event.getRightClicked()); + gadgetEvent.setCancelled(true); // Pre cancel + + Bukkit.getPluginManager().callEvent(gadgetEvent); + + if (gadgetEvent.isCancelled()) + return; + + Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown + + Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + return; + + Player player = event.getPlayer(); + + if (!IsActive(player)) + return; + + if (!Recharge.Instance.use(player, "Interact Love Potion", 500, false, false)) + return; + + event.setCancelled(true); + + //Stock + if (!hasAmmo(player)) + { + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + + ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); + Bukkit.getServer().getPluginManager().callEvent(ammoEvent); + + return; + } + + //Recharge + if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + { + UtilInv.Update(player); + return; + } + + String message = UtilMath.randomElement(DRINK_MESSAGES); + UtilPlayer.message(player, F.main("Potion", message)); + + Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + + ActivateCustom(event.getPlayer()); + } + + @Override + public void ActivateCustom(Player player) + { + player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 40, false, false)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java index 5e8a9734a..9e27220e4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.item; -import java.util.HashSet; - import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -12,6 +10,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; @@ -22,7 +21,7 @@ import mineplex.core.gadget.types.ItemGadget; public class ItemSnowball extends ItemGadget { - private HashSet _snowballs = new HashSet<>(); + private NautHashMap _snowballs = new NautHashMap(); public ItemSnowball(GadgetManager manager) { @@ -40,16 +39,21 @@ public class ItemSnowball extends ItemGadget public void ActivateCustom(Player player) { Snowball ball = player.launchProjectile(Snowball.class); - _snowballs.add(ball); + _snowballs.put(ball, player); ball.getWorld().playSound(ball.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.3f); } @EventHandler public void onHit(EntityDamageByEntityEvent event) { - if(!_snowballs.contains(event.getDamager())) return; + if (!(event.getDamager() instanceof Snowball)) + return; - GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity()); + Snowball ball = (Snowball) event.getDamager(); + + if(!_snowballs.containsKey(ball)) return; + + GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(_snowballs.remove(ball), this, event.getEntity()); if(gevent.isCancelled()) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java index e3b5f01f9..6584046e5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java @@ -16,11 +16,11 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; @@ -29,7 +29,7 @@ import mineplex.core.updater.event.UpdateEvent; public class ItemTNT extends ItemGadget { - private HashSet _tnt = new HashSet(); + private HashMap _tnt = new HashMap(); public ItemTNT(GadgetManager manager) { @@ -46,7 +46,7 @@ public class ItemTNT extends ItemGadget TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); tnt.setYield(0.0F); // Added in order to prevent water from being evaporated. UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false); - _tnt.add(tnt); + _tnt.put(tnt, player); //Inform UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + ".")); @@ -58,13 +58,15 @@ public class ItemTNT extends ItemGadget if (!(event.getEntity() instanceof TNTPrimed)) return; - if (!_tnt.remove(event.getEntity())) + if (!_tnt.containsKey(event.getEntity())) return; + Player killer = _tnt.get(event.getEntity()); + HashMap players = UtilPlayer.getInRadius(event.getLocation(), 8); for (Player player : players.keySet()) { - if (Manager.collideEvent(this, player)) + if (Manager.collideEvent(killer, this, player)) continue; double mult = players.get(player); @@ -84,16 +86,12 @@ public class ItemTNT extends ItemGadget if (event.getType() != UpdateType.FAST) return; - Iterator tntIterator = _tnt.iterator(); - - while (tntIterator.hasNext()) + for (TNTPrimed tnt : new HashSet(_tnt.keySet())) { - TNTPrimed tnt = tntIterator.next(); - if (!tnt.isValid() || tnt.getTicksLived() > 200) { tnt.remove(); - tntIterator.remove(); + _tnt.remove(tnt); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index ee5a33290..90478d1eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -113,7 +113,7 @@ public class MorphCreeper extends MorphGadget if (other.equals(player)) continue; - if (Manager.collideEvent(this, other)) + if (Manager.collideEvent(player, this, other)) continue; double mult = players.get(other); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index 59ed09fa0..04fa7c32e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -135,7 +135,7 @@ public class MorphPig extends MorphGadget if (UtilMath.offset(player, other) > range) continue; - if (Manager.collideEvent(this, other)) + if (Manager.collideEvent(player, this, other)) continue; //Cooldown diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java index 75e5ad743..8834023e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -143,7 +143,7 @@ public class MorphSnowman extends MorphGadget if (!_snowball.containsKey(proj)) return; - GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity()); + GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(_snowball.remove(proj), this, event.getEntity()); if(gevent.isCancelled()) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index 68091b674..aaed71945 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -139,7 +139,7 @@ public class MorphTitan extends MorphGadget for (Player ent : players.keySet()) { if (ent instanceof Player) - if (Manager.collideEvent(this, (Player)ent)) + if (Manager.collideEvent(event.GetPlayer(), this, (Player)ent)) continue; double mult = players.get(ent); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index f327f0551..d2e9f9bad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -116,7 +116,7 @@ public class MorphVillager extends MorphGadget implements IThrown return; if (target instanceof Player) - if (Manager.collideEvent(this, (Player) target)) + if (Manager.collideEvent((Player) data.GetThrower(), this, (Player) target)) return; //Pull diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index a2d68070f..f5029d34b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -128,7 +128,7 @@ public class MorphWither extends MorphGadget HashMap players = UtilPlayer.getInRadius(event.getLocation(), 6); for (Player player : players.keySet()) { - if (Manager.collideEvent(this, player)) + if (Manager.collideEvent((Player) skull.getShooter(), this, player)) continue; double mult = players.get(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java index d07a2b01a..dacc9e9da 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java @@ -33,10 +33,10 @@ public class ParticleHeart extends ParticleGadget { public ParticleHeart(GadgetManager manager) { - super(manager, "I Heart You", - UtilText.splitLineToArray(C.cGray + "Show off how much you love Mineplex and everyone on it!", LineFormat.LORE), + super(manager, "Heartfelt Halo", + UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE), -2, - Material.APPLE, (byte)0); + Material.APPLE, (byte)0, "I Heart You"); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java new file mode 100644 index 000000000..60f474c73 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java @@ -0,0 +1,25 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts; +import mineplex.core.gadget.gadgets.death.DeathHearts; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts; +import mineplex.core.gadget.gadgets.particle.ParticleHeart; +import mineplex.core.gadget.types.GadgetSet; + +public class SetLove extends GadgetSet +{ + /** + * Created by: Mysticate + * Timestamp: February 4, 2016 + */ + + public SetLove(GadgetManager manager) + { + super(manager, "Lovely!", "Coming Soon", + manager.getGadget(ArrowTrailHearts.class), + manager.getGadget(DeathHearts.class), + manager.getGadget(DoubleJumpHearts.class), + manager.getGadget(ParticleHeart.class)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index ecaa65bf3..51bb9f662 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -68,15 +68,17 @@ public enum GameDisplay Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), - SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60), - - Minecraft_League("Minecraft League", Material.DIAMOND_SWORD, (byte)0, GameCategory.SURVIVAL, 61), + Minecraft_League("Minecraft League", Material.DIAMOND_SWORD, (byte)0, GameCategory.SURVIVAL, 62), ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58), TypeWars("Type Wars", Material.NAME_TAG, (byte) 0, GameCategory.CLASSICS, 59), + + SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60), + + Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java index 97257bd98..e6d4a4897 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java @@ -12,7 +12,6 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.command.GlobalPacketCommand; import mineplex.core.globalpacket.listeners.GlobalGiveCoins; import mineplex.core.globalpacket.listeners.GlobalGiveGems; @@ -35,7 +34,7 @@ public class GlobalPacketManager extends MiniPlugin private DonationManager _donationManager; private RewardManager _rewardManager; - public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager) + public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager) { super("Global Packet Manager", plugin); @@ -44,7 +43,7 @@ public class GlobalPacketManager extends MiniPlugin _inventoryManager = inventoryManager; _donationManager = donationManager; - _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, 100, 250, 500, 1000, 1500, 2500, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 4d3431275..72a33d939 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -103,6 +103,13 @@ public class InventoryManager extends MiniDbClientPlugin { System.out.println("Add item to Inventory FAILED for " + player.getName()); } + else + { + if (_items.containsKey(item)) + { + Get(player).addItem(new ClientItem(_items.get(item), count)); + } + } if (callback != null) callback.run(success); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 59dc27148..10b0c9707 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -209,8 +209,6 @@ public class MessageManager extends MiniClientPlugin } } - message = _chat.getFilteredMessage(from, message); - // Inform UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message); @@ -229,11 +227,6 @@ public class MessageManager extends MiniClientPlugin UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development."); UtilPlayer.message(from, C.cPurple + "Please be patient if she does not reply instantly."); } - - /*if(to.getName().equals("ishh")) - { - UtilPlayer.message(from, C.cPurple + "Hi, my name is ishh. If I don't respond to your message, please be patient and try again later!"); - }*/ // Log // Logger().logChat("Private Message", from, to.getName(), message); @@ -495,26 +488,16 @@ public class MessageManager extends MiniClientPlugin final FriendStatus friendInfo = friend; - new BukkitRunnable() + runAsync(new Runnable() { - final String newMessage = _chat.getFilteredMessage(sender, message); - @Override public void run() { - new BukkitRunnable() - { + final String newMessage = _chat.getFilteredMessage(sender, message); - @Override - public void run() - { - sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo); - } - - }.runTask(getPlugin()); + runSync(() -> sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo)); } - - }.runTaskAsynchronously(getPlugin()); + }); } private void sendMessage(final Player sender, String target, String message, final boolean adminMessage, boolean isReply, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 814280180..905a61ba4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -32,6 +32,7 @@ import mineplex.core.mount.types.MountSlime; import mineplex.core.mount.types.MountSpider; import mineplex.core.mount.types.MountTitan; import mineplex.core.mount.types.MountUndead; +import mineplex.core.mount.types.MountValentinesSheep; import mineplex.core.mount.types.MountZombie; public class MountManager extends MiniPlugin @@ -70,6 +71,7 @@ public class MountManager extends MiniPlugin _types.add(new MountZombie(this)); _types.add(new MountTitan(this)); _types.add(new MountBabyReindeer(this)); + _types.add(new MountValentinesSheep(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java new file mode 100644 index 000000000..5213be86b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java @@ -0,0 +1,97 @@ +package mineplex.core.mount.types; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +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.UtilText; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSheep; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MountValentinesSheep extends HorseMount +{ + /** + * Created by: Mysticate + * Timestamp: February 4, 2016 + */ + + public MountValentinesSheep(MountManager manager) + { + super(manager, "Loving Sheeples", + UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE), + Material.WOOL, (byte) 6, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null); + } + + @Override + public void EnableCustom(Player player) + { + super.EnableCustom(player); + + Horse horse = GetActive().get(player).getEntity(); + + UtilEnt.silence(horse, true); + + DisguiseSheep disguise = new DisguiseSheep(horse); + disguise.setColor(DyeColor.PINK); + + Manager.getDisguiseManager().disguise(disguise); + } + + @EventHandler + public void doAnimations(UpdateEvent event) + { + for (SingleEntityMountData ent : GetActive().values()) + { + if (!ent.getEntity().isValid()) + continue; + + if (event.getType() == UpdateType.FASTEST) + { + Location loc = ent.getEntity().getLocation().clone().add(0, .5, 0); + + UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, .5F, .4F, .5F, 0F, 1, ViewDist.NORMAL); + + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), loc, .5F, .4F, .5F, 0.0f, 1, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), loc, .5F, .4F, .5F, 0.0f, 1, ViewDist.NORMAL); + } + else if (event.getType() == UpdateType.FAST) + { + DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(ent.getEntity()); + + if (disguise instanceof DisguiseSheep) + { + DisguiseSheep sheep = (DisguiseSheep) disguise; + + if (sheep.getColor() == 6) // Pink + { + sheep.setColor(DyeColor.RED); + } + else if (sheep.getColor() == 14) // Red + { + sheep.setColor(DyeColor.MAGENTA); + } + else if (sheep.getColor() == 2) // Magenta + { + sheep.setColor(DyeColor.PINK); + } + + Manager.getDisguiseManager().updateDisguise(sheep); + } + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index 1235a6301..56d689a77 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -11,25 +11,12 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.World; +import org.bukkit.*; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; -import org.bukkit.entity.Ageable; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Slime; -import org.bukkit.entity.Villager; -import org.bukkit.entity.Zombie; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityCombustEvent; @@ -236,7 +223,7 @@ public class NpcManager extends MiniPlugin event.setCancelled(true); } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.getRightClicked() instanceof LivingEntity) @@ -350,6 +337,8 @@ public class NpcManager extends MiniPlugin ((Skeleton) entity).setSkeletonType(Skeleton.SkeletonType.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase())); if (entity instanceof Villager && npc.getDatabaseRecord().getEntityMeta() != null) ((Villager) entity).setProfession(Villager.Profession.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase())); + if (entity instanceof Sheep && npc.getDatabaseRecord().getEntityMeta() != null) + ((Sheep) entity).setColor(DyeColor.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase())); if (entity instanceof org.bukkit.entity.Creature) ((org.bukkit.entity.Creature) entity).setTarget(null); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 6a8507a5e..1a7094a8f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -39,7 +39,6 @@ public class RewardManager private CoreClientManager _clientManager; private DonationManager _donationManager; private ServerStatusManager _statusManager; - private GiveawayManager _giveawayManager; private boolean _doubleGadgetValue; @@ -48,7 +47,7 @@ public class RewardManager private int _legendaryShards = 5000; - public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager, + public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, int commonValueMin, int commonValueMax, int uncommonValueMin, int uncommonValueMax, int rareValueMin, int rareValueMax, @@ -67,7 +66,6 @@ public class RewardManager _clientManager = clientManager; _statusManager = statusManager; _donationManager = donationManager; - _giveawayManager = giveawayManager; _doubleGadgetValue = doubleGadgetValue; _carlSpinner = carlSpinner; @@ -101,6 +99,58 @@ public class RewardManager maxValue *= 2; } + // Valentines + addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Cupid's Arrows", "Cupid Arrow", 1, 5, + new ItemStack(Material.BOW, 1), rarity, 300, 0)); + // Pets + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow", + EntityType.COW, rarity, 50, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep", + EntityType.SHEEP, rarity, 50, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom", + EntityType.MUSHROOM_COW, rarity, 50, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig", + EntityType.PIG, rarity, 50, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat", + EntityType.OCELOT, rarity, 50, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken", + EntityType.CHICKEN, rarity, 50, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog", + EntityType.WOLF, rarity, 50, _uncommonShards)); + // Discs + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "13 Disc", "13 Disc", + new ItemStack(2256), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Cat Disc", "Cat Disc", + new ItemStack(2257), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Blocks Disc", "Blocks Disc", + new ItemStack(2258), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Chirp Disc", "Chirp Disc", + new ItemStack(2259), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Far Disc", "Far Disc", + new ItemStack(2260), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Mall Disc", "Mall Disc", + new ItemStack(2261), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Mellohi Disc", "Mellohi Disc", + new ItemStack(2262), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Stal Disc", "Stal Disc", + new ItemStack(2263), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Strad Disc", "Strad Disc", + new ItemStack(2264), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Ward Disc", "Ward Disc", + new ItemStack(2265), rarity, 10, _uncommonShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Wait Disc", "Wait Disc", + new ItemStack(2267), rarity, 10, _uncommonShards)); + // Mounts + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Mule", "Mount Mule", + new ItemStack(Material.HAY_BLOCK), rarity, 4, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Minecart", "Minecart", + new ItemStack(Material.MINECART), rarity, 3, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Slime", "Slime Mount", + new ItemStack(Material.SLIME_BALL), rarity, 2, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Glacial Steed", "Glacial Steed", + new ItemStack(Material.SNOW_BALL), rarity, 1, _rareShards)); + + // Christmas addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Coal", "Coal", 50, 100, new ItemStack(Material.COAL), rarity, 10, 0)); @@ -162,6 +212,12 @@ public class RewardManager maxValue *= 2; } + // Valentines + addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1, + new ItemStack(Material.POTION, 1), rarity, 100, 0)); + addReward(RewardPool.Type.VALENTINES_GIFT, new TreasureShardReward(_clientManager, donationManager, 100, 200, 25, rarity)); + + // Christmas addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Freeze Cannon", "Freeze Cannon", 5, 10, new ItemStack(Material.ICE), rarity, 10, 0)); addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Party Popper", "Party Popper", 5, 10, @@ -257,6 +313,19 @@ public class RewardManager // addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE)); } + // Valentines + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Companion Hat", "Companion", + SkinData.COMPANION_CUBE.getSkull(), rarity, 100, 0)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Lovestruck Hat", "Lovestruck", + SkinData.LOVESTRUCK.getSkull(), rarity, 100, 0)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Secret Package Hat", "Secret Package", + SkinData.SECRET_PACKAGE.getSkull(), rarity, 100, 0)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Teddy Bear Hat", "Teddy Bear", + SkinData.TEDDY_BEAR.getSkull(), rarity, 100, 0)); + addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1, + new ItemStack(Material.POTION, 1), rarity, 1, 0)); + + // Christmas addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "Santa", "Santa", SkinData.SANTA.getSkull(), rarity, 5, _rareShards)); addReward(RewardPool.Type.WINTER_HOLIDAY, new PetReward(petManager, inventoryManager, donationManager, "Elf", "Christmas Elf", @@ -326,6 +395,19 @@ public class RewardManager // addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); } + // Valentines + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Arrow Effect", "Arrows of Cupid", "Arrows of Cupid", + new ItemStack(Material.POTION), rarity, 100, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Death Effect", "Broken Hearted", "Broken Hearted", + new ItemStack(Material.POTION), rarity, 100, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Jump Effect", "Wings of Love", "Wings of Love", + new ItemStack(Material.POTION), rarity, 100, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Particles", "Heartfelt Halo", "Heartfelt Halo", + new ItemStack(Material.POTION), rarity, 100, _rareShards)); + addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1, + new ItemStack(Material.POTION, 1), rarity, 1, 0)); + + // Christmas addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "The Grinch", "The Grinch", SkinData.THE_GRINCH.getSkull(), rarity, 5, _legendaryShards)); addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Morph", "Olaf", "Olaf Morph", @@ -480,7 +562,7 @@ public class RewardManager } } - if (!isExcluded) + if (!isExcluded && (pool.getUseDuplicates() || treasure.canGiveReward(player))) { possibleRewards.add(treasure); totalWeight += treasure.getWeight(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 72c38535f..97f4f23c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -34,7 +34,20 @@ public class RewardPool public static enum Type { - NORMAL, - WINTER_HOLIDAY; + NORMAL(true), + WINTER_HOLIDAY(true), + VALENTINES_GIFT(false); + + private boolean _useDuplicates; + + Type(boolean useDuplicates) + { + _useDuplicates = useDuplicates; + } + + public boolean getUseDuplicates() + { + return _useDuplicates; + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index a26c177a7..24773c6b8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -11,6 +11,7 @@ public enum RewardType AncientChest( 0, 2, 8, 32), MythicalChest( 0.1, 4, 16, 72), WinterChest( 0, 5, 18, 32), + ValentinesGift( 0, 7, 20, 20), SpinnerFiller( 0.1, 1, 4, 20), SpinnerReal( 0.000001, 0.05, 0.4, 5); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java index 2fcb04e18..5f9c368e5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java @@ -1,6 +1,7 @@ package mineplex.core.reward.rewards; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.UtilMath; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -18,7 +19,8 @@ public class TreasureShardReward extends Reward private CoreClientManager _clientManager; private DonationManager _donationManager; private Reward _otherReward; - private int _shards = 0; + private int _shardsMin = 0; + private int _shardsMax = 0; public TreasureShardReward(CoreClientManager clientManager, DonationManager donationManager, Reward otherReward, int weight, RewardRarity rarity) { @@ -28,14 +30,36 @@ public class TreasureShardReward extends Reward _donationManager = donationManager; _otherReward = otherReward; - _shards += (int) (otherReward.getShardValue() + (Math.random() * otherReward.getShardValue() / 2.0)); + _shardsMin = (int) (otherReward.getShardValue() + (Math.random() * otherReward.getShardValue() / 2.0)); + _shardsMax = _shardsMin; + } + + public TreasureShardReward(CoreClientManager clientManager, DonationManager donationManager, int min, int max, int weight, RewardRarity rarity) + { + super(rarity, weight, 0); + + _clientManager = clientManager; + _donationManager = donationManager; + + _shardsMin = min; + _shardsMax = max; } @Override public RewardData giveRewardCustom(Player player, RewardType rewardType) { - RewardData fakeData = _otherReward.getFakeRewardData(player); - RewardData rewardData = new RewardData(fakeData.getHeader(), fakeData.getFriendlyName(), fakeData.getDisplayItem(), fakeData.getRarity(), _shards); + RewardData rewardData; + final int shards = UtilMath.rRange(_shardsMin, _shardsMax); + + if (_otherReward != null) + { + RewardData fakeData = _otherReward.getFakeRewardData(player); + rewardData = new RewardData(fakeData.getHeader(), fakeData.getFriendlyName(), fakeData.getDisplayItem(), fakeData.getRarity(), shards); + } + else + { + rewardData = new RewardData(null, getRarity().getColor() + shards + " Treasure Shards", new ItemStack(Material.PRISMARINE_SHARD), getRarity()); + } int accountId = _clientManager.getAccountId(player); @@ -45,7 +69,7 @@ public class TreasureShardReward extends Reward @Override public void run() { - _donationManager.rewardCoinsUntilSuccess(null, "Treasure", player.getName(), accountId, _shards); + _donationManager.rewardCoinsUntilSuccess(null, "Treasure", player.getName(), accountId, shards); } }, 100); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java index 342784570..d05f7734c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -210,4 +211,13 @@ public class ShopItem extends ItemStack return this; } + + public ShopItem hideInfo() + { + ItemMeta meta = getItemMeta(); + meta.addItemFlags(ItemFlag.values()); + setItemMeta(meta); + + return this; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index a5c89e0ce..104272137 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -14,7 +14,6 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.donation.DonationManager; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.pet.PetManager; @@ -38,7 +37,7 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _treasureLocations; - public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, GiveawayManager giveawayManager) + public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager) { super("Treasure", plugin); @@ -47,7 +46,7 @@ public class TreasureManager extends MiniPlugin _blockRestore = blockRestore; _hologramManager = hologramManager; _statsManager = statsManager; - _rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager, giveawayManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager, 100, 250, 500, 1000, 4000, 6000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/GiftEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/GiftEffect.java new file mode 100644 index 000000000..c8411188c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/GiftEffect.java @@ -0,0 +1,140 @@ +package mineplex.core.valentines; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; + +public class GiftEffect +{ + private static final int ANIMATION_LENGTH = 20 * 5; + private static final double CIRCLE_RADIUS = 3; + private static final double CIRCLE_HEIGHT = 3; + + private Player _from; + private Player _to; + private String _fromGift; + private String _toGift; + private Location _centerLocation; + private boolean _finished; + private int _ticks; + + public GiftEffect(Player from, Player to, String fromGift, String toGift, Location centerLocation) + { + _from = from; + _to = to; + _fromGift = fromGift; + _toGift = toGift; + _centerLocation = centerLocation; + _finished = false; + _ticks = 0; + +// _to.setWalkSpeed(0.0F); +// _from.setWalkSpeed(0.0F); + } + + public void tick() + { + _ticks++; + + if (_ticks == 1) + { + if (_to.isOnline()) + { + UtilTextMiddle.display("", C.cYellow + _from.getName() + C.cPurple + " is sharing a Gift with you", _to); + _to.playSound(_to.getLocation(), Sound.CAT_MEOW, 1f, 1f);; + } + if (_from.isOnline()) + { + UtilTextMiddle.display("", C.cPurple + "You are sharing a Gift with " + C.cYellow + _to.getName(), _from); + _from.playSound(_from.getLocation(), Sound.CAT_MEOW, 1f, 1f); + } + } + else if (_ticks == 40) + { + if (_to.isOnline()) + { + UtilTextMiddle.display("", C.cRed + "3", _to); + _to.playSound(_to.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.3f); + } + if (_from.isOnline()) + { + UtilTextMiddle.display("", C.cRed + "3", _from); + _from.playSound(_from.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.3f); + } + } + else if (_ticks == 60) + { + if (_to.isOnline()) + { + UtilTextMiddle.display("", C.cGold + "2", _to); + _to.playSound(_to.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.2f); + } + if (_from.isOnline()) + { + UtilTextMiddle.display("", C.cGold + "2", _from); + _from.playSound(_from.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.2f); + } + } + else if (_ticks == 80) + { + if (_to.isOnline()) + { + UtilTextMiddle.display("", C.cGreen + "1", _to); + _to.playSound(_to.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.1f); + } + if (_from.isOnline()) + { + UtilTextMiddle.display("", C.cGreen + "1", _from); + _from.playSound(_from.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.1f); + } + } + else if (_ticks == 100) + { + if (_to.isOnline()) + { + UtilTextMiddle.display("", C.cPurple + "You received " + _toGift, _to); + _to.playSound(_to.getEyeLocation(), Sound.LEVEL_UP, 1F, 1F); + UtilPlayer.message(_to, F.main("Gift", "You received " + F.elem(_toGift) + "!")); + UtilPlayer.message(_to, F.main("Gift", F.name(_from.getName()) + " received " + F.elem(_fromGift) + "!")); + } + if (_from.isOnline()) + { + UtilTextMiddle.display("", C.cPurple + "You received " + _fromGift, _from); + _from.playSound(_from.getEyeLocation(), Sound.LEVEL_UP, 1F, 1F); + UtilPlayer.message(_from, F.main("Gift", "You received " + F.elem(_fromGift) + "!")); + UtilPlayer.message(_from, F.main("Gift", F.name(_to.getName()) + " received " + F.elem(_toGift) + "!")); + } + } + + double yAdd = CIRCLE_HEIGHT * ((double) _ticks) / ANIMATION_LENGTH; + double xAdd = CIRCLE_RADIUS * Math.sin(_ticks / 10.0 * Math.PI); + double zAdd = CIRCLE_RADIUS * Math.cos(_ticks / 10.0 * Math.PI); + + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.HEART, _centerLocation.clone().add(xAdd, yAdd, zAdd), 0.5f, 0.5f, 0.5f, 0, 5, UtilParticle.ViewDist.NORMAL); + + if (_ticks % 10 == 0) + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FIREWORKS_SPARK, _centerLocation.clone().add(0, 1, 0), 3f, 3f, 3f, 0, 10, UtilParticle.ViewDist.NORMAL); + + if (_ticks >= ANIMATION_LENGTH) + { + UtilFirework.playFirework(_centerLocation.clone().add(0, 3, 0), FireworkEffect.builder().with(FireworkEffect.Type.STAR).withColor(Color.RED).withFade(Color.WHITE).withFlicker().build()); + _finished = true; +// if (_to.isOnline()) _to.setWalkSpeed(0.2F); +// if (_from.isOnline()) _from.setWalkSpeed(0.2F); + } + } + + public boolean isFinished() + { + return _finished; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java new file mode 100644 index 000000000..a58a05c10 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java @@ -0,0 +1,143 @@ +package mineplex.core.valentines; + +import java.util.Iterator; +import java.util.LinkedList; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.*; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.reward.*; +import mineplex.core.stats.StatsManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.valentines.event.AttemptGiftEvent; +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class ValentinesGiftManager extends MiniPlugin +{ + private final String ITEM_NAME = "Valentines Gift"; + private final Material ITEM_MATERIAL = Material.RED_ROSE; + + private CoreClientManager _clientManager; + private RewardManager _rewardManager; + private InventoryManager _inventoryManager; + private GadgetManager _gadgetManager; + private StatsManager _statsManager; + + private ValentinesGiftRepository _repository; + private LinkedList _effects; + + public ValentinesGiftManager(JavaPlugin plugin, CoreClientManager clientManager, RewardManager rewardManager, InventoryManager inventoryManager, GadgetManager gadgetManager, StatsManager statsManager) + { + super("Valentines", plugin); + + _clientManager = clientManager; + _rewardManager = rewardManager; + _inventoryManager = inventoryManager; + _gadgetManager = gadgetManager; + _statsManager = statsManager; + + _repository = new ValentinesGiftRepository(plugin); + _effects = new LinkedList<>(); + } + + @EventHandler + public void onAttemptGift(AttemptGiftEvent event) + { + Player from = event.getFrom(); + Player to = event.getTo(); + + final int fromId = _clientManager.getAccountId(from); + final int toId = _clientManager.getAccountId(to); + + runAsync(() -> { +// final boolean complete = _repository.giveGift(fromId, toId); + final boolean complete = true; + runSync(() -> giveGift(from, to, complete)); + }); + } + + /** + * I apologize for this mess. Love, Shaun + */ + private void giveGift(Player from, Player to, boolean success) + { + if (success) + { + _inventoryManager.addItemToInventory(new Callback() + { + @Override + public void run(Boolean data) + { + if (data) + { + _rewardManager.nextReward(to, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, to, new Callback() + { + @Override + public void run(RewardData toData) + { + String toGift = ChatColor.stripColor(toData.getFriendlyName()); + + _rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, from, new Callback() + { + @Override + public void run(RewardData fromData) + { + + + String fromGift = ChatColor.stripColor(fromData.getFriendlyName()); + _effects.add(new GiftEffect(from, to, fromGift, toGift, UtilAlg.getMidpoint(to.getLocation(), from.getLocation()))); + } + }); + } + }); + + from.getInventory().setItem(_gadgetManager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(ITEM_MATERIAL, (byte) 0, 1, F.item(_inventoryManager.Get(from).getItemCount(ITEM_NAME) + " " + ITEM_NAME))); + } + else + { + UtilPlayer.message(from, F.main("Gift", "Error giving gift! Please try again")); + } + } + }, from, ITEM_NAME, -1); + } + else + { + UtilPlayer.message(from, F.main("Gift", "Spread the love! You have already gifted " + F.name(to.getName()))); + } + } + + @EventHandler + public void updateEffects(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _effects.iterator(); + + while (iterator.hasNext()) + { + GiftEffect effect = iterator.next(); + if (effect.isFinished()) + iterator.remove(); + else + effect.tick(); + } + } + + private void incrementStat(Player from, Player to) + { + _statsManager.incrementStat(from, "Global.Valentines2016.GiftsGiven", 1); + _statsManager.incrementStat(to, "Global.Valentines2016.GiftsReceived", 1); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java new file mode 100644 index 000000000..39a9d4034 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java @@ -0,0 +1,33 @@ +package mineplex.core.valentines; + +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.column.ColumnInt; +import org.bukkit.plugin.java.JavaPlugin; + +public class ValentinesGiftRepository extends RepositoryBase +{ + private String GIVE_GIFT = "INSERT INTO accountValentinesGift (senderId, targetId) VALUES (?, ?);"; + + public ValentinesGiftRepository(JavaPlugin plugin) + { + super(plugin, DBPool.getAccount()); + } + + @Override + protected void initialize() + { + + } + + @Override + protected void update() + { + + } + + public boolean giveGift(int senderId, int targetId) + { + return executeUpdate(GIVE_GIFT, new ColumnInt("senderId", senderId), new ColumnInt("targetId", targetId)) == 1; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/event/AttemptGiftEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/event/AttemptGiftEvent.java new file mode 100644 index 000000000..6b5d5f806 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/event/AttemptGiftEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.valentines.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class AttemptGiftEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + public static HandlerList getHandlerList() { return handlers; } + public HandlerList getHandlers() { return handlers; } + + private Player _from; + private Player _to; + + public AttemptGiftEvent(Player from, Player to) + { + _from = from; + _to = to; + } + + public Player getFrom() + { + return _from; + } + + public Player getTo() + { + return _to; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index de561f590..15513f191 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -22,7 +22,6 @@ import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.friend.FriendManager; import mineplex.core.give.Give; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; @@ -117,7 +116,6 @@ public class Hub extends JavaPlugin implements IRelation //Main Modules ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); - GiveawayManager giveawayManager = new GiveawayManager(this, clientManager, serverStatusManager); new TitanGiveawayManager(this, clientManager, serverStatusManager); Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); @@ -138,7 +136,7 @@ public class Hub extends JavaPlugin implements IRelation CustomDataManager customDataManager = new CustomDataManager(this, clientManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager, customDataManager); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); @@ -150,7 +148,7 @@ public class Hub extends JavaPlugin implements IRelation new CustomTagFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler); new ResourcePackManager(this, portal); - new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager); + new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager); //new Replay(this, packetHandler); AprilFoolsManager.Initialize(this, clientManager, disguiseManager); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 3828bda01..8dfa24518 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -8,6 +8,41 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Random; +import mineplex.core.reward.RewardManager; +import mineplex.core.valentines.ValentinesGiftManager; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerVelocityEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; + import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -18,7 +53,6 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.bonuses.BonusManager; import mineplex.core.botspam.BotSpamManager; import mineplex.core.common.Rank; -import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; @@ -74,7 +108,6 @@ import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.NewsCommand; import mineplex.hub.modules.ForcefieldManager; -import mineplex.hub.modules.HolidayGiftManager; import mineplex.hub.modules.HubVisibilityManager; import mineplex.hub.modules.JumpManager; import mineplex.hub.modules.KothManager; @@ -82,6 +115,7 @@ import mineplex.hub.modules.NewsManager; import mineplex.hub.modules.ParkourManager; import mineplex.hub.modules.SoccerManager; import mineplex.hub.modules.TextManager; +import mineplex.hub.modules.ValentinesManager; import mineplex.hub.modules.WorldManager; import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.tutorial.TutorialManager; @@ -90,51 +124,12 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.ConditionManager; -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 net.md_5.bungee.api.chat.HoverEvent.Action; import net.md_5.bungee.api.chat.TextComponent; -import org.jooq.tools.json.JSONObject; - -import net.minecraft.server.v1_8_R3.ChatMessage; import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.IChatBaseComponent; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Egg; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerVelocityEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; public class HubManager extends MiniClientPlugin { @@ -168,6 +163,7 @@ public class HubManager extends MiniClientPlugin private PlayerCountManager _playerCountManager; private CustomDataManager _customDataManager; private Punish _punishManager; + private ValentinesManager _valentinesManager; // private HalloweenSpookinessManager _halloweenManager; // private TrickOrTreatManager _trickOrTreatManager; @@ -190,7 +186,7 @@ public class HubManager extends MiniClientPlugin // private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; private final ArrayList _songs; - public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager, CustomDataManager customDataManager) + public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, CustomDataManager customDataManager) { super("Hub Manager", plugin); @@ -221,9 +217,9 @@ public class HubManager extends MiniClientPlugin _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); - _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager); + _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler); - _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, giveawayManager); + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); new SoccerManager(this, _gadgetManager); @@ -251,7 +247,7 @@ public class HubManager extends MiniClientPlugin ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager, facebookManager); + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager); // _halloweenManager = new HalloweenSpookinessManager(this); @@ -259,6 +255,12 @@ public class HubManager extends MiniClientPlugin new PlayerDisguiseManager(plugin, _clientManager); // NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager); // new MailManager(_plugin, notificationManager); + new ValentinesGiftManager(plugin, clientManager, new RewardManager(clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, statsManager, + 100, 250, + 500, 1000, + 4000, 6000, + 12000, 22000, + true, false), inventoryManager, _gadgetManager, statsManager); _playerCountManager = new PlayerCountManager(plugin); @@ -267,6 +269,8 @@ public class HubManager extends MiniClientPlugin _songs = new ArrayList(); _punishManager = punish; + + _valentinesManager = new ValentinesManager(plugin, clientManager, donationManager); try { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java new file mode 100644 index 000000000..dfd461ab7 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java @@ -0,0 +1,133 @@ +package mineplex.hub.modules; + +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.gadget.gadgets.item.ItemLovePotion; +import mineplex.core.server.util.TransactionResponse; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.modules.valentines.Courtship; + +public class ValentinesManager extends MiniPlugin +{ + /** + * Created by: Mysticate + * Timestamp: February 6, 2016 + */ + + private final boolean _enabled = true; + + private final String _prefix = C.cDPurple + "Polly"; + private final String _identifier = "Polly the Pink Sheep"; + private final String _reward = "Loving Sheeples"; // The sales package to reward + + private final float _dropRate = .1F; + + private CoreClientManager _client; + private DonationManager _donation; + + private Courtship _active = null; + private long _lastEnd = -1; + + public ValentinesManager(JavaPlugin plugin, CoreClientManager client, DonationManager donation) + { + super("Valentines Sheep Manager", plugin); + + _client = client; + _donation = donation; + } + + @EventHandler + public void onGadget(GadgetCollideEntityEvent event) + { + if (!_enabled) + return; + + if (!(event.getGadget() instanceof ItemLovePotion)) + return; + + if (!(event.getOther() instanceof Sheep)) + return; + + Player player = event.getPlayer(); + + if (!event.getOther().getCustomName().contains(_identifier)) + return; + + if (_lastEnd != -1 && !UtilTime.elapsed(_lastEnd, 1000)) + return; + + if (_active != null) + { + UtilPlayer.message(player, F.main("Cupid", "Someone is already courting " + F.elem(_prefix) + "!")); + return; + } + +// if (_donation.Get(player).OwnsUnknownPackage(_reward)) +// { +// UtilPlayer.message(player, F.main(_prefix, "I already love you!")); +// return; +// } + + event.setCancelled(false); // Uncancel + + final boolean success = UtilMath.random.nextFloat() > 1 - _dropRate; + _active = new Courtship(this, player, (Sheep) event.getOther(), _prefix, success); + } + + @EventHandler + public void onTick(UpdateEvent event) + { + if (_active == null) + return; + + if (event.getType() == UpdateType.TICK) + { + if (_active.tick()) + { + _active = null; + _lastEnd = System.currentTimeMillis(); + } + } + } + + public void giveReward(Player player) + { + _donation.PurchaseUnknownSalesPackage(new Callback() + { + @Override + public void run(TransactionResponse data) + { +// if (data == TransactionResponse.AlreadyOwns) +// { +// UtilPlayer.message(player, "owned but it worked"); +// } +// + if (data == TransactionResponse.AlreadyOwns || data == TransactionResponse.Failed) + { + UtilPlayer.message(player, F.main("Error", "An error occured while rewarding " + F.elem(_reward) + ".")); + return; + } + + if (data == TransactionResponse.Success) + { + UtilPlayer.message(player, F.main("Reward", "You recieved " + F.elem(_reward + " Mount") + " from " + F.elem(_prefix) + "!")); + } + } + }, player.getName(), _client.getAccountId(player), _reward, CurrencyType.Coins, 0, true); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/valentines/Courtship.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/valentines/Courtship.java new file mode 100644 index 000000000..948a334aa --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/valentines/Courtship.java @@ -0,0 +1,192 @@ +package mineplex.hub.modules.valentines; + +import org.bukkit.DyeColor; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSheep; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.hub.modules.ValentinesManager; + +public class Courtship +{ + private static final String[] FAIL_MESSAGES = { + "Sorry, but you don't seem like the type of person I prefer to associate with.", + "Mmmmmm, that's delicious! But I still don't like you very much.", + "For a moment there, I thought you were my friend... But you're not! Leave me alone!", + "Just because I'm drinking your drink, doesn't mean we're friends!", + "Hmmm... I don't know. I think I have enough friends right now, thanks.", + "Ugh why are you always trying to talk to me?", + "Just because I eat grass sometimes, doesn't mean I'm desperate enough to be your friend." + }; + + /** + * Created by: Mysticate + * Timestamp: February 6, 2016 + */ + + private ValentinesManager _manager; + private Player _player; + private Sheep _sheep; + private String _prefix; + private final boolean _success; + + private int _tick = 0; + + public Courtship(ValentinesManager manager, Player player, Sheep sheep, String prefix, boolean success) + { + _manager = manager; + _player = player; + _sheep = sheep; + _prefix = prefix; + _success = success; + } + + public boolean tick() + { + if (!_player.isOnline()) + return true; + + _tick++; + + { + Vector vec = UtilAlg.getTrajectory(_sheep, _player); + UtilEnt.CreatureForceLook(_sheep, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec)); + } + + for (Player player : UtilPlayer.getNearby(_sheep.getLocation(), 4)) + { + if (player != _player) + { + if (Recharge.Instance.use(player, "Sheep Bump", 500, false, false)) + { + Entity bottom = player; + while (bottom.getVehicle() != null) + bottom = bottom.getVehicle(); + + UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(_sheep, bottom), .5, true, 0.8, 0, 10, true); + player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f); + + UtilPlayer.message(player, F.main(_prefix, "I'm talking to someone else right now!")); + } + } + } + + if (_tick == 20) + { + message("What do we have here?"); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.NOTE_BASS, 1F, 1F); + } + + if (_tick == 40) + { + if (_success) + { + message("I feel weird..."); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.NOTE_BASS, 2F, 1F); + } + else + { + message("Was that a love potion?"); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.NOTE_BASS, .5F, 1F); + } + } + + if (_tick > 40 && _tick < 80) + { + if (_tick % 2 == 0) + { + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.DIG_GRASS, 1F, 1F); + + UtilParticle.PlayParticle(ParticleType.HEART, _sheep.getLocation().clone().add(0, 1, 0), new Vector(), 0F, 1, ViewDist.NORMAL, _player); + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _sheep.getLocation(), 1F, 1F, 1F, 0F, 1, ViewDist.NORMAL, _player); + + _sheep.setColor(DyeColor.PINK); + } + else + { + _sheep.setColor(DyeColor.WHITE); + } + } + + if (_tick == 80) + { + if (_success) + { + message("I..."); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.FIZZ, 1F, 1F); + } + else + { + message(UtilMath.randomElement(FAIL_MESSAGES)); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.ANVIL_BREAK, 1F, 1F); + _sheep.setColor(DyeColor.BLACK); + } + } + + if (_tick > 80 && _tick < 120 && _success) + { + if (_tick % 2 == 0) + { + _sheep.setColor(DyeColor.PINK); + } + else + { + _sheep.setColor(DyeColor.RED); + } + } + + if (_tick == 90 && _success) + { + message("I think..."); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.FIZZ, 1F, 1F); + } + + if (_tick == 100 && _success) + { + message("I think I'm in love!"); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.LEVEL_UP, 1F, 1F); + } + + if (_tick == 120 && _success) + { + message("Here, take this present as a token of my admiration."); + _sheep.getWorld().playSound(_sheep.getLocation(), Sound.LEVEL_UP, 1F, 1F); + + _manager.giveReward(_player); + + _sheep.setColor(DyeColor.RED); + + UtilServer.broadcast(C.cYellowB + _player.getName() + C.cWhiteB + " tricked " + C.cGoldB + "Polly the Pink Sheep" + C.cWhiteB + " with a love potion!"); + } + + if (_tick == 130) + { + _sheep.setColor(DyeColor.PINK); + ((CraftSheep) _sheep).getHandle().setFakeHead(false); + return true; + } + + return false; + } + + private void message(String message) + { + UtilPlayer.message(_player, " "); + UtilPlayer.message(_player, F.main(_prefix, C.cPurple + message)); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 0782488fc..591671352 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -913,4 +913,9 @@ public class ServerManager extends MiniPlugin { return _serverNpcShopMap.get("Type Wars"); } + + public ShopBase getValentinesShop() + { + return _serverNpcShopMap.get("Valentines"); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 0df7aac78..42f56f53e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -40,17 +40,16 @@ public class ServerGameMenu extends ShopPageBase @Override protected void buildPage() { - addButton(2, new ItemBuilder(Material.NAME_TAG).setTitle(C.cYellowB + "Type Wars " + C.cGray + "Team Deathmatch").addLore(new String[] + addButton(2, new ItemBuilder(Material.RED_ROSE).setTitle(C.cYellowB + "Valentines Vendetta " + C.cGray + "Save Valentines!").addLore(new String[] { - (_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME", + (_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME GAME", C.Reset + "", - C.Reset + "Attack your enemies with", - C.Reset + "waves of mobs. Defend your giant", - C.Reset + "by typing the name of an enemy mob", - C.Reset + "to kill it.", + C.Reset + "Calvin the Cow has a Valentines Date,", + C.Reset + "but he was robbed by the nasty pigs!", + C.Reset + "Recover his items, and save the day!", C.Reset + "", - C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TW") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectTWButton(this)); + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("VV") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectVVButton(this)); addButton(4, new ItemBuilder(Material.QUARTZ_BLOCK).setTitle(C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building").addLore(new String[] { @@ -76,6 +75,7 @@ public class ServerGameMenu extends ShopPageBase }).setHideInfo(true).build(), new SelectFEATButton(this, "Gladiators")); */ + /* addButton(6, new ItemBuilder(Material.LAVA_BUCKET).setTitle(C.cYellowB + "Micro Battle" + C.cGray + " 4 Team Deathmatch").addLore(new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME", @@ -86,6 +86,17 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "", C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MB") + C.Reset + " other players!" }).setHideInfo(true).build(), new SelectFEATButton(this, "Micro Battle")); + */ + + addButton(6, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "Bomb Lobbers " + C.cGray + "TNT Mayhem").addLore(new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME", + C.Reset + "", + C.Reset + "Fight against your enemies using", + C.Reset + "the power of explosives!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BL") + C.Reset + " other players!" + }).setHideInfo(true).build(), new SelectFEATButton(this, "Bomb Lobbers")); addButton(9, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[] { @@ -681,4 +692,9 @@ public class ServerGameMenu extends ShopPageBase { getPlugin().getTypeWarsShop().attemptShopOpen(player); } + + public void openValentines(Player player) + { + getPlugin().getValentinesShop().attemptShopOpen(player); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectVVButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectVVButton.java new file mode 100644 index 000000000..f6a15ba35 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectVVButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectVVButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectVVButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openValentines(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index 2ebdd5be8..de559f25b 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -99,6 +99,10 @@ public class DamageManager extends MiniPlugin LivingEntity damager = UtilEvent.GetDamagerEntity(event, true); Projectile projectile = GetProjectile(event); + /* + * Fishing rods are disabled because of their custom properties + * we want them to behave like default MC. + */ if (projectile instanceof Fish) return; @@ -348,9 +352,8 @@ public class DamageManager extends MiniPlugin } } - // TODO: What is this required for? Players with books in regular games are spammed. Is it meant for debugging? - // TODO: Temporarily commenting out - //DisplayDamage(event); + //Debug + DisplayDamage(event); } private void Damage(CustomDamageEvent event) @@ -669,7 +672,7 @@ public class DamageManager extends MiniPlugin event.setDamage(damage); } - private LivingEntity GetDamageeEntity(EntityDamageEvent event) + public LivingEntity GetDamageeEntity(EntityDamageEvent event) { if (event.getEntity() instanceof LivingEntity) return (LivingEntity)event.getEntity(); @@ -677,7 +680,7 @@ public class DamageManager extends MiniPlugin return null; } - private Projectile GetProjectile(EntityDamageEvent event) + public Projectile GetProjectile(EntityDamageEvent event) { if (!(event instanceof EntityDamageByEntityEvent)) return null; diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 1f12a4982..58e91b517 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -106,6 +106,7 @@ public class CustomerSupport extends MiniPlugin int ancientChestsReceived = 0; int mythicalChestsReceived = 0; int winterChestsReceived = 0; + int valentinesGiftsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -160,7 +161,18 @@ public class CustomerSupport extends MiniPlugin else if (transaction.SalesPackageName.split(" ").length == 2) winterChestsReceived += 1; } - + + } + if (transaction.SalesPackageName.startsWith("Valentines Gift")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + valentinesGiftsReceived += 1; + } + } } @@ -169,6 +181,7 @@ public class CustomerSupport extends MiniPlugin caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived); + caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _salesPackageManager.displaySalesPackages(caller, playerName); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index e3ef2eba3..debd2f265 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -21,12 +21,14 @@ import mineplex.staffServer.salespackage.salespackages.FrostLord; import mineplex.staffServer.salespackage.salespackages.GemHunter; import mineplex.staffServer.salespackage.salespackages.LifetimeHero; import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; +import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; import mineplex.staffServer.salespackage.salespackages.LifetimeUltra; import mineplex.staffServer.salespackage.salespackages.MonthlyHero; import mineplex.staffServer.salespackage.salespackages.MonthlyUltra; import mineplex.staffServer.salespackage.salespackages.MythicalChest; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; import mineplex.staffServer.salespackage.salespackages.OldChest; +import mineplex.staffServer.salespackage.salespackages.ValentinesGift; public class SalesPackageManager extends MiniPlugin { @@ -55,12 +57,14 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new LifetimeUltra(this)); AddSalesPackage(new LifetimeHero(this)); AddSalesPackage(new LifetimeLegend(this)); + AddSalesPackage(new LifetimeTitan(this)); AddSalesPackage(new GemHunter(this, 4)); AddSalesPackage(new GemHunter(this, 8)); AddSalesPackage(new ApplyKits(this)); AddSalesPackage(new OldChest(this)); AddSalesPackage(new AncientChest(this)); AddSalesPackage(new MythicalChest(this)); + AddSalesPackage(new ValentinesGift(this)); AddSalesPackage(new FrostLord(this)); AddSalesPackage(new EasterBunny(this)); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeTitan.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeTitan.java new file mode 100644 index 000000000..b28e653f9 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeTitan.java @@ -0,0 +1,23 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +import org.bukkit.entity.Player; + +public class LifetimeTitan extends SalesPackageBase +{ + public LifetimeTitan(SalesPackageManager manager) + { + super(manager, "Lifetime Titan"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales rank " + playerName + " TITAN true", " Lifetime Titan."); + addButton(agent, "/sales item " + playerName + " 1 Molten Snake", "Gives Molten Snake Mount."); + addButton(agent, "/sales item " + playerName + " 1 Elder Guardian Morph", "Gives Elder Guardian Morph."); + addButton(agent, "/sales item " + playerName + " 1 Flame of the Titans", "Gives Titan Particle."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ValentinesGift.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ValentinesGift.java new file mode 100644 index 000000000..2e593d682 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ValentinesGift.java @@ -0,0 +1,20 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +import org.bukkit.entity.Player; + +public class ValentinesGift extends SalesPackageBase +{ + public ValentinesGift(SalesPackageManager manager) + { + super(manager, "1 Valentines Gift"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Valentines Gift", "Give 1 Valentines Gift."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 2adad7e3b..6252145da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -27,7 +27,6 @@ import mineplex.core.donation.DonationManager; import mineplex.core.friend.FriendManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.give.Give; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; @@ -145,19 +144,18 @@ public class Arcade extends JavaPlugin InventoryManager inventoryManager = new InventoryManager(this, _clientManager); PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); - GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager); + GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null); cosmeticManager.setInterfaceSlot(7); cosmeticManager.disableTeamArmor(); - GiveawayManager giveawayManager = new GiveawayManager(this, _clientManager, serverStatusManager); CustomDataManager customDataManager = new CustomDataManager(this, _clientManager); - new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, giveawayManager); + new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager); //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, giveawayManager, customDataManager, punish); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish); //new BroadcastManager(this, _gameManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 9ca2b3726..4fd7728dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -33,7 +33,6 @@ import mineplex.core.explosion.ExplosionEvent; import mineplex.core.facebook.FacebookManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; @@ -49,6 +48,7 @@ import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.rewards.PetReward; import mineplex.core.stats.StatsManager; @@ -57,6 +57,7 @@ import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; import mineplex.core.titangiveaway.TitanGiveawayManager; +import mineplex.core.valentines.ValentinesGiftManager; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -185,7 +186,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation private StatsManager _statsManager; private PartyManager _partyManager; private PreferencesManager _preferencesManager; - private GiveawayManager _giveawayManager; private ResourcePackManager _resourcePackManager; private CustomDataManager _customDataManager; private Punish _punishmentManager; @@ -214,7 +214,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation StatsManager statsManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, - NpcManager npcManager, GiveawayManager giveawayManager, CustomDataManager customDataManager, Punish punish) + NpcManager npcManager, CustomDataManager customDataManager, Punish punish) { super("Game Manager", plugin); @@ -272,7 +272,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation _portal = portal; _petManager = petManager; _eventManager = new EventModule(this, getPlugin()); - _giveawayManager = giveawayManager; _resourcePackManager = new ResourcePackManager(plugin, portal); _customDataManager = customDataManager; @@ -301,6 +300,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); // new HolidayManager(this, titanGiveaway); + new ValentinesGiftManager(plugin, clientManager, new RewardManager(clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, statsManager, + 100, 250, + 500, 1000, + 4000, 6000, + 12000, 22000, + true, false), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); new PlayerDisguiseManager(plugin, _clientManager); @@ -310,7 +315,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new TeamArmorAddon(plugin, this); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager, facebookManager); + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager); //Champions Modules _energy = new Energy(plugin); @@ -457,11 +462,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _explosionManager; } - public GiveawayManager getGiveawayManager() - { - return _giveawayManager; - } - public Fire GetFire() { return _fire; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index bf25e4199..97e9047b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -64,6 +64,7 @@ import nautilus.game.arcade.game.games.tug.Tug; import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.typewars.TypeWars; import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.game.games.valentines.Valentines; import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; @@ -139,6 +140,8 @@ public enum GameType BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), + Valentines(Valentines.class, GameDisplay.Valentines), + Event(EventGame.class, GameDisplay.Event, new GameType[]{ GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build, GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java index 3d5ca5cf0..6e029034f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java @@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.Kit; public abstract class SoloGame extends Game { - private GameTeam _players; + protected GameTeam _players; public SoloGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index fa198fe45..d19dc43e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -6,6 +6,46 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.UUID; + +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; +import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Item; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.util.Vector; + import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -18,6 +58,7 @@ import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; @@ -51,41 +92,6 @@ import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.FoodForTheMassesStatTracker; import nautilus.game.arcade.stats.KillFastStatTracker; import nautilus.game.arcade.stats.TntMinerStatTracker; -import org.bukkit.ChatColor; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.Chest; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Cow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Item; -import org.bukkit.entity.Pig; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockFormEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.CraftingInventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.util.Vector; public class Bridge extends TeamGame implements OreObsfucation { @@ -1332,6 +1338,12 @@ public class Bridge extends TeamGame implements OreObsfucation event.setCancelled(true); event.getBlock().setType(Material.AIR); + if (event.getBlock().getType() == Material.FURNACE || UtilItem.isOre(event.getBlock().getType())) // Can't be broken by fist + { + if (event.getPlayer().getItemInHand() == null || !CraftItemStack.asNMSCopy(event.getPlayer().getItemInHand()).b(CraftMagicNumbers.getBlock((CraftBlock) event.getBlock()))) + return; + } + Location loc = event.getBlock().getLocation().clone().add(.5, .5, .5); for (ItemStack item : drops) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 34a82c937..ea2b2960e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -5,6 +5,52 @@ import java.util.HashSet; import java.util.List; import java.util.Map.Entry; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.ItemMergeEvent; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.event.world.StructureGrowEvent; +import org.bukkit.material.Bed; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -45,52 +91,8 @@ import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuild import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.BlockPlaceStatTracker; - import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockFormEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ItemMergeEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerBucketFillEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.world.StructureGrowEvent; -import org.bukkit.material.Bed; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; - public class SpeedBuilders extends SoloGame { private static final String GUARDIAN_NAME = "Gwen the Guardian"; @@ -147,7 +149,7 @@ public class SpeedBuilders extends SoloGame private RecreationData _lastRecreationTarget; private double _standMoveProgress; private Location _standStart; - + private BuildData _nextBuild; public SpeedBuilders(ArcadeManager manager) @@ -431,10 +433,10 @@ public class SpeedBuilders extends SoloGame EndCheck(); } - @EventHandler(priority = EventPriority.MONITOR) - public void teamGen(GameStateChangeEvent event) + @EventHandler(priority = EventPriority.LOWEST) + public void onPrepare(GameStateChangeEvent event) { - if (event.GetState() != GameState.Live) + if (event.GetState() != GameState.Prepare) return; //Add 1 spawn so it doesn't freak out @@ -444,13 +446,6 @@ public class SpeedBuilders extends SoloGame GameTeam guardians = new GameTeam(this, "Guardians", ChatColor.GRAY, spawns); AddTeam(guardians); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onPrepare(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - return; spawnJudge(); //GUARDIAN LAZORZ WILL ROXORZ YOUR BOXORZ @@ -461,11 +456,13 @@ public class SpeedBuilders extends SoloGame { if (i >= WorldData.GetDataLocs("YELLOW").size()) { - Manager.addSpectator(players.get(i), true); GetTeamList().get(0).RemovePlayer(players.get(i)); + Manager.addSpectator(players.get(i), true); } } } + + @EventHandler public void onLive(GameStateChangeEvent event) @@ -473,7 +470,7 @@ public class SpeedBuilders extends SoloGame if (!IsLive()) return; - if (WorldData.GetDataLocs("YELLOW").size() < GetPlayers(true).size()) + if (WorldData.GetDataLocs("YELLOW").size() < GetTeamList().get(0).GetPlayers(true).size()) { Announce(C.Bold + "Too many players..."); SetState(GameState.End); @@ -491,7 +488,7 @@ public class SpeedBuilders extends SoloGame HashSet usedBuildLocs = new HashSet(); - for (Player player : GetPlayers(true)) + for (Player player : GetTeamList().get(0).GetPlayers(true)) { Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")); Location spawnLoc = UtilAlg.findClosest(buildLoc, GetTeamList().get(0).GetSpawns()); @@ -648,7 +645,7 @@ public class SpeedBuilders extends SoloGame _perfectBuild.put(player, System.currentTimeMillis()); - if (_perfectBuild.size() == GetTeamList().get(0).GetPlayers(false).size()) + if (_perfectBuild.size() == _buildRecreations.size()) { // Everyone has a perfect build _allPerfect = true; @@ -734,12 +731,20 @@ public class SpeedBuilders extends SoloGame { for (RecreationData recreation : _buildRecreations.values()) { - Vector vec = player.getLocation().getDirection().multiply(-1); + Vector vec = UtilAlg.getTrajectory(recreation.getMidpoint(), player.getLocation()); if (UtilMath.offsetSquared(player.getLocation(), recreation.getMidpoint()) < 64) { + Location tpLoc = recreation.getMidpoint().add(vec.clone().multiply(8)); + tpLoc.setDirection(player.getLocation().getDirection()); + + //First tp out this combats hacked clients with anti-KB + player.teleport(tpLoc); + + //Then apply velocity as normal + UtilAction.velocity(player, vec, 1.8, false, 0, 0.4, vec.length(), false); + player.playSound(player.getEyeLocation(), Sound.NOTE_PLING, 10F, 0.5F); - UtilAction.velocity(player, vec, 1.6, false, 0, 0.4, vec.length(), false); } } } @@ -1219,9 +1224,34 @@ public class SpeedBuilders extends SoloGame if (!_buildRecreations.get(player).inBuildArea(event.getEntity().getLocation())) return; + boolean hasMobType = false; + + for (MobData mobData : _currentBuild.Mobs) + { + if (mobData.EntityType == event.getEntityType()) + { + hasMobType = true; + + break; + } + } + + if (!hasMobType) + return; + _buildRecreations.get(player).addToDemolition(event.getEntity()); } + @EventHandler + public void stopBabyEgg(PlayerInteractEntityEvent event) + { + if (!IsLive()) + return; + + if (event.getPlayer().getItemInHand().getType() == Material.MONSTER_EGG) + event.setCancelled(true); + } + @EventHandler public void updateDemolitionBlocks(UpdateEvent event) { @@ -1393,6 +1423,9 @@ public class SpeedBuilders extends SoloGame if (!IsLive()) return; + // Falling blocks disappear for some reason so we update to make it reappear + event.getBlock().getState().update(true, false); + event.setCancelled(true); } @@ -1453,6 +1486,18 @@ public class SpeedBuilders extends SoloGame @EventHandler public void stopPhysics(BlockPhysicsEvent event) + { + if (!IsLive()) + return; + + if (event.getBlock().isLiquid()) + return; + + event.setCancelled(true); + } + + @EventHandler + public void stopInventoryPickup(InventoryPickupItemEvent event) { if (!IsLive()) return; @@ -1567,34 +1612,6 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - //Add to guardians before arcade manager adds to spectator to trick it into thinking the player is "alive" - @EventHandler(priority = EventPriority.LOW) - public void joinAddGuardian(PlayerJoinEvent event) - { - if (!InProgress()) - return; - - moveToGuardians(event.getPlayer(), false); - event.getPlayer().teleport(GetSpectatorLocation()); - - //We need to disguise a tick after - Manager.runSyncLater(new Runnable() - { - @Override - public void run() - { - DisguiseGuardian disguise = new DisguiseGuardian(event.getPlayer()); - disguise.setName(C.cGray + event.getPlayer().getName()); - disguise.setCustomNameVisible(true); - - Manager.GetDisguise().disguise(disguise); - - event.getPlayer().setAllowFlight(true); - event.getPlayer().setFlying(true); - } - }, 1); - } - @EventHandler public void setNextBuild(PlayerCommandPreprocessEvent event) { @@ -1637,6 +1654,37 @@ public class SpeedBuilders extends SoloGame } } + @EventHandler + public void moveSetFlight(PlayerMoveEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuildersState.BUILDING) + return; + + if (!GetTeamList().get(0).HasPlayer(event.getPlayer())) + return; + + if (UtilEnt.isGrounded(event.getPlayer()) && !event.getPlayer().isFlying()) + event.getPlayer().setAllowFlight(true); + } + + @EventHandler + public void flightToggleJump(PlayerToggleFlightEvent event) + { + if (!GetTeamList().get(0).HasPlayer(event.getPlayer())) + return; + + event.setCancelled(true); + + event.getPlayer().setAllowFlight(false); + + event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.GHAST_FIREBALL, 1f, 1f); + + UtilAction.velocity(event.getPlayer(), new Vector(0, 1, 0)); + } + @Override public void EndCheck() { @@ -1662,7 +1710,17 @@ public class SpeedBuilders extends SoloGame if (places.size() >= 3) AddGems(places.get(2), 10, "3rd Place", false, false); - for (Player player : GetPlayers(false)) + ArrayList participants = new ArrayList(); + + ArrayList guardians = GetTeamList().get(1).GetPlayers(false); + + participants.addAll(playersTeam.GetPlayers(true)); + + guardians.retainAll(playersTeam.GetPlacements(true)); + + participants.addAll(guardians); + + for (Player player : participants) if (player.isOnline()) AddGems(player, 10, "Participation", false, false); @@ -1734,7 +1792,7 @@ public class SpeedBuilders extends SoloGame for (Player player : playersDead) { - Scoreboard.Write(C.cGray + player.getName()); + Scoreboard.Write(C.cDGray + player.getName()); } Scoreboard.Draw(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java index f53f653c0..0f8804aac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java @@ -2,14 +2,6 @@ package nautilus.game.arcade.game.games.speedbuilders.data; import java.util.ArrayList; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilTime; -import mineplex.core.hologram.Hologram; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -17,11 +9,19 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; import org.bukkit.material.Door; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; + public class DemolitionData { @@ -170,9 +170,7 @@ public class DemolitionData for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) { - Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack); - - Parent.DroppedItems.put(item, System.currentTimeMillis()); + UtilInv.insert(Parent.Player, itemStack); } //Destroy the other part @@ -210,9 +208,7 @@ public class DemolitionData { ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId()); - Item item = entity.getWorld().dropItem(entity.getLocation().add(0, 1, 0), spawnEgg); - - Parent.DroppedItems.put(item, System.currentTimeMillis()); + UtilInv.insert(Parent.Player, spawnEgg); entity.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 11aaac85a..268434338 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -297,10 +297,10 @@ public class RecreationData } //Ender portal direction fix & 0x4 is a check to see if the frame has an ender eye in it - if (currentBlock.getType() == Material.ENDER_PORTAL_FRAME && expectedState.getType() == Material.ENDER_PORTAL_FRAME && (currentBlock.getData() & 0x4) == (expectedState.getRawData() & 0x4)) + if (currentBlock.getType() == Material.ENDER_PORTAL_FRAME && expectedState.getType() == Material.ENDER_PORTAL_FRAME) { - score++; - continue; + if ((currentBlock.getData() & 0x4) == (expectedState.getRawData() & 0x4)) + score++; } //Sapling growth fix @@ -317,6 +317,13 @@ public class RecreationData score++; } + //Fix for anvil facing direction + if (expectedState.getType() == Material.ANVIL && currentBlock.getType() == Material.ANVIL) + { + if (currentBlock.getData() / 4 == expectedState.getRawData() / 4 && currentBlock.getData() % 2 == expectedState.getRawData() % 2) + score++; + } + //Fix for corner stair shape if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/ValItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/ValItem.java new file mode 100644 index 000000000..6dc6e4bd0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/ValItem.java @@ -0,0 +1,76 @@ +package nautilus.game.arcade.game.games.valentines; + +import org.bukkit.Material; + +public enum ValItem +{ + FLOWER1("Red Rose", + "She will love this bouquet of roses!", + Material.RED_ROSE, 0), + + FLOWER2("Dandelion", + "I hope she's not allergic to these!", + Material.YELLOW_FLOWER, 0), + + FLOWER3("Blue Orchid", + "Thank you! These are her favourites!", + Material.RED_ROSE, 1), + + WINE("Blue Wine", + "This will go great with our steak dinner!", + Material.POTION, 0), + + GRASS("Organic Free Range Grass", + "Yum! This is much tastier than caged grass!", + Material.LONG_GRASS, 1), + + DIAMONDS("Diamond Earings", + "I saved up for months for this gift!", + Material.DIAMOND, 0), + + EMERALDS("Cold Hard Cash", + "They say love don't cost a thing. That's a lie!", + Material.EMERALD, 0), + + BOOK("Love Poems", + "I will use impress her with poetry!", + Material.BOOK, 0), + + WATCH("Fancy Pocket Watch", + "This Moolex Watch sure looks good on me!", + Material.WATCH, 0); + + + private String _title; + private String _endText; + private Material _item; + private byte _itemByte; + + ValItem(String title, String endText, Material item, int data) + { + _title = title; + _item = item; + _endText = endText; + _itemByte = (byte)data; + } + + public String getTitle() + { + return _title; + } + + public Material getMaterial() + { + return _item; + } + + public String getEndText() + { + return _endText; + } + + public byte getData() + { + return _itemByte; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java new file mode 100644 index 000000000..eb24917bf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java @@ -0,0 +1,843 @@ +package nautilus.game.arcade.game.games.valentines; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.stream.Collectors; + +import org.bukkit.EntityEffect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Fish; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.noteblock.INoteVerifier; +import mineplex.core.noteblock.NBSReader; +import mineplex.core.noteblock.NotePlayer; +import mineplex.core.noteblock.NoteSong; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.christmas.ChristmasAudio; +import nautilus.game.arcade.game.games.gladiators.tutorial.TutorialGladiators; +import nautilus.game.arcade.game.games.valentines.kit.KitMasterOfLove; +import nautilus.game.arcade.game.games.valentines.tutorial.TutorialValentines; +import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; +import nautilus.game.arcade.kit.Kit; + +public class Valentines extends SoloGame +{ + private String _cowName = "Calvin the Cow"; + + private Cow _cow; + + private NotePlayer _music; + private NoteSong[] _songs; + private NoteSong _finalSong; + + private int _playersOutPerRound = 1; + + + + private HashSet _blocks = new HashSet(); + private int _blockMapHeight = 0; + + private int _round = 0; + private long _roundTime = 0; + private long _roundTimeLimit = 60000; + + private int _roundState = 0; + //1 = Playing + //2 = Between Rounds + + private boolean _finalRound = false; + + private ValItem _item = null; + + private ArrayList _pigSpawns = null; + private HashMap _pigs = new HashMap(); + private HashSet _pigsDead = new HashSet(); + + private ArrayList _hasItem = new ArrayList(); + private ArrayList _completedRound = new ArrayList(); + + private HashSet _unusedGifts = new HashSet(); + + public Valentines(ArcadeManager manager) + { + super(manager, GameType.Valentines, + + new Kit[] + { + new KitMasterOfLove(manager), + }, + + new String[] + { + "Calvin the Cow has a Valentines Date,", + "but he was robbed by the nasty pigs!", + "Recover his items, and save the day!", + "", + "Slowest players are eliminated!" + }); + + this.DamageTeamSelf = true; + this.HungerSet = 20; + this.HealthSet = 20; + + EnableTutorials = true; + + + try + { + _songs = new NoteSong[2]; + _songs[0] = NBSReader.loadSong("../../update/songs/tetris.nbs"); + _songs[1] = NBSReader.loadSong("../../update/songs/gangnam.nbs"); + _finalSong = NBSReader.loadSong("../../update/songs/popcorn.nbs"); + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + } + } + + @Override + public void ParseData() + { + _pigSpawns = WorldData.GetDataLocs("YELLOW"); + + //Scan Map + for (Block block : UtilBlock.getInBoundingBox(WorldData.GetDataLocs("GRAY").get(0), WorldData.GetDataLocs("GRAY").get(1))) + { + if (block.getType() != Material.AIR) + _blocks.add(block); + + if (UtilBlock.solid(block)) + { + if (block.getY() > _blockMapHeight) + _blockMapHeight = block.getY(); + } + } + + System.out.println("Scanned " + _blocks.size() + " Arena Blocks"); + } + + @EventHandler + public void stateChanges(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Prepare) + { + _playersOutPerRound = Math.max(1, (int)(GetPlayers(true).size()/8d)); + + CreatureAllowOverride = true; + _cow = GetSpectatorLocation().getWorld().spawn(GetSpectatorLocation(), Cow.class); + _cow.setCustomName(C.cGreen + C.Bold + _cowName); + _cow.setCustomNameVisible(true); + + UtilEnt.Vegetate(_cow); + UtilEnt.ghost(_cow, true, false); + CreatureAllowOverride = false; + } + if (event.GetState() == GameState.End || event.GetState() == GameState.Dead) + _music.cancel(); + } + + @Override + public void addTutorials() + { + GetTeamList().get(0).setTutorial(new TutorialValentines(this, Manager)); + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetDamageePlayer() != null) + { + if (event.GetCause() == DamageCause.ENTITY_ATTACK) + event.AddKnockback("Hit Reversal", -1); + } + } + + @EventHandler + public void knockbackRod(EntityDamageEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + Player player = ((Player) event.getEntity()); + Projectile projectile = Manager.GetDamage().GetProjectile(event); + + if (!(projectile instanceof Fish)) + return; + +// LivingEntity damagee = Manager.GetDamage().GetDamageeEntity(event); +// LivingEntity damager = UtilEvent.GetDamagerEntity(event, true); + + if (player.getVehicle() != null) + { + UtilTextMiddle.display("", C.cRed + "You were knocked off the pig!", player); + player.getVehicle().eject(); + } + + event.setCancelled(true); + +// damagee.playEffect(EntityEffect.HURT); +// +// UtilAction.velocity(damagee, UtilAlg.getTrajectory(damagee, damager), 0.2, false, 0, 0.1, 1, true); + + projectile.remove(); + } + + @EventHandler + public void grabDamage(CustomDamageEvent event) + { + if (_finalRound) + return; + + if (event.GetDamagerPlayer(false) == null) + return; + + if (_finalRound) + { + event.GetDamageeEntity().eject(); + event.GetDamageeEntity().leaveVehicle(); + } + + if (event.GetDamageeEntity() instanceof Pig) + { + grabItem(event.GetDamagerPlayer(false), (Pig)event.GetDamageeEntity()); + } + + if (!event.IsCancelled()) + { + event.SetCancelled("Pig Cancel"); + + event.GetDamageeEntity().playEffect(EntityEffect.HURT); + } + } + + private void grabItem(Player player, Pig pig) + { + if (!IsAlive(player)) + return; + + if (_hasItem.contains(player) || _completedRound.contains(player)) + return; + + if (!_pigs.containsKey(pig)) + return; + + _pigs.remove(pig); + + pig.damage(9999); +// pig.playEffect(EntityEffect.DEATH); +// _pigsDead.add(pig); + + //Remove Item from Pig + if (pig.getPassenger() != null) + pig.getPassenger().remove(); + + //Give Item to Player + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(_item.getMaterial(), _item.getData())); + + _hasItem.add(player); + + //Effects + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); + player.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 1f); + + //Inform + UtilTextMiddle.display(C.cGreen + C.Bold + "Success", "Take " + _item.getTitle() + " back to Calvin!", 0, 80, 20, player); + + if (_pigs.size() > 0) + UtilTextBottom.display(C.Bold + _pigs.size() + " Items Left", UtilServer.getPlayers()); + } + + @EventHandler + public void returnDamage(CustomDamageEvent event) + { + if (event.GetDamagerPlayer(false) == null) + return; + + if (event.GetDamageeEntity() instanceof Cow) + { + returnItem(event.GetDamagerPlayer(false), (Cow)event.GetDamageeEntity()); + + event.SetCancelled("Cow Damage"); + } + } + + @EventHandler + public void returnInteract(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof Cow) + { + returnItem(event.getPlayer(), (Cow)event.getRightClicked()); + } + } + + private void returnItem(Player player, Cow cow) + { + if (!IsAlive(player)) + return; + + if (!_hasItem.remove(player) && player.getVehicle() == null) + return; + + + //Remove Item to Player + if (!_finalRound) + { + player.getInventory().remove(_item.getMaterial()); + } + else + { + _pigs.clear(); + } + + _completedRound.add(player); + + //Effects + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + player.getWorld().playSound(cow.getLocation(), Sound.COW_IDLE, 2f, 1f); + + UtilParticle.PlayParticle(ParticleType.HEART, _cow.getLocation().add(0, 0.5, 0), 1f, 1f, 1f, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers()); + + //Inform + UtilTextMiddle.display(C.cGreen + C.Bold + _cowName, _item.getEndText(), 0, 80, 20, player); + + if (_pigs.size() > 0) + UtilTextBottom.display(C.Bold + _pigs.size() + " Items Left", UtilServer.getPlayers()); + + } + + public double getRadius() + { + return 24 + (GetPlayers(true).size() * 0.5d); + } + + //@EventHandler + public void arenaShrinkUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + double radius = getRadius(); + + Block bestBlock = null; + double bestDist = 0; + + for (Block block : _blocks) + { + double dist = UtilMath.offset2d(GetSpectatorLocation(), block.getLocation().add(0.5, 0.5, 0.5)); + + if (dist < radius) + continue; + + if (bestBlock == null || dist > bestDist) + { + bestBlock = block; + bestDist = dist; + } + } + + //Shuffle Down + while (bestBlock.getRelative(BlockFace.DOWN).getType() != Material.AIR) + bestBlock = bestBlock.getRelative(BlockFace.DOWN); + + _blocks.remove(bestBlock); + + if (bestBlock.getType() != Material.AIR) + MapUtil.QuickChangeBlockAt(bestBlock.getLocation(), Material.AIR); + } + + @EventHandler + public void pigFall(EntityDamageEvent event) + { + if (event.getCause() == DamageCause.FALL) + event.setCancelled(true); + } + + public void pigSpawn() + { + CreatureAllowOverride = true; + + int toSpawn = GetPlayers(true).size()-_playersOutPerRound; + + if (toSpawn == 1) + _finalRound = true; + + for (int i=0 ; i < toSpawn ; i++) + { + Location loc = UtilAlg.Random(_pigSpawns); + + Pig pig = loc.getWorld().spawn(loc, Pig.class); + _pigs.put(pig, pig.getLocation()); + + UtilEnt.Vegetate(pig); + + //Give Item + if (toSpawn > 1) + { + Item item = pig.getWorld().dropItem(pig.getLocation(),ItemStackFactory.Instance.CreateStack(_item.getMaterial(), _item.getData())); + + if (pig.getPassenger() != null) + pig.getPassenger().remove(); + + pig.setPassenger(item); + } + } + + CreatureAllowOverride = false; + } + + @EventHandler + public void pigUpdate(UpdateEvent event) + { + for (Pig pig : _pigs.keySet()) + { + //Fallen Off Island?! JUMP BACK! + Block block = pig.getLocation().getBlock(); + while (block.getType() == Material.AIR) + { + block = block.getRelative(BlockFace.DOWN); + } + if (block.isLiquid()) + { + UtilAction.velocity(pig, + UtilAlg.getTrajectory(pig.getLocation(), + GetSpectatorLocation().clone().add(Math.random() * 30 - 15, 0, Math.random() * 30 - 15)), + 2 + Math.random(), false, 0, 0.4, 10, true); + + pig.getWorld().playSound(pig.getLocation(), Sound.PIG_IDLE, 2f, 2f); + + continue; + } + + //Player Rider + if (_finalRound && pig.getPassenger() != null && pig.getPassenger() instanceof Player) + { + Location target = pig.getLocation(); + target.add(pig.getPassenger().getLocation().getDirection().multiply(5)); + + UtilEnt.CreatureMoveFast(pig, target, 2); + + continue; + } + + Vector threat = new Vector(0,0,0); + + //waypoint + Location loc = _pigs.get(pig); + + //find new waypoint + if (UtilMath.offset2d(pig.getLocation(), loc) < 5 || targetAtEdge(loc)) + { + Location newLoc = getNewWaypoint(pig); + + if (newLoc != null) + { + loc.setX(newLoc.getX()); + loc.setZ(newLoc.getZ()); + } + } + + threat.add(UtilAlg.getTrajectory2d(pig.getLocation(), loc).multiply(0.4)); + + //run from players + double closestDist = 0; + HashMap ents = UtilEnt.getInRadius(pig.getLocation(), 12); + if (ents.size() > 0) + { + for (LivingEntity ent : ents.keySet()) + { + if (ent instanceof Player) + { + if (ent.equals(pig)) + continue; + + if (!IsAlive((Player)ent)) + continue; + + double score = ents.get(ent); + + //Add scaled threat! + threat.add(UtilAlg.getTrajectory2d(ent, pig).multiply(score)); + + if (score > closestDist) + closestDist = score; + } + if (ent instanceof Pig) + { + if (ents.get(ent) < 0.3) + { + threat.add(UtilAlg.getTrajectory2d(ent, pig).multiply(ents.get(ent) * 0.3)); + } + } + } + } + + threat.normalize(); + + //MOVE + Location target = pig.getLocation().add(threat.multiply(4)); + + //try to skate around edge + int attempts = 0; + while (targetAtEdge(target) && attempts < 10) + { + attempts++; + + target.add(UtilAlg.getTrajectory(target, GetSpectatorLocation())); + + //too cornered! jump back in + if (UtilMath.offset(pig.getLocation(), target) < 2) + { + UtilEnt.CreatureMoveFast(pig, pig.getLocation().add(UtilAlg.getTrajectory(pig.getLocation(), GetSpectatorLocation())), 2f); + + UtilAction.velocity(pig, + UtilAlg.getTrajectory(pig.getLocation(), + GetSpectatorLocation().clone().add(Math.random() * 30 - 15, 0, Math.random() * 30 - 15)), + 2 + Math.random(), false, 0, 0.4, 10, true); + + pig.getWorld().playSound(pig.getLocation(), Sound.PIG_IDLE, 2f, 2f); + } + } + + UtilEnt.CreatureMoveFast(pig, target, 1.5f + (float)(1f * closestDist)); + } + } + + private Location getNewWaypoint(Pig pig) + { + for (int i=0 ; i<50 ; i++) + { + Location loc = pig.getLocation(); + + loc.add(Math.random() * 50 - 25, 0, Math.random() * 50 - 25); + + if (!targetAtEdge(loc)) + return loc; + } + + return null; + } + + private boolean targetAtEdge(Location target) + { + Block block = target.getWorld().getBlockAt(target.getBlockX(), _blockMapHeight, target.getBlockZ()); + + for (int x=-1 ; x <= 1 ; x++) + for (int z=-1 ; z <= 1 ; z++) + { + if (block.getRelative(x, -1, z).getType() == Material.AIR) + return true; + } + + return false; + } + + @EventHandler + public void roundUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + if (_roundState == 0) + { + nextRound(); + } + + else if (_roundState == 1) + { + if (UtilTime.elapsed(_roundTime, _roundTimeLimit) || (_pigs.isEmpty() && _hasItem.isEmpty())) + { + if (_completedRound.isEmpty()) + { + //Announce + AnnounceEnd(new ArrayList()); + + //End + SetState(GameState.End); + + return; + } + + //Kill Failed Players + for (Player player : GetPlayers(true)) + { + if (!_completedRound.contains(player)) + { + UtilTextMiddle.display(C.cRed + C.Bold + "Game Over", "You failed to help Calvin", 0, 80, 20, player); + player.damage(9999); + } + } + + _roundState = 2; + _roundTime = System.currentTimeMillis(); + + + //Cull Excess Pigs + Iterator pigIter = _pigs.keySet().iterator(); + while (pigIter.hasNext()) + { + Pig pig = pigIter.next(); + + if (pig.getPassenger() != null) + pig.getPassenger().remove(); + + _pigsDead.add(pig); + pigIter.remove(); + } + + //Stop Music + _music.cancel(); + } + } + + else if (_roundState == 2 && UtilTime.elapsed(_roundTime, 5000)) + { + nextRound(); + } + } + + private void nextRound() + { + _round++; + + _roundState = 1; + _roundTime = System.currentTimeMillis(); + + _completedRound.clear(); + _hasItem.clear(); + + //Restock Items (only repeat items if required) + if (_unusedGifts.isEmpty()) + for (ValItem gift : ValItem.values()) + _unusedGifts.add(gift); + + //Set Item + _item = UtilAlg.Random(_unusedGifts); + _unusedGifts.remove(_item); + + //Delete Dead Pigs + for (Pig pig : _pigsDead) + pig.remove(); + _pigsDead.clear(); + + //Clean + for (Pig pig : _pigs.keySet()) + { + if (pig.getPassenger() != null) + pig.getPassenger().remove(); + + pig.remove(); + } + _pigs.clear(); + + //Restock Pigs + pigSpawn(); + + + NoteSong noteSong; + //Announce + if (_pigs.size() > 1) + { + UtilTextMiddle.display(C.cYellow + "Round " + _round, _item.getTitle(), 0, 80, 20); + noteSong = _songs[_round % _songs.length]; + } + else + { + UtilTextMiddle.display(C.cYellow + "Final Round", "Capture the Pig!", 0, 80, 20); + + for (Player player : GetPlayers(true)) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1, "Pig Saddle")); + noteSong = _finalSong; + } + + //Music! + _music = new NotePlayer(Manager.getPlugin(), noteSong, new INoteVerifier() + { + @Override + public boolean shouldPlay(Player player) + { + return Manager.getPreferences().Get(player).HubMusic; + } + }, 0.7F, true); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cGreen + "Players Alive"); + Scoreboard.Write("" + GetPlayers(true).size()); + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cGreen + "Items Left"); + + if (_roundState == 1) + Scoreboard.Write("" + _pigs.size()); + else + Scoreboard.Write("-"); + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cGreen + "Time Left"); + if (_roundState == 1) + Scoreboard.Write("" + UtilTime.MakeStr(_roundTimeLimit - (System.currentTimeMillis() - _roundTime), 0)); + else + Scoreboard.Write("-"); + + Scoreboard.Draw(); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (GetPlayers(true).size() == 1) + { + ArrayList places = _players.GetPlacements(true); + + //Announce + AnnounceEnd(places); + + //Gems + if (places.size() >= 1) + AddGems(places.get(0), 20, "1st Place", false, false); + + if (places.size() >= 2) + AddGems(places.get(1), 15, "2nd Place", false, false); + + if (places.size() >= 3) + AddGems(places.get(2), 10, "3rd Place", false, false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + + + if (GetPlayers(true).size() >= 1) + { + Player winner = places.get(0); + + if (Manager.GetTaskManager().hasCompletedTask(winner, "Valentines Reward 2016")) + { + + } + else + { + SetCustomWinMessage(winner, winner.getName() + " earned " + C.cYellow + "3x Valentines Gift"); + + Manager.GetTaskManager().completedTask(new Callback() + { + @Override + public void run(Boolean data) + { + if (data) + { + Manager.getInventoryManager().addItemToInventory(winner, "Valentines Gift", 3); + } + else + { + UtilPlayer.message(winner, F.main("Inventory", "An error occured while giving you " + C.cRed + "3x Valentines Gift" + C.cGray + ".")); + } + } + }, winner, "Valentines Reward 2016"); + } + } + + //End + SetState(GameState.End); + } + else if (GetPlayers(true).size() == 0) + { + for (Player player : GetPlayers(false)) + { + Manager.GetGame().AddGems(player, 10, "Participation", false, false); + } + + SetCustomWinLine("Moolanie broke up with Calvin..."); + + SetState(GameState.End); + } + } + + @EventHandler + public void displayCalvinMessage(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!IsLive()) + return; + + String message = _finalRound ? "Bring the Pig to Calvin!" : "Return " + _item.getTitle() + " to Calvin!"; + + Player[] players = GetPlayers(true).stream().filter(this::canReturnToCow).toArray(size -> new Player[size]); + UtilTextMiddle.display("", C.cGreen + message, players); + } + + private boolean canReturnToCow(Player player) + { + return _hasItem.contains(player) || player.getVehicle() != null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java new file mode 100644 index 000000000..cc9d89158 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.game.games.valentines.kit; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +public class KitMasterOfLove extends Kit +{ + public KitMasterOfLove(ArcadeManager manager) + { + super(manager, "Master of Love", KitAvailability.Free, + + new String[] + { + "Ain't no mountain high enough!" + }, + + new Perk[] + { + }, + EntityType.SKELETON, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FISHING_ROD, (byte)0, 1, "Cupids Pig Catcher")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialPhaseValentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialPhaseValentines.java new file mode 100644 index 000000000..923fe4947 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialPhaseValentines.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.games.valentines.tutorial; + +import org.bukkit.Sound; + +import mineplex.core.common.util.C; +import nautilus.game.arcade.gametutorial.TutorialPhase; +import nautilus.game.arcade.gametutorial.TutorialText; + +public class TutorialPhaseValentines extends TutorialPhase +{ + + public TutorialPhaseValentines() + { + super(new TutorialText[] + { + new TutorialText(C.cRed + "Moolanie", "Calvin! Did you forget Valentines Day again?!", 1, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "Of course not!!!", 2, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "I promise this year will be amazing!", 3, Sound.COW_IDLE), + new TutorialText(C.cRed + "Moolanie", "It better be, or we're finished...", 4, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "Good thing I prepared this year!", 5, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "WHAT?!", 6, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "NO!!", 7, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "SOMEBODY HELP ME!", 8, Sound.COW_IDLE), + new TutorialText(C.cGreen + "Calvin", "I'M BEING ROBBED!", 9, Sound.COW_IDLE), + + }); + } + + @Override + public int ID() + { + return 1; + } + + @Override + public void onStart() + { + + } + + @Override + public void onEnd() + { + + } + + @Override + public void onMessageDisplay(TutorialText text) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java new file mode 100644 index 000000000..386bc5fe1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java @@ -0,0 +1,223 @@ +package nautilus.game.arcade.game.games.valentines.tutorial; + +import java.util.HashMap; +import java.util.Map.Entry; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Item; +import org.bukkit.entity.MushroomCow; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.valentines.ValItem; +import nautilus.game.arcade.game.games.valentines.Valentines; +import nautilus.game.arcade.gametutorial.GameTutorial; +import nautilus.game.arcade.gametutorial.TutorialPhase; + +public class TutorialValentines extends GameTutorial +{ + private Valentines Host; + + private Cow _cowBoy; + private Cow _cowGirl; + private HashMap _pigs = new HashMap(); + + private Location _pigSpawn; + private Location _pigWaypointA; + private Location _pigWaypointB; + + public TutorialValentines(Valentines valentines, ArcadeManager manager) + { + super(manager, new TutorialPhase[]{new TutorialPhaseValentines()}); + + Host = valentines; + + PlayTutorialSounds = true; + } + + @Override + public void onTick(int tick) + { + if (!hasStarted()) + return; + + if (getCurrentPhase() == null || getCurrentPhase().getCurrentText() == null) + return; + + cowGirlUpdate(tick); + cowBoyUpdate(tick); + pigUpdate(tick); + + lookUpdate(); + + } + + private void lookUpdate() + { + if (getCurrentPhase().getCurrentText().ID() == 2) + getPhase(1).setTarget(_cowBoy.getLocation().add(0, 2, 0)); + + if (getCurrentPhase().getCurrentText().ID() == 3) + getPhase(1).setTarget(_cowBoy.getLocation().add(0, 2, 0)); + + if (getCurrentPhase().getCurrentText().ID() == 4) + getPhase(1).setTarget(Host.WorldData.GetDataLocs("RED").get(0).clone().add(0, 2, 0)); + + if (getCurrentPhase().getCurrentText().ID() == 5) + getPhase(1).setTarget(_pigWaypointA.clone().add(0, 2, 0)); + } + + private void cowGirlUpdate(int tick) + { + if (getCurrentPhase().getCurrentText().ID() >= 4) + { + Location loc = _cowGirl.getLocation().add(UtilAlg.getTrajectory(_pigWaypointA, _cowGirl.getLocation()).multiply(5)); + + UtilEnt.CreatureMoveFast(_cowGirl, loc, 1.4f); + } + } + + private void cowBoyUpdate(int tick) + { + if (getCurrentPhase().getCurrentText().ID() == 5) + { + Location loc = _cowBoy.getLocation().add(UtilAlg.getTrajectory(_cowBoy.getLocation(), _pigSpawn).multiply(5)); + + UtilEnt.CreatureMoveFast(_cowBoy, loc, 1f); + } + } + + private void pigUpdate(int tick) + { + //Pigs + if (getCurrentPhase().getCurrentText().ID() > 5) + { + //Spawn + if (_pigs.size() < 5 && tick % 15 == 0) + { + Host.CreatureAllowOverride = true; + + //Spawn + Pig pig = _pigSpawn.getWorld().spawn(_pigSpawn, Pig.class); + UtilEnt.Vegetate(pig); + + + //Item + Item item = pig.getWorld().dropItem(pig.getLocation(), new ItemStack(Material.CHEST)); + pig.setPassenger(item); + + _pigs.put(pig, 0);; + + Host.CreatureAllowOverride = false; + } + + //Move + for (Entry data : _pigs.entrySet()) + { + //Move + if (data.getValue().intValue() == 0) + { + if (UtilMath.offset(data.getKey().getLocation(), _pigWaypointA) > 1) + { + UtilEnt.CreatureMoveFast(data.getKey(), _pigWaypointA, 1.4f); + } + else + { + data.setValue(1); + } + } + if (data.getValue().intValue() == 1) + { + if (UtilMath.offset(data.getKey().getLocation(), _pigWaypointB) > 1) + { + UtilEnt.CreatureMoveFast(data.getKey(), _pigWaypointB, 1.2f); + } + else + { + data.setValue(2); + } + } + + //Oink + if (Math.random() > 0.98) + { + data.getKey().getWorld().playSound(data.getKey().getLocation(), Sound.PIG_IDLE, 1.5f, 1f); + } + } + } + } + + @Override + public void onStart() + { + //Pig Spawn + _pigSpawn = Host.WorldData.GetDataLocs("PINK").get(0); + + //Pig Waypoints + if (UtilMath.offset(_pigSpawn, Host.WorldData.GetDataLocs("ORANGE").get(0)) < + UtilMath.offset(_pigSpawn, Host.WorldData.GetDataLocs("ORANGE").get(1))) + { + _pigWaypointA = Host.WorldData.GetDataLocs("ORANGE").get(0); + _pigWaypointB = Host.WorldData.GetDataLocs("ORANGE").get(1); + } + else + { + _pigWaypointA = Host.WorldData.GetDataLocs("ORANGE").get(1); + _pigWaypointB = Host.WorldData.GetDataLocs("ORANGE").get(0); + } + + //Spawn Cows + Host.CreatureAllowOverride = true; + + _cowBoy = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("BROWN").get(0), Cow.class); + _cowBoy.setCustomName(C.cGreenB + "Calvin"); + _cowBoy.setCustomNameVisible(true); + UtilEnt.Vegetate(_cowBoy); + + _cowGirl = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("RED").get(0), MushroomCow.class); + _cowGirl.setCustomName(C.cRedB + "Moolanie"); + _cowGirl.setCustomNameVisible(true); + UtilEnt.Vegetate(_cowGirl); + + Host.CreatureAllowOverride = false; + + + //Player Data + getPhase(1).setLocation(Host.WorldData.GetDataLocs("WHITE").get(0)); + getPhase(1).setTarget(_cowGirl.getLocation().add(0, 2, 0)); + } + + @Override + public void onEnd() + { + _cowBoy.remove(); + _cowGirl.remove(); + + for (Pig pig : _pigs.keySet()) + { + if (pig.getPassenger() != null) + pig.getPassenger().remove(); + + pig.remove(); + } + _pigs.clear(); + + for (Player player : getPlayers().keySet()) + { + Host.Manager.GetCondition().Factory().Blind("Tutorial End", player, player, 4, 0, false, false, false); + } + + UtilTextMiddle.display(C.cGreenB + "Calvin", "Punch the Pigs to get my items back!", 0, 100, 20, UtilServer.getPlayers()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 96ac7ad5a..3204c2dbb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -303,6 +303,11 @@ public abstract class GameTutorial return _phases; } + public TutorialPhase getCurrentPhase() + { + return _currentPhase; + } + public long getTutorialStart() { return _started; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 57c4baad5..e94afdbe3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -62,7 +62,7 @@ public abstract class TutorialPhase /** * preparing Pitch/Yaw of the location */ - private void prepareLocations() + public void prepareLocations() { Vector vector = new Vector(_target.getBlockX() - _location.getBlockX(), _target.getBlockY() - _location.getBlockY(), _target.getBlockZ() - _location.getBlockZ()); float pitch = UtilAlg.GetPitch(vector); @@ -158,7 +158,7 @@ public abstract class TutorialPhase i++; } displayMessage(text); - UtilTextMiddle.display("", text.getText(), 0, text.getStayTime(), 0, players); + UtilTextMiddle.display(text.getTitle(), text.getText(), 0, text.getStayTime(), 0, players); try { Thread.sleep(text.getStayTime() * 50); @@ -222,6 +222,11 @@ public abstract class TutorialPhase return _text; } + public TutorialText getCurrentText() + { + return _currentText; + } + public void setText(TutorialText[] text) { _text = text; @@ -240,11 +245,17 @@ public abstract class TutorialPhase public void setLocation(Location location) { _location = location; + + if (_location != null && _target != null) + prepareLocations(); } public void setTarget(Location target) { _target = target; + + if (_location != null && _target != null) + prepareLocations(); } public GameTutorial getTutorial() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java index 2711b10fa..82daa80c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java @@ -7,31 +7,43 @@ public class TutorialText { private String _text; + private String _title; private int _stayTime; private int _id; private Sound _sound; - public TutorialText(String text, int stayTime, int id, Sound sound) + public TutorialText(String title, String text, int stayTime, int id, Sound sound) { _text = text; + _title = title; _id = id; _stayTime = stayTime; _sound = sound; } + public TutorialText(String title, String text, int id, Sound sound) + { + this(title, text, (int) (Math.round(1.2 * text.length()) + 25), id, sound); + } + public TutorialText(String text, int id) { - this(text, (int) (Math.round(1.5 * text.length()) + 25), id, Sound.NOTE_PLING); + this(null, text, (int) (Math.round(1.2 * text.length()) + 25), id, Sound.NOTE_PLING); } public TutorialText(String text, int id, Sound sound) { - this(text, (int) (Math.round(1.5 * text.length()) + 25), id, sound); + this(null, text, (int) (Math.round(1.2 * text.length()) + 25), id, sound); } public TutorialText(String text, int stayTime, int id) { - this(text, stayTime, id, Sound.NOTE_PLING); + this(null, text, stayTime, id, Sound.NOTE_PLING); + } + + public String getTitle() + { + return _title; } public String getText() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index 60bf68b48..c78bd3771 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -52,7 +52,7 @@ public class GameLootManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); - _rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(), Manager.getGiveawayManager(), + _rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(), 100, 250, 500, 1000, 1500, 2500,