diff --git a/build.gradle b/build.gradle index 7c417ac59..520a0f5da 100644 --- a/build.gradle +++ b/build.gradle @@ -1 +1 @@ -allprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' group = 'be.isach' version = '2.4.9-RELEASE' compileJava.options.encoding = 'UTF-8' sourceCompatibility = 1.8 targetCompatibility = 1.8 configurations { shaded compile.extendsFrom shaded } afterEvaluate { jar { dependsOn configurations.shaded from configurations.shaded.collect { it.isDirectory() ? it : zipTree(it) } } } } boolean local = false if (local) libsDirName = '/Users/sacha/Documents/Development/Java/UC_1_11/testserver/plugins' dependencies { subprojects.each { p -> shaded(p) { transitive false } } } subprojects { repositories { mavenLocal() mavenCentral() // Vault maven { url 'http://nexus.hc.to/content/repositories/pub_releases' } // Lib's Disguises maven { url 'http://repo.md-5.net/content/groups/public/' } // Use BuildTools to download Spigot to your local maven repository. More information: https://www.spigotmc.org/wiki/buildtools/ // BungeeCord maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } } \ No newline at end of file +allprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' group = 'be.isach' version = '2.5.0-RELEASE' compileJava.options.encoding = 'UTF-8' sourceCompatibility = 1.8 targetCompatibility = 1.8 configurations { shaded compile.extendsFrom shaded } afterEvaluate { jar { dependsOn configurations.shaded from configurations.shaded.collect { it.isDirectory() ? it : zipTree(it) } } } } boolean local = false if (local) libsDirName = '/Users/sacha/Documents/Development/Java/UC_1_11/testserver/plugins' dependencies { subprojects.each { p -> shaded(p) { transitive false } } } subprojects { repositories { mavenLocal() mavenCentral() // Vault maven { url 'http://nexus.hc.to/content/repositories/pub_releases' } // Lib's Disguises maven { url 'http://repo.md-5.net/content/groups/public/' } // Use BuildTools to download Spigot to your local maven repository. More information: https://www.spigotmc.org/wiki/buildtools/ // BungeeCord maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } } \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index 3f58b8c42..5fdf3f550 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,6 +1,6 @@ dependencies { compile 'org.spigotmc:spigot:1.12-R0.1-SNAPSHOT' - compile('LibsDisguises:LibsDisguises:9.0.7') { + compile('LibsDisguises:LibsDisguises:9.4.0') { exclude group: 'org.spigotmc' exclude group: 'com.comphenix.protocol' } diff --git a/core/src/main/java/be/isach/ultracosmetics/CosmeticManager.java b/core/src/main/java/be/isach/ultracosmetics/CosmeticManager.java index 10b7702b0..e51ae143a 100644 --- a/core/src/main/java/be/isach/ultracosmetics/CosmeticManager.java +++ b/core/src/main/java/be/isach/ultracosmetics/CosmeticManager.java @@ -1,14 +1,8 @@ package be.isach.ultracosmetics; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.type.EmoteType; -import be.isach.ultracosmetics.cosmetics.type.GadgetType; -import be.isach.ultracosmetics.cosmetics.type.HatType; -import be.isach.ultracosmetics.cosmetics.type.MorphType; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.cosmetics.type.ParticleEffectType; -import be.isach.ultracosmetics.cosmetics.type.PetType; -import be.isach.ultracosmetics.cosmetics.type.SuitType; +import be.isach.ultracosmetics.cosmetics.Cosmetic; +import be.isach.ultracosmetics.cosmetics.type.*; import java.io.IOException; import java.util.ArrayList; @@ -45,14 +39,16 @@ public void setupCosmeticsConfigs() { ultraCosmetics.getConfig().addDefault("Ammo-System-For-Gadgets.Show-Ammo-In-Menu-As-Item-Amount", true, "Do you want that in the gadgets menu", "each gadget item has an amount", "corresponding to your ammo."); // CALL STATIC BLOCK. - GadgetType.ANTIGRAVITY.getConfigName(); - MountType.DRAGON.getConfigName(); - ParticleEffectType.ANGELWINGS.getConfigName(); - PetType.CHICK.getConfigName(); - SuitType.ASTRONAUT.getConfigName(); + GadgetType.register(); + MountType.register(); + ParticleEffectType.register(); + PetType.register(); + HatType.register(); + SuitType.register(); EmoteType.ANGRY.getConfigName(); if (Category.MORPHS.isEnabled()) { - MorphType.BAT.getConfigName(); + MorphType.register(); + // MorphType.valueOf("bat").getConfigName(); } for (GadgetType gadgetType : GadgetType.values()) { @@ -60,7 +56,7 @@ public void setupCosmeticsConfigs() { ultraCosmetics.getConfig().addDefault("Gadgets." + gadgetType.getConfigName() + ".Enabled", true, "if true, the gadget will be enabled."); ultraCosmetics.getConfig().addDefault("Gadgets." + gadgetType.getConfigName() + ".Show-Description", true, "if true, the description of gadget will be showed."); ultraCosmetics.getConfig().addDefault("Gadgets." + gadgetType.getConfigName() + ".Can-Be-Found-In-Treasure-Chests", true, "if true, it'll be possible to find", "it in treasure chests"); - if (gadgetType == GadgetType.PAINTBALLGUN) { + if (gadgetType == GadgetType.valueOf("paintballgun")) { ultraCosmetics.getConfig().addDefault("Gadgets." + gadgetType.getConfigName() + ".Block-Type", "STAINED_CLAY", "With what block will it paint?"); ultraCosmetics.getConfig().addDefault("Gadgets." + gadgetType.getConfigName() + ".Particle.Enabled", false, "Should it display particles?"); ultraCosmetics.getConfig().addDefault("Gadgets." + gadgetType.getConfigName() + ".Particle.Effect", "FIREWORKS_SPARK", "what particles? (List: http://pastebin.com/CVKkufck)"); diff --git a/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandClear.java b/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandClear.java index d493cdbc0..00de0c5a1 100644 --- a/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandClear.java +++ b/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandClear.java @@ -2,6 +2,7 @@ import be.isach.ultracosmetics.UltraCosmetics; import be.isach.ultracosmetics.command.SubCommand; +import be.isach.ultracosmetics.cosmetics.suits.ArmorSlot; import be.isach.ultracosmetics.player.UltraPlayer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -57,12 +58,13 @@ private void common(CommandSender sender, String... args) { else if (s.startsWith("pa")) up.removeParticleEffect(); else if (s.startsWith("pe")) up.removePet(); else if (s.startsWith("h")) up.removeHat(); - else if (s.startsWith("s")) up.removeSuit(); + else if (s.startsWith("s") && !s.contains(":")) up.removeSuit(); + else if (s.startsWith("s") && s.contains(":")) up.removeSuit(ArmorSlot.getByName(s.split(":")[1])); else if (s.startsWith("mor")) up.removeMorph(); else if (s.startsWith("mou")) up.removeMount(); else if (s.startsWith("e")) up.removeEmote(); else { - sender.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "/uc menu \n" + ChatColor.RED + "" + ChatColor.BOLD + "Invalid Type.\n" + ChatColor.RED + "" + ChatColor.BOLD + "Available types: gadgets, particleeffects, pets, mounts, suits, hats, morphs"); + sender.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "/uc clear \n" + ChatColor.RED + "" + ChatColor.BOLD + "Invalid Type.\n" + ChatColor.RED + "" + ChatColor.BOLD + "Available types: gadgets, particleeffects, pets, mounts, suits, hats, morphs"); } } } diff --git a/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandToggle.java b/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandToggle.java index 0b2fcc264..696319264 100644 --- a/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandToggle.java +++ b/core/src/main/java/be/isach/ultracosmetics/command/subcommands/SubCommandToggle.java @@ -93,7 +93,7 @@ protected void onExePlayer(Player sender, String... args) { return; } } - Object[] cosmeticTypes = category.getEnabled().stream().filter(cosmeticType -> cosmeticType.isEnabled() && cosmeticType.toString().toLowerCase().contains(cosm)).toArray(); + Object[] cosmeticTypes = category.getEnabled().stream().filter(cosmeticType -> cosmeticType.isEnabled() && cosmeticType.toString().toLowerCase().contains(cosm.split(":")[0])).toArray(); if (cosmeticTypes.length == 1) { CosmeticType cosmeticType = (CosmeticType) cosmeticTypes[0]; if (args.length > 3) { @@ -101,8 +101,8 @@ protected void onExePlayer(Player sender, String... args) { UltraPlayer other = getUltraCosmetics().getPlayerManager().getUltraPlayer(Bukkit.getPlayer(args[3])); if (cosmeticType.getCategory() == Category.SUITS) { try { - ArmorSlot armorSlot = ArmorSlot.getByName(args[2].split(":")[1]); - SuitType suitType = SuitType.valueOf(args[2].split(":")[0]); + ArmorSlot armorSlot = ArmorSlot.getByName(cosm.split(":")[1]); + SuitType suitType = SuitType.valueOf(cosm.split(":")[0]); suitType.equip(other, getUltraCosmetics(), armorSlot); } catch (Exception ex) { sender.sendMessage(MessageManager.getMessage("Prefix") + " §c§l/uc toggle suit ."); @@ -148,8 +148,7 @@ protected void onExeConsole(ConsoleCommandSender sender, String... args) { if (!UltraCosmeticsData.get().getEnabledWorlds().contains(Bukkit.getPlayer(args[3]).getWorld().getName())) { sender.sendMessage(MessageManager.getMessage("World-Disabled")); return; - } - } catch (Exception e) { + } } catch (Exception e) { sender.sendMessage(MessageManager.getMessage("Prefix") + " §c§lInvalid player."); return; } @@ -174,7 +173,7 @@ protected void onExeConsole(ConsoleCommandSender sender, String... args) { sender.sendMessage(MessageManager.getMessage("Prefix") + " §c§lInvalid player."); return; } - Object[] cosmeticTypes = category.getEnabled().stream().filter(cosmeticType -> cosmeticType.isEnabled() && cosmeticType.toString().toLowerCase().startsWith(cosm)).toArray(); + Object[] cosmeticTypes = category.getEnabled().stream().filter(cosmeticType -> cosmeticType.isEnabled() && cosmeticType.toString().toLowerCase().startsWith(cosm.split(":")[0])).toArray(); if (cosmeticTypes.length == 1) { CosmeticType cosmeticType = (CosmeticType) cosmeticTypes[0]; try { @@ -200,4 +199,4 @@ protected void onExeConsole(ConsoleCommandSender sender, String... args) { sender.sendMessage(MessageManager.getMessage("Prefix") + " §c§lInvalid category."); } } -} +} \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/config/MessageManager.java b/core/src/main/java/be/isach/ultracosmetics/config/MessageManager.java index 352ad166b..f8af36db3 100755 --- a/core/src/main/java/be/isach/ultracosmetics/config/MessageManager.java +++ b/core/src/main/java/be/isach/ultracosmetics/config/MessageManager.java @@ -228,6 +228,20 @@ private void loadMessages() { addMessage("Pets.ChristmasElf.entity-displayname", "&l%playername%'s Christmas elf"); addMessage("Pets.Mooshroom.menu-name", "&4&lMooshroom"); addMessage("Pets.Mooshroom.entity-displayname", "&l%playername%'s Mooshroom"); + addMessage("Pets.IronGolem.menu-name", "&7&lIronGolem"); + addMessage("Pets.IronGolem.entity-displayname", "&l%playername%'s IronGolem"); + addMessage("Pets.Snowman.menu-name", "&f&lSnowman"); + addMessage("Pets.Snowman.entity-displayname", "&l%playername%'s Snowman"); + addMessage("Pets.Villager.menu-name", "&a&lVillager"); + addMessage("Pets.Villager.entity-displayname", "&l%playername%'s Villager"); + addMessage("Pets.Bat.menu-name", "&8&lBat"); + addMessage("Pets.Bat.entity-displayname", "&l%playername%'s Bat"); + addMessage("Pets.PolarBear.menu-name", "&b&lPolarBear"); + addMessage("Pets.PolarBear.entity-displayname", "&l%playername%'s PolarBear"); + addMessage("Pets.Llama.menu-name", "&7&lLlama"); + addMessage("Pets.Llama.entity-displayname", "&l%playername%'s Llama"); + addMessage("Pets.Parrot.menu-name", "&a&lParrot"); + addMessage("Pets.Parrot.entity-displayname", "&l%playername%'s Parrot"); addMessage("Pets.Spawn", "%prefix% &9You spawned %petname%"); addMessage("Pets.Despawn", "%prefix% &9You despawned %petname%"); @@ -300,6 +314,54 @@ private void loadMessages() { addMessage("Hats.Present.Name", "&c&lPresent"); addMessage("Hats.Elf.Name", "&a&lElf"); addMessage("Hats.Bedrock.Name", "&8&lBedrock"); + addMessage("Hats.Bread.Name", "&f&lBread"); + addMessage("Hats.Cheese.Name", "&e&lCheese"); + addMessage("Hats.Pancakes.Name", "&f&lPancakes"); + addMessage("Hats.Cake.Name", "&c&lCake"); + addMessage("Hats.Cookie.Name", "&6&lCookie"); + addMessage("Hats.CandyCane.Name", "&c&lCandy &f&lCane"); + addMessage("Hats.Chocolate.Name", "&a&lChocolate"); + addMessage("Hats.WhiteChocolate.Name", "&f&lWhite Chocolate"); + addMessage("Hats.Apple.Name", "&4&lApple"); + addMessage("Hats.Melon.Name", "&a&lMelon"); + addMessage("Hats.CarvedPumpkin.Name", "&6&lCarved Pumpkin"); + addMessage("Hats.Strawberry.Name", "&c&lStrawberry"); + addMessage("Hats.Coconut.Name", "&f&lCoconut"); + addMessage("Hats.Taco.Name", "&e&lTaco"); + addMessage("Hats.Bacon.Name", "&f&lBacon"); + addMessage("Hats.Fries.Name", "&6&lFries"); + addMessage("Hats.Hamburger.Name", "&6&lHamburger"); + addMessage("Hats.Popcorn.Name", "&6&lPopcorn"); + addMessage("Hats.WhiteDonut.Name", "&f&lWhite Donut"); + addMessage("Hats.PinkDonut.Name", "&d&lPink Donut"); + addMessage("Hats.ChocolateDonut.Name", "&a&lChocolate Donut"); + addMessage("Hats.Pie.Name", "&4&lPie"); + addMessage("Hats.A.Name", "&6&lA"); + addMessage("Hats.B.Name", "&4&lB"); + addMessage("Hats.C.Name", "&2&lC"); + addMessage("Hats.D.Name", "&b&lD"); + addMessage("Hats.E.Name", "&e&lE"); + addMessage("Hats.F.Name", "&5&lF"); + addMessage("Hats.G.Name", "&d&lG"); + addMessage("Hats.H.Name", "&a&lH"); + addMessage("Hats.I.Name", "&6&lI"); + addMessage("Hats.J.Name", "&4&lJ"); + addMessage("Hats.K.Name", "&2&lK"); + addMessage("Hats.L.Name", "&b&lL"); + addMessage("Hats.M.Name", "&e&lM"); + addMessage("Hats.N.Name", "&5&lN"); + addMessage("Hats.O.Name", "&d&lO"); + addMessage("Hats.P.Name", "&a&lP"); + addMessage("Hats.Q.Name", "&6&lQ"); + addMessage("Hats.R.Name", "&4&lR"); + addMessage("Hats.S.Name", "&2&lS"); + addMessage("Hats.T.Name", "&b&lT"); + addMessage("Hats.U.Name", "&e&lU"); + addMessage("Hats.V.Name", "&5&lV"); + addMessage("Hats.W.Name", "&d&lW"); + addMessage("Hats.X.Name", "&a&lX"); + addMessage("Hats.Y.Name", "&6&lY"); + addMessage("Hats.Z.Name", "&4&lZ"); addMessage("Hats.Must-Remove-Hat", "%prefix% &c&lYou must remove your helmet to equip a hat!"); //SUITS diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/Category.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/Category.java index 1c9d7bb75..51da9afa1 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/Category.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/Category.java @@ -12,6 +12,7 @@ import be.isach.ultracosmetics.cosmetics.type.MountType; import be.isach.ultracosmetics.cosmetics.type.ParticleEffectType; import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.cosmetics.type.SuitType; import be.isach.ultracosmetics.menu.CosmeticMenu; import be.isach.ultracosmetics.util.ItemFactory; import org.bukkit.Bukkit; @@ -106,7 +107,7 @@ public CosmeticMenu getMenu(UltraCosmetics ultraCosmetics) { @Override public List getEnabled() { - return EmoteType.enabled(); + return SuitType.enabled(); } }, EMOTES("Emotes", "Equip", "Unequip", "Clear-Emote", "%emotename%", "Equip", "Unequip") { diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetAntiGravity.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetAntiGravity.java index 4565b4e3b..ef51ac9fa 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetAntiGravity.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetAntiGravity.java @@ -29,7 +29,7 @@ public class GadgetAntiGravity extends Gadget { private boolean running; public GadgetAntiGravity(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.ANTIGRAVITY, ultraCosmetics); + super(owner, GadgetType.valueOf("antigravity"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBatBlaster.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBatBlaster.java index 648953263..68ebf3b52 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBatBlaster.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBatBlaster.java @@ -32,7 +32,7 @@ public class GadgetBatBlaster extends Gadget { private List bats; public GadgetBatBlaster(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.BATBLASTER, ultraCosmetics); + super(owner, GadgetType.valueOf("batblaster"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlackHole.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlackHole.java index efa4b0308..c418dc9b2 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlackHole.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlackHole.java @@ -31,7 +31,7 @@ public class GadgetBlackHole extends Gadget { private Item item; public GadgetBlackHole(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.BLACKHOLE, ultraCosmetics); + super(owner, GadgetType.valueOf("blackhole"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlizzardBlaster.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlizzardBlaster.java index 449d1f5e4..3097c3eb4 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlizzardBlaster.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetBlizzardBlaster.java @@ -22,7 +22,7 @@ public class GadgetBlizzardBlaster extends Gadget { private Vector vector; public GadgetBlizzardBlaster(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.BLIZZARDBLASTER, ultraCosmetics); + super(owner, GadgetType.valueOf("blizzardblaster"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChickenator.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChickenator.java index cb80b110f..789205b0e 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChickenator.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChickenator.java @@ -35,7 +35,7 @@ public class GadgetChickenator extends Gadget { private List items = new ArrayList<>(); public GadgetChickenator(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.CHICKENATOR, ultraCosmetics); + super(owner, GadgetType.valueOf("chickenator"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChristmasTree.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChristmasTree.java index 21d397137..4c209b191 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChristmasTree.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetChristmasTree.java @@ -28,7 +28,7 @@ public class GadgetChristmasTree extends Gadget { private static final Color LOG_COLOR = Color.fromRGB(101, 67, 33); public GadgetChristmasTree(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.CHRISTMASTREE, ultraCosmetics); + super(owner, GadgetType.valueOf("christmastree"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetColorBomb.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetColorBomb.java index 333a8d809..6bd4f21c6 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetColorBomb.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetColorBomb.java @@ -34,7 +34,7 @@ public class GadgetColorBomb extends Gadget { private boolean running = false; public GadgetColorBomb(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.COLORBOMB, ultraCosmetics); + super(owner, GadgetType.valueOf("colorbomb"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetDiscoBall.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetDiscoBall.java index 9112ae59b..a9480eb81 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetDiscoBall.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetDiscoBall.java @@ -43,7 +43,7 @@ public class GadgetDiscoBall extends Gadget { private boolean running = false; public GadgetDiscoBall(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.DISCOBALL, ultraCosmetics); + super(owner, GadgetType.valueOf("discoball"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetEtherealPearl.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetEtherealPearl.java index 27b90a8af..47d832aaf 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetEtherealPearl.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetEtherealPearl.java @@ -32,7 +32,7 @@ public class GadgetEtherealPearl extends Gadget implements Listener { private EnderPearl pearl; public GadgetEtherealPearl(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.ETHEREALPEARL, ultraCosmetics); + super(owner, GadgetType.valueOf("etherealpearl"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetExplosiveSheep.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetExplosiveSheep.java index 7275ae973..af6d20579 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetExplosiveSheep.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetExplosiveSheep.java @@ -39,7 +39,7 @@ public class GadgetExplosiveSheep extends Gadget { private ArrayList sheepArrayList = new ArrayList<>(); public GadgetExplosiveSheep(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.EXPLOSIVESHEEP, ultraCosmetics); + super(owner, GadgetType.valueOf("explosivesheep"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFirework.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFirework.java index b0203bcd7..7c104c846 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFirework.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFirework.java @@ -22,7 +22,7 @@ public class GadgetFirework extends Gadget { private static Random random = new Random(); public GadgetFirework(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.FIREWORK, ultraCosmetics); + super(owner, GadgetType.valueOf("firework"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFleshHook.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFleshHook.java index 4d0b98400..e32f142f1 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFleshHook.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFleshHook.java @@ -31,7 +31,7 @@ public class GadgetFleshHook extends Gadget implements Listener { private ArrayList items = new ArrayList<>(); public GadgetFleshHook(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.FLESHHOOK, ultraCosmetics); + super(owner, GadgetType.valueOf("fleshhook"), ultraCosmetics); } @EventHandler diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFreezeCannon.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFreezeCannon.java index 9b5e7e55c..4ee5802f9 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFreezeCannon.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFreezeCannon.java @@ -27,7 +27,7 @@ public class GadgetFreezeCannon extends Gadget { private List queue; public GadgetFreezeCannon(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.FREEZECANNON, ultraCosmetics); + super(owner, GadgetType.valueOf("freezecannon"), ultraCosmetics); if (owner == null) return; items = new ArrayList<>(); queue = new ArrayList<>(); diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFunGun.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFunGun.java index 9b2d4c963..667424790 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFunGun.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetFunGun.java @@ -28,7 +28,7 @@ public class GadgetFunGun extends Gadget { private List projectiles = new ArrayList<>(); public GadgetFunGun(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.FUNGUN, ultraCosmetics); + super(owner, GadgetType.valueOf("fungun"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetGhostParty.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetGhostParty.java index d960fef55..25601675c 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetGhostParty.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetGhostParty.java @@ -32,7 +32,7 @@ public class GadgetGhostParty extends Gadget { Map bats = new HashMap<>(); public GadgetGhostParty(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.GHOSTPARTY, ultraCosmetics); + super(owner, GadgetType.valueOf("ghostparty"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetMelonThrower.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetMelonThrower.java index 85d098cec..42866933e 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetMelonThrower.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetMelonThrower.java @@ -38,7 +38,7 @@ public class GadgetMelonThrower extends Gadget implements Listener { private World world = null; public GadgetMelonThrower(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.MELONTHROWER, ultraCosmetics); + super(owner, GadgetType.valueOf("melonthrower"), ultraCosmetics); } @EventHandler diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPaintballGun.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPaintballGun.java index f6ae15ec7..8032e0054 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPaintballGun.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPaintballGun.java @@ -43,7 +43,7 @@ public class GadgetPaintballGun extends Gadget implements Listener { int radius = 2; public GadgetPaintballGun(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.PAINTBALLGUN, ultraCosmetics); + super(owner, GadgetType.valueOf("paintballgun"), ultraCosmetics); if (owner != null) { radius = SettingsManager.getConfig().getInt("Gadgets." + getType().getConfigName() + ".Radius"); } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetParachute.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetParachute.java index 7ce5aff8f..eb0904ca7 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetParachute.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetParachute.java @@ -34,7 +34,7 @@ public class GadgetParachute extends Gadget { boolean active; public GadgetParachute(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.PARACHUTE, ultraCosmetics); + super(owner, GadgetType.valueOf("parachute"), ultraCosmetics); } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPartyPopper.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPartyPopper.java index eebcd6e65..a69f97b7c 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPartyPopper.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPartyPopper.java @@ -19,7 +19,7 @@ public class GadgetPartyPopper extends Gadget { public GadgetPartyPopper(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.PARTYPOPPER, ultraCosmetics); + super(owner, GadgetType.valueOf("partypopper"), ultraCosmetics); setAsynchronous(true); } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPortalGun.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPortalGun.java index b45461008..e4930c06f 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPortalGun.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetPortalGun.java @@ -40,7 +40,7 @@ public class GadgetPortalGun extends Gadget { BlockFace redBlockFace; public GadgetPortalGun(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.PORTALGUN, ultraCosmetics); + super(owner, GadgetType.valueOf("portalgun"), ultraCosmetics); displayCooldownMessage = false; useTwoInteractMethods = true; } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetQuakeGun.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetQuakeGun.java index 4270f93a0..b9da1a1a9 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetQuakeGun.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetQuakeGun.java @@ -34,7 +34,7 @@ public class GadgetQuakeGun extends Gadget { List fireworkList = new ArrayList<>(); public GadgetQuakeGun(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.QUAKEGUN, ultraCosmetics); + super(owner, GadgetType.valueOf("quakegun"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetRocket.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetRocket.java index 60eb12097..d3f418df8 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetRocket.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetRocket.java @@ -41,7 +41,7 @@ public class GadgetRocket extends Gadget { List fallingBlocks = new ArrayList<>(); public GadgetRocket(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.ROCKET, ultraCosmetics); + super(owner, GadgetType.valueOf("rocket"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSmashDown.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSmashDown.java index d685c9620..76e6c3450 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSmashDown.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSmashDown.java @@ -39,7 +39,7 @@ public class GadgetSmashDown extends Gadget { private boolean playEffect; public GadgetSmashDown(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.SMASHDOWN, ultraCosmetics); + super(owner, GadgetType.valueOf("smashdown"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSnowball.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSnowball.java index 6147ca7af..c6f3adcbf 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSnowball.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetSnowball.java @@ -22,7 +22,7 @@ public class GadgetSnowball extends Gadget { private List snowballs; public GadgetSnowball(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.SNOWBALL, ultraCosmetics); + super(owner, GadgetType.valueOf("snowball"), ultraCosmetics); if (owner != null) snowballs = new ArrayList<>(); diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTNT.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTNT.java index 3755574f2..f23146438 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTNT.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTNT.java @@ -34,7 +34,7 @@ public class GadgetTNT extends Gadget { List entities = new ArrayList<>(); public GadgetTNT(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.TNT, ultraCosmetics); + super(owner, GadgetType.valueOf("tnt"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetThorHammer.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetThorHammer.java index 15775d67d..85fbcb424 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetThorHammer.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetThorHammer.java @@ -34,7 +34,7 @@ public class GadgetThorHammer extends Gadget implements Listener { Vector v; public GadgetThorHammer(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.THORHAMMER, ultraCosmetics); + super(owner, GadgetType.valueOf("thorhammer"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTrampoline.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTrampoline.java index fc9c30fdb..04960b51a 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTrampoline.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTrampoline.java @@ -36,7 +36,7 @@ public class GadgetTrampoline extends Gadget { private boolean running; public GadgetTrampoline(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.TRAMPOLINE, ultraCosmetics); + super(owner, GadgetType.valueOf("trampoline"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTsunami.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTsunami.java index 8a64a8fae..d279fbc95 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTsunami.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/gadgets/GadgetTsunami.java @@ -28,7 +28,7 @@ public class GadgetTsunami extends Gadget { List cooldownJump = new ArrayList<>(); public GadgetTsunami(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, GadgetType.TSUNAMI, ultraCosmetics); + super(owner, GadgetType.valueOf("tsunami"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBat.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBat.java index a1eb26d09..de4636bdd 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBat.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBat.java @@ -20,7 +20,7 @@ public class MorphBat extends Morph { public MorphBat(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.BAT, ultraCosmetics); + super(owner, MorphType.valueOf("bat"), ultraCosmetics); } @Override @@ -31,7 +31,6 @@ protected void onEquip() { @Override public void onUpdate() { - //-- } @EventHandler diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBlaze.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBlaze.java index 5fed770e6..cd8e64b66 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBlaze.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphBlaze.java @@ -20,7 +20,7 @@ public class MorphBlaze extends Morph { public MorphBlaze(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.BLAZE, ultraCosmetics); + super(owner, MorphType.valueOf("blaze"), ultraCosmetics); } @Override @@ -42,7 +42,6 @@ public void onKick(PlayerKickEvent event) { @Override protected void onClear() { - } @EventHandler diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphChicken.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphChicken.java index b9139a57a..cb1ae088a 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphChicken.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphChicken.java @@ -32,11 +32,10 @@ * @since 08-27-2015 */ public class MorphChicken extends Morph { - private boolean cooldown; public MorphChicken(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.CHICKEN, ultraCosmetics); + super(owner, MorphType.valueOf("chicken"), ultraCosmetics); } @EventHandler @@ -95,7 +94,6 @@ public void run() { @Override protected void onClear() { - } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCow.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCow.java new file mode 100644 index 000000000..fe445facc --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCow.java @@ -0,0 +1,44 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.SoundUtil; +import be.isach.ultracosmetics.util.Sounds; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +/** + * Represents an instance of a cow morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphCow extends Morph { + // TODO: Add something better for this morph - having it just "moo" isn't much. + private long coolDown = 0; + + public MorphCow(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("cow"), ultraCosmetics); + } + + @EventHandler + public void onLeftClick(PlayerInteractEvent event) { + if ((event.getAction() == Action.LEFT_CLICK_AIR + || event.getAction() == Action.LEFT_CLICK_BLOCK) && event.getPlayer() == getPlayer()) { + if (coolDown > System.currentTimeMillis()) return; + event.setCancelled(true); + SoundUtil.playSound(event.getPlayer().getLocation(), Sounds.COW_IDLE); + coolDown = System.currentTimeMillis() + 500; + } + } + + @Override + public void onUpdate() { + } + + @Override + protected void onClear() { + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCreeper.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCreeper.java index a1a980985..c0b91f1b0 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCreeper.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphCreeper.java @@ -23,11 +23,10 @@ * @since 08-26-2015 */ public class MorphCreeper extends Morph { - private int charge = 0; public MorphCreeper(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.CREEPER, ultraCosmetics); + super(owner, MorphType.valueOf("creeper"), ultraCosmetics); } @Override @@ -85,6 +84,5 @@ public void onUpdate() { @Override protected void onClear() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphEnderman.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphEnderman.java index 72b460707..d460fc1e0 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphEnderman.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphEnderman.java @@ -26,11 +26,10 @@ * @since 08-26-2015 */ public class MorphEnderman extends Morph { - private boolean cooldown; public MorphEnderman(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ENDERMAN, ultraCosmetics); + super(owner, MorphType.valueOf("enderman"), ultraCosmetics); } @Override @@ -72,7 +71,6 @@ && getOwner().getCurrentMorph() == this) { @Override public void onUpdate() { - } public static FireworkEffect getRandomFireworkEffect() { diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphLlama.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphLlama.java new file mode 100644 index 000000000..e05cd8aec --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphLlama.java @@ -0,0 +1,46 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import me.libraryaddict.disguise.disguisetypes.watchers.LlamaWatcher; +import org.bukkit.entity.Llama; +import org.bukkit.entity.LlamaSpit; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +/** + * Represents an instance of a llama morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphLlama extends Morph { + private long coolDown = 0; + + public MorphLlama(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("llama"), ultraCosmetics); + } + + @EventHandler + public void onLeftClick(PlayerInteractEvent event) { + if ((event.getAction() == Action.LEFT_CLICK_AIR + || event.getAction() == Action.LEFT_CLICK_BLOCK) && event.getPlayer() == getPlayer()) { + if (coolDown > System.currentTimeMillis()) return; + event.setCancelled(true); + LlamaSpit llamaSpit = event.getPlayer().launchProjectile(LlamaSpit.class); + System.out.println("llama spit is from: " + llamaSpit.getShooter()); + coolDown = System.currentTimeMillis() + 500; + } + } + + @Override + public void onUpdate() { + } + + @Override + protected void onClear() { + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphMooshroom.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphMooshroom.java new file mode 100644 index 000000000..c26291a54 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphMooshroom.java @@ -0,0 +1,71 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import be.isach.ultracosmetics.util.MathUtils; +import be.isach.ultracosmetics.util.SoundUtil; +import be.isach.ultracosmetics.util.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.metadata.FixedMetadataValue; + +import java.util.ArrayList; +import java.util.List; + +/** + * Represents an instance of a mooshroom morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphMooshroom extends Morph { + private boolean inCooldown = false; + + public MorphMooshroom(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("mooshroom"), ultraCosmetics); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onSneak(PlayerToggleSneakEvent event) { + if (event.getPlayer() == getPlayer() && !inCooldown) { + inCooldown = true; + Bukkit.getScheduler().runTaskLaterAsynchronously(getUltraCosmetics(), () -> inCooldown = false, 200); + for (Entity ent : getPlayer().getNearbyEntities(3, 3, 3)) { + if (ent instanceof Player || ent instanceof Creature) + MathUtils.applyVelocity(ent, ent.getLocation().toVector().subtract(getPlayer().getLocation().toVector()).setY(1)); + } + final List items = new ArrayList<>(); + for (int i = 0; i < 20; i++) { + Item soup = getPlayer().getWorld().dropItem(getPlayer().getLocation().add(Math.random() * 5.0D - 2.5D, Math.random() * 3.0D, Math.random() * 5.0D - 2.5D), ItemFactory + .create(Material.MUSHROOM_SOUP, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); + soup.setVelocity(MathUtils.getRandomVector()); + soup.setMetadata("UNPICKABLEUP", new FixedMetadataValue(getUltraCosmetics(), "")); + items.add(soup); + } + Bukkit.getScheduler().runTaskLaterAsynchronously(getUltraCosmetics(), () -> { + for (Entity soup : items) + soup.remove(); + items.clear(); + }, 50); + SoundUtil.playSound(getPlayer(), Sounds.SHEEP_SHEAR, 0.4f, (float) Math.random() + 1f); + } + } + + @Override + public void onUpdate() { + } + + @Override + protected void onClear() { + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphParrot.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphParrot.java new file mode 100644 index 000000000..14f4c9212 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphParrot.java @@ -0,0 +1,56 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.MathUtils; +import be.isach.ultracosmetics.util.SoundUtil; +import be.isach.ultracosmetics.util.Sounds; +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + +/** + * Represents an instance of a parrot morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphParrot extends Morph { + public MorphParrot(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("parrot"), ultraCosmetics); + } + + @Override + protected void onEquip() { + super.onEquip(); + getPlayer().setAllowFlight(true); + } + + @Override + public void onUpdate() { + } + + @EventHandler + public void onPlayerToggleFlight(PlayerToggleFlightEvent event) { + if (event.getPlayer() == getPlayer() + && event.getPlayer().getGameMode() != GameMode.CREATIVE + && !event.getPlayer().isFlying()) { + Vector v = event.getPlayer().getLocation().getDirection(); + v.setY(0.75); + MathUtils.applyVelocity(getPlayer(), v); + event.getPlayer().setFlying(false); + event.setCancelled(true); + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_PARROT_FLY, 0.4f, 1.0f); + } + } + + @Override + public void onClear() { + if (getPlayer().getGameMode() != GameMode.CREATIVE) { + getPlayer().setAllowFlight(false); + } + } +} \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPig.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPig.java index f7c28bf6b..0d514dd1e 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPig.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPig.java @@ -19,11 +19,10 @@ * @since 08-27-2015 */ public class MorphPig extends Morph { - private boolean cooldown = false; public MorphPig(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.PIG, ultraCosmetics); + super(owner, MorphType.valueOf("pig"), ultraCosmetics); } @Override @@ -52,6 +51,5 @@ public void onUpdate() { @Override protected void onClear() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPolarBear.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPolarBear.java new file mode 100644 index 000000000..041b8610a --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphPolarBear.java @@ -0,0 +1,85 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +/** + * Represents an instance of a polar bear morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphPolarBear extends Morph { + private long coolDown = 0; + private boolean active; + private Location location; + private Vector vector; + + public MorphPolarBear(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("polarbear"), ultraCosmetics); + } + + @EventHandler + public void onLeftClick(PlayerInteractEvent event) { + if ((event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + && event.getPlayer() == getPlayer()) { + if (coolDown > System.currentTimeMillis()) return; + event.setCancelled(true); + coolDown = System.currentTimeMillis() + 15000; + vector = getPlayer().getLocation().getDirection().normalize().multiply(0.3); + vector.setY(0); + location = getPlayer().getLocation().subtract(0, 1, 0).add(vector); + active = true; + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> active = false, 40); + } + } + + @Override + public void onUpdate() { + if (active) { + if (location.getBlock().getType() != Material.AIR && location.getBlock().getType().isSolid()) { + location.add(0, 1, 0); + } + + if (location.clone().subtract(0, 1, 0).getBlock().getType() == Material.AIR) { + if (location.clone().getBlock().getTypeId() != 43 && location.clone().getBlock().getTypeId() != 44) + location.add(0, -1, 0); + } + + for (int i = 0; i < 3; i++) { + UltraCosmeticsData.get().getVersionManager().getEntityUtil() + .sendBlizzard(getPlayer(), location, false, vector); + } + + location.add(vector); + } else { + location = null; + vector = null; + } + } + + @Override + protected void onClear() { + active = false; + if (getOwner() != null && getPlayer() != null) { + UltraCosmeticsData.get().getVersionManager().getEntityUtil().clearBlizzard(getPlayer()); + } + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSheep.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSheep.java new file mode 100644 index 000000000..eed0f5a6f --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSheep.java @@ -0,0 +1,58 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.SoundUtil; +import be.isach.ultracosmetics.util.Sounds; +import me.libraryaddict.disguise.disguisetypes.watchers.SheepWatcher; +import org.bukkit.Bukkit; +import org.bukkit.DyeColor; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import java.util.Random; + +/** + * Represents an instance of a sheep morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphSheep extends Morph { + private long coolDown = 0; + private Random r = new Random(); + private int count = 0; + + public MorphSheep(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("sheep"), ultraCosmetics); + } + + @EventHandler + public void onLeftClick(PlayerInteractEvent event) { + if ((event.getAction() == Action.LEFT_CLICK_AIR + || event.getAction() == Action.LEFT_CLICK_BLOCK) && event.getPlayer() == getPlayer()) { + if (coolDown > System.currentTimeMillis()) return; + event.setCancelled(true); + SoundUtil.playSound(event.getPlayer().getLocation(), Sounds.SHEEP_IDLE, 1.0F, 1.0F); + SheepWatcher sheepWatcher = (SheepWatcher) getDisguise().getWatcher(); + Bukkit.getScheduler().runTaskTimer(getUltraCosmetics(), () -> { + if (count > 9) { + cancel(); + } + sheepWatcher.setColor(DyeColor.values()[r.nextInt(DyeColor.values().length)]); + count++; + }, 0, 2); + coolDown = System.currentTimeMillis() + 2000; + } + } + + @Override + public void onUpdate() { + } + + @Override + protected void onClear() { + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSlime.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSlime.java index 308925a89..8f44fa2f6 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSlime.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSlime.java @@ -19,11 +19,10 @@ * @since 08-26-2015 */ public class MorphSlime extends Morph { - private boolean cooldown; public MorphSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.SLIME, ultraCosmetics); + super(owner, MorphType.valueOf("slime"), ultraCosmetics); } @EventHandler @@ -56,11 +55,9 @@ protected void onEquip() { @Override public void onUpdate() { - } @Override protected void onClear() { - } } \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSnowman.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSnowman.java index a64c7f9f3..2eaad9120 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSnowman.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphSnowman.java @@ -19,7 +19,7 @@ public class MorphSnowman extends Morph { private long coolDown = 0; public MorphSnowman(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.SNOWNMAN, ultraCosmetics); + super(owner, MorphType.valueOf("snowman"), ultraCosmetics); } @EventHandler @@ -35,11 +35,9 @@ public void onLeftClick(PlayerInteractEvent event) { @Override public void onUpdate() { - } @Override protected void onClear() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphVillager.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphVillager.java new file mode 100644 index 000000000..55e36da3e --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphVillager.java @@ -0,0 +1,52 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import be.isach.ultracosmetics.util.SoundUtil; +import be.isach.ultracosmetics.util.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +/** + * Represents an instance of a villager morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphVillager extends Morph { + private long coolDown = 0; + + public MorphVillager(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("villager"), ultraCosmetics); + } + + @EventHandler + public void onLeftClick(PlayerInteractEvent event) { + if ((event.getAction() == Action.LEFT_CLICK_AIR + || event.getAction() == Action.LEFT_CLICK_BLOCK) && event.getPlayer() == getPlayer()) { + if (coolDown > System.currentTimeMillis()) return; + event.setCancelled(true); + SoundUtil.playSound(event.getPlayer(), Sounds.ORB_PICKUP); + Item emerald = getPlayer().getWorld().dropItem(getPlayer().getEyeLocation(), ItemFactory.create(Material.EMERALD, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + emerald.setPickupDelay(30000); + emerald.setVelocity(getPlayer().getEyeLocation().getDirection().multiply(1.5)); + coolDown = System.currentTimeMillis() + 5000; + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), emerald::remove, 80); + } + } + + @Override + public void onUpdate() { + } + + @Override + protected void onClear() { + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitch.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitch.java new file mode 100644 index 000000000..a32a31dff --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitch.java @@ -0,0 +1,51 @@ +package be.isach.ultracosmetics.cosmetics.morphs; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.cosmetics.type.MorphType; +import be.isach.ultracosmetics.player.UltraPlayer; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +/** + * Represents an instance of a witch morph summoned by a player. + * + * @author RadBuilder + * @since 07-03-2017 + */ +public class MorphWitch extends Morph { + private static final List POTION_EFFECTS = new ArrayList<>(Arrays.asList(PotionEffectType.JUMP, PotionEffectType.LEVITATION, PotionEffectType.GLOWING, PotionEffectType.SPEED)); + private long coolDown = 0; + private Random r = new Random(); + + public MorphWitch(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, MorphType.valueOf("witch"), ultraCosmetics); + } + + @EventHandler + public void onLeftClick(PlayerInteractEvent event) { + if ((event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + && event.getPlayer() == getPlayer()) { + if (coolDown > System.currentTimeMillis()) return; + event.setCancelled(true); + ThrownPotion thrownPotion = getPlayer().launchProjectile(ThrownPotion.class); + thrownPotion.getEffects().add(new PotionEffect(POTION_EFFECTS.get(r.nextInt(POTION_EFFECTS.size())), 40, 1)); + } + } + + @Override + public void onUpdate() { + } + + @Override + protected void onClear() { + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitherSkeleton.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitherSkeleton.java index 8c3733f0d..ba4a25449 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitherSkeleton.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/morphs/MorphWitherSkeleton.java @@ -28,16 +28,14 @@ * @since 10-18-2015 */ public class MorphWitherSkeleton extends Morph { - boolean inCooldown; public MorphWitherSkeleton(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.WITHERSKELETON, ultraCosmetics); + super(owner, MorphType.valueOf("witherskeleton"), ultraCosmetics); } @Override public void onUpdate() { - } @EventHandler(priority = EventPriority.HIGHEST) @@ -67,6 +65,5 @@ public void onSneak(PlayerToggleSneakEvent event) { @Override protected void onClear() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/Mount.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/Mount.java index 6fe5e72ab..4e26d4490 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/Mount.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/Mount.java @@ -197,14 +197,14 @@ && getOwner().getCurrentMount() == this @EventHandler public void openInv(InventoryOpenEvent event) { - if (getType() == MountType.DRUGGEDHORSE - || getType() == MountType.ECOLOGISTHORSE - || getType() == MountType.GLACIALSTEED - || getType() == MountType.INFERNALHORROR - || getType() == MountType.MOUNTOFFIRE - || getType() == MountType.MOUNTOFWATER - || getType() == MountType.WALKINGDEAD - || getType() == MountType.RUDOLPH) { + if (getType() == MountType.valueOf("druggedhorse") + || getType() == MountType.valueOf("ecologisthorse") + || getType() == MountType.valueOf("glacialsteed") + || getType() == MountType.valueOf("infernalhorror") + || getType() == MountType.valueOf("mountoffire") + || getType() == MountType.valueOf("mountofwater") + || getType() == MountType.valueOf("walkingdead") + || getType() == MountType.valueOf("rudolph")) { if (getOwner() != null && getPlayer() != null && event.getPlayer() == getPlayer() diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDragon.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDragon.java index 75883821b..d6e99b3dc 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDragon.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDragon.java @@ -21,7 +21,7 @@ public class MountDragon extends Mount { public MountDragon(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.DRAGON, ultraCosmetics); + super(owner, MountType.valueOf("dragon"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDruggedHorse.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDruggedHorse.java index 6c29e7f9e..6ff4a1551 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDruggedHorse.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountDruggedHorse.java @@ -18,7 +18,7 @@ public class MountDruggedHorse extends MountHorse { public MountDruggedHorse(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.DRUGGEDHORSE, ultraCosmetics); + super(owner, MountType.valueOf("druggedhorse"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountEcologistHorse.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountEcologistHorse.java index 5c7def64a..51d7ad6ce 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountEcologistHorse.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountEcologistHorse.java @@ -27,7 +27,7 @@ public class MountEcologistHorse extends MountHorse { public MountEcologistHorse(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.ECOLOGISTHORSE, ultraCosmetics); + super(owner, MountType.valueOf("ecologisthorse"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountFlyingShip.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountFlyingShip.java deleted file mode 100644 index 0a028c697..000000000 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountFlyingShip.java +++ /dev/null @@ -1,147 +0,0 @@ -package be.isach.ultracosmetics.cosmetics.mounts; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.Particles; -import be.isach.ultracosmetics.util.SoundUtil; -import be.isach.ultracosmetics.util.Sounds; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.entity.Animals; -import org.bukkit.entity.Boat; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.vehicle.VehicleDestroyEvent; -import org.bukkit.util.Vector; - -/** - * Represents an instance of a flying ship mount. - * - * @author iSach - * @author Matthew - * @since 01-23-2016 - */ -public class MountFlyingShip extends Mount { - long nextAllowTime = 0; - Entity currentboom = null; - - public MountFlyingShip(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.FLYINGSHIP, ultraCosmetics); - } - - @Override - public void onUpdate() { - if (entity.getPassenger() == null) - clear(); - - Vector vector = getPlayer().getLocation().toVector(); - - double rotX = getPlayer().getLocation().getYaw(); - double rotY = getPlayer().getLocation().getPitch(); - - vector.setY(-Math.sin(Math.toRadians(rotY))); - - double h = Math.cos(Math.toRadians(rotY)); - - vector.setX(-h * Math.sin(Math.toRadians(rotX))); - vector.setZ(h * Math.cos(Math.toRadians(rotX))); - - UltraCosmeticsData.get().getVersionManager().getEntityUtil().moveShip(getPlayer(), entity, vector); - - if (currentboom != null) { - if (currentboom.isDead()) { - currentboom = null; - return; - } - SoundUtil.playSound(getPlayer(), Sounds.NOTE_STICKS); - if (currentboom.isOnGround()) { - Location l = currentboom.getLocation().clone(); - - for (Entity i : currentboom.getNearbyEntities(3, 3, 3)) { - double dX = i.getLocation().getX() - currentboom.getLocation().getX(); - double dY = i.getLocation().getY() - currentboom.getLocation().getY(); - double dZ = i.getLocation().getZ() - currentboom.getLocation().getZ(); - double yaw = Math.atan2(dZ, dX); - double pitch = Math.atan2(Math.sqrt(dZ * dZ + dX * dX), dY) + Math.PI; - double X = Math.sin(pitch) * Math.cos(yaw); - double Y = Math.sin(pitch) * Math.sin(yaw); - double Z = Math.cos(pitch); - MathUtils.applyVelocity(i, new Vector(X, Z, Y).multiply(1.3D).add(new Vector(0, 1.4D, 0))); - } - UtilParticles.display(Particles.EXPLOSION_HUGE, l); - SoundUtil.playSound(l, Sounds.EXPLODE); - currentboom.remove(); - currentboom = null; - } - } - } - - @EventHandler - public void stopBoatDamage(EntityExplodeEvent event) { - if (event.getEntity() == entity) - event.setCancelled(true); - } - - @EventHandler - public void onInteractEvent(PlayerInteractEvent event) { - if (event.getAction() == Action.PHYSICAL) { - return; - } - if (event.getPlayer() != getPlayer()) { - return; - } - if (event.getPlayer().getVehicle() == null || event.getPlayer().getVehicle() != entity) { - return; - } - - if (System.currentTimeMillis() < nextAllowTime) { - SoundUtil.playSound(getPlayer().getLocation(), Sounds.ITEM_PICKUP, 1.0f, 1.0f); - return; - } - - SoundUtil.playSound(getPlayer(), Sounds.NOTE_STICKS, 1.0f, 1.0f); - nextAllowTime = System.currentTimeMillis() + 10000; - currentboom = getPlayer().getWorld().spawnEntity(getPlayer().getLocation(), EntityType.PRIMED_TNT); - currentboom.setCustomName(ChatColor.RED + ChatColor.BOLD.toString() + "!!!!!!!"); - currentboom.setCustomNameVisible(true); - - if (currentboom instanceof LivingEntity) { - ((LivingEntity) currentboom).setNoDamageTicks(-1); - if (currentboom instanceof Animals) { - ((Animals) currentboom).setBreed(false); - } - } - } - - @EventHandler - public void onEntityDamage(EntityDamageByEntityEvent event) { - if (event.getDamager() == entity) { - event.setCancelled(true); - } - } - - @EventHandler - public void onBoatBreak(VehicleDestroyEvent event) { - if (event.getVehicle() == entity) { - event.setCancelled(true); - } - } - - @Override - public void onClear() { - if (currentboom != null) { - currentboom.remove(); - } - super.onClear(); - } -} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountGlacialSteed.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountGlacialSteed.java index e8b43e049..8c94c32a9 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountGlacialSteed.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountGlacialSteed.java @@ -23,7 +23,7 @@ public class MountGlacialSteed extends MountHorse { public MountGlacialSteed(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.GLACIALSTEED, ultraCosmetics); + super(owner, MountType.valueOf("glacialsteed"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountHypeCart.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountHypeCart.java index 7ab337fdd..b60ae6d0a 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountHypeCart.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountHypeCart.java @@ -18,7 +18,7 @@ public class MountHypeCart extends Mount { public MountHypeCart(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.HYPECART, ultraCosmetics); + super(owner, MountType.valueOf("hypecart"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountMoltenSnake.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountMoltenSnake.java index cc8f55501..5ed9dddea 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountMoltenSnake.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountMoltenSnake.java @@ -31,7 +31,7 @@ public class MountMoltenSnake extends Mount { private float lastPitch; public MountMoltenSnake(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.MOLTENSNAKE, ultraCosmetics); + super(owner, MountType.valueOf("moltensnake"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountNyanSheep.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountNyanSheep.java index d355fa994..acb8797ba 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountNyanSheep.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountNyanSheep.java @@ -24,7 +24,7 @@ public class MountNyanSheep extends Mount { public MountNyanSheep(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.NYANSHEEP, ultraCosmetics); + super(owner, MountType.valueOf("nyansheep"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfFire.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfFire.java index 941458e35..851544bb5 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfFire.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfFire.java @@ -26,7 +26,7 @@ public class MountOfFire extends MountHorse { public MountOfFire(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.MOUNTOFFIRE, ultraCosmetics); + super(owner, MountType.valueOf("mountoffire"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfWater.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfWater.java index c60fb063a..760a7c47f 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfWater.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountOfWater.java @@ -27,7 +27,7 @@ public class MountOfWater extends MountHorse { public MountOfWater(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.MOUNTOFWATER, ultraCosmetics); + super(owner, MountType.valueOf("mountofwater"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountSnake.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountSnake.java index 39eba9e59..954cd95d5 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountSnake.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/mounts/MountSnake.java @@ -32,7 +32,7 @@ public class MountSnake extends Mount { public MountSnake(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SNAKE, ultraCosmetics); + super(owner, MountType.valueOf("snake"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffect.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffect.java index 32b3b26a3..52c86d189 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffect.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffect.java @@ -47,16 +47,16 @@ public void run() { if (Bukkit.getPlayer(getOwnerUniqueId()) != null && getOwner().getCurrentParticleEffect() != null && getOwner().getCurrentParticleEffect().getType() == getType()) { - if (getType() != ParticleEffectType.FROZENWALK - && getType() != ParticleEffectType.ENCHANTED - && getType() != ParticleEffectType.MUSIC - && getType() != ParticleEffectType.SANTAHAT - && getType() != ParticleEffectType.FLAMEFAIRY - && getType() != ParticleEffectType.ENDERAURA) { + if (getType() != ParticleEffectType.valueOf("frozenwalk") + && getType() != ParticleEffectType.valueOf("enchanted") + && getType() != ParticleEffectType.valueOf("music") + && getType() != ParticleEffectType.valueOf("santahat") + && getType() != ParticleEffectType.valueOf("flamefairy") + && getType() != ParticleEffectType.valueOf("enderaura")) { if (!isMoving() || ignoreMove) onUpdate(); if (isMoving()) { - boolean c = getType() == ParticleEffectType.ANGELWINGS; + boolean c = getType() == ParticleEffectType.valueOf("angelwings"); if (getType().getEffect() == Particles.REDSTONE) { if (!ignoreMove) { for (int i = 0; i < 15; i++) { diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectAngelWings.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectAngelWings.java index f8301692d..bdf65eda8 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectAngelWings.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectAngelWings.java @@ -19,7 +19,7 @@ public class ParticleEffectAngelWings extends ParticleEffect { boolean o = false; public ParticleEffectAngelWings(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.ANGELWINGS); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("angelwings")); } private boolean[][] shape = { diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectBloodHelix.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectBloodHelix.java index 135afb9fd..f9241075c 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectBloodHelix.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectBloodHelix.java @@ -19,7 +19,7 @@ public class ParticleEffectBloodHelix extends ParticleEffect { double i = 0; public ParticleEffectBloodHelix(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.BLOODHELIX); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("bloodhelix")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectCrushedCandyCane.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectCrushedCandyCane.java index 355972985..d1c450857 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectCrushedCandyCane.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectCrushedCandyCane.java @@ -22,7 +22,7 @@ public class ParticleEffectCrushedCandyCane extends ParticleEffect { private static Random random = new Random(); public ParticleEffectCrushedCandyCane(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.CRUSHEDCANDYCANE); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("crushedcandycane")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnchanted.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnchanted.java index 4dcdbd0c3..bb6337deb 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnchanted.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnchanted.java @@ -16,7 +16,7 @@ public class ParticleEffectEnchanted extends ParticleEffect { public ParticleEffectEnchanted(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.ENCHANTED); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("enchanted")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnderAura.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnderAura.java index 477909fc9..ace181bbb 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnderAura.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectEnderAura.java @@ -14,7 +14,7 @@ public class ParticleEffectEnderAura extends ParticleEffect { public ParticleEffectEnderAura(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.ENDERAURA); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("enderaura")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameFairy.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameFairy.java index 5092247cf..a22fc271e 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameFairy.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameFairy.java @@ -24,7 +24,7 @@ public class ParticleEffectFlameFairy extends ParticleEffect { public double noMoveTime = 0, movementSpeed = 0.2d; public ParticleEffectFlameFairy(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.FLAMEFAIRY); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("flamefairy")); currentLocation = getPlayer().getLocation(); targetLocation = generateNewTarget(); diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameRings.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameRings.java index 6ca7657c9..4ea73a607 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameRings.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFlameRings.java @@ -18,7 +18,7 @@ public class ParticleEffectFlameRings extends ParticleEffect { float step = 0; public ParticleEffectFlameRings(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.FLAMERINGS); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("flamerings")); } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrostLord.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrostLord.java index cad04da22..6f6912148 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrostLord.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrostLord.java @@ -22,7 +22,7 @@ public class ParticleEffectFrostLord extends ParticleEffect { float radius = 1.5f; public ParticleEffectFrostLord(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.FROSTLORD); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("frostlord")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrozenWalk.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrozenWalk.java index fa09c089c..bf18ef60a 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrozenWalk.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectFrozenWalk.java @@ -17,7 +17,7 @@ public class ParticleEffectFrozenWalk extends ParticleEffect { public ParticleEffectFrozenWalk(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.FROZENWALK); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("frozenwalk")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectGreenSparks.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectGreenSparks.java index 6cabbfabe..05a498072 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectGreenSparks.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectGreenSparks.java @@ -19,7 +19,7 @@ public class ParticleEffectGreenSparks extends ParticleEffect { int step; public ParticleEffectGreenSparks(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.GREENSPARKS); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("greensparks")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInLove.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInLove.java index 88df78422..f1a5496df 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInLove.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInLove.java @@ -14,7 +14,7 @@ public class ParticleEffectInLove extends ParticleEffect { public ParticleEffectInLove(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.INLOVE); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("inlove")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInferno.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInferno.java index da65c414d..e72373456 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInferno.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectInferno.java @@ -19,7 +19,7 @@ public class ParticleEffectInferno extends ParticleEffect { int[] steps = { 0, 0, 0, 0 }; public ParticleEffectInferno(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.INFERNO); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("inferno")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectMusic.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectMusic.java index 82733f022..3d846117a 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectMusic.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectMusic.java @@ -17,7 +17,7 @@ public class ParticleEffectMusic extends ParticleEffect { public ParticleEffectMusic(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.MUSIC); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("music")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectRainCloud.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectRainCloud.java index a362cefb0..1d79d1f48 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectRainCloud.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectRainCloud.java @@ -15,7 +15,7 @@ public class ParticleEffectRainCloud extends ParticleEffect { public ParticleEffectRainCloud(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.RAINCLOUD); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("raincloud")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSantaHat.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSantaHat.java index a9e5213a2..542fad69e 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSantaHat.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSantaHat.java @@ -18,7 +18,7 @@ public class ParticleEffectSantaHat extends ParticleEffect { public int particles = 12; public ParticleEffectSantaHat(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.SANTAHAT); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("santahat")); this.ignoreMove = true; } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSnowCloud.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSnowCloud.java index d648b0e06..c24eb9257 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSnowCloud.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSnowCloud.java @@ -15,7 +15,7 @@ public class ParticleEffectSnowCloud extends ParticleEffect { public ParticleEffectSnowCloud(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.SNOWCLOUD); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("snowcloud")); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSuperHero.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSuperHero.java index cc2bd416f..a93c426d3 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSuperHero.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/particleeffects/ParticleEffectSuperHero.java @@ -19,7 +19,7 @@ public class ParticleEffectSuperHero extends ParticleEffect { boolean x = true; public ParticleEffectSuperHero(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(ultraCosmetics, owner, ParticleEffectType.SUPERHERO); + super(ultraCosmetics, owner, ParticleEffectType.valueOf("superhero")); this.ignoreMove = true; } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/Pet.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/Pet.java index 88a6fc9ec..95a24ec5f 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/Pet.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/Pet.java @@ -10,18 +10,17 @@ import be.isach.ultracosmetics.player.UltraPlayer; import be.isach.ultracosmetics.util.EntitySpawningManager; import org.bukkit.Bukkit; -import org.bukkit.entity.Ageable; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.util.Vector; import java.util.ArrayList; +import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -56,10 +55,18 @@ public abstract class Pet extends Cosmetic implements Updatable { * If Pet is a normal entity, it will be stored here. */ public Entity entity; + + /** + * The {@link org.bukkit.inventory.ItemStack ItemStack} this pet drops, null if none. + */ + private ItemStack dropItem; + + private Random r = new Random(); - public Pet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { + public Pet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { super(ultraCosmetics, Category.PETS, owner, petType); - + + this.dropItem = dropItem; this.pathUpdater = Executors.newSingleThreadExecutor(); } @@ -204,6 +211,18 @@ public IPlayerFollower getFollowTask() { public Entity getEntity() { return entity; } + + @Override + public void onUpdate() { + final Item drop = entity.getWorld().dropItem(((LivingEntity) entity).getEyeLocation(), dropItem); + drop.setPickupDelay(30000); + drop.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); + items.add(drop); + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { + drop.remove(); + items.remove(drop); + }, 5); + } @EventHandler public void onEntityDamage(EntityDamageEvent event) { diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetBat.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetBat.java new file mode 100644 index 000000000..8c6ab038b --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetBat.java @@ -0,0 +1,26 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Bat; +import org.bukkit.entity.Item; +import org.bukkit.util.Vector; + +import java.util.Random; + +/** + * Represents an instance of a bat pet summoned by a player. + * + * @author RadBuilder + * @since 07-02-2017 + */ +public class PetBat extends Pet { + public PetBat(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("bat"), ItemFactory.create(Material.COAL, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChick.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChick.java index 9075f2f02..0c6420792 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChick.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChick.java @@ -21,18 +21,7 @@ * @since 08-12-2015 */ public class PetChick extends Pet { - - Random r = new Random(); - public PetChick(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.CHICK); + super(owner, ultraCosmetics, PetType.getByName("chick"), ItemFactory.create(Material.EGG, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); } - - @Override - public void onUpdate() { - final Item ITEM = entity.getWorld().dropItem(((Chicken) entity).getEyeLocation(), ItemFactory.create(Material.EGG, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), ITEM::remove, 5); - } -} +} \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChristmasElf.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChristmasElf.java index 9e0de8ddb..ec4f487d7 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChristmasElf.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetChristmasElf.java @@ -17,10 +17,7 @@ import org.bukkit.util.Vector; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.UUID; +import java.util.*; /** * Represents an instance of a Christmas Elf pet summoned by a player. @@ -29,41 +26,41 @@ * @since 11-29-2015 */ public class PetChristmasElf extends Pet { + private static List presents = new ArrayList<>(Arrays.asList( + getSkull("f5612dc7b86d71afc1197301c15fd979e9f39e7b1f41d8f1ebdf8115576e2e"), + getSkull("6b4cde16a4014de0a7651f6067f12695bb5fed6feaec1e9413ca4271e7c819"), + getSkull("d08ce7deba56b726a832b61115ca163361359c30434f7d5e3c3faa6fe4052"), + getSkull("928e692d86e224497915a39583dbe38edffd39cbba457cc95a7ac3ea25d445"), + getSkull("1b6730de7e5b941efc6e8cbaf5755f9421a20de871759682cd888cc4a81282"), + getSkull("1ac1163f54dcbb0e8e31ac675696f2409299c5abbf6c3fe73bf1cfe91422e1"), + getSkull("6cef9aa14e884773eac134a4ee8972063f466de678363cf7b1a21a85b7"), + getSkull("aa074845885202e17ed5c4be4103733121235c5440ae3a1c49fbd39317b04d"))); - private static List presents = new ArrayList<>(); - - static { - presents.add(getSkull("f5612dc7b86d71afc1197301c15fd979e9f39e7b1f41d8f1ebdf8115576e2e", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("6b4cde16a4014de0a7651f6067f12695bb5fed6feaec1e9413ca4271e7c819", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("d08ce7deba56b726a832b61115ca163361359c30434f7d5e3c3faa6fe4052", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("928e692d86e224497915a39583dbe38edffd39cbba457cc95a7ac3ea25d445", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("1b6730de7e5b941efc6e8cbaf5755f9421a20de871759682cd888cc4a81282", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("1ac1163f54dcbb0e8e31ac675696f2409299c5abbf6c3fe73bf1cfe91422e1", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("6cef9aa14e884773eac134a4ee8972063f466de678363cf7b1a21a85b7", UltraCosmeticsData.get().getItemNoPickupString())); - presents.add(getSkull("aa074845885202e17ed5c4be4103733121235c5440ae3a1c49fbd39317b04d", UltraCosmeticsData.get().getItemNoPickupString())); - } - - Random r = new Random(); + private Random r = new Random(); public PetChristmasElf(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.CHRISTMASELF); + super(owner, ultraCosmetics, PetType.getByName("christmaself"), presents.get(0)); } @Override public void onUpdate() { - final Item ITEM = entity.getWorld().dropItem(((Villager) entity).getEyeLocation(), presents.get(r.nextInt(presents.size()))); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), ITEM::remove, 5); + final Item drop = entity.getWorld().dropItem(((Villager) entity).getEyeLocation(), presents.get(r.nextInt(presents.size()))); + drop.setPickupDelay(30000); + drop.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); + items.add(drop); + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { + drop.remove(); + items.remove(drop); + }, 5); } - private static ItemStack getSkull(String url, String name) { + private static ItemStack getSkull(String url) { url = "http://textures.minecraft.net/texture/" + url; ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); if (url == null || url.isEmpty()) return skull; SkullMeta skullMeta = (SkullMeta) skull.getItemMeta(); - skullMeta.setDisplayName(name); + skullMeta.setDisplayName(UltraCosmeticsData.get().getItemNoPickupString()); GameProfile profile = new GameProfile(UUID.randomUUID(), null); byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes()); profile.getProperties().put("textures", new Property("textures", new String(encodedData))); diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetCow.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetCow.java index 0cb5e33ff..26e7069bf 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetCow.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetCow.java @@ -20,18 +20,7 @@ * @since 08-12-2015 */ public class PetCow extends Pet { - - Random r = new Random(); - public PetCow(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.COW); + super(owner, ultraCosmetics, PetType.getByName("cow"), ItemFactory.create(Material.MILK_BUCKET, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); } - - @Override - public void onUpdate() { - final Item ITEM = entity.getWorld().dropItem(((Cow) entity).getEyeLocation(), ItemFactory.create(Material.MILK_BUCKET, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), ITEM::remove, 5); - } -} +} \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetDog.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetDog.java index 88a1297c9..ede911465 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetDog.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetDog.java @@ -26,7 +26,7 @@ public class PetDog extends Pet { Random r = new Random(); public PetDog(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.DOG); + super(owner, ultraCosmetics, PetType.getByName("dog"), ItemFactory.create(Material.BONE, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { if (getOwner() != null && getEntity() != null) { Wolf w = (Wolf) entity; @@ -38,15 +38,15 @@ public PetDog(UltraPlayer owner, UltraCosmetics ultraCosmetics) { @Override public void onUpdate() { - Wolf w = (Wolf) entity; - w.setCollarColor(DyeColor.values()[r.nextInt(15)]); - final Item ITEM = entity.getWorld().dropItem(((Wolf) entity).getEyeLocation(), ItemFactory.create(Material.BONE, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); + Wolf wolf = (Wolf) entity; + wolf.setCollarColor(DyeColor.values()[r.nextInt(15)]); + final Item drop = entity.getWorld().dropItem(((Wolf) entity).getEyeLocation(), ItemFactory.create(Material.BONE, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + drop.setPickupDelay(30000); + drop.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); + items.add(drop); Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); + drop.remove(); + items.remove(drop); }, 5); } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetEasterBunny.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetEasterBunny.java index 932232cb2..e94d47836 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetEasterBunny.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetEasterBunny.java @@ -12,8 +12,8 @@ import org.bukkit.util.Vector; import java.util.ArrayList; +import java.util.Arrays; import java.util.Random; -import java.util.UUID; /** * Represents an instance of an easter bunny pet summoned by a player. @@ -22,32 +22,22 @@ * @since 08-12-2015 */ public class PetEasterBunny extends Pet { - - ArrayList eggDatas = new ArrayList<>(); - Random r = new Random(); + private static final ArrayList EGG_DATA = new ArrayList<>(Arrays.asList((byte) 0x32, (byte) 0x3d, (byte) 0x5e, (byte) 0x36, (byte) 0x3a, (byte) 0x38, (byte) 0x62)); + private Random r = new Random(); public PetEasterBunny(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.EASTERBUNNY); - if (owner != null) { - eggDatas.add((byte) 0x32); - eggDatas.add((byte) 0x3d); - eggDatas.add((byte) 0x5e); - eggDatas.add((byte) 0x36); - eggDatas.add((byte) 0x3a); - eggDatas.add((byte) 0x38); - eggDatas.add((byte) 0x62); - } + super(owner, ultraCosmetics, PetType.getByName("easterbunny"), ItemFactory.create(Material.MONSTER_EGG, EGG_DATA.get(0), UltraCosmeticsData.get().getItemNoPickupString())); } @Override public void onUpdate() { - final Item ITEM = entity.getWorld().dropItem(((Rabbit) entity).getEyeLocation(), ItemFactory.create(Material.MONSTER_EGG, eggDatas.get(r.nextInt(6)), UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); + final Item drop = entity.getWorld().dropItem(((Rabbit) entity).getEyeLocation(), ItemFactory.create(Material.MONSTER_EGG, EGG_DATA.get(r.nextInt(6)), UltraCosmeticsData.get().getItemNoPickupString())); + drop.setPickupDelay(30000); + drop.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); + items.add(drop); Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); + drop.remove(); + items.remove(drop); }, 5); } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetIronGolem.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetIronGolem.java new file mode 100644 index 000000000..87e067c8c --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetIronGolem.java @@ -0,0 +1,27 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.IronGolem; +import org.bukkit.entity.Item; +import org.bukkit.util.Vector; + +import java.util.Random; + +/** + * Represents an instance of an iron golem pet summoned by a player. + * + * @author RadBuilder + * @since 07-02-2017 + */ +public class PetIronGolem extends Pet { + public PetIronGolem(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("irongolem"), ItemFactory.create(Material.RED_ROSE, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetKitty.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetKitty.java index 768345ce9..37dbec52a 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetKitty.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetKitty.java @@ -21,11 +21,8 @@ * @since 08-12-2015 */ public class PetKitty extends Pet { - - Random r = new Random(); - public PetKitty(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.KITTY); + super(owner, ultraCosmetics, PetType.getByName("kitty"), ItemFactory.create(Material.RAW_FISH, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { if (getOwner() != null && getEntity() != null) { Ocelot ocelot = (Ocelot) getEntity(); @@ -35,16 +32,4 @@ public PetKitty(UltraPlayer owner, UltraCosmetics ultraCosmetics) { } }, 30); } - - @Override - public void onUpdate() { - final Item item = entity.getWorld().dropItem(((Ocelot) entity).getEyeLocation(), ItemFactory.create(Material.RAW_FISH, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(item); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - item.remove(); - items.remove(item); - }, 5); - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetLlama.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetLlama.java new file mode 100644 index 000000000..b5ee22a42 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetLlama.java @@ -0,0 +1,32 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Llama; +import org.bukkit.util.Vector; + +import java.util.Random; + +/** + * Represents an instance of a llama pet summoned by a player. + * + * @author RadBuilder + * @since 07-02-2017 + */ +public class PetLlama extends Pet { + public PetLlama(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("llama"), ItemFactory.create(Material.WOOL, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { + if (getOwner() != null && getEntity() != null) { + Llama llama = (Llama) entity; + llama.setTamed(true); + } + }, 30); + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetMooshroom.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetMooshroom.java index f5285e7e9..8eb88ec1b 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetMooshroom.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetMooshroom.java @@ -21,17 +21,7 @@ * @since 06-26-2015 */ public class PetMooshroom extends Pet { - Random r = new Random(); - public PetMooshroom(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.MOOSHROOM); - } - - @Override - public void onUpdate() { - Item item = entity.getWorld().dropItem(((MushroomCow) entity).getEyeLocation(), ItemFactory.create(Material.RED_MUSHROOM, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), item::remove, 5); + super(owner, ultraCosmetics, PetType.getByName("mooshroom"), ItemFactory.create(Material.RED_MUSHROOM, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetParrot.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetParrot.java new file mode 100644 index 000000000..d9db9c8e0 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetParrot.java @@ -0,0 +1,33 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Parrot; +import org.bukkit.util.Vector; + +import java.util.Random; + +/** + * Represents an instance of a parrot pet summoned by a player. + * + * @author RadBuilder + * @since 07-02-2017 + */ +public class PetParrot extends Pet { + public PetParrot(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("parrot"), ItemFactory.create(Material.COOKIE, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { + if (getOwner() != null && getEntity() != null) { + Parrot parrot = (Parrot) entity; + parrot.setTamed(true); + parrot.setSitting(false); + } + }, 30); + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPiggy.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPiggy.java index 53e0d0b96..c141ab72c 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPiggy.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPiggy.java @@ -21,19 +21,7 @@ * @since 08-12-2015 */ public class PetPiggy extends Pet { - - Random r = new Random(); - public PetPiggy(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.PIGGY); - } - - @Override - public void onUpdate() { - Pig pig = (Pig) entity; - Item item = entity.getWorld().dropItem(pig.getEyeLocation(), ItemFactory.create(Material.PORK, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), item::remove, 5); + super(owner, ultraCosmetics, PetType.getByName("piggy"), ItemFactory.create(Material.PORK, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPolarBear.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPolarBear.java new file mode 100644 index 000000000..6e23940a3 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetPolarBear.java @@ -0,0 +1,20 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Material; + +/** + * Represents an instance of a polar bear pet summoned by a player. + * + * @author RadBuilder + * @since 10-21-2017 + */ +public class PetPolarBear extends Pet { + public PetPolarBear(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("polarbear"), ItemFactory.create(Material.SNOW_BLOCK, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSheep.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSheep.java index 6c5722671..a6a0b998d 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSheep.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSheep.java @@ -25,15 +25,19 @@ public class PetSheep extends Pet { Random r = new Random(); public PetSheep(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.SHEEP); + super(owner, ultraCosmetics, PetType.getByName("sheep"), ItemFactory.create(Material.WOOL, (byte) 0, UltraCosmeticsData.get().getItemNoPickupString())); } @Override public void onUpdate() { Sheep sheep = (Sheep) entity; - Item item = entity.getWorld().dropItem(sheep.getEyeLocation(), ItemFactory.create(Material.WOOL, (byte) r.nextInt(16), UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), item::remove, 5); + Item drop = entity.getWorld().dropItem(sheep.getEyeLocation(), ItemFactory.create(Material.WOOL, (byte) r.nextInt(16), UltraCosmeticsData.get().getItemNoPickupString())); + drop.setPickupDelay(30000); + drop.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); + items.add(drop); + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { + drop.remove(); + items.remove(drop); + }, 5); } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSnowman.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSnowman.java new file mode 100644 index 000000000..93ab87669 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetSnowman.java @@ -0,0 +1,32 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Snowman; +import org.bukkit.util.Vector; + +import java.util.Random; + +/** + * Represents an instance of a snowman pet summoned by a player. + * + * @author RadBuilder + * @since 07-02-2017 + */ +public class PetSnowman extends Pet { + public PetSnowman(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("snowman"), ItemFactory.create(Material.SNOW_BALL, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { + if (getOwner() != null && getEntity() != null) { + Snowman snowman = (Snowman) getEntity(); + snowman.setDerp(false); + } + }, 30); + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetVillager.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetVillager.java new file mode 100644 index 000000000..20356522b --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetVillager.java @@ -0,0 +1,27 @@ +package be.isach.ultracosmetics.cosmetics.pets; + +import be.isach.ultracosmetics.UltraCosmetics; +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.cosmetics.type.PetType; +import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ItemFactory; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Villager; +import org.bukkit.util.Vector; + +import java.util.Random; + +/** + * Represents an instance of a villager pet summoned by a player. + * + * @author RadBuilder + * @since 07-02-2017 + */ +public class PetVillager extends Pet { + public PetVillager(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("villager"), + ItemFactory.create(Material.EMERALD, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); + } +} \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetWither.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetWither.java index 635e162b8..be7c4114b 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetWither.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/pets/PetWither.java @@ -15,7 +15,7 @@ public class PetWither extends Pet { public PetWither(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.WITHER); + super(owner, ultraCosmetics, PetType.getByName("wither"), null); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/ArmorSlot.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/ArmorSlot.java index e908b6409..de6337130 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/ArmorSlot.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/ArmorSlot.java @@ -19,6 +19,6 @@ public static ArmorSlot getByName(String s) { if (a.toString().equalsIgnoreCase(ChatColor.stripColor(s))) return a; } - return null; + return ArmorSlot.CHESTPLATE; } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitAstronaut.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitAstronaut.java index 4ba98e5c4..033efee2d 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitAstronaut.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitAstronaut.java @@ -11,13 +11,11 @@ * @since 12-20-2015 */ public class SuitAstronaut extends Suit { - public SuitAstronaut(UltraPlayer owner, ArmorSlot armorSlot, UltraCosmetics ultraCosmetics) { - super(owner, armorSlot, SuitType.ASTRONAUT, ultraCosmetics); + super(owner, armorSlot, SuitType.valueOf("astronaut"), ultraCosmetics); } @Override public void onUpdate() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitDiamond.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitDiamond.java index fe4922e3e..b7387ceea 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitDiamond.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitDiamond.java @@ -11,13 +11,11 @@ * @since 12-20-2015 */ public class SuitDiamond extends Suit { - public SuitDiamond(UltraPlayer owner, ArmorSlot armorSlot, UltraCosmetics ultraCosmetics) { - super(owner, armorSlot, SuitType.DIAMOND, ultraCosmetics); + super(owner, armorSlot, SuitType.valueOf("diamond"), ultraCosmetics); } @Override public void onUpdate() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitRave.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitRave.java index f94c66488..fc413dff4 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitRave.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitRave.java @@ -13,11 +13,10 @@ * @since 12-20-2015 */ public class SuitRave extends Suit { - private int[] colors = new int[]{ 255, 0, 0 }; public SuitRave(UltraPlayer owner, ArmorSlot armorSlot, UltraCosmetics ultraCosmetics) { - super(owner, armorSlot, SuitType.RAVE, ultraCosmetics); + super(owner, armorSlot, SuitType.valueOf("rave"), ultraCosmetics); } @Override diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitSanta.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitSanta.java index d60632ee8..350675640 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitSanta.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/suits/SuitSanta.java @@ -13,9 +13,8 @@ * @since 12-20-2015 */ public class SuitSanta extends Suit { - public SuitSanta(UltraPlayer owner, ArmorSlot armorSlot, UltraCosmetics ultraCosmetics) { - super(owner, armorSlot, SuitType.SANTA, ultraCosmetics); + super(owner, armorSlot, SuitType.valueOf("santa"), ultraCosmetics); } @Override @@ -29,6 +28,5 @@ protected void onEquip() { @Override public void onUpdate() { - } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticEntType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticEntType.java index 7406cf557..4a7b76093 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticEntType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticEntType.java @@ -2,6 +2,7 @@ import be.isach.ultracosmetics.cosmetics.Category; import be.isach.ultracosmetics.cosmetics.Cosmetic; +import be.isach.ultracosmetics.util.ServerVersion; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -11,14 +12,12 @@ * @author iSach * @since 08-04-2016 */ -public class CosmeticEntType extends CosmeticMatType { +public abstract class CosmeticEntType extends CosmeticMatType { private EntityType entityType; - public CosmeticEntType(Category category, String configName, String permission, - String description, Material material, byte data, - EntityType entityType, Class clazz) { - super(category, configName, permission, description, material, data, clazz); + public CosmeticEntType(Category category, String configName, String permission, String description, Material material, byte data, EntityType entityType, Class clazz, ServerVersion baseVersion) { + super(category, configName, permission, description, material, data, clazz, baseVersion); this.entityType = entityType; } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticMatType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticMatType.java index 244df6f61..bae5f4e23 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticMatType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticMatType.java @@ -2,6 +2,7 @@ import be.isach.ultracosmetics.cosmetics.Category; import be.isach.ultracosmetics.cosmetics.Cosmetic; +import be.isach.ultracosmetics.util.ServerVersion; import org.bukkit.Material; /** @@ -10,14 +11,12 @@ * @author iSach * @since 08-04-2016 */ -public class CosmeticMatType extends CosmeticType { - +public abstract class CosmeticMatType extends CosmeticType { private Material material; private byte data; - public CosmeticMatType(Category category, String configName, String permission, - String description, Material material, byte data, Class clazz) { - super(category, configName, permission, description, clazz); + public CosmeticMatType(Category category, String configName, String permission, String description, Material material, byte data, Class clazz, ServerVersion baseVersion) { + super(category, configName, permission, description, clazz, baseVersion); this.material = material; this.data = data; } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticType.java index 31b481b24..fa839f7f3 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/CosmeticType.java @@ -28,13 +28,15 @@ public abstract class CosmeticType { private String descriptionAsString; private Class clazz; private Category category; + private ServerVersion baseVersion; - public CosmeticType(Category category, String configName, String permission, String description, Class clazz) { + public CosmeticType(Category category, String configName, String permission, String description, Class clazz, ServerVersion baseVersion) { this.configName = configName; this.permission = permission; this.descriptionAsString = description; this.clazz = clazz; this.category = category; + this.baseVersion = baseVersion; if (SettingsManager.getConfig().get(getCategory().getConfigPath() + "." + configName + ".Description") == null) { setDescriptionAsString(description); @@ -55,9 +57,8 @@ public T equip(UltraPlayer player, UltraCosmetics ultraCosmetics) { } public boolean isEnabled() { - return !(this == GadgetType.ETHEREALPEARL - && (UltraCosmeticsData.get().getServerVersion() == ServerVersion.v1_11_R1 || UltraCosmeticsData.get().getServerVersion() == ServerVersion.v1_12_R1)) - && SettingsManager.getConfig().getBoolean(category.getConfigPath() + "." + configName + ".Enabled"); + return !(this == GadgetType.valueOf("etherealpearl") && (UltraCosmeticsData.get().getServerVersion() == ServerVersion.v1_11_R1 || UltraCosmeticsData.get().getServerVersion() == ServerVersion.v1_12_R1)) + && SettingsManager.getConfig().getBoolean(category.getConfigPath() + "." + configName + ".Enabled") && UltraCosmeticsData.get().getServerVersion().compareTo(baseVersion) >= 0; } public String getName() { diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/EmoteType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/EmoteType.java index d5cd50ef1..36ed9c8e0 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/EmoteType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/EmoteType.java @@ -5,6 +5,7 @@ import be.isach.ultracosmetics.cosmetics.Category; import be.isach.ultracosmetics.cosmetics.emotes.Emote; import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ServerVersion; import be.isach.ultracosmetics.util.TexturedSkullFactory; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -205,7 +206,7 @@ public static void checkEnabled() { private int ticksPerFrame; public EmoteType(String permission, String configName, String defaultDesc, int ticksPerFrame) { - super(Category.EMOTES, configName, permission, defaultDesc, Material.SKULL_ITEM, (byte) 3, Emote.class); + super(Category.EMOTES, configName, permission, defaultDesc, Material.SKULL_ITEM, (byte) 3, Emote.class, ServerVersion.v1_8_R1); this.ticksPerFrame = ticksPerFrame; this.frames = new ArrayList<>(); diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/GadgetType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/GadgetType.java index eb8947673..16138ded2 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/GadgetType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/GadgetType.java @@ -2,35 +2,8 @@ import be.isach.ultracosmetics.config.SettingsManager; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.gadgets.Gadget; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetAntiGravity; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetBatBlaster; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetBlackHole; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetBlizzardBlaster; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetChickenator; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetChristmasTree; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetColorBomb; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetDiscoBall; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetEtherealPearl; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetExplosiveSheep; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetFirework; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetFleshHook; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetFreezeCannon; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetFunGun; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetGhostParty; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetMelonThrower; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetPaintballGun; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetParachute; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetPartyPopper; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetPortalGun; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetQuakeGun; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetRocket; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetSmashDown; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetSnowball; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetTNT; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetThorHammer; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetTrampoline; -import be.isach.ultracosmetics.cosmetics.gadgets.GadgetTsunami; +import be.isach.ultracosmetics.cosmetics.gadgets.*; +import be.isach.ultracosmetics.util.ServerVersion; import org.bukkit.Material; import java.util.ArrayList; @@ -67,40 +40,11 @@ public static void checkEnabled() { ENABLED.addAll(values().stream().filter(CosmeticType::isEnabled).collect(Collectors.toList())); } - public static final GadgetType BATBLASTER = new GadgetType(Material.IRON_BARDING, (byte) 0, 8, "ultracosmetics.gadgets.batblaster", "BatBlaster", "&7&oLaunch waves of annoying bats\n&7&oto people you don't like!", GadgetBatBlaster.class); - public static final GadgetType CHICKENATOR = new GadgetType(Material.COOKED_CHICKEN, (byte) 0, 6, "ultracosmetics.gadgets.chickenator", "Chickenator", "&7&oShoot, boom, KFC.", GadgetChickenator.class); - public static final GadgetType COLORBOMB = new GadgetType(Material.WOOL, (byte) 3, 25, "ultracosmetics.gadgets.colorbomb", "ColorBomb", "&7&oA colorful bomb!", GadgetColorBomb.class); - public static final GadgetType DISCOBALL = new GadgetType(Material.BEACON, (byte) 0, 45, "ultracosmetics.gadgets.discoball", "DiscoBall", "&7&oJust, dance!", GadgetDiscoBall.class); - public static final GadgetType ETHEREALPEARL = new GadgetType(Material.ENDER_PEARL, (byte) 0, 2, "ultracosmetics.gadgets.etherealpearl", "EtherealPearl", "&7&oTake a ride through the skies" + "\n&7&oon your very own Ethereal Pearl!", GadgetEtherealPearl.class); - public static final GadgetType FLESHHOOK = new GadgetType(Material.TRIPWIRE_HOOK, (byte) 0, 5, "ultracosmetics.gadgets.fleshhook", "FleshHook", "&7&oMake new friends by throwing a hook" + "\n&7&ointo their face and pulling them\n&7&otowards you!", GadgetFleshHook.class); - public static final GadgetType MELONTHROWER = new GadgetType(Material.MELON_BLOCK, (byte) 0, 2, "ultracosmetics.gadgets.melonthrower", "MelonThrower", "&7&oDeliciously fun!", GadgetMelonThrower.class); - public static final GadgetType BLIZZARDBLASTER = new GadgetType(Material.PACKED_ICE, (byte) 0, 12, "ultracosmetics.gadgets.blizzardblaster", "BlizzardBlaster", "&7&oLet it go!", GadgetBlizzardBlaster.class); - public static final GadgetType PORTALGUN = new GadgetType(Material.REDSTONE_COMPARATOR, (byte) 0, 2, "ultracosmetics.gadgets.portalgun", "PortalGun", "&7&oMomentum, a function of " + "mass and velocity,\n&7&ois converved between portals. In Layman''s terms,\n&7&ospeedy thing goes in, speedy thing goes out.", GadgetPortalGun.class); - public static final GadgetType EXPLOSIVESHEEP = new GadgetType(Material.SHEARS, (byte) 0, 25, "ultracosmetics.gadgets.explosivesheep", "ExplosiveSheep", "&7&oAre you sure it's supposed\n&7&oto flicker like that?", GadgetExplosiveSheep.class); - public static final GadgetType PAINTBALLGUN = new GadgetType(Material.DIAMOND_BARDING, (byte) 0, 0.5, "ultracosmetics.gadgets.paintballgun", "PaintballGun", "&7&oPEW PEW PEW PEW!!!", GadgetPaintballGun.class); - public static final GadgetType THORHAMMER = new GadgetType(Material.IRON_AXE, (byte) 0, 8, "ultracosmetics.gadgets.thorhammer", "ThorHammer", "&7&oGet the real Mjölnir", GadgetThorHammer.class); - public static final GadgetType ANTIGRAVITY = new GadgetType(Material.EYE_OF_ENDER, (byte) 0, 30, "ultracosmetics.gadgets.antigravity", "AntiGravity", "&7&oYou don't like gravity?" + "\n&7&oThen, this gadget is made for you!", GadgetAntiGravity.class); - public static final GadgetType SMASHDOWN = new GadgetType(Material.FIREWORK_CHARGE, (byte) 0, 15, "ultracosmetics.gadgets.smashdown", "SmashDown", "&7&oAND HIS NAME IS... JOHN CENA!!", GadgetSmashDown.class); - public static final GadgetType ROCKET = new GadgetType(Material.FIREWORK, (byte) 0, 60, "ultracosmetics.gadgets.rocket", "Rocket", "&7&oHouston, we have got a problem..", GadgetRocket.class); - public static final GadgetType BLACKHOLE = new GadgetType(Material.STAINED_CLAY, (byte) 15, 35, "ultracosmetics.gadgets.blackhole", "BlackHole", "&7&oYou should not get caught by it..", GadgetBlackHole.class); - public static final GadgetType TSUNAMI = new GadgetType(Material.WATER_BUCKET, (byte) 0, 12, "ultracosmetics.gadgets.tsunami", "Tsunami", "&9&oTSUNAMI!!\n&7&oJUMP!\n&7&oLet's go!", GadgetTsunami.class); - public static final GadgetType TNT = new GadgetType(Material.TNT, (byte) 0, 10, "ultracosmetics.gadgets.tnt", "TNT", "&7&oBlow some people up!\n&7&oKABOOM!", GadgetTNT.class); - public static final GadgetType FUNGUN = new GadgetType(Material.BLAZE_ROD, (byte) 0, 4, "ultracosmetics.gadgets.fungun", "FunGun", "&7&oWoow! So much fun in a gun!", GadgetFunGun.class); - public static final GadgetType PARACHUTE = new GadgetType(Material.LEASH, (byte) 0, 60, "ultracosmetics.gadgets.parachute", "Parachute", "&7&oGERONIMOooo!", GadgetParachute.class); - public static final GadgetType QUAKEGUN = new GadgetType(Material.DIAMOND_HOE, (byte) 0, 3, "ultracosmetics.gadgets.quakegun", "QuakeGun", "&7&oGet a real Rail Gun" + "\n&7&oand strike players and mobs!", GadgetQuakeGun.class); - public static final GadgetType GHOSTPARTY = new GadgetType(Material.SKULL_ITEM, (byte) 0, 45, "ultracosmetics.gadgets.ghostparty", "GhostParty", "&7&oWho Ya Gonna Call?\n&f&lGHOST &4&lBUSTERS!", GadgetGhostParty.class); - public static final GadgetType FIREWORK = new GadgetType(Material.FIREWORK, (byte) 0, 0.2, "ultracosmetics.gadgets.firework", "Firework", "&7&oNeed to celebrate?\n&7&oUse fireworks!", GadgetFirework.class); - public static final GadgetType CHRISTMASTREE = new GadgetType(Material.LONG_GRASS, (byte) 2, 20, "ultracosmetics.gadgets.christmastree", "ChristmasTree", "&7&oHere is a Christmas" + "\n&7&oTree for you!", GadgetChristmasTree.class); - public static final GadgetType FREEZECANNON = new GadgetType(Material.ICE, (byte) 0, 8, "ultracosmetics.gadgets.freezecannon", "FreezeCannon", "&7&oTransform the floor into a rink!", GadgetFreezeCannon.class); - public static final GadgetType SNOWBALL = new GadgetType(Material.SNOW_BALL, (byte) 0, 0.5, "ultracosmetics.gadgets.snowball", "Snowball", "&7&oJoin in on the festive fun by\n" + "&7&othrowing snow at people!", GadgetSnowball.class); - public static final GadgetType PARTYPOPPER = new GadgetType(Material.GOLDEN_CARROT, (byte) 0, 2, "ultracosmetics.gadgets.partypopper", "PartyPopper", "&7&oCelebrate by blasting confetti into\n&7&opeoples' eyes!", GadgetPartyPopper.class); - public static final GadgetType TRAMPOLINE = new GadgetType(Material.WOOL, (byte) 11, 75, "ultracosmetics.gadgets.trampoline", "Trampoline", "&7&oConstructs a trampoline!" + "\n&7&othat sends you and your\n&7&ofriends into air!", GadgetTrampoline.class); - private double countdown; private boolean affectPlayers; - GadgetType(Material material, byte data, double defaultCountdown, String permission, String configName, String defaultDesc, Class clazz) { - super(Category.GADGETS, configName, permission, defaultDesc, material, data, clazz); + GadgetType(Material material, byte data, double defaultCountdown, String permission, String configName, String defaultDesc, Class clazz, ServerVersion baseVersion) { + super(Category.GADGETS, configName, permission, defaultDesc, material, data, clazz, baseVersion); this.affectPlayers = SettingsManager.getConfig().getBoolean("Gadgets." + configName + ".Affect-Players"); @@ -125,4 +69,35 @@ public boolean affectPlayers() { public double getCountdown() { return countdown; } + + public static void register() { + new GadgetType(Material.IRON_BARDING, (byte) 0, 8, "ultracosmetics.gadgets.batblaster", "BatBlaster", "&7&oLaunch waves of annoying bats\n&7&oto people you don't like!", GadgetBatBlaster.class, ServerVersion.v1_8_R1); + new GadgetType(Material.COOKED_CHICKEN, (byte) 0, 6, "ultracosmetics.gadgets.chickenator", "Chickenator", "&7&oShoot, boom, KFC.", GadgetChickenator.class, ServerVersion.v1_8_R1); + new GadgetType(Material.WOOL, (byte) 3, 25, "ultracosmetics.gadgets.colorbomb", "ColorBomb", "&7&oA colorful bomb!", GadgetColorBomb.class, ServerVersion.v1_8_R1); + new GadgetType(Material.BEACON, (byte) 0, 45, "ultracosmetics.gadgets.discoball", "DiscoBall", "&7&oJust, dance!", GadgetDiscoBall.class, ServerVersion.v1_8_R1); + new GadgetType(Material.ENDER_PEARL, (byte) 0, 2, "ultracosmetics.gadgets.etherealpearl", "EtherealPearl", "&7&oTake a ride through the skies" + "\n&7&oon your very own Ethereal Pearl!", GadgetEtherealPearl.class, ServerVersion.v1_8_R1); + new GadgetType(Material.TRIPWIRE_HOOK, (byte) 0, 5, "ultracosmetics.gadgets.fleshhook", "FleshHook", "&7&oMake new friends by throwing a hook" + "\n&7&ointo their face and pulling them\n&7&otowards you!", GadgetFleshHook.class, ServerVersion.v1_8_R1); + new GadgetType(Material.MELON_BLOCK, (byte) 0, 2, "ultracosmetics.gadgets.melonthrower", "MelonThrower", "&7&oDeliciously fun!", GadgetMelonThrower.class, ServerVersion.v1_8_R1); + new GadgetType(Material.PACKED_ICE, (byte) 0, 12, "ultracosmetics.gadgets.blizzardblaster", "BlizzardBlaster", "&7&oLet it go!", GadgetBlizzardBlaster.class, ServerVersion.v1_8_R1); + new GadgetType(Material.REDSTONE_COMPARATOR, (byte) 0, 2, "ultracosmetics.gadgets.portalgun", "PortalGun", "&7&oMomentum, a function of " + "mass and velocity,\n&7&ois converved between portals. In Layman''s terms,\n&7&ospeedy thing goes in, speedy thing goes out.", GadgetPortalGun.class, ServerVersion.v1_8_R1); + new GadgetType(Material.SHEARS, (byte) 0, 25, "ultracosmetics.gadgets.explosivesheep", "ExplosiveSheep", "&7&oAre you sure it's supposed\n&7&oto flicker like that?", GadgetExplosiveSheep.class, ServerVersion.v1_8_R1); + new GadgetType(Material.DIAMOND_BARDING, (byte) 0, 0.5, "ultracosmetics.gadgets.paintballgun", "PaintballGun", "&7&oPEW PEW PEW PEW!!!", GadgetPaintballGun.class, ServerVersion.v1_8_R1); + new GadgetType(Material.IRON_AXE, (byte) 0, 8, "ultracosmetics.gadgets.thorhammer", "ThorHammer", "&7&oGet the real Mjölnir", GadgetThorHammer.class, ServerVersion.v1_8_R1); + new GadgetType(Material.EYE_OF_ENDER, (byte) 0, 30, "ultracosmetics.gadgets.antigravity", "AntiGravity", "&7&oYou don't like gravity?" + "\n&7&oThen, this gadget is made for you!", GadgetAntiGravity.class, ServerVersion.v1_8_R1); + new GadgetType(Material.FIREWORK_CHARGE, (byte) 0, 15, "ultracosmetics.gadgets.smashdown", "SmashDown", "&7&oAND HIS NAME IS... JOHN CENA!!", GadgetSmashDown.class, ServerVersion.v1_8_R1); + new GadgetType(Material.FIREWORK, (byte) 0, 60, "ultracosmetics.gadgets.rocket", "Rocket", "&7&oHouston, we have got a problem..", GadgetRocket.class, ServerVersion.v1_8_R1); + new GadgetType(Material.STAINED_CLAY, (byte) 15, 35, "ultracosmetics.gadgets.blackhole", "BlackHole", "&7&oYou should not get caught by it..", GadgetBlackHole.class, ServerVersion.v1_8_R1); + new GadgetType(Material.WATER_BUCKET, (byte) 0, 12, "ultracosmetics.gadgets.tsunami", "Tsunami", "&9&oTSUNAMI!!\n&7&oJUMP!\n&7&oLet's go!", GadgetTsunami.class, ServerVersion.v1_8_R1); + new GadgetType(Material.TNT, (byte) 0, 10, "ultracosmetics.gadgets.tnt", "TNT", "&7&oBlow some people up!\n&7&oKABOOM!", GadgetTNT.class, ServerVersion.v1_8_R1); + new GadgetType(Material.BLAZE_ROD, (byte) 0, 4, "ultracosmetics.gadgets.fungun", "FunGun", "&7&oWoow! So much fun in a gun!", GadgetFunGun.class, ServerVersion.v1_8_R1); + new GadgetType(Material.LEASH, (byte) 0, 60, "ultracosmetics.gadgets.parachute", "Parachute", "&7&oGERONIMOooo!", GadgetParachute.class, ServerVersion.v1_8_R1); + new GadgetType(Material.DIAMOND_HOE, (byte) 0, 3, "ultracosmetics.gadgets.quakegun", "QuakeGun", "&7&oGet a real Rail Gun" + "\n&7&oand strike players and mobs!", GadgetQuakeGun.class, ServerVersion.v1_8_R1); + new GadgetType(Material.SKULL_ITEM, (byte) 0, 45, "ultracosmetics.gadgets.ghostparty", "GhostParty", "&7&oWho Ya Gonna Call?\n&f&lGHOST &4&lBUSTERS!", GadgetGhostParty.class, ServerVersion.v1_8_R1); + new GadgetType(Material.FIREWORK, (byte) 0, 0.2, "ultracosmetics.gadgets.firework", "Firework", "&7&oNeed to celebrate?\n&7&oUse fireworks!", GadgetFirework.class, ServerVersion.v1_8_R1); + new GadgetType(Material.LONG_GRASS, (byte) 2, 20, "ultracosmetics.gadgets.christmastree", "ChristmasTree", "&7&oHere is a Christmas" + "\n&7&oTree for you!", GadgetChristmasTree.class, ServerVersion.v1_8_R1); + new GadgetType(Material.ICE, (byte) 0, 8, "ultracosmetics.gadgets.freezecannon", "FreezeCannon", "&7&oTransform the floor into a rink!", GadgetFreezeCannon.class, ServerVersion.v1_8_R1); + new GadgetType(Material.SNOW_BALL, (byte) 0, 0.5, "ultracosmetics.gadgets.snowball", "Snowball", "&7&oJoin in on the festive fun by\n" + "&7&othrowing snow at people!", GadgetSnowball.class, ServerVersion.v1_8_R1); + new GadgetType(Material.GOLDEN_CARROT, (byte) 0, 2, "ultracosmetics.gadgets.partypopper", "PartyPopper", "&7&oCelebrate by blasting confetti into\n&7&opeoples' eyes!", GadgetPartyPopper.class, ServerVersion.v1_8_R1); + new GadgetType(Material.WOOL, (byte) 11, 75, "ultracosmetics.gadgets.trampoline", "Trampoline", "&7&oConstructs a trampoline!" + "\n&7&othat sends you and your\n&7&ofriends into air!", GadgetTrampoline.class, ServerVersion.v1_8_R1); + } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/HatType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/HatType.java index 8bf426b3b..ca1031837 100755 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/HatType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/HatType.java @@ -6,14 +6,14 @@ import be.isach.ultracosmetics.cosmetics.hats.Hat; import be.isach.ultracosmetics.player.UltraPlayer; import be.isach.ultracosmetics.util.ItemFactory; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - +import be.isach.ultracosmetics.util.ServerVersion; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; /** * Hat types. @@ -45,47 +45,6 @@ public static void checkEnabled() { ENABLED.addAll(values().stream().filter(CosmeticType::isEnabled).collect(Collectors.toList())); } - public static final HatType ASTRONAUT = new HatType("M2U4YWFkNjczMTU3YzkyMzE3YTg4YjFmODZmNTI3MWYxY2Q3Mzk3ZDdmYzhlYzMyODFmNzMzZjc1MTYzNCJ9fX0=", "Astronaut", "&7&oHouston, we have got a problem."); - public static final HatType SCARED = new HatType("NjM2ZTI2YzQ0NjU5ZTgxNDhlZDU4YWE3OWU0ZDYwZGI1OTVmNDI2NDQyMTE2ZjgxYjU0MTVjMjQ0NmVkOCJ9fX0=", "Scared", "&7&oOh gawd, that scared me!"); - public static final HatType ANGEL = new HatType("M2UxZGViYzczMjMxZjhlZDRiNjlkNWMzYWMxYjFmMThmMzY1NmE4OTg4ZTIzZjJlMWJkYmM0ZTg1ZjZkNDZhIn19fQ==", "Angel", "&7&oDid it hurt when you fell from heaven?"); - public static final HatType EMBARASSED = new HatType("ZjcyMGRmOTExYzA1MjM3NzA2NTQwOGRiNzhhMjVjNjc4Zjc5MWViOTQ0YzA2MzkzNWFlODZkYmU1MWM3MWIifX19", "Embarassed", "&7&oI am kinda embarassed by that."); - public static final HatType KISSY = new HatType("NTQ1YmQxOGEyYWFmNDY5ZmFkNzJlNTJjZGU2Y2ZiMDJiZmJhYTViZmVkMmE4MTUxMjc3Zjc3OWViY2RjZWMxIn19fQ==", "Kissy", "&7&oWanna kiss?"); - public static final HatType SAD = new HatType("MTQ5NjhhYzVhZjMxNDY4MjZmYTJiMGQ0ZGQxMTRmZGExOTdmOGIyOGY0NzUwNTUzZjNmODg4MzZhMjFmYWM5In19fQ==", "Sad", "&7&oI am so sad."); - public static final HatType COOL = new HatType("ODY4ZjRjZWY5NDlmMzJlMzNlYzVhZTg0NWY5YzU2OTgzY2JlMTMzNzVhNGRlYzQ2ZTViYmZiN2RjYjYifX19", "Cool", "&7&oI am such a cool guy."); - public static final HatType SURPRISED = new HatType("YmMyYjliOWFlNjIyYmQ2OGFkZmY3MTgwZjgyMDZlYzQ0OTRhYmJmYTEzMGU5NGE1ODRlYzY5MmU4OTg0YWIyIn19fQ==", "Surprised", "&7&oWow, did not expect that!"); - public static final HatType DEAD = new HatType("YjM3MWU0ZTFjZjZhMWEzNmZkYWUyNzEzN2ZkOWI4NzQ4ZTYxNjkyOTk5MjVmOWFmMmJlMzAxZTU0Mjk4YzczIn19fQ==", "Dead", "&7&ogot rekt"); - public static final HatType CRYING = new HatType("MWYxYjg3NWRlNDljNTg3ZTNiNDAyM2NlMjRkNDcyZmYyNzU4M2ExZjA1NGYzN2U3M2ExMTU0YjViNTQ5OCJ9fX0=", "Crying", "&7&oi cri evrytiem"); - public static final HatType BIGSMILE = new HatType("NTA1OWQ1OWViNGU1OWMzMWVlY2Y5ZWNlMmY5Y2YzOTM0ZTQ1YzBlYzQ3NmZjODZiZmFlZjhlYTkxM2VhNzEwIn19fQ==", "BigSmile", "&7&oUh, because I am really happy!"); - public static final HatType WINK = new HatType("ZjRlYTJkNmY5MzlmZWZlZmY1ZDEyMmU2M2RkMjZmYThhNDI3ZGY5MGIyOTI4YmMxZmE4OWE4MjUyYTdlIn19fQ==", "Wink", "&7&oYou know what I mean ;)"); - public static final HatType DERP = new HatType("M2JhYWJlNzI0ZWFlNTljNWQxM2Y0NDJjN2RjNWQyYjFjNmI3MGMyZjgzMzY0YTQ4OGNlNTk3M2FlODBiNGMzIn19fQ==", "Derp", "&7&oDerp Derp Derping all around"); - public static final HatType SMILE = new HatType("NTJlOTgxNjVkZWVmNGVkNjIxOTUzOTIxYzFlZjgxN2RjNjM4YWY3MWMxOTM0YTQyODdiNjlkN2EzMWY2YjgifX19", "Smile", "&7&oUh, because I am happy"); - public static final HatType IRON = new HatType("YmJhODQ1OTE0NWQ4M2ZmYzQ0YWQ1OGMzMjYwZTc0Y2E1YTBmNjM0YzdlZWI1OWExYWQzMjM0ODQ5YzkzM2MifX19", "Iron", "&7&oAs hard as iron!"); - public static final HatType GOLD = new HatType("YjZkMWNlNjk3ZTlkYmFhNGNjZjY0MjUxNmFhYTU5ODEzMzJkYWMxZDMzMWFmZWUyZWUzZGNjODllZmRlZGIifX19", "Gold", "&7&oMy precious!"); - public static final HatType DIAMOND = new HatType("YzAxNDYxOTczNjM0NTI1MTk2ZWNjNzU3NjkzYjE3MWFkYTRlZjI0YWE5MjgzNmY0MmVhMTFiZDc5YzNhNTAyZCJ9fX0=", "Diamond", "&7&oThis is really strong!"); - public static final HatType PISTON = new HatType("YWE4NjhjZTkxN2MwOWFmOGU0YzM1MGE1ODA3MDQxZjY1MDliZjJiODlhY2E0NWU1OTFmYmJkN2Q0YjExN2QifX19", "Piston", "&7&oHave you got the redstone?"); - public static final HatType COMMANDBLOCK = new HatType("ODUxNGQyMjViMjYyZDg0N2M3ZTU1N2I0NzQzMjdkY2VmNzU4YzJjNTg4MmU0MWVlNmQ4YzVlOWNkM2JjOTE0In19fQ==", "CommandBlock", "&7&oControl the world with it!"); - public static final HatType MUSIC = new HatType("NGNlZWI3N2Q0ZDI1NzI0YTljYWYyYzdjZGYyZDg4Mzk5YjE0MTdjNmI5ZmY1MjEzNjU5YjY1M2JlNDM3NmUzIn19fQ==", "Music", "&7&oYou are so musical."); - public static final HatType SQUID = new HatType("MDE0MzNiZTI0MjM2NmFmMTI2ZGE0MzRiODczNWRmMWViNWIzY2IyY2VkZTM5MTQ1OTc0ZTljNDgzNjA3YmFjIn19fQ==", "Squid", "&7&oBloop Bloop!"); - public static final HatType CHICKEN = new HatType("MTYzODQ2OWE1OTljZWVmNzIwNzUzNzYwMzI0OGE5YWIxMWZmNTkxZmQzNzhiZWE0NzM1YjM0NmE3ZmFlODkzIn19fQ==", "Chicken", "&7&oBwwaaaaaaaaaaaakkkkk!"); - public static final HatType PIG = new HatType("NjIxNjY4ZWY3Y2I3OWRkOWMyMmNlM2QxZjNmNGNiNmUyNTU5ODkzYjZkZjRhNDY5NTE0ZTY2N2MxNmFhNCJ9fX0=", "Pig", "&7&oOink Oink!"); - public static final HatType BLAZE = new HatType("Yjc4ZWYyZTRjZjJjNDFhMmQxNGJmZGU5Y2FmZjEwMjE5ZjViMWJmNWIzNWE0OWViNTFjNjQ2Nzg4MmNiNWYwIn19fQ==", "Blaze", "&7&oWatch out for the fire!"); - public static final HatType SHEEP = new HatType("ZjMxZjljY2M2YjNlMzJlY2YxM2I4YTExYWMyOWNkMzNkMThjOTVmYzczZGI4YTY2YzVkNjU3Y2NiOGJlNzAifX19", "Sheep", "&7&oBaaaa, baa"); - public static final HatType GOLEM = new HatType("ODkwOTFkNzllYTBmNTllZjdlZjk0ZDdiYmE2ZTVmMTdmMmY3ZDQ1NzJjNDRmOTBmNzZjNDgxOWE3MTQifX19", "Golem", "&7&oI am your guard."); - public static final HatType ENDERMAN = new HatType("N2E1OWJiMGE3YTMyOTY1YjNkOTBkOGVhZmE4OTlkMTgzNWY0MjQ1MDllYWRkNGU2YjcwOWFkYTUwYjljZiJ9fX0=", "Enderman", "&7&oNow I am here, now I am there."); - public static final HatType MARIO = new HatType("ZGJhOGQ4ZTUzZDhhNWE3NTc3MGI2MmNjZTczZGI2YmFiNzAxY2MzZGU0YTliNjU0ZDIxM2Q1NGFmOTYxNSJ9fX0=", "Mario", "&7&oIt is me! Mario!"); - public static final HatType LUIGI = new HatType("ZmYxNTMzODcxZTQ5ZGRhYjhmMWNhODJlZGIxMTUzYTVlMmVkMzc2NGZkMWNlMDI5YmY4MjlmNGIzY2FhYzMifX19", "Luigi", "&7&oLuigi time!"); - public static final HatType BATMAN = new HatType("ZjI1NmY3MTczNWVmNDU4NTgxYzlkYWNmMzk0MTg1ZWVkOWIzM2NiNmVjNWNkNTk0YTU3MTUzYThiNTY2NTYwIn19fQ==", "Batman", "&7&oI am batman!"); - public static final HatType CHEST = new HatType("NmY2OGQ1MDliNWQxNjY5Yjk3MWRkMWQ0ZGYyZTQ3ZTE5YmNiMWIzM2JmMWE3ZmYxZGRhMjliZmM2ZjllYmYifX19", "Chest", "&7&oOpen, and close"); - public static final HatType SKULL = new HatType("MTFmNTRmZjliYjQyODUxOTEyYWE4N2ExYmRhNWI3Y2Q5ODE0Y2NjY2ZiZTIyNWZkZGE4ODdhZDYxODBkOSJ9fX0=", "Skull", "&7&oWho iss headless now?"); - public static final HatType GHOST = new HatType("NjhkMjE4MzY0MDIxOGFiMzMwYWM1NmQyYWFiN2UyOWE5NzkwYTU0NWY2OTE2MTllMzg1NzhlYTRhNjlhZTBiNiJ9fX0=", "Ghost", "&7&o2spooky4u"); - public static final HatType JACKOLANTERN = new HatType("MDI4OWQ0YjRjOTYyOTU5MTVmMDY4Yjk5YzI3ZDM5NDI3M2Y5ZjI2NGZjOTY4YzVkNWM0N2RmMmY1YmUyIn19fQ==", "JackOLantern", "&7&oA little pumkin"); - public static final HatType SCARYCLOW = new HatType("ODZkYmMxZGViYzU3NDM4YTVkZTRiYTkxNTE1MTM4MmFiYzNkOGYxMzE4ZTJhMzVlNzhkZmIzMGYwNGJjNDY3In19fQ==", "ScaryClown", "&7&oHope you are not scared of clowns."); - public static final HatType SANTA = new HatType("MmQ2MWNjYmZkY2RmODk0MWFkYWY3NmM2YzBlMDE4MmQyYzhiYmI1ZGMxOGYzNzQ4OTU2NTJiYzY2MWI2ZWQifX19", "Santa", "&7&oOh oh oh! Merry Christmas!"); - public static final HatType SNOWMAN = new HatType("OThlMzM0ZTRiZWUwNDI2NDc1OWE3NjZiYzE5NTVjZmFmM2Y1NjIwMTQyOGZhZmVjOGQ0YmYxYmIzNmFlNiJ9fX0=", "Snowman", "&7&oI don't have a skull.. or bones"); - public static final HatType PRESENT = new HatType("ZjBhZmE0ZmZmZDEwODYzZTc2YzY5OGRhMmM5YzllNzk5YmNmOWFiOWFhMzdkODMxMjg4MTczNDIyNWQzY2EifX19", "Present", "&7&oFrom Santa, to you!"); - public static final HatType ELF = new HatType("ODJhYjZjNzljNjNiODMzNGIyYzAzYjZmNzM2YWNmNjFhY2VkNWMyNGYyYmE3MmI3NzdkNzdmMjhlOGMifX19", "Elf", "&7&oI work for Santa!"); - public static final HatType BEDROCK = new HatType("MzZkMWZhYmRmM2UzNDI2NzFiZDlmOTVmNjg3ZmUyNjNmNDM5ZGRjMmYxYzllYThmZjE1YjEzZjFlN2U0OGI5In19fQ==", "Bedrock", "&7&oUnbreakable!"); - /** * STATIC list of all the enabled hats. */ @@ -97,7 +56,7 @@ public static void checkEnabled() { private ItemStack itemStack; HatType(String str, String configName, String defaultDesc) { - super(Category.HATS, configName, "ultracosmetics.hats." + configName.toLowerCase(), defaultDesc, Material.SKULL_ITEM, (byte) 3, Hat.class); + super(Category.HATS, configName, "ultracosmetics.hats." + configName.toLowerCase(), defaultDesc, Material.SKULL_ITEM, (byte) 3, Hat.class, ServerVersion.v1_8_R1); this.itemStack = ItemFactory.createSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUv" + str, ChatColor.DARK_GRAY + "" + ChatColor.ITALIC + "Hat"); VALUES.add(this); @@ -133,4 +92,95 @@ public ItemStack getItemStack() { public String getName() { return MessageManager.getMessage("Hats." + getConfigName() + ".Name"); } + + public static void register() { + new HatType("M2U4YWFkNjczMTU3YzkyMzE3YTg4YjFmODZmNTI3MWYxY2Q3Mzk3ZDdmYzhlYzMyODFmNzMzZjc1MTYzNCJ9fX0=", "Astronaut", "&7&oHouston, we have got a problem."); + new HatType("NjM2ZTI2YzQ0NjU5ZTgxNDhlZDU4YWE3OWU0ZDYwZGI1OTVmNDI2NDQyMTE2ZjgxYjU0MTVjMjQ0NmVkOCJ9fX0=", "Scared", "&7&oOh gawd, that scared me!"); + new HatType("M2UxZGViYzczMjMxZjhlZDRiNjlkNWMzYWMxYjFmMThmMzY1NmE4OTg4ZTIzZjJlMWJkYmM0ZTg1ZjZkNDZhIn19fQ==", "Angel", "&7&oDid it hurt when you fell from heaven?"); + new HatType("ZjcyMGRmOTExYzA1MjM3NzA2NTQwOGRiNzhhMjVjNjc4Zjc5MWViOTQ0YzA2MzkzNWFlODZkYmU1MWM3MWIifX19", "Embarassed", "&7&oI am kinda embarassed by that."); + new HatType("NTQ1YmQxOGEyYWFmNDY5ZmFkNzJlNTJjZGU2Y2ZiMDJiZmJhYTViZmVkMmE4MTUxMjc3Zjc3OWViY2RjZWMxIn19fQ==", "Kissy", "&7&oWanna kiss?"); + new HatType("MTQ5NjhhYzVhZjMxNDY4MjZmYTJiMGQ0ZGQxMTRmZGExOTdmOGIyOGY0NzUwNTUzZjNmODg4MzZhMjFmYWM5In19fQ==", "Sad", "&7&oI am so sad."); + new HatType("ODY4ZjRjZWY5NDlmMzJlMzNlYzVhZTg0NWY5YzU2OTgzY2JlMTMzNzVhNGRlYzQ2ZTViYmZiN2RjYjYifX19", "Cool", "&7&oI am such a cool guy."); + new HatType("YmMyYjliOWFlNjIyYmQ2OGFkZmY3MTgwZjgyMDZlYzQ0OTRhYmJmYTEzMGU5NGE1ODRlYzY5MmU4OTg0YWIyIn19fQ==", "Surprised", "&7&oWow, did not expect that!"); + new HatType("YjM3MWU0ZTFjZjZhMWEzNmZkYWUyNzEzN2ZkOWI4NzQ4ZTYxNjkyOTk5MjVmOWFmMmJlMzAxZTU0Mjk4YzczIn19fQ==", "Dead", "&7&ogot rekt"); + new HatType("MWYxYjg3NWRlNDljNTg3ZTNiNDAyM2NlMjRkNDcyZmYyNzU4M2ExZjA1NGYzN2U3M2ExMTU0YjViNTQ5OCJ9fX0=", "Crying", "&7&oi cri evrytiem"); + new HatType("NTA1OWQ1OWViNGU1OWMzMWVlY2Y5ZWNlMmY5Y2YzOTM0ZTQ1YzBlYzQ3NmZjODZiZmFlZjhlYTkxM2VhNzEwIn19fQ==", "BigSmile", "&7&oUh, because I am really happy!"); + new HatType("ZjRlYTJkNmY5MzlmZWZlZmY1ZDEyMmU2M2RkMjZmYThhNDI3ZGY5MGIyOTI4YmMxZmE4OWE4MjUyYTdlIn19fQ==", "Wink", "&7&oYou know what I mean ;)"); + new HatType("M2JhYWJlNzI0ZWFlNTljNWQxM2Y0NDJjN2RjNWQyYjFjNmI3MGMyZjgzMzY0YTQ4OGNlNTk3M2FlODBiNGMzIn19fQ==", "Derp", "&7&oDerp Derp Derping all around"); + new HatType("NTJlOTgxNjVkZWVmNGVkNjIxOTUzOTIxYzFlZjgxN2RjNjM4YWY3MWMxOTM0YTQyODdiNjlkN2EzMWY2YjgifX19", "Smile", "&7&oUh, because I am happy"); + new HatType("YmJhODQ1OTE0NWQ4M2ZmYzQ0YWQ1OGMzMjYwZTc0Y2E1YTBmNjM0YzdlZWI1OWExYWQzMjM0ODQ5YzkzM2MifX19", "Iron", "&7&oAs hard as iron!"); + new HatType("YjZkMWNlNjk3ZTlkYmFhNGNjZjY0MjUxNmFhYTU5ODEzMzJkYWMxZDMzMWFmZWUyZWUzZGNjODllZmRlZGIifX19", "Gold", "&7&oMy precious!"); + new HatType("YzAxNDYxOTczNjM0NTI1MTk2ZWNjNzU3NjkzYjE3MWFkYTRlZjI0YWE5MjgzNmY0MmVhMTFiZDc5YzNhNTAyZCJ9fX0=", "Diamond", "&7&oThis is really strong!"); + new HatType("YWE4NjhjZTkxN2MwOWFmOGU0YzM1MGE1ODA3MDQxZjY1MDliZjJiODlhY2E0NWU1OTFmYmJkN2Q0YjExN2QifX19", "Piston", "&7&oHave you got the redstone?"); + new HatType("ODUxNGQyMjViMjYyZDg0N2M3ZTU1N2I0NzQzMjdkY2VmNzU4YzJjNTg4MmU0MWVlNmQ4YzVlOWNkM2JjOTE0In19fQ==", "CommandBlock", "&7&oControl the world with it!"); + new HatType("NGNlZWI3N2Q0ZDI1NzI0YTljYWYyYzdjZGYyZDg4Mzk5YjE0MTdjNmI5ZmY1MjEzNjU5YjY1M2JlNDM3NmUzIn19fQ==", "Music", "&7&oYou are so musical."); + new HatType("MDE0MzNiZTI0MjM2NmFmMTI2ZGE0MzRiODczNWRmMWViNWIzY2IyY2VkZTM5MTQ1OTc0ZTljNDgzNjA3YmFjIn19fQ==", "Squid", "&7&oBloop Bloop!"); + new HatType("MTYzODQ2OWE1OTljZWVmNzIwNzUzNzYwMzI0OGE5YWIxMWZmNTkxZmQzNzhiZWE0NzM1YjM0NmE3ZmFlODkzIn19fQ==", "Chicken", "&7&oBwwaaaaaaaaaaaakkkkk!"); + new HatType("NjIxNjY4ZWY3Y2I3OWRkOWMyMmNlM2QxZjNmNGNiNmUyNTU5ODkzYjZkZjRhNDY5NTE0ZTY2N2MxNmFhNCJ9fX0=", "Pig", "&7&oOink Oink!"); + new HatType("Yjc4ZWYyZTRjZjJjNDFhMmQxNGJmZGU5Y2FmZjEwMjE5ZjViMWJmNWIzNWE0OWViNTFjNjQ2Nzg4MmNiNWYwIn19fQ==", "Blaze", "&7&oWatch out for the fire!"); + new HatType("ZjMxZjljY2M2YjNlMzJlY2YxM2I4YTExYWMyOWNkMzNkMThjOTVmYzczZGI4YTY2YzVkNjU3Y2NiOGJlNzAifX19", "Sheep", "&7&oBaaaa, baa"); + new HatType("ODkwOTFkNzllYTBmNTllZjdlZjk0ZDdiYmE2ZTVmMTdmMmY3ZDQ1NzJjNDRmOTBmNzZjNDgxOWE3MTQifX19", "Golem", "&7&oI am your guard."); + new HatType("N2E1OWJiMGE3YTMyOTY1YjNkOTBkOGVhZmE4OTlkMTgzNWY0MjQ1MDllYWRkNGU2YjcwOWFkYTUwYjljZiJ9fX0=", "Enderman", "&7&oNow I am here, now I am there."); + new HatType("ZGJhOGQ4ZTUzZDhhNWE3NTc3MGI2MmNjZTczZGI2YmFiNzAxY2MzZGU0YTliNjU0ZDIxM2Q1NGFmOTYxNSJ9fX0=", "Mario", "&7&oIt is me! Mario!"); + new HatType("ZmYxNTMzODcxZTQ5ZGRhYjhmMWNhODJlZGIxMTUzYTVlMmVkMzc2NGZkMWNlMDI5YmY4MjlmNGIzY2FhYzMifX19", "Luigi", "&7&oLuigi time!"); + new HatType("ZjI1NmY3MTczNWVmNDU4NTgxYzlkYWNmMzk0MTg1ZWVkOWIzM2NiNmVjNWNkNTk0YTU3MTUzYThiNTY2NTYwIn19fQ==", "Batman", "&7&oI am batman!"); + new HatType("NmY2OGQ1MDliNWQxNjY5Yjk3MWRkMWQ0ZGYyZTQ3ZTE5YmNiMWIzM2JmMWE3ZmYxZGRhMjliZmM2ZjllYmYifX19", "Chest", "&7&oOpen, and close"); + new HatType("MTFmNTRmZjliYjQyODUxOTEyYWE4N2ExYmRhNWI3Y2Q5ODE0Y2NjY2ZiZTIyNWZkZGE4ODdhZDYxODBkOSJ9fX0=", "Skull", "&7&oWho iss headless now?"); + new HatType("NjhkMjE4MzY0MDIxOGFiMzMwYWM1NmQyYWFiN2UyOWE5NzkwYTU0NWY2OTE2MTllMzg1NzhlYTRhNjlhZTBiNiJ9fX0=", "Ghost", "&7&o2spooky4u"); + new HatType("MDI4OWQ0YjRjOTYyOTU5MTVmMDY4Yjk5YzI3ZDM5NDI3M2Y5ZjI2NGZjOTY4YzVkNWM0N2RmMmY1YmUyIn19fQ==", "JackOLantern", "&7&oA little pumkin"); + new HatType("ODZkYmMxZGViYzU3NDM4YTVkZTRiYTkxNTE1MTM4MmFiYzNkOGYxMzE4ZTJhMzVlNzhkZmIzMGYwNGJjNDY3In19fQ==", "ScaryClown", "&7&oHope you are not scared of clowns."); + new HatType("MmQ2MWNjYmZkY2RmODk0MWFkYWY3NmM2YzBlMDE4MmQyYzhiYmI1ZGMxOGYzNzQ4OTU2NTJiYzY2MWI2ZWQifX19", "Santa", "&7&oOh oh oh! Merry Christmas!"); + new HatType("OThlMzM0ZTRiZWUwNDI2NDc1OWE3NjZiYzE5NTVjZmFmM2Y1NjIwMTQyOGZhZmVjOGQ0YmYxYmIzNmFlNiJ9fX0=", "Snowman", "&7&oI don't have a skull.. or bones"); + new HatType("ZjBhZmE0ZmZmZDEwODYzZTc2YzY5OGRhMmM5YzllNzk5YmNmOWFiOWFhMzdkODMxMjg4MTczNDIyNWQzY2EifX19", "Present", "&7&oFrom Santa, to you!"); + new HatType("ODJhYjZjNzljNjNiODMzNGIyYzAzYjZmNzM2YWNmNjFhY2VkNWMyNGYyYmE3MmI3NzdkNzdmMjhlOGMifX19", "Elf", "&7&oI work for Santa!"); + new HatType("MzZkMWZhYmRmM2UzNDI2NzFiZDlmOTVmNjg3ZmUyNjNmNDM5ZGRjMmYxYzllYThmZjE1YjEzZjFlN2U0OGI5In19fQ==", "Bedrock", "&7&oUnbreakable!"); + new HatType("ZjM0ODdkNDU3ZjkwNjJkNzg3YTNlNmNlMWM0NjY0YmY3NDAyZWM2N2RkMTExMjU2ZjE5YjM4Y2U0ZjY3MCJ9fX0=", "Bread", "&7&o"); + new HatType("OTU1ZDYxMWE4NzhlODIxMjMxNzQ5YjI5NjU3MDhjYWQ5NDI2NTA2NzJkYjA5ZTI2ODQ3YTg4ZTJmYWMyOTQ2In19fQ==", "Cheese", "&7&o"); + new HatType("MzQ3ZjRmNWE3NGM2NjkxMjgwY2Q4MGU3MTQ4YjQ5YjJjZTE3ZGNmNjRmZDU1MzY4NjI3ZjVkOTJhOTc2YTZhOCJ9fX0=", "Pancakes", "&7&oBetter with syrup!"); + new HatType("ZjkxMzY1MTRmMzQyZTdjNTIwOGExNDIyNTA2YTg2NjE1OGVmODRkMmIyNDkyMjAxMzllOGJmNjAzMmUxOTMifX19", "Cake", "&7&oMmmm, cake."); + new HatType("YjU5MmNmOWY0MmE1YThjOTk1OTY4NDkzZmRkMWIxMWUwYjY5YWFkNjQ3M2ZmNDUzODRhYmU1OGI3ZmM3YzcifX19", "Cookie", "&7&oCookie"); + new HatType("NGNjM2Y3ODFjOTIzYTI4ODdmMTRjMWVlYTExMDUwMTY2OTY2ZjI2MDI1Nzg0MDFmMTQ1MWU2MDk3Yjk3OWRmIn19fQ==", "CandyCane", "&7&o"); + new HatType("ODE5Zjk0OGQxNzcxOGFkYWNlNWRkNmUwNTBjNTg2MjI5NjUzZmVmNjQ1ZDcxMTNhYjk0ZDE3YjYzOWNjNDY2In19fQ==", "Chocolate", "&7&o"); + new HatType("MWVkNTUyNjBkY2NjOGRhNTkzMzhjNzVlNDFkNTQ0YTJlMWU3ZGJlZjMxYTY5ZmU0MmMwMWIzMjk4YmYyZCJ9fX0=", "WhiteChocolate", "&7&o"); + new HatType("Y2JiMzExZjNiYTFjMDdjM2QxMTQ3Y2QyMTBkODFmZTExZmQ4YWU5ZTNkYjIxMmEwZmE3NDg5NDZjMzYzMyJ9fX0=", "Apple", "&7&o"); + new HatType("YzNmZWQ1MTRjM2UyMzhjYTdhYzFjOTRiODk3ZmY2NzExYjFkYmU1MDE3NGFmYzIzNWM4ZjgwZDAyOSJ9fX0=", "Melon", "&7&o"); + new HatType("ZmVjNDE1ZDcwMmYzMjkyYTgyZjE0NzFjODc5NGNmNjMxMjJkNDQ5ZDI4YWI4ODZkNGRjNThmYWZkNjYifX19", "CarvedPumpkin", "&7&o"); + new HatType("Y2JjODI2YWFhZmI4ZGJmNjc4ODFlNjg5NDQ0MTRmMTM5ODUwNjRhM2Y4ZjA0NGQ4ZWRmYjQ0NDNlNzZiYSJ9fX0=", "Strawberry", "&7&o"); + new HatType("ZTliMGU5NjljZjNmY2NlZDM2YjcxMjM1MGZmYjQ2ZDhlZDc2MWZlNWVmYjEwZTNiNmE5Nzk1ZTY2NTZkYTk3In19fQ==", "Coconut", "&7&o"); + new HatType("OThjZWQ3NGEyMjAyMWE1MzVmNmJjZTIxYzhjNjMyYjI3M2RjMmQ5NTUyYjcxYTM4ZDU3MjY5YjM1MzhjZiJ9fX0=", "Taco", "&7&o"); + new HatType("ZTdiYTIyZDVkZjIxZTgyMWE2ZGU0YjhjOWQzNzNhM2FhMTg3ZDhhZTc0ZjI4OGE4MmQyYjYxZjI3MmU1In19fQ==", "Bacon", "&7&oEverything's better with bacon."); + new HatType("YTBlYWNhYzQxYTllYWYwNTEzNzZlZjJmOTU5NzAxZTFiYmUxYmY0YWE2NzE1YWRjMzRiNmRjMjlhMTNlYTkifX19", "Fries", "&7&o"); + new HatType("YTZlZjFjMjVmNTE2ZjJlN2Q2Zjc2Njc0MjBlMzNhZGNmM2NkZjkzOGNiMzdmOWE0MWE4YjM1ODY5ZjU2OWIifX19", "Hamburger", "&7&o"); + new HatType("MTQ5N2IxNDdjZmFlNTIyMDU1OTdmNzJlM2M0ZWY1MjUxMmU5Njc3MDIwZTRiNGZhNzUxMmMzYzZhY2RkOGMxIn19fQ==", "Popcorn", "&7&o"); + new HatType("ZDA3YjhjNTFhY2VjMmE1MDhiYjJmYTY1MmZiNmU0YTA4YjE5NDg1MTU5YTA5OWY1OTgyY2NiODhkZjFmZTI3ZSJ9fX0=", "WhiteDonut", "&7&o"); + new HatType("ODM3YzliODJiMTg2NjU2ZTlmNjM2M2EyYTFjNmE0YjViOTNjZmE5ZWY0ZGFkNmYxNmI5NGViYjVlMzYyNjc4In19fQ==", "PinkDonut", "&7&o"); + new HatType("NTlkYTU0ZmYzNjZlNzM4ZTMxZGU5MjkxOTk4NmFiYjRkNTBjYTk0NGZhOTkyNmFmNjM3NThiNzQ0OGYxOCJ9fX0=", "ChocolateDonut", "&7&o"); + new HatType("ZDUzYzFlODdlNTM3ZjFhYjI3NzRkZGFmYjgzNDM5YjMzNmY0YTc3N2I0N2FkODJiY2IzMGQ1ZmNiZGY5YmMifX19", "Pie", "&7&oi like pie"); + new HatType("OWM2MGRhMjk0NGExNzdkZDA4MjY4ZmJlYzA0ZTQwODEyZDFkOTI5NjUwYmU2NjUyOWIxZWU1ZTFlN2VjYSJ9fX0=", "A", "&7&oThe first letter in the alphabet!"); + new HatType("ODA0MWY1ZTg2OTgzZDM2ZWFlYzRlMTY3YjJiYmI1YTM3Mjc2MDdjZGU4OGY3NTU1Y2ExYjUyMmEwMzliYiJ9fX0==", "B", "&7&oThe second letter in the alphabet!"); + new HatType("ZDk0NTk5NmM4YWU5MWUzNzYxOTZkNGRjNjc2ZmVjMzFmZWFjNzkwYTJmMTk1YjI5ODFhNzAzY2ExZDE2Y2I2In19fQ===", "C", "&7&oThe third letter in the alphabet!"); + new HatType("MTY0MTE1MGY0ODFlODQ5MmY3MTI4Yzk0ODk5NjI1NGQyZDkxZmM5MGY1YThmZjRkOGFjNWMzOWE2YTg4YSJ9fX0=", "D", "&7&9The fourth letter in the alphabet!"); + new HatType("ZGIyNTE0ODdmZjhlZWYyZWJjN2E1N2RhYjZlM2Q5ZjFkYjdmYzkyNmRkYzY2ZmVhMTRhZmUzZGZmMTVhNDUifX19", "E", "&7&9The fifth letter in the alphabet!"); + new HatType("N2U0MzM2NTZiNDQzNjY4ZWQwM2RhYzhjNDQyNzIyYTJhNDEyMjFiZThiYjQ4ZTIzYjM1YmQ4YzJlNTlmNjMifX19", "F", "&7&9The sixth letter in the alphabet!"); + new HatType("OTk1ODYzYjczNjM3NjA1ZmVhY2JiMTczYjc3ZDVlMTU1ZTY1MjA0Yzc4ZDVjNzkxMWY3MzhmMjhkZWI2MCJ9fX0=", "G", "&7&9The seventh letter in the alphabet!"); + new HatType("M2MxZDM1OGQ5MjcwNzQyODljYzI2YmZmNWIxMjQwNzQ2ZjlmNGYwY2M0NmY5NDJmNTk4MWM2NTk1ZjcyZGQifX19", "H", "&7&9The eighth letter in the alphabet!"); + new HatType("OGYyMjk1ODY1YmRhNGU0Nzk3OWQzNmI4YTg4N2E3NWExM2IwMzRlNjk4OGY3ODY3MGI2NGExZTY0NDJjIn19fQ==", "I", "&7&9The ninth letter in the alphabet!"); + new HatType("ZTM0NDYyYjU1ZDdmNTgyMzY4MGFkMTNmMmFkYmQ3ZDFlZDQ2YmE1MTAxMDE3ZWQ0YjM3YWVlZWI3NzVkIn19fQ==", "J", "&7&9The tenth letter in the alphabet!"); + new HatType("NzczMzI1YTkzNWMwNjdiNmVmMjI3MzY3ZjYyY2E0YmY0OWY2N2FkYjlmNmRhMzIwOTFlMmQzMmM1ZGRlMzI4In19fQ==", "K", "&7&9The eleventh letter in the alphabet!"); + new HatType("MjVhMWUzMzI4YzU3MWFhNDk1ZDljNWY0OTQ4MTVjY2ExNzZjM2FjYjE4NGZlYjVhN2I5Yzk2Y2U4ZTUyZmNlIn19fQ==", "L", "&7&9The twelfth letter in the alphabet!"); + new HatType("ZDQ2N2JmNmJlOTVlNWM4ZTlkMDE5NzdhMmYwYzQ4N2VkNWIwZGU1Yzg3OTYzYTJlYjE1NDExYzQ0MmZiMmIifX19", "M", "&7&9The thirteenth letter in the alphabet!"); + new HatType("ODIzZTQzNGQ2Mzk1ZmU3ZTYzNDkyNDMxYmRlZTU3ODJiZDVlZTViYzhjYWI3NTU5NDY3YmRkMWY5M2I5MjVhIn19fQ==", "N", "&7&9The fourteenth letter in the alphabet!"); + new HatType("ODg0NDU0NjZiZGM1YWQ1YmNlYTgyMjM5YzRlMWI1MTBmNmVhNTI2MmQ4MmQ4YTk2ZDcyOTFjMzQyZmI4OSJ9fX0=", "O", "&7&9The fifteenth letter in the alphabet!"); + new HatType("ZjlkZTYwMWRlZTNmZmVjYTRkNTQ1OTVmODQ0MjAxZDBlZDIwOTFhY2VjNDU0OGM2OTZiYjE2YThhMTU4ZjYifX19", "P", "&7&9The sixteenth letter in the alphabet!"); + new HatType("NjZjYTc2OWJkZTI1ZDRjYzQxZTE5ZTQyYWRjMzVhYjRjMTU1N2I3NmFmMjMyNjQ5YWNjOTk2N2ZmMTk4ZjEzIn19fQ==", "Q", "&7&9The seventeenth letter in the alphabet!"); + new HatType("NjdhMTg4ODA1MTYyY2E1ZGQ0ZjQ2NDljNjYxZDNmNmQyM2M0MjY2MmFlZjAxNjQ1YjFhOTdmNzhiM2YxMzIxOSJ9fX0=", "R", "&7&9The eighteenth letter in the alphabet!"); + new HatType("NjBkMDlkZmQ5ZjVkZTYyNDMyMzNlMGUzMzI1YjZjMzQ3OTMzNWU3Y2NmMTNmMjQ0OGQ0ZTFmN2ZjNGEwZGYifX19", "S", "&7&9The nineteenth letter in the alphabet!"); + new HatType("NjRjNzU2MTliOTFkMjQxZjY3ODM1MGFkOTIzN2MxMzRjNWUwOGQ4N2Q2ODYwNzQxZWRlMzA2YTRlZjkxIn19fQ==", "T", "&7&9The twentieth letter in the alphabet!"); + new HatType("ZTlmNmQyYzZkNTI4NWY4ODJhZTU1ZDFlOTFiOGY5ZWZkZmM5YjM3NzIwOGJmNGM4M2Y4OGRkMTU2NDE1ZSJ9fX0=", "U", "&7&9The twenty-first letter in the alphabet!"); + new HatType("ZGNlMjdhMTUzNjM1ZjgzNTIzN2Q4NWM2YmY3NGY1YjFmMmU2MzhjNDhmZWU4YzgzMDM4ZDA1NThkNDFkYTcifX19", "V", "&7&9The twenty-second letter in the alphabet!"); + new HatType("YWVkY2Y0ZmZjYjUzYjU2ZDQyYmFhYzlkMGRmYjExOGUzNDM0NjIzMjc0NDJkZDliMjlkNDlmNTBhN2QzOGIifX19", "W", "&7&9The twenty-third letter in the alphabet!"); + new HatType("ODM2MThmZjEyMTc2NDBiZWM1YjUyNWZhMmE4ZTY3MWM3NWQyYTdkN2NiMmRkYzMxZDc5ZDlkODk1ZWFiMSJ9fX0=", "X", "&7&9The twenty-fourth letter in the alphabet!"); + new HatType("ZDljMWQyOWEzOGJjZjExM2I3ZThjMzRlMTQ4YTc5ZjlmZTQxZWRmNDFhYThiMWRlODczYmIxZDQzM2IzODYxIn19fQ==", "Y", "&7&9The twenty-fifth letter in the alphabet!"); + new HatType("YjkyOTU3MzQxOTVkMmM3ZmEzODliOTg3NTdlOTY4NmNlNjQzN2MxNmM1OGJkZjJiNGNkNTM4Mzg5YjU5MTIifX19", "Z", "&7&9The twenty-sixth letter in the alphabet!"); + } } \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MorphType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MorphType.java index 1bca3c8f2..09b972a42 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MorphType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MorphType.java @@ -3,16 +3,8 @@ import be.isach.ultracosmetics.UltraCosmeticsData; import be.isach.ultracosmetics.config.MessageManager; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.morphs.Morph; -import be.isach.ultracosmetics.cosmetics.morphs.MorphBat; -import be.isach.ultracosmetics.cosmetics.morphs.MorphBlaze; -import be.isach.ultracosmetics.cosmetics.morphs.MorphChicken; -import be.isach.ultracosmetics.cosmetics.morphs.MorphCreeper; -import be.isach.ultracosmetics.cosmetics.morphs.MorphEnderman; -import be.isach.ultracosmetics.cosmetics.morphs.MorphPig; -import be.isach.ultracosmetics.cosmetics.morphs.MorphSlime; -import be.isach.ultracosmetics.cosmetics.morphs.MorphSnowman; -import be.isach.ultracosmetics.cosmetics.morphs.MorphWitherSkeleton; +import be.isach.ultracosmetics.cosmetics.morphs.*; +import be.isach.ultracosmetics.util.ServerVersion; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import org.bukkit.Material; @@ -49,25 +41,14 @@ public static MorphType valueOf(String s) { public static void checkEnabled() { ENABLED.addAll(values().stream().filter(CosmeticType::isEnabled).collect(Collectors.toList())); } - - public static final MorphType BAT = new MorphType("ultracosmetics.morphs.bat", "Bat", Material.COAL, (byte) 0, DisguiseType.BAT, "&7&oBecome a bat!", MorphBat.class); - public static final MorphType BLAZE = new MorphType("ultracosmetics.morphs.blaze", "Blaze", Material.BLAZE_POWDER, (byte) 0, DisguiseType.BLAZE, "&7&oIt might be hot on there..", MorphBlaze.class); - public static final MorphType CHICKEN = new MorphType("ultracosmetics.morphs.chicken", "Chicken", Material.EGG, (byte) 0, DisguiseType.CHICKEN, "&7&oBecome a chicken!", MorphChicken.class); - public static final MorphType PIG = new MorphType("ultracosmetics.morphs.pig", "Pig", Material.PORK, (byte) 0, DisguiseType.PIG, "&7&oMust hold your carrot!", MorphPig.class); - public static final MorphType ENDERMAN = new MorphType("ultracosmetics.morphs.enderman", "Enderman", Material.ENDER_PEARL, (byte) 0, DisguiseType.ENDERMAN, "&7&oI go from there to\n" + "&7&othere, then you lost me..", MorphEnderman.class); - public static final MorphType SLIME = new MorphType("ultracosmetics.morphs.slime", "Slime", Material.SLIME_BALL, (byte) 0, DisguiseType.SLIME, "&7&oSplat splat!", MorphSlime.class); - public static final MorphType CREEPER = new MorphType("ultracosmetics.morphs.creeper", "Creeper", Material.SULPHUR, (byte) 0, DisguiseType.CREEPER, "&7&oHey What'sssssss up?", MorphCreeper.class); - public static final MorphType WITHERSKELETON = new MorphType("ultracosmetics.morphs.witherskeleton", "WitherSkeleton", Material.SKULL_ITEM, (byte) 1, DisguiseType.WITHER_SKELETON, "&7&oJust a regular skeleton..\n&7&obut from the Nether!", MorphWitherSkeleton.class); - public static final MorphType SNOWNMAN = new MorphType("ultracosmetics.morphs.snowman", "Snowman", Material.SNOW_BALL, (byte) 0, DisguiseType.SNOWMAN, "&7&oBecome Olaf!", MorphSnowman.class); - public static final MorphType ELDERGUARDIAN = new MorphType("ultracosmetics.morphs.elderguardian", "ElderGuardian", Material.PRISMARINE_CRYSTALS, (byte) 0, DisguiseType.valueOf("ELDER_GUARDIAN"), "&7&oBecome an Elder Guardian!!", UltraCosmeticsData.get().getVersionManager().getMorphs().getElderGuardianClass()); - + /** * Disguise Type of the morph. */ private DisguiseType disguiseType; - private MorphType(String permission, String configName, Material material, byte data, DisguiseType disguiseType, String defaultDesc, Class clazz) { - super(Category.MORPHS, configName, permission, defaultDesc, material, data, clazz); + private MorphType(String permission, String configName, Material material, byte data, DisguiseType disguiseType, String defaultDesc, Class clazz, ServerVersion baseVersion) { + super(Category.MORPHS, configName, permission, defaultDesc, material, data, clazz, baseVersion); this.disguiseType = disguiseType; VALUES.add(this); @@ -90,4 +71,36 @@ public String getSkill() { public DisguiseType getDisguiseType() { return disguiseType; } + + public static void register() { + ServerVersion serverVersion = UltraCosmeticsData.get().getServerVersion(); + + new MorphType("ultracosmetics.morphs.bat", "Bat", Material.COAL, (byte) 0, DisguiseType.BAT, "&7&oBecome a bat!", MorphBat.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.blaze", "Blaze", Material.BLAZE_POWDER, (byte) 0, DisguiseType.BLAZE, "&7&oIt might be hot on there..", MorphBlaze.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.chicken", "Chicken", Material.EGG, (byte) 0, DisguiseType.CHICKEN, "&7&oBecome a chicken!", MorphChicken.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.pig", "Pig", Material.PORK, (byte) 0, DisguiseType.PIG, "&7&oMust hold your carrot!", MorphPig.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.enderman", "Enderman", Material.ENDER_PEARL, (byte) 0, DisguiseType.ENDERMAN, "&7&oI go from there to\n" + "&7&othere, then you lost me..", MorphEnderman.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.slime", "Slime", Material.SLIME_BALL, (byte) 0, DisguiseType.SLIME, "&7&oSplat splat!", MorphSlime.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.creeper", "Creeper", Material.SULPHUR, (byte) 0, DisguiseType.CREEPER, "&7&oHey What'sssssss up?", MorphCreeper.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.witherskeleton", "WitherSkeleton", Material.SKULL_ITEM, (byte) 1, DisguiseType.WITHER_SKELETON, "&7&oJust a regular skeleton..\n&7&obut from the Nether!", MorphWitherSkeleton.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.snowman", "Snowman", Material.SNOW_BALL, (byte) 0, DisguiseType.SNOWMAN, "&7&oBecome Olaf!", MorphSnowman.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.elderguardian", "ElderGuardian", Material.PRISMARINE_CRYSTALS, (byte) 0, DisguiseType.ELDER_GUARDIAN, "&7&oBecome an Elder Guardian!!", UltraCosmeticsData.get().getVersionManager().getMorphs().getElderGuardianClass(), ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.cow", "Cow", Material.MILK_BUCKET, (byte) 0, DisguiseType.COW, "&7&oMoooo!", MorphCow.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.sheep", "Sheep", Material.WOOL, (byte) 0, DisguiseType.SHEEP, "&7&oBaaaa, baa", MorphSheep.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.mooshroom", "Mooshroom", Material.RED_MUSHROOM, (byte) 0, DisguiseType.MUSHROOM_COW, "&7&oMoooo!", MorphMooshroom.class, ServerVersion.v1_8_R1); + new MorphType("ultracosmetics.morphs.villager", "Villager", Material.EMERALD, (byte) 0, DisguiseType.VILLAGER, "&7&oHmmmmmmmmm", MorphVillager.class, ServerVersion.v1_8_R1); + + if (serverVersion.compareTo(ServerVersion.v1_9_R1) >= 0) { + new MorphType("ultracosmetics.morphs.witch", "Witch", Material.POISONOUS_POTATO, (byte) 0, DisguiseType.WITCH, "&7&oMuahahahahaha", MorphWitch.class, ServerVersion.v1_9_R1); + } + if (serverVersion.compareTo(ServerVersion.v1_10_R1) >= 0) { + new MorphType("ultracosmetics.morphs.polarbear", "PolarBear", Material.SNOW_BLOCK, (byte) 0, DisguiseType.POLAR_BEAR, "&7&oI prefer cold areas", MorphPolarBear.class, ServerVersion.v1_10_R1); + } + if (serverVersion.compareTo(ServerVersion.v1_11_R1) >= 0) { + new MorphType("ultracosmetics.morphs.llama", "Llama", Material.WOOL, (byte) 14, DisguiseType.LLAMA, "&7&oNeed me to carry anything?", MorphLlama.class, ServerVersion.v1_11_R1); + } + if (serverVersion.compareTo(ServerVersion.v1_12_R1) >= 0) { + new MorphType("ultracosmetics.morphs.parrot", "Parrot", Material.COOKIE, (byte) 0, DisguiseType.PARROT, "&7&oPolly want a cracker?", MorphParrot.class, ServerVersion.v1_12_R1); + } + } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MountType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MountType.java index 3b91d94a9..cf4c00248 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MountType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/MountType.java @@ -4,18 +4,7 @@ import be.isach.ultracosmetics.config.MessageManager; import be.isach.ultracosmetics.config.SettingsManager; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.mounts.Mount; -import be.isach.ultracosmetics.cosmetics.mounts.MountDragon; -import be.isach.ultracosmetics.cosmetics.mounts.MountDruggedHorse; -import be.isach.ultracosmetics.cosmetics.mounts.MountEcologistHorse; -import be.isach.ultracosmetics.cosmetics.mounts.MountFlyingShip; -import be.isach.ultracosmetics.cosmetics.mounts.MountGlacialSteed; -import be.isach.ultracosmetics.cosmetics.mounts.MountHypeCart; -import be.isach.ultracosmetics.cosmetics.mounts.MountMoltenSnake; -import be.isach.ultracosmetics.cosmetics.mounts.MountNyanSheep; -import be.isach.ultracosmetics.cosmetics.mounts.MountOfFire; -import be.isach.ultracosmetics.cosmetics.mounts.MountOfWater; -import be.isach.ultracosmetics.cosmetics.mounts.MountSnake; +import be.isach.ultracosmetics.cosmetics.mounts.*; import be.isach.ultracosmetics.util.ServerVersion; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -54,39 +43,16 @@ public static MountType valueOf(String s) { public static void checkEnabled() { ENABLED.addAll(values().stream().filter(MountType::isEnabled).collect(Collectors.toList())); } - - public static final MountType DRUGGEDHORSE = new MountType("ultracosmetics.mounts.druggedhorse", "DruggedHorse", Material.SUGAR, (byte) 0, EntityType.HORSE, "&7&oThat is just too much!", 2, MountDruggedHorse.class); - public static final MountType INFERNALHORROR = new MountType("ultracosmetics.mounts.infernalhorror", "InfernalHorror", Material.BONE, (byte) 0, UltraCosmeticsData.get().getVersionManager().getMounts().getHorrorType(), "&7&oThis mount comes directly from... hell!", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getHorrorClass()); - public static final MountType GLACIALSTEED = new MountType("ultracosmetics.mounts.glacialsteed", "GlacialSteed", Material.PACKED_ICE, (byte) 0, EntityType.HORSE, "&7&oThis mount comes from North Pole!", 2, MountGlacialSteed.class); - public static final MountType WALKINGDEAD = new MountType("ultracosmetics.mounts.walkingdead", "WalkingDead", Material.ROTTEN_FLESH, (byte) 0, UltraCosmeticsData.get().getVersionManager().getMounts().getWalkingDeadType(), "&7&oGraaaaw...", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getWalkingDeadClass()); - public static final MountType MOUNTOFFIRE = new MountType("ultracosmetics.mounts.mountoffire", "MountOfFire", Material.BLAZE_POWDER, (byte) 0, EntityType.HORSE, "&7&oThe mount of Hadès!", 2, MountOfFire.class); - public static final MountType MOUNTOFWATER = new MountType("ultracosmetics.mounts.mountofwater", "MountOfWater", Material.INK_SACK, (byte) 4, EntityType.HORSE, "&7&oThe mount of Poséidon!", 2, MountOfWater.class); - public static final MountType ECOLOGISTHORSE = new MountType("ultracosmetics.mounts.ecologisthorse", "EcologistHorse", Material.RED_ROSE, (byte) 0, EntityType.HORSE, "&7&oBecome ecologist!", 2, MountEcologistHorse.class); - public static final MountType SNAKE = new MountType("ultracosmetics.mounts.snake", "Snake", Material.SEEDS, (byte) 0, EntityType.SHEEP, "&7&oWatch out! It may bite..", 2, MountSnake.class); - public static final MountType NYANSHEEP = new MountType("ultracosmetics.mounts.nyansheep", "NyanSheep", Material.STAINED_GLASS, (byte) 9, EntityType.SHEEP, "&4&lNyan &6&lnyan &e&lnyan\n&a&lnyan &3&lnyan &9&lnyan", 1, MountNyanSheep.class); - public static final MountType DRAGON = new MountType("ultracosmetics.mounts.dragon", "Dragon", Material.DRAGON_EGG, (byte) 0, EntityType.ENDER_DRAGON, "&7&oBecome a dragon rider!", 1, MountDragon.class); - public static final MountType SKYSQUID = new MountType("ultracosmetics.mounts.skysquid", "SkySquid", Material.INK_SACK, (byte) 0, EntityType.SQUID, "&7&oWat.", 4, UltraCosmeticsData.get().getVersionManager().getMounts().getSquidClass()); - public static final MountType SLIME = new MountType("ultracosmetics.mounts.slime", "Slime", Material.SLIME_BALL, (byte) 0, EntityType.SLIME, "&7&oSplat! Splat!", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getSlimeClass()); - public static final MountType HYPECART = new MountType("ultracosmetics.mounts.hypecart", "HypeCart", Material.MINECART, (byte) 0, EntityType.MINECART, "&7&oEver wanted to drive a F1?\n&7&oNow you can!", 1, MountHypeCart.class); - public static final MountType SPIDER = new MountType("ultracosmetics.mounts.spider", "Spider", Material.WEB, (byte) 0, EntityType.SPIDER, "&7&oYOU are the spider jockey!", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getSpiderClass()); - public static final MountType RUDOLPH = new MountType("ultracosmetics.mounts.rudolph", "Rudolph", Material.DEAD_BUSH, (byte) 0, UltraCosmeticsData.get().getVersionManager().getMounts().getRudolphType(), "&7&oWhat would be Christmas\n&7&owithout Rudolph the Reeinder?", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getRudolphClass()); - public static final MountType MOLTENSNAKE = new MountType("ultracosmetics.mounts.moltensnake", "MoltenSnake", Material.MAGMA_CREAM, (byte) 0, EntityType.MAGMA_CUBE, "&7&oDeep under the Earth's surface, there\n&7&oexists a mythical species of Molten\n&7&oSnakes. This one will serve you eternally.", 1, MountMoltenSnake.class); - public static final MountType FLYINGSHIP = new MountType("ultracosmetics.mounts.flyingship", "FlyingShip", Material.BOAT, (byte) 0, EntityType.BOAT, "&7&oBomb them all!", 2, MountFlyingShip.class); - + private int repeatDelay; - MountType(String permission, String configName, Material material, byte data, EntityType entityType, String defaultDescription, int repeatDelay, Class mountClass) { - super(Category.MOUNTS, configName, permission, defaultDescription, material, data, entityType, mountClass); + MountType(String permission, String configName, Material material, byte data, EntityType entityType, String defaultDescription, int repeatDelay, Class mountClass, ServerVersion baseVersion) { + super(Category.MOUNTS, configName, permission, defaultDescription, material, data, entityType, mountClass, baseVersion); this.repeatDelay = repeatDelay; VALUES.add(this); } - @Override - public boolean isEnabled() { - return !((this == FLYINGSHIP || this == SKYSQUID) && (UltraCosmeticsData.get().getServerVersion().compareTo(ServerVersion.v1_9_R1) >= 0)) && SettingsManager.getConfig().getBoolean("Mounts." + getConfigName() + ".Enabled"); - } - public String getMenuName() { return MessageManager.getMessage("Mounts." + getConfigName() + ".menu-name"); } @@ -103,4 +69,22 @@ public String getName(Player player) { public int getRepeatDelay() { return repeatDelay; } + + public static void register() { + new MountType("ultracosmetics.mounts.druggedhorse", "DruggedHorse", Material.SUGAR, (byte) 0, EntityType.HORSE, "&7&oThat is just too much!", 2, MountDruggedHorse.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.infernalhorror", "InfernalHorror", Material.BONE, (byte) 0, UltraCosmeticsData.get().getVersionManager().getMounts().getHorrorType(), "&7&oThis mount comes directly from... hell!", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getHorrorClass(), ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.glacialsteed", "GlacialSteed", Material.PACKED_ICE, (byte) 0, EntityType.HORSE, "&7&oThis mount comes from North Pole!", 2, MountGlacialSteed.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.walkingdead", "WalkingDead", Material.ROTTEN_FLESH, (byte) 0, UltraCosmeticsData.get().getVersionManager().getMounts().getWalkingDeadType(), "&7&oGraaaaw...", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getWalkingDeadClass(), ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.mountoffire", "MountOfFire", Material.BLAZE_POWDER, (byte) 0, EntityType.HORSE, "&7&oThe mount of Hadès!", 2, MountOfFire.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.mountofwater", "MountOfWater", Material.INK_SACK, (byte) 4, EntityType.HORSE, "&7&oThe mount of Poséidon!", 2, MountOfWater.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.ecologisthorse", "EcologistHorse", Material.RED_ROSE, (byte) 0, EntityType.HORSE, "&7&oBecome ecologist!", 2, MountEcologistHorse.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.snake", "Snake", Material.SEEDS, (byte) 0, EntityType.SHEEP, "&7&oWatch out! It may bite..", 2, MountSnake.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.nyansheep", "NyanSheep", Material.STAINED_GLASS, (byte) 9, EntityType.SHEEP, "&4&lNyan &6&lnyan &e&lnyan\n&a&lnyan &3&lnyan &9&lnyan", 1, MountNyanSheep.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.dragon", "Dragon", Material.DRAGON_EGG, (byte) 0, EntityType.ENDER_DRAGON, "&7&oBecome a dragon rider!", 1, MountDragon.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.slime", "Slime", Material.SLIME_BALL, (byte) 0, EntityType.SLIME, "&7&oSplat! Splat!", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getSlimeClass(), ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.hypecart", "HypeCart", Material.MINECART, (byte) 0, EntityType.MINECART, "&7&oEver wanted to drive a F1?\n&7&oNow you can!", 1, MountHypeCart.class, ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.spider", "Spider", Material.WEB, (byte) 0, EntityType.SPIDER, "&7&oYOU are the spider jockey!", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getSpiderClass(), ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.rudolph", "Rudolph", Material.DEAD_BUSH, (byte) 0, UltraCosmeticsData.get().getVersionManager().getMounts().getRudolphType(), "&7&oWhat would be Christmas\n&7&owithout Rudolph the Reeinder?", 2, UltraCosmeticsData.get().getVersionManager().getMounts().getRudolphClass(), ServerVersion.v1_8_R1); + new MountType("ultracosmetics.mounts.moltensnake", "MoltenSnake", Material.MAGMA_CREAM, (byte) 0, EntityType.MAGMA_CUBE, "&7&oDeep under the Earth's surface, there\n&7&oexists a mythical species of Molten\n&7&oSnakes. This one will serve you eternally.", 1, MountMoltenSnake.class, ServerVersion.v1_8_R1); + } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/ParticleEffectType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/ParticleEffectType.java index bc7118dbf..e6bdc2c9e 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/ParticleEffectType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/ParticleEffectType.java @@ -1,25 +1,9 @@ package be.isach.ultracosmetics.cosmetics.type; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffect; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectAngelWings; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectBloodHelix; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectCrushedCandyCane; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectEnchanted; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectEnderAura; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectFlameFairy; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectFlameRings; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectFrostLord; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectFrozenWalk; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectGreenSparks; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectInLove; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectInferno; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectMusic; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectRainCloud; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectSantaHat; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectSnowCloud; -import be.isach.ultracosmetics.cosmetics.particleeffects.ParticleEffectSuperHero; +import be.isach.ultracosmetics.cosmetics.particleeffects.*; import be.isach.ultracosmetics.util.Particles; +import be.isach.ultracosmetics.util.ServerVersion; import org.bukkit.Material; import java.util.ArrayList; @@ -56,29 +40,11 @@ public static void checkEnabled() { ENABLED.addAll(values().stream().filter(CosmeticType::isEnabled).collect(Collectors.toList())); } - public static final ParticleEffectType RAINCLOUD = new ParticleEffectType("ultracosmetics.particleeffects.raincloud", "RainCloud", 1, Particles.DRIP_WATER, Material.INK_SACK, (byte) 0, ParticleEffectRainCloud.class, "&7&oThe weather forecast\n&7&ois telling me it's raining."); - public static final ParticleEffectType SNOWCLOUD = new ParticleEffectType("ultracosmetics.particleeffects.snowcloud", "SnowCloud", 1, Particles.SNOW_SHOVEL, Material.SNOW_BALL, (byte) 0, ParticleEffectSnowCloud.class, "&7&oThe weather forecast\n&7&ois telling me it's snowing."); - public static final ParticleEffectType BLOODHELIX = new ParticleEffectType("ultracosmetics.particleeffects.bloodhelix", "BloodHelix", 1, Particles.REDSTONE, Material.REDSTONE, (byte) 0, ParticleEffectBloodHelix.class, "&7&oAncient legend says this magic\n&7&oempowers the blood of its user,\n&7&ogiving them godly powers.."); - public static final ParticleEffectType FROSTLORD = new ParticleEffectType("ultracosmetics.particleeffects.frostlord", "FrostLord", 1, Particles.SNOW_SHOVEL, Material.PACKED_ICE, (byte) 0, ParticleEffectFrostLord.class, "&7&oI am The Almighty Frostlord!"); - public static final ParticleEffectType FLAMERINGS = new ParticleEffectType("ultracosmetics.particleeffects.flamerings", "FlameRings", 1, Particles.FLAME, Material.BLAZE_POWDER, (byte) 0, ParticleEffectFlameRings.class, "&7&oWatch out! They are hot!"); - public static final ParticleEffectType INLOVE = new ParticleEffectType("ultracosmetics.particleeffects.inlove", "InLove", 1, Particles.HEART, Material.RED_ROSE, (byte) 0, ParticleEffectInLove.class, "&7&oOMG wow I'm in love!"); - public static final ParticleEffectType GREENSPARKS = new ParticleEffectType("ultracosmetics.particleeffects.greensparks", "GreenSparks", 1, Particles.VILLAGER_HAPPY, Material.EMERALD, (byte) 0, ParticleEffectGreenSparks.class, "&7&oLittle and green sparkly sparks!"); - public static final ParticleEffectType FROZENWALK = new ParticleEffectType("ultracosmetics.particleeffects.frozenwalk", "FrozenWalk", 1, Particles.SNOW_SHOVEL, Material.SNOW_BALL, (byte) 0, ParticleEffectFrozenWalk.class, "&7&oMy feet are so cold!"); - public static final ParticleEffectType MUSIC = new ParticleEffectType("ultracosmetics.particleeffects.music", "Music", 4, Particles.FLAME, Material.RECORD_7, (byte) 0, ParticleEffectMusic.class, "&7&oMuch music!"); - public static final ParticleEffectType ENCHANTED = new ParticleEffectType("ultracosmetics.particleeffects.enchanted", "Enchanted", 1, Particles.ENCHANTMENT_TABLE, Material.BOOK, (byte) 0, ParticleEffectEnchanted.class, "&7&oBecome an almighty enchanter!"); - public static final ParticleEffectType INFERNO = new ParticleEffectType("ultracosmetics.particleeffects.inferno", "Inferno", 1, Particles.FLAME, Material.NETHER_STALK, (byte) 0, ParticleEffectInferno.class, "&7&oEffect created by Satan himself!"); - public static final ParticleEffectType ANGELWINGS = new ParticleEffectType("ultracosmetics.particleeffects.angelwings", "AngelWings", 2, Particles.REDSTONE, Material.FEATHER, (byte) 0, ParticleEffectAngelWings.class, "&7&oBecome an angel!"); - public static final ParticleEffectType SUPERHERO = new ParticleEffectType("ultracosmetics.particleeffects.superhero", "SuperHero", 2, Particles.REDSTONE, Material.GLOWSTONE_DUST, (byte) 0, ParticleEffectSuperHero.class, "&7&oBecome Superman!"); - public static final ParticleEffectType SANTAHAT = new ParticleEffectType("ultracosmetics.particleeffects.santahat", "SantaHat", 2, Particles.REDSTONE, Material.BEACON, (byte) 0, ParticleEffectSantaHat.class, "&7&oBecome Santa!"); - public static final ParticleEffectType CRUSHEDCANDYCANE = new ParticleEffectType("ultracosmetics.particleeffects.crushedcandycane", "CrushedCandyCane", 1, Particles.ITEM_CRACK, Material.INK_SACK, (byte) 1, ParticleEffectCrushedCandyCane.class, "&7&oThere's no such thing as too much\n&7&oChristmas Candy. Do not listen\n&7&oto your dentist."); - public static final ParticleEffectType ENDERAURA = new ParticleEffectType("ultracosmetics.particleeffects.enderaura", "EnderAura", 1, Particles.PORTAL, Material.EYE_OF_ENDER, (byte) 0, ParticleEffectEnderAura.class, "&7&oThese mystic particle attach" + " to\n&7&oonly the most legendary of players!"); - public static final ParticleEffectType FLAMEFAIRY = new ParticleEffectType("ultracosmetics.particleeffects.flamefairy", "FlameFairy", 1, Particles.FLAME, Material.BLAZE_POWDER, (byte) 0, ParticleEffectFlameFairy.class, "&7&oHEY!!"); - private Particles effect; private int repeatDelay; - private ParticleEffectType(String permission, String configName, int repeatDelay, Particles effect, Material material, byte data, Class clazz, String defaultDesc) { - super(Category.EFFECTS, configName, permission, defaultDesc, material, data, clazz); + private ParticleEffectType(String permission, String configName, int repeatDelay, Particles effect, Material material, byte data, Class clazz, String defaultDesc, ServerVersion baseVersion) { + super(Category.EFFECTS, configName, permission, defaultDesc, material, data, clazz, baseVersion); this.repeatDelay = repeatDelay; this.effect = effect; @@ -92,4 +58,24 @@ public Particles getEffect() { public int getRepeatDelay() { return repeatDelay; } + + public static void register() { + new ParticleEffectType("ultracosmetics.particleeffects.raincloud", "RainCloud", 1, Particles.DRIP_WATER, Material.INK_SACK, (byte) 0, ParticleEffectRainCloud.class, "&7&oThe weather forecast\n&7&ois telling me it's raining.", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.snowcloud", "SnowCloud", 1, Particles.SNOW_SHOVEL, Material.SNOW_BALL, (byte) 0, ParticleEffectSnowCloud.class, "&7&oThe weather forecast\n&7&ois telling me it's snowing.", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.bloodhelix", "BloodHelix", 1, Particles.REDSTONE, Material.REDSTONE, (byte) 0, ParticleEffectBloodHelix.class, "&7&oAncient legend says this magic\n&7&oempowers the blood of its user,\n&7&ogiving them godly powers..", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.frostlord", "FrostLord", 1, Particles.SNOW_SHOVEL, Material.PACKED_ICE, (byte) 0, ParticleEffectFrostLord.class, "&7&oI am The Almighty Frostlord!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.flamerings", "FlameRings", 1, Particles.FLAME, Material.BLAZE_POWDER, (byte) 0, ParticleEffectFlameRings.class, "&7&oWatch out! They are hot!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.inlove", "InLove", 1, Particles.HEART, Material.RED_ROSE, (byte) 0, ParticleEffectInLove.class, "&7&oOMG wow I'm in love!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.greensparks", "GreenSparks", 1, Particles.VILLAGER_HAPPY, Material.EMERALD, (byte) 0, ParticleEffectGreenSparks.class, "&7&oLittle and green sparkly sparks!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.frozenwalk", "FrozenWalk", 1, Particles.SNOW_SHOVEL, Material.SNOW_BALL, (byte) 0, ParticleEffectFrozenWalk.class, "&7&oMy feet are so cold!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.music", "Music", 4, Particles.FLAME, Material.RECORD_7, (byte) 0, ParticleEffectMusic.class, "&7&oMuch music!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.enchanted", "Enchanted", 1, Particles.ENCHANTMENT_TABLE, Material.BOOK, (byte) 0, ParticleEffectEnchanted.class, "&7&oBecome an almighty enchanter!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.inferno", "Inferno", 1, Particles.FLAME, Material.NETHER_STALK, (byte) 0, ParticleEffectInferno.class, "&7&oEffect created by Satan himself!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.angelwings", "AngelWings", 2, Particles.REDSTONE, Material.FEATHER, (byte) 0, ParticleEffectAngelWings.class, "&7&oBecome an angel!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.superhero", "SuperHero", 2, Particles.REDSTONE, Material.GLOWSTONE_DUST, (byte) 0, ParticleEffectSuperHero.class, "&7&oBecome Superman!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.santahat", "SantaHat", 2, Particles.REDSTONE, Material.BEACON, (byte) 0, ParticleEffectSantaHat.class, "&7&oBecome Santa!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.crushedcandycane", "CrushedCandyCane", 1, Particles.ITEM_CRACK, Material.INK_SACK, (byte) 1, ParticleEffectCrushedCandyCane.class, "&7&oThere's no such thing as too much\n&7&oChristmas Candy. Do not listen\n&7&oto your dentist.", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.enderaura", "EnderAura", 1, Particles.PORTAL, Material.EYE_OF_ENDER, (byte) 0, ParticleEffectEnderAura.class, "&7&oThese mystic particle attach" + " to\n&7&oonly the most legendary of players!", ServerVersion.v1_8_R1); + new ParticleEffectType("ultracosmetics.particleeffects.flamefairy", "FlameFairy", 1, Particles.FLAME, Material.BLAZE_POWDER, (byte) 0, ParticleEffectFlameFairy.class, "&7&oHEY!!", ServerVersion.v1_8_R1); + } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/PetType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/PetType.java index 92d2da33d..3c1b73d61 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/PetType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/PetType.java @@ -3,17 +3,9 @@ import be.isach.ultracosmetics.UltraCosmeticsData; import be.isach.ultracosmetics.config.MessageManager; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.pets.Pet; -import be.isach.ultracosmetics.cosmetics.pets.PetChick; -import be.isach.ultracosmetics.cosmetics.pets.PetChristmasElf; -import be.isach.ultracosmetics.cosmetics.pets.PetCow; -import be.isach.ultracosmetics.cosmetics.pets.PetDog; -import be.isach.ultracosmetics.cosmetics.pets.PetEasterBunny; -import be.isach.ultracosmetics.cosmetics.pets.PetKitty; -import be.isach.ultracosmetics.cosmetics.pets.PetMooshroom; -import be.isach.ultracosmetics.cosmetics.pets.PetPiggy; -import be.isach.ultracosmetics.cosmetics.pets.PetSheep; -import be.isach.ultracosmetics.cosmetics.pets.PetWither; +import be.isach.ultracosmetics.cosmetics.pets.*; +import be.isach.ultracosmetics.util.ServerVersion; +import be.isach.ultracosmetics.version.GetForVersion; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -50,7 +42,7 @@ public static PetType valueOf(String s) { public static PetType getByName(String s) { try { - return VALUES.stream().filter(value -> value.getName().equalsIgnoreCase(s)).findFirst().get(); + return VALUES.stream().filter(value -> value.getConfigName().equalsIgnoreCase(s)).findFirst().get(); } catch (Exception exc) { return null; } @@ -59,26 +51,13 @@ public static PetType getByName(String s) { public static void checkEnabled() { ENABLED.addAll(values().stream().filter(CosmeticType::isEnabled).collect(Collectors.toList())); } - - public static final PetType PIGGY = new PetType("ultracosmetics.pets.piggy", "Piggy", Material.PORK, (byte) 0, "&7&oOink! Oink!", EntityType.PIG, PetPiggy.class); - public static final PetType SHEEP = new PetType("ultracosmetics.pets.sheep", "Sheep", Material.WOOL, (byte) 0, "&7&oBaaaa, baa", EntityType.SHEEP, PetSheep.class); - public static final PetType EASTERBUNNY = new PetType("ultracosmetics.pets.easterbunny", "EasterBunny", Material.CARROT_ITEM, (byte) 0, "&7&oIs it Easter yet?", EntityType.RABBIT, PetEasterBunny.class); - public static final PetType COW = new PetType("ultracosmetics.pets.cow", "Cow", Material.MILK_BUCKET, (byte) 0, "&7&oMoooo!", EntityType.COW, PetCow.class); - public static final PetType MOOSHROOM = new PetType("ultracosmetics.pets.mooshroom", "Mooshroom", Material.RED_MUSHROOM, (byte) 0, "&7&oMoooo!", EntityType.MUSHROOM_COW, PetMooshroom.class); - public static final PetType KITTY = new PetType("ultracosmetics.pets.kitty", "Kitty", Material.RAW_FISH, (byte) 0, "&7&oMeoooow", EntityType.OCELOT, PetKitty.class); - public static final PetType DOG = new PetType("ultracosmetics.pets.dog", "Dog", Material.BONE, (byte) 0, "&7&oWoof!", EntityType.WOLF, PetDog.class); - public static final PetType CHICK = new PetType("ultracosmetics.pets.chick", "Chick", Material.EGG, (byte) 0, "&7&oBwaaaaaaak!!", EntityType.CHICKEN, PetChick.class); - public static final PetType WITHER = new PetType("ultracosmetics.pets.wither", "Wither", Material.SKULL_ITEM, (byte) 1, "&7&oWatch out for me..", EntityType.WITHER, PetWither.class); - public static final PetType PUMPLING = new PetType("ultracosmetics.pets.pumpling", "Pumpling", Material.PUMPKIN, (byte) 0, "&7&oJust a little floating pumpkin", EntityType.ZOMBIE, UltraCosmeticsData.get().getVersionManager().getPets().getPumplingClass()); - public static final PetType CHRISTMASELF = new PetType("ultracosmetics.pets.christmaself", "ChristmasElf", Material.BEACON, (byte) 0, "&7&oI can make presents for you!", EntityType.VILLAGER, PetChristmasElf.class); - + private EntityType entityType; - private PetType(String permission, String configName, Material material, byte data, String defaultDesc, EntityType entityType, Class clazz) { - super(Category.PETS, configName, permission, defaultDesc, material, data, clazz); + private PetType(String permission, String configName, Material material, byte data, String defaultDesc, EntityType entityType, Class clazz, ServerVersion baseVersion) { + super(Category.PETS, configName, permission, defaultDesc, material, data, clazz, baseVersion); this.entityType = entityType; - VALUES.add(this); } @@ -94,4 +73,34 @@ public String getEntityName(Player player) { public String getName() { return MessageManager.getMessage("Pets." + getConfigName() + ".menu-name"); } + + public static void register() { + ServerVersion serverVersion = UltraCosmeticsData.get().getServerVersion(); + + new PetType("ultracosmetics.pets.piggy", "Piggy", Material.PORK, (byte) 0, "&7&oOink! Oink!", EntityType.PIG, PetPiggy.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.sheep", "Sheep", Material.WOOL, (byte) 0, "&7&oBaaaa, baa", EntityType.SHEEP, PetSheep.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.easterbunny", "EasterBunny", Material.CARROT_ITEM, (byte) 0, "&7&oIs it Easter yet?", EntityType.RABBIT, PetEasterBunny.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.cow", "Cow", Material.MILK_BUCKET, (byte) 0, "&7&oMoooo!", EntityType.COW, PetCow.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.mooshroom", "Mooshroom", Material.RED_MUSHROOM, (byte) 0, "&7&oMoooo!", EntityType.MUSHROOM_COW, PetMooshroom.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.kitty", "Kitty", Material.RAW_FISH, (byte) 0, "&7&oMeoooow", EntityType.OCELOT, PetKitty.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.dog", "Dog", Material.BONE, (byte) 0, "&7&oWoof!", EntityType.WOLF, PetDog.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.chick", "Chick", Material.EGG, (byte) 0, "&7&oBwaaaaaaak!!", EntityType.CHICKEN, PetChick.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.wither", "Wither", Material.SKULL_ITEM, (byte) 1, "&7&oWatch out for me..", EntityType.WITHER, PetWither.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.pumpling", "Pumpling", Material.PUMPKIN, (byte) 0, "&7&oJust a little floating pumpkin", EntityType.ZOMBIE, UltraCosmeticsData.get().getVersionManager().getPets().getPumplingClass(), ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.christmaself", "ChristmasElf", Material.BEACON, (byte) 0, "&7&oI can make presents for you!", EntityType.VILLAGER, PetChristmasElf.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.irongolem", "IronGolem", Material.IRON_INGOT, (byte) 0, "&7&oI like flowers", EntityType.IRON_GOLEM, PetIronGolem.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.snowman", "Snowman", Material.SNOW_BALL, (byte) 0, "&7&oPew pew pew", EntityType.SNOWMAN, PetSnowman.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.villager", "Villager", Material.EMERALD, (byte) 0, "&7&oHmmmmmmmmm", EntityType.VILLAGER, PetVillager.class, ServerVersion.v1_8_R1); + new PetType("ultracosmetics.pets.bat", "Bat", Material.COAL, (byte) 0, "&7&oI prefer dark areas", EntityType.BAT, PetBat.class, ServerVersion.v1_8_R1); + + if (serverVersion.compareTo(ServerVersion.v1_10_R1) >= 0) { + new PetType("ultracosmetics.pets.polarbear", "PolarBear", Material.SNOW_BLOCK, (byte) 0, "&7&oI prefer cold areas", GetForVersion.entityType("POLAR_BEAR"), PetPolarBear.class, ServerVersion.v1_10_R1); + } + if (serverVersion.compareTo(ServerVersion.v1_11_R1) >= 0) { + new PetType("ultracosmetics.pets.llama", "Llama", Material.WOOL, (byte) 14, "&7&oNeed me to carry anything?", GetForVersion.entityType("LLAMA"), PetLlama.class, ServerVersion.v1_11_R1); + } + if (serverVersion.compareTo(ServerVersion.v1_12_R1) >= 0) { + new PetType("ultracosmetics.pets.parrot", "Parrot", Material.COOKIE, (byte) 0, "&7&oPolly want a cracker?", GetForVersion.entityType("PARROT"), PetParrot.class, ServerVersion.v1_12_R1); + } + } } diff --git a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/SuitType.java b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/SuitType.java index 5855105dd..9ff1062e4 100644 --- a/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/SuitType.java +++ b/core/src/main/java/be/isach/ultracosmetics/cosmetics/type/SuitType.java @@ -3,13 +3,9 @@ import be.isach.ultracosmetics.UltraCosmetics; import be.isach.ultracosmetics.config.MessageManager; import be.isach.ultracosmetics.cosmetics.Category; -import be.isach.ultracosmetics.cosmetics.suits.ArmorSlot; -import be.isach.ultracosmetics.cosmetics.suits.Suit; -import be.isach.ultracosmetics.cosmetics.suits.SuitAstronaut; -import be.isach.ultracosmetics.cosmetics.suits.SuitDiamond; -import be.isach.ultracosmetics.cosmetics.suits.SuitRave; -import be.isach.ultracosmetics.cosmetics.suits.SuitSanta; +import be.isach.ultracosmetics.cosmetics.suits.*; import be.isach.ultracosmetics.player.UltraPlayer; +import be.isach.ultracosmetics.util.ServerVersion; import org.bukkit.Material; import java.lang.reflect.InvocationTargetException; @@ -47,11 +43,6 @@ public static void checkEnabled() { ENABLED.addAll(values().stream().filter(CosmeticType::isEnabled).collect(Collectors.toList())); } - public final static SuitType RAVE = new SuitType("Rave", "rave", "&7&oSuch amazing colors!", Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, SuitRave.class); - public final static SuitType ASTRONAUT = new SuitType("Astronaut", "astronaut", "&7&oHouston?", Material.GLASS, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS, SuitAstronaut.class); - public final static SuitType DIAMOND = new SuitType("Diamond", "diamond", "&7&oShow your Mining skills\n&7&owith this amazing outfit!", Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, SuitDiamond.class); - public final static SuitType SANTA = new SuitType("Santa", "santa", "&7&oBecome Santa and deliver presents!", Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, SuitSanta.class); - /** * The parts materials. */ @@ -68,8 +59,8 @@ public static void checkEnabled() { * @param clazz The Suit Class */ SuitType(String configName, String permissionSuffix, String defaultDesc, - Material h, Material c, Material l, Material b, Class clazz) { - super(Category.SUITS, configName, "ultracosmetics.suits." + permissionSuffix, defaultDesc, h, (byte) 0, clazz); + Material h, Material c, Material l, Material b, Class clazz, ServerVersion baseVersion) { + super(Category.SUITS, configName, "ultracosmetics.suits." + permissionSuffix, defaultDesc, h, (byte) 0, clazz, baseVersion); this.boots = b; this.helmet = h; this.chestplate = c; @@ -167,4 +158,11 @@ public String getName(ArmorSlot armorSlot) { public String getPermission(ArmorSlot armorSlot) { return getPermission() + "." + armorSlot.toString().toLowerCase(); } + + public static void register() { + new SuitType("Rave", "rave", "&7&oSuch amazing colors!", Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, SuitRave.class, ServerVersion.v1_8_R1); + new SuitType("Astronaut", "astronaut", "&7&oHouston?", Material.GLASS, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS, SuitAstronaut.class, ServerVersion.v1_8_R1); + new SuitType("Diamond", "diamond", "&7&oShow your Mining skills\n&7&owith this amazing outfit!", Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, SuitDiamond.class, ServerVersion.v1_8_R1); + new SuitType("Santa", "santa", "&7&oBecome Santa and deliver presents!", Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, SuitSanta.class, ServerVersion.v1_8_R1); + } } \ No newline at end of file diff --git a/core/src/main/java/be/isach/ultracosmetics/menu/menus/MenuSuits.java b/core/src/main/java/be/isach/ultracosmetics/menu/menus/MenuSuits.java index 87c8571bd..77d4bdb4c 100644 --- a/core/src/main/java/be/isach/ultracosmetics/menu/menus/MenuSuits.java +++ b/core/src/main/java/be/isach/ultracosmetics/menu/menus/MenuSuits.java @@ -109,14 +109,12 @@ public void open(UltraPlayer player, int page) { ItemMeta itemMeta = is.getItemMeta(); - if (suitType == SuitType.SANTA - || suitType == SuitType.RAVE) { - + if (suitType == SuitType.valueOf("santa") || suitType == SuitType.valueOf("rave")) { LeatherArmorMeta laMeta = (LeatherArmorMeta) itemMeta; Color color = Color.RED; - if (suitType == SuitType.RAVE) { + if (suitType == SuitType.valueOf("rave")) { int r = MathUtils.random(255); int g = MathUtils.random(255); int b = MathUtils.random(255); @@ -125,7 +123,6 @@ public void open(UltraPlayer player, int page) { } laMeta.setColor(color); - } List loreList = new ArrayList<>(); diff --git a/core/src/main/java/be/isach/ultracosmetics/treasurechests/CommandReward.java b/core/src/main/java/be/isach/ultracosmetics/treasurechests/CommandReward.java new file mode 100644 index 000000000..42534a2b3 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/treasurechests/CommandReward.java @@ -0,0 +1,56 @@ +package be.isach.ultracosmetics.treasurechests; + +import be.isach.ultracosmetics.UltraCosmeticsData; +import be.isach.ultracosmetics.util.CustomConfiguration; +import java.util.List; +import org.bukkit.ChatColor; +import org.bukkit.Material; + +/** + * A command reward. + * + * @author RadBuilder + * @since 10-21-2017 + */ +public class CommandReward { + private String name; + private Material material; + private int chance; + private boolean messageEnabled; + private String message; + private List commands; + + public CommandReward(String path) { + CustomConfiguration config = UltraCosmeticsData.get().getPlugin().getConfig(); + chance = config.getInt(path + ".Chance"); + messageEnabled = config.getBoolean(path + ".Message.enabled"); + message = config.getString(path + ".Message.message"); + commands = config.getStringList(path + ".Commands"); + material = Material.valueOf(config.getString(path + ".Material")); + name = ChatColor.translateAlternateColorCodes('&', config.getString(path + ".Name")); + } + + public int getChance() { + return chance; + } + + public boolean getMessageEnabled() { + return messageEnabled; + } + + public String getMessage() { + return message; + } + + public List getCommands() { + return commands; + } + + public String getName() { + return name; + } + + public Material getMaterial() { + return material; + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/treasurechests/TreasureRandomizer.java b/core/src/main/java/be/isach/ultracosmetics/treasurechests/TreasureRandomizer.java index 6141bbb00..b921705d4 100755 --- a/core/src/main/java/be/isach/ultracosmetics/treasurechests/TreasureRandomizer.java +++ b/core/src/main/java/be/isach/ultracosmetics/treasurechests/TreasureRandomizer.java @@ -14,10 +14,12 @@ import be.isach.ultracosmetics.cosmetics.type.ParticleEffectType; import be.isach.ultracosmetics.cosmetics.type.PetType; import be.isach.ultracosmetics.cosmetics.type.SuitType; +import be.isach.ultracosmetics.util.CustomConfiguration; import be.isach.ultracosmetics.util.MathUtils; import be.isach.ultracosmetics.util.SoundUtil; import be.isach.ultracosmetics.util.Sounds; import be.isach.ultracosmetics.util.TextUtil; +import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -39,27 +41,41 @@ * Created by sacha on 19/08/15. */ public class TreasureRandomizer { + private static final int MONEY_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Money.Chance"); + private static final int GADGET_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Gadgets.Chance"); + private static final int AMMO_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Gadgets-Ammo.Chance"); + private static final int MORPHS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Morphs.Chance"); + private static final int PETS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Pets.Chance"); + private static final int EFFECTS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Effects.Chance"); + private static final int MOUNTS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Mounts.Chance"); + private static final int HATS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Hats.Chance"); + private static final int HELMET_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; + private static final int CHESTPLATE_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; + private static final int LEGGINGS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; + private static final int BOOTS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; + private static final int EMOTES_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Emotes.Chance"); - Player player; + private static List gadgetList = new ArrayList<>(); + private static List ammoList = new ArrayList<>(); + private static List particleEffectList = new ArrayList<>(); + private static List mountList = new ArrayList<>(); + private static List petList = new ArrayList<>(); + private static List morphList = new ArrayList<>(); + private static List hatList = new ArrayList<>(); + private static List helmetList = new ArrayList<>(); + private static List chestplateList = new ArrayList<>(); + private static List leggingList = new ArrayList<>(); + private static List bootList = new ArrayList<>(); + private static List emoteList = new ArrayList<>(); + private static List commandRewardList = new ArrayList<>(); + + private static Random random = new Random(); + + private Player player; public Location loc; private ItemStack itemStack; private String name; - public static List gadgetList = new ArrayList<>(); - public static List ammoList = new ArrayList<>(); - public static List particleEffectList = new ArrayList<>(); - public static List mountList = new ArrayList<>(); - public static List petList = new ArrayList<>(); - public static List morphList = new ArrayList<>(); - public static List hatList = new ArrayList<>(); - public static List helmetList = new ArrayList<>(); - public static List chestplateList = new ArrayList<>(); - public static List leggingList = new ArrayList<>(); - public static List bootList = new ArrayList<>(); - public static List emoteList = new ArrayList<>(); - - private static Random random = new Random(); - private enum ResultType { AMMO, GADGET, @@ -73,25 +89,12 @@ private enum ResultType { CHESTPLATE, LEGGINGS, BOOTS, - EMOTE + EMOTE, + COMMAND } private static final List RESULT_TYPES = new ArrayList<>(); - private static final int MONEY_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Money.Chance"); - private static final int GADGET_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Gadgets.Chance"); - private static final int AMMO_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Gadgets-Ammo.Chance"); - private static final int MORPHS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Morphs.Chance"); - private static final int PETS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Pets.Chance"); - private static final int EFFECTS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Effects.Chance"); - private static final int MOUNTS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Mounts.Chance"); - private static final int HATS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Hats.Chance"); - private static final int HELMET_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; - private static final int CHESTPLATE_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; - private static final int LEGGINGS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; - private static final int BOOTS_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Suits.Chance") / 4; - private static final int EMOTES_CHANCE = SettingsManager.getConfig().getInt("TreasureChests.Loots.Emotes.Chance"); - private static void setupChance(List resultRef, int percent, ResultType resultType) { for (int i = 0; i < percent; i++) { resultRef.add(resultType); @@ -177,7 +180,19 @@ public TreasureRandomizer(final Player player, Location location) { if (emoteType.canBeFound() && !player.hasPermission(emoteType.getPermission())) emoteList.add(emoteType); - + if (commandRewardList.isEmpty()) { + CustomConfiguration config = UltraCosmeticsData.get().getPlugin().getConfig(); + + for (String key : config.getConfigurationSection("TreasureChests.Loots.Commands").getKeys(false)) { + String path = "TreasureChests.Loots.Commands." + key; + if (config.getBoolean(path + ".Enabled")) { + String cancelPermission = config.getString(path + ".Cancel-If-Permission"); + if (cancelPermission.equals("no") || !player.hasPermission(cancelPermission)) { + commandRewardList.add(new CommandReward(path)); + } + } + } + } if (!Category.MOUNTS.isEnabled()) mountList.clear(); @@ -253,6 +268,12 @@ public TreasureRandomizer(final Player player, Location location) { && !emoteList.isEmpty() && (boolean) SettingsManager.getConfig().get("TreasureChests.Loots.Emotes.Enabled")) setupChance(RESULT_TYPES, EMOTES_CHANCE, ResultType.EMOTE); + + for (CommandReward commandReward : commandRewardList) { + for (int i = 0; i < commandReward.getChance(); i++) { + RESULT_TYPES.add(ResultType.COMMAND); + } + } } private String getMessage(String s) { @@ -324,6 +345,9 @@ public void giveRandomThing() { case EMOTE: giveRandomEmote(); break; + case COMMAND: + giveRandomCommandReward(); + break; } } catch (IndexOutOfBoundsException | IllegalArgumentException exception) { @@ -363,6 +387,7 @@ public void clear() { leggingList.clear(); bootList.clear(); emoteList.clear(); + commandRewardList.clear(); RESULT_TYPES.clear(); types.clear(); } @@ -530,6 +555,26 @@ public void giveRandomMorph() { .replace("%name%", player.getName()).replace("%morph%", (UltraCosmeticsData.get().arePlaceholdersColored()) ? morph.getName() : TextUtil.filterColor(morph.getName()))); } + public void giveRandomCommandReward() { + ArrayList rewards = new ArrayList<>(); + for (CommandReward commandReward : commandRewardList) { + for (int i = 0; i < commandReward.getChance(); i++) { + rewards.add(commandReward); + } + } + CommandReward reward = rewards.get(random.nextInt(rewards.size())); + rewards.clear(); + for (String command : reward.getCommands()) { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ChatColor.translateAlternateColorCodes('&', command.replace("%name%", player.getName()))); + } + name = reward.getName().replace("%name%", player.getName()); + itemStack = new ItemStack(reward.getMaterial()); + spawnRandomFirework(loc); + + if (reward.getMessageEnabled()) + Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', reward.getMessage().replace("%name%", player.getName()).replace("%prefix%", MessageManager.getMessage("Prefix")))); + } + public static FireworkEffect getRandomFireworkEffect() { if (!UltraCosmeticsData.get().getPlugin().isEnabled()) diff --git a/core/src/main/java/be/isach/ultracosmetics/version/GetForVersion.java b/core/src/main/java/be/isach/ultracosmetics/version/GetForVersion.java new file mode 100644 index 000000000..d40926037 --- /dev/null +++ b/core/src/main/java/be/isach/ultracosmetics/version/GetForVersion.java @@ -0,0 +1,26 @@ +package be.isach.ultracosmetics.version; + +import org.bukkit.entity.EntityType; + +/** + * Gets version specific things (e.g. entity types), if valid. + * + * @author RadBuilder + * @since 10-20-2017 + */ +public class GetForVersion { + /** + * Gets the {@link org.bukkit.entity.EntityType EntityType} for the server version, if valid. + * + * @param name The name of the entity type. + * @return The {@link org.bukkit.entity.EntityType EntityType} for the server version, if valid. + */ + public static EntityType entityType(String name) { + for (EntityType type : EntityType.values()) { + if (type.toString().equalsIgnoreCase(name)) { + return type; + } + } + return EntityType.values()[0]; + } +} diff --git a/core/src/main/java/be/isach/ultracosmetics/version/IMounts.java b/core/src/main/java/be/isach/ultracosmetics/version/IMounts.java index c5995851a..1be26fb57 100644 --- a/core/src/main/java/be/isach/ultracosmetics/version/IMounts.java +++ b/core/src/main/java/be/isach/ultracosmetics/version/IMounts.java @@ -4,8 +4,6 @@ import org.bukkit.entity.EntityType; public interface IMounts { - Class getSquidClass(); - Class getSpiderClass(); Class getSlimeClass(); diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index d413831e8..8062c481c 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -137,6 +137,30 @@ TreasureChests: Message: enabled: false message: '%prefix% &6&l%name% found rare %emote%' + Commands: + shoutout: + Name: '&d&lShoutout' + Material: 'NETHER_STAR' + Enabled: false + Chance: 100 + Message: + enabled: false + message: '%prefix% &6&l%name% found a rare shoutout!' + Cancel-If-Permission: 'no' + Commands: + - 'say %name% is awesome!' + flower: + Name: '&e&lFlower' + Material: 'YELLOW_FLOWER' + Enabled: false + Chance: 100 + Message: + enabled: true + message: '%prefix% &6&l%name% found a flower!' + Cancel-If-Permission: 'example.yellowflower' + Commands: + - 'give %name% yellow_flower 1' + - 'pex user %name% add example.yellowflower' Designs: Classic: center-block: '169:0' diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/Mounts.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/Mounts.java index bb735779b..a694c10d0 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/Mounts.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_10_R1.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_10_R1.mount.MountRudolph; -import be.isach.ultracosmetics.v1_10_R1.mount.MountSkySquid; import be.isach.ultracosmetics.v1_10_R1.mount.MountSlime; import be.isach.ultracosmetics.v1_10_R1.mount.MountSpider; import be.isach.ultracosmetics.v1_10_R1.mount.MountWalkingDead; @@ -11,11 +10,6 @@ import org.bukkit.entity.EntityType; public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/CustomEntities.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/CustomEntities.java index 915d8f921..6af9abae0 100755 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/CustomEntities.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/CustomEntities.java @@ -12,8 +12,6 @@ import java.util.Map; public enum CustomEntities { - - // FLYING_SQUID("FlyingSquid", EntityType.SQUID.getTypeId(), EntityType.SQUID, FlyingSquid.class, FlyingSquid.class), PUMPLING("Pumpling", EntityType.ZOMBIE.getTypeId(), EntityType.ZOMBIE, Pumpling.class, Pumpling.class), SLIME("CustomSlime", EntityType.SLIME.getTypeId(), EntityType.SLIME, CustomSlime.class, CustomSlime.class), RIDEABLE_SPIDER("RideableSpider", EntityType.SPIDER.getTypeId(), EntityType.SPIDER, RideableSpider.class, RideableSpider.class), diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/FlyingSquid.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/FlyingSquid.java deleted file mode 100755 index 56421932f..000000000 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/customentities/FlyingSquid.java +++ /dev/null @@ -1,126 +0,0 @@ -package be.isach.ultracosmetics.v1_10_R1.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import be.isach.ultracosmetics.v1_10_R1.EntityBase; -import be.isach.ultracosmetics.v1_10_R1.nms.WrapperEntityHuman; -import be.isach.ultracosmetics.v1_10_R1.nms.WrapperEntityInsentient; -import net.minecraft.server.v1_10_R1.EntityHuman; -import net.minecraft.server.v1_10_R1.EntityInsentient; -import net.minecraft.server.v1_10_R1.EntitySquid; -import net.minecraft.server.v1_10_R1.MathHelper; -import net.minecraft.server.v1_10_R1.World; - -/** - * Custom Squid class. - *

- * Created by Sacha on 11/10/15. - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity, EntityBase { - - boolean canFly = true; - - public FlyingSquid(World world) { - super(world); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - EntityHuman passenger = null; - if (!bx().isEmpty()) { - passenger = (EntityHuman) bx().get(0); - } - ride(sideMot, forMot, passenger, this); - } - - @Override - public void g_(float sideMot, float forMot) { - super.g(sideMot, forMot); - } - - @Override - public float getSpeed() { - return 0.5f; - } - - @Override - public boolean canFly() { - return true; - } - - @Override - public org.bukkit.entity.Entity getEntity() { - return getBukkitEntity(); - } - - static void ride(float sideMot, float forMot, EntityHuman passenger, EntityInsentient entity) { - if (!(entity instanceof EntityBase)) - throw new IllegalArgumentException("The entity field should implements EntityBase"); - - EntityBase entityBase = (EntityBase) entity; - - WrapperEntityInsentient wEntity = new WrapperEntityInsentient(entity); - WrapperEntityHuman wPassenger = new WrapperEntityHuman(passenger); - - if (passenger != null) { - entity.lastYaw = entity.yaw = passenger.yaw % 360f; - entity.pitch = (passenger.pitch * 0.5F) % 360f; - - wEntity.setRenderYawOffset(entity.yaw); - wEntity.setRotationYawHead(entity.yaw); - - sideMot = wPassenger.getMoveStrafing() * 0.25f; - forMot = wPassenger.getMoveForward() * 0.5f; - - if (forMot <= 0.0F) - forMot *= 0.25F; - - wEntity.setJumping(wPassenger.isJumping()); - - if (wPassenger.isJumping() && (entity.onGround || entityBase.canFly())) { - entity.motY = 0.4D; - - float f2 = MathHelper.sin(entity.yaw * 0.017453292f); - float f3 = MathHelper.cos(entity.yaw * 0.017453292f); - entity.motX += (double) (-0.4f * f2); - entity.motZ += (double) (0.4f * f3); - } - - wEntity.setStepHeight(1.0f); - wEntity.setJumpMovementFactor(wEntity.getMoveSpeed() * 0.1f); - - wEntity.setRotationYawHead(entity.yaw); - - if (wEntity.canPassengerSteer()) { - wEntity.setMoveSpeed(0.35f * entityBase.getSpeed()); - entityBase.g_(sideMot, forMot); - } - - wEntity.setPrevLimbSwingAmount(wEntity.getLimbSwingAmount()); - - double dx = entity.locX - entity.lastX; - double dz = entity.locZ - entity.lastZ; - - float f4 = MathHelper.sqrt(dx * dx + dz * dz) * 4; - - if (f4 > 1) - f4 = 1; - - wEntity.setLimbSwingAmount(wEntity.getLimbSwingAmount() + (f4 - wEntity.getLimbSwingAmount()) * 0.4f); - wEntity.setLimbSwing(wEntity.getLimbSwing() + wEntity.getLimbSwingAmount()); - } else { - wEntity.setStepHeight(0.5f); - wEntity.setJumpMovementFactor(0.02f); - - entityBase.g_(sideMot, forMot); - } - } - - @Override - public void removeAi() { - setAI(false); - } -} diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/morphs/MorphElderGuardian.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/morphs/MorphElderGuardian.java index cb5243b86..507753d8d 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/morphs/MorphElderGuardian.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { private CustomGuardian customGuardian; public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } @EventHandler diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountCustomEntity.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountCustomEntity.java index 28f1d3e61..a07c56a79 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountCustomEntity.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_10_R1.customentities.CustomEntities; import be.isach.ultracosmetics.v1_10_R1.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_10_R1.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_10_R1.customentities.RideableSpider; import net.minecraft.server.v1_10_R1.Entity; import org.bukkit.Bukkit; @@ -34,11 +33,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountInfernalHorror.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountInfernalHorror.java index f589a242e..df411bf12 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountInfernalHorror.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountInfernalHorror.java @@ -14,7 +14,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountRudolph.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountRudolph.java index b11f1fa21..fd7369d8f 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountRudolph.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountRudolph.java @@ -25,7 +25,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSkySquid.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSkySquid.java deleted file mode 100755 index 8e33ebb40..000000000 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSkySquid.java +++ /dev/null @@ -1,35 +0,0 @@ -package be.isach.ultracosmetics.v1_10_R1.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.Effect; - -import java.util.Random; - -/** - * Created by Sacha on 11/10/15. - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - } - - @Override - public void onUpdate() { - Random random = new Random(); - for (int i = 0; i < 5; i++) - if (UltraCosmeticsData.get().isUsingSpigot()) - getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), - random.nextFloat(), random.nextFloat(), 1, 20, 64); - else - UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), - getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } -} diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSlime.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSlime.java index 4d5a34723..528df3c7e 100755 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSlime.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSpider.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSpider.java index aa90d9c47..d2f58c773 100755 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSpider.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountWalkingDead.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountWalkingDead.java index adca46d08..5a27c7251 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountWalkingDead.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/mount/MountWalkingDead.java @@ -14,7 +14,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/CustomEntityPet.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/CustomEntityPet.java index c764773a1..8b789680a 100644 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/CustomEntityPet.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/CustomEntityPet.java @@ -15,6 +15,7 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -27,9 +28,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); - + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } @Override diff --git a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/PetPumpling.java b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/PetPumpling.java index cad0599a1..0f4fa42b3 100755 --- a/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/PetPumpling.java +++ b/v1_10_R1/src/main/java/be/isach/ultracosmetics/v1_10_R1/pets/PetPumpling.java @@ -18,23 +18,7 @@ * Created by Sacha on 18/10/15. */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item item = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), - ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(item); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - item.remove(); - items.remove(item); - }, 5); + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/Mounts.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/Mounts.java index 83e175498..a91f655f0 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/Mounts.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_11_R1.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_11_R1.mount.MountRudolph; -import be.isach.ultracosmetics.v1_11_R1.mount.MountSkySquid; import be.isach.ultracosmetics.v1_11_R1.mount.MountSlime; import be.isach.ultracosmetics.v1_11_R1.mount.MountSpider; import be.isach.ultracosmetics.v1_11_R1.mount.MountWalkingDead; @@ -14,11 +13,6 @@ * @author RadBuilder */ public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/CustomEntities.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/CustomEntities.java index b77e4041a..270e52278 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/CustomEntities.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/CustomEntities.java @@ -23,7 +23,6 @@ * @author RadBuilder */ public enum CustomEntities { - // FLYING_SQUID("FlyingSquid", EntityType.SQUID.getTypeId(), EntityType.SQUID, FlyingSquid.class, FlyingSquid.class), PUMPLING("Pumpling", EntityType.ZOMBIE.getTypeId(), EntityType.ZOMBIE, EntityZombie.class, Pumpling.class), SLIME("CustomSlime", EntityType.SLIME.getTypeId(), EntityType.SLIME, EntitySlime.class, CustomSlime.class), RIDEABLE_SPIDER("RideableSpider", EntityType.SPIDER.getTypeId(), EntityType.SPIDER, EntitySpider.class, RideableSpider.class), diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/FlyingSquid.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/FlyingSquid.java deleted file mode 100644 index d85e71999..000000000 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/customentities/FlyingSquid.java +++ /dev/null @@ -1,124 +0,0 @@ -package be.isach.ultracosmetics.v1_11_R1.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import be.isach.ultracosmetics.v1_11_R1.EntityBase; -import be.isach.ultracosmetics.v1_11_R1.nms.WrapperEntityHuman; -import be.isach.ultracosmetics.v1_11_R1.nms.WrapperEntityInsentient; -import net.minecraft.server.v1_11_R1.EntityHuman; -import net.minecraft.server.v1_11_R1.EntityInsentient; -import net.minecraft.server.v1_11_R1.EntitySquid; -import net.minecraft.server.v1_11_R1.MathHelper; -import net.minecraft.server.v1_11_R1.World; - -/** - * @author RadBuilder - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity, EntityBase { - - boolean canFly = true; - - public FlyingSquid(World world) { - super(world); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - EntityHuman passenger = null; - if (!bx().isEmpty()) { - passenger = (EntityHuman) bx().get(0); - } - ride(sideMot, forMot, passenger, this); - } - - @Override - public void g_(float sideMot, float forMot) { - super.g(sideMot, forMot); - } - - @Override - public float getSpeed() { - return 0.5f; - } - - @Override - public boolean canFly() { - return true; - } - - @Override - public org.bukkit.entity.Entity getEntity() { - return getBukkitEntity(); - } - - static void ride(float sideMot, float forMot, EntityHuman passenger, EntityInsentient entity) { - if (!(entity instanceof EntityBase)) - throw new IllegalArgumentException("The entity field should implements EntityBase"); - - EntityBase entityBase = (EntityBase) entity; - - WrapperEntityInsentient wEntity = new WrapperEntityInsentient(entity); - WrapperEntityHuman wPassenger = new WrapperEntityHuman(passenger); - - if (passenger != null) { - entity.lastYaw = entity.yaw = passenger.yaw % 360f; - entity.pitch = (passenger.pitch * 0.5F) % 360f; - - wEntity.setRenderYawOffset(entity.yaw); - wEntity.setRotationYawHead(entity.yaw); - - sideMot = wPassenger.getMoveStrafing() * 0.25f; - forMot = wPassenger.getMoveForward() * 0.5f; - - if (forMot <= 0.0F) - forMot *= 0.25F; - - wEntity.setJumping(wPassenger.isJumping()); - - if (wPassenger.isJumping() && (entity.onGround || entityBase.canFly())) { - entity.motY = 0.4D; - - float f2 = MathHelper.sin(entity.yaw * 0.017453292f); - float f3 = MathHelper.cos(entity.yaw * 0.017453292f); - entity.motX += (double) (-0.4f * f2); - entity.motZ += (double) (0.4f * f3); - } - - wEntity.setStepHeight(1.0f); - wEntity.setJumpMovementFactor(wEntity.getMoveSpeed() * 0.1f); - - wEntity.setRotationYawHead(entity.yaw); - - if (wEntity.canPassengerSteer()) { - wEntity.setMoveSpeed(0.35f * entityBase.getSpeed()); - entityBase.g_(sideMot, forMot); - } - - wEntity.setPrevLimbSwingAmount(wEntity.getLimbSwingAmount()); - - double dx = entity.locX - entity.lastX; - double dz = entity.locZ - entity.lastZ; - - float f4 = MathHelper.sqrt(dx * dx + dz * dz) * 4; - - if (f4 > 1) - f4 = 1; - - wEntity.setLimbSwingAmount(wEntity.getLimbSwingAmount() + (f4 - wEntity.getLimbSwingAmount()) * 0.4f); - wEntity.setLimbSwing(wEntity.getLimbSwing() + wEntity.getLimbSwingAmount()); - } else { - wEntity.setStepHeight(0.5f); - wEntity.setJumpMovementFactor(0.02f); - - entityBase.g_(sideMot, forMot); - } - } - - @Override - public void removeAi() { - setAI(false); - } -} diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/morphs/MorphElderGuardian.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/morphs/MorphElderGuardian.java index 508384e2e..61a6bdd37 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/morphs/MorphElderGuardian.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { private CustomGuardian customGuardian; public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } @EventHandler diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountCustomEntity.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountCustomEntity.java index 3c8830d69..313bae4b9 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountCustomEntity.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_11_R1.customentities.CustomEntities; import be.isach.ultracosmetics.v1_11_R1.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_11_R1.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_11_R1.customentities.RideableSpider; import net.minecraft.server.v1_11_R1.Entity; import org.bukkit.Bukkit; @@ -33,11 +32,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountInfernalHorror.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountInfernalHorror.java index 76089c106..4d9757b59 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountInfernalHorror.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountInfernalHorror.java @@ -17,7 +17,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountRudolph.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountRudolph.java index 369151a38..8bc7df82c 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountRudolph.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountRudolph.java @@ -26,7 +26,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSkySquid.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSkySquid.java deleted file mode 100644 index 3be899c8e..000000000 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSkySquid.java +++ /dev/null @@ -1,35 +0,0 @@ -package be.isach.ultracosmetics.v1_11_R1.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.Effect; - -import java.util.Random; - -/** - * @author RadBuilder - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - } - - @Override - public void onUpdate() { - Random random = new Random(); - for (int i = 0; i < 5; i++) - if (UltraCosmeticsData.get().isUsingSpigot()) - getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), - random.nextFloat(), random.nextFloat(), 1, 20, 64); - else - UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), - getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } -} diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSlime.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSlime.java index 76c085e16..f2db91ffb 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSlime.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSpider.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSpider.java index e7305ff50..ae3c651a8 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSpider.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountWalkingDead.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountWalkingDead.java index a14055517..f1f06d709 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountWalkingDead.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/mount/MountWalkingDead.java @@ -17,7 +17,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/CustomEntityPet.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/CustomEntityPet.java index 9cb266a2e..9933de009 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/CustomEntityPet.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/CustomEntityPet.java @@ -14,6 +14,7 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; public abstract class CustomEntityPet extends Pet { @@ -23,9 +24,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); - + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } @Override diff --git a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/PetPumpling.java b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/PetPumpling.java index 81ad62fb5..2b8c86612 100644 --- a/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/PetPumpling.java +++ b/v1_11_R1/src/main/java/be/isach/ultracosmetics/v1_11_R1/pets/PetPumpling.java @@ -18,23 +18,7 @@ * @author RadBuilder */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item item = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), - ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(item); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - item.remove(); - items.remove(item); - }, 5); + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/Mounts.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/Mounts.java index 43e38f616..521db9817 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/Mounts.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_12_R1.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_12_R1.mount.MountRudolph; -import be.isach.ultracosmetics.v1_12_R1.mount.MountSkySquid; import be.isach.ultracosmetics.v1_12_R1.mount.MountSlime; import be.isach.ultracosmetics.v1_12_R1.mount.MountSpider; import be.isach.ultracosmetics.v1_12_R1.mount.MountWalkingDead; @@ -14,11 +13,6 @@ * @author RadBuilder */ public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/customentities/FlyingSquid.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/customentities/FlyingSquid.java deleted file mode 100644 index 85e973c78..000000000 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/customentities/FlyingSquid.java +++ /dev/null @@ -1,124 +0,0 @@ -package be.isach.ultracosmetics.v1_12_R1.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import be.isach.ultracosmetics.v1_12_R1.EntityBase; -import be.isach.ultracosmetics.v1_12_R1.nms.WrapperEntityHuman; -import be.isach.ultracosmetics.v1_12_R1.nms.WrapperEntityInsentient; -import net.minecraft.server.v1_12_R1.EntityHuman; -import net.minecraft.server.v1_12_R1.EntityInsentient; -import net.minecraft.server.v1_12_R1.EntitySquid; -import net.minecraft.server.v1_12_R1.MathHelper; -import net.minecraft.server.v1_12_R1.World; - -/** - * @author RadBuilder - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity, EntityBase { - - boolean canFly = true; - - public FlyingSquid(World world) { - super(world); - } - - @Override - public void a(float sideMot, float forMot, float f2) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - EntityHuman passenger = null; - if (!bF().isEmpty()) { - passenger = (EntityHuman) bF().get(0); - } - ride(sideMot, forMot, passenger, this); - } - - @Override - public void g_(float sideMot, float forMot) { - super.g(sideMot, forMot); - } - - @Override - public float getSpeed() { - return 0.5f; - } - - @Override - public boolean canFly() { - return true; - } - - @Override - public org.bukkit.entity.Entity getEntity() { - return getBukkitEntity(); - } - - static void ride(float sideMot, float forMot, EntityHuman passenger, EntityInsentient entity) { - if (!(entity instanceof EntityBase)) - throw new IllegalArgumentException("The entity field should implements EntityBase"); - - EntityBase entityBase = (EntityBase) entity; - - WrapperEntityInsentient wEntity = new WrapperEntityInsentient(entity); - WrapperEntityHuman wPassenger = new WrapperEntityHuman(passenger); - - if (passenger != null) { - entity.lastYaw = entity.yaw = passenger.yaw % 360f; - entity.pitch = (passenger.pitch * 0.5F) % 360f; - - wEntity.setRenderYawOffset(entity.yaw); - wEntity.setRotationYawHead(entity.yaw); - - sideMot = wPassenger.getMoveStrafing() * 0.25f; - forMot = wPassenger.getMoveForward() * 0.5f; - - if (forMot <= 0.0F) - forMot *= 0.25F; - - wEntity.setJumping(wPassenger.isJumping()); - - if (wPassenger.isJumping() && (entity.onGround || entityBase.canFly())) { - entity.motY = 0.4D; - - float f2 = MathHelper.sin(entity.yaw * 0.017453292f); - float f3 = MathHelper.cos(entity.yaw * 0.017453292f); - entity.motX += (double) (-0.4f * f2); - entity.motZ += (double) (0.4f * f3); - } - - wEntity.setStepHeight(1.0f); - wEntity.setJumpMovementFactor(wEntity.getMoveSpeed() * 0.1f); - - wEntity.setRotationYawHead(entity.yaw); - - if (wEntity.canPassengerSteer()) { - wEntity.setMoveSpeed(0.35f * entityBase.getSpeed()); - entityBase.g_(sideMot, forMot); - } - - wEntity.setPrevLimbSwingAmount(wEntity.getLimbSwingAmount()); - - double dx = entity.locX - entity.lastX; - double dz = entity.locZ - entity.lastZ; - - float f4 = MathHelper.sqrt(dx * dx + dz * dz) * 4; - - if (f4 > 1) - f4 = 1; - - wEntity.setLimbSwingAmount(wEntity.getLimbSwingAmount() + (f4 - wEntity.getLimbSwingAmount()) * 0.4f); - wEntity.setLimbSwing(wEntity.getLimbSwing() + wEntity.getLimbSwingAmount()); - } else { - wEntity.setStepHeight(0.5f); - wEntity.setJumpMovementFactor(0.02f); - - entityBase.g_(sideMot, forMot); - } - } - - @Override - public void removeAi() { - setNoAI(true); - } -} diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/morphs/MorphElderGuardian.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/morphs/MorphElderGuardian.java index c4f4454e8..211579c6f 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/morphs/MorphElderGuardian.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { private CustomGuardian customGuardian; public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } @EventHandler diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountCustomEntity.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountCustomEntity.java index e1b6a6a3a..3573466ca 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountCustomEntity.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_12_R1.customentities.CustomEntities; import be.isach.ultracosmetics.v1_12_R1.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_12_R1.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_12_R1.customentities.RideableSpider; import net.minecraft.server.v1_12_R1.Entity; import org.bukkit.Bukkit; @@ -33,11 +32,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountInfernalHorror.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountInfernalHorror.java index cc1b54cbf..f1a9a6a89 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountInfernalHorror.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountInfernalHorror.java @@ -17,7 +17,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountRudolph.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountRudolph.java index 99f664f7e..c32ca0064 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountRudolph.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountRudolph.java @@ -26,7 +26,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSkySquid.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSkySquid.java deleted file mode 100644 index d1c10857f..000000000 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSkySquid.java +++ /dev/null @@ -1,35 +0,0 @@ -package be.isach.ultracosmetics.v1_12_R1.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.Effect; - -import java.util.Random; - -/** - * @author RadBuilder - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - } - - @Override - public void onUpdate() { - Random random = new Random(); - for (int i = 0; i < 5; i++) - if (UltraCosmeticsData.get().isUsingSpigot()) - getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), - random.nextFloat(), random.nextFloat(), 1, 20, 64); - else - UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), - getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } -} diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSlime.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSlime.java index 48f0a5b73..5befb59d1 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSlime.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSpider.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSpider.java index efce2ccb9..8d6688d46 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSpider.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountWalkingDead.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountWalkingDead.java index 06cd6e37a..cde237050 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountWalkingDead.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/mount/MountWalkingDead.java @@ -17,7 +17,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/CustomEntityPet.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/CustomEntityPet.java index 8832cec92..6fd1194b6 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/CustomEntityPet.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/CustomEntityPet.java @@ -14,6 +14,7 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -26,8 +27,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } diff --git a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/PetPumpling.java b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/PetPumpling.java index c647f0267..3476a280c 100644 --- a/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/PetPumpling.java +++ b/v1_12_R1/src/main/java/be/isach/ultracosmetics/v1_12_R1/pets/PetPumpling.java @@ -18,23 +18,7 @@ * @author RadBuilder */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item item = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), - ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - item.setPickupDelay(30000); - item.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(item); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - item.remove(); - items.remove(item); - }, 5); + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/Mounts.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/Mounts.java index 86dcdc381..445ca60cc 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/Mounts.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_8_R1.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_8_R1.mount.MountRudolph; -import be.isach.ultracosmetics.v1_8_R1.mount.MountSkySquid; import be.isach.ultracosmetics.v1_8_R1.mount.MountSlime; import be.isach.ultracosmetics.v1_8_R1.mount.MountSpider; import be.isach.ultracosmetics.v1_8_R1.mount.MountWalkingDead; @@ -14,11 +13,6 @@ * @author RadBuilder */ public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/customentities/FlyingSquid.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/customentities/FlyingSquid.java deleted file mode 100644 index d76aa3f94..000000000 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/customentities/FlyingSquid.java +++ /dev/null @@ -1,195 +0,0 @@ -package be.isach.ultracosmetics.v1_8_R1.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import net.minecraft.server.v1_8_R1.BlockPosition; -import net.minecraft.server.v1_8_R1.EnchantmentManager; -import net.minecraft.server.v1_8_R1.EntityHuman; -import net.minecraft.server.v1_8_R1.EntityLiving; -import net.minecraft.server.v1_8_R1.EntitySquid; -import net.minecraft.server.v1_8_R1.MathHelper; -import net.minecraft.server.v1_8_R1.PathfinderGoalSelector; -import net.minecraft.server.v1_8_R1.World; -import org.bukkit.craftbukkit.v1_8_R1.util.UnsafeList; -import org.bukkit.entity.Entity; - -import java.lang.reflect.Field; - -/** - * @author RadBuilder - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity { - - - public FlyingSquid(World world) { - super(world); - } - - private void removeSelectors() { - try { - Field bField = PathfinderGoalSelector.class.getDeclaredField("b"); - bField.setAccessible(true); - Field cField = PathfinderGoalSelector.class.getDeclaredField("c"); - cField.setAccessible(true); - bField.set(goalSelector, new UnsafeList()); - bField.set(targetSelector, new UnsafeList()); - cField.set(goalSelector, new UnsafeList()); - cField.set(targetSelector, new UnsafeList()); - } catch (Exception exc) { - exc.printStackTrace(); - } - } - - @Override - public void removeAi() { - removeSelectors(); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - if (this.passenger != null && this.passenger instanceof EntityHuman - && CustomEntities.customEntities.contains(this)) { - this.lastYaw = this.yaw = this.passenger.yaw; - this.pitch = this.passenger.pitch * 0.5F; - this.setYawPitch(this.yaw, this.pitch); //Update the pitch and yaw - this.aG = this.aE = this.yaw; - sideMot = ((EntityLiving) this.passenger).aX * 0.5F; - forMot = ((EntityLiving) this.passenger).aY; - - Field jump = null; //Jumping - try { - jump = EntityLiving.class.getDeclaredField("aW"); - } catch (NoSuchFieldException | SecurityException e1) { - e1.printStackTrace(); - } - jump.setAccessible(true); - - try { - if (jump.getBoolean(this.passenger)) { - this.motY = 0.5D; // Used all the time in NMS for entity jumping - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - this.S = 1.0F;// The custom entity will now automatically climb up 1 high blocks - this.aK = this.yaw; - if (!this.world.isStatic) { - this.j(0.35f * 2); - - if (bL()) { - if (V()) { - double d0 = locY; - float f3 = 0.8F; - float f4 = 0.02F; - float f2 = EnchantmentManager.b(this); - if (f2 > 3.0F) { - f2 = 3.0F; - } - - if (f2 > 0.0F) { - f3 += (0.5460001F - f3) * f2 / 3.0F; - f4 += (bH() * 1.0F - f4) * f2 / 3.0F; - } - - a(sideMot, forMot, f4); - move(motX, motY, motZ); - motX *= f3; - motY *= 0.800000011920929D; - motZ *= f3; - motY -= 0.02D; - if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) - motY = 0.300000011920929D; - } else if (ab()) { - double d0 = locY; - a(sideMot, forMot, 0.02F); - move(motX, motY, motZ); - motX *= 0.5D; - motY *= 0.5D; - motZ *= 0.5D; - motY -= 0.02D; - if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) - motY = 0.300000011920929D; - } else { - float f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F; - - float f6 = 0.1627714F / (f5 * f5 * f5); - float f3 = bH() * f6; - - a(sideMot, forMot, f3); - f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F; - - if (j_()) { - float f4 = 0.15F; - motX = MathHelper.a(motX, -f4, f4); - motZ = MathHelper.a(motZ, -f4, f4); - fallDistance = 0.0F; - if (motY < -0.15D) { - motY = -0.15D; - } - - if (motY < 0.0D) { - motY = 0.0D; - } - } - - move(motX, motY, motZ); - if ((positionChanged) && (j_())) { - motY = 0.2D; - } - - if ((world.isStatic) && ((!world.isLoaded(new BlockPosition((int) locX, 0, (int) locZ))) || (!world.getChunkAtWorldCoords(new BlockPosition((int) locX, 0, (int) locZ)).o()))) { - if (locY > 0.0D) - motY = -0.1D; - else - motY = 0.0D; - } else { - motY += 0D; - } - - motY *= 0.9800000190734863D; - motX *= f5; - motZ *= f5; - } - } - - aw = ax; - double d0 = locX - lastX; - double d1 = locZ - lastZ; - - float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; - if (f2 > 1.0F) { - f2 = 1.0F; - } - - ax += (f2 - ax) * 0.4F; - ay += ax; - - super.g(sideMot, forMot); - } - - this.aw = this.ay; //Some extra things - double d0 = this.locX - this.lastX; - double d1 = this.locZ - this.lastZ; - float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; - if (f4 > 1.0F) { - f4 = 1.0F; - } - - this.ax += (f4 - this.ax) * 0.4F; - this.ay += this.ax; - } else { - this.S = 0.5F; - this.aI = 0.02F; - super.g(sideMot, forMot); - } - } - - @Override - public Entity getEntity() { - return getBukkitEntity(); - } -} diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/morphs/MorphElderGuardian.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/morphs/MorphElderGuardian.java index 0e3f893d6..6c8dc6511 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/morphs/MorphElderGuardian.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { public static List customEntities = new ArrayList<>(); public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } @EventHandler diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountCustomEntity.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountCustomEntity.java index 44d49fe9f..f6acedbdc 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountCustomEntity.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_8_R1.customentities.CustomEntities; import be.isach.ultracosmetics.v1_8_R1.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_8_R1.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_8_R1.customentities.RideableSpider; import net.minecraft.server.v1_8_R1.Entity; import org.bukkit.Bukkit; @@ -34,11 +33,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountInfernalHorror.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountInfernalHorror.java index 801377529..bd133f3f7 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountInfernalHorror.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountInfernalHorror.java @@ -14,7 +14,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountRudolph.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountRudolph.java index f49f59bf9..43d4f303d 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountRudolph.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountRudolph.java @@ -25,7 +25,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSkySquid.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSkySquid.java deleted file mode 100644 index 7276d385a..000000000 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSkySquid.java +++ /dev/null @@ -1,35 +0,0 @@ -package be.isach.ultracosmetics.v1_8_R1.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; - -/** - * @author RadBuilder - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - - } - - @Override - public void onUpdate() { -// Random random = new Random(); -// for (int i = 0; i < 5; i++) -// if (UltraCosmetics.usingSpigot()) -// getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), -// MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), -// random.nextFloat(), random.nextFloat(), 1, 20, 64); -// else -// UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), -// getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), -// MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } - - @Override - protected void onClear() { - - } -} diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSlime.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSlime.java index 888743d78..5aa65c2cb 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSlime.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSpider.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSpider.java index 4d98b44b3..50b0d6287 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSpider.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountWalkingDead.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountWalkingDead.java index 6cbb99835..28386377e 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountWalkingDead.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/mount/MountWalkingDead.java @@ -14,7 +14,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/CustomEntityPet.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/CustomEntityPet.java index 7cc0711be..448354521 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/CustomEntityPet.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/CustomEntityPet.java @@ -15,6 +15,7 @@ import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -27,9 +28,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); - + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } @Override diff --git a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/PetPumpling.java b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/PetPumpling.java index 469526ca9..5b4307dd8 100644 --- a/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/PetPumpling.java +++ b/v1_8_R1/src/main/java/be/isach/ultracosmetics/v1_8_R1/pets/PetPumpling.java @@ -18,22 +18,7 @@ * @author RadBuilder */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - - public PetPumpling(UltraPlayer ultraPlayer, UltraCosmetics ultraCosmetics) { - super(ultraPlayer, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item ITEM = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); - }, 5); + public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/Mounts.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/Mounts.java index 9b19783b0..84cc5e25a 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/Mounts.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_8_R2.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_8_R2.mount.MountRudolph; -import be.isach.ultracosmetics.v1_8_R2.mount.MountSkySquid; import be.isach.ultracosmetics.v1_8_R2.mount.MountSlime; import be.isach.ultracosmetics.v1_8_R2.mount.MountSpider; import be.isach.ultracosmetics.v1_8_R2.mount.MountWalkingDead; @@ -14,11 +13,6 @@ * @author RadBuilder */ public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/customentities/FlyingSquid.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/customentities/FlyingSquid.java deleted file mode 100644 index 2009e0d27..000000000 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/customentities/FlyingSquid.java +++ /dev/null @@ -1,196 +0,0 @@ -package be.isach.ultracosmetics.v1_8_R2.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import net.minecraft.server.v1_8_R2.BlockPosition; -import net.minecraft.server.v1_8_R2.EnchantmentManager; -import net.minecraft.server.v1_8_R2.EntityHuman; -import net.minecraft.server.v1_8_R2.EntityLiving; -import net.minecraft.server.v1_8_R2.EntitySquid; -import net.minecraft.server.v1_8_R2.MathHelper; -import net.minecraft.server.v1_8_R2.PathfinderGoalSelector; -import net.minecraft.server.v1_8_R2.World; -import org.bukkit.craftbukkit.v1_8_R2.util.UnsafeList; -import org.bukkit.entity.Entity; - -import java.lang.reflect.Field; - -/** - * @author RadBuilder - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity { - - - public FlyingSquid(World world) { - super(world); - } - - private void removeSelectors() { - try { - Field bField = PathfinderGoalSelector.class.getDeclaredField("b"); - bField.setAccessible(true); - Field cField = PathfinderGoalSelector.class.getDeclaredField("c"); - cField.setAccessible(true); - bField.set(goalSelector, new UnsafeList()); - bField.set(targetSelector, new UnsafeList()); - cField.set(goalSelector, new UnsafeList()); - cField.set(targetSelector, new UnsafeList()); - } catch (Exception exc) { - exc.printStackTrace(); - } - } - - @Override - public void removeAi() { - removeSelectors(); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - if (this.passenger != null && this.passenger instanceof EntityHuman - && CustomEntities.customEntities.contains(this)) { - this.lastYaw = this.yaw = this.passenger.yaw; - this.pitch = this.passenger.pitch * 0.5F; - this.setYawPitch(this.yaw, this.pitch);//Update the pitch and yaw - this.aI = this.aG = this.yaw; - sideMot = ((EntityLiving) this.passenger).aZ * 0.5F; - forMot = ((EntityLiving) this.passenger).ba; - - Field jump = null; //Jumping - try { - jump = EntityLiving.class.getDeclaredField("aY"); - } catch (NoSuchFieldException | SecurityException e1) { - e1.printStackTrace(); - } - jump.setAccessible(true); - - try { - if (jump.getBoolean(this.passenger)) { - this.motY = 0.5D; // Used all the time in NMS for entity jumping - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - this.S = 1.0F; // The custom entity will now automatically climb up 1 high blocks - this.aK = this.yaw; - if (!this.world.isClientSide) { - this.k(0.35f * 2); - - if (bM()) { - if (V()) { - double d0 = locY; - float f3 = 0.8F; - float f4 = 0.02F; - float f2 = EnchantmentManager.b(this); - if (f2 > 3.0F) { - f2 = 3.0F; - } - - if (f2 > 0.0F) { - f3 += (0.5460001F - f3) * f2 / 3.0F; - f4 += (bI() * 1.0F - f4) * f2 / 3.0F; - } - - a(sideMot, forMot, f4); - move(motX, motY, motZ); - motX *= f3; - motY *= 0.800000011920929D; - motZ *= f3; - motY -= 0.02D; - if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) - motY = 0.300000011920929D; - } else if (ab()) { - double d0 = locY; - a(sideMot, forMot, 0.02F); - move(motX, motY, motZ); - motX *= 0.5D; - motY *= 0.5D; - motZ *= 0.5D; - motY -= 0.02D; - if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) - motY = 0.300000011920929D; - } else { - float f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F; - - float f6 = 0.1627714F / (f5 * f5 * f5); - float f3 = bI() * f6; - - a(sideMot, forMot, f3); - f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F; - - if (k_()) { - float f4 = 0.15F; - motX = MathHelper.a(motX, -f4, f4); - motZ = MathHelper.a(motZ, -f4, f4); - fallDistance = 0.0F; - if (motY < -0.15D) { - motY = -0.15D; - } - - if (motY < 0.0D) { - motY = 0.0D; - } - } - - move(motX, motY, motZ); - if ((positionChanged) && (k_())) { - motY = 0.2D; - } - - if ((world.isClientSide) && ((!world.isLoaded(new BlockPosition((int) locX, 0, (int) locZ))) || (!world.getChunkAtWorldCoords(new BlockPosition((int) locX, 0, (int) locZ)).o()))) { - if (locY > 0.0D) - motY = -0.1D; - else - motY = 0.0D; - } else { - motY += 0D; - } - - motY *= 0.9800000190734863D; - motX *= f5; - motZ *= f5; - } - } - - ay = az; - double d0 = locX - lastX; - double d1 = locZ - lastZ; - - float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; - if (f2 > 1.0F) { - f2 = 1.0F; - } - - az += (f2 - az) * 0.4F; - aA += az; - - super.g(sideMot, forMot); - } - - - this.ay = this.az; //Some extra things - double d0 = this.locX - this.lastX; - double d1 = this.locZ - this.lastZ; - float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; - if (f4 > 1.0F) { - f4 = 1.0F; - } - - this.az += (f4 - this.az) * 0.4F; - this.aA += this.az; - } else { - this.S = 0.5F; - this.aK = 0.02F; - super.g(sideMot, forMot); - } - } - - @Override - public Entity getEntity() { - return getBukkitEntity(); - } -} diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/morphs/MorphElderGuardian.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/morphs/MorphElderGuardian.java index 2978f83ca..a99196039 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/morphs/MorphElderGuardian.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/morphs/MorphElderGuardian.java @@ -41,7 +41,7 @@ public class MorphElderGuardian extends Morph { public static List customEntities = new ArrayList<>(); public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountCustomEntity.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountCustomEntity.java index 0eea42e0d..f93ef000b 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountCustomEntity.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_8_R2.customentities.CustomEntities; import be.isach.ultracosmetics.v1_8_R2.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_8_R2.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_8_R2.customentities.RideableSpider; import net.minecraft.server.v1_8_R2.Entity; import org.bukkit.Bukkit; @@ -34,11 +33,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountInfernalHorror.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountInfernalHorror.java index bc884b86b..a265ecc92 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountInfernalHorror.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountInfernalHorror.java @@ -14,7 +14,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountRudolph.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountRudolph.java index c762b6f25..addb42fdb 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountRudolph.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountRudolph.java @@ -25,7 +25,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSkySquid.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSkySquid.java deleted file mode 100644 index 947583222..000000000 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSkySquid.java +++ /dev/null @@ -1,35 +0,0 @@ -package be.isach.ultracosmetics.v1_8_R2.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; - -/** - * @author RadBuilder - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - - } - - @Override - public void onUpdate() { -// Random random = new Random(); -// for (int i = 0; i < 5; i++) -// if (UltraCosmetics.usingSpigot()) -// getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), -// MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), -// random.nextFloat(), random.nextFloat(), 1, 20, 64); -// else -// UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), -// getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), -// MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } - - @Override - protected void onClear() { - - } -} diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSlime.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSlime.java index 6d6782e1a..eececab38 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSlime.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSpider.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSpider.java index 5803262a4..a476c9c5f 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSpider.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountWalkingDead.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountWalkingDead.java index 5f3c74e86..118dab707 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountWalkingDead.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/mount/MountWalkingDead.java @@ -14,7 +14,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/CustomEntityPet.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/CustomEntityPet.java index a8ed3ec17..d6d2c9140 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/CustomEntityPet.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/CustomEntityPet.java @@ -15,6 +15,7 @@ import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -27,8 +28,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } diff --git a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/PetPumpling.java b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/PetPumpling.java index 44d436dbe..4fa043272 100644 --- a/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/PetPumpling.java +++ b/v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/pets/PetPumpling.java @@ -18,22 +18,7 @@ * @author RadBuilder */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - - public PetPumpling(UltraPlayer ultraPlayer, UltraCosmetics ultraCosmetics) { - super(ultraPlayer, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item ITEM = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); - }, 5); + public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/Mounts.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/Mounts.java index a7c0f15b2..f5271b275 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/Mounts.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_8_R3.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_8_R3.mount.MountRudolph; -import be.isach.ultracosmetics.v1_8_R3.mount.MountSkySquid; import be.isach.ultracosmetics.v1_8_R3.mount.MountSlime; import be.isach.ultracosmetics.v1_8_R3.mount.MountSpider; import be.isach.ultracosmetics.v1_8_R3.mount.MountWalkingDead; @@ -11,11 +10,6 @@ import org.bukkit.entity.EntityType; public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/CustomEntities.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/CustomEntities.java index 58f47323f..cd0ca38e9 100755 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/CustomEntities.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/CustomEntities.java @@ -12,8 +12,6 @@ @SuppressWarnings("deprecation") public enum CustomEntities { - - FLYING_SQUID("FlyingSquid", EntityType.SQUID.getTypeId(), EntityType.SQUID, FlyingSquid.class, FlyingSquid.class), PUMPLING("Pumpling", EntityType.ZOMBIE.getTypeId(), EntityType.ZOMBIE, Pumpling.class, Pumpling.class), SLIME("CustomSlime", EntityType.SLIME.getTypeId(), EntityType.SLIME, CustomSlime.class, CustomSlime.class), RIDEABLE_SPIDER("RideableSpider", EntityType.SPIDER.getTypeId(), EntityType.SPIDER, RideableSpider.class, RideableSpider.class), diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/FlyingSquid.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/FlyingSquid.java deleted file mode 100755 index ab6fd3a36..000000000 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/customentities/FlyingSquid.java +++ /dev/null @@ -1,198 +0,0 @@ -package be.isach.ultracosmetics.v1_8_R3.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.EnchantmentManager; -import net.minecraft.server.v1_8_R3.EntityHuman; -import net.minecraft.server.v1_8_R3.EntityLiving; -import net.minecraft.server.v1_8_R3.EntitySquid; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; -import net.minecraft.server.v1_8_R3.World; -import org.bukkit.craftbukkit.v1_8_R3.util.UnsafeList; -import org.bukkit.entity.Entity; - -import java.lang.reflect.Field; - -/** - * Custom Squid class. - *

- * Created by Sacha on 11/10/15. - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity { - - - public FlyingSquid(World world) { - super(world); - } - - private void removeSelectors() { - try { - Field bField = PathfinderGoalSelector.class.getDeclaredField("b"); - bField.setAccessible(true); - Field cField = PathfinderGoalSelector.class.getDeclaredField("c"); - cField.setAccessible(true); - bField.set(goalSelector, new UnsafeList()); - bField.set(targetSelector, new UnsafeList()); - cField.set(goalSelector, new UnsafeList()); - cField.set(targetSelector, new UnsafeList()); - } catch (Exception exc) { - exc.printStackTrace(); - } - } - - @Override - public void removeAi() { - removeSelectors(); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - if (this.passenger != null && this.passenger instanceof EntityHuman - && CustomEntities.customEntities.contains(this)) { - this.lastYaw = this.yaw = this.passenger.yaw; - this.pitch = this.passenger.pitch * 0.5F; - this.setYawPitch(this.yaw, this.pitch);//Update the pitch and yaw - this.aI = this.aG = this.yaw; - sideMot = ((EntityLiving) this.passenger).aZ * 0.5F; - forMot = ((EntityLiving) this.passenger).ba; - - Field jump = null; //Jumping - try { - jump = EntityLiving.class.getDeclaredField("aY"); - } catch (NoSuchFieldException | SecurityException e1) { - e1.printStackTrace(); - } - jump.setAccessible(true); - - try { - if (jump.getBoolean(this.passenger)) { - this.motY = 0.5D; // Used all the time in NMS for entity jumping - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - this.S = 1.0F;// The custom entity will now automatically climb up 1 high blocks - this.aK = this.yaw; - if (!this.world.isClientSide) { - this.k(0.35f * 2); - - if (bM()) { - if (V()) { - double d0 = locY; - float f3 = 0.8F; - float f4 = 0.02F; - float f2 = EnchantmentManager.b(this); - if (f2 > 3.0F) { - f2 = 3.0F; - } - - if (f2 > 0.0F) { - f3 += (0.5460001F - f3) * f2 / 3.0F; - f4 += (bI() * 1.0F - f4) * f2 / 3.0F; - } - - a(sideMot, forMot, f4); - move(motX, motY, motZ); - motX *= f3; - motY *= 0.800000011920929D; - motZ *= f3; - motY -= 0.02D; - if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) - motY = 0.300000011920929D; - } else if (ab()) { - double d0 = locY; - a(sideMot, forMot, 0.02F); - move(motX, motY, motZ); - motX *= 0.5D; - motY *= 0.5D; - motZ *= 0.5D; - motY -= 0.02D; - if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) - motY = 0.300000011920929D; - } else { - float f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F; - - float f6 = 0.1627714F / (f5 * f5 * f5); - float f3 = bI() * f6; - - a(sideMot, forMot, f3); - f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F; - - if (k_()) { - float f4 = 0.15F; - motX = MathHelper.a(motX, -f4, f4); - motZ = MathHelper.a(motZ, -f4, f4); - fallDistance = 0.0F; - if (motY < -0.15D) { - motY = -0.15D; - } - - if (motY < 0.0D) { - motY = 0.0D; - } - } - - move(motX, motY, motZ); - if ((positionChanged) && (k_())) { - motY = 0.2D; - } - - if ((world.isClientSide) && ((!world.isLoaded(new BlockPosition((int) locX, 0, (int) locZ))) || (!world.getChunkAtWorldCoords(new BlockPosition((int) locX, 0, (int) locZ)).o()))) { - if (locY > 0.0D) - motY = -0.1D; - else - motY = 0.0D; - } else { - motY += 0D; - } - - motY *= 0.9800000190734863D; - motX *= f5; - motZ *= f5; - } - } - - ay = az; - double d0 = locX - lastX; - double d1 = locZ - lastZ; - - float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; - if (f2 > 1.0F) { - f2 = 1.0F; - } - - az += (f2 - az) * 0.4F; - aA += az; - - super.g(sideMot, forMot); - } - - - this.ay = this.az;//Some extra things - double d0 = this.locX - this.lastX; - double d1 = this.locZ - this.lastZ; - float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; - if (f4 > 1.0F) { - f4 = 1.0F; - } - - this.az += (f4 - this.az) * 0.4F; - this.aA += this.az; - } else { - this.S = 0.5F; - this.aK = 0.02F; - super.g(sideMot, forMot); - } - } - - @Override - public Entity getEntity() { - return getBukkitEntity(); - } -} diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/morphs/MorphElderGuardian.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/morphs/MorphElderGuardian.java index b8c4cda1e..c7a0ea137 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/morphs/MorphElderGuardian.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { public static List customEntities = new ArrayList<>(); public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } @EventHandler diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountCustomEntity.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountCustomEntity.java index 6a1af9278..3f11f368d 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountCustomEntity.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_8_R3.customentities.CustomEntities; import be.isach.ultracosmetics.v1_8_R3.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_8_R3.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_8_R3.customentities.RideableSpider; import net.minecraft.server.v1_8_R3.Entity; import org.bukkit.Bukkit; @@ -34,11 +33,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountInfernalHorror.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountInfernalHorror.java index 2bd47ea7a..9ef0a2c21 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountInfernalHorror.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountInfernalHorror.java @@ -14,7 +14,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountRudolph.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountRudolph.java index be2b0547a..ea63fd1ff 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountRudolph.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountRudolph.java @@ -25,7 +25,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSkySquid.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSkySquid.java deleted file mode 100755 index 544afbbcf..000000000 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSkySquid.java +++ /dev/null @@ -1,35 +0,0 @@ -package be.isach.ultracosmetics.v1_8_R3.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.Effect; - -import java.util.Random; - -/** - * Created by Sacha on 11/10/15. - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - } - - @Override - public void onUpdate() { - Random random = new Random(); - for (int i = 0; i < 5; i++) - if (UltraCosmeticsData.get().isUsingSpigot()) - getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), - random.nextFloat(), random.nextFloat(), 1, 20, 64); - else - UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), - getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } -} diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSlime.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSlime.java index bcfe55db6..09f637a5c 100755 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSlime.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSpider.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSpider.java index 19548b7ac..ca2a1fc4e 100755 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSpider.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountWalkingDead.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountWalkingDead.java index 3ff3b5533..1054dbdf7 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountWalkingDead.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/mount/MountWalkingDead.java @@ -14,7 +14,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/CustomEntityPet.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/CustomEntityPet.java index 986c43bdd..07031e825 100644 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/CustomEntityPet.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/CustomEntityPet.java @@ -15,6 +15,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -27,8 +28,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } diff --git a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/PetPumpling.java b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/PetPumpling.java index 3027c447c..b8b400e44 100755 --- a/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/PetPumpling.java +++ b/v1_8_R3/src/main/java/be/isach/ultracosmetics/v1_8_R3/pets/PetPumpling.java @@ -18,22 +18,7 @@ * Created by Sacha on 18/10/15. */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - - public PetPumpling(UltraPlayer ultraPlayer, UltraCosmetics ultraCosmetics) { - super(ultraPlayer, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item ITEM = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); - }, 5); + public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/Mounts.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/Mounts.java index 3651230ad..cca169657 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/Mounts.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_9_R1.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_9_R1.mount.MountRudolph; -import be.isach.ultracosmetics.v1_9_R1.mount.MountSkySquid; import be.isach.ultracosmetics.v1_9_R1.mount.MountSlime; import be.isach.ultracosmetics.v1_9_R1.mount.MountSpider; import be.isach.ultracosmetics.v1_9_R1.mount.MountWalkingDead; @@ -11,11 +10,6 @@ import org.bukkit.entity.EntityType; public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/CustomEntities.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/CustomEntities.java index e3e23ee94..37af9f322 100755 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/CustomEntities.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/CustomEntities.java @@ -12,8 +12,6 @@ import java.util.Map; public enum CustomEntities { - - // FLYING_SQUID("FlyingSquid", EntityType.SQUID.getTypeId(), EntityType.SQUID, FlyingSquid.class, FlyingSquid.class), PUMPLING("Pumpling", EntityType.ZOMBIE.getTypeId(), EntityType.ZOMBIE, Pumpling.class, Pumpling.class), SLIME("CustomSlime", EntityType.SLIME.getTypeId(), EntityType.SLIME, CustomSlime.class, CustomSlime.class), RIDEABLE_SPIDER("RideableSpider", EntityType.SPIDER.getTypeId(), EntityType.SPIDER, RideableSpider.class, RideableSpider.class), diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/FlyingSquid.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/FlyingSquid.java deleted file mode 100755 index 1eb9a20d0..000000000 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/customentities/FlyingSquid.java +++ /dev/null @@ -1,146 +0,0 @@ -package be.isach.ultracosmetics.v1_9_R1.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import be.isach.ultracosmetics.v1_9_R1.EntityBase; -import be.isach.ultracosmetics.v1_9_R1.nms.WrapperEntityHuman; -import be.isach.ultracosmetics.v1_9_R1.nms.WrapperEntityInsentient; -import net.minecraft.server.v1_9_R1.EntityHuman; -import net.minecraft.server.v1_9_R1.EntityInsentient; -import net.minecraft.server.v1_9_R1.EntitySquid; -import net.minecraft.server.v1_9_R1.MathHelper; -import net.minecraft.server.v1_9_R1.PathfinderGoalSelector; -import net.minecraft.server.v1_9_R1.World; -import org.bukkit.craftbukkit.v1_9_R1.util.UnsafeList; - -import java.lang.reflect.Field; - -/** - * Custom Squid class. - *

- * Created by Sacha on 11/10/15. - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity, EntityBase { - - boolean canFly = true; - - public FlyingSquid(World world) { - super(world); - } - - private void removeSelectors() { - try { - Field bField = PathfinderGoalSelector.class.getDeclaredField("b"); - bField.setAccessible(true); - Field cField = PathfinderGoalSelector.class.getDeclaredField("c"); - cField.setAccessible(true); - bField.set(goalSelector, new UnsafeList()); - bField.set(targetSelector, new UnsafeList()); - cField.set(goalSelector, new UnsafeList()); - cField.set(targetSelector, new UnsafeList()); - } catch (Exception exc) { - exc.printStackTrace(); - } - } - - @Override - public void removeAi() { - removeSelectors(); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - EntityHuman passenger = null; - if (!bv().isEmpty()) { - passenger = (EntityHuman) bv().iterator().next(); - } - ride(sideMot, forMot, passenger, this); - } - - @Override - public void g_(float sideMot, float forMot) { - super.g(sideMot, forMot); - } - - @Override - public float getSpeed() { - return 0.5f; - } - - @Override - public boolean canFly() { - return true; - } - - @Override - public org.bukkit.entity.Entity getEntity() { - return getBukkitEntity(); - } - - static void ride(float sideMot, float forMot, EntityHuman passenger, EntityInsentient entity) { - if (!(entity instanceof EntityBase)) - throw new IllegalArgumentException("The entity field should implements EntityBase"); - - EntityBase entityBase = (EntityBase) entity; - - WrapperEntityInsentient wEntity = new WrapperEntityInsentient(entity); - WrapperEntityHuman wPassenger = new WrapperEntityHuman(passenger); - - if (passenger != null) { - entity.lastYaw = entity.yaw = passenger.yaw % 360f; - entity.pitch = (passenger.pitch * 0.5F) % 360f; - - wEntity.setRenderYawOffset(entity.yaw); - wEntity.setRotationYawHead(entity.yaw); - - sideMot = wPassenger.getMoveStrafing() * 0.25f; - forMot = wPassenger.getMoveForward() * 0.5f; - - if (forMot <= 0.0F) - forMot *= 0.25F; - - wEntity.setJumping(wPassenger.isJumping()); - - if (wPassenger.isJumping() && (entity.onGround || entityBase.canFly())) { - entity.motY = 0.4D; - - float f2 = MathHelper.sin(entity.yaw * 0.017453292f); - float f3 = MathHelper.cos(entity.yaw * 0.017453292f); - entity.motX += (double) (-0.4f * f2); - entity.motZ += (double) (0.4f * f3); - } - - wEntity.setStepHeight(1.0f); - wEntity.setJumpMovementFactor(wEntity.getMoveSpeed() * 0.1f); - - wEntity.setRotationYawHead(entity.yaw); - - if (wEntity.canPassengerSteer()) { - wEntity.setMoveSpeed(0.35f * entityBase.getSpeed()); - entityBase.g_(sideMot, forMot); - } - - wEntity.setPrevLimbSwingAmount(wEntity.getLimbSwingAmount()); - - double dx = entity.locX - entity.lastX; - double dz = entity.locZ - entity.lastZ; - - float f4 = MathHelper.sqrt(dx * dx + dz * dz) * 4; - - if (f4 > 1) - f4 = 1; - - wEntity.setLimbSwingAmount(wEntity.getLimbSwingAmount() + (f4 - wEntity.getLimbSwingAmount()) * 0.4f); - wEntity.setLimbSwing(wEntity.getLimbSwing() + wEntity.getLimbSwingAmount()); - } else { - wEntity.setStepHeight(0.5f); - wEntity.setJumpMovementFactor(0.02f); - - entityBase.g_(sideMot, forMot); - } - - } -} diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/morphs/MorphElderGuardian.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/morphs/MorphElderGuardian.java index 9025c58b4..c25dade82 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/morphs/MorphElderGuardian.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { private CustomGuardian customGuardian; public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } @EventHandler diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountCustomEntity.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountCustomEntity.java index 820a9a7c3..cb2db61cc 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountCustomEntity.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_9_R1.customentities.CustomEntities; import be.isach.ultracosmetics.v1_9_R1.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_9_R1.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_9_R1.customentities.RideableSpider; import net.minecraft.server.v1_9_R1.Entity; import org.bukkit.Bukkit; @@ -34,11 +33,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountInfernalHorror.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountInfernalHorror.java index 3c44252d9..ad3715849 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountInfernalHorror.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountInfernalHorror.java @@ -14,7 +14,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountRudolph.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountRudolph.java index ddd84003d..05d7ae2ca 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountRudolph.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountRudolph.java @@ -25,7 +25,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSkySquid.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSkySquid.java deleted file mode 100755 index e82872fe9..000000000 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSkySquid.java +++ /dev/null @@ -1,40 +0,0 @@ -package be.isach.ultracosmetics.v1_9_R1.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.Effect; - -import java.util.Random; - -/** - * Created by Sacha on 11/10/15. - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - } - - @Override - public void onUpdate() { - Random random = new Random(); - for (int i = 0; i < 5; i++) - if (UltraCosmeticsData.get().isUsingSpigot()) - getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), - random.nextFloat(), random.nextFloat(), 1, 20, 64); - else - UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), - getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } - - @Override - protected void onClear() { - - } -} diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSlime.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSlime.java index 010b2f75d..a46db86f7 100755 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSlime.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSpider.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSpider.java index d30b49b5e..a48b018da 100755 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSpider.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountWalkingDead.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountWalkingDead.java index 3a7a9920b..5e2a60ed3 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountWalkingDead.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/mount/MountWalkingDead.java @@ -14,7 +14,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/CustomEntityPet.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/CustomEntityPet.java index cf407d555..d7600f517 100644 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/CustomEntityPet.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/CustomEntityPet.java @@ -15,6 +15,7 @@ import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -27,8 +28,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } diff --git a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/PetPumpling.java b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/PetPumpling.java index 54f3dd9bd..49a154634 100755 --- a/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/PetPumpling.java +++ b/v1_9_R1/src/main/java/be/isach/ultracosmetics/v1_9_R1/pets/PetPumpling.java @@ -18,23 +18,7 @@ * Created by Sacha on 18/10/15. */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - - public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetic) { - super(owner, ultraCosmetic, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item ITEM = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), - ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); - }, 5); + public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } } diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/Mounts.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/Mounts.java index db9b81cbd..5f6a5583d 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/Mounts.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/Mounts.java @@ -3,7 +3,6 @@ import be.isach.ultracosmetics.cosmetics.mounts.Mount; import be.isach.ultracosmetics.v1_9_R2.mount.MountInfernalHorror; import be.isach.ultracosmetics.v1_9_R2.mount.MountRudolph; -import be.isach.ultracosmetics.v1_9_R2.mount.MountSkySquid; import be.isach.ultracosmetics.v1_9_R2.mount.MountSlime; import be.isach.ultracosmetics.v1_9_R2.mount.MountSpider; import be.isach.ultracosmetics.v1_9_R2.mount.MountWalkingDead; @@ -11,11 +10,6 @@ import org.bukkit.entity.EntityType; public class Mounts implements IMounts { - @Override - public Class getSquidClass() { - return MountSkySquid.class; - } - @Override public Class getSpiderClass() { return MountSpider.class; diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/CustomEntities.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/CustomEntities.java index 3bfc68cce..b6567f73f 100755 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/CustomEntities.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/CustomEntities.java @@ -12,8 +12,6 @@ import java.util.Map; public enum CustomEntities { - - // FLYING_SQUID("FlyingSquid", EntityType.SQUID.getTypeId(), EntityType.SQUID, FlyingSquid.class, FlyingSquid.class), PUMPLING("Pumpling", EntityType.ZOMBIE.getTypeId(), EntityType.ZOMBIE, Pumpling.class, Pumpling.class), SLIME("CustomSlime", EntityType.SLIME.getTypeId(), EntityType.SLIME, CustomSlime.class, CustomSlime.class), RIDEABLE_SPIDER("RideableSpider", EntityType.SPIDER.getTypeId(), EntityType.SPIDER, RideableSpider.class, RideableSpider.class), diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/FlyingSquid.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/FlyingSquid.java deleted file mode 100755 index cde57c6fa..000000000 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/customentities/FlyingSquid.java +++ /dev/null @@ -1,128 +0,0 @@ -package be.isach.ultracosmetics.v1_9_R2.customentities; - -import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity; -import be.isach.ultracosmetics.v1_9_R2.EntityBase; -import be.isach.ultracosmetics.v1_9_R2.nms.WrapperEntityHuman; -import be.isach.ultracosmetics.v1_9_R2.nms.WrapperEntityInsentient; -import net.minecraft.server.v1_9_R2.EntityHuman; -import net.minecraft.server.v1_9_R2.EntityInsentient; -import net.minecraft.server.v1_9_R2.EntitySquid; -import net.minecraft.server.v1_9_R2.MathHelper; -import net.minecraft.server.v1_9_R2.World; - -/** - * Custom Squid class. - *

- * Created by Sacha on 11/10/15. - */ -public class FlyingSquid extends EntitySquid implements IMountCustomEntity, EntityBase { - - boolean canFly = true; - - public FlyingSquid(World world) { - super(world); - } - - @Override - public void removeAi() { - setAI(false); - } - - @Override - public void g(float sideMot, float forMot) { - if (!CustomEntities.customEntities.contains(this)) { - super.g(sideMot, forMot); - return; - } - EntityHuman passenger = null; - if (!bv().isEmpty()) { - passenger = (EntityHuman) bv().get(0); - } - ride(sideMot, forMot, passenger, this); - } - - @Override - public void g_(float sideMot, float forMot) { - super.g(sideMot, forMot); - } - - @Override - public float getSpeed() { - return 0.5f; - } - - @Override - public boolean canFly() { - return true; - } - - @Override - public org.bukkit.entity.Entity getEntity() { - return getBukkitEntity(); - } - - static void ride(float sideMot, float forMot, EntityHuman passenger, EntityInsentient entity) { - if (!(entity instanceof EntityBase)) - throw new IllegalArgumentException("The entity field should implements EntityBase"); - - EntityBase entityBase = (EntityBase) entity; - - WrapperEntityInsentient wEntity = new WrapperEntityInsentient(entity); - WrapperEntityHuman wPassenger = new WrapperEntityHuman(passenger); - - if (passenger != null) { - entity.lastYaw = entity.yaw = passenger.yaw % 360f; - entity.pitch = (passenger.pitch * 0.5F) % 360f; - - wEntity.setRenderYawOffset(entity.yaw); - wEntity.setRotationYawHead(entity.yaw); - - sideMot = wPassenger.getMoveStrafing() * 0.25f; - forMot = wPassenger.getMoveForward() * 0.5f; - - if (forMot <= 0.0F) - forMot *= 0.25F; - - wEntity.setJumping(wPassenger.isJumping()); - - if (wPassenger.isJumping() && (entity.onGround || entityBase.canFly())) { - entity.motY = 0.4D; - - float f2 = MathHelper.sin(entity.yaw * 0.017453292f); - float f3 = MathHelper.cos(entity.yaw * 0.017453292f); - entity.motX += (double) (-0.4f * f2); - entity.motZ += (double) (0.4f * f3); - } - - wEntity.setStepHeight(1.0f); - wEntity.setJumpMovementFactor(wEntity.getMoveSpeed() * 0.1f); - - wEntity.setRotationYawHead(entity.yaw); - - if (wEntity.canPassengerSteer()) { - wEntity.setMoveSpeed(0.35f * entityBase.getSpeed()); - entityBase.g_(sideMot, forMot); - } - - wEntity.setPrevLimbSwingAmount(wEntity.getLimbSwingAmount()); - - double dx = entity.locX - entity.lastX; - double dz = entity.locZ - entity.lastZ; - - float f4 = MathHelper.sqrt(dx * dx + dz * dz) * 4; - - if (f4 > 1) - f4 = 1; - - wEntity.setLimbSwingAmount(wEntity.getLimbSwingAmount() + (f4 - wEntity.getLimbSwingAmount()) * 0.4f); - wEntity.setLimbSwing(wEntity.getLimbSwing() + wEntity.getLimbSwingAmount()); - } else { - wEntity.setStepHeight(0.5f); - wEntity.setJumpMovementFactor(0.02f); - - entityBase.g_(sideMot, forMot); - } - - } - -} diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/morphs/MorphElderGuardian.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/morphs/MorphElderGuardian.java index dcd63b6c5..e13baaf27 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/morphs/MorphElderGuardian.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/morphs/MorphElderGuardian.java @@ -42,7 +42,7 @@ public class MorphElderGuardian extends Morph { private CustomGuardian customGuardian; public MorphElderGuardian(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MorphType.ELDERGUARDIAN, ultraCosmetics); + super(owner, MorphType.valueOf("elderguardian"), ultraCosmetics); } diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountCustomEntity.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountCustomEntity.java index f3e74e41c..b48709e63 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountCustomEntity.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountCustomEntity.java @@ -9,7 +9,6 @@ import be.isach.ultracosmetics.util.EntitySpawningManager; import be.isach.ultracosmetics.v1_9_R2.customentities.CustomEntities; import be.isach.ultracosmetics.v1_9_R2.customentities.CustomSlime; -import be.isach.ultracosmetics.v1_9_R2.customentities.FlyingSquid; import be.isach.ultracosmetics.v1_9_R2.customentities.RideableSpider; import net.minecraft.server.v1_9_R2.Entity; import org.bukkit.Bukkit; @@ -34,11 +33,9 @@ public MountCustomEntity(UltraPlayer owner, MountType type, UltraCosmetics ultra @Override public void onEquip() { - if (getType() == MountType.SKYSQUID) - customEntity = new FlyingSquid(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SLIME) + if (getType() == MountType.valueOf("slime")) customEntity = new CustomSlime(((CraftPlayer) getPlayer()).getHandle().getWorld()); - else if (getType() == MountType.SPIDER) + else if (getType() == MountType.valueOf("spider")) customEntity = new RideableSpider(((CraftWorld) getPlayer().getWorld()).getHandle()); double x = getPlayer().getLocation().getX(); double y = getPlayer().getLocation().getY(); diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountInfernalHorror.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountInfernalHorror.java index 43f9be671..0308d44da 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountInfernalHorror.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountInfernalHorror.java @@ -14,7 +14,7 @@ public class MountInfernalHorror extends MountHorse { public MountInfernalHorror(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.INFERNALHORROR, ultraCosmetics); + super(owner, MountType.valueOf("infernalhorror"), ultraCosmetics); } @Override diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountRudolph.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountRudolph.java index 757a31fcc..d4008b83d 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountRudolph.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountRudolph.java @@ -25,7 +25,7 @@ public class MountRudolph extends MountHorse { private ArmorStand left, right; public MountRudolph(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.RUDOLPH, ultraCosmetics); + super(owner, MountType.valueOf("rudolph"), ultraCosmetics); } @Override diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSkySquid.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSkySquid.java deleted file mode 100755 index c03819b4b..000000000 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSkySquid.java +++ /dev/null @@ -1,37 +0,0 @@ -package be.isach.ultracosmetics.v1_9_R2.mount; - -import be.isach.ultracosmetics.UltraCosmetics; -import be.isach.ultracosmetics.UltraCosmeticsData; -import be.isach.ultracosmetics.cosmetics.type.MountType; -import be.isach.ultracosmetics.player.UltraPlayer; -import be.isach.ultracosmetics.util.MathUtils; -import be.isach.ultracosmetics.util.UtilParticles; -import org.bukkit.Effect; - -import java.util.Random; - -/** - * Created by Sacha on 11/10/15. - */ -public class MountSkySquid extends MountCustomEntity { - - public MountSkySquid(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SKYSQUID, ultraCosmetics); - - } - - @Override - public void onUpdate() { - Random random = new Random(); - for (int i = 0; i < 5; i++) - if (UltraCosmeticsData.get().isUsingSpigot()) { - getPlayer().getWorld().spigot().playEffect(getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2)), Effect.POTION_BREAK, 0, 0, random.nextFloat(), - random.nextFloat(), random.nextFloat(), 1, 20, 64); - } else { - UtilParticles.display(MathUtils.random(255), MathUtils.random(255), MathUtils.random(255), - getCustomEntity().getBukkitEntity().getLocation().add(MathUtils.randomDouble(-2, 2), - MathUtils.randomDouble(-1, 1.3), MathUtils.randomDouble(-2, 2))); - } - } -} diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSlime.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSlime.java index b0053b67c..ed41a753f 100755 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSlime.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSlime.java @@ -11,7 +11,7 @@ public class MountSlime extends MountCustomEntity { public MountSlime(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SLIME, ultraCosmetics); + super(owner, MountType.valueOf("slime"), ultraCosmetics); } @Override diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSpider.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSpider.java index cd93c8553..9856c05d0 100755 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSpider.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountSpider.java @@ -9,7 +9,7 @@ */ public class MountSpider extends MountCustomEntity { public MountSpider(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.SPIDER, ultraCosmetics); + super(owner, MountType.valueOf("spider"), ultraCosmetics); } @Override diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountWalkingDead.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountWalkingDead.java index 59eb538ce..1dc416407 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountWalkingDead.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/mount/MountWalkingDead.java @@ -14,7 +14,7 @@ public class MountWalkingDead extends MountHorse { public MountWalkingDead(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, MountType.WALKINGDEAD, ultraCosmetics); + super(owner, MountType.valueOf("walkingdead"), ultraCosmetics); } @Override diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/CustomEntityPet.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/CustomEntityPet.java index 286aa33c1..9c85ce5e4 100644 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/CustomEntityPet.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/CustomEntityPet.java @@ -15,6 +15,7 @@ import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; /** @@ -27,8 +28,8 @@ public abstract class CustomEntityPet extends Pet { */ public IPetCustomEntity customEntity; - public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType) { - super(owner, ultraCosmetics, petType); + public CustomEntityPet(UltraPlayer owner, UltraCosmetics ultraCosmetics, PetType petType, ItemStack dropItem) { + super(owner, ultraCosmetics, petType, dropItem); } diff --git a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/PetPumpling.java b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/PetPumpling.java index c9f59dbd2..d64a400ba 100755 --- a/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/PetPumpling.java +++ b/v1_9_R2/src/main/java/be/isach/ultracosmetics/v1_9_R2/pets/PetPumpling.java @@ -18,23 +18,7 @@ * Created by Sacha on 18/10/15. */ public class PetPumpling extends CustomEntityPet { - - Random r = new Random(); - public PetPumpling(UltraPlayer owner, UltraCosmetics ultraCosmetics) { - super(owner, ultraCosmetics, PetType.PUMPLING); - } - - @Override - public void onUpdate() { - final Item ITEM = customEntity.getEntity().getWorld().dropItem(((Zombie) customEntity.getEntity()).getEyeLocation(), - ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); - ITEM.setPickupDelay(30000); - ITEM.setVelocity(new Vector(r.nextDouble() - 0.5, r.nextDouble() / 2.0 + 0.3, r.nextDouble() - 0.5).multiply(0.4)); - items.add(ITEM); - Bukkit.getScheduler().runTaskLater(getUltraCosmetics(), () -> { - ITEM.remove(); - items.remove(ITEM); - }, 5); + super(owner, ultraCosmetics, PetType.getByName("pumpling"), ItemFactory.create(Material.JACK_O_LANTERN, (byte) 0x0, UltraCosmeticsData.get().getItemNoPickupString())); } }