diff --git a/.gitignore b/.gitignore
index 7f893ed..9cceb44 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,12 @@ tmp/
.classpath
.settings/
.loadpath
+target/
+Giants/target/
+v1_7_R3/target/
+v1_7_R4/target/
+v1_8_R1/target/
+v1_8_R2/target/
# External tool builders
.externalToolBuilders/
@@ -224,3 +230,9 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
+v1_10_R1/dependency-reduced-pom.xml
+v1_9_R2/dependency-reduced-pom.xml
+v1_9_R1/dependency-reduced-pom.xml
+v1_8_R3/dependency-reduced-pom.xml
+v1_8_R2/dependency-reduced-pom.xml
+v1_8_R1/dependency-reduced-pom.xml
diff --git a/files/pom.xml b/files/pom.xml
new file mode 100644
index 0000000..fd49607
--- /dev/null
+++ b/files/pom.xml
@@ -0,0 +1,24 @@
+
+
+ 4.0.0
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+ Giants-Files
+ 1.1-SNAPSHOT
+ Giants Files
+ jar
+
+
+
+ org.bukkit
+ bukkit
+ 1.9.4-R0.1-SNAPSHOT
+ jar
+
+
+
diff --git a/files/src/main/java/me/Mammothskier/Giants/Files/ConfigValues.java b/files/src/main/java/me/Mammothskier/Giants/Files/ConfigValues.java
new file mode 100644
index 0000000..a7b0922
--- /dev/null
+++ b/files/src/main/java/me/Mammothskier/Giants/Files/ConfigValues.java
@@ -0,0 +1,229 @@
+package me.Mammothskier.Giants.Files;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.PluginDescriptionFile;
+
+public enum ConfigValues {
+ /**
+ * value commons (any using ConfigValues(String key, String value) as a constructor should be here).
+ * These values will be put at the top of each file.
+ */
+ fileVersion("Giants Configuration.File Version", loadVersion()),
+
+ /**
+ * These file values will go in the config.yml file.
+ */
+ dependencies(Files.CONFIG, "Giants Configuration.Dependencies.BarAPI", FileSetup.checkDependencies("BarAPI")),
+ zombieBoolean(Files.CONFIG,"Giants Configuration.Entities.Giant Zombie", true),
+ slimeBoolean(Files.CONFIG, "Giants Configuration.Entities.Giant Slime", false),
+ lavaSlimeBoolean(Files.CONFIG, "Giants Configuration.Entities.Giant Lava Slime", false),
+ jockeyWarningBugs(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Bugs", "This entity of Giants is extremely experimental and does not have many features. Bugs may be present."),
+ jockeyWarningFiles(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Files", "Config files for this entity will NOT load unless enabled."),
+ jockeyBoolean(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled", false),
+ soundsBoolean(Files.CONFIG, "Giants Configuration.Sounds", true),
+ debugBoolean(Files.CONFIG, "Giants Configuration.Debug Mode.Enabled", false),
+ debugMessage(Files.CONFIG, "Giants Configuration.Debug Mode.Debug Message", "&2A {entity} has spawned at X:&F%X &2Y:&F%Y &2Z:&F%Z"),
+
+ /**
+ * These file values will go in the biome.yml file.
+ */
+ biomeSwampland(Files.BIOMES,"Giants Configuration.Biome Settings.Swampland", FileSetup.loadEntities()),
+ biomeForest(Files.BIOMES, "Giants Configuration.Biome Settings.Forest", FileSetup.loadEntities()),
+ biomeTaiga(Files.BIOMES, "Giants Configuration.Biome Settings.Taiga", FileSetup.loadEntities()),
+ biomePlains(Files.BIOMES, "Giants Configuration.Biome Settings.Plains", FileSetup.loadEntities()),
+ biomeExtremeHills(Files.BIOMES, "Giants Configuration.Biome Settings.Extreme Hills", FileSetup.loadEntities()),
+ biomeMushroomIsland(Files.BIOMES, "Giants Configuration.Biome Settings.Mushroom Island", FileSetup.loadEntities()),
+ biomeDesert(Files.BIOMES, "Giants Configuration.Biome Settings.Desert", FileSetup.loadEntities()),
+ biomeJungle(Files.BIOMES, "Giants Configuration.Biome Settings.Jungle", FileSetup.loadEntities()),
+ biomeBirchForest(Files.BIOMES, "Giants Configuration.Biome Settings.Birch Forest", FileSetup.loadEntities()),
+ biomeSavanna(Files.BIOMES, "Giants Configuration.Biome Settings.Savanna", FileSetup.loadEntities()),
+ biomeRoofedForest(Files.BIOMES, "Giants Configuration.Biome Settings.Roofed Forest",FileSetup.loadEntities()),
+ biomeMesa(Files.BIOMES, "Giants Configuration.Biome Settings.Mesa",FileSetup.loadEntities()),
+ biomeSmallMountains(Files.BIOMES,"Giants Configuration.Biome Settings.Other.Small Mountains",FileSetup.loadEntities()),
+ biomeIceMountains(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Ice Mountains",FileSetup.loadEntities()),
+ biomeOcean(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Ocean", ""),
+ biomeRiver(Files.BIOMES, "Giants Configuration.Biome Settings.Other.River", ""),
+ biomeHell(Files.BIOMES,"Giants Configuration.Biome Settings.Other.Hell", "- Giant Lava Slime"),
+ biomeSky(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Sky", ""),
+
+ /**
+ * These file values will go in the entities.yml file.
+ */
+//Worlds
+ zombieWorlds(Files.ENTITIES, "Entities Configuration.Spawn Settings.Worlds.Giant Zombie", FileSetup.loadWorlds()),
+ slimeWorlds(Files.ENTITIES, "Entities Configuration.Spawn Settings.Worlds.Giant Slime", FileSetup.loadWorlds()),
+ lavaslimeWorlds(Files.ENTITIES, "Entities Configuration.Spawn Settings.World.Giant Lava Slime", FileSetup.loadWorlds()),
+//Spawn chance
+ zombieChance(Files.ENTITIES, "Entities Configuration.Spawn Settings.Chance.Giant Zombie", new Integer(10)),
+ slimeChance(Files.ENTITIES, "Entities Configuration.Spawn Settings.Chance.Giant Slime", new Integer(10)),
+ lavaSlimeChance(Files.ENTITIES, "Entities Configuration.Spawn Settings.Chance.Giant Lava Slime", new Integer(10)),
+//Size
+ slimeSize(Files.ENTITIES, "Entities Configuration.Spawn Settings.Size.Giant Slime", new Integer(12)),
+ lavaSlimeSize(Files.ENTITIES, "Entities Configuration.Spawn Settings.Size.Giant Lava Slime", new Integer(12)),
+//Speed
+ zombieSpeed(Files.ENTITIES, "Entities Configuration.Stats.Speed.Giant Zombie", new Integer(3)),
+//Health
+ zombieHealth(Files.ENTITIES, "Entities Configuration.Stats.Health.Giant Zombie", new Integer(100)),
+ slimeHealth(Files.ENTITIES, "Entities Configuration.Stats.Health.Giant Slime", new Integer(100)),
+ lavaSlimeHealth(Files.ENTITIES, "Entities Configuration.Stats.Health.Giant Lava Slime", new Integer(100)),
+//Experience
+ zombieExperience(Files.ENTITIES, "Entities Configuration.Stats.Experience.Giant Zombie", new Integer(5)),
+ slimeExperience(Files.ENTITIES, "Entities Configuration.Stats.Experience.Giant Slime", new Integer(5)),
+ lavaSlimeExperience(Files.ENTITIES, "Entities Configuration.Stats.Experience.Giant Lava Slime", new Integer(5)),
+//Armour
+ zombieHelmet(Files.ENTITIES, "Entities Configuration.Stats.Equipped Armour.Giant Zombie.Helmet",
+ new String("diamond_helmet protection:1 unbreaking:1 aqua_affinity:1 projectile_protection:4 name:'Giant Helmet' dropRate:8.5")),
+ zombieChestPlate(Files.ENTITIES, "Entities Configuration.Stats.Equipped Armour.Giant Zombie.ChestPlate",
+ new String("diamond_chestplate protection:1 unbreaking:1 fire_protection:1 blast_protection:1 projectile_protection:4 name:'Giant ChestPlate' dropRate:8.5")),
+ zombieLeggings(Files.ENTITIES, "Entities Configuration.Stats.Equipped Armour.Giant Zombie.Leggings",
+ new String("diamond_leggings protection:1 unbreaking:1 fire_protection:1 blast_protection:1 projectile_protection:4 name:'Giant Leggings' dropRate:8.5")),
+ zombieBoots(Files.ENTITIES, "Entities Configuration.Stats.Equipped Armour.Giant Zombie.Boots",
+ new String("diamond_boots protection:1 unbreaking:1 fire_protection:1 blast_protection:1 projectile_protection:4 name:'Giant Boots' dropRate:8.5")),
+ zombieMainHand(Files.ENTITIES, "Entities Configuration.Stats.Equipped Armour.Giant Zombie.MainHand",
+ new String("diamond_sword sharpness:1 fire_aspect:1 unbreaking:1 knockback:1 smite:1 name:'Giant Sword' dropRate:8.5")),
+//Drops
+ dropManager(Files.ENTITIES, "Entities Configuration.Stats.Drops.Enable Drop Manager", true),
+ zombieDrops(Files.ENTITIES, "Entities Configuration.Stats.Drops.Giant Zombie", Arrays.asList(FileSetup.loadDefaultDrop("Giant Zombie"))),
+ slimeDrops(Files.ENTITIES, "Entities Configuration.Stats.Drops.Giant Slime", Arrays.asList(FileSetup.loadDefaultDrop("Giant Slime"))),
+ lavaSlimeDrops(Files.ENTITIES, "Entities Configuration.Stats.Drops.Giant Lava Slime", Arrays.asList(FileSetup.loadDefaultDrop("Giant Lava Slime"))),
+//BarAPI
+ zombieBarAPI(Files.ENTITIES, "Entities Configuration.Stats.BarAPI.Display Name.Giant Zombie", "&2Giant Zombie"),
+ slimeBarAPI(Files.ENTITIES, "Entities Configuration.Stats.BarAPI.Display Name.Giant Slime", "&2Giant Slime Size {size}"),
+ lavaSlimeBarAPI(Files.ENTITIES, "Entities Configuration.Stats.BarAPI.Display Name.Giant Lava Slime", "&2Giant Lava Slime Size {size}"),
+//Damage
+ zombieArrowDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Arrows.Damage done by arrow.Giant Zombie", new Integer(10)),
+ slimeArrowDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Arrows.Damage done by arrow.Giant Slime", new Integer(10)),
+ lavaSlimeArrowDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Arrows.Damage done by arrow.Giant Lava Slime", new Integer(10)),
+ zombieAllowFireDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Fire.Allow Fire Damage.Giant Zombie", true),
+ slimeAllowFireDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Fire.Allow Fire Damage.Giant Slime", true),
+ zombieAllowSuffocation(Files.ENTITIES, "Entities Configuration.Damage Settings.Block Damage.Allow Suffocation.Giant Zombie",false),
+ slimeAllowSuffocation(Files.ENTITIES, "Entities Configuration.Damage Settings.Block Damage.Allow Suffocation.Giant Slime",false),
+ lavaSlimeAllowSuffocation(Files.ENTITIES, "Entities Configuration.Damage Settings.Block Damage.Allow Suffocation.Giant Lava Slime",false),
+ zombieAllowCactiDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Block Damage.Allow Cacti Damage.Giant Zombie", false),
+ slimeAllowCactiDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Block Damage.Allow Cacti Damage.Giant Slime", false),
+ lavaSlimeAllowCactiDamage(Files.ENTITIES, "Entities Configuration.Damage Settings.Block Damage.Allow Cacti Damage.Giant Lava Slime", false),
+//Targets
+ zombieAggressiveToVillage(Files.ENTITIES, "Entities Configuration.Target Settings.Target Villagers", false),
+
+ /**
+ * These file values will go in attacks.yml
+ */
+ lightningAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Lightning Attack", FileSetup.loadEntities()),
+ stompAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Stomp Attack.Enabled", FileSetup.loadEntities()),
+ stompAttackPower(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Stomp Attack.Explosion Power", new Integer(1)),
+ stompAttackFire(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Stomp Attack.Light Fire", FileSetup.loadEntities()),
+ lavaAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Lava Attack", FileSetup.loadEntities()),
+ kickAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Kick Attack.Enabled", FileSetup.loadEntities()),
+ kickAttackHeight(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Kick Attack.Kick Height", new Integer(1)),
+ fireAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Fire Attack.Enabled", FileSetup.loadEntities()),
+ fireAttackTargetTicks(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Fire Attack.Ticks for Target", new Integer(100)),
+ fireAttackGiantTicks(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Fire Attack.Ticks for Giant", new Integer(100)),
+ boulderAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled", FileSetup.loadEntities()),
+ bouldAttackBlockDamage(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage", new Integer(1)),
+ shrapnelAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Enabled", Arrays.asList("Giant Zombie")),
+ shrapnelAttackBabies(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Baby Zombies", false),
+ shrapnelAttackZombies(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Zombies to Spawn", new Integer(3)),
+ shrapnelAttackHealth(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Health", new Integer(20)),
+ zombiesOnDeath(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Enabled", false),
+ zombiesOnDeathBabies(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Baby Zombies", false),
+ zombiesOnDeathZombies(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Zombies to Spawn", new Integer(5)),
+ zombiesOnDeathHealth(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Health", new Integer(20)),
+ poisonAttack(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Poison Attack", FileSetup.loadEntities()),
+ poisonAttackLength(Files.ATTACKS, "Attacks Configuration.Attack Mechanisms.Poison Attack.length", "10.0"),
+
+ /**
+ * These file values will go in jockey.yml
+ */
+ jockeyWarning(Files.JOCKEY, "Jockey Configuration", new String("This entity of Giants is extremely experimental and does not have many features")),
+ jockeyWorlds(Files.JOCKEY, "Jockey Configuration.Spawn Settings.Worlds", FileSetup.loadWorlds()),
+
+ /**
+ * The file values will go in jockey/biomes.yml
+ */
+ jockeyBiomeSwampland(Files.JOCKEYBIOMES,"Giants Configuration.Biome Settings.Swampland", FileSetup.loadEntities()),
+ jockeyBiomeForest(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Forest", FileSetup.loadEntities()),
+ jockeyBiomeTaiga(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Taiga", FileSetup.loadEntities()),
+ jockeyBiomePlains(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Plains", FileSetup.loadEntities()),
+ jockeyBiomeExtremeHills(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Extreme Hills", FileSetup.loadEntities()),
+ jockeyBiomeMushroomIsland(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Mushroom Island", FileSetup.loadEntities()),
+ jockeyBiomeDesert(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Desert", FileSetup.loadEntities()),
+ jockeyBiomeJungle(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Jungle", FileSetup.loadEntities()),
+ jockeyBiomeBirchForest(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Birch Forest", FileSetup.loadEntities()),
+ jockeyBiomeSavanna(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Savanna", FileSetup.loadEntities()),
+ jockeyBiomeRoofedForest(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Roofed Forest",FileSetup.loadEntities()),
+ jockeyBiomeMesa(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Mesa",FileSetup.loadEntities()),
+ jockeyBiomeSmallMountains(Files.JOCKEYBIOMES,"Giants Configuration.Biome Settings.Other.Small Mountains",FileSetup.loadEntities()),
+ jockeyBiomeIceMountains(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Other.Ice Mountains",FileSetup.loadEntities()),
+ jockeyBiomeOcean(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Other.Ocean", ""),
+ jockeyBiomeRiver(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Other.River", ""),
+ jockeyBiomeHell(Files.JOCKEYBIOMES,"Giants Configuration.Biome Settings.Other.Hell", "- Giant Lava Slime"),
+ jockeyBiomeSky(Files.JOCKEYBIOMES, "Giants Configuration.Biome Settings.Other.Sky", ""),
+ ;
+ private final String _key;
+ private final Files _files;
+ private final String _value;
+ private final List _values;
+ private final boolean list;
+
+ private ConfigValues(Files file, String key, Serializable value) {
+ _files = file;
+ _key = key;
+ _value= value + "";
+ _values = null;
+ list = false;
+ }
+
+ private ConfigValues(String key, String value) {
+ _files = null;
+ _key = key;
+ _value= value;
+ _values = null;
+ list = false;
+ }
+
+ private ConfigValues(Files file, String key, List value) {
+ _files = file;
+ _key = key;
+ _values= value;
+ _value = null;
+ list = true;
+ }
+
+ public String getKey() {
+ return _key;
+ }
+
+ public Files getFile() {
+ return _files;
+ }
+
+ public String getValue() {
+ return _value;
+ }
+
+ public List getValues() {
+ return _values;
+ }
+
+ private static String loadVersion() {
+ PluginDescriptionFile pdf =
+ Bukkit.getPluginManager().getPlugin("Giants").getDescription();
+ String version = pdf.getVersion();
+ if (version == null) {
+ return null;
+ }
+ return version;
+ }
+
+ /**
+ * @return the list
+ */
+ public boolean isList() {
+ return list;
+ }
+
+}
diff --git a/files/src/main/java/me/Mammothskier/Giants/Files/FileHandler.java b/files/src/main/java/me/Mammothskier/Giants/Files/FileHandler.java
new file mode 100644
index 0000000..8db0e76
--- /dev/null
+++ b/files/src/main/java/me/Mammothskier/Giants/Files/FileHandler.java
@@ -0,0 +1,372 @@
+package me.Mammothskier.Giants.Files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+import me.Mammothskier.Giants.Files.Files;
+
+public class FileHandler {
+ public static FileHandler instance;
+ private final HashMap _configurations;
+
+ public FileHandler() {
+ instance = this;
+ _configurations = new HashMap();
+ loadFiles();
+ }
+
+ public static List loadWorlds() {
+ List worldList = new ArrayList();
+ for (World w : Bukkit.getServer().getWorlds()) {
+ worldList.add(w.getName());
+ }
+ return worldList;
+ }
+
+ public static String getInstanceProperty(ConfigValues value) {
+ return instance != null ? instance.getProperty(value) : null;
+ }
+
+/* public static boolean checkDependencies(String plugin) {
+ if (Bukkit.getPluginManager().getPlugin(plugin) != null) {
+ return true;
+ }
+ return false;
+ }*/
+
+ public void loadFiles() {
+ for (Files file : Files.values()) {
+ File confFile = new File(file.getPath());
+
+ if (confFile.exists()) {
+ if (_configurations.containsKey(file)) {
+ _configurations.remove(file);
+ }
+ YamlConfiguration conf = YamlConfiguration.loadConfiguration(confFile);
+ _configurations.put(file, conf);
+ } else {
+ File parentFile = confFile.getParentFile();
+
+ if (!parentFile.exists()) {
+ parentFile.mkdirs();
+ }
+ this.createFiles(file, confFile);
+ }
+ }
+ }
+
+ private void createFiles(Files files, File file) {
+ switch (files) {
+ case CONFIG:
+ YamlConfiguration Config = YamlConfiguration.loadConfiguration(file);
+ /*Config.set("Giants Configuration.File Version", loadVersion());
+ Config.set("Giants Configuration.Dependencies.BarAPI", checkDependencies("BarAPI"));
+ Config.set("Giants Configuration.Entities.Giant Zombie", true);
+ Config.set("Giants Configuration.Entities.Giant Slime", false);
+ Config.set("Giants Configuration.Entities.Giant Lava Slime", false);
+ Config.set("Giants Configuration.Entities.Giant Jockey.Warning.Bugs", new String("This entity of Giants is extremely experimental and does not have many features. Bugs may be present."));
+ Config.set("Giants Configuration.Entities.Giant Jockey.Warning.Files", new String("Config files for this entity will NOT load unless enabled."));
+ Config.set("Giants Configuration.Entities.Giant Jockey.Warning.Enabled", false);
+ Config.set("Giants Configuration.Sounds", true);
+ Config.set("Giants Configuration.Debug Mode.Enabled", false);
+ Config.set("Giants Configuration.Debug Mode.Debug Message", "&2A {entity} has spawned at X:&F%X &2Y:&F%Y &2Z:&F%Z");*/
+ for (ConfigValues value : ConfigValues.values()) {
+ if (value.getFile() == Files.CONFIG) {
+ if (!value.isList())
+ Config.set(value.getKey(), value.getValue());
+ else
+ Config.set(value.getKey(), value.getValues());
+ }
+ }
+ try {
+ Config.save(file);
+ } catch (IOException e) {
+ }
+ _configurations.put(files, Config);
+ break;
+ case BIOMES:
+ YamlConfiguration Biomes = YamlConfiguration.loadConfiguration(file);
+ /*Biomes.set("Giants Configuration.File Version", loadVersion());
+ Biomes.set("Giants Configuration.Biome Settings.Swampland", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Forest", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Taiga", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Plains", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Extreme Hills", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Mushroom Island", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Desert", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Jungle", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Birch Forest", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Savanna", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Roofed Forest", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Mesa", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Other.Small Mountains", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Other.Ice Mountains", loadEntities());
+ Biomes.set("Giants Configuration.Biome Settings.Other.Ocean", "");
+ Biomes.set("Giants Configuration.Biome Settings.Other.River", "");
+ Biomes.set("Giants Configuration.Biome Settings.Other.Hell", "- Giant Lava Slime");
+ Biomes.set("Giants Configuration.Biome Settings.Other.Sky", "");*/
+ for (ConfigValues value : ConfigValues.values()) {
+ if (value.getFile() == Files.BIOMES) {
+ if (!value.isList())
+ Biomes.set(value.getKey(), value.getValue());
+ else
+ Biomes.set(value.getKey(), value.getValues());
+ }
+ }
+ try {
+ Biomes.save(file);
+ } catch (IOException e) {
+ }
+ _configurations.put(files, Biomes);
+ break;
+ case ENTITIES:
+ YamlConfiguration entities = YamlConfiguration.loadConfiguration(file);
+/* entities.set("Entities Configuration.File Version", loadVersion());
+// Worlds
+ entities.set("Entities Configuration.Spawn Settings.Worlds.Giant Zombie", loadWorlds());
+ entities.set("Entities Configuration.Spawn Settings.Worlds.Giant Slime", loadWorlds());
+ entities.set("Entities Configuration.Spawn Settings.Worlds.Giant Lava Slime", loadWorlds());
+// Spawn Chance
+ entities.set("Entities Configuration.Spawn Settings.Chance.Giant Zombie", new Integer(10));
+ entities.set("Entities Configuration.Spawn Settings.Chance.Giant Slime", new Integer(10));
+ entities.set("Entities Configuration.Spawn Settings.Chance.Giant Lava Slime", new Integer(10));
+// Size
+ entities.set("Entities Configuration.Spawn Settings.Size.Giant Slime", new Integer(12));
+ entities.set("Entities Configuration.Spawn Settings.Size.Giant Lava Slime", new Integer(12));
+// Speed
+ entities.set("Entities Configuration.Stats.Speed.Giant Zombie", new Integer(3));
+// Health
+ entities.set("Entities Configuration.Stats.Health.Giant Zombie", new Integer(100));
+ entities.set("Entities Configuration.Stats.Health.Giant Slime", new Integer(100));
+ entities.set("Entities Configuration.Stats.Health.Giant Lava Slime", new Integer(100));
+// Experience
+ entities.set("Entities Configuration.Stats.Experience.Giant Zombie", new Integer(5));
+ entities.set("Entities Configuration.Stats.Experience.Giant Slime", new Integer(5));
+ entities.set("Entities Configuration.Stats.Experience.Giant Lava Slime", new Integer(5));
+// Armour
+ entities.set("Entities Configuration.Stats.Equipped Armour.Giant Zombie.Items",
+ new String("chainmail_helmet:chainmail_chestplate:chainmail_leggings:chainmail_boots:diamond_sword"));
+ entities.set("Entities Configuration.Stats.Equipped Armour.Giant Zombie.Equipped Item Drop Rate", new Float(8.5));
+// Drops
+ entities.set("Entities Configuration.Stats.Drops.Enable Drop Manager", true);
+ entities.set("Entities Configuration.Stats.Drops.Giant Zombie", Arrays.asList(loadDefaultDrop("Giant Zombie")));
+ entities.set("Entities Configuration.Stats.Drops.Giant Slime", Arrays.asList(loadDefaultDrop("Giant Slime")));
+ entities.set("Entities Configuration.Stats.Drops.Giant Lava Slime", Arrays.asList(loadDefaultDrop("Giant Lava Slime")));
+// BarAPI
+ entities.set("Entities Configuration.Stats.BarAPI.Display Name.Giant Zombie", "&2Giant Zombie");
+ entities.set("Entities Configuration.Stats.BarAPI.Display Name.Giant Slime", "&2Giant Slime Size {size}");
+ entities.set("Entities Configuration.Stats.BarAPI.Display Name.Giant Lava Slime", "&2Giant Lava Slime Size {size}");
+// Damage
+ entities.set("Entities Configuration.Damage Settings.Arrows.Damage done by arrow.Giant Zombie", new Integer(10));
+ entities.set("Entities Configuration.Damage Settings.Arrows.Damage done by arrow.Giant Slime", new Integer(10));
+ entities.set("Entities Configuration.Damage Settings.Arrows.Damage done by arrow.Giant Lava Slime", new Integer(10));
+ entities.set("Entities Configuration.Damage Settings.Fire.Allow Fire Damage.Giant Zombie", true);
+ entities.set("Entities Configuration.Damage Settings.Fire.Allow Fire Damage.Giant Slime", true);
+ entities.set("Entities Configuration.Damage Settings.Block Damage.Allow Suffocation.Giant Zombie",false);
+ entities.set("Entities Configuration.Damage Settings.Block Damage.Allow Suffocation.Giant Slime",false);
+ entities.set("Entities Configuration.Damage Settings.Block Damage.Allow Suffocation.Giant Lava Slime",false);
+ entities.set("Entities Configuration.Damage Settings.Block Damage.Allow Cacti Damage.Giant Zombie", false);
+ entities.set("Entities Configuration.Damage Settings.Block Damage.Allow Cacti Damage.Giant Slime", false);
+ entities.set("Entities Configuration.Damage Settings.Block Damage.Allow Cacti Damage.Giant Lava Slime", false);*/
+ for (ConfigValues value : ConfigValues.values()) {
+ if (value.getFile() == Files.ENTITIES) {
+ if (!value.isList())
+ entities.set(value.getKey(), value.getValue());
+ else
+ entities.set(value.getKey(), value.getValues());
+ }
+ }
+ try {
+ entities.save(file);
+ } catch (IOException e) {
+ }
+ _configurations.put(files, entities);
+ break;
+
+ case ATTACKS:
+ YamlConfiguration attacks = YamlConfiguration.loadConfiguration(file);
+ /*attacks.set("Attacks Configuration.File Version", loadVersion());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Lightning Attack", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Stomp Attack.Enabled", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Stomp Attack.Explosion Power", new Integer(1));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Stomp Attack.Light Fire", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Lava Attack", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Kick Attack.Enabled", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Kick Attack.Kick Height", new Integer(1));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Fire Attack.Enabled", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Fire Attack.Ticks for Target", new Integer(100));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Fire Attack.Ticks for Giant", new Integer(100));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled", loadEntities());
+ attacks.set("Attacks Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage", new Integer(1));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Enabled", Arrays.asList("Giant Zombie"));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Baby Zombies", false);
+ attacks.set("Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Zombies to Spawn", new Integer(3));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Shrapnel Attack.Health", new Integer(20));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Enabled", false);
+ attacks.set("Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Baby Zombies", false);
+ attacks.set("Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Zombies to Spawn", new Integer(5));
+ attacks.set("Attacks Configuration.Attack Mechanisms.Spawn Zombies On Death.Health", new Integer(20));*/
+ for (ConfigValues value : ConfigValues.values()) {
+ if (value.getFile() == Files.ATTACKS) {
+ if (!value.isList())
+ attacks.set(value.getKey(), value.getValue());
+ else
+ attacks.set(value.getKey(), value.getValues());
+ }
+ }
+ try {
+ attacks.save(file);
+ } catch (IOException e) {
+ }
+ _configurations.put(files, attacks);
+ break;
+ case JOCKEY:
+ if (getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled").equalsIgnoreCase("true")) {
+ YamlConfiguration Jockey = YamlConfiguration.loadConfiguration(file);
+ Jockey.set("Jockey Configuration.File Version", FileSetup.loadVersion());
+ Jockey.set("Jockey Configuration", new String("This entity of Giants is extremely experimental and does not have many features"));
+ Jockey.set("Jockey Configuration.Spawn Settings.Worlds", loadWorlds());
+ for (ConfigValues value : ConfigValues.values()) {
+ if (value.getFile() == Files.JOCKEY) {
+ if (!value.isList())
+ Jockey.set(value.getKey(), value.getValue());
+ else
+ Jockey.set(value.getKey(), value.getValues());
+ }
+ }
+ try {
+ Jockey.save(file);
+ } catch (IOException e) {
+ }
+ _configurations.put(files, Jockey);
+ }
+ break;
+ case JOCKEYBIOMES:
+ if (getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled").equalsIgnoreCase("true")) {
+ YamlConfiguration JockeyBiomes = YamlConfiguration.loadConfiguration(file);
+/* JockeyBiomes.set("Giants Configuration.File Version", FileSetup.loadVersion());
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Swampland", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Forest", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Taiga", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Plains", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Extreme Hills", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Mushroom Island", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Desert", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Jungle", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Birch Forest", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Savanna", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Roofed Forest", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Mesa", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Other.Small Mountains", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Other.Ice Mountains", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Other.Ocean", false);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Other.River", false);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Other.Hell", true);
+ JockeyBiomes.set("Giants Configuration.Biome Settings.Other.Sky", true);*/
+ for (ConfigValues value : ConfigValues.values()) {
+ if (value.getFile() == Files.JOCKEYBIOMES) {
+ if (!value.isList())
+ JockeyBiomes.set(value.getKey(), value.getValue());
+ else
+ JockeyBiomes.set(value.getKey(), value.getValues());
+ }
+ }
+ try {
+ JockeyBiomes.save(file);
+ } catch (IOException e) {
+ }
+ _configurations.put(files, JockeyBiomes);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Deprecated
+ public String getProperty(Files file, String path) {
+ FileConfiguration conf = _configurations.get(file);
+
+ if (conf != null) {
+ String prop = conf.getString(path, "NULL");
+
+ if (!prop.equalsIgnoreCase("NULL"))
+ return prop;
+ conf.set(path, null);
+ }
+ return null;
+ }
+ @Deprecated
+ public List getPropertyList(Files file, String path) {
+ FileConfiguration conf = _configurations.get(file);
+
+ if (conf != null) {
+ List prop = conf.getStringList(path);
+ if (!prop.contains("NULL"))
+ return prop;
+ conf.set(path, null);
+ }
+ return null;
+ }
+
+ /**
+ * Gets the property that is saved at the value location.
+ * @param ConfigValues value.
+ * @return String property from the config file the value is saved in.
+ */
+ public String getProperty(ConfigValues value) {
+ if (value == ConfigValues.soundsBoolean)
+ return "false";
+ FileConfiguration config = _configurations.get(value.getFile());
+ if (config != null) {
+ String property = config.getString(value.getKey(), "NULL");
+
+ if (!property.equalsIgnoreCase("NULL"))
+ return property;
+ config.set(value.getKey(), value.getValue());
+ }
+ return null;
+ }
+
+ /**
+ * Gets the property list that is saved at the value location.
+ * @param ConfigValues value.
+ * @return List propertylist from the config file the value is saved in.
+ */
+ public List getPropertyList(ConfigValues value) {
+ FileConfiguration config = _configurations.get(value.getFile());
+ if (config != null) {
+ List property = config.getStringList(value.getKey());
+
+ if (!property.contains("NULL"))
+ return property;
+ config.set(value.getKey(), value.getValue());
+ }
+ return null;
+ }
+
+ /**
+ * Changes the property value at the value location.
+ * @param value - the value to change
+ * @param newValue the value to put in place of the current value
+ */
+ public void setProperty(ConfigValues value, Object newValue) {
+ FileConfiguration config = _configurations.get(value.getFile());
+ if (config != null) {
+ config.set(value.getKey(), newValue);
+ try {
+ config.save(new File(value.getFile().getPath()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/files/src/main/java/me/Mammothskier/Giants/Files/FileSetup.java b/files/src/main/java/me/Mammothskier/Giants/Files/FileSetup.java
new file mode 100644
index 0000000..5682567
--- /dev/null
+++ b/files/src/main/java/me/Mammothskier/Giants/Files/FileSetup.java
@@ -0,0 +1,62 @@
+package me.Mammothskier.Giants.Files;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.plugin.PluginDescriptionFile;
+
+public class FileSetup {
+
+ public static String loadVersion() {
+ PluginDescriptionFile pdf = Bukkit.getPluginManager().getPlugin("Giants").getDescription();
+ String version = pdf.getVersion();
+ if (version == null) {
+ return null;
+ }
+ return version;
+ }
+
+ public static List loadWorlds() {
+ List worldList = new ArrayList();
+ for (World w : Bukkit.getServer().getWorlds()) {
+ worldList.add(w.getName());
+ }
+ return worldList;
+ }
+
+
+ public static String[] loadDefaultDrop(String arg) {
+ String[] drops = null;
+ switch(arg){
+ case "Giant Zombie":
+ drops = new String[]{ "1-0-0;1;100/100;GIANT STONE;Dropped by a Giant Zombie" };
+ break;
+ case "Giant Slime":
+ drops = new String[]{ "1-0-0;1;100/100;4-12;GIANT STONE;Dropped by a Giant Slime" };
+ break;
+ case "Giant Lava Slime":
+ drops = new String[]{ "1-0-0;1;100/100;4-12;GIANT STONE;Dropped by a Giant Lava Slime" };
+ break;
+ default:
+ break;
+ }
+ return drops;
+ }
+
+ public static List loadEntities() {
+ List list = new ArrayList();
+ list.add("Giant Zombie");
+ list.add("Giant Slime");
+ list.add("Giant Lava Slime");
+ return list;
+ }
+
+ public static boolean checkDependencies(String plugin) {
+ if (Bukkit.getPluginManager().getPlugin(plugin) != null) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/files/src/main/java/me/Mammothskier/Giants/Files/Files.java b/files/src/main/java/me/Mammothskier/Giants/Files/Files.java
new file mode 100644
index 0000000..847aaed
--- /dev/null
+++ b/files/src/main/java/me/Mammothskier/Giants/Files/Files.java
@@ -0,0 +1,19 @@
+package me.Mammothskier.Giants.Files;
+
+public enum Files {
+ CONFIG("plugins/Giants/config.yml"),
+ ENTITIES("plugins/Giants/entities.yml"), BIOMES("plugins/Giants/biomes.yml"),
+ ATTACKS("plugins/Giants/attacks.yml"),
+ JOCKEY("plugins/Giants/Jockey/jockey.yml"), JOCKEYBIOMES("plugins/Giants/Jockey/biomes.yml");
+
+ private final String _path;
+
+ private Files(final String path) {
+ _path = path;
+ }
+
+ public String getPath() {
+ return _path;
+ }
+
+}
\ No newline at end of file
diff --git a/plugin/dependency-reduced-pom.xml b/plugin/dependency-reduced-pom.xml
new file mode 100644
index 0000000..dd6a479
--- /dev/null
+++ b/plugin/dependency-reduced-pom.xml
@@ -0,0 +1,33 @@
+
+
+
+ Giants-Parent
+ me.Mammothskier
+ 7.1.1-SNAPSHOT
+
+ 4.0.0
+ Giants-plugins
+ Giants
+ 7.1.1-Beta
+
+
+ confuser-repo
+ http://ci.frostcast.net/plugin/repository/everything
+
+
+
+
+ org.bukkit
+ bukkit
+ 1.9.4-R0.1-SNAPSHOT
+ compile
+
+
+ me.confuser
+ BarAPI
+ 3.3
+ compile
+
+
+
+
diff --git a/plugin/pom.xml b/plugin/pom.xml
new file mode 100644
index 0000000..7ee8294
--- /dev/null
+++ b/plugin/pom.xml
@@ -0,0 +1,185 @@
+
+ 4.0.0
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+ Giants
+ Giants-plugins
+ 7.1.1-Beta
+ jar
+
+
+
+ org.bukkit
+ bukkit
+ 1.9.4-R0.1-SNAPSHOT
+ jar
+
+
+
+ me.confuser
+ BarAPI
+ 3.3
+ jar
+
+
+
+ me.Mammothskier
+ Giants-Files
+ 1.1-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_7_R3
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_7_R4
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_8_R1
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_8_R2
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_8_R3
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_9_R1
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_9_R2
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+ me.Mammothskier
+ Giants-v1_10_R1
+ 2.0-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ me.Mammothskier
+ Giants-Files
+
+
+ false
+
+
+
+
+
+ confuser-repo
+ http://ci.frostcast.net/plugin/repository/everything
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/BarAPI/HealthBar.java b/plugin/src/main/java/me/Mammothskier/Giants/BarAPI/HealthBar.java
similarity index 78%
rename from src/main/java/me/Mammothskier/Giants/BarAPI/HealthBar.java
rename to plugin/src/main/java/me/Mammothskier/Giants/BarAPI/HealthBar.java
index 18186a8..0db19e1 100644
--- a/src/main/java/me/Mammothskier/Giants/BarAPI/HealthBar.java
+++ b/plugin/src/main/java/me/Mammothskier/Giants/BarAPI/HealthBar.java
@@ -14,8 +14,8 @@
import org.bukkit.event.entity.EntityDeathEvent;
import me.Mammothskier.Giants.Giants;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
+import me.Mammothskier.Giants.Files.Files;
+import me.Mammothskier.Giants.entity.Entities;
import me.confuser.barapi.BarAPI;
public class HealthBar implements Listener {
@@ -33,9 +33,9 @@ public void changeHealthBar(EntityDamageByEntityEvent event) {
if (entity == null || damager == null) {
return;
}
- if (API.isGiant(entity) || API.isGiantMagmaCube(entity) || API.isGiantSlime(entity)) {
+ if (Entities.isGiantZombie(entity) || Entities.isGiantLavaSlime(entity) || Entities.isGiantSlime(entity)) {
if (damager instanceof Projectile) {
- damager = ((Projectile) damager).getShooter();
+ damager = (Entity) ((Projectile) damager).getShooter();
}
if (damager instanceof Player) {
Player player = (Player) damager;
@@ -47,7 +47,7 @@ public void changeHealthBar(EntityDamageByEntityEvent event) {
@EventHandler
public void onDeath(EntityDeathEvent event) {
Entity entity = event.getEntity();
- if (API.isGiant(entity) || API.isGiantMagmaCube(entity) || API.isGiantSlime(entity)) {
+ if (Entities.isGiantZombie(entity) || Entities.isGiantLavaSlime(entity) || Entities.isGiantSlime(entity)) {
Entity killer = event.getEntity().getKiller();
if (killer instanceof Player) {
Player player = (Player) killer;
@@ -67,14 +67,14 @@ public void setupBar(Player player, Entity entity) {
switch (entityType) {
case GIANT:
- String giantName = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Giant Stats.BarAPI.Display Name");
+ String giantName = Giants.getProperty(Files.ENTITIES, "Entities Configuration.Stats.BarAPI.Display Name.Giant Zombie");
giantName = ChatColor.translateAlternateColorCodes('&', giantName);
if (player.hasPermission("giants.barAPI") || player.hasPermission("giants.*") || player.isOp()) {
BarAPI.setMessage(player, giantName, percent * 100);
}
break;
case SLIME:
- String slimeName = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.BarAPI.Display Name");
+ String slimeName = Giants.getProperty(Files.ENTITIES, "Entities Configuration.Stats.BarAPI.Display Name.Giant Slime");
slimeName = ChatColor.translateAlternateColorCodes('&', slimeName);
size = Integer.toString(((Slime) entity).getSize());
if (player.hasPermission("giants.barAPI") || player.hasPermission("giants.*") || player.isOp()) {
@@ -82,7 +82,7 @@ public void setupBar(Player player, Entity entity) {
}
break;
case MAGMA_CUBE:
- String magmacubeName = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.BarAPI.Display Name");
+ String magmacubeName = Giants.getProperty(Files.ENTITIES, "Magma Cube Configuration.Magma Cube Stats.BarAPI.Display Name.Giant Lava Slime");
magmacubeName = ChatColor.translateAlternateColorCodes('&', magmacubeName);
size = Integer.toString(((MagmaCube) entity).getSize());
if (player.hasPermission("giants.barAPI") || player.hasPermission("giants.*") || player.isOp()) {
diff --git a/src/main/java/me/Mammothskier/Giants/Commands.java b/plugin/src/main/java/me/Mammothskier/Giants/Commands.java
similarity index 76%
rename from src/main/java/me/Mammothskier/Giants/Commands.java
rename to plugin/src/main/java/me/Mammothskier/Giants/Commands.java
index f6034a0..5b7ef68 100644
--- a/src/main/java/me/Mammothskier/Giants/Commands.java
+++ b/plugin/src/main/java/me/Mammothskier/Giants/Commands.java
@@ -1,19 +1,27 @@
package me.Mammothskier.Giants;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.entity.Entities;
+import me.Mammothskier.Giants.events.SpawnEvent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
+import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Damageable;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.inventory.EntityEquipment;
+import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginDescriptionFile;
public class Commands implements CommandExecutor {
@@ -41,9 +49,9 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
if (args[0].equalsIgnoreCase("reload")) {
if ((player.hasPermission("giants.reload")) || (player.isOp()) || (player.hasPermission("giants.*"))) {
if ((player.hasPermission("giants.reload")) || (player.isOp())) {
- API.getFileHandler().loadFiles();
+ Giants.getFileHandler().loadFiles();
player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "Giants config file reloaded.");
- Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants]" + ChatColor.GREEN + player + "has reloaded the giants config");
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants]" + ChatColor.GREEN + player.getName() + "has reloaded the giants config");
_giants.log.info("Giants config file reloaded.");
} else {
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
@@ -54,10 +62,11 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
if (args[0].equalsIgnoreCase("spawn")){
if((player.hasPermission("giants.spawn")) || (player.isOp()) || player.hasPermission("giants.*")){
if (args.length >= 2){
- if(args[1].equalsIgnoreCase("giant")){
+ if(args[1].equalsIgnoreCase("zombie")){
+ Giant entity = null;
double health;
- String string = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Giant Stats.Health");
+ String string = Giants.getProperty(ConfigValues.zombieHealth);
try {
health = Double.parseDouble(string);
} catch (Exception e) {
@@ -66,10 +75,9 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
if(args.length == 2){
Location loc = (Location) player.getEyeLocation();
- Location location = loc;
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
+ Entities.createGiant(loc, SpawnReason.NATURAL);
+
+ entity = (Giant) SpawnEvent.getGiantZombie(SpawnEvent.getNearbyEntities(loc, 10), loc);
player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A Giant has been spawned");
}
if(args.length == 5){
@@ -89,20 +97,42 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
location.setY(locy);
location.setZ(locz);
Location loc = location;
+ if (Entities.GiantZombie == true) {
+ Entities.createGiant(loc, SpawnReason.NATURAL);
+ entity = (Giant) SpawnEvent.getGiantZombie(SpawnEvent.getNearbyEntities(loc, 10), loc);
+ } else {
+ entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
+ }
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
+ player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A Giant has been spawned at x:" + locx + " y:" + locy + "z:" + locz);
+ }
+
+ if (entity != null) {
entity.setMaxHealth(health);
entity.setHealth(health);
-
- player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A Giant has been spawned at x:" + locx + " y:" + locy + "z:" + locz);
+ if (entity.getType() == EntityType.GIANT) {
+ EntityEquipment entityArmour = ((LivingEntity) entity).getEquipment();
+
+ float dropChance = 0;
+ entityArmour.setHelmet(SpawnEvent.parseArmour(ConfigValues.zombieHelmet, dropChance));
+ entityArmour.setHelmetDropChance(dropChance);
+ entityArmour.setChestplate(SpawnEvent.parseArmour(ConfigValues.zombieChestPlate, dropChance));
+ entityArmour.setChestplateDropChance(dropChance);
+ entityArmour.setLeggings(SpawnEvent.parseArmour(ConfigValues.zombieLeggings, dropChance));
+ entityArmour.setLeggingsDropChance(dropChance);
+ entityArmour.setBoots(SpawnEvent.parseArmour(ConfigValues.zombieBoots, dropChance));
+ entityArmour.setBootsDropChance(dropChance);
+ entityArmour.setItemInMainHand(SpawnEvent.parseArmour(ConfigValues.zombieMainHand, dropChance));
+ entityArmour.setItemInMainHandDropChance(dropChance);
+ }
}
return true;
}
if(args[1].equalsIgnoreCase("slime")){
Location loc = (Location) player.getEyeLocation();
Location location = loc;
- String string = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Size");
- String string2 = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Health");
+ String string = Giants.getProperty(ConfigValues.slimeSize);
+ String string2 = Giants.getProperty(ConfigValues.slimeHealth);
int size;
double health;
try {
@@ -145,9 +175,9 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
if(args[1].equalsIgnoreCase("jockey")){
Location loc = (Location) player.getEyeLocation();
Location location = loc;
- String string = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Size");
- String string2 = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Health");
- String string3 = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Giant Stats.Health");
+ String string = Giants.getProperty(ConfigValues.slimeSize);
+ String string2 = Giants.getProperty(ConfigValues.slimeHealth);
+ String string3 = Giants.getProperty(ConfigValues.zombieHealth);
int size;
double giantHealth;
double slimeHealth;
@@ -165,8 +195,10 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
slime.setSize(size);
slime.setMaxHealth(slimeHealth);
slime.setHealth(slimeHealth);
- Giant giant = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- giant.setMaxHealth(giantHealth);
+ Entities.createGiant(loc, SpawnReason.NATURAL);
+
+ Entity giant = SpawnEvent.getGiantZombie(SpawnEvent.getNearbyEntities(loc, 10), loc);
+ ((Damageable) giant).setMaxHealth(giantHealth);
slime.setPassenger(giant);
player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A Giant Jockey has been spawned");
}
@@ -199,8 +231,8 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
if((args[1].equalsIgnoreCase("lavaslime")) || (args[1].equalsIgnoreCase("magma_cube")) || (args[1].equalsIgnoreCase("magma"))|| (args[1].equalsIgnoreCase("magmacube"))){
Location loc = (Location) player.getEyeLocation();
Location location = loc;
- String string = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.Size");
- String string2 = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.Health");
+ String string = Giants.getProperty(ConfigValues.lavaSlimeSize);
+ String string2 = Giants.getProperty(ConfigValues.lavaSlimeHealth);
int size;
double health;
try {
@@ -240,7 +272,7 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
return true;
}
else {
- player.sendMessage(ChatColor.RED + "Unknown Entity Type! I recognise giant, slime, magmacube and jockey.");
+ player.sendMessage(ChatColor.RED + "Unknown Entity Type! I recognise zombie, slime, lavaslime and jockey.");
}
}
else {
@@ -250,10 +282,8 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
return true;
}
if (args[0].equalsIgnoreCase("version")){
- if((player.hasPermission("giants.version")) || (player.isOp())){
- PluginDescriptionFile pdf = Bukkit.getPluginManager().getPlugin("Giants").getDescription();
- player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + pdf.getName() + " Version " + pdf.getVersion() + " is currently Enabled!");
- }
+ PluginDescriptionFile pdf = Bukkit.getPluginManager().getPlugin("Giants").getDescription();
+ player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + pdf.getName() + " Version " + pdf.getVersion() + " is currently Enabled!");
return true;
}
else {
@@ -272,7 +302,7 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
}
if (args[0].equalsIgnoreCase("reload")) {
Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] "+ ChatColor.GREEN + "Giants config files reloaded.");
- API.getFileHandler().loadFiles();
+ Giants.getFileHandler().loadFiles();
_giants.log.info("Giants config file reloaded.");
return true;
}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/Giants.java b/plugin/src/main/java/me/Mammothskier/Giants/Giants.java
new file mode 100644
index 0000000..b3bb417
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/Giants.java
@@ -0,0 +1,93 @@
+package me.Mammothskier.Giants;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.logging.Logger;
+
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.Files.FileHandler;
+import me.Mammothskier.Giants.Files.Files;
+import me.Mammothskier.Giants.entity.Entities;
+import me.Mammothskier.Giants.util.Metrics;
+import me.Mammothskier.Giants.util.NMSUtils;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.java.JavaPlugin;
+
+public class Giants extends JavaPlugin {
+ private static FileHandler fileHandler;
+ public final Logger log = Logger.getLogger("Minecraft");
+
+ @Override
+ public void onEnable() {
+ NMSUtils.registerEntities();
+
+ PluginDescriptionFile pdf = this.getDescription();
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + pdf.getName() + " Version " + pdf.getVersion() + " Has Been Enabled!");
+
+ try {
+ Metrics metrics = new Metrics(this);
+ metrics.start();
+ } catch (IOException e) {
+ // Failed to submit the stats :-(
+ }
+
+ this.getCommand("giants").setExecutor(new Commands(this));
+ new Entities(this);
+ fileHandler = new FileHandler();
+ updateEntities();
+ }
+
+ @Override
+ public void onDisable() {
+ NMSUtils.unregisterEntities();
+ }
+
+ @Deprecated
+ public static String getProperty(Files file, String path) {
+ return fileHandler.getProperty(file, path);
+ }
+
+ @Deprecated
+ public static List getPropertyList(Files file, String path) {
+ return fileHandler.getPropertyList(file, path);
+ }
+
+ public static String getProperty(ConfigValues value) {
+ return fileHandler.getProperty(value);
+ }
+
+ public static List getPropertyList(ConfigValues values) {
+ return fileHandler.getPropertyList(values);
+ }
+
+ public static FileHandler getFileHandler() {
+ return fileHandler;
+ }
+
+ public static void updateEntities() {
+ if (Entities.GiantZombie == true && getProperty(ConfigValues.zombieBoolean).equalsIgnoreCase("false"))
+ Entities.GiantZombie = false;
+
+ if (getProperty(ConfigValues.slimeBoolean).equalsIgnoreCase("true")) {
+ Entities.GiantSlime = true;
+ } else {
+ Entities.GiantSlime = false;
+ }
+
+ if (getProperty(ConfigValues.lavaSlimeBoolean).equalsIgnoreCase("true")) {
+ Entities.GiantLavaSlime = true;
+ } else {
+ Entities.GiantLavaSlime = false;
+ }
+
+ if (getProperty(ConfigValues.jockeyBoolean).equalsIgnoreCase("true")) {
+ Entities.GiantJockey = true;
+ } else {
+ Entities.GiantJockey = false;
+ }
+
+ }
+}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/entity/DamageListener.java b/plugin/src/main/java/me/Mammothskier/Giants/entity/DamageListener.java
new file mode 100644
index 0000000..ed56690
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/entity/DamageListener.java
@@ -0,0 +1,109 @@
+package me.Mammothskier.Giants.entity;
+
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
+
+import org.bukkit.entity.Arrow;
+import org.bukkit.entity.Damageable;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.MagmaCube;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+
+public class DamageListener implements Listener {
+ private Giants _giants;
+ public DamageListener(Giants giants) {
+ _giants = giants;
+ _giants.getServer().getPluginManager().registerEvents(this, giants);
+ }
+
+ @EventHandler
+ public void onEntityDamageEvent(EntityDamageEvent event) {
+ Entity entity = event.getEntity();
+ if (Entities.isGiant(entity)) {
+ if (event.getCause() == DamageCause.SUFFOCATION || event.getCause() == DamageCause.FALLING_BLOCK) {
+ String string = "true";
+ if (Entities.isGiantZombie(entity))
+ string = Giants.getProperty(ConfigValues.zombieAllowSuffocation);
+ else if (Entities.isGiantSlime(entity))
+ string = Giants.getProperty(ConfigValues.slimeAllowSuffocation);
+ else if (Entities.isGiantLavaSlime(entity))
+ string = Giants.getProperty(ConfigValues.lavaSlimeAllowSuffocation);
+
+ if (string.equalsIgnoreCase("false")) {
+ event.setCancelled(true);
+ }
+ }
+
+ if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK) {
+ String string = "true";
+ if (Entities.isGiantZombie(entity))
+ string = Giants.getProperty(ConfigValues.zombieAllowFireDamage);
+ else if (Entities.isGiantSlime(entity))
+ string = Giants.getProperty(ConfigValues.slimeAllowFireDamage);
+ if (string.equalsIgnoreCase("false")) {
+ event.setCancelled(true);
+ }
+ }
+ if (event.getCause() == DamageCause.THORNS) {
+ String string = "true";
+ if (Entities.isGiantZombie(entity))
+ string = Giants.getProperty(ConfigValues.zombieAllowCactiDamage);
+ else if (Entities.isGiantSlime(entity))
+ string = Giants.getProperty(ConfigValues.slimeAllowCactiDamage);
+ else if (Entities.isGiantLavaSlime(entity))
+ string = Giants.getProperty(ConfigValues.lavaSlimeAllowCactiDamage);
+ if (string.equalsIgnoreCase("false")) {
+ event.setCancelled(true);
+ }
+ }
+ }
+ }
+
+ public void onArrowDamage(EntityDamageByEntityEvent event) {
+ Entity entity = event.getEntity();
+ if (Entities.isGiant(entity)) {
+ if (event.getDamager() instanceof Arrow){
+ int damage;
+ String string = "";
+ if (Entities.isGiantZombie(entity))
+ string = Giants.getProperty(ConfigValues.zombieArrowDamage);
+ else if (Entities.isGiantSlime(entity))
+ string = Giants.getProperty(ConfigValues.slimeArrowDamage);
+ else if (Entities.isGiantSlime(entity))
+ string = Giants.getProperty(ConfigValues.lavaSlimeArrowDamage);
+ try {
+ damage = Integer.parseInt(string);
+ } catch (Exception e) {
+ damage = 10;
+ }
+ if(damage == 0){
+ event.setCancelled(true);
+ return;
+ }
+ event.setDamage(damage + 0.0);
+ }
+ }
+ }
+
+
+ @EventHandler
+ public void damage(EntityDamageByEntityEvent event){
+ Entity entity = event.getEntity();
+ int s;
+ if ((event.getDamager() instanceof Player) && (Entities.isGiantLavaSlime(entity))){
+ MagmaCube magmacube = (MagmaCube) event.getEntity();
+ s = magmacube.getSize();
+ if (s > 4){
+ double damage = event.getDamage();
+ double health = ((Damageable) event.getEntity()).getHealth();
+ ((Damageable) entity).setHealth(Math.max(0, Math.min(health - damage, ((Damageable) entity).getMaxHealth())));
+ event.setCancelled(true);
+ }
+ }
+ }
+}
diff --git a/src/main/java/me/Mammothskier/Giants/utils/DropsManager.java b/plugin/src/main/java/me/Mammothskier/Giants/entity/DropsManager.java
similarity index 86%
rename from src/main/java/me/Mammothskier/Giants/utils/DropsManager.java
rename to plugin/src/main/java/me/Mammothskier/Giants/entity/DropsManager.java
index 2615f07..9f1e009 100644
--- a/src/main/java/me/Mammothskier/Giants/utils/DropsManager.java
+++ b/plugin/src/main/java/me/Mammothskier/Giants/entity/DropsManager.java
@@ -1,27 +1,35 @@
-package me.Mammothskier.Giants.utils;
+package me.Mammothskier.Giants.entity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
import org.bukkit.ChatColor;
+import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentWrapper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Slime;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-import me.Mammothskier.Giants.Giants;
-
-public class DropsManager {
+public class DropsManager implements Listener {
- public DropsManager(Giants drops) {
+ private Giants _giants;
+
+ public DropsManager(Giants giants) {
+ _giants = giants;
+ _giants.getServer().getPluginManager().registerEvents(this, giants);
}
- public List setDrop(Entity entity, List newDrop) {
+ public static List setDrop(Entity entity, List newDrop) {
List drops = new ArrayList();
switch (entity.getType()) {
@@ -431,4 +439,41 @@ public List setDrop(Entity entity, List newDrop) {
}
return drops;
}
-}
\ No newline at end of file
+
+ @EventHandler
+ public void onEntityDeath(EntityDeathEvent event) {
+ Entity entity = event.getEntity();
+ if (Entities.giantEntities.remove(entity) && Giants.getProperty(ConfigValues.dropManager).equalsIgnoreCase("true")) {
+ String experience;
+ List newDrop;
+ if (Entities.isGiantZombie(entity)) {
+ experience = Giants.getProperty(ConfigValues.zombieExperience);
+ newDrop = Giants.getPropertyList(ConfigValues.zombieDrops);
+ } else if (Entities.isGiantSlime(entity)) {
+ experience = Giants.getProperty(ConfigValues.slimeExperience);
+ newDrop = Giants.getPropertyList(ConfigValues.slimeDrops);
+ } else if (Entities.isGiantLavaSlime(entity)) {
+ experience = Giants.getProperty(ConfigValues.lavaSlimeExperience);
+ newDrop = Giants.getPropertyList(ConfigValues.lavaSlimeDrops);
+ } else {
+ return;
+ }
+
+ try {
+ event.setDroppedExp(Integer.parseInt(experience));
+ } catch ( Exception e) {
+ event.setDroppedExp(5);
+ }
+
+ if (newDrop == null || newDrop.contains("") || newDrop.toString().equalsIgnoreCase("[]")) {
+ return;
+ }
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ entity.getWorld().playSound(entity.getLocation(), Sound.ENTITY_ENDERDRAGON_DEATH, 1, 0);
+ }
+
+ setDrop(entity, newDrop);
+
+ }
+ }
+}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/entity/Entities.java b/plugin/src/main/java/me/Mammothskier/Giants/entity/Entities.java
new file mode 100644
index 0000000..0333d60
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/entity/Entities.java
@@ -0,0 +1,385 @@
+package me.Mammothskier.Giants.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Ghast;
+import org.bukkit.entity.Giant;
+import org.bukkit.entity.MagmaCube;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Slime;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.scheduler.BukkitScheduler;
+
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.events.JockeySpawnEvent;
+import me.Mammothskier.Giants.events.SpawnEvent;
+import me.Mammothskier.Giants.util.NMSUtils;
+
+public class Entities implements Listener {
+ private static Giants _giants;
+ public static boolean GiantZombie = false;
+ public static boolean GiantSlime = false;
+ public static boolean GiantLavaSlime = false;
+ public static boolean GiantJockey = false;
+
+ public static final EntityType[] zombieReplacements = {EntityType.ZOMBIE, EntityType.MUSHROOM_COW, EntityType.PIG_ZOMBIE, EntityType.ENDERMAN};
+ public static final EntityType[] slimeReplacements = {EntityType.ZOMBIE,EntityType.MUSHROOM_COW, EntityType.PIG_ZOMBIE, EntityType.SLIME, EntityType.ENDERMAN};
+ public static final EntityType[] lavaSlimeReplacements = {EntityType.PIG_ZOMBIE, EntityType.ZOMBIE, EntityType.MAGMA_CUBE, EntityType.ENDERMAN, EntityType.BLAZE};
+
+ public static ArrayList giantEntities = new ArrayList();
+
+ public Entities(Giants giants) {
+ _giants = giants;
+ _giants.getServer().getPluginManager().registerEvents(this, giants);
+ new DamageListener(_giants);
+ new DropsManager(_giants);
+ new GiantListeners(_giants);
+ new SlimeListeners(_giants);
+ new MagmaCubeListeners(_giants);
+ jockeySpawner();
+ }
+
+ @EventHandler (priority = EventPriority.NORMAL)
+ public void onSpawnEvent (CreatureSpawnEvent event) {
+ Entity entity = (Entity) event.getEntity();
+ EntityType type = event.getEntityType();
+ SpawnReason spawnReason = event.getSpawnReason();
+
+ if(event.isCancelled()){
+ return;
+ }
+
+ if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE && ((Slime) entity).getSize() == 4) return;
+
+ if ((spawnReason == SpawnReason.NATURAL || spawnReason == SpawnReason.SPAWNER) && isASpawnReplacement(type)) {
+ Random rand = new Random();
+
+ EntityType spawn = null;
+ int i = -1;
+ while (spawn == null) {
+ i = rand.nextInt(3);
+ if (i== 0 && isASpawnReplacementFor(type, EntityType.GIANT)) {
+ spawn = EntityType.GIANT;
+ } else if (i == 1 && isASpawnReplacementFor(type, EntityType.SLIME)) {
+ spawn = EntityType.SLIME;
+ } else if (i == 2 && isASpawnReplacementFor(type, EntityType.MAGMA_CUBE)){
+ spawn = EntityType.MAGMA_CUBE;
+ }
+ }
+ if (!isEnabled(spawn)) {
+ return;
+ }
+
+ String string = "";
+ if (spawn.equals(EntityType.GIANT)) {
+ string = Giants.getProperty(ConfigValues.zombieChance);
+ } else if (spawn.equals(EntityType.SLIME)) {
+ string = Giants.getProperty(ConfigValues.slimeChance);
+ } else if (spawn.equals(EntityType.MAGMA_CUBE)) {
+ string = Giants.getProperty(ConfigValues.lavaSlimeChance);
+ }
+
+ Float sRate;
+ try {
+ sRate = Float.parseFloat(string);
+ } catch (NumberFormatException e) {
+ sRate = 10f;
+ }
+
+ if (rand.nextFloat()*100 < sRate) {
+ Location location = entity.getLocation();
+ double x = location.getX();
+ double y = location.getY();
+ double z = location.getZ();
+
+ int x2 = (int) x;
+ int y2 = (int) y;
+ int z2 = (int) z;
+
+ int spawngiant = 1;
+ double checkcount = 1;
+
+ String s;
+ int size;
+
+ //Comment out this next line to allow random spawning.
+ //spawn = EntityType.GIANT;
+
+ switch (spawn) {
+ case GIANT:
+ while (checkcount <= 15) {
+ if (entity.getWorld().getBlockAt(new Location(entity.getWorld(), x2, y2 + checkcount, z2)).getType() != Material.AIR) {
+ spawngiant = 0;
+ }
+ checkcount++;
+ }
+ break;
+ case SLIME:
+ s = Giants.getProperty(ConfigValues.slimeSize);
+ try {
+ size = Integer.parseInt(s);
+ } catch (Exception e) {
+ size = 12;
+ }
+ while (checkcount <= size) {
+ if (entity.getWorld().getBlockAt(new Location(entity.getWorld(), x2, y2 + checkcount, z2)).getType() != Material.AIR) {
+ spawngiant = 0;
+ }
+ checkcount++;
+ }
+ break;
+ case MAGMA_CUBE:
+ s = Giants.getProperty(ConfigValues.lavaSlimeSize);
+ try {
+ size = Integer.parseInt(s);
+ } catch (Exception e) {
+ size = 12;
+ }
+ while (checkcount <= size) {
+ if (entity.getWorld().getBlockAt(new Location(entity.getWorld(), x2, y2 + checkcount, z2)).getType() != Material.AIR) {
+ spawngiant = 0;
+ }
+ checkcount++;
+ }
+ break;
+ default:
+ break;
+ }
+ //Commment out the following line to enable chance of spawning.
+ //spawngiant = 1;
+ if (spawngiant == 1) {
+ SpawnEvent SE = new SpawnEvent(location, spawn);
+ Bukkit.getServer().getPluginManager().callEvent(SE);
+ event.setCancelled(true);
+ }
+ }
+ }
+ }
+
+ public static void createGiant (Location location, SpawnReason reason) {
+ NMSUtils.createGiant(location, reason);
+ }
+
+ private boolean isEnabled(EntityType spawn) {
+ boolean enabled = false;
+ if (spawn == null) {
+ return false;
+ }
+ switch (spawn) {
+ case GIANT:
+ if (Giants.getProperty(ConfigValues.zombieBoolean).equalsIgnoreCase("true") && GiantZombie == true)
+ enabled = true;
+ break;
+ case SLIME:
+ if (Giants.getProperty(ConfigValues.slimeBoolean).equalsIgnoreCase("true") && GiantSlime == true)
+ enabled = true;
+ break;
+ case MAGMA_CUBE:
+ if (Giants.getProperty(ConfigValues.lavaSlimeBoolean).equalsIgnoreCase("true") && GiantLavaSlime == true)
+
+ enabled = true;
+ break;
+ default:
+ break;
+ }
+ return enabled;
+ }
+
+ public static boolean isGiantZombie(Entity entity) {
+ return entity.getType() == EntityType.GIANT ? true : false;
+ }
+
+ public static boolean isGiantSlime(Entity entity) {
+ if (entity.getType() == EntityType.SLIME) {
+ Slime slime = (Slime) entity;
+ if (slime.getSize() > 4)
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isGiantLavaSlime(Entity entity) {
+ if (entity.getType() == EntityType.MAGMA_CUBE) {
+ Slime slime = (Slime) entity;
+ if (slime.getSize() > 4)
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isGiantJockey(Entity entity) {
+ switch (entity.getType()) {
+ case GIANT:
+ if ((isGiantSlime(entity.getVehicle())) || (isGiantLavaSlime(entity.getVehicle())) || (entity.getVehicle().getType() == EntityType.GHAST)) {
+ return true;
+ }
+ break;
+ case SLIME:
+ if ((isGiantSlime(entity)) && (entity.getPassenger().getType() == EntityType.GIANT)) {
+ return true;
+ }
+ break;
+ case MAGMA_CUBE:
+ if ((isGiantLavaSlime(entity)) && (entity.getPassenger().getType() == EntityType.GIANT)) {
+ return true;
+ }
+ break;
+ case GHAST:
+ if (entity.getPassenger().getType() == EntityType.GIANT) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ public static boolean isGiantJockeyMount(Entity entity) {
+ return (isGiantJockey(entity) && isGiantZombie(entity.getPassenger()));
+ }
+
+ public static boolean isGiantJockeyRider(Entity entity) {
+ return (isGiantJockey(entity) && isGiantZombie(entity));
+ }
+
+ public static List getEntitySpawnReplacements(EntityType type) {
+ List list = new ArrayList();
+ switch (type) {
+ case GIANT:
+ for (EntityType t : zombieReplacements) list.add(t);
+ break;
+ case SLIME:
+ for (EntityType t : slimeReplacements) list.add(t);
+ break;
+ case MAGMA_CUBE:
+ for (EntityType t : lavaSlimeReplacements) list.add(t);
+ break;
+ default:
+ break;
+ }
+
+ return list;
+ }
+
+ public static List getGiantSpawnWorlds(EntityType entityType) {
+ switch (entityType) {
+ case GIANT:
+ return Giants.getPropertyList(ConfigValues.zombieWorlds);
+ case SLIME:
+ return Giants.getPropertyList(ConfigValues.slimeWorlds);
+ case MAGMA_CUBE:
+ return Giants.getPropertyList(ConfigValues.lavaslimeWorlds);
+ default:
+ return null;
+ }
+ }
+
+ public static List getJockeySpawnWorlds() {
+ return Giants.getPropertyList(ConfigValues.jockeyWorlds);
+ }
+
+ public static void callSpawnDebug(Entity entity) {
+ if (entity == null)
+ return;
+ if (Giants.getProperty(ConfigValues.debugBoolean).equalsIgnoreCase("true")) {
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ if (player.hasPermission("giants.debug") || player.hasPermission("giants.*") || player.isOp()) {
+ String x = String.valueOf(Math.round(entity.getLocation().getX()));
+ String y = String.valueOf(Math.round(entity.getLocation().getY()));
+ String z = String.valueOf(Math.round(entity.getLocation().getZ()));
+ switch (entity.getType()) {
+ case GIANT:
+ player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A giant zombie has spawned at X:" + x +", Y:" + y + ", Z:" + z +".");
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A giant zombie has spawned at X:" + x +", Y:" + y + ", Z:" + z +".");
+ break;
+ case SLIME:
+ player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A giant slime has spawned at X:" + x +", Y:" + y + ", Z:" + z +".");
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A giant slime has spawned at X:" + x +", Y:" + y + ", Z:" + z +".");
+ break;
+ case MAGMA_CUBE:
+ player.sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A giant lava slime has spawned at X:" + x +", Y:" + y + ", Z:" + z +".");
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "A giant lava slime has spawned at X:" + x +", Y:" + y + ", Z:" + z +".");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public static boolean isGiant(Entity entity) {
+ if (isGiantZombie(entity))
+ return true;
+ if (isGiantSlime(entity))
+ return true;
+ if (isGiantLavaSlime(entity))
+ return true;
+ return false;
+ }
+
+ private void jockeySpawner() {
+ if (GiantJockey == true) {
+ BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
+ scheduler.scheduleSyncRepeatingTask(_giants, new Runnable() {
+
+ public void run() {
+ for (Entity entity : giantEntities) {
+ if ((entity instanceof Slime) || (entity instanceof MagmaCube) || (entity instanceof Ghast)) {
+ for (Entity entity2 : entity.getNearbyEntities(15, 12, 15)) {
+ if ((entity2 instanceof Giant) && (entity.getPassenger() == null) && (entity2.getVehicle() == null)) {
+ Entity passenger = entity2;
+ JockeySpawnEvent JSE = new JockeySpawnEvent(entity, passenger);
+ Bukkit.getServer().getPluginManager().callEvent(JSE);
+ }
+ }
+ }
+ }
+ }
+ }, 0L, 20L);
+ }
+ }
+
+ private boolean isASpawnReplacement(EntityType entityType) {
+ for (EntityType e : zombieReplacements)
+ if (e == entityType) return true;
+ for (EntityType e : slimeReplacements)
+ if (e == entityType) return true;
+ for (EntityType e : lavaSlimeReplacements)
+ if (e == entityType) return true;
+ return false;
+ }
+
+ private boolean isASpawnReplacementFor(EntityType replacement, EntityType entityType) {
+ if (entityType == null) return false;
+ switch(entityType) {
+ case GIANT:
+ for (EntityType e : zombieReplacements)
+ if (e == replacement) return true;
+ case SLIME:
+ for (EntityType e : slimeReplacements)
+ if (e == replacement) return true;
+ case MAGMA_CUBE:
+ for (EntityType e : lavaSlimeReplacements)
+ if (e == replacement) return true;
+
+ default:
+ break;
+ }
+ return false;
+ }
+}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/entity/GiantListeners.java b/plugin/src/main/java/me/Mammothskier/Giants/entity/GiantListeners.java
new file mode 100644
index 0000000..9e9c869
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/entity/GiantListeners.java
@@ -0,0 +1,306 @@
+package me.Mammothskier.Giants.entity;
+
+import java.util.Random;
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
+
+import org.bukkit.Location;
+import org.bukkit.Sound;
+import org.bukkit.entity.Damageable;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Fireball;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Zombie;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDeathEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.util.Vector;
+
+public class GiantListeners implements Listener {
+ private Giants _giants;
+
+ public GiantListeners(Giants giants) {
+ _giants = giants;
+ _giants.getServer().getPluginManager().registerEvents(this, giants);
+ }
+
+ @EventHandler
+ public void onFireAttack(EntityTargetEvent event) {
+ String ticks1 = Giants.getProperty(ConfigValues.fireAttackTargetTicks);
+ String ticks2 = Giants.getProperty(ConfigValues.fireAttackGiantTicks);
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int ticksTarget;
+ int ticksGiant;
+ try {
+ ticksTarget = Integer.parseInt(ticks1);
+ ticksGiant = Integer.parseInt(ticks2);
+ } catch (Exception e) {
+ ticksTarget = 0;
+ ticksGiant = 0;
+ }
+
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantZombie(entity)) {
+ if(!(target == null)){
+ if (Giants.getPropertyList(ConfigValues.fireAttack).contains("Giant Zombie")) {
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ target.getLocation().getWorld().playSound(target.getLocation(), Sound.BLOCK_FIRE_AMBIENT , 1, 0);
+ }
+ try {
+ event.getTarget().setFireTicks(ticksTarget);
+ event.getEntity().setFireTicks(ticksGiant);
+ } catch (Exception e) {
+ }
+ } else {
+ event.setTarget(target);
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onLightningAttack(EntityTargetEvent event) {
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantZombie(entity)) {
+ if (Giants.getPropertyList(ConfigValues.lightningAttack).contains("Giant Zombie")) {
+ try {
+ target.getLocation().getWorld().strikeLightning(target.getLocation());
+ } catch (Exception e) {
+ }
+ } else {
+ event.setTarget(target);
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onShrapnelAttack(EntityTargetEvent event) {
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int Amt;
+ double Health;
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantZombie(entity)) {
+ Location spawnLocation = entity.getLocation();
+ Location loc = spawnLocation;
+ if (Giants.getPropertyList(ConfigValues.shrapnelAttack).contains("Giant Zombie")) {
+ String config = Giants.getProperty(ConfigValues.shrapnelAttackZombies);
+ String config2 = Giants.getProperty(ConfigValues.shrapnelAttackHealth);
+ try {
+ Amt = Integer.parseInt(config);
+ Health = Double.parseDouble(config2);
+ } catch (Exception e) {
+ Amt = 3;
+ Health = 20;
+ }
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")){
+ if (target instanceof LivingEntity){
+ target.getLocation().getWorld().playSound(target.getLocation(), Sound.ENTITY_GENERIC_EXPLODE , 1, 0);
+ }
+ }
+ for (int i = 1; i <= Amt; i++){
+ if (Giants.getProperty(ConfigValues.shrapnelAttackBabies).equalsIgnoreCase("true")) {
+ Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
+ ((Zombie) e).setBaby(true);
+ ((Damageable) e).setMaxHealth(Health);
+ ((Damageable) e).setHealth(Health);
+ }
+ else{
+ Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
+ ((Damageable) e).setMaxHealth(Health);
+ ((Damageable) e).setHealth(Health);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onThrownBoulderAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ boolean inRange = false;
+ Random pick = new Random();
+ int chance = 0;
+ int bDamage;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+
+ for (Entity entity : player.getNearbyEntities(15, 12, 15)) {
+ if (Entities.isGiantZombie(entity)) {
+ if (entity.getNearbyEntities(15, 12, 15).contains(player) && !entity.getNearbyEntities(5, 3, 5).contains(player)) {
+ inRange = true;
+ }
+ if (inRange == true) {
+ if (chance == 50) {
+ if (Giants.getPropertyList(ConfigValues.boulderAttack).contains("Giant Zombie")) {
+ String config = Giants.getProperty(ConfigValues.bouldAttackBlockDamage);
+ try {
+ bDamage = Integer.parseInt(config);
+ } catch (Exception e) {
+ bDamage = 1;
+ }
+ Vector direction = ((LivingEntity) entity).getEyeLocation().getDirection().multiply(2);
+ Fireball fireball = entity.getWorld().spawn(((LivingEntity) entity).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
+ fireball.setShooter((LivingEntity) entity);
+ fireball.setYield(bDamage);
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onKickAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.kickAttack).contains("Giant Zombie")) {
+ String config = Giants.getProperty(ConfigValues.kickAttackHeight);
+ double height;
+
+ try {
+ height = Double.parseDouble(config);
+ } catch (Exception e) {
+ height = 1;
+ }
+
+ Random pick = new Random();
+ int chance = 0;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
+ if (Entities.isGiantZombie(entity)) {
+ if (entity.getNearbyEntities(5, 5, 5).contains(player)) {
+ player.setVelocity(new Vector(0, height, 0));
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_LAVA_POP, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onStompAttack(PlayerMoveEvent event) {
+ boolean sound = false;
+ boolean fire = false;
+ float power = 1.0f;
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.stompAttack).contains("Giant Zombie")) {
+ Random pick = new Random();
+ int chance = 0;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
+ if (Entities.isGiantZombie(entity)) {
+ if (entity.getNearbyEntities(3, 2, 3).contains(player)) {
+ String config = Giants.getProperty(ConfigValues.stompAttackPower);
+ if (Giants.getProperty(ConfigValues.stompAttackFire).equalsIgnoreCase("true")) {
+ fire = true;
+ }
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ sound = true;
+ }
+
+ try {
+ power = Float.parseFloat(config);
+ } catch (Exception e) {
+ power = 0.0f;
+ }
+ Location location = player.getLocation();
+ location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), power, fire);
+ if (sound == true){
+ location.getWorld().playSound(location, Sound.ENTITY_FIREWORK_LARGE_BLAST, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void zombiesOnDeath(EntityDeathEvent event) {
+ Entity entity = event.getEntity();
+ if (Entities.isGiantZombie(entity)) {
+ if(Giants.getProperty(ConfigValues.zombiesOnDeath).equalsIgnoreCase("true")){
+ Location spawnLocation = entity.getLocation();
+ Location loc = spawnLocation;
+ String config = Giants.getProperty(ConfigValues.zombiesOnDeathZombies);
+ String config2 = Giants.getProperty(ConfigValues.zombiesOnDeathHealth);
+ int zombAmt;
+ double zombHealth;
+
+ try {
+ zombAmt = Integer.parseInt(config);
+ zombHealth = Double.parseDouble(config2);
+ }catch (Exception e) {
+ zombAmt = 1;
+ zombHealth = 20;
+ }
+ for (int i = 1; i <= zombAmt; i++){
+ if (Giants.getProperty(ConfigValues.zombiesOnDeathBabies).equalsIgnoreCase("true")) {
+ Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
+ ((Zombie) e).setBaby(true);
+ ((Damageable) e).setMaxHealth(zombHealth);
+ ((Damageable) e).setHealth(zombHealth);
+ }
+ else{
+ Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
+ ((Damageable) e).setMaxHealth(zombHealth);
+ ((Damageable) e).setHealth(zombHealth);
+ }
+ }
+
+ }
+ }
+ }
+
+ @EventHandler
+ public void poisonAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.poisonAttack).contains("Giant Zombie")){
+ Random pick = new Random();
+ int chance = 0;
+ double length;
+ String config = Giants.getProperty(ConfigValues.poisonAttackLength);
+ try {
+ length = Double.parseDouble(config);
+ } catch (Exception e) {
+ length = 5;
+ }
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
+ if (Entities.isGiantZombie(entity)) {
+ player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, (int) (length*20), 3));
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/entity/MagmaCubeListeners.java b/plugin/src/main/java/me/Mammothskier/Giants/entity/MagmaCubeListeners.java
new file mode 100644
index 0000000..efae7f0
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/entity/MagmaCubeListeners.java
@@ -0,0 +1,273 @@
+package me.Mammothskier.Giants.entity;
+
+import java.util.Random;
+
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Fireball;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.MagmaCube;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.util.Vector;
+
+public class MagmaCubeListeners implements Listener {
+ private Giants _magmacubes;
+
+ public MagmaCubeListeners(Giants magmacubes) {
+ _magmacubes = magmacubes;
+ _magmacubes.getServer().getPluginManager().registerEvents(this, magmacubes);
+ }
+
+ @EventHandler
+ public void onFireAttack(EntityTargetEvent event) {
+ String ticks1 = Giants.getProperty(ConfigValues.fireAttackTargetTicks);
+ String ticks2 = Giants.getProperty(ConfigValues.fireAttackGiantTicks);
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int ticksTarget;
+ int ticksGiant;
+ int s;
+ try {
+ ticksTarget = Integer.parseInt(ticks1);
+ ticksGiant = Integer.parseInt(ticks2);
+ } catch (Exception e) {
+ ticksTarget = 0;
+ ticksGiant = 0;
+ }
+
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantLavaSlime(entity)) {
+ if(!(target == null)){
+ if (Giants.getPropertyList(ConfigValues.fireAttack).contains("Giant Lava Slime")) {
+ MagmaCube magmacube = (MagmaCube) event.getEntity();
+ s = magmacube.getSize();
+ if (s > 4){
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ target.getLocation().getWorld().playSound(target.getLocation(), Sound.BLOCK_FIRE_AMBIENT, 1, 0);
+ }
+ try {
+ event.getTarget().setFireTicks(ticksTarget);
+ event.getEntity().setFireTicks(ticksGiant);
+ } catch (Exception e) {
+ }
+ } else {
+ event.setTarget(target);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onLightningAttack(EntityTargetEvent event) {
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int s;
+
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantLavaSlime(entity)) {
+ MagmaCube magmacube = (MagmaCube) event.getEntity();
+ s = magmacube.getSize();
+ if (s > 4){
+ if (Giants.getProperty(ConfigValues.lightningAttack).contains("Giant Lava Slime")) {
+ try {
+ target.getLocation().getWorld().strikeLightning(target.getLocation());
+ } catch (Exception e) {
+ }
+ } else {
+ event.setTarget(target);
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void LavaAttack(EntityTargetEvent event){
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int s;
+
+ if((Entities.isGiantLavaSlime(entity)) && (target instanceof Player)){
+ MagmaCube magmacube = (MagmaCube) event.getEntity();
+ s = magmacube.getSize();
+ if (s > 4){
+ if (Giants.getPropertyList(ConfigValues.lavaAttack).contains("Giant Lava Slime")) {
+ target.getLocation().getBlock().setType(Material.LAVA);
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ target.getLocation().getWorld().playSound(target.getLocation(), Sound.ENTITY_GENERIC_EXPLODE , 1, 0);
+ target.getLocation().getWorld().playSound(target.getLocation(), Sound.BLOCK_LAVA_POP, 1, 0);
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onStompAttack(PlayerMoveEvent event) {
+ boolean sound = false;
+ boolean fire = false;
+ float power = 1.0f;
+ Player player = event.getPlayer();
+ if (Giants.getProperty(ConfigValues.stompAttack).equalsIgnoreCase("true")) {
+ Random pick = new Random();
+ int chance = 0;
+ int s;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
+ if (Entities.isGiantLavaSlime(entity)) {
+ MagmaCube magmacube = (MagmaCube) entity;
+ s = magmacube.getSize();
+ if (s > 4){
+ if (entity.getNearbyEntities(3, 2, 3).contains(player)) {
+ String config = Giants.getProperty(ConfigValues.stompAttackPower);
+ if (Giants.getProperty(ConfigValues.stompAttackFire).equalsIgnoreCase("true")) {
+ fire = true;
+ }
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ sound = true;
+ }
+
+ try {
+ power = Float.parseFloat(config);
+ } catch (Exception e) {
+ power = 0.0f;
+ }
+
+ Location location = player.getLocation();
+ location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), power, fire);
+ if (sound == true){
+ location.getWorld().playSound(location, Sound.ENTITY_FIREWORK_LARGE_BLAST, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void ThrownBoulderAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ boolean inRange = false;
+ Random pick = new Random();
+ int chance = 0;
+ int bDamage;
+ int s;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+
+ for (Entity entity : player.getNearbyEntities(15, 12, 15)) {
+ if (Entities.isGiantLavaSlime(entity)) {
+ MagmaCube magmacube = (MagmaCube) entity;
+ s = magmacube.getSize();
+ if (s > 4){
+ if (entity.getNearbyEntities(15, 12, 15).contains(player) && !entity.getNearbyEntities(5, 3, 5).contains(player)) {
+ inRange = true;
+ }
+ if (inRange == true) {
+ if (chance == 50) {
+ if (Giants.getPropertyList(ConfigValues.boulderAttack).contains("Giant Lava Slime")) {
+ String config = Giants.getProperty(ConfigValues.bouldAttackBlockDamage);
+ try {
+ bDamage = Integer.parseInt(config);
+ } catch (Exception e) {
+ bDamage = 1;
+ }
+
+ Vector direction = ((LivingEntity) entity).getEyeLocation().getDirection().multiply(2);
+ Fireball fireball = entity.getWorld().spawn(((LivingEntity) entity).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
+ fireball.setShooter((LivingEntity) entity);
+ fireball.setYield(bDamage);
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onKickAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.kickAttack).contains("Giant Lava Slime")) {
+ int s;
+ String config = Giants.getProperty(ConfigValues.kickAttackHeight);
+ double height;
+
+ try {
+ height = Double.parseDouble(config);
+ } catch (Exception e) {
+ height = 1;
+ }
+
+ Random pick = new Random();
+ int chance = 0;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
+ if (Entities.isGiantLavaSlime(entity)) {
+ MagmaCube magmacube = (MagmaCube) entity;
+ s = magmacube.getSize();
+ if (s > 4){
+ if (entity.getNearbyEntities(5, 5, 5).contains(player)) {
+ player.setVelocity(new Vector(0, height, 0));
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_LAVA_POP, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void poisonAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.poisonAttack).contains("Giant Lava Slime")){
+ Random pick = new Random();
+ int chance = 0;
+ double length;
+ String config = Giants.getProperty(ConfigValues.poisonAttackLength);
+ try {
+ length = Double.parseDouble(config);
+ } catch (Exception e) {
+ length = 5;
+ }
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
+ if (Entities.isGiantLavaSlime(entity)) {
+ player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, (int) (length*20), 3));
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/entity/SlimeListeners.java b/plugin/src/main/java/me/Mammothskier/Giants/entity/SlimeListeners.java
new file mode 100644
index 0000000..51247bb
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/entity/SlimeListeners.java
@@ -0,0 +1,249 @@
+package me.Mammothskier.Giants.entity;
+
+import java.util.Random;
+
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
+
+import org.bukkit.Location;
+import org.bukkit.Sound;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Fireball;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Slime;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.util.Vector;
+
+public class SlimeListeners implements Listener {
+ private Giants _slimes;
+
+ public SlimeListeners(Giants slimes) {
+ _slimes = slimes;
+ _slimes.getServer().getPluginManager().registerEvents(this, slimes);
+ }
+
+ @EventHandler
+ public void onLightningAttack(EntityTargetEvent event) {
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int s;
+
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantSlime(entity)) {
+ Slime slime = (Slime) event.getEntity();
+ s = slime.getSize();
+ if (s > 4){
+ if (Giants.getPropertyList(ConfigValues.lightningAttack).contains("Giant Slime")) {
+ try {
+ target.getLocation().getWorld().strikeLightning(target.getLocation());
+ } catch (Exception e) {
+ }
+ } else {
+ event.setTarget(target);
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onFireAttack(EntityTargetEvent event) {
+ String ticks1 = Giants.getProperty(ConfigValues.fireAttackTargetTicks);
+ String ticks2 = Giants.getProperty(ConfigValues.fireAttackGiantTicks);
+ Entity entity = event.getEntity();
+ Entity target = event.getTarget();
+ int ticksTarget;
+ int ticksGiant;
+ int s;
+ try {
+ ticksTarget = Integer.parseInt(ticks1);
+ ticksGiant = Integer.parseInt(ticks2);
+ } catch (Exception e) {
+ ticksTarget = 0;
+ ticksGiant = 0;
+ }
+
+ if ((entity instanceof LivingEntity)) {
+ if (Entities.isGiantSlime(entity)) {
+ Slime slime = (Slime) event.getEntity();
+ s = slime.getSize();
+ if (s > 4){
+ if(!(target == null)){
+ if (Giants.getPropertyList(ConfigValues.fireAttack).contains("Giant Slime")) {
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ target.getLocation().getWorld().playSound(target.getLocation(), Sound.BLOCK_FIRE_AMBIENT, 1, 0);
+ }
+ try {
+ event.getTarget().setFireTicks(ticksTarget);
+ event.getEntity().setFireTicks(ticksGiant);
+ } catch (Exception e) {
+ }
+ } else {
+ event.setTarget(target);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void ThrownBoulderAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ boolean inRange = false;
+ Random pick = new Random();
+ int chance = 0;
+ int bDamage;
+ int s;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+
+ for (Entity entity : player.getNearbyEntities(15, 12, 15)) {
+ if (Entities.isGiantSlime(entity)) {
+ Slime slime = (Slime) entity;
+ s = slime.getSize();
+ if (s > 4){
+ if (entity.getNearbyEntities(15, 12, 15).contains(player) && !entity.getNearbyEntities(5, 3, 5).contains(player)) {
+ inRange = true;
+ }
+ if (inRange == true) {
+ if (chance == 50) {
+ if (Giants.getPropertyList(ConfigValues.boulderAttack).contains("Giant Slime")) {
+ String config = Giants.getProperty(ConfigValues.bouldAttackBlockDamage);
+ try {
+ bDamage = Integer.parseInt(config);
+ } catch (Exception e) {
+ bDamage = 1;
+ }
+ Vector direction = ((LivingEntity) entity).getEyeLocation().getDirection().multiply(2);
+ Fireball fireball = entity.getWorld().spawn(((LivingEntity) entity).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
+ fireball.setShooter((LivingEntity) entity);
+ fireball.setYield(bDamage);
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onKickAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.kickAttack).contains("Giant Slime")) {
+ String config = Giants.getProperty(ConfigValues.kickAttackHeight);
+ double height;
+ int s;
+
+ try {
+ height = Double.parseDouble(config);
+ } catch (Exception e) {
+ height = 1;
+ }
+
+ Random pick = new Random();
+ int chance = 0;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
+ if (Entities.isGiantSlime(entity)) {
+ Slime slime = (Slime) entity;
+ s = slime.getSize();
+ if (s > 4){
+ if (entity.getNearbyEntities(5, 5, 5).contains(player)) {
+ player.setVelocity(new Vector(0, height, 0));
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_LAVA_POP, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onStompAttack(PlayerMoveEvent event) {
+ boolean sound = false;
+ boolean fire = false;
+ float power = 1.0f;
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.stompAttack).contains("Giant Slime")) {
+ Random pick = new Random();
+ int chance = 0;
+ int s;
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
+ if (Entities.isGiantSlime(entity)) {
+ Slime slime = (Slime) entity;
+ s = slime.getSize();
+ if (s > 4){
+ if (entity.getNearbyEntities(3, 2, 3).contains(player)) {
+ String config = Giants.getProperty(ConfigValues.stompAttackPower);
+ if (Giants.getProperty(ConfigValues.stompAttackFire).equalsIgnoreCase("true")) {
+ fire = true;
+ }
+ if (Giants.getProperty(ConfigValues.soundsBoolean).equalsIgnoreCase("true")) {
+ sound = true;
+ }
+
+ try {
+ power = Float.parseFloat(config);
+ } catch (Exception e) {
+ power = 0.0f;
+ }
+ Location location = player.getLocation();
+ location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), power, fire);
+ if (sound == true){
+ location.getWorld().playSound(location, Sound.ENTITY_FIREWORK_LARGE_BLAST, 1, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void poisonAttack(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ if (Giants.getPropertyList(ConfigValues.poisonAttack).contains("Giant Slime")){
+ Random pick = new Random();
+ int chance = 0;
+ double length;
+ String config = Giants.getProperty(ConfigValues.poisonAttackLength);
+ try {
+ length = Double.parseDouble(config);
+ } catch (Exception e) {
+ length = 5;
+ }
+ for (int counter = 1; counter <= 1; counter++) {
+ chance = 1 + pick.nextInt(100);
+ }
+ if (chance == 50) {
+ for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
+ if (Entities.isGiantSlime(entity)) {
+ player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, (int) (length*20), 3));
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/events/JockeySpawnEvent.java b/plugin/src/main/java/me/Mammothskier/Giants/events/JockeySpawnEvent.java
new file mode 100644
index 0000000..d8e24d9
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/events/JockeySpawnEvent.java
@@ -0,0 +1,115 @@
+package me.Mammothskier.Giants.events;
+
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.ConfigValues;
+
+import org.bukkit.Location;
+import org.bukkit.block.Biome;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class JockeySpawnEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel = false;
+
+ public JockeySpawnEvent (Entity entity, Entity passenger) {
+ Location location = entity.getLocation();
+
+ Biome biome = location.getWorld().getBiome(location.getBlockX(), location.getBlockZ());
+
+ if (!isCancelled()) {
+ if (biome.toString().toLowerCase().contains("Swampland".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeSwampland).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Forest".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeForest).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Taiga".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeTaiga).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Plains".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomePlains).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Extreme_Hills".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeExtremeHills).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Mushroom".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeMushroomIsland).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Desert".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeDesert).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Jungle".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeJungle).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Birch".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeBirchForest).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Savanna".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeSavanna).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Roofed_Forest".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeRoofedForest).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Mesa".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeMesa).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Small_Mountains".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeSmallMountains).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Ice_Mountains".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeIceMountains).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Ocean".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeOcean).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("River".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeRiver).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Hell".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeHell).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ if (biome.toString().toLowerCase().contains("Sky".toLowerCase()) &&
+ Giants.getProperty(ConfigValues.jockeyBiomeSky).equalsIgnoreCase("true")) {
+ entity.setPassenger(passenger);
+ }
+ }
+ }
+
+
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/events/SpawnEvent.java b/plugin/src/main/java/me/Mammothskier/Giants/events/SpawnEvent.java
new file mode 100644
index 0000000..b4c0b52
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/events/SpawnEvent.java
@@ -0,0 +1,237 @@
+package me.Mammothskier.Giants.events;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.Giants;
+import me.Mammothskier.Giants.Files.Files;
+import me.Mammothskier.Giants.entity.Entities;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Biome;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Damageable;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Slime;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.inventory.EntityEquipment;
+import org.bukkit.inventory.ItemStack;
+
+public class SpawnEvent extends Event{
+ private static boolean cancelled = false;
+ private Entity entity;
+ private Location location;
+ private static final HandlerList handlers = new HandlerList();
+
+public SpawnEvent(Location loc, EntityType entityType) {
+ location = loc;
+ Biome biome = loc.getWorld().getBiome(loc.getBlockX(), loc.getBlockZ());
+ double health = 100;
+ int size = 0;
+
+ if (entityType.equals(EntityType.SLIME) || entityType.equals(EntityType.MAGMA_CUBE)) {
+ String s = entityType.equals(EntityType.SLIME) ? Giants.getProperty(ConfigValues.slimeSize) : Giants.getProperty(ConfigValues.lavaSlimeSize);
+
+ try {
+ size = Integer.parseInt(s);
+ } catch (Exception e) {
+ size = 12;
+ }
+ }
+
+ if (entityType == EntityType.GIANT && !Entities.GiantZombie)
+ setCancelled(true);
+ if (entityType == EntityType.SLIME && !Entities.GiantSlime) {
+ setCancelled(true);
+ }
+ if (entityType == EntityType.MAGMA_CUBE && !Entities.GiantLavaSlime) {
+ setCancelled(true);
+ }
+
+ if ((!isCancelled()) && (Entities.getGiantSpawnWorlds(entityType).contains(loc.getWorld().getName()))) {
+ Entity entity = null;
+
+ if (biome.toString().toLowerCase().contains("Swampland".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Swampland");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Forest".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Forest");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Taiga".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Taiga");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Plains".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Plains");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Extreme_Hills".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Extreme Hills");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Mushroom".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Mushroom Island");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Desert".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Desert");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Jungle".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Jungle");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Birch".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Birch Forest");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Savanna".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Savanna");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Roofed_Forest".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Roofed Forest");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Mesa".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Mesa");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Small_Mountains".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Small Mountains");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Ice_Mountains".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Ice Mountains");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Ocean".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Ocean");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("River".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Other.River");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Hell".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Hell");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+ if (biome.toString().toLowerCase().contains("Sky".toLowerCase())) {
+ List l = Giants.getPropertyList(Files.BIOMES, "Giants Configuration.Biome Settings.Other.Sky");
+ entity = spawnMob(entityType, l, loc, size);
+ }
+
+ Entities.callSpawnDebug(entity);
+
+ if (entity != null) {
+ ((Damageable) entity).setMaxHealth(health);
+ ((Damageable) entity).setHealth(health);
+ if (entity.getType() == EntityType.GIANT) {
+ EntityEquipment entityArmour = ((LivingEntity) entity).getEquipment();
+
+ float dropChance = 0;
+ entityArmour.setHelmet(parseArmour(ConfigValues.zombieHelmet, dropChance));
+ entityArmour.setHelmetDropChance(dropChance);
+ entityArmour.setChestplate(parseArmour(ConfigValues.zombieChestPlate, dropChance));
+ entityArmour.setChestplateDropChance(dropChance);
+ entityArmour.setLeggings(parseArmour(ConfigValues.zombieLeggings, dropChance));
+ entityArmour.setLeggingsDropChance(dropChance);
+ entityArmour.setBoots(parseArmour(ConfigValues.zombieBoots, dropChance));
+ entityArmour.setBootsDropChance(dropChance);
+ entityArmour.setItemInMainHand(parseArmour(ConfigValues.zombieMainHand, dropChance));
+ entityArmour.setItemInMainHandDropChance(dropChance);
+ }
+ }
+ }
+ }
+
+ public static ItemStack parseArmour(ConfigValues value, float dropRate) {
+ String string = Giants.getProperty(value);
+ String[] split = string.split(" ");
+ ItemStack itemStack = null;
+ for (String each : split) {
+ if (each.contains("item:")) {
+ Material material = Material.getMaterial(each.split(":")[1].toUpperCase());
+ itemStack = new ItemStack(material);
+ continue;
+ } else if (each.contains("name:") && itemStack != null) {
+ itemStack.getItemMeta().setDisplayName(each.split(":")[1]);
+ continue;
+ } else if (each.contains("dropRate:")) {
+ dropRate = Float.parseFloat(each.split(":")[1]);
+ }
+ String[] enchant = each.split(":");
+ itemStack.addEnchantment(Enchantment.getByName(enchant[0].toUpperCase()), Integer.parseInt(enchant[1]));
+ }
+ return itemStack;
+ }
+
+ private Entity spawnMob(EntityType entityType, List l, Location loc, int size) {
+ if ((entityType.equals(EntityType.GIANT) && l.contains("Giant Zombie")) ||
+ (entityType.equals(EntityType.SLIME) && l.contains("Giant Slime")) ||
+ (entityType.equals(EntityType.MAGMA_CUBE) && l.contains("Giant Lava Slime"))) {
+ if (entityType.equals(EntityType.GIANT)) {
+ Entities.createGiant(loc, SpawnReason.NATURAL);
+
+ entity = getGiantZombie(getNearbyEntities(loc, 10), loc);
+
+ } else {
+ entity = (Slime) loc.getWorld().spawnEntity(location, entityType);
+ ((Slime) entity).setSize(size);
+ }
+ }
+ return entity;
+ }
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+ public static boolean isCancelled() {
+ return cancelled;
+ }
+
+ public Entity getEntity() {
+ return entity;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public static List getNearbyEntities(Location loc, int size) {
+ List entities = new ArrayList();
+
+ for (Entity e : loc.getWorld().getEntities())
+ if (loc.distance(e.getLocation()) <= size)
+ entities.add(e);
+ return entities;
+ }
+
+ public static Entity getGiantZombie(List entities, Location loc) {
+ Entity e2 = null;
+ for (Entity e : getNearbyEntities(loc, 5)) {
+ if (Entities.isGiantZombie(e)) {
+ e2 = e;
+ break;
+ }
+ }
+ return e2;
+ }
+}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/util/Metrics.java b/plugin/src/main/java/me/Mammothskier/Giants/util/Metrics.java
new file mode 100644
index 0000000..6c1b552
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/util/Metrics.java
@@ -0,0 +1,759 @@
+/*
+ * Copyright 2011-2013 Tyler Blair. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and contributors and should not be interpreted as representing official policies,
+ * either expressed or implied, of anybody else.
+ */
+package me.Mammothskier.Giants.util;
+
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.InvalidConfigurationException;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.scheduler.BukkitTask;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.Proxy;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.zip.GZIPOutputStream;
+
+public class Metrics {
+
+ /**
+ * The current revision number
+ */
+ private final static int REVISION = 7;
+
+ /**
+ * The base url of the metrics domain
+ */
+ private static final String BASE_URL = "http://report.mcstats.org";
+
+ /**
+ * The url used to report a server's status
+ */
+ private static final String REPORT_URL = "/plugin/%s";
+
+ /**
+ * Interval of time to ping (in minutes)
+ */
+ private static final int PING_INTERVAL = 15;
+
+ /**
+ * The plugin this metrics submits for
+ */
+ private final Plugin plugin;
+
+ /**
+ * All of the custom graphs to submit to metrics
+ */
+ private final Set graphs = Collections.synchronizedSet(new HashSet());
+
+ /**
+ * The plugin configuration file
+ */
+ private final YamlConfiguration configuration;
+
+ /**
+ * The plugin configuration file
+ */
+ private final File configurationFile;
+
+ /**
+ * Unique server id
+ */
+ private final String guid;
+
+ /**
+ * Debug mode
+ */
+ private final boolean debug;
+
+ /**
+ * Lock for synchronization
+ */
+ private final Object optOutLock = new Object();
+
+ /**
+ * The scheduled task
+ */
+ private volatile BukkitTask task = null;
+
+ public Metrics(final Plugin plugin) throws IOException {
+ if (plugin == null) {
+ throw new IllegalArgumentException("Plugin cannot be null");
+ }
+
+ this.plugin = plugin;
+
+ // load the config
+ configurationFile = getConfigFile();
+ configuration = YamlConfiguration.loadConfiguration(configurationFile);
+
+ // add some defaults
+ configuration.addDefault("opt-out", false);
+ configuration.addDefault("guid", UUID.randomUUID().toString());
+ configuration.addDefault("debug", false);
+
+ // Do we need to create the file?
+ if (configuration.get("guid", null) == null) {
+ configuration.options().header("http://mcstats.org").copyDefaults(true);
+ configuration.save(configurationFile);
+ }
+
+ // Load the guid then
+ guid = configuration.getString("guid");
+ debug = configuration.getBoolean("debug", false);
+ }
+
+ /**
+ * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics
+ * website. Plotters can be added to the graph object returned.
+ *
+ * @param name The name of the graph
+ * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
+ */
+ public Graph createGraph(final String name) {
+ if (name == null) {
+ throw new IllegalArgumentException("Graph name cannot be null");
+ }
+
+ // Construct the graph object
+ final Graph graph = new Graph(name);
+
+ // Now we can add our graph
+ graphs.add(graph);
+
+ // and return back
+ return graph;
+ }
+
+ /**
+ * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
+ *
+ * @param graph The name of the graph
+ */
+ public void addGraph(final Graph graph) {
+ if (graph == null) {
+ throw new IllegalArgumentException("Graph cannot be null");
+ }
+
+ graphs.add(graph);
+ }
+
+ /**
+ * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
+ * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
+ * ticks.
+ *
+ * @return True if statistics measuring is running, otherwise false.
+ */
+ public boolean start() {
+ synchronized (optOutLock) {
+ // Did we opt out?
+ if (isOptOut()) {
+ return false;
+ }
+
+ // Is metrics already running?
+ if (task != null) {
+ return true;
+ }
+
+ // Begin hitting the server with glorious data
+ task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
+
+ private boolean firstPost = true;
+
+ public void run() {
+ try {
+ // This has to be synchronized or it can collide with the disable method.
+ synchronized (optOutLock) {
+ // Disable Task, if it is running and the server owner decided to opt-out
+ if (isOptOut() && task != null) {
+ task.cancel();
+ task = null;
+ // Tell all plotters to stop gathering information.
+ for (Graph graph : graphs) {
+ graph.onOptOut();
+ }
+ }
+ }
+
+ // We use the inverse of firstPost because if it is the first time we are posting,
+ // it is not a interval ping, so it evaluates to FALSE
+ // Each time thereafter it will evaluate to TRUE, i.e PING!
+ postPlugin(!firstPost);
+
+ // After the first post we set firstPost to false
+ // Each post thereafter will be a ping
+ firstPost = false;
+ } catch (IOException e) {
+ if (debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
+ }
+ }
+ }
+ }, 0, PING_INTERVAL * 1200);
+
+ return true;
+ }
+ }
+
+ /**
+ * Has the server owner denied plugin metrics?
+ *
+ * @return true if metrics should be opted out of it
+ */
+ public boolean isOptOut() {
+ synchronized (optOutLock) {
+ try {
+ // Reload the metrics file
+ configuration.load(getConfigFile());
+ } catch (IOException ex) {
+ if (debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
+ }
+ return true;
+ } catch (InvalidConfigurationException ex) {
+ if (debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
+ }
+ return true;
+ }
+ return configuration.getBoolean("opt-out", false);
+ }
+ }
+
+ /**
+ * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
+ *
+ * @throws java.io.IOException
+ */
+ public void enable() throws IOException {
+ // This has to be synchronized or it can collide with the check in the task.
+ synchronized (optOutLock) {
+ // Check if the server owner has already set opt-out, if not, set it.
+ if (isOptOut()) {
+ configuration.set("opt-out", false);
+ configuration.save(configurationFile);
+ }
+
+ // Enable Task, if it is not running
+ if (task == null) {
+ start();
+ }
+ }
+ }
+
+ /**
+ * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
+ *
+ * @throws java.io.IOException
+ */
+ public void disable() throws IOException {
+ // This has to be synchronized or it can collide with the check in the task.
+ synchronized (optOutLock) {
+ // Check if the server owner has already set opt-out, if not, set it.
+ if (!isOptOut()) {
+ configuration.set("opt-out", true);
+ configuration.save(configurationFile);
+ }
+
+ // Disable Task, if it is running
+ if (task != null) {
+ task.cancel();
+ task = null;
+ }
+ }
+ }
+
+ /**
+ * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
+ *
+ * @return the File object for the config file
+ */
+ public File getConfigFile() {
+ // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
+ // is to abuse the plugin object we already have
+ // plugin.getDataFolder() => base/plugins/PluginA/
+ // pluginsFolder => base/plugins/
+ // The base is not necessarily relative to the startup directory.
+ File pluginsFolder = plugin.getDataFolder().getParentFile();
+
+ // return => base/plugins/PluginMetrics/config.yml
+ return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
+ }
+
+ /**
+ * Generic method that posts a plugin to the metrics website
+ */
+ private void postPlugin(final boolean isPing) throws IOException {
+ // Server software specific section
+ PluginDescriptionFile description = plugin.getDescription();
+ String pluginName = description.getName();
+ boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
+ String pluginVersion = description.getVersion();
+ String serverVersion = Bukkit.getVersion();
+ int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
+
+ // END server software specific section -- all code below does not use any code outside of this class / Java
+
+ // Construct the post data
+ StringBuilder json = new StringBuilder(1024);
+ json.append('{');
+
+ // The plugin's description file containg all of the plugin data such as name, version, author, etc
+ appendJSONPair(json, "guid", guid);
+ appendJSONPair(json, "plugin_version", pluginVersion);
+ appendJSONPair(json, "server_version", serverVersion);
+ appendJSONPair(json, "players_online", Integer.toString(playersOnline));
+
+ // New data as of R6
+ String osname = System.getProperty("os.name");
+ String osarch = System.getProperty("os.arch");
+ String osversion = System.getProperty("os.version");
+ String java_version = System.getProperty("java.version");
+ int coreCount = Runtime.getRuntime().availableProcessors();
+
+ // normalize os arch .. amd64 -> x86_64
+ if (osarch.equals("amd64")) {
+ osarch = "x86_64";
+ }
+
+ appendJSONPair(json, "osname", osname);
+ appendJSONPair(json, "osarch", osarch);
+ appendJSONPair(json, "osversion", osversion);
+ appendJSONPair(json, "cores", Integer.toString(coreCount));
+ appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
+ appendJSONPair(json, "java_version", java_version);
+
+ // If we're pinging, append it
+ if (isPing) {
+ appendJSONPair(json, "ping", "1");
+ }
+
+ if (graphs.size() > 0) {
+ synchronized (graphs) {
+ json.append(',');
+ json.append('"');
+ json.append("graphs");
+ json.append('"');
+ json.append(':');
+ json.append('{');
+
+ boolean firstGraph = true;
+
+ final Iterator iter = graphs.iterator();
+
+ while (iter.hasNext()) {
+ Graph graph = iter.next();
+
+ StringBuilder graphJson = new StringBuilder();
+ graphJson.append('{');
+
+ for (Plotter plotter : graph.getPlotters()) {
+ appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
+ }
+
+ graphJson.append('}');
+
+ if (!firstGraph) {
+ json.append(',');
+ }
+
+ json.append(escapeJSON(graph.getName()));
+ json.append(':');
+ json.append(graphJson);
+
+ firstGraph = false;
+ }
+
+ json.append('}');
+ }
+ }
+
+ // close json
+ json.append('}');
+
+ // Create the url
+ URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
+
+ // Connect to the website
+ URLConnection connection;
+
+ // Mineshafter creates a socks proxy, so we can safely bypass it
+ // It does not reroute POST requests so we need to go around it
+ if (isMineshafterPresent()) {
+ connection = url.openConnection(Proxy.NO_PROXY);
+ } else {
+ connection = url.openConnection();
+ }
+
+
+ byte[] uncompressed = json.toString().getBytes();
+ byte[] compressed = gzip(json.toString());
+
+ // Headers
+ connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
+ connection.addRequestProperty("Content-Type", "application/json");
+ connection.addRequestProperty("Content-Encoding", "gzip");
+ connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
+ connection.addRequestProperty("Accept", "application/json");
+ connection.addRequestProperty("Connection", "close");
+
+ connection.setDoOutput(true);
+
+ if (debug) {
+ System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
+ }
+
+ // Write the data
+ OutputStream os = connection.getOutputStream();
+ os.write(compressed);
+ os.flush();
+
+ // Now read the response
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String response = reader.readLine();
+
+ // close resources
+ os.close();
+ reader.close();
+
+ if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
+ if (response == null) {
+ response = "null";
+ } else if (response.startsWith("7")) {
+ response = response.substring(response.startsWith("7,") ? 2 : 1);
+ }
+
+ throw new IOException(response);
+ } else {
+ // Is this the first update this hour?
+ if (response.equals("1") || response.contains("This is your first update this hour")) {
+ synchronized (graphs) {
+ final Iterator iter = graphs.iterator();
+
+ while (iter.hasNext()) {
+ final Graph graph = iter.next();
+
+ for (Plotter plotter : graph.getPlotters()) {
+ plotter.reset();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * GZip compress a string of bytes
+ *
+ * @param input
+ * @return
+ */
+ public static byte[] gzip(String input) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ GZIPOutputStream gzos = null;
+
+ try {
+ gzos = new GZIPOutputStream(baos);
+ gzos.write(input.getBytes("UTF-8"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (gzos != null) try {
+ gzos.close();
+ } catch (IOException ignore) {
+ }
+ }
+
+ return baos.toByteArray();
+ }
+
+ /**
+ * Check if mineshafter is present. If it is, we need to bypass it to send POST requests
+ *
+ * @return true if mineshafter is installed on the server
+ */
+ private boolean isMineshafterPresent() {
+ try {
+ Class.forName("mineshafter.MineServer");
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Appends a json encoded key/value pair to the given string builder.
+ *
+ * @param json
+ * @param key
+ * @param value
+ * @throws UnsupportedEncodingException
+ */
+ private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
+ boolean isValueNumeric = false;
+
+ try {
+ if (value.equals("0") || !value.endsWith("0")) {
+ Double.parseDouble(value);
+ isValueNumeric = true;
+ }
+ } catch (NumberFormatException e) {
+ isValueNumeric = false;
+ }
+
+ if (json.charAt(json.length() - 1) != '{') {
+ json.append(',');
+ }
+
+ json.append(escapeJSON(key));
+ json.append(':');
+
+ if (isValueNumeric) {
+ json.append(value);
+ } else {
+ json.append(escapeJSON(value));
+ }
+ }
+
+ /**
+ * Escape a string to create a valid JSON string
+ *
+ * @param text
+ * @return
+ */
+ private static String escapeJSON(String text) {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append('"');
+ for (int index = 0; index < text.length(); index++) {
+ char chr = text.charAt(index);
+
+ switch (chr) {
+ case '"':
+ case '\\':
+ builder.append('\\');
+ builder.append(chr);
+ break;
+ case '\b':
+ builder.append("\\b");
+ break;
+ case '\t':
+ builder.append("\\t");
+ break;
+ case '\n':
+ builder.append("\\n");
+ break;
+ case '\r':
+ builder.append("\\r");
+ break;
+ default:
+ if (chr < ' ') {
+ String t = "000" + Integer.toHexString(chr);
+ builder.append("\\u" + t.substring(t.length() - 4));
+ } else {
+ builder.append(chr);
+ }
+ break;
+ }
+ }
+ builder.append('"');
+
+ return builder.toString();
+ }
+
+ /**
+ * Encode text as UTF-8
+ *
+ * @param text the text to encode
+ * @return the encoded text, as UTF-8
+ */
+ private static String urlEncode(final String text) throws UnsupportedEncodingException {
+ return URLEncoder.encode(text, "UTF-8");
+ }
+
+ /**
+ * Represents a custom graph on the website
+ */
+ public static class Graph {
+
+ /**
+ * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is
+ * rejected
+ */
+ private final String name;
+
+ /**
+ * The set of plotters that are contained within this graph
+ */
+ private final Set plotters = new LinkedHashSet();
+
+ private Graph(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the graph's name
+ *
+ * @return the Graph's name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Add a plotter to the graph, which will be used to plot entries
+ *
+ * @param plotter the plotter to add to the graph
+ */
+ public void addPlotter(final Plotter plotter) {
+ plotters.add(plotter);
+ }
+
+ /**
+ * Remove a plotter from the graph
+ *
+ * @param plotter the plotter to remove from the graph
+ */
+ public void removePlotter(final Plotter plotter) {
+ plotters.remove(plotter);
+ }
+
+ /**
+ * Gets an unmodifiable set of the plotter objects in the graph
+ *
+ * @return an unmodifiable {@link java.util.Set} of the plotter objects
+ */
+ public Set getPlotters() {
+ return Collections.unmodifiableSet(plotters);
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (!(object instanceof Graph)) {
+ return false;
+ }
+
+ final Graph graph = (Graph) object;
+ return graph.name.equals(name);
+ }
+
+ /**
+ * Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
+ */
+ protected void onOptOut() {
+ }
+ }
+
+ /**
+ * Interface used to collect custom data for a plugin
+ */
+ public static abstract class Plotter {
+
+ /**
+ * The plot's name
+ */
+ private final String name;
+
+ /**
+ * Construct a plotter with the default plot name
+ */
+ public Plotter() {
+ this("Default");
+ }
+
+ /**
+ * Construct a plotter with a specific plot name
+ *
+ * @param name the name of the plotter to use, which will show up on the website
+ */
+ public Plotter(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the current value for the plotted point. Since this function defers to an external function it may or may
+ * not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
+ * from any thread so care should be taken when accessing resources that need to be synchronized.
+ *
+ * @return the current value for the point to be plotted.
+ */
+ public abstract int getValue();
+
+ /**
+ * Get the column name for the plotted point
+ *
+ * @return the plotted point's column name
+ */
+ public String getColumnName() {
+ return name;
+ }
+
+ /**
+ * Called after the website graphs have been updated
+ */
+ public void reset() {
+ }
+
+ @Override
+ public int hashCode() {
+ return getColumnName().hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (!(object instanceof Plotter)) {
+ return false;
+ }
+
+ final Plotter plotter = (Plotter) object;
+ return plotter.name.equals(name) && plotter.getValue() == getValue();
+ }
+ }
+}
diff --git a/plugin/src/main/java/me/Mammothskier/Giants/util/NMSUtils.java b/plugin/src/main/java/me/Mammothskier/Giants/util/NMSUtils.java
new file mode 100644
index 0000000..0c30669
--- /dev/null
+++ b/plugin/src/main/java/me/Mammothskier/Giants/util/NMSUtils.java
@@ -0,0 +1,126 @@
+package me.Mammothskier.Giants.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import me.Mammothskier.Giants.entity.Entities;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+
+public class NMSUtils {
+
+ public static String getBukkitVersion() {
+ Matcher matcher = Pattern.compile("v\\d+_\\d+_R\\d+").matcher(Bukkit.getServer().getClass().getPackage().getName());
+ if (matcher.find()) {
+ return matcher.group();
+ } else {
+ return null;
+ }
+ }
+
+ public static String getMinecraftVersion() {
+ Matcher matcher = Pattern.compile("(\\(MC: )([\\d\\.]+)(\\))").matcher(Bukkit.getVersion());
+ if (matcher.find()) {
+ return matcher.group(2);
+ } else {
+ return null;
+ }
+ }
+
+ public static void createGiant(Location location, SpawnReason reason) {
+ String version = NMSUtils.getBukkitVersion();
+ if (Entities.GiantZombie == true) {
+ switch (version) {
+ case("v1_7_R3"):
+ me.Mammothskier.Giants.entity.nms.v1_7_R3.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_7_R4"):
+ me.Mammothskier.Giants.entity.nms.v1_7_R4.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_8_R1"):
+ me.Mammothskier.Giants.entity.nms.v1_8_R1.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_8_R2"):
+ me.Mammothskier.Giants.entity.nms.v1_8_R2.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_8_R3"):
+ me.Mammothskier.Giants.entity.nms.v1_8_R3.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_9_R1"):
+ me.Mammothskier.Giants.entity.nms.v1_9_R1.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_9_R2"):
+ me.Mammothskier.Giants.entity.nms.v1_9_R2.EntityCreator.createEntity(location, reason);
+ break;
+ case("v1_10_R1"):
+ me.Mammothskier.Giants.entity.nms.v1_10_R1.EntityCreator.createEntity(location, reason);
+ break;
+ }
+ }
+ }
+
+ public static void registerEntities() {
+ String version = NMSUtils.getBukkitVersion();
+ if ("v1_7_R3".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_7_R3 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_7_R3.CustomEntityType.registerEntities();
+ } else if ("v1_7_R4".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_7_R4 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_7_R4.CustomEntityType.registerEntities();
+ } else if ("v1_8_R1".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_8_R1 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_8_R1.CustomEntityType.registerEntities();
+ } else if ("v1_8_R2".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_8_R2 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_8_R2.CustomEntityType.registerEntities();
+ } else if ("v1_8_R3".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_8_R3 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_8_R3.CustomEntityType.registerEntities();
+ } else if ("v1_9_R1".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_9_R1 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_9_R1.CustomEntityType.registerEntities();
+ } else if ("v1_9_R2".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_9_R2 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_9_R2.CustomEntityType.registerEntities();
+ } else if ("v1_10_R1".equals(version)) {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + "Minecraft server version v1_10_R1 found. Enabling Giant Zombies.");
+ Entities.GiantZombie = true;
+ me.Mammothskier.Giants.entity.nms.v1_10_R1.CustomEntityType.registerEntities();
+ } else {
+ Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.RED + "Minecraft server version " + version + "does not support Giant Zombies.Disabling Giant Zombies");
+ Entities.GiantZombie = false;
+ }
+ }
+
+ public static void unregisterEntities() {
+ String version = NMSUtils.getBukkitVersion();
+ if ("v1_7_R3".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_7_R3.CustomEntityType.unregisterEntities();
+ } else if ("v1_7_R4".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_7_R4.CustomEntityType.unregisterEntities();
+ } else if ("v1_8_R1".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_8_R1.CustomEntityType.unregisterEntities();
+ } else if ("v1_8_R2".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_8_R2.CustomEntityType.unregisterEntities();
+ } else if ("v1_8_R3".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_8_R3.CustomEntityType.unregisterEntities();
+ } else if ("v1_9_R1".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_9_R1.CustomEntityType.unregisterEntities();
+ } else if ("v1_9_R2".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_9_R2.CustomEntityType.unregisterEntities();
+ } else if ("v1_10_R1".equals(version)) {
+ me.Mammothskier.Giants.entity.nms.v1_10_R1.CustomEntityType.unregisterEntities();
+ }
+
+ }
+}
diff --git a/src/main/resources/biomes.yml b/plugin/src/main/resources/biomes.yml
similarity index 100%
rename from src/main/resources/biomes.yml
rename to plugin/src/main/resources/biomes.yml
diff --git a/src/main/resources/config.yml b/plugin/src/main/resources/config.yml
similarity index 100%
rename from src/main/resources/config.yml
rename to plugin/src/main/resources/config.yml
diff --git a/src/main/resources/giant.yml b/plugin/src/main/resources/giant.yml
similarity index 100%
rename from src/main/resources/giant.yml
rename to plugin/src/main/resources/giant.yml
diff --git a/src/main/resources/jockey.yml b/plugin/src/main/resources/jockey.yml
similarity index 100%
rename from src/main/resources/jockey.yml
rename to plugin/src/main/resources/jockey.yml
diff --git a/src/main/resources/magmacube.yml b/plugin/src/main/resources/magmacube.yml
similarity index 100%
rename from src/main/resources/magmacube.yml
rename to plugin/src/main/resources/magmacube.yml
diff --git a/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml
similarity index 100%
rename from src/main/resources/plugin.yml
rename to plugin/src/main/resources/plugin.yml
diff --git a/src/main/resources/slime.yml b/plugin/src/main/resources/slime.yml
similarity index 100%
rename from src/main/resources/slime.yml
rename to plugin/src/main/resources/slime.yml
diff --git a/pom.xml b/pom.xml
index d5620bb..6d668bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,25 +1,42 @@
-
- 4.0.0
-
-
-
-
- me.mammothskier
- giants
- 6.4-SNAPSHOT
- jar
-
-
-
-
- Giants
-
-
-
-
+
+
+ 4.0.0
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+ pom
+
+
+ files
+ v1_7_R3
+ v1_7_R4
+ v1_8_R1
+ v1_8_R2
+ v1_8_R3
+ v1_9_R1
+ v1_9_R2
+ v1_10_R1
+ plugin
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/groups/public/
+
+
+
+ confuser-repo
+ http://ci.frostcast.net/plugin/repository/everything
+
+
+
+ bukkit-repo
+ http://repo.bukkit.org/content/groups/public
+
+
+
${basedir}/src/main/java
@@ -54,8 +71,17 @@
shade
+
+
+ me.Mammothskier:Giants*
+
+ **
+
+
+
+ me.Mammothskier:Giants*
org.mcstats.bukkit:metrics
@@ -67,59 +93,16 @@
-
-
-
-
-
-
- bukkit-repo
- Bukkit Repository
- http://repo.bukkit.org/content/groups/public/
-
-
- Plugin Metrics
- http://repo.mcstats.org/content/repositories/public
-
-
- confuser-repo
- http://ci.frostcast.net/plugin/repository/everything
-
-
-
-
-
-
- org.bukkit
- craftbukkit
- 1.7.2-R0.3-SNAPSHOT
- jar
- compile
-
-
- org.mcstats.bukkit
- metrics
- R7
- compile
-
-
- me.confuser
- BarAPI
- 3.0
- compile
-
-
-
-
+
+
UTF-8
UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
-
-
-
+
+
stable
@@ -195,17 +178,12 @@
0
- DEFAULT
+ Custom
- ${project.version}-b${project.build.number}-${project.build.type}
+ ${project.version}-${project.build.type}
${project.name}
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/Attacks.java b/src/main/java/me/Mammothskier/Giants/Attacks.java
deleted file mode 100644
index c6011e1..0000000
--- a/src/main/java/me/Mammothskier/Giants/Attacks.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package me.Mammothskier.Giants;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.entity.Damageable;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Zombie;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import org.bukkit.util.Vector;
-
-public class Attacks {
-
- public Attacks(Giants attacks) {
-
- }
-
- public void fireAttack(Entity attacker, Entity target, int ticksAttacker, int ticksTarget, boolean sound){
- attacker.setFireTicks(ticksAttacker);
- target.setFireTicks(ticksTarget);
- if (sound == true){
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.FIRE_IGNITE, 1, 0);
- }
- }
-
- public void jumpAttack(Entity attacker, Entity target, double height, float power, boolean blockDamage, boolean sound){
- attacker.setVelocity(new Vector(0,height, 0));
- Location location = attacker.getLocation();
- location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), power, false, blockDamage);
- if (attacker.getNearbyEntities(2, 4, 2).contains(target)){
- Vector direction = target.getLocation().toVector().subtract(target.getLocation().toVector()).normalize();
- direction.setX( direction.getX()*2 );
- direction.setY( direction.getY()*2 );
- direction.setZ( direction.getZ()*2 );
- target.setVelocity(direction);
- }
- if (sound == true){
-
- }
- }
-
- public void kickAttack(Entity target, double height, boolean sound){
- target.setVelocity(new Vector(0, height, 0));
- if (sound == true){
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.LAVA_POP, 1, 0);
- }
- }
-
- public void lavaAttack(Entity target, boolean sound){
- target.getLocation().getBlock().setType(Material.LAVA);
- if (sound == true){
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.EXPLODE, 1, 0);
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.LAVA_POP, 1, 0);
- }
- }
-
- public void lightningAttack(Entity target){
- try {
- Location location = target.getLocation();
- location.getWorld().strikeLightning(location);
- } catch (Exception e) {
- }
- }
-
- public void poisonAttack(Player player, Double length) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, (int) (length*20), 3));
- }
-
- public void spawnZombies(Location location, int amount, double health, boolean baby, boolean sound){
- for (int i = 1; i <= amount; i++){
- if (baby == true) {
- Entity e = location.getWorld().spawnEntity(location, EntityType.ZOMBIE);
- ((Zombie) e).setBaby(true);
- ((Damageable) e).setMaxHealth(health);
- ((Damageable) e).setHealth(health);
- }
- else{
- Entity e = location.getWorld().spawnEntity(location, EntityType.ZOMBIE);
- ((Damageable) e).setMaxHealth(health);
- ((Damageable) e).setHealth(health);
- }
- }
- if (sound == true){
- location.getWorld().playSound(location, Sound.EXPLODE, 1, 0);
- }
- }
-
- public void stompAttack(Location location, float power, boolean fire, boolean sound){
- location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), power, fire);
- if (sound == true){
- location.getWorld().playSound(location, Sound.FIREWORK_LARGE_BLAST, 1, 0);
- }
- }
-
- public void throwBoulderAttack(LivingEntity attacker, boolean sound){
- Vector direction = ((LivingEntity) attacker).getEyeLocation().getDirection().multiply(2);
- Fireball fireball = attacker.getWorld().spawn(((LivingEntity) attacker).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
- fireball.setShooter(attacker);
- if (sound == true){
- Location location = attacker.getLocation();
- location.getWorld().playSound(location, Sound.GHAST_FIREBALL, 1, 0);
- }
- }
-}
diff --git a/src/main/java/me/Mammothskier/Giants/Giants.java b/src/main/java/me/Mammothskier/Giants/Giants.java
deleted file mode 100644
index c720aa8..0000000
--- a/src/main/java/me/Mammothskier/Giants/Giants.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package me.Mammothskier.Giants;
-
-import java.io.IOException;
-import java.util.logging.Logger;
-
-import me.Mammothskier.Giants.BarAPI.HealthBar;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.plugin.PluginDescriptionFile;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.mcstats.Metrics;
-
-
-public class Giants extends JavaPlugin{
-
- public final Logger log = Logger.getLogger("Minecraft");
-
- /*
- * CHANGE LOG:
- * ======
- * V1.1 :
- * Giants no longer spawn from spawn eggs
- * changed spawn chance to a float so it can store decimals
- * Removed Damage modifier - it causes a player to kill a Giant instantly
- * ======
- * V1.2 :
- * Fixed spelling error for Experience in config
- * ======
- * V2.0 :
- * ======
- * Biome Spawn settings
- * ======
- * V2.1 :
- * Update to CB 1.4.6-R0.1
- * Fixed Giants not targetting players if Fire Attack is set to False
- * ======
- * V3.0 :
- * Added more Biome Spawn options
- * Added Giant Spawn Egg
- * ======
- * V3.1 :
- * Added 'Other' Biome option incase other plugins modify where mobs can spawn
- * ======
- * V3.2 :
- * Temporarily Disabled Spout Features due to servers getting errors if they did not have the SpoutPlugin
- * ======
- * V3.3 :
- * Added a check to see if the server has the SpoutPlugin before enabling Spout features
- * ======
- * V3.4 :
- * Fixed errors when a player interacts while the server does not have the SpoutPlugin
- * ======
- * V4.0 :
- * Update to craftbukkit-1.4.6-R0.3 and SpoutPlugin 1412
- * Added Kick Attack
- * Added Lightning Attack
- * \giants reload can now be used in console
- * ======
- * V5.0 :
- * Updated to Craftbukkit-1.4.7-R0.1 and SpoutPlugin 1.4.7-R0.2
- * Added "Throw Boulder Attack"
- * Added "Stomp Attack"
- * Added "Spawn Zombies Attack"
- * Added Sounds to some of the Attack Mechanisms (the ones that don't have sounds)
- * Added Config to set the height the player is kicked (for the Kick Attack)
- * Cleaned code
- * Organized the config.yml
- * Added option to use Spout features
- * ======
- * v6.0:
- * Update to CB 1.7.2-R0.3
- * Added 1.7 biome support
- * Fixed zombie attack
- * removed spoutcraft support due to being unupdated
- * Added /giants spawn command
- * Organized config.yml
- * ======
- * V6.1 :
- * Added support for giant slimes and magmacubes
- * Added attacks to slimes and magmacubes
- * Fixed health issue
- * Moved biome settings to another file
- * Changed name of zombie attack
- * Added damage settings
- * Added /giants version command
- * Added metrics support
- * ======
- * v6.2 :
- * Added health settings to giant's shrapnel and spawn zombies attack
- * Fixed error on magmacube spawns
- * Added error message to commands
- * ======
- * v6.3 :
- * Updated the drop system and format
- * Added a poison attack to slimes
- * added block settings for stomp attacks
- * ======
- * V6.4 :
- * Added support for lore and custom item names
- * Added file version to each file
- * Added Giant Jockey Entity
- * Added support for BarAPI
- * Fixed Slime's health bug
- * ======
- */
-
- @Override
- public void onEnable(){
- new API(this);
- PluginDescriptionFile pdf = this.getDescription();
- Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + pdf.getName() + " Version " + pdf.getVersion() + " Has Been Enabled!");
- try {
- Metrics metrics = new Metrics(this);
- metrics.start();
- } catch (IOException e) {
- // Failed to submit the stats :-(
- }
-
- if ((API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Dependencies.BarAPI").equalsIgnoreCase("true")) &&
- (Bukkit.getPluginManager().getPlugin("BarAPI") != null)) {
- Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "Found BarAPI: Enabling BarAPI features.");
- new HealthBar(this);
- } else if (Bukkit.getPluginManager().getPlugin("BarAPI") != null) {
- Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "Found BarAPI: Config set to ignore BarAPI features. \n" +
- "Disabling BarAPI features.");
- } else {
- Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GREEN + "Cannot Find BarAPI: Disabling BarAPI features.");
- }
-
- if (API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled").equalsIgnoreCase("true")) {
- Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Giants] " + ChatColor.GOLD + "You have Giant Jockeys Enabled! \n" +
- "This entity of Giants is extremely experimental and does not have many features.");
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/events/GiantSpawnEvent.java b/src/main/java/me/Mammothskier/Giants/events/GiantSpawnEvent.java
deleted file mode 100644
index be46f19..0000000
--- a/src/main/java/me/Mammothskier/Giants/events/GiantSpawnEvent.java
+++ /dev/null
@@ -1,475 +0,0 @@
-package me.Mammothskier.Giants.events;
-
-import org.bukkit.Location;
-import org.bukkit.block.Biome;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Giant;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-public class GiantSpawnEvent extends Event {
- private static boolean cancelled = false;
- private Entity entity;
- private Location location;
- private static final HandlerList handlers = new HandlerList();
-
-
- public GiantSpawnEvent(Location loc) {
- location = loc;
- double health;
- Biome biome = loc.getWorld().getBiome(loc.getBlockX(), loc.getBlockZ());
-
- String string = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Giant Stats.Health");
-
- try {
- health = Double.parseDouble(string);
- } catch (Exception e) {
- health = 100;
- }
-
- if (!API.getGiantSpawnWorlds().contains(loc.getWorld().getName())) {
- setCancelled(true);
- }
-
- if(API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant").equalsIgnoreCase("false")){
- setCancelled(true);
- }
-
- if (!isCancelled()) {
- if (biome == Biome.SWAMPLAND) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Swampland.Swampland").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SWAMPLAND_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Swampland.Swampland Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FOREST) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Forest.Forest").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Forest.Forest Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Taiga").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Taiga Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Taiga Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Cold Taiga").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Cold Taiga Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Cold Taiga Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_TAIGA) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Mega Taiga").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Mega Taiga Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Mega Spruce Taiga").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.PLAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Plains.Plains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_PLAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Plains.Ice Plains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_PLAINS_SPIKES) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Plains.Ice Plains Spikes").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SUNFLOWER_PLAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Plains.Sunflower Plains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.OCEAN) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Ocean.Ocean").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DEEP_OCEAN) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Ocean.Deep Ocean").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FROZEN_OCEAN) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Ocean.Frozen Ocean").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.RIVER) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.River.River").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FROZEN_RIVER) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.River.Frozen River").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BEACH) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Beach.Beach").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.STONE_BEACH) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Beach.Stone Beach").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_BEACH) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Beach.Cold Beach").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MUSHROOM_ISLAND) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mushroom Island.Mushroom Island").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MUSHROOM_SHORE) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mushroom Island.Mushroom Shore").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Desert.Desert").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Desert.Desert Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Desert.Desert Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Jungle.Jungle").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE_HILLS) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Jungle.Jungle Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE_MOUNTAINS) || (biome == Biome.JUNGLE_EDGE) || (biome == Biome.JUNGLE_EDGE_MOUNTAINS)) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Jungle.Jungle Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Birch Forest.Birch Forest").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Birch Forest.Birch Forest Hills").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Birch Forest.Birch Forest Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Savanna.Savanna").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Savanna.Savanna Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Savanna.Savanna Plateau").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Savanna.Savanna Plateau Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ROOFED_FOREST) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Roofed Forest.Roofed Forest").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ROOFED_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mesa.Mesa").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_BRYCE) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mesa.Mesa Bryce").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mesa.Mesa Plateau").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mesa.Mesa Plateau Forest").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mesa.Mesa Plateau Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SMALL_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Other.Small Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Other.Ice Mountains").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.HELL) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Other.Hell").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SKY) {
- if (API.getFileHandler().getProperty(Files.GIANTBIOMES, "Giant Configuration.Biome Settings.Other.Sky").equalsIgnoreCase("true")) {
- Giant entity = (Giant) loc.getWorld().spawnEntity(location, EntityType.GIANT);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- }
- }
-
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- public static boolean isCancelled() {
- return cancelled;
- }
-
- public Entity getEntity() {
- return entity;
- }
-
- public Location getLocation() {
- return location;
- }
-
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/events/JockeySpawnEvent.java b/src/main/java/me/Mammothskier/Giants/events/JockeySpawnEvent.java
deleted file mode 100644
index 83416c6..0000000
--- a/src/main/java/me/Mammothskier/Giants/events/JockeySpawnEvent.java
+++ /dev/null
@@ -1,333 +0,0 @@
-package me.Mammothskier.Giants.events;
-
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-import org.bukkit.Location;
-import org.bukkit.block.Biome;
-import org.bukkit.entity.Entity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-public class JockeySpawnEvent extends Event implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
- private boolean cancel = false;
-
- public JockeySpawnEvent (Entity entity, Entity passenger) {
- Location location = entity.getLocation();
-
- Biome biome = location.getWorld().getBiome(location.getBlockX(), location.getBlockZ());
-
- if (!isCancelled()) {
- if (biome == Biome.SWAMPLAND) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Swampland.Swampland").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SWAMPLAND_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Swampland.Swampland Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.FOREST) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Forest.Forest").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Forest.Forest Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.TAIGA) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Taiga").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Taiga Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Taiga Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.COLD_TAIGA) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Cold Taiga").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.COLD_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Cold Taiga Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.COLD_TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Cold Taiga Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MEGA_TAIGA) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Mega Taiga").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MEGA_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Mega Taiga Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Mega Spruce Taiga").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.PLAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Plains.Plains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.ICE_PLAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Plains.Ice Plains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.ICE_PLAINS_SPIKES) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Plains.Ice Plains Spikes").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SUNFLOWER_PLAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Plains.Sunflower Plains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.OCEAN) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Ocean.Ocean").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.DEEP_OCEAN) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Ocean.Deep Ocean").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.FROZEN_OCEAN) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Ocean.Frozen Ocean").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.RIVER) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.River.River").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.FROZEN_RIVER) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.River.Frozen River").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.BEACH) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Beach.Beach").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.STONE_BEACH) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Beach.Stone Beach").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.COLD_BEACH) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Beach.Cold Beach").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.EXTREME_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.EXTREME_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MUSHROOM_ISLAND) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mushroom Island.Mushroom Island").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MUSHROOM_SHORE) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mushroom Island.Mushroom Shore").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.DESERT) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Desert.Desert").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.DESERT_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Desert.Desert Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.DESERT_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Desert.Desert Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if ((biome == Biome.JUNGLE) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Jungle.Jungle").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if ((biome == Biome.JUNGLE_HILLS) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Jungle.Jungle Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if ((biome == Biome.JUNGLE_MOUNTAINS) || (biome == Biome.JUNGLE_EDGE) || (biome == Biome.JUNGLE_EDGE_MOUNTAINS)) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Jungle.Jungle Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.BIRCH_FOREST) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Birch Forest.Birch Forest").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Birch Forest.Birch Forest Hills").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.BIRCH_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Birch Forest.Birch Forest Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SAVANNA) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Savanna.Savanna").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SAVANNA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Savanna.Savanna Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Savanna.Savanna Plateau").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Savanna.Savanna Plateau Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.ROOFED_FOREST) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Roofed Forest.Roofed Forest").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.ROOFED_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MESA) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mesa.Mesa").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MESA_BRYCE) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mesa.Mesa Bryce").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MESA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mesa.Mesa Plateau").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mesa.Mesa Plateau Forest").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MESA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mesa.Mesa Plateau Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SMALL_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Other.Small Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.ICE_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Other.Ice Mountains").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.HELL) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Other.Hell").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- if (biome == Biome.SKY) {
- if (API.getFileHandler().getProperty(Files.JOCKEYBIOMES, "Jockey Configuration.Biome Settings.Other.Sky").equalsIgnoreCase("true")) {
- entity.setPassenger(passenger);
- }
- }
- }
- }
-
-
- public boolean isCancelled() {
- return cancel;
- }
-
- public void setCancelled(boolean cancel) {
- this.cancel = cancel;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/src/main/java/me/Mammothskier/Giants/events/MagmaCubeSpawnEvent.java b/src/main/java/me/Mammothskier/Giants/events/MagmaCubeSpawnEvent.java
deleted file mode 100644
index c763b3b..0000000
--- a/src/main/java/me/Mammothskier/Giants/events/MagmaCubeSpawnEvent.java
+++ /dev/null
@@ -1,546 +0,0 @@
-package me.Mammothskier.Giants.events;
-
-import org.bukkit.Location;
-import org.bukkit.block.Biome;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.MagmaCube;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-
-public class MagmaCubeSpawnEvent extends Event {
- private static boolean cancelled = false;
- private Entity entity;
- private Location location;
- private static final HandlerList handlers = new HandlerList();
-
-
- public MagmaCubeSpawnEvent(Location loc) {
- location = loc;
- Biome biome = loc.getWorld().getBiome(loc.getBlockX(), loc.getBlockZ());
- String string = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.Size");
-
-
- String string2 = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.Health");
- int size;
- double health = 1;
- try {
- size = Integer.parseInt(string);
- health = Double.parseDouble(string2);
- } catch (Exception e) {
- size = 12;
- }
-
-
- if (!API.getMagmaCubeSpawnWorlds().contains(loc.getWorld().getName())) {
- setCancelled(true);
- }
-
-
- if (!API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Magma Cube").equalsIgnoreCase("true")){
- setCancelled(true);
- }
-
-
- if (!isCancelled()) {
- if (biome == Biome.SWAMPLAND) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Swampland.Swampland").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SWAMPLAND_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Swampland.Swampland Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FOREST) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Forest.Forest").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Forest.Forest Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Taiga").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Taiga Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Taiga Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Cold Taiga").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Cold Taiga Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Cold Taiga Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_TAIGA) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Mega Taiga").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Mega Taiga Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Mega Spruce Taiga").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.PLAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Plains.Plains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_PLAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Plains.Ice Plains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_PLAINS_SPIKES) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Plains.Ice Plains Spikes").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SUNFLOWER_PLAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Plains.Sunflower Plains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.OCEAN) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Ocean.Ocean").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DEEP_OCEAN) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Ocean.Deep Ocean").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FROZEN_OCEAN) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Ocean.Frozen Ocean").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.RIVER) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.River.River").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FROZEN_RIVER) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.River.Frozen River").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BEACH) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Beach.Beach").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.STONE_BEACH) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Beach.Stone Beach").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_BEACH) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Beach.Cold Beach").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MUSHROOM_ISLAND) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mushroom Island.Mushroom Island").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MUSHROOM_SHORE) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mushroom Island.Mushroom Shore").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Desert.Desert").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Desert.Desert Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Desert.Desert Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Jungle.Jungle").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE_HILLS) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Jungle.Jungle Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE_MOUNTAINS) || (biome == Biome.JUNGLE_EDGE) || (biome == Biome.JUNGLE_EDGE_MOUNTAINS)) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Jungle.Jungle Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest Hills").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Savanna.Savanna").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Savanna.Savanna Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Savanna.Savanna Plateau").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Savanna.Savanna Plateau Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ROOFED_FOREST) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Roofed Forest.Roofed Forest").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ROOFED_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mesa.Mesa").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_BRYCE) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mesa.Mesa Bryce").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau Forest").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SMALL_MOUNTAINS) {
- if(API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Other.Small Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Other.Ice Mountains").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.HELL) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Other.Hell").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SKY) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBEBIOMES, "Magma Cube Configuration.Biome Settings.Other.Sky").equalsIgnoreCase("true")) {
- MagmaCube entity = (MagmaCube) loc.getWorld().spawnEntity(location, EntityType.MAGMA_CUBE);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- }
- }
-
-
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
-
- public static boolean isCancelled() {
- return cancelled;
- }
-
-
- public Entity getEntity() {
- return entity;
- }
-
-
- public Location getLocation() {
- return location;
- }
-
-
- public HandlerList getHandlers() {
- return handlers;
- }
-
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/src/main/java/me/Mammothskier/Giants/events/SlimeSpawnEvent.java b/src/main/java/me/Mammothskier/Giants/events/SlimeSpawnEvent.java
deleted file mode 100644
index d4459fd..0000000
--- a/src/main/java/me/Mammothskier/Giants/events/SlimeSpawnEvent.java
+++ /dev/null
@@ -1,534 +0,0 @@
-package me.Mammothskier.Giants.events;
-
-import org.bukkit.Location;
-import org.bukkit.block.Biome;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Slime;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-public class SlimeSpawnEvent extends Event {
- private static boolean cancelled = false;
- private Entity entity;
- private Location location;
- private static final HandlerList handlers = new HandlerList();
-
- public SlimeSpawnEvent(Location loc) {
- location = loc;
- Biome biome = loc.getWorld().getBiome(loc.getBlockX(), loc.getBlockZ());
- String string = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Size");
- String string2 = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Health");
- int size;
- double health;
- try {
- size = Integer.parseInt(string);
- health = Double.parseDouble(string2);
- } catch (Exception e) {
- size = 12;
- health = size^2;
- }
-
- if (!API.getSlimeSpawnWorlds().contains(loc.getWorld().getName())) {
- setCancelled(true);
- }
-
- if(!API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Slime").equalsIgnoreCase("true")){
- setCancelled(true);
- }
-
- if (!isCancelled()) {
- if (biome == Biome.SWAMPLAND) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Swampland.Swampland").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SWAMPLAND_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Swampland.Swampland Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FOREST) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Forest.Forest").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Forest.Forest Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Taiga").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Taiga Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Taiga Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Cold Taiga").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Cold Taiga Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_TAIGA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Cold Taiga Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_TAIGA) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Mega Taiga").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Mega Taiga Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Mega Spruce Taiga").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MEGA_SPRUCE_TAIGA_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.PLAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Plains.Plains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_PLAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Plains.Ice Plains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_PLAINS_SPIKES) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Plains.Ice Plains Spikes").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SUNFLOWER_PLAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Plains.Sunflower Plains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.OCEAN) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Ocean.Ocean").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DEEP_OCEAN) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Ocean.Deep Ocean").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FROZEN_OCEAN) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Ocean.Frozen Ocean").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.RIVER) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.River.River").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.FROZEN_RIVER) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.River.Frozen River").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BEACH) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Beach.Beach").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.STONE_BEACH) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Beach.Stone Beach").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.COLD_BEACH) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Beach.Cold Beach").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.EXTREME_HILLS_PLUS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MUSHROOM_ISLAND) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mushroom Island.Mushroom Island").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MUSHROOM_SHORE) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mushroom Island.Mushroom Shore").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Desert.Desert").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Desert.Desert Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.DESERT_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Desert.Desert Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Jungle.Jungle").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE_HILLS) || (biome == Biome.JUNGLE_EDGE)) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Jungle.Jungle Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if ((biome == Biome.JUNGLE_MOUNTAINS) || (biome == Biome.JUNGLE_EDGE) || (biome == Biome.JUNGLE_EDGE_MOUNTAINS)) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Jungle.Jungle Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Birch Forest.Birch Forest").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Birch Forest.Birch Forest Hills").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Birch Forest.Birch Forest Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.BIRCH_FOREST_HILLS_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Savanna.Savanna").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Savanna.Savanna Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Savanna.Savanna Plateau").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SAVANNA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Savanna.Savanna Plateau Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ROOFED_FOREST) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Roofed Forest.Roofed Forest").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ROOFED_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mesa.Mesa").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_BRYCE) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mesa.Mesa Bryce").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mesa.Mesa Plateau").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mesa.Mesa Plateau Forest").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mesa.Mesa Plateau Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.MESA_PLATEAU_FOREST_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SMALL_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Other.Small Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.ICE_MOUNTAINS) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Other.Ice Mountains").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.HELL) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Other.Hell").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- if (biome == Biome.SKY) {
- if (API.getFileHandler().getProperty(Files.SLIMEBIOMES, "Slime Configuration.Biome Settings.Other.Sky").equalsIgnoreCase("true")) {
- Slime entity = (Slime) loc.getWorld().spawnEntity(location, EntityType.SLIME);
- entity.setSize(size);
- entity.setMaxHealth(health);
- entity.setHealth(health);
- }
- }
- }
- }
-
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- public static boolean isCancelled() {
- return cancelled;
- }
-
- public Entity getEntity() {
- return entity;
- }
-
- public Location getLocation() {
- return location;
- }
-
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/files/FileHandler.java b/src/main/java/me/Mammothskier/Giants/files/FileHandler.java
deleted file mode 100644
index 716106e..0000000
--- a/src/main/java/me/Mammothskier/Giants/files/FileHandler.java
+++ /dev/null
@@ -1,548 +0,0 @@
-package me.Mammothskier.Giants.files;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.PluginDescriptionFile;
-
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.Giants;
-
-public class FileHandler {
- private final Giants _giants;
- private final HashMap _configurations;
-
- public FileHandler(Giants giants) {
- _giants = giants;
- _configurations = new HashMap();
- loadWorlds();
- loadFiles();
- loadVersion();
- loadDefaultDrop("Giant");
- loadDefaultDrop("Slime");
- loadDefaultDrop("MagmaCube");
- }
-
- private String loadVersion() {
- PluginDescriptionFile pdf = _giants.getDescription();
- String version = pdf.getVersion();
- if (version == null) {
- return null;
- }
- return version;
- }
-
- public List loadWorlds() {
- List worldList = new ArrayList();
- for (World w : _giants.getServer().getWorlds()) {
- worldList.add(w.getName());
- }
- return worldList;
- }
-
- private boolean checkDependencies(String plugin) {
- if (Bukkit.getPluginManager().getPlugin(plugin) != null) {
- return true;
- }
- return false;
- }
-
- private String[] loadDefaultDrop(String arg) {
- String[] drops = null;
- switch(arg){
- case "Giant":
- drops = new String[]{ "1-0-0;1;100/100;GIANT STONE;Dropped by a Giant" };
- break;
- case "Slime":
- drops = new String[]{ "1-0-0;1;100/100;4-12;GIANT STONE;Dropped by a Giant Slime" };
- break;
- case "MagmaCube":
- drops = new String[]{ "1-0-0;1;100/100;4-12;GIANT STONE;Dropped by a Giant Magma Cube" };
- break;
- default:
- break;
- }
- return drops;
- }
-
- public void loadFiles() {
- for (Files file : Files.values()) {
- File confFile = new File(file.getPath());
-
- if (confFile.exists()) {
- if (_configurations.containsKey(file)) {
- _configurations.remove(file);
- }
- YamlConfiguration conf = YamlConfiguration.loadConfiguration(confFile);
- _configurations.put(file, conf);
- } else {
- File parentFile = confFile.getParentFile();
-
- if (!parentFile.exists()) {
- parentFile.mkdirs();
- }
- this.createFiles(file, confFile);
- }
- }
- }
-
- private void createFiles(Files files, File file) {
- switch (files) {
- case CONFIG:
- YamlConfiguration Config = YamlConfiguration.loadConfiguration(file);
- Config.set("Giants Configuration.File Version", loadVersion());
- Config.set("Giants Configuration.Dependencies.BarAPI", checkDependencies("BarAPI"));
- Config.set("Giants Configuration.Entities.Giant", true);
- Config.set("Giants Configuration.Entities.Giant Slime", false);
- Config.set("Giants Configuration.Entities.Giant Magma Cube", false);
- Config.set("Giants Configuration.Entities.Giant Jockey.Warning.Bugs", new String("This entity of Giants is extremely experimental and does not have many features. Bugs may be present."));
- Config.set("Giants Configuration.Entities.Giant Jockey.Warning.Files", new String("Config files for this entity will NOT load unless enabled."));
- Config.set("Giants Configuration.Entities.Giant Jockey.Warning.Enabled", false);
- Config.set("Giants Configuration.Debug Mode.Enabled", false);
- Config.set("Giants Configuration.Debug Mode.Debug Message", "&2A {entity} has spawned at X:&F%X &2Y:&F%Y &2Z:&F%Z");
- try {
- Config.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, Config);
- break;
- case GIANT:
- YamlConfiguration Giant = YamlConfiguration.loadConfiguration(file);
- Giant.set("Giant Configuration.File Version", loadVersion());
- Giant.set("Giant Configuration.Spawn Settings.Chance", new Integer(10));
- Giant.set("Giant Configuration.Spawn Settings.Worlds", loadWorlds());
- Giant.set("Giant Configuration.Giant Stats.Health", new Integer(100));
- Giant.set("Giant Configuration.Giant Stats.Experience", new Integer(5));
- Giant.set("Giant Configuration.Giant Stats.Drops", Arrays.asList(loadDefaultDrop("Giant")));
- Giant.set("Giant Configuration.Giant Stats.BarAPI.Display Name", "&2Giant");
- Giant.set("Giant Configuration.Damage Settings.Arrows.Damage done by arrow", new Integer(10));
- Giant.set("Giant Configuration.Damage Settings.Fire.Allow Fire Damage", true);
- Giant.set("Giant Configuration.Damage Settings.Block Damage.Allow Suffocation", false);
- Giant.set("Giant Configuration.Damage Settings.Block Damage.Allow Cacti Damage", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Lightning Attack", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Stomp Attack.Enabled", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Stomp Attack.Explosion Power", new Integer(1));
- Giant.set("Giant Configuration.Attack Mechanisms.Stomp Attack.Light Fire", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Kick Attack.Enabled", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Kick Attack.Kick Height", new Integer(1));
- Giant.set("Giant Configuration.Attack Mechanisms.Fire Attack.Enabled", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Fire Attack.Ticks for Target", new Integer(100));
- Giant.set("Giant Configuration.Attack Mechanisms.Fire Attack.Ticks for Giant", new Integer(100));
- Giant.set("Giant Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage", new Integer(1));
- Giant.set("Giant Configuration.Attack Mechanisms.Shrapnel Attack.Enabled", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Shrapnel Attack.Baby Zombies", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Shrapnel Attack.Zombies to Spawn", new Integer(3));
- Giant.set("Giant Configuration.Attack Mechanisms.Shrapnel Attack.Health", new Integer(20));
- Giant.set("Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Enabled", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Baby Zombies", false);
- Giant.set("Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Zombies to Spawn", new Integer(5));
- Giant.set("Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Health", new Integer(20));
- Giant.set("Giant Configuration.Sounds.Stomp Attack", true);
- Giant.set("Giant Configuration.Sounds.Fire Attack", true);
- Giant.set("Giant Configuration.Sounds.Throw Boulder Attack", true);
- Giant.set("Giant Configuration.Sounds.Kick Attack", true);
- Giant.set("Giant Configuration.Sounds.Shrapnel Attack", true);
- Giant.set("Giant Configuration.Sounds.Death", true);
- try {
- Giant.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, Giant);
- break;
- case GIANTBIOMES:
- YamlConfiguration GiantBiomes = YamlConfiguration.loadConfiguration(file);
- GiantBiomes.set("Giant Configuration.File Version", loadVersion());
- GiantBiomes.set("Giant Configuration.Biome Settings.Swampland.Swampland", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Swampland.Swampland Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Forest.Forest", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Forest.Forest Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Taiga", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Taiga Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Taiga Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Cold Taiga", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Cold Taiga Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Cold Taiga Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Mega Taiga", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Mega Taiga Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Mega Spruce Taiga", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Plains.Plains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Plains.Ice Plains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Plains.Ice Plains Spikes", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Plains.Sunflower Plains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Ocean.Ocean", false);
- GiantBiomes.set("Giant Configuration.Biome Settings.Ocean.Deep Ocean", false);
- GiantBiomes.set("Giant Configuration.Biome Settings.Ocean.Frozen Ocean", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.River.River", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.River.Frozen River", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Beach.Beach", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Beach.Stone Beach", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Beach.Cold Beach", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mushroom Island.Mushroom Island", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mushroom Island.Mushroom Shore", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Desert.Desert", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Desert.Desert Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Desert.Desert Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Jungle.Jungle", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Jungle.Jungle Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Jungle.Jungle Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Birch Forest.Birch Forest", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Birch Forest.Birch Forest Hills", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Birch Forest.Birch Forest Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Savanna.Savanna", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Savanna.Savanna Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Savanna.Savanna Plateau", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Savanna.Savanna Plateau Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Roofed Forest.Roofed Forest", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mesa.Mesa", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mesa.Mesa Bryce", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mesa.Mesa Plateau", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mesa.Mesa Plateau Forest", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mesa.Mesa Plateau Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Other.Small Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Other.Ice Mountains", true);
- GiantBiomes.set("Giant Configuration.Biome Settings.Other.Hell", false);
- GiantBiomes.set("Giant Configuration.Biome Settings.Other.Sky", false);
- try {
- GiantBiomes.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, GiantBiomes);
- break;
- case SLIME:
- YamlConfiguration Slime = YamlConfiguration.loadConfiguration(file);
- Slime.set("Slime Configuration.File Version", loadVersion());
- Slime.set("Slime Configuration.Spawn Settings.Chance", new Integer(10));
- Slime.set("Slime Configuration.Spawn Settings.Worlds", loadWorlds());
- Slime.set("Slime Configuration.Spawn Settings.Worlds", loadWorlds());
- Slime.set("Slime Configuration.Slime Stats.Size", new Integer(12));
- Slime.set("Slime Configuration.Slime Stats.Health", new Integer(100));
- Slime.set("Slime Configuration.Slime Stats.Experience", new Integer(5));
- Slime.set("Slime Configuration.Slime Stats.Drops", Arrays.asList(loadDefaultDrop("Slime")));
- Slime.set("Slime Configuration.Slime Stats.BarAPI.Display Name", "&2Giant Slime Size {size}");
- Slime.set("Slime Configuration.Damage Settings.Arrows.Damage done by arrow", new Integer(10));
- Slime.set("Slime Configuration.Damage Settings.Fire.Allow Fire Damage", true);
- Slime.set("Slime Configuration.Damage Settings.Block Damage.Allow Suffocation",false);
- Slime.set("Slime Configuration.Damage Settings.Block Damage.Allow Cacti Damage", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Lightning Attack", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Stomp Attack.Enabled", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Stomp Attack.Explosion Power", new Integer(1));
- Slime.set("Slime Configuration.Attack Mechanisms.Stomp Attack.Light Fire", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Kick Attack.Enabled", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Kick Attack.Kick Height", new Integer(1));
- Slime.set("Slime Configuration.Attack Mechanisms.Fire Attack.Enabled", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Fire Attack.Ticks for Target", new Integer(100));
- Slime.set("Slime Configuration.Attack Mechanisms.Fire Attack.Ticks for Slime", new Integer(100));
- Slime.set("Slime Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled", false);
- Slime.set("Slime Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage", new Integer(1));
- Slime.set("Slime Configuration.Attack Mechanisms.Poison Attack.Enabled", true);
- Slime.set("Slime Configuration.Attack Mechanisms.Poison Attack.length", new Integer(5));
- Slime.set("Slime Configuration.Sounds.Stomp Attack", true);
- Slime.set("Slime Configuration.Sounds.Fire Attack", true);
- Slime.set("Slime Configuration.Sounds.Throw Boulder Attack", true);
- Slime.set("Slime Configuration.Sounds.Kick Attack", true);
- Slime.set("Slime Configuration.Sounds.Death", true);
- try {
- Slime.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, Slime);
- break;
- case SLIMEBIOMES:
- YamlConfiguration SlimeBiomes = YamlConfiguration.loadConfiguration(file);
- SlimeBiomes.set("Slime Configuration.File Version", loadVersion());
- SlimeBiomes.set("Slime Configuration.Biome Settings.Swampland.Swampland", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Swampland.Swampland Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Forest.Forest", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Forest.Forest Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Taiga", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Taiga Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Taiga Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Cold Taiga", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Cold Taiga Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Cold Taiga Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Mega Taiga", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Mega Taiga Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Mega Spruce Taiga", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Plains.Plains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Plains.Ice Plains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Plains.Ice Plains Spikes", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Plains.Sunflower Plains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Ocean.Ocean", false);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Ocean.Deep Ocean", false);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Ocean.Frozen Ocean", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.River.River", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.River.Frozen River", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Beach.Beach", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Beach.Stone Beach", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Beach.Cold Beach", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mushroom Island.Mushroom Island", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mushroom Island.Mushroom Shore", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Desert.Desert", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Desert.Desert Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Desert.Desert Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Jungle.Jungle", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Jungle.Jungle Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Jungle.Jungle Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Birch Forest.Birch Forest", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Birch Forest.Birch Forest Hills", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Birch Forest.Birch Forest Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Savanna.Savanna", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Savanna.Savanna Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Savanna.Savanna Plateau", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Savanna.Savanna Plateau Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Roofed Forest.Roofed Forest", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mesa.Mesa", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mesa.Mesa Bryce", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mesa.Mesa Plateau", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mesa.Mesa Plateau Forest", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mesa.Mesa Plateau Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Other.Small Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Other.Ice Mountains", true);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Other.Hell", false);
- SlimeBiomes.set("Slime Configuration.Biome Settings.Other.Sky", false);
- try {
- SlimeBiomes.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, SlimeBiomes);
- break;
- case MAGMACUBE:
- YamlConfiguration MagmaCube = YamlConfiguration.loadConfiguration(file);
- MagmaCube.set("Magma Cube Configuration.File Version", loadVersion());
- MagmaCube.set("Magma Cube Configuration.Spawn Settings.Chance", new Integer(10));
- MagmaCube.set("Magma Cube Configuration.Spawn Settings.Worlds", loadWorlds());
- MagmaCube.set("Magma Cube Configuration.Magma Cube Stats.Size", new Integer(12));
- MagmaCube.set("Magma Cube Configuration.Magma Cube Stats.Health", new Integer(100));
- MagmaCube.set("Magma Cube Configuration.Magma Cube Stats.Experience", new Integer(5));
- MagmaCube.set("Magma Cube Configuration.Magma Cube Stats.Drops", Arrays.asList(loadDefaultDrop("MagmaCube")));
- MagmaCube.set("Magma Cube Configuration.Magma Cube Stats.BarAPI.Display Name", "&2Giant Magma Cube Size {size}");
- MagmaCube.set("Magma Cube Configuration.Damage Settings.Arrows.Damage done by arrow", true);
- MagmaCube.set("Magma Cube Configuration.Damage Settings.Block Damage.Allow Suffocation", false);
- MagmaCube.set("Magma Cube Configuration.Damage Settings.Block Damage.Allow Cacti Damage", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Lightning Attack", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Stomp Attack.Enabled", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Stomp Attack.Explosion Power", new Integer(1));
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Stomp Attack.Light Fire", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Lava Attack", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Kick Attack.Enabled", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Kick Attack.Kick Height", new Integer(1));
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Fire Attack.Enabled", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Fire Attack.Ticks for Target", new Integer(100));
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Fire Attack.Ticks for Magma Cube", new Integer(100));
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled", false);
- MagmaCube.set("Magma Cube Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage", new Integer(1));
- MagmaCube.set("Magma Cube Configuration.Sounds.Fire Attack", true);
- MagmaCube.set("Magma Cube Configuration.Sounds.Throw Boulder Attack", true);
- MagmaCube.set("Magma Cube Configuration.Sounds.Kick Attack", true);
- MagmaCube.set("Magma Cube Configuration.Sounds.Lava Attack", true);
- MagmaCube.set("Magma Cube Configuration.Sounds.Death", true);
- try {
- MagmaCube.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, MagmaCube);
- break;
- case MAGMACUBEBIOMES:
- YamlConfiguration MagmaCubeBiomes = YamlConfiguration.loadConfiguration(file);
- MagmaCubeBiomes.set("Magma Cube Configuration.File Version", loadVersion());
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Swampland.Swampland", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Swampland.Swampland Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Forest.Forest", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Forest.Forest Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Taiga", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Taiga Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Taiga Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Cold Taiga", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Cold Taiga Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Cold Taiga Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Mega Taiga", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Mega Taiga Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Mega Spruce Taiga", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Plains.Plains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Plains.Ice Plains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Plains.Ice Plains Spikes", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Plains.Sunflower Plains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Ocean.Ocean", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Ocean.Deep Ocean", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Ocean.Frozen Ocean", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.River.River", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.River.Frozen River", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Beach.Beach", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Beach.Stone Beach", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Beach.Cold Beach", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mushroom Island.Mushroom Island", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mushroom Island.Mushroom Shore", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Desert.Desert", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Desert.Desert Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Desert.Desert Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Jungle.Jungle", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Jungle.Jungle Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Jungle.Jungle Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest Hills", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Savanna.Savanna", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Savanna.Savanna Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Savanna.Savanna Plateau", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Savanna.Savanna Plateau Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Roofed Forest.Roofed Forest", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mesa.Mesa", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mesa.Mesa Bryce", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau Forest", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Other.Small Mountains", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Other.Ice Mountains", true);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Other.Hell", false);
- MagmaCubeBiomes.set("Magma Cube Configuration.Biome Settings.Other.Sky", false);
- try {
- MagmaCubeBiomes.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, MagmaCubeBiomes);
- break;
- case JOCKEY:
- if (getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled").equalsIgnoreCase("true")) {
- YamlConfiguration Jockey = YamlConfiguration.loadConfiguration(file);
- Jockey.set("Jockey Configuration.File Version", loadVersion());
- Jockey.set("Jockey Configuration", new String("This entity of Giants is extremely experimental and does not have many features"));
- Jockey.set("Jockey Configuration.Spawn Settings.Worlds", loadWorlds());
- try {
- Jockey.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, Jockey);
- }
- break;
- case JOCKEYBIOMES:
- if (getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled").equalsIgnoreCase("true")) {
- YamlConfiguration JockeyBiomes = YamlConfiguration.loadConfiguration(file);
- JockeyBiomes.set("Jockey Configuration.File Version", loadVersion());
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Swampland.Swampland", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Swampland.Swampland Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Forest.Forest", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Forest.Forest Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Taiga", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Taiga Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Taiga Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Cold Taiga", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Cold Taiga Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Cold Taiga Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Mega Taiga", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Mega Taiga Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Mega Spruce Taiga", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Taiga.Mega Spruce Taiga Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Plains.Plains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Plains.Ice Plains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Plains.Ice Plains Spikes", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Plains.Sunflower Plains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Ocean.Ocean", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Ocean.Deep Ocean", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Ocean.Frozen Ocean", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.River.River", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.River.Frozen River", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Beach.Beach", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Beach.Stone Beach", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Beach.Cold Beach", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Extreme Hills.Extreme Hills Plus Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mushroom Island.Mushroom Island", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mushroom Island.Mushroom Shore", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Desert.Desert", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Desert.Desert Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Desert.Desert Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Jungle.Jungle", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Jungle.Jungle Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Jungle.Jungle Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Birch Forest.Birch Forest", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Birch Forest.Birch Forest Hills", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Birch Forest.Birch Forest Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Birch Forest.Birch Forest Hills Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Savanna.Savanna", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Savanna.Savanna Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Savanna.Savanna Plateau", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Savanna.Savanna Plateau Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Roofed Forest.Roofed Forest", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Roofed Forest.Roofed Forest Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mesa.Mesa", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mesa.Mesa Bryce", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mesa.Mesa Plateau", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mesa.Mesa Plateau Forest", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mesa.Mesa Plateau Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Mesa.Mesa Plateau Forest Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Other.Small Mountains", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Other.Ice Mountains", true);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Other.Hell", false);
- JockeyBiomes.set("Jockey Configuration.Biome Settings.Other.Sky", false);
- try {
- JockeyBiomes.save(file);
- } catch (IOException e) {
- }
- _configurations.put(files, JockeyBiomes);
- }
- break;
- default:
- break;
- }
- }
-
- public String getProperty(Files file, String path) {
- FileConfiguration conf = _configurations.get(file);
-
- if (conf != null) {
- String prop = conf.getString(path, "NULL");
-
- if (!prop.equalsIgnoreCase("NULL"))
- return prop;
- conf.set(path, null);
- }
- return null;
- }
-
- public List getPropertyList(Files file, String path) {
- FileConfiguration conf = _configurations.get(file);
-
- if (conf != null) {
- List prop = conf.getStringList(path);
- if (!prop.contains("NULL"))
- return prop;
- conf.set(path, null);
- }
- return null;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/files/Files.java b/src/main/java/me/Mammothskier/Giants/files/Files.java
deleted file mode 100644
index 8cc665f..0000000
--- a/src/main/java/me/Mammothskier/Giants/files/Files.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package me.Mammothskier.Giants.files;
-
-public enum Files {
- CONFIG("plugins/Giants/config.yml"),
- GIANT("plugins/Giants/Giant/giant.yml"), GIANTBIOMES("plugins/Giants/Giant/biomes.yml"),
- MAGMACUBE("plugins/Giants/Magma Cube/magmacube.yml"), MAGMACUBEBIOMES("plugins/Giants/Magma Cube/biomes.yml"),
- SLIME("plugins/Giants/Slime/slime.yml"), SLIMEBIOMES("plugins/Giants/Slime/biomes.yml"),
- JOCKEY("plugins/Giants/Jockey/jockey.yml"), JOCKEYBIOMES("plugins/Giants/Jockey/biomes.yml");
-
- private final String _path;
-
- private Files(final String path) {
- _path = path;
- }
-
- public String getPath() {
- return _path;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/listeners/GiantListeners.java b/src/main/java/me/Mammothskier/Giants/listeners/GiantListeners.java
deleted file mode 100644
index 8d7de24..0000000
--- a/src/main/java/me/Mammothskier/Giants/listeners/GiantListeners.java
+++ /dev/null
@@ -1,452 +0,0 @@
-package me.Mammothskier.Giants.listeners;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.io.*;
-
-import me.Mammothskier.Giants.Giants;
-import me.Mammothskier.Giants.events.GiantSpawnEvent;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.enchantments.EnchantmentWrapper;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Damageable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Zombie;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.entity.EntityTargetEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-
-public class GiantListeners implements Listener {
- private Giants _giants;
-
- public GiantListeners(Giants giants) {
- _giants = giants;
- _giants.getServer().getPluginManager().registerEvents(this, giants);
- }
-
- @EventHandler
- public void onGiantSpawn(GiantSpawnEvent event) {
- if (API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Debug Mode.Enabled").equalsIgnoreCase("true")) {
- String message = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Debug Mode.Debug Message");
- if (message != null) {
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.hasPermission("giants.debug") || player.hasPermission("giants.*") || player.isOp()) {
- message = ChatColor.translateAlternateColorCodes('&', message);
- String x = String.valueOf(Math.round(event.getLocation().getX()));
- String y = String.valueOf(Math.round(event.getLocation().getY()));
- String z = String.valueOf(Math.round(event.getLocation().getZ()));
- player.sendMessage(message.replace("%X", x).replace("%Y", y).replace("%Z", z).replace("{entity}", "Giant"));
- Bukkit.getConsoleSender().sendMessage(message.replace("%X", x).replace("%Y", y).replace("%Z", z).replace("{entity}", "Giant"));
- }
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.NORMAL)
- public void GiantsSpawnEvent(CreatureSpawnEvent event) {
- Entity entity = event.getEntity();
- EntityType type = event.getEntityType();
- SpawnReason spawnReason = event.getSpawnReason();
- if(event.isCancelled()){
- return;
- }
-
- if (!API.getGiantSpawnWorlds().contains(entity.getWorld().getName())) {
- return;
- }
-
- if ((spawnReason == SpawnReason.NATURAL)) {
- if ((type == EntityType.ZOMBIE) || (type == EntityType.COW) || (type == EntityType.MUSHROOM_COW) || (type == EntityType.PIG_ZOMBIE) || (type == EntityType.ENDERMAN)) {
- String string = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Spawn Settings.Chance");
- float sRate;
- try {
- sRate = Float.parseFloat(string);
- } catch (NumberFormatException e) {
- sRate = 10;
- }
- float chance = 100 - sRate;
-
- Random rand = new Random();
- double choice = rand.nextInt(100) < chance ? 1 : 0;
- if (choice == 0) {
- Location location = event.getEntity().getLocation();
- double x = location.getX();
- double y = location.getY();
- double z = location.getZ();
-
- int x2 = (int) x;
- int y2 = (int) y;
- int z2 = (int) z;
-
- int spawngiant = 1;
- double checkcount = 0.01;
- while (checkcount < 10) {
- y2 += checkcount;
-
- if (entity.getWorld().getBlockTypeIdAt(x2, y2, z2) != 0) {
- spawngiant = 0;
- }
- checkcount++;
- }
- if (spawngiant == 1) {
- GiantSpawnEvent GSE = new GiantSpawnEvent(location);
- Bukkit.getServer().getPluginManager().callEvent(GSE);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void arrowDamage(EntityDamageByEntityEvent event){
- Entity entity = event.getEntity();
- if((event.getDamager() instanceof Arrow) && (API.isGiant(entity))){
- int damage;
- String string = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Damage Settings.Arrows.Damage done by arrow");
- try {
- damage = Integer.parseInt(string);
- } catch (Exception e) {
- damage = 10;
- }
- if(damage == 0){
- event.setCancelled(true);
- return;
- }
- event.setDamage(damage + 0.0);
- }
- }
-
- @EventHandler
- public void fireDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- if (API.isGiant(entity)){
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Damage Settings.Fire.Allow Fire Damage").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK){
- event.setCancelled(true);
- }
- }
- }
- }
-
- @EventHandler
- public void suffocationDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- if (API.isGiant(entity)){
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Damage Settings.Block Damage.Allow Suffocation").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.SUFFOCATION || event.getCause() == DamageCause.FALLING_BLOCK){
- event.setCancelled(true);
- }
- }
- }
- }
-
- @EventHandler
- public void cactiDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- if (API.isGiant(entity)){
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Damage Settings.Block Damage.Allow Cacti Damage").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.THORNS){
- event.setCancelled(true);
- }
- }
- }
- }
-
- @EventHandler
- public void onFireAttack(EntityTargetEvent event) {
- String ticks1 = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Fire Attack.Ticks for Target");
- String ticks2 = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Fire Attack.Ticks for Giant");
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int ticksTarget;
- int ticksGiant;
- try {
- ticksTarget = Integer.parseInt(ticks1);
- ticksGiant = Integer.parseInt(ticks2);
- } catch (Exception e) {
- ticksTarget = 0;
- ticksGiant = 0;
- }
-
- if ((entity instanceof LivingEntity)) {
- if (API.isGiant(entity)) {
- if(!(target == null)){
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Fire Attack.Enabled").equalsIgnoreCase("true")) {
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Sounds.Fire Attack").equalsIgnoreCase("true")) {
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.FIRE, 1, 0);
- }
- try {
- event.getTarget().setFireTicks(ticksTarget);
- event.getEntity().setFireTicks(ticksGiant);
- } catch (Exception e) {
- }
- } else {
- event.setTarget(target);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onLightningAttack(EntityTargetEvent event) {
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
-
- if ((entity instanceof LivingEntity)) {
- if (API.isGiant(entity)) {
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Lightning Attack").equalsIgnoreCase("true")) {
- try {
- target.getLocation().getWorld().strikeLightning(target.getLocation());
- } catch (Exception e) {
- }
- } else {
- event.setTarget(target);
- }
- }
- }
- }
-
- @EventHandler
- public void onShrapnelAttack(EntityTargetEvent event) {
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int Amt;
- double Health;
- if ((entity instanceof LivingEntity)) {
- if (API.isGiant(entity)) {
- Location spawnLocation = entity.getLocation();
- Location loc = spawnLocation;
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Shrapnel Attack.Enabled").equalsIgnoreCase("true")) {
- String config = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Shrapnel Attack.Zombies to Spawn");
- String config2 = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Shrapnel Attack.Health");
- try {
- Amt = Integer.parseInt(config);
- Health = Double.parseDouble(config2);
- } catch (Exception e) {
- Amt = 3;
- Health = 20;
- }
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Sounds.Shrapnel Attack").equalsIgnoreCase("true")){
- if (target instanceof LivingEntity){
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.EXPLODE, 1, 0);
- }
- }
- for (int i = 1; i <= Amt; i++){
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Shrapnel Attack.Baby Zombies").equalsIgnoreCase("true")) {
- Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
- ((Zombie) e).setBaby(true);
- ((Damageable) e).setMaxHealth(Health);
- ((Damageable) e).setHealth(Health);
- }
- else{
- Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
- ((Damageable) e).setMaxHealth(Health);
- ((Damageable) e).setHealth(Health);
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onThrownBoulderAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- boolean inRange = false;
- Random pick = new Random();
- int chance = 0;
- int bDamage;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
-
- for (Entity entity : player.getNearbyEntities(15, 12, 15)) {
- if (API.isGiant(entity)) {
- if (entity.getNearbyEntities(15, 12, 15).contains(player) && !entity.getNearbyEntities(5, 3, 5).contains(player)) {
- inRange = true;
- }
- if (inRange == true) {
- if (chance == 50) {
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled").equalsIgnoreCase("true")) {
- String config = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage");
- try {
- bDamage = Integer.parseInt(config);
- } catch (Exception e) {
- bDamage = 1;
- }
- Vector direction = ((LivingEntity) entity).getEyeLocation().getDirection().multiply(2);
- Fireball fireball = entity.getWorld().spawn(((LivingEntity) entity).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
- fireball.setShooter((LivingEntity) entity);
- fireball.setYield(bDamage);
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Sounds.Throw Boulder Attack").equalsIgnoreCase("true")) {
- player.getLocation().getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1, 0);
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onKickAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Kick Attack.Enabled").equalsIgnoreCase("true")) {
- String config = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Kick Attack.Kick Height");
- double height;
-
- try {
- height = Double.parseDouble(config);
- } catch (Exception e) {
- height = 1;
- }
-
- Random pick = new Random();
- int chance = 0;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
- if (API.isGiant(entity)) {
- if (entity.getNearbyEntities(5, 5, 5).contains(player)) {
- player.setVelocity(new Vector(0, height, 0));
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Sounds.Kick Attack").equalsIgnoreCase("true")) {
- player.getLocation().getWorld().playSound(player.getLocation(), Sound.LAVA_POP, 1, 0);
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onStompAttack(PlayerMoveEvent event) {
- boolean sound = false;
- boolean fire = false;
- float power = 1.0f;
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Stomp Attack.Enabled").equalsIgnoreCase("true")) {
- Random pick = new Random();
- int chance = 0;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
- if (API.isGiant(entity)) {
- if (entity.getNearbyEntities(3, 2, 3).contains(player)) {
- String config = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Stomp Attack.Explosion Power");
- if (API.getFileHandler().getProperty(Files.GIANT,
- "Giant Configuration.Attack Mechanisms.Stomp Attack.Light Fire").equalsIgnoreCase("true")) {
- fire = true;
- }
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Sounds.Stomp Attack").equalsIgnoreCase("true")) {
- sound = true;
- }
-
- try {
- power = Float.parseFloat(config);
- } catch (Exception e) {
- power = 0.0f;
- }
- API.createAttack().stompAttack(player.getLocation(), power, fire, sound);
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void zombiesOnDeath(EntityDeathEvent event) {
- Entity entity = event.getEntity();
- if (API.isGiant(entity)) {
- if(API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Enabled").equalsIgnoreCase("true")){
- Location spawnLocation = entity.getLocation();
- Location loc = spawnLocation;
- String config = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Zombies to Spawn");
- String config2 = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Health");
- int zombAmt;
- double zombHealth;
-
- try {
- zombAmt = Integer.parseInt(config);
- zombHealth = Double.parseDouble(config2);
- }catch (Exception e) {
- zombAmt = 1;
- zombHealth = 20;
- }
- for (int i = 1; i <= zombAmt; i++){
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Attack Mechanisms.Spawn Zombies On Death.Baby Zombies").equalsIgnoreCase("true")) {
- Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
- ((Zombie) e).setBaby(true);
- ((Damageable) e).setMaxHealth(zombHealth);
- ((Damageable) e).setHealth(zombHealth);
- }
- else{
- Entity e = loc.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
- ((Damageable) e).setMaxHealth(zombHealth);
- ((Damageable) e).setHealth(zombHealth);
- }
- }
-
- }
- }
- }
-
- @EventHandler
- public void onGiantDrops(EntityDeathEvent event) throws IOException{
- Entity entity = event.getEntity();
- String string = API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Giant Stats.Experience");
- int exp;
-
- try {
- exp = Integer.parseInt(string);
- } catch (Exception e) {
- exp = 5;
- }
-
- if (API.isGiant(entity)) {
- if (API.getFileHandler().getProperty(Files.GIANT, "Giant Configuration.Sounds.Death").equalsIgnoreCase("true")) {
- entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
- }
- event.setDroppedExp(exp);
- List newDrop = API.getFileHandler().getPropertyList(Files.GIANT, "Giant Configuration.Giant Stats.Drops");
- if (newDrop == null || newDrop.contains("") || newDrop.toString().equalsIgnoreCase("[]")) {
- return;
- }
-
- List drops = new ArrayList();
- drops = API.createDrop().setDrop(entity, newDrop);
-
- event.getDrops().addAll(drops);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/listeners/JockeyListeners.java b/src/main/java/me/Mammothskier/Giants/listeners/JockeyListeners.java
deleted file mode 100644
index e41b877..0000000
--- a/src/main/java/me/Mammothskier/Giants/listeners/JockeyListeners.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package me.Mammothskier.Giants.listeners;
-
-import me.Mammothskier.Giants.Giants;
-import org.bukkit.event.Listener;
-
-public class JockeyListeners implements Listener {
- private Giants _jockeys;
-
-
- public JockeyListeners(Giants jockey) {
- _jockeys = jockey;
- _jockeys.getServer().getPluginManager().registerEvents(this, jockey);
- }
-}
diff --git a/src/main/java/me/Mammothskier/Giants/listeners/MagmaCubeListeners.java b/src/main/java/me/Mammothskier/Giants/listeners/MagmaCubeListeners.java
deleted file mode 100644
index c0679c4..0000000
--- a/src/main/java/me/Mammothskier/Giants/listeners/MagmaCubeListeners.java
+++ /dev/null
@@ -1,437 +0,0 @@
-package me.Mammothskier.Giants.listeners;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import me.Mammothskier.Giants.Giants;
-import me.Mammothskier.Giants.events.MagmaCubeSpawnEvent;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.enchantments.EnchantmentWrapper;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Damageable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.MagmaCube;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.entity.EntityTargetEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-
-public class MagmaCubeListeners implements Listener {
- private Giants _magmacubes;
-
- public MagmaCubeListeners(Giants magmacubes) {
- _magmacubes = magmacubes;
- _magmacubes.getServer().getPluginManager().registerEvents(this, magmacubes);
- }
-
- @EventHandler
- public void onMagmaCubeSpawn(MagmaCubeSpawnEvent event) {
- if (API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Debug Mode.Enabled").equalsIgnoreCase("true")) {
- String message = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Debug Mode.Debug Message");
- if (message != null) {
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.hasPermission("giants.debug") || player.hasPermission("giants.*") || player.isOp()) {
- message = ChatColor.translateAlternateColorCodes('&', message);
- String x = String.valueOf(Math.round(event.getLocation().getX()));
- String y = String.valueOf(Math.round(event.getLocation().getY()));
- String z = String.valueOf(Math.round(event.getLocation().getZ()));
- player.sendMessage(message.replace("%X", x).replace("%Y", y).replace("%Z", z).replace("{entity}", "Giant Magma Cube"));
- Bukkit.getConsoleSender().sendMessage(message.replace("%X", x).replace("%Y", y).replace("%Z", z).replace("{entity}", "Giant Magma Cube"));
- }
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.NORMAL)
- public void MagmaCubeSpawnEvent(CreatureSpawnEvent event) {
- Entity entity = event.getEntity();
- EntityType type = event.getEntityType();
- SpawnReason spawnReason = event.getSpawnReason();
- if(event.isCancelled()){
- return;
- }
-
- if (!API.getMagmaCubeSpawnWorlds().contains(entity.getWorld().getName())) {
- return;
- }
- if ((spawnReason == SpawnReason.NATURAL)) {
- if ((type == EntityType.ZOMBIE) || (type == EntityType.COW) || (type == EntityType.MUSHROOM_COW) || (type == EntityType.PIG_ZOMBIE) || (type == EntityType.ENDERMAN) || (type == EntityType.MAGMA_CUBE)) {
- String string = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Spawn Settings.Chance");
- float sRate;
- try {
- sRate = Float.parseFloat(string);
- } catch (NumberFormatException e) {
- sRate = 0;
- }
- float chance = 100 - sRate;
-
- Random rand = new Random();
- double choice = rand.nextInt(100) < chance ? 1 : 0;
- if (choice == 0) {
- Location location = event.getEntity().getLocation();
- double x = location.getX();
- double y = location.getY();
- double z = location.getZ();
-
- int x2 = (int) x;
- int y2 = (int) y;
- int z2 = (int) z;
-
- int spawnmagmacube = 1;
- double checkcount = 0.01;
- while (checkcount < 10) {
- y2 += checkcount;
-
- if (entity.getWorld().getBlockTypeIdAt(x2, y2, z2) != 0) {
- spawnmagmacube = 0;
- }
- checkcount++;
- }
- if (spawnmagmacube == 1) {
- MagmaCubeSpawnEvent MCSE = new MagmaCubeSpawnEvent(location);
- Bukkit.getServer().getPluginManager().callEvent(MCSE);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void ArrowDamage(EntityDamageByEntityEvent event){
- Entity entity = event.getEntity();
- if((event.getDamager() instanceof Arrow) && (API.isGiantMagmaCube(entity))){
- int damage;
- int s;
- String string2 = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Damage Settings.Arrows.Damage done by arrow");
- try {
- damage = Integer.parseInt(string2);
- } catch (Exception e) {
- damage = 10;
- }
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- if(damage == 0){
- event.setCancelled(true);
- return;
- }
- event.setDamage(damage + 0.0);
- }
- }
- }
-
- @EventHandler
- public void suffocationDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- int s;
- if (API.isGiantMagmaCube(entity)){
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Damage Settings.Block Damage.Allow Suffocation").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.SUFFOCATION || event.getCause() == DamageCause.FALLING_BLOCK){
- event.setCancelled(true);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void cactiDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- int s;
- if (API.isGiantMagmaCube(entity)){
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Damage Settings.Block Damage.Allow Cacti Damage").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.THORNS){
- event.setCancelled(true);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void damage(EntityDamageByEntityEvent event){
- Entity entity = event.getEntity();
- int s;
- if ((event.getDamager() instanceof Player) && (API.isGiantMagmaCube(entity))){
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- double damage = event.getDamage();
- double health = ((Damageable) event.getEntity()).getHealth();
- ((Damageable) entity).setHealth(Math.max(0, Math.min(health - damage, ((Damageable) entity).getMaxHealth())));
- event.setCancelled(true);
- }
- }
- }
-
- @EventHandler
- public void onFireAttack(EntityTargetEvent event) {
- String ticks1 = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Fire Attack.Ticks for Target");
- String ticks2 = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Fire Attack.Ticks for Magma Cube");
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int ticksTarget;
- int ticksGiant;
- int s;
- try {
- ticksTarget = Integer.parseInt(ticks1);
- ticksGiant = Integer.parseInt(ticks2);
- } catch (Exception e) {
- ticksTarget = 0;
- ticksGiant = 0;
- }
-
- if ((entity instanceof LivingEntity)) {
- if (API.isGiantMagmaCube(entity)) {
- if(!(target == null)){
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Fire Attack.Enabled").equalsIgnoreCase("true")) {
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Sounds.Fire Attack").equalsIgnoreCase("true")) {
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.FIRE, 1, 0);
- }
- try {
- event.getTarget().setFireTicks(ticksTarget);
- event.getEntity().setFireTicks(ticksGiant);
- } catch (Exception e) {
- }
- } else {
- event.setTarget(target);
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onLightningAttack(EntityTargetEvent event) {
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int s;
-
- if ((entity instanceof LivingEntity)) {
- if (API.isGiantMagmaCube(entity)) {
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Lightning Attack").equalsIgnoreCase("true")) {
- try {
- target.getLocation().getWorld().strikeLightning(target.getLocation());
- } catch (Exception e) {
- }
- } else {
- event.setTarget(target);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void LavaAttack(EntityTargetEvent event){
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int s;
-
- if((API.isGiantMagmaCube(entity)) && (target instanceof Player)){
- MagmaCube magmacube = (MagmaCube) event.getEntity();
- s = magmacube.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Lava Attack").equalsIgnoreCase("true")) {
- target.getLocation().getBlock().setType(Material.LAVA);
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Sounds.Lava Attack").equalsIgnoreCase("true")) {
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.EXPLODE, 1, 0);
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.LAVA_POP, 1, 0);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onStompAttack(PlayerMoveEvent event) {
- boolean sound = false;
- boolean fire = false;
- float power = 1.0f;
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Stomp Attack.Enabled").equalsIgnoreCase("true")) {
- Random pick = new Random();
- int chance = 0;
- int s;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
- if (API.isGiantMagmaCube(entity)) {
- MagmaCube magmacube = (MagmaCube) entity;
- s = magmacube.getSize();
- if (s > 4){
- if (entity.getNearbyEntities(3, 2, 3).contains(player)) {
- String config = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Stomp Attack.Explosion Power");
- if (API.getFileHandler().getProperty(Files.MAGMACUBE,
- "Magma Cube Configuration.Attack Mechanisms.Stomp Attack.Light Fire").equalsIgnoreCase("true")) {
- fire = true;
- }
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Sounds.Stomp Attack").equalsIgnoreCase("true")) {
- sound = true;
- }
-
- try {
- power = Float.parseFloat(config);
- } catch (Exception e) {
- power = 0.0f;
- }
- API.createAttack().stompAttack(player.getLocation(), power, fire, sound);
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void ThrownBoulderAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- boolean inRange = false;
- Random pick = new Random();
- int chance = 0;
- int bDamage;
- int s;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
-
- for (Entity entity : player.getNearbyEntities(15, 12, 15)) {
- if (API.isGiantMagmaCube(entity)) {
- MagmaCube magmacube = (MagmaCube) entity;
- s = magmacube.getSize();
- if (s > 4){
- if (entity.getNearbyEntities(15, 12, 15).contains(player) && !entity.getNearbyEntities(5, 3, 5).contains(player)) {
- inRange = true;
- }
- if (inRange == true) {
- if (chance == 50) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled").equalsIgnoreCase("true")) {
- String config = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage");
- try {
- bDamage = Integer.parseInt(config);
- } catch (Exception e) {
- bDamage = 1;
- }
-
- Vector direction = ((LivingEntity) entity).getEyeLocation().getDirection().multiply(2);
- Fireball fireball = entity.getWorld().spawn(((LivingEntity) entity).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
- fireball.setShooter((LivingEntity) entity);
- fireball.setYield(bDamage);
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Sounds.Throw Boulder Attack").equalsIgnoreCase("true")) {
- player.getLocation().getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1, 0);
- }
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onKickAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Kick Attack.Enabled").equalsIgnoreCase("true")) {
- int s;
- String config = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Attack Mechanisms.Kick Attack.Kick Height");
- double height;
-
- try {
- height = Double.parseDouble(config);
- } catch (Exception e) {
- height = 1;
- }
-
- Random pick = new Random();
- int chance = 0;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
- if (API.isGiantMagmaCube(entity)) {
- MagmaCube magmacube = (MagmaCube) entity;
- s = magmacube.getSize();
- if (s > 4){
- if (entity.getNearbyEntities(5, 5, 5).contains(player)) {
- player.setVelocity(new Vector(0, height, 0));
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Sounds.Kick Attack").equalsIgnoreCase("true")) {
- player.getLocation().getWorld().playSound(player.getLocation(), Sound.LAVA_POP, 1, 0);
- }
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void GiantMagmaCubeDrops(EntityDeathEvent event) {
- Entity entity = event.getEntity();
- String string = API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.Experience");
- int exp;
-
- try {
- exp = Integer.parseInt(string);
- } catch (Exception e) {
- exp = 5;
- }
-
- if (API.isGiantMagmaCube(entity)) {
- if (API.getFileHandler().getProperty(Files.MAGMACUBE, "Magma Cube Configuration.Sounds.Death").equalsIgnoreCase("true")) {
- entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
- }
- event.setDroppedExp(exp);
- List newDrop = API.getFileHandler().getPropertyList(Files.MAGMACUBE, "Magma Cube Configuration.Magma Cube Stats.Drops");
- if (newDrop == null || newDrop.contains("") || newDrop.toString().equalsIgnoreCase("[]")) {
- return;
- }
-
- List drops = new ArrayList();
-
- drops = API.createDrop().setDrop(entity, newDrop);
-
- event.getDrops().addAll(drops);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/listeners/SlimeListeners.java b/src/main/java/me/Mammothskier/Giants/listeners/SlimeListeners.java
deleted file mode 100644
index 29fd25e..0000000
--- a/src/main/java/me/Mammothskier/Giants/listeners/SlimeListeners.java
+++ /dev/null
@@ -1,438 +0,0 @@
-package me.Mammothskier.Giants.listeners;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import me.Mammothskier.Giants.Giants;
-import me.Mammothskier.Giants.events.SlimeSpawnEvent;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.utils.API;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.Sound;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Slime;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityTargetEvent;
-import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-
-public class SlimeListeners implements Listener {
- private Giants _slimes;
-
- public SlimeListeners(Giants slimes) {
- _slimes = slimes;
- _slimes.getServer().getPluginManager().registerEvents(this, slimes);
- }
-
- @EventHandler
- public void onSlimeSpawn(SlimeSpawnEvent event) {
- if (API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Debug Mode.Enabled").equalsIgnoreCase("true")) {
- String message = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Debug Mode.Debug Message");
- if (message != null) {
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.hasPermission("giants.debug") || player.hasPermission("giants.*") || player.isOp()) {
- message = ChatColor.translateAlternateColorCodes('&', message);
- String x = String.valueOf(Math.round(event.getLocation().getX()));
- String y = String.valueOf(Math.round(event.getLocation().getY()));
- String z = String.valueOf(Math.round(event.getLocation().getZ()));
- player.sendMessage(message.replace("%X", x).replace("%Y", y).replace("%Z", z).replace("{entity}", "Giant Slime"));
- Bukkit.getConsoleSender().sendMessage(message.replace("%X", x).replace("%Y", y).replace("%Z", z).replace("{entity}", "Giant Slime"));
- }
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.NORMAL)
- public void SlimeSpawnEvent(CreatureSpawnEvent event) {
- Entity entity = event.getEntity();
- EntityType type = event.getEntityType();
- SpawnReason spawnReason = event.getSpawnReason();
- if(event.isCancelled()){
- return;
- }
- if (!API.getSlimeSpawnWorlds().contains(entity.getWorld().getName())) {
- return;
- }
-
- if ((spawnReason == SpawnReason.NATURAL)) {
- if ((type == EntityType.ZOMBIE) || (type == EntityType.COW) || (type == EntityType.MUSHROOM_COW) || (type == EntityType.PIG_ZOMBIE) || (type == EntityType.ENDERMAN) || (type == EntityType.SLIME)) {
- String string = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Spawn Settings.Chance");
- float sRate;
- try {
- sRate = Float.parseFloat(string);
- } catch (NumberFormatException e) {
- sRate = 0;
- }
- float chance = 100 - sRate;
-
- Random rand = new Random();
- double choice = rand.nextInt(100) < chance ? 1 : 0;
- if (choice == 0) {
- Location location = event.getEntity().getLocation();
- double x = location.getX();
- double y = location.getY();
- double z = location.getZ();
-
- int x2 = (int) x;
- int y2 = (int) y;
- int z2 = (int) z;
-
- int spawnslime = 1;
- double checkcount = 0.01;
- while (checkcount < 10) {
- y2 += checkcount;
-
- if (entity.getWorld().getBlockTypeIdAt(x2, y2, z2) != 0) {
- spawnslime = 0;
- }
- checkcount++;
- }
- if (spawnslime == 1) {
- SlimeSpawnEvent SSE = new SlimeSpawnEvent(location);
- Bukkit.getServer().getPluginManager().callEvent(SSE);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void ArrowDamage(EntityDamageByEntityEvent event){
- Entity entity = event.getEntity();
- if((event.getDamager() instanceof Arrow) && (API.isGiantSlime(entity))){
- int damage;
- int s;
- String string = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Damage Settings.Arrows.Damage done by arrow");
- try {
- damage = Integer.parseInt(string);
- } catch (Exception e) {
- damage = 10;
- }
- Slime slime = (Slime) event.getEntity();
- s = slime.getSize();
- if (s > 4){
- if(damage == 0){
- event.setCancelled(true);
- return;
- }
- event.setDamage(damage + 0.0);
- }
- }
- }
-
- @EventHandler
- public void fireDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- int s;
- if (API.isGiantSlime(entity)){
- Slime slime = (Slime) event.getEntity();
- s = slime.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Damage Settings.Fire.Allow Fire Damage").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK){
- event.setCancelled(true);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void suffocationDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- int s;
- if (API.isGiantSlime(entity)){
- Slime slime = (Slime) event.getEntity();
- s = slime.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Damage Settings.Block Damage.Allow Suffocation").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.SUFFOCATION || event.getCause() == DamageCause.FALLING_BLOCK){
- event.setCancelled(true);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void cactiDamage(EntityDamageEvent event){
- Entity entity = event.getEntity();
- int s;
- if (API.isGiantSlime(entity)){
- Slime slime = (Slime) event.getEntity();
- s = slime.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Damage Settings.Block Damage.Allow Cacti Damage").equalsIgnoreCase("false")){
- if (event.getCause() == DamageCause.THORNS){
- event.setCancelled(true);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onLightningAttack(EntityTargetEvent event) {
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int s;
-
- if ((entity instanceof LivingEntity)) {
- if (API.isGiantSlime(entity)) {
- Slime slime = (Slime) event.getEntity();
- s = slime.getSize();
- if (s > 4){
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Lightning Attack").equalsIgnoreCase("true")) {
- try {
- target.getLocation().getWorld().strikeLightning(target.getLocation());
- } catch (Exception e) {
- }
- } else {
- event.setTarget(target);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onFireAttack(EntityTargetEvent event) {
- String ticks1 = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Fire Attack.Ticks for Target");
- String ticks2 = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Fire Attack.Ticks for Slime");
- Entity entity = event.getEntity();
- Entity target = event.getTarget();
- int ticksTarget;
- int ticksGiant;
- int s;
- try {
- ticksTarget = Integer.parseInt(ticks1);
- ticksGiant = Integer.parseInt(ticks2);
- } catch (Exception e) {
- ticksTarget = 0;
- ticksGiant = 0;
- }
-
- if ((entity instanceof LivingEntity)) {
- if (API.isGiantSlime(entity)) {
- Slime slime = (Slime) event.getEntity();
- s = slime.getSize();
- if (s > 4){
- if(!(target == null)){
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Fire Attack.Enabled").equalsIgnoreCase("true")) {
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Sounds.Fire Attack").equalsIgnoreCase("true")) {
- target.getLocation().getWorld().playSound(target.getLocation(), Sound.FIRE, 1, 0);
- }
- try {
- event.getTarget().setFireTicks(ticksTarget);
- event.getEntity().setFireTicks(ticksGiant);
- } catch (Exception e) {
- }
- } else {
- event.setTarget(target);
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void ThrownBoulderAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- boolean inRange = false;
- Random pick = new Random();
- int chance = 0;
- int bDamage;
- int s;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
-
- for (Entity entity : player.getNearbyEntities(15, 12, 15)) {
- if (API.isGiantMagmaCube(entity)) {
- Slime slime = (Slime) entity;
- s = slime.getSize();
- if (s > 4){
- if (entity.getNearbyEntities(15, 12, 15).contains(player) && !entity.getNearbyEntities(5, 3, 5).contains(player)) {
- inRange = true;
- }
- if (inRange == true) {
- if (chance == 50) {
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Throw Boulder Attack.Enabled").equalsIgnoreCase("true")) {
- String config = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Throw Boulder Attack.Block Damage");
- try {
- bDamage = Integer.parseInt(config);
- } catch (Exception e) {
- bDamage = 1;
- }
- Vector direction = ((LivingEntity) entity).getEyeLocation().getDirection().multiply(2);
- Fireball fireball = entity.getWorld().spawn(((LivingEntity) entity).getEyeLocation().add(direction.getX(), direction.getY() - 5, direction.getZ()), Fireball.class);
- fireball.setShooter((LivingEntity) entity);
- fireball.setYield(bDamage);
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Sounds.Throw Boulder Attack").equalsIgnoreCase("true")) {
- player.getLocation().getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1, 0);
- }
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onKickAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Kick Attack.Enabled").equalsIgnoreCase("true")) {
- String config = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Kick Attack.Kick Height");
- double height;
- int s;
-
- try {
- height = Double.parseDouble(config);
- } catch (Exception e) {
- height = 1;
- }
-
- Random pick = new Random();
- int chance = 0;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
- if (API.isGiantSlime(entity)) {
- Slime slime = (Slime) entity;
- s = slime.getSize();
- if (s > 4){
- if (entity.getNearbyEntities(5, 5, 5).contains(player)) {
- player.setVelocity(new Vector(0, height, 0));
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Sounds.Kick Attack").equalsIgnoreCase("true")) {
- player.getLocation().getWorld().playSound(player.getLocation(), Sound.LAVA_POP, 1, 0);
- }
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void onStompAttack(PlayerMoveEvent event) {
- boolean sound = false;
- boolean fire = false;
- float power = 1.0f;
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Stomp Attack.Enabled").equalsIgnoreCase("true")) {
- Random pick = new Random();
- int chance = 0;
- int s;
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
- if (API.isGiantSlime(entity)) {
- Slime slime = (Slime) entity;
- s = slime.getSize();
- if (s > 4){
- if (entity.getNearbyEntities(3, 2, 3).contains(player)) {
- String config = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Stomp Attack.Explosion Power");
- if (API.getFileHandler().getProperty(Files.SLIME,
- "Slime Configuration.Attack Mechanisms.Stomp Attack.Light Fire").equalsIgnoreCase("true")) {
- fire = true;
- }
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Sounds.Stomp Attack").equalsIgnoreCase("true")) {
- sound = true;
- }
-
- try {
- power = Float.parseFloat(config);
- } catch (Exception e) {
- power = 0.0f;
- }
- API.createAttack().stompAttack(player.getLocation(), power, fire, sound);
- }
- }
- }
- }
- }
- }
- }
-
- @EventHandler
- public void poisonAttack(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Poison Attack").equalsIgnoreCase("true")){
- Random pick = new Random();
- int chance = 0;
- double length;
- String config = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Attack Mechanisms.Poison Attack.length");
- try {
- length = Double.parseDouble(config);
- } catch (Exception e) {
- length = 5;
- }
- for (int counter = 1; counter <= 1; counter++) {
- chance = 1 + pick.nextInt(100);
- }
- if (chance == 50) {
- for (Entity entity : player.getNearbyEntities(3, 2, 3)) {
- if (API.isGiantSlime(entity)) {
- API.createAttack().poisonAttack(player, length);
- }
- }
- }
- }
- }
-
- @EventHandler
- public void GiantSlimeDrops(EntityDeathEvent event) {
- Entity entity = event.getEntity();
- String string = API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Slime Stats.Experience");
- int exp;
-
- try {
- exp = Integer.parseInt(string);
- } catch (Exception e) {
- exp = 5;
- }
-
- if (API.isGiantSlime(entity)) {
- if (API.getFileHandler().getProperty(Files.SLIME, "Slime Configuration.Sounds.Death").equalsIgnoreCase("true")) {
- entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.ENDERDRAGON_DEATH, 1, 0);
- }
- event.setDroppedExp(exp);
- List newDrop = API.getFileHandler().getPropertyList(Files.SLIME, "Slime Configuration.Slime Stats.Drops");
- if (newDrop == null || newDrop.contains("") || newDrop.toString().equalsIgnoreCase("[]")) {
- return;
- }
-
- List drops = new ArrayList();
-
- drops = API.createDrop().setDrop(entity, newDrop);
-
- event.getDrops().addAll(drops);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/Mammothskier/Giants/utils/API.java b/src/main/java/me/Mammothskier/Giants/utils/API.java
deleted file mode 100644
index f2c5379..0000000
--- a/src/main/java/me/Mammothskier/Giants/utils/API.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package me.Mammothskier.Giants.utils;
-
-import java.util.List;
-
-import me.Mammothskier.Giants.Attacks;
-import me.Mammothskier.Giants.Commands;
-import me.Mammothskier.Giants.Giants;
-import me.Mammothskier.Giants.events.JockeySpawnEvent;
-import me.Mammothskier.Giants.files.FileHandler;
-import me.Mammothskier.Giants.files.Files;
-import me.Mammothskier.Giants.listeners.GiantListeners;
-import me.Mammothskier.Giants.listeners.JockeyListeners;
-import me.Mammothskier.Giants.listeners.MagmaCubeListeners;
-import me.Mammothskier.Giants.listeners.SlimeListeners;
-
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Ghast;
-import org.bukkit.entity.Giant;
-import org.bukkit.entity.MagmaCube;
-import org.bukkit.entity.Slime;
-import org.bukkit.scheduler.BukkitScheduler;
-
-public class API {
- private static Giants _giants;
- private Commands commands;
- private static FileHandler fileHandler;
- private static Attacks Attacks;
- private static DropsManager drops;
-
- public API(Giants giants) {
- _giants = giants;
- new GiantListeners(_giants);
- new SlimeListeners(_giants);
- new MagmaCubeListeners(_giants);
- new JockeyListeners(_giants);
- commands = new Commands(_giants);
- _giants.getCommand("giants").setExecutor(commands);
- fileHandler = new FileHandler(_giants);
- Attacks = new Attacks(_giants);
- drops = new DropsManager(_giants);
-
- if (getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey.Warning.Enabled").equalsIgnoreCase("true")) {
- BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
- scheduler.scheduleSyncRepeatingTask(_giants, new Runnable() {
-
- @Override
- public void run() {
- for (World world : _giants.getServer().getWorlds()) {
- for (Entity entity : world.getEntities()) {
- if ((entity instanceof Slime) || (entity instanceof MagmaCube) || (entity instanceof Ghast)) {
- for (Entity entity2 : entity.getNearbyEntities(15, 12, 15)) {
- if ((entity2 instanceof Giant) && (entity.getPassenger() == null) && (entity2.getVehicle() == null)) {
- Entity passenger = entity2;
- JockeySpawnEvent JSE = new JockeySpawnEvent(entity, passenger);
- Bukkit.getServer().getPluginManager().callEvent(JSE);
- }
- }
- }
- }
- }
- }
- }, 0L, 20L);
- }
- }
-
- public static boolean isGiant(Entity entity) {
- String config = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant");
- if (config.equalsIgnoreCase("false")){
- return false;
- }
- return entity instanceof Giant;
- }
-
- public static boolean isGiantSlime(Entity entity) {
- String config = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Slime");
- if (config.equalsIgnoreCase("false")){
- return false;
- }
-
- if (entity instanceof Slime){
- Slime slime = (Slime) entity;
- if ( slime.getSize() > 4){
- return entity instanceof Slime;
- }
- }
- return false;
- }
-
- public static boolean isGiantMagmaCube(Entity entity) {
- String config = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Magma Cube");
- if (config.equalsIgnoreCase("false")){
- return false;
- }
- if (entity instanceof MagmaCube){
- MagmaCube magmacube = (MagmaCube) entity;
- if (magmacube.getSize() > 4){
- return entity instanceof MagmaCube;
- }
- }
- return false;
- }
-
- public static boolean isGiantJockey(Entity entity) {
- String config = API.getFileHandler().getProperty(Files.CONFIG, "Giants Configuration.Entities.Giant Jockey");
- if (config.equalsIgnoreCase("false")){
- return false;
- }
- switch (entity.getType()) {
- case GIANT:
- if ((isGiantSlime(entity.getVehicle())) || (isGiantMagmaCube(entity.getVehicle())) || (entity.getVehicle().getType() == EntityType.GHAST)) {
- return true;
- }
- break;
- case SLIME:
- if ((isGiantSlime(entity)) && (entity.getPassenger().getType() == EntityType.GIANT)) {
- return true;
- }
- break;
- case MAGMA_CUBE:
- if ((isGiantMagmaCube(entity)) && (entity.getPassenger().getType() == EntityType.GIANT)) {
- return true;
- }
- break;
- case GHAST:
- if (entity.getPassenger().getType() == EntityType.GIANT) {
- return true;
- }
- break;
- default:
- break;
- }
- return false;
- }
-
- public static List getGiantSpawnWorlds() {
- return getFileHandler().getPropertyList(Files.GIANT, "Giant Configuration.Spawn Settings.Worlds");
- }
-
- public static List getSlimeSpawnWorlds() {
- return getFileHandler().getPropertyList(Files.SLIME, "Slime Configuration.Spawn Settings.Worlds");
- }
-
- public static List getMagmaCubeSpawnWorlds() {
- return getFileHandler().getPropertyList(Files.MAGMACUBE, "Magma Cube Configuration.Spawn Settings.Worlds");
- }
-
- public static List getJockeySpawnWorlds() {
- return getFileHandler().getPropertyList(Files.JOCKEY, "Jockey Configuration.Spawn Settings.Worlds");
- }
-
- public static FileHandler getFileHandler() {
- return fileHandler;
- }
-
- public static Attacks createAttack() {
- return Attacks;
- }
-
- public static DropsManager createDrop() {
- return drops;
- }
-}
\ No newline at end of file
diff --git a/v1_10_R1/pom.xml b/v1_10_R1/pom.xml
new file mode 100644
index 0000000..6ed9753
--- /dev/null
+++ b/v1_10_R1/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+ Giants-v1_10_R1
+ 2.0-SNAPSHOT
+ Giants for v1_10_R1
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.10-R0.1-SNAPSHOT
+ jar
+
+
+
+ me.Mammothskier
+ Giants-Files
+ 1.1-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ true
+
+
+
diff --git a/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomEntityGiantZombie.java b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..8d3486a
--- /dev/null
+++ b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomEntityGiantZombie.java
@@ -0,0 +1,61 @@
+package me.Mammothskier.Giants.entity.nms.v1_10_R1;
+
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.Files.FileHandler;
+import net.minecraft.server.v1_10_R1.*;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ private static final DataWatcherObject by = DataWatcher.a(CustomEntityGiantZombie.class, DataWatcherRegistry.h);
+
+ public CustomEntityGiantZombie (World world) {
+ super(world);
+ }
+
+ protected void r () {
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new CustomPathfinderGoalGiantZombieAttack(this, 1.0D, false));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ public void a(boolean flag) {
+ this.getDataWatcher().set(CustomEntityGiantZombie.by, Boolean.valueOf(flag));
+ }
+
+ @Override
+ protected void initAttributes() {
+ super.initAttributes();
+ String string = FileHandler.getInstanceProperty(ConfigValues.zombieSpeed);
+ double speed;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
+ }
+
+ protected void o() {
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ if (FileHandler.getInstanceProperty(ConfigValues.zombieAggressiveToVillage).equalsIgnoreCase("false"))
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
+ }
+
+ public float a(BlockPosition position) {
+ return 0.5F - this.world.n(position);
+ }
+}
diff --git a/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomEntityType.java b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomEntityType.java
new file mode 100644
index 0000000..d2b837a
--- /dev/null
+++ b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_10_R1;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_10_R1.BiomeBase;
+import net.minecraft.server.v1_10_R1.BiomeBase.BiomeMeta;
+import net.minecraft.server.v1_10_R1.Entity;
+import net.minecraft.server.v1_10_R1.EntityInsentient;
+import net.minecraft.server.v1_10_R1.EntityTypes;
+import net.minecraft.server.v1_10_R1.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.i){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "u", "v", "w", "x" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "u", "v", "w", "x" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomPathfinderGoalGiantZombieAttack.java b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomPathfinderGoalGiantZombieAttack.java
new file mode 100644
index 0000000..c4c1dc3
--- /dev/null
+++ b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/CustomPathfinderGoalGiantZombieAttack.java
@@ -0,0 +1,38 @@
+package me.Mammothskier.Giants.entity.nms.v1_10_R1;
+
+import net.minecraft.server.v1_10_R1.PathfinderGoalMeleeAttack;
+
+public class CustomPathfinderGoalGiantZombieAttack extends PathfinderGoalMeleeAttack {
+
+ private final CustomEntityGiantZombie h;
+ private int i;
+
+ public CustomPathfinderGoalGiantZombieAttack(CustomEntityGiantZombie entityzombie, double d0, boolean flag) {
+ super(entityzombie, d0, flag);
+ this.h = entityzombie;
+ }
+
+ public void c() {
+ super.c();
+ this.setI(0);
+ }
+
+ public void d() {
+ super.d();
+ this.h.a(false);
+ }
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/EntityCreator.java b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/EntityCreator.java
new file mode 100644
index 0000000..b61655c
--- /dev/null
+++ b/v1_10_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_10_R1/EntityCreator.java
@@ -0,0 +1,17 @@
+package me.Mammothskier.Giants.entity.nms.v1_10_R1;
+
+import net.minecraft.server.v1_10_R1.World;
+
+import org.bukkit.Location;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_10_R1/src/test/java/me/Mammothskier/Giants_v1_10_R1/AppTest.java b/v1_10_R1/src/test/java/me/Mammothskier/Giants_v1_10_R1/AppTest.java
new file mode 100644
index 0000000..741adf7
--- /dev/null
+++ b/v1_10_R1/src/test/java/me/Mammothskier/Giants_v1_10_R1/AppTest.java
@@ -0,0 +1,38 @@
+package me.Mammothskier.Giants_v1_10_R1;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
diff --git a/v1_7_R3/pom.xml b/v1_7_R3/pom.xml
new file mode 100644
index 0000000..a1f46f7
--- /dev/null
+++ b/v1_7_R3/pom.xml
@@ -0,0 +1,30 @@
+
+ 4.0.0
+
+ Giants for v1_7_R3
+ Giants-v1_7_R3
+ 2.0-SNAPSHOT
+ jar
+
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+
+
+ org.bukkit
+ bukkit
+ 1.7.9-R0.2
+ jar
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.7.9-R0.2
+ jar
+
+
+
\ No newline at end of file
diff --git a/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/CustomEntityGiantZombie.java b/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..c2a7f55
--- /dev/null
+++ b/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/CustomEntityGiantZombie.java
@@ -0,0 +1,85 @@
+package me.Mammothskier.Giants.entity.nms.v1_7_R3;
+
+import java.lang.reflect.Field;
+
+import org.bukkit.craftbukkit.v1_7_R3.util.UnsafeList;
+
+import net.minecraft.server.v1_7_R3.EntityGiantZombie;
+import net.minecraft.server.v1_7_R3.EntityHuman;
+import net.minecraft.server.v1_7_R3.EntityIronGolem;
+import net.minecraft.server.v1_7_R3.EntitySkeleton;
+import net.minecraft.server.v1_7_R3.EntityVillager;
+import net.minecraft.server.v1_7_R3.PathfinderGoalFloat;
+import net.minecraft.server.v1_7_R3.PathfinderGoalHurtByTarget;
+import net.minecraft.server.v1_7_R3.PathfinderGoalLookAtPlayer;
+import net.minecraft.server.v1_7_R3.PathfinderGoalMeleeAttack;
+import net.minecraft.server.v1_7_R3.PathfinderGoalMoveThroughVillage;
+import net.minecraft.server.v1_7_R3.PathfinderGoalMoveTowardsRestriction;
+import net.minecraft.server.v1_7_R3.PathfinderGoalNearestAttackableTarget;
+import net.minecraft.server.v1_7_R3.PathfinderGoalRandomLookaround;
+import net.minecraft.server.v1_7_R3.PathfinderGoalRandomStroll;
+import net.minecraft.server.v1_7_R3.PathfinderGoalSelector;
+import net.minecraft.server.v1_7_R3.World;
+import net.minecraft.server.v1_7_R3.GenericAttributes;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ public CustomEntityGiantZombie(World world) {
+ super(world);
+ 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());
+ this.n();
+ } catch (Exception exc) {
+ exc.printStackTrace();
+ }
+
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntitySkeleton.class, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ @Override
+ protected void aC() {
+ super.aW();
+ String string = " ";//Giants.getProperty(Files.ENTITIES, "Entities Configuration.Stats.Speed.Giant Zombie");
+ double speed = 1;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.b).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.a).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.e).setValue(50.0D);
+ }
+
+ protected void n() {
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1, true));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1, true));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, 0, true));
+ }
+}
diff --git a/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/CustomEntityType.java b/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/CustomEntityType.java
new file mode 100644
index 0000000..0838146
--- /dev/null
+++ b/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/CustomEntityType.java
@@ -0,0 +1,181 @@
+package me.Mammothskier.Giants.entity.nms.v1_7_R3;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_7_R3.BiomeBase;
+import net.minecraft.server.v1_7_R3.BiomeMeta;
+import net.minecraft.server.v1_7_R3.Entity;
+import net.minecraft.server.v1_7_R3.EntityInsentient;
+import net.minecraft.server.v1_7_R3.EntityTypes;
+import net.minecraft.server.v1_7_R3.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "as", "at", "au", "av" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "as", "at", "au", "av" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/EntityCreator.java b/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/EntityCreator.java
new file mode 100644
index 0000000..ed200f7
--- /dev/null
+++ b/v1_7_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R3/EntityCreator.java
@@ -0,0 +1,19 @@
+package me.Mammothskier.Giants.entity.nms.v1_7_R3;
+
+import net.minecraft.server.v1_7_R3.World;
+
+import me.Mammothskier.Giants.entity.nms.v1_7_R3.CustomEntityGiantZombie;
+
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_7_R3.CraftWorld;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_7_R4/pom.xml b/v1_7_R4/pom.xml
new file mode 100644
index 0000000..fde9237
--- /dev/null
+++ b/v1_7_R4/pom.xml
@@ -0,0 +1,24 @@
+
+ 4.0.0
+
+ Giants for v1_7_R4
+ Giants-v1_7_R4
+ 2.0-SNAPSHOT
+ jar
+
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.7.10-R0.1-SNAPSHOT
+ jar
+
+
+
+
\ No newline at end of file
diff --git a/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/CustomEntityGiantZombie.java b/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..778d20e
--- /dev/null
+++ b/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/CustomEntityGiantZombie.java
@@ -0,0 +1,85 @@
+package me.Mammothskier.Giants.entity.nms.v1_7_R4;
+
+import java.lang.reflect.Field;
+
+import org.bukkit.craftbukkit.v1_7_R4.util.UnsafeList;
+
+import net.minecraft.server.v1_7_R4.EntityGiantZombie;
+import net.minecraft.server.v1_7_R4.EntityHuman;
+import net.minecraft.server.v1_7_R4.EntityIronGolem;
+import net.minecraft.server.v1_7_R4.EntitySkeleton;
+import net.minecraft.server.v1_7_R4.EntityVillager;
+import net.minecraft.server.v1_7_R4.PathfinderGoalFloat;
+import net.minecraft.server.v1_7_R4.PathfinderGoalHurtByTarget;
+import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
+import net.minecraft.server.v1_7_R4.PathfinderGoalMeleeAttack;
+import net.minecraft.server.v1_7_R4.PathfinderGoalMoveThroughVillage;
+import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
+import net.minecraft.server.v1_7_R4.PathfinderGoalNearestAttackableTarget;
+import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
+import net.minecraft.server.v1_7_R4.PathfinderGoalRandomStroll;
+import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
+import net.minecraft.server.v1_7_R4.World;
+import net.minecraft.server.v1_7_R4.GenericAttributes;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ public CustomEntityGiantZombie(World world) {
+ super(world);
+ 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());
+ this.n();
+ } catch (Exception exc) {
+ exc.printStackTrace();
+ }
+
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntitySkeleton.class, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ @Override
+ protected void aD() {
+ super.aW();
+ String string = " ";//Giants.getProperty(Files.ENTITIES, "Entities Configuration.Stats.Speed.Giant Zombie");
+ double speed = 1;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.b).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.e).setValue(50.0D);
+ }
+
+ protected void n() {
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1, true));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1, true));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, 0, true));
+ }
+}
diff --git a/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/CustomEntityType.java b/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/CustomEntityType.java
new file mode 100644
index 0000000..bc7edbd
--- /dev/null
+++ b/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_7_R4;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_7_R4.BiomeBase;
+import net.minecraft.server.v1_7_R4.BiomeMeta;
+import net.minecraft.server.v1_7_R4.Entity;
+import net.minecraft.server.v1_7_R4.EntityInsentient;
+import net.minecraft.server.v1_7_R4.EntityTypes;
+import net.minecraft.server.v1_7_R4.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.getBiomes()){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "as", "at", "au", "av" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "as", "at", "au", "av" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/EntityCreator.java b/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/EntityCreator.java
new file mode 100644
index 0000000..724345d
--- /dev/null
+++ b/v1_7_R4/src/main/java/me/Mammothskier/Giants/entity/nms/v1_7_R4/EntityCreator.java
@@ -0,0 +1,19 @@
+package me.Mammothskier.Giants.entity.nms.v1_7_R4;
+
+import net.minecraft.server.v1_7_R4.World;
+
+import me.Mammothskier.Giants.entity.nms.v1_7_R4.CustomEntityGiantZombie;
+
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_8_R1/pom.xml b/v1_8_R1/pom.xml
new file mode 100644
index 0000000..108dac9
--- /dev/null
+++ b/v1_8_R1/pom.xml
@@ -0,0 +1,30 @@
+
+ 4.0.0
+
+ Giants for v1_8_R1
+ Giants-v1_8_R1
+ 2.0-SNAPSHOT
+ jar
+
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.8-R0.1-SNAPSHOT
+ jar
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/groups/public/
+
+
+
\ No newline at end of file
diff --git a/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/CustomEntityGiantZombie.java b/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..1532203
--- /dev/null
+++ b/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/CustomEntityGiantZombie.java
@@ -0,0 +1,84 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R1;
+
+import java.lang.reflect.Field;
+
+import org.bukkit.craftbukkit.v1_8_R1.util.UnsafeList;
+
+import net.minecraft.server.v1_8_R1.EntityGiantZombie;
+import net.minecraft.server.v1_8_R1.EntityHuman;
+import net.minecraft.server.v1_8_R1.EntityIronGolem;
+import net.minecraft.server.v1_8_R1.EntityPigZombie;
+import net.minecraft.server.v1_8_R1.EntitySkeleton;
+import net.minecraft.server.v1_8_R1.EntityVillager;
+import net.minecraft.server.v1_8_R1.PathfinderGoalFloat;
+import net.minecraft.server.v1_8_R1.PathfinderGoalHurtByTarget;
+import net.minecraft.server.v1_8_R1.PathfinderGoalLookAtPlayer;
+import net.minecraft.server.v1_8_R1.PathfinderGoalMeleeAttack;
+import net.minecraft.server.v1_8_R1.PathfinderGoalMoveThroughVillage;
+import net.minecraft.server.v1_8_R1.PathfinderGoalMoveTowardsRestriction;
+import net.minecraft.server.v1_8_R1.PathfinderGoalNearestAttackableTarget;
+import net.minecraft.server.v1_8_R1.PathfinderGoalRandomLookaround;
+import net.minecraft.server.v1_8_R1.PathfinderGoalRandomStroll;
+import net.minecraft.server.v1_8_R1.PathfinderGoalSelector;
+import net.minecraft.server.v1_8_R1.World;
+import net.minecraft.server.v1_8_R1.BlockPosition;
+import net.minecraft.server.v1_8_R1.GenericAttributes;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ public CustomEntityGiantZombie(World world) {
+ super(world);
+ 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());
+ this.n();
+ } catch (Exception exc) {
+ exc.printStackTrace();
+ }
+
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntitySkeleton.class, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ @Override
+ protected void aW() {
+ super.aW();
+ this.getAttributeInstance(GenericAttributes.b).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.d).setValue(0.5D);
+ this.getAttributeInstance(GenericAttributes.e).setValue(50.0D);
+ }
+
+ protected void n() {
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
+ }
+
+ public float a(BlockPosition position) {
+ return 0.5F - this.world.o(position);
+ }
+}
diff --git a/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/CustomEntityType.java b/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/CustomEntityType.java
new file mode 100644
index 0000000..cc50044
--- /dev/null
+++ b/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R1;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_8_R1.BiomeBase;
+import net.minecraft.server.v1_8_R1.BiomeMeta;
+import net.minecraft.server.v1_8_R1.Entity;
+import net.minecraft.server.v1_8_R1.EntityInsentient;
+import net.minecraft.server.v1_8_R1.EntityTypes;
+import net.minecraft.server.v1_8_R1.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.getBiomes()){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "at", "au", "av", "aw" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "at", "au", "av", "aw" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/EntityCreator.java b/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/EntityCreator.java
new file mode 100644
index 0000000..55cc365
--- /dev/null
+++ b/v1_8_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R1/EntityCreator.java
@@ -0,0 +1,17 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R1;
+
+import net.minecraft.server.v1_8_R1.World;
+
+import org.bukkit.Location;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_8_R2/pom.xml b/v1_8_R2/pom.xml
new file mode 100644
index 0000000..7a4347e
--- /dev/null
+++ b/v1_8_R2/pom.xml
@@ -0,0 +1,36 @@
+
+ 4.0.0
+
+ Giants for v1_8_R2
+ Giants-v1_8_R2
+ 2.0-SNAPSHOT
+ jar
+
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+
+
+ org.bukkit
+ bukkit
+ 1.8.3-R0.1-SNAPSHOT
+ jar
+
+
+ org.bukkit
+ craftbukkit
+ 1.8.3-R0.1-SNAPSHOT
+ jar
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/groups/public/
+
+
+
\ No newline at end of file
diff --git a/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/CustomEntityGiantZombie.java b/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..72eacb3
--- /dev/null
+++ b/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/CustomEntityGiantZombie.java
@@ -0,0 +1,92 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R2;
+
+import java.lang.reflect.Field;
+
+import org.bukkit.craftbukkit.v1_8_R2.util.UnsafeList;
+
+import net.minecraft.server.v1_8_R2.EntityGiantZombie;
+import net.minecraft.server.v1_8_R2.EntityHuman;
+import net.minecraft.server.v1_8_R2.EntityIronGolem;
+import net.minecraft.server.v1_8_R2.EntitySkeleton;
+import net.minecraft.server.v1_8_R2.EntityVillager;
+import net.minecraft.server.v1_8_R2.GenericAttributes;
+import net.minecraft.server.v1_8_R2.PathfinderGoalFloat;
+import net.minecraft.server.v1_8_R2.PathfinderGoalHurtByTarget;
+import net.minecraft.server.v1_8_R2.PathfinderGoalLookAtPlayer;
+import net.minecraft.server.v1_8_R2.PathfinderGoalMeleeAttack;
+import net.minecraft.server.v1_8_R2.PathfinderGoalMoveThroughVillage;
+import net.minecraft.server.v1_8_R2.PathfinderGoalMoveTowardsRestriction;
+import net.minecraft.server.v1_8_R2.PathfinderGoalNearestAttackableTarget;
+import net.minecraft.server.v1_8_R2.PathfinderGoalRandomLookaround;
+import net.minecraft.server.v1_8_R2.PathfinderGoalRandomStroll;
+import net.minecraft.server.v1_8_R2.PathfinderGoalSelector;
+import net.minecraft.server.v1_8_R2.World;
+import net.minecraft.server.v1_8_R2.BlockPosition;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public CustomEntityGiantZombie(World world) {
+ super(world);
+ 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());
+ this.n();
+ } catch (Exception exc) {
+ exc.printStackTrace();
+ }
+
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntitySkeleton.class, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ @Override
+ protected void initAttributes() {
+ super.initAttributes();
+ String string = " ";// Giants.getProperty(Files.ENTITIES, "Entities Configuration.Stats.Speed.Giant Zombie");
+ double speed = 1;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.b).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.e).setValue(50.0D);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected void n() {
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, EntityHuman.class));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
+ }
+
+ public float a(BlockPosition position) {
+ return 0.5F - this.world.o(position);
+ }
+}
diff --git a/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/CustomEntityType.java b/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/CustomEntityType.java
new file mode 100644
index 0000000..0705bfc
--- /dev/null
+++ b/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R2;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_8_R2.BiomeBase;
+import net.minecraft.server.v1_8_R2.BiomeBase.BiomeMeta;
+import net.minecraft.server.v1_8_R2.Entity;
+import net.minecraft.server.v1_8_R2.EntityInsentient;
+import net.minecraft.server.v1_8_R2.EntityTypes;
+import net.minecraft.server.v1_8_R2.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.getBiomes()){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "at", "au", "av", "aw" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "at", "au", "av", "aw" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/EntityCreator.java b/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/EntityCreator.java
new file mode 100644
index 0000000..56af3b3
--- /dev/null
+++ b/v1_8_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R2/EntityCreator.java
@@ -0,0 +1,19 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R2;
+
+import net.minecraft.server.v1_8_R2.World;
+
+import me.Mammothskier.Giants.entity.nms.v1_8_R2.CustomEntityGiantZombie;
+
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_8_R3/pom.xml b/v1_8_R3/pom.xml
new file mode 100644
index 0000000..8bed2f2
--- /dev/null
+++ b/v1_8_R3/pom.xml
@@ -0,0 +1,36 @@
+
+ 4.0.0
+
+ Giants for v1_8_R3
+ Giants-v1_8_R3
+ 2.0-SNAPSHOT
+ jar
+
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.8.7-R0.1-SNAPSHOT
+ jar
+
+
+
+ me.Mammothskier
+ Giants-Files
+ 1.1-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ false
+
+
+
\ No newline at end of file
diff --git a/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/CustomEntityGiantZombie.java b/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..4b3eb3e
--- /dev/null
+++ b/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/CustomEntityGiantZombie.java
@@ -0,0 +1,91 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R3;
+
+import java.lang.reflect.Field;
+
+import org.bukkit.craftbukkit.v1_8_R3.util.UnsafeList;
+
+import net.minecraft.server.v1_8_R3.EntityGiantZombie;
+import net.minecraft.server.v1_8_R3.EntityHuman;
+import net.minecraft.server.v1_8_R3.EntityIronGolem;
+import net.minecraft.server.v1_8_R3.EntitySkeleton;
+import net.minecraft.server.v1_8_R3.EntityVillager;
+import net.minecraft.server.v1_8_R3.PathfinderGoalFloat;
+import net.minecraft.server.v1_8_R3.PathfinderGoalHurtByTarget;
+import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
+import net.minecraft.server.v1_8_R3.PathfinderGoalMeleeAttack;
+import net.minecraft.server.v1_8_R3.PathfinderGoalMoveThroughVillage;
+import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction;
+import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget;
+import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
+import net.minecraft.server.v1_8_R3.PathfinderGoalRandomStroll;
+import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
+import net.minecraft.server.v1_8_R3.World;
+import net.minecraft.server.v1_8_R3.BlockPosition;
+import net.minecraft.server.v1_8_R3.GenericAttributes;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public CustomEntityGiantZombie(World world) {
+ super(world);
+ 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());
+ this.n();
+ } catch (Exception exc) {
+ exc.printStackTrace();
+ }
+
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntitySkeleton.class, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ @Override
+ protected void initAttributes() {
+ super.initAttributes();
+ String string = " ";// Giants.getProperty(Files.ENTITIES, "Entities Configuration.Stats.Speed.Giant Zombie");
+ double speed = 1;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected void n() {
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
+ }
+
+ public float a(BlockPosition position) {
+ return 0.5F - this.world.o(position);
+ }
+}
diff --git a/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/CustomEntityType.java b/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/CustomEntityType.java
new file mode 100644
index 0000000..277de0d
--- /dev/null
+++ b/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R3;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_8_R3.BiomeBase;
+import net.minecraft.server.v1_8_R3.BiomeBase.BiomeMeta;
+import net.minecraft.server.v1_8_R3.Entity;
+import net.minecraft.server.v1_8_R3.EntityInsentient;
+import net.minecraft.server.v1_8_R3.EntityTypes;
+import net.minecraft.server.v1_8_R3.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.getBiomes()){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "at", "au", "av", "aw" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "at", "au", "av", "aw" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/EntityCreator.java b/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/EntityCreator.java
new file mode 100644
index 0000000..362b18b
--- /dev/null
+++ b/v1_8_R3/src/main/java/me/Mammothskier/Giants/entity/nms/v1_8_R3/EntityCreator.java
@@ -0,0 +1,17 @@
+package me.Mammothskier.Giants.entity.nms.v1_8_R3;
+
+import net.minecraft.server.v1_8_R3.World;
+
+import org.bukkit.Location;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_9_R1/pom.xml b/v1_9_R1/pom.xml
new file mode 100644
index 0000000..4a376e1
--- /dev/null
+++ b/v1_9_R1/pom.xml
@@ -0,0 +1,36 @@
+
+ 4.0.0
+
+ Giants for v1_9_R1
+ Giants-v1_9_R1
+ 2.0-SNAPSHOT
+ jar
+
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.9-R0.1-SNAPSHOT
+ jar
+
+
+
+ me.Mammothskier
+ Giants-Files
+ 1.1-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ false
+
+
+
\ No newline at end of file
diff --git a/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomEntityGiantZombie.java b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..5047fc5
--- /dev/null
+++ b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomEntityGiantZombie.java
@@ -0,0 +1,81 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R1;
+
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.Files.FileHandler;
+import net.minecraft.server.v1_9_R1.BlockPosition;
+import net.minecraft.server.v1_9_R1.DataWatcher;
+import net.minecraft.server.v1_9_R1.DataWatcherObject;
+import net.minecraft.server.v1_9_R1.DataWatcherRegistry;
+import net.minecraft.server.v1_9_R1.EntityGiantZombie;
+import net.minecraft.server.v1_9_R1.EntityHuman;
+import net.minecraft.server.v1_9_R1.EntityIronGolem;
+import net.minecraft.server.v1_9_R1.EntityPigZombie;
+import net.minecraft.server.v1_9_R1.EntityVillager;
+import net.minecraft.server.v1_9_R1.EntityZombie;
+import net.minecraft.server.v1_9_R1.PathfinderGoalFloat;
+import net.minecraft.server.v1_9_R1.PathfinderGoalHurtByTarget;
+import net.minecraft.server.v1_9_R1.PathfinderGoalLookAtPlayer;
+import net.minecraft.server.v1_9_R1.PathfinderGoalMoveThroughVillage;
+import net.minecraft.server.v1_9_R1.PathfinderGoalMoveTowardsRestriction;
+import net.minecraft.server.v1_9_R1.PathfinderGoalNearestAttackableTarget;
+import net.minecraft.server.v1_9_R1.PathfinderGoalRandomLookaround;
+import net.minecraft.server.v1_9_R1.PathfinderGoalRandomStroll;
+import net.minecraft.server.v1_9_R1.World;
+import net.minecraft.server.v1_9_R1.GenericAttributes;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ private static final DataWatcherObject by = DataWatcher.a(CustomEntityGiantZombie.class, DataWatcherRegistry.h);
+
+ public CustomEntityGiantZombie (World world) {
+ super(world);
+
+ }
+
+ protected void r () {
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new CustomPathfinderGoalGiantZombieAttack(this, 1.0D, false));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ public void a(boolean flag) {
+ this.getDataWatcher().set(CustomEntityGiantZombie.by, Boolean.valueOf(flag));
+ }
+
+ @Override
+ protected void initAttributes() {
+ super.initAttributes();
+ String string = FileHandler.getInstanceProperty(ConfigValues.zombieSpeed);
+ double speed = 1;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
+ }
+
+ protected void o() {
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ if (FileHandler.getInstanceProperty(ConfigValues.zombieAggressiveToVillage).equalsIgnoreCase("false"))
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
+ }
+
+ public float a(BlockPosition position) {
+ return 0.5F - this.world.n(position);
+ }
+}
diff --git a/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomEntityType.java b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomEntityType.java
new file mode 100644
index 0000000..21d1b4b
--- /dev/null
+++ b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R1;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_9_R1.BiomeBase;
+import net.minecraft.server.v1_9_R1.BiomeBase.BiomeMeta;
+import net.minecraft.server.v1_9_R1.Entity;
+import net.minecraft.server.v1_9_R1.EntityInsentient;
+import net.minecraft.server.v1_9_R1.EntityTypes;
+import net.minecraft.server.v1_9_R1.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.i){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "u", "v", "w", "x" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "u", "v", "w", "x" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomPathfinderGoalGiantZombieAttack.java b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomPathfinderGoalGiantZombieAttack.java
new file mode 100644
index 0000000..522b773
--- /dev/null
+++ b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/CustomPathfinderGoalGiantZombieAttack.java
@@ -0,0 +1,38 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R1;
+
+import net.minecraft.server.v1_9_R1.PathfinderGoalMeleeAttack;
+
+public class CustomPathfinderGoalGiantZombieAttack extends PathfinderGoalMeleeAttack {
+
+ private final CustomEntityGiantZombie h;
+ private int i;
+
+ public CustomPathfinderGoalGiantZombieAttack(CustomEntityGiantZombie entityzombie, double d0, boolean flag) {
+ super(entityzombie, d0, flag);
+ this.h = entityzombie;
+ }
+
+ public void c() {
+ super.c();
+ this.setI(0);
+ }
+
+ public void d() {
+ super.d();
+ this.h.a(false);
+ }
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/EntityCreator.java b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/EntityCreator.java
new file mode 100644
index 0000000..9449ee3
--- /dev/null
+++ b/v1_9_R1/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R1/EntityCreator.java
@@ -0,0 +1,17 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R1;
+
+import net.minecraft.server.v1_9_R1.World;
+
+import org.bukkit.Location;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}
diff --git a/v1_9_R2/pom.xml b/v1_9_R2/pom.xml
new file mode 100644
index 0000000..108af95
--- /dev/null
+++ b/v1_9_R2/pom.xml
@@ -0,0 +1,34 @@
+
+ 4.0.0
+
+ me.Mammothskier
+ Giants-Parent
+ 7.1.1-SNAPSHOT
+
+
+ Giants-v1_9_R2
+ 2.0-SNAPSHOT
+ Giants for v1_9_R2
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.9.4-R0.1-SNAPSHOT
+ jar
+
+
+
+ me.Mammothskier
+ Giants-Files
+ 1.1-SNAPSHOT
+
+
+ org.bukkit
+ craftbukkit
+
+
+ false
+
+
+
\ No newline at end of file
diff --git a/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomEntityGiantZombie.java b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomEntityGiantZombie.java
new file mode 100644
index 0000000..55acf71
--- /dev/null
+++ b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomEntityGiantZombie.java
@@ -0,0 +1,62 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R2;
+
+import me.Mammothskier.Giants.Files.ConfigValues;
+import me.Mammothskier.Giants.Files.FileHandler;
+import net.minecraft.server.v1_9_R2.*;
+
+public class CustomEntityGiantZombie extends EntityGiantZombie {
+
+ private static final DataWatcherObject by = DataWatcher.a(CustomEntityGiantZombie.class, DataWatcherRegistry.h);
+
+ public CustomEntityGiantZombie (World world) {
+ super(world);
+
+ }
+
+ protected void r () {
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new CustomPathfinderGoalGiantZombieAttack(this, 1.0D, false));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ }
+
+ @Override
+ public float getHeadHeight() {
+ return 14.440001F;
+ }
+
+ public void a(boolean flag) {
+ this.getDataWatcher().set(CustomEntityGiantZombie.by, Boolean.valueOf(flag));
+ }
+
+ @Override
+ protected void initAttributes() {
+ super.initAttributes();
+ String string = FileHandler.getInstanceProperty(ConfigValues.zombieSpeed);
+ double speed = 1;
+ try {
+ speed = Double.parseDouble(string);
+ } catch (Exception e) {
+ speed = 1;
+ }
+ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(35D);
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D * speed);
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
+ }
+
+ protected void o() {
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class}));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ if (FileHandler.getInstanceProperty(ConfigValues.zombieAggressiveToVillage).equalsIgnoreCase("false"))
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true));
+ }
+
+ public float a(BlockPosition position) {
+ return 0.5F - this.world.n(position);
+ }
+}
diff --git a/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomEntityType.java b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomEntityType.java
new file mode 100644
index 0000000..18bb8d0
--- /dev/null
+++ b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomEntityType.java
@@ -0,0 +1,175 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R2;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.server.v1_9_R2.BiomeBase;
+import net.minecraft.server.v1_9_R2.BiomeBase.BiomeMeta;
+import net.minecraft.server.v1_9_R2.Entity;
+import net.minecraft.server.v1_9_R2.EntityInsentient;
+import net.minecraft.server.v1_9_R2.EntityTypes;
+import net.minecraft.server.v1_9_R2.EntityGiantZombie;
+
+import org.bukkit.entity.EntityType;
+
+public enum CustomEntityType {
+
+ GIANT("Giant", 53, EntityType.GIANT, EntityGiantZombie.class, CustomEntityGiantZombie.class);
+
+ private String name;
+ private int id;
+ private EntityType entityType;
+ private Class extends EntityInsentient> nmsClass;
+ private Class extends EntityInsentient> customClass;
+
+ private CustomEntityType(String name, int id, EntityType entityType,
+ Class extends EntityInsentient> nmsClass,
+ Class extends EntityInsentient> customClass) {
+ this.name = name;
+ this.id = id;
+ this.entityType = entityType;
+ this.nmsClass = nmsClass;
+ this.customClass = customClass;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public EntityType getEntityType() {
+ return entityType;
+ }
+
+ public Class extends EntityInsentient> getNMSClass() {
+ return nmsClass;
+ }
+
+ public Class extends EntityInsentient> getCustomClass() {
+ return customClass;
+ }
+
+ /**
+ * Register our entities.
+ */
+ public static void registerEntities() {
+ for (CustomEntityType entity : values())
+ a(entity.getCustomClass(), entity.getName(), entity.getID());
+
+ // BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
+ for (BiomeBase biomeBase : BiomeBase.i){
+ if (biomeBase == null)
+ break;
+
+ // This changed names from J, K, L and M.
+ for (String field : new String[] { "u", "v", "w", "x" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List mobList = (List) list
+ .get(biomeBase);
+
+ // Write in our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getNMSClass().equals(meta.b))
+ meta.b = entity.getCustomClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Unregister our entities to prevent memory leaks. Call on disable.
+ */
+ @SuppressWarnings("unchecked")
+ public static void unregisterEntities() {
+ for (CustomEntityType entity : values()) {
+ // Remove our class references.
+ try {
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).remove(entity.getCustomClass());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (CustomEntityType entity : values())
+ try {
+ // Unregister each entity by writing the NMS back in place of the custom class.
+ a(entity.getNMSClass(), entity.getName(), entity.getID());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Biomes#biomes was made private so use reflection to get it.
+ BiomeBase[] biomes;
+ try {
+ biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, "biomes");
+ } catch (Exception exc) {
+ // Unable to fetch.
+ return;
+ }
+ for (BiomeBase biomeBase : biomes) {
+ if (biomeBase == null)
+ break;
+
+ // The list fields changed names but update the meta regardless.
+ for (String field : new String[] { "u", "v", "w", "x" })
+ try {
+ Field list = BiomeBase.class.getDeclaredField(field);
+ list.setAccessible(true);
+ List mobList = (List) list.get(biomeBase);
+
+ // Make sure the NMS class is written back over our custom class.
+ for (BiomeMeta meta : mobList)
+ for (CustomEntityType entity : values())
+ if (entity.getCustomClass().equals(meta.b))
+ meta.b = entity.getNMSClass();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * A convenience method.
+ * @param clazz The class.
+ * @param f The string representation of the private static field.
+ * @return The object found
+ * @throws Exception if unable to get the object.
+ */
+ @SuppressWarnings("rawtypes")
+ private static Object getPrivateStatic(Class clazz, String f) throws Exception {
+ Field field = clazz.getDeclaredField(f);
+ field.setAccessible(true);
+ return field.get(null);
+ }
+
+ /*
+ * Since 1.7.2 added a check in their entity registration, simply bypass it and write to the maps ourself.
+ */
+ @SuppressWarnings("unchecked")
+ private static void a(Class extends Entity> paramClass, String paramString, int paramInt) {
+ try {
+ ((Map>) getPrivateStatic(EntityTypes.class, "c")).put(paramString, paramClass);
+ ((Map, String>) getPrivateStatic(EntityTypes.class, "d")).put(paramClass, paramString);
+ ((Map>) getPrivateStatic(EntityTypes.class, "e")).put(Integer.valueOf(paramInt), paramClass);
+ ((Map, Integer>) getPrivateStatic(EntityTypes.class, "f")).put(paramClass, Integer.valueOf(paramInt));
+ ((Map) getPrivateStatic(EntityTypes.class, "g")).put(paramString, Integer.valueOf(paramInt));
+ } catch (Exception exc) {
+ // Unable to register the new class.
+ }
+ }
+}
diff --git a/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomPathfinderGoalGiantZombieAttack.java b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomPathfinderGoalGiantZombieAttack.java
new file mode 100644
index 0000000..61110f5
--- /dev/null
+++ b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/CustomPathfinderGoalGiantZombieAttack.java
@@ -0,0 +1,38 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R2;
+
+import net.minecraft.server.v1_9_R2.PathfinderGoalMeleeAttack;
+
+public class CustomPathfinderGoalGiantZombieAttack extends PathfinderGoalMeleeAttack {
+
+ private final CustomEntityGiantZombie h;
+ private int i;
+
+ public CustomPathfinderGoalGiantZombieAttack(CustomEntityGiantZombie entityzombie, double d0, boolean flag) {
+ super(entityzombie, d0, flag);
+ this.h = entityzombie;
+ }
+
+ public void c() {
+ super.c();
+ this.setI(0);
+ }
+
+ public void d() {
+ super.d();
+ this.h.a(false);
+ }
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/EntityCreator.java b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/EntityCreator.java
new file mode 100644
index 0000000..0145632
--- /dev/null
+++ b/v1_9_R2/src/main/java/me/Mammothskier/Giants/entity/nms/v1_9_R2/EntityCreator.java
@@ -0,0 +1,17 @@
+package me.Mammothskier.Giants.entity.nms.v1_9_R2;
+
+import net.minecraft.server.v1_9_R2.World;
+
+import org.bukkit.Location;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
+
+public class EntityCreator {
+
+ public static void createEntity (Location location, SpawnReason reason) {
+ World world = ((CraftWorld) location.getWorld()).getHandle();
+ CustomEntityGiantZombie giant = new CustomEntityGiantZombie(world);
+ giant.setPosition(location.getX(), location.getY(), location.getZ());
+ world.addEntity(giant, reason);
+ }
+}