diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index b6a5c64..d3be7d5 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 6dbc7b9..3939da2 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -653,9 +653,11 @@ public class CustomDamage { } static void leaderRallyNearbyMonsters(Monster m, Player p) { - if (MonsterController.isZombieLeader(m) && + if ((MonsterController.isZombieLeader(m) || ( + m.getCustomName()!=null && m.getCustomName().contains(ChatColor.MAGIC+"") + )) && !m.hasPotionEffect(PotionEffectType.GLOWING)) { - rallyNearbyMonsters(m,p,10); + rallyNearbyMonsters(m,p,24); } } @@ -1120,10 +1122,6 @@ public class CustomDamage { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (pd.iframetime= duration) { - logAndRemovePotionEffectFromPlayer(type,p); logAndApplyPotionEffectToPlayer(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true); } } else { @@ -3811,4 +3809,27 @@ public class GenericFunctions { } } } + + public static void logToFile(String message) { + try { + if (!TwosideKeeper..exists()) { + savePath.mkdir(); + } + + File saveTo = new File(plugin.getDataFolder(), "aPluginLogger.txt"); + if (!saveTo.exists()) { + saveTo.createNewFile(); + } + + FileWriter fw = new FileWriter(saveTo, true); + PrintWriter pw = new PrintWriter(fw); + + pw.println(message); + pw.flush(); + pw.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index 418d980..23c8fad 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -105,6 +105,25 @@ public class Loot { aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),4)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),4)); aPlugin.API.Chests.LOOT_HELLFIRE.printDrops(); + + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_SWORD,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_SWORD,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_AXE,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_PICKAXE,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_HOE,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_SPADE,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.BOW,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.FISHING_ROD,8)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_BOOTS,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_HELMET,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_BOOTS,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_HELMET,78)); + aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),4)); + aPlugin.API.Chests.LOOT_CUSTOM.printDrops(); //aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10)); } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java index 0751f1f..e634e2f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java @@ -201,7 +201,18 @@ public enum MonsterDifficulty { new LootStructure[]{ //Legendary Loot new LootStructure(Material.END_CRYSTAL), } - ); + ), + END( + new LootStructure[]{ //Common Loot + new LootStructure(Material.EMERALD), + }, + new LootStructure[]{ //Rare Loot + new LootStructure(Material.EMERALD_BLOCK), + }, + new LootStructure[]{ //Legendary Loot + new LootStructure(Material.END_CRYSTAL), + } + ); LootStructure[] loot_regular; LootStructure[] loot_rare; @@ -256,6 +267,10 @@ public enum MonsterDifficulty { goodie=aPlugin.API.Chests.LOOT_HELLFIRE.getSingleDrop(); KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_HELLFIRE, damager); }break; + case END:{ + goodie=aPlugin.API.Chests.LOOT_CUSTOM.getSingleDrop(); + KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_CUSTOM, damager); + }break; case ELITE:{ }break; diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index f67a235..67f031e 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -58,7 +58,7 @@ public class MonsterController { ent.remove(); return false; } - } + } else if (!meetsConditionsToSpawn(ent)) { return false; } @@ -79,6 +79,11 @@ public class MonsterController { convertMonster(m,md); return true; } + if (ent.getWorld().getName().equalsIgnoreCase("world_the_end")) { + Monster m = (Monster)ent; + convertMonster(m,MonsterDifficulty.END); + return true; + } else if (ylv>=128) { //This is a 95% chance this will despawn. if (Math.random()<=0.95 && !ent.getWorld().hasStorm() && @@ -148,9 +153,11 @@ public class MonsterController { double dist = 999999999; int nearbyplayers=0; for (Player p : Bukkit.getOnlinePlayers()) { - double temp = ent.getLocation().distanceSquared(p.getLocation()); - if (temp<4096) {nearbyplayers++;} - dist = (temp20) || (md==MonsterDifficulty.DANGEROUS && ent.getMaxHealth()>20*2) || (md==MonsterDifficulty.DEADLY && ent.getMaxHealth()>20*3) || - (md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4) + (md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4) || + (md==MonsterDifficulty.END && ent.getMaxHealth()>20*80) ) { return true; @@ -663,6 +671,9 @@ public class MonsterController { } public static Monster convertMonster(Monster m) { + if (m.getWorld().getName().equalsIgnoreCase("world_the_end")) { + convertMonster(m,MonsterDifficulty.END); + } if (m.getLocation().getY()<48) { if (m.getLocation().getY()>=32) return convertMonster(m,MonsterDifficulty.DANGEROUS); @@ -689,6 +700,9 @@ public class MonsterController { if (m.getCustomName().contains("Elite")) { return MonsterDifficulty.ELITE; } else + if (m.getCustomName().contains("End")) { + return MonsterDifficulty.END; + } else { return MonsterDifficulty.NORMAL; } @@ -844,6 +858,32 @@ public class MonsterController { } m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(24.0); }break; + case END:{ + //m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob"); + //m.setCustomNameVisible(true); + if (m.getType()!=EntityType.ENDERMAN) { + m.setFireTicks(Integer.MAX_VALUE); + } + if (isAllowedToEquipItems(m)) { + m.getEquipment().clear(); + RandomizeEquipment(m,0); + } + m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,1)); + m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,3)); + SetupCustomName(ChatColor.DARK_BLUE+""+ChatColor.MAGIC+"End",m); + if(isZombieLeader(m)) + { + GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); + m.setMaxHealth(32000); //Target is 1600 HP. + m.setHealth(m.getMaxHealth()); + MonsterStructure.getMonsterStructure(m).SetLeader(true); + TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5); + } else { + m.setMaxHealth(m.getMaxHealth()*80.0); + m.setHealth(m.getMaxHealth()); + } + m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(64.0); + }break; } removeZombieLeaderAttribute(m); return m; diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index bf5172a..713d879 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -103,6 +103,7 @@ public class PlayerStructure { public List lasteffectlist=null; public boolean stealthmode=false; public long lastcompassnotification=0; + public long endnotification=0; public long iframetime = 0; diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 5f4f6c3..d860572 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -45,6 +45,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; +import org.bukkit.entity.Shulker; import org.bukkit.entity.Snowball; import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.TippedArrow; @@ -479,6 +480,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen); } } + + if (pd.endnotification+720000) { if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p); - GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.ABSORPTION,p); GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.ABSORPTION,599,(int)(absorption_amt/4)+oldlv,p); } else { GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.ABSORPTION,599,(int)(absorption_amt/4),p); @@ -4046,10 +4101,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener { return; } + if (ev.getEntity() instanceof Shulker) { + convertToStrongerShulker(ev.getEntity()); + } + if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) || ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) || ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) || - ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) && + ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION) || + ev.getSpawnReason().equals(SpawnReason.CHUNK_GEN)) && ev.getEntity() instanceof Monster) { if (ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) || ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) { //Remove this one and spawn another one. @@ -4093,7 +4153,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } - //A fix to make achievemnt announcements not show the healthbar! + private void convertToStrongerShulker(LivingEntity entity) { + if (entity.getWorld().getName().equalsIgnoreCase("world_the_end")) { + entity.setFireTicks(Integer.MAX_VALUE); + entity.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,1)); + entity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,3)); + entity.setCustomName(ChatColor.DARK_BLUE+""+ChatColor.MAGIC+"End"+" "+GenericFunctions.CapitalizeFirstLetters(entity.getType().name())); + entity.setMaxHealth(entity.getMaxHealth()*420.0); + entity.setHealth(entity.getMaxHealth()); + } + } + + //A fix to make achievemnt announcements not show the healthbar! @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void playerGetAchievementEvent(PlayerAchievementAwardedEvent ev) { final Player p = ev.getPlayer(); @@ -4794,6 +4865,37 @@ public class TwosideKeeper extends JavaPlugin implements Listener { }} ,50); break; + case END: + m.getWorld().playSound(m.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1.0f, 1.0f); + totalexp=ev.getDroppedExp()*40; + ev.setDroppedExp((int)(totalexp*0.75)); + final Monster mer4 = m; + final int expdrop4 = totalexp; + droplist.clear(); //Clear the drop list. We are going to delay the drops. + droplist.addAll(originaldroplist); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + public void run() { + if (mer4.getLocation().getBlockY()<48) { + mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 5.0f, false, true); + GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 12, 5); + GenericFunctions.RandomlyCreateFire(mer4.getLocation(),2); + } else { + mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 6.0f, false, false); + GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 12, 6); + GenericFunctions.RandomlyCreateFire(mer4.getLocation(),3); + } + }} + ,30); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + public void run() { + for (int i=0;i