diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index b446579..435e765 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 78a34fa..aeb7c02 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.10.17 +version: 3.11.1a loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/EliteMonster.java b/src/sig/plugin/TwosideKeeper/EliteMonster.java index 7bece2e..7d3b045 100644 --- a/src/sig/plugin/TwosideKeeper/EliteMonster.java +++ b/src/sig/plugin/TwosideKeeper/EliteMonster.java @@ -140,10 +140,14 @@ public class EliteMonster { } protected void displayHealthbarToNearbyPlayers() { - for (Player p : Bukkit.getOnlinePlayers()) { - if (m.getLocation().distanceSquared(p.getLocation())<=2500) { - bar.addPlayer(p); + try { + for (Player p : Bukkit.getOnlinePlayers()) { + if (m.getLocation().getWorld().equals(p.getLocation().getWorld()) && m.getLocation().distanceSquared(p.getLocation())<=2500) { + bar.addPlayer(p); + } } + } catch (IllegalArgumentException e) { + e.printStackTrace(); } } @@ -197,6 +201,9 @@ public class EliteMonster { public GlowAPI.Color getGlow() { GlowAPI.Color col = GlowAPI.Color.DARK_PURPLE; if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) { + col = GlowAPI.Color.DARK_BLUE; + } + if (Channel.isChanneling(m)) { col = GlowAPI.Color.YELLOW; } if (storingenergy) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index c942c9b..694b1d1 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -3644,26 +3644,30 @@ public class GenericFunctions { public static void ConvertSetColor(ItemStack item, ItemSet set) { if (item.getType().name().contains("LEATHER_")) { - if (set==ItemSet.JAMDAK) { - LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta(); - lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0)); - item.setItemMeta(lm); - } - if (set==ItemSet.DARNYS) { - LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta(); - lm.setColor(org.bukkit.Color.fromRGB(224, 224, 224)); - item.setItemMeta(lm); - } - if (set==ItemSet.ALIKAHN) { - LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta(); - lm.setColor(org.bukkit.Color.fromRGB(64, 0, 64)); - item.setItemMeta(lm); - } - if (set==ItemSet.LORASAADI) { - LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta(); - lm.setColor(org.bukkit.Color.fromRGB(0, 64, 0)); - item.setItemMeta(lm); + org.bukkit.Color col = org.bukkit.Color.fromRGB(0, 0, 0); + switch (set) { + case JAMDAK:{ + col=org.bukkit.Color.fromRGB(128, 64, 0); + }break; + case DARNYS:{ + col=org.bukkit.Color.fromRGB(224, 224, 224); + }break; + case ALIKAHN:{ + col=org.bukkit.Color.fromRGB(64, 0, 64); + }break; + case LORASAADI:{ + col=org.bukkit.Color.fromRGB(0, 64, 0); + }break; + case SHARD:{ + col=org.bukkit.Color.fromRGB(224, 0, 24); + }break; + case TOXIN:{ + col=org.bukkit.Color.fromRGB(196, 196, 0); + }break; } + LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta(); + lm.setColor(col); + item.setItemMeta(lm); } } @@ -3675,6 +3679,7 @@ public class GenericFunctions { public static boolean AttemptRevive(Player p, double dmg, String reason) { boolean revived=false; + boolean fromRoom=false; if (p.getHealth()<=dmg) { //This means we would die from this attack. Attempt to revive the player. //Check all artifact armor for a perk. @@ -3684,6 +3689,18 @@ public class GenericFunctions { pd.slayermodehp = p.getMaxHealth(); ItemStack[] equips = p.getEquipment().getArmorContents(); + + + if (!revived) { + for (Room r : TwosideKeeper.roominstances) { + if (r.onPlayerDeath(p)) { + revived=true; + fromRoom=true; + RevivePlayer(p, p.getMaxHealth()); + return true; //Intentionally prevent other revive effects from working. + } + } + } if (!revived) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LEGION, 5)) { @@ -3738,16 +3755,9 @@ public class GenericFunctions { } } - if (!revived) { - if (pd.inTankChallengeRoom || pd.inParkourChallengeRoom) { - for (Room r : TwosideKeeper.roominstances) { - r.onPlayerDeath(p); - } - revived=true; - RevivePlayer(p, p.getMaxHealth()); - } + if (!fromRoom) { + RandomlyBreakBaubles(p); } - RandomlyBreakBaubles(p); } return revived; } @@ -3779,16 +3789,16 @@ public class GenericFunctions { set==ItemSet.WOLFSBANE)) { double basechance = 1/8d; if (set==ItemSet.WOLFSBANE) { - basechance += 0.0d * ItemSet.GetItemTier(bauble); + basechance += 1/16d; } if (set==ItemSet.ALUSTINE) { - basechance += 1/16d * ItemSet.GetItemTier(bauble); + basechance += 1/16d; } if (set==ItemSet.MOONSHADOW) { - basechance += 1/8d * ItemSet.GetItemTier(bauble); + basechance += 1/8d; } if (set==ItemSet.GLADOMAIN) { - basechance += 1/4d * ItemSet.GetItemTier(bauble); + basechance += 1/4d; } if (Math.random()<=basechance) { if (GenericFunctions.isHardenedItem(bauble)) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index 08f2636..529c132 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -993,7 +993,7 @@ public enum ItemSet { lore.add(ChatColor.GRAY+" (Cripple slows the target and decreases target's damage"); lore.add(ChatColor.GRAY+" output by 10% per level.)"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Fire Cesspool"+ABILITY_LABEL_END); - lore.add(ChatColor.GRAY+" When projectiles hit a target, a temporary file pool"); + lore.add(ChatColor.GRAY+" When projectiles hit a target, a temporary fire pool"); lore.add(ChatColor.GRAY+" is created around it, applying stacking Burn to all"); lore.add(ChatColor.GRAY+" enemy targets in the fire pool. (Burn deals more damage"); lore.add(ChatColor.GRAY+" as the number of stacks increase.)"); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index a24c08d..b05c895 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -18,6 +18,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta; import aPlugin.DropItem; import aPlugin.DropMaterial; import aPlugin.API.Chests; +import aPlugin.Drop; import sig.plugin.TwosideKeeper.Artifact; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.Drops.SigDrop; @@ -186,7 +187,8 @@ public class Loot { aPlugin.API.Chests.LOOT_CUSTOM_5.setName(ChatColor.RED+"Leader Wither Loot Box"); aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,1000,"[Leader Wither] Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,1000,"[Leader Wither] Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY)); - aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropMaterial(Material.NETHER_STAR,70)); + aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropMaterial(Material.NETHER_STAR,140)); + aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropItem(CustomItem.DailyToken(),140)); aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,70,"[Leader Wither] Hardened Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,70,"[Leader Wither] Hardened Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,40,"[Leader Wither] Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY)); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java index 5b4361d..3178cdf 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java @@ -18,15 +18,14 @@ public class SoundUtils { */ public static void playGlobalSound(Location loc, Sound sound, float vol, float pitch) { loc.getWorld().playSound(loc, sound, vol, pitch); + //playIndividualGlobalSound(loc,sound,vol,pitch); } /** * Same as playGlobalSound. Just done for every single player locally. */ public static void playIndividualGlobalSound(Location loc, Sound sound, float vol, float pitch) { for (Player p : Bukkit.getOnlinePlayers()) { - if (p.getLocation().distanceSquared(loc)<=2500) { - p.playSound(loc, sound, vol, pitch); - } + p.playSound(loc, sound, vol, pitch); } } /** diff --git a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java index 3ff1f47..2edee1d 100644 --- a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java +++ b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java @@ -196,9 +196,20 @@ public class LivingEntityStructure { for (Player p : Bukkit.getOnlinePlayers()) { //if (p!=null && p.isValid() && !p.isDead()) { if (isImportantGlowEnemy) { + if (TwosideKeeper.custommonsters.containsKey(m.getUniqueId()) && + TwosideKeeper.custommonsters.get(m.getUniqueId()).getGlowColor()!=null) { + CustomMonster cm = TwosideKeeper.custommonsters.get(m.getUniqueId()); + if (cm.getGlowColor()!=null) { + setGlow(p,cm.getGlowColor()); + } + } + else if (GenericFunctions.isSuppressed(m)) { setGlow(p,GlowAPI.Color.BLACK); } else + if (Channel.isChanneling(m)) { + setGlow(p,GlowAPI.Color.YELLOW); + } else if (getElite()) { boolean handled=false; for (EliteMonster em : TwosideKeeper.elitemonsters) { @@ -219,14 +230,7 @@ public class LivingEntityStructure { if (GenericFunctions.isIsolatedTarget(m, p)) { setGlow(p,GlowAPI.Color.WHITE); } else - if (TwosideKeeper.custommonsters.containsKey(m.getUniqueId()) && - TwosideKeeper.custommonsters.get(m.getUniqueId()).getGlowColor()!=null) { - CustomMonster cm = TwosideKeeper.custommonsters.get(m.getUniqueId()); - if (cm.getGlowColor()!=null) { - setGlow(p,cm.getGlowColor()); - } - } - else { + { //No glow. //setGlow(p,null); if (glowcolorlist.containsKey(p.getUniqueId())) { diff --git a/src/sig/plugin/TwosideKeeper/Monster/Bloodmite.java b/src/sig/plugin/TwosideKeeper/Monster/Bloodmite.java index 9d0d4fe..98719ea 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/Bloodmite.java +++ b/src/sig/plugin/TwosideKeeper/Monster/Bloodmite.java @@ -5,6 +5,7 @@ import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.attribute.Attribute; import org.bukkit.entity.LivingEntity; +import org.inventivetalent.glow.GlowAPI; import sig.plugin.TwosideKeeper.CustomMonster; import sig.plugin.TwosideKeeper.LivingEntityStructure; @@ -28,6 +29,10 @@ public class Bloodmite extends CustomMonster{ main = ss; } + public GlowAPI.Color getGlowColor() { + return GlowAPI.Color.WHITE; + } + public void runTick() { if (lastBloodPool+90<=TwosideKeeper.getServerTickTime()) { TemporaryBlock.createTemporaryBlockCircle(m.getLocation(), 1, Material.WOOL, (byte)14, 20*30, "BLOODPOOL"); diff --git a/src/sig/plugin/TwosideKeeper/Monster/DarkSpider.java b/src/sig/plugin/TwosideKeeper/Monster/DarkSpider.java index 737a015..f7f1b21 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/DarkSpider.java +++ b/src/sig/plugin/TwosideKeeper/Monster/DarkSpider.java @@ -14,6 +14,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Spider; import org.bukkit.potion.PotionEffectType; +import org.inventivetalent.glow.GlowAPI; import sig.plugin.TwosideKeeper.Buff; import sig.plugin.TwosideKeeper.CustomDamage; @@ -56,8 +57,18 @@ public class DarkSpider extends CustomMonster{ if (canCastSpells()) { //SPELL CASTS HERE. castSpiderSummon(); } + removeIfCannotFindMaster(); } + private void removeIfCannotFindMaster() { + if (linked_knight==null) { + for (LivingEntity l : temp_spiders) { + l.remove(); + } + m.remove(); + } + } + private void castSpiderSummon() { CastSpell(SPIDERSUMMON); } @@ -206,4 +217,16 @@ public class DarkSpider extends CustomMonster{ } m.remove(); } + + public GlowAPI.Color getGlowColor() { + if (Channel.isChanneling(m)) { + return GlowAPI.Color.YELLOW; + } else { + if (GenericFunctions.isSuppressed(m)) { + return GlowAPI.Color.BLACK; + } else { + return GlowAPI.Color.NONE; + } + } + } } diff --git a/src/sig/plugin/TwosideKeeper/Monster/ExplosiveMite.java b/src/sig/plugin/TwosideKeeper/Monster/ExplosiveMite.java new file mode 100644 index 0000000..b388a11 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/Monster/ExplosiveMite.java @@ -0,0 +1,17 @@ +package sig.plugin.TwosideKeeper.Monster; + +import org.bukkit.entity.LivingEntity; +import org.inventivetalent.glow.GlowAPI; + +import sig.plugin.TwosideKeeper.CustomMonster; + +public class ExplosiveMite extends CustomMonster{ + + public ExplosiveMite(LivingEntity m) { + super(m); + } + + public GlowAPI.Color getGlowColor() { + return GlowAPI.Color.RED; + } +} diff --git a/src/sig/plugin/TwosideKeeper/Monster/GenericBoss.java b/src/sig/plugin/TwosideKeeper/Monster/GenericBoss.java index dc639de..2524c1c 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/GenericBoss.java +++ b/src/sig/plugin/TwosideKeeper/Monster/GenericBoss.java @@ -38,6 +38,7 @@ public class GenericBoss extends CustomMonster{ private long stuckTimer=0; long lasthit; double baseHP; + protected boolean isFlying=false; public GenericBoss(LivingEntity m) { super(m); @@ -134,6 +135,11 @@ public class GenericBoss extends CustomMonster{ healthbar.setProgress(m.getHealth()/m.getMaxHealth()); Monster me = (Monster)m; String healthbarfooter = ((me.getTarget()!=null && (me.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)me.getTarget()).getName()):""); + for (Player p : participantlist) { + if (p.isFlying()) { + p.setFlying(false); + } + } if (Channel.isChanneling(m)) { healthbar.setTitle(LivingEntityStructure.getChannelingBar(m)+healthbarfooter); } else { @@ -171,17 +177,21 @@ public class GenericBoss extends CustomMonster{ aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```"); dpslist.clear(); healthbar.setColor(BarColor.WHITE); + if (m instanceof Monster) { + Monster me = (Monster)m; + me.setTarget(null); + } } } private void updateTargetIfLost() { Monster mm = (Monster)m; LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m); - if (mm.getTarget()==null || !mm.getTarget().isValid() || + if ((mm.getTarget()==null || !mm.getTarget().isValid() || les.GetTarget()==null || !mm.getTarget().isValid() || - ((mm.getTarget().getLocation().distanceSquared(mm.getLocation())>2500 || - les.GetTarget().getLocation().distanceSquared(mm.getLocation())>2500 - ))) { + (((mm.getTarget().getLocation().distanceSquared(mm.getLocation())>2500 || + les.GetTarget().getLocation().distanceSquared(mm.getLocation())>2500)))) + && !isFlying) { //See if there's another participant in the list. Choose randomly. while (participantlist.size()>0) { Player p = participantlist.get((int)(Math.random()*participantlist.size())); @@ -204,9 +214,6 @@ public class GenericBoss extends CustomMonster{ private void updateHealthbarForNearbyPlayers() { for (Player p : healthbar.getPlayers()) { - if (p.isFlying()) { - p.setFlying(false); - } if (p.getWorld().equals(m.getWorld()) && p.getLocation().distanceSquared(m.getLocation())>2500) { healthbar.removePlayer(p); } diff --git a/src/sig/plugin/TwosideKeeper/Monster/Knight.java b/src/sig/plugin/TwosideKeeper/Monster/Knight.java index 1dc5133..7256d86 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/Knight.java +++ b/src/sig/plugin/TwosideKeeper/Monster/Knight.java @@ -27,6 +27,7 @@ import org.bukkit.entity.LightningStrike; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; +import org.bukkit.entity.Silverfish; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; import org.inventivetalent.glow.GlowAPI.Color; @@ -81,7 +82,6 @@ public class Knight extends GenericBoss{ DarkSpider spider_pet; BossBar shieldbar; - boolean isFlying=false; Location lastlandedloc = null; final static double[] SHIELD_AMT = new double[]{1800,4700,16000}; Location targetloc = null; @@ -152,10 +152,30 @@ public class Knight extends GenericBoss{ removeDebuffs(); updateAI(); removeIfTooOld(); + updateShieldBar(); } + private void updateShieldBar() { + if (shieldbar!=null) { + shieldbar.setProgress(Math.min(1,CustomDamage.getAbsorptionHearts(m)/SHIELD_AMT[getDifficultySlot()])); + } + } + public Color getGlowColor() { - return Color.AQUA; + if (Channel.isChanneling(m)) { + Channel c = Channel.getCurrentChannel(m); + if (c.getSpellName().equalsIgnoreCase("Dark Cleanse")) { + return Color.PURPLE; + } else { + return Color.YELLOW; + } + } else { + if (GenericFunctions.isSuppressed(m)) { + return Color.BLACK; + } else { + return Color.AQUA; + } + } } private void removeIfTooOld() { @@ -215,7 +235,7 @@ public class Knight extends GenericBoss{ endermites.clear(); silverfish=null; } else - if (silverfish!=null && silverfishtimer+(MINDFIELD.getCooldowns()[getDifficultySlot()]/2)<=TwosideKeeper.getServerTickTime()) { + if (silverfish!=null/* && silverfishtimer+(MINDFIELD.getCooldowns()[getDifficultySlot()]/2)<=TwosideKeeper.getServerTickTime()*/) { silverfish.setGlowing(true); } } @@ -383,12 +403,14 @@ public class Knight extends GenericBoss{ } public void triggerEndermiteKill(LivingEntity endermite) { - List players = GenericFunctions.DealDamageToNearbyPlayers(m.getLocation(), MINDFIELD.getDamageValues()[getDifficultySlot()].getTruePctDmgComponent(), 50, false, false, 0, m, "Endermite Popped", false, true); - for (Player p : players) { - GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 20*3, 0, p, true); - GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 20*3, 0, p, true); + if (endermites.contains(endermite)) { + List players = GenericFunctions.DealDamageToNearbyPlayers(m.getLocation(), MINDFIELD.getDamageValues()[getDifficultySlot()].getTruePctDmgComponent(), 50, false, false, 0, m, "Endermite Popped", false, true); + for (Player p : players) { + GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 20*3, 0, p, true); + GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 20*3, 0, p, true); + } + SoundUtils.playLocalGlobalSound(Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f); } - SoundUtils.playLocalGlobalSound(Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f); } public void triggerSilverfishKill(LivingEntity silverfish) { @@ -398,6 +420,14 @@ public class Knight extends GenericBoss{ } endermites.clear(); this.silverfish=null; + List ents = m.getNearbyEntities(50, 50, 50); + for (Entity e : ents) { + if (e instanceof Silverfish || + e instanceof Endermite || + e instanceof Spider) { + e.remove(); + } + } } private void spawnEndermiteAndSilverfishNearby() { @@ -411,6 +441,7 @@ public class Knight extends GenericBoss{ Endermite end = (Endermite)spawnloc.getWorld().spawnEntity(m.getLocation(), EntityType.ENDERMITE); end.setTarget(pickRandomTarget()); endermites.add(end); + TwosideKeeper.custommonsters.put(end.getUniqueId(), new ExplosiveMite(end)); } Location spawnloc = GetFreeRandomLocationAroundPoint(10); @@ -522,6 +553,11 @@ public class Knight extends GenericBoss{ SoundUtils.playGlobalSound(m.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 0.9f);}}, ()->{ if (attemptSpellCast(DARKCLEANSE)) { + LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m); + shieldbar = Bukkit.getServer().createBossBar(les.getDifficultyAndMonsterName()+"'s Shield", BarColor.PURPLE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG); + for (Player p : participantlist) { + shieldbar.addPlayer(p); + } CustomDamage.setAbsorptionHearts(m, (float)SHIELD_AMT[getDifficultySlot()]);}}, ()->{ performGrandSlam();}, @@ -629,7 +665,6 @@ public class Knight extends GenericBoss{ SoundUtils.playLocalGlobalSound(Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f); },90); Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,()->{ - isFlying=false; GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION, m); m.teleport(lastlandedloc); for (int i=0;i<5;i++) { @@ -648,6 +683,9 @@ public class Knight extends GenericBoss{ } } },100); + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,()->{ + isFlying=false; + },105); lastusedgrandslam = TwosideKeeper.getServerTickTime(); } } @@ -791,6 +829,10 @@ public class Knight extends GenericBoss{ public void announceFailedTakedown() { super.announceFailedTakedown(); if (dpslist.size()>0 && !m.isDead()) { + if (shieldbar!=null) { + shieldbar.removeAll(); + shieldbar=null; + } phaseii=false; PerformSpiderCleanup(); PerformSilverfishAndEndermiteCleanup(); @@ -930,6 +972,7 @@ public class Knight extends GenericBoss{ super.cleanup(); if (shieldbar!=null) { shieldbar.removeAll(); + shieldbar=null; } if (startedfight) { announceFailedTakedown(); @@ -952,6 +995,14 @@ public class Knight extends GenericBoss{ } } endermites.clear(); + List ents = m.getNearbyEntities(50, 50, 50); + for (Entity e : ents) { + if (e instanceof Silverfish || + e instanceof Endermite || + e instanceof Spider) { + e.remove(); + } + } } public void setupBonusLoot() { @@ -959,57 +1010,60 @@ public class Knight extends GenericBoss{ LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m); GlobalLoot gl = GlobalLoot.spawnGlobalLoot(m.getLocation(), ChatColor.AQUA+""+ChatColor.BOLD+les.getDifficultyAndMonsterName()+ChatColor.AQUA+""+ChatColor.BOLD+" Miniboss Loot"); double lootrate=1.0; - for (Player p : participantlist) { - PlayerMode mode = getMostUsedPlayerMode(p); - switch (diff) { - case T2_MINIBOSS:{ - lootrate+=0.5; - }break; - case T3_MINIBOSS:{ - lootrate+=1.0; - }break; - } - double lootamt = lootrate; - while (lootamt>0) { - if ((lootamt-1)>=0 || - Math.random()<=lootamt) { - gl.addNewDropInventory(p,GetSetPiece(diff,mode)); //Guaranteed Loot Piece. + for (String s : dpslist.keySet()) { + Player p = Bukkit.getPlayer(s); + if (p!=null) { + PlayerMode mode = getMostUsedPlayerMode(p); + switch (diff) { + case T2_MINIBOSS:{ + lootrate+=0.5; + }break; + case T3_MINIBOSS:{ + lootrate+=1.0; + }break; } - lootamt--; + double lootamt = lootrate; + while (lootamt>0) { + if ((lootamt-1)>=0 || + Math.random()<=lootamt) { + gl.addNewDropInventory(p,GetSetPiece(diff,mode)); //Guaranteed Loot Piece. + } + lootamt--; + } + AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); + AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); + + AttemptRoll(gl, 0.75*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE, (int)(Math.random()*3)+1)); + switch (diff) { + case T1_MINIBOSS:{ + AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); + }break; + case T2_MINIBOSS:{ + AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); + }break; + case T3_MINIBOSS:{ + AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); + }break; + } + //Artifact.createRecipe(5, ArtifactItemType.SHOVEL) + AttemptRoll(gl, 0.08*lootrate, p, GetArtifactRecipe(diff)); + AttemptRoll(gl, 0.02*lootrate, p, GetMaterialKit(diff)); + AttemptRoll(gl, 0.5*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,100).getItemStack()); + AttemptRoll(gl, 0.33*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,500).getItemStack()); + AttemptRoll(gl, 0.1*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,1000).getItemStack()); + AttemptRoll(gl, 0.5*lootrate, p, new DropRandomEnchantedBook(0,2).getItemStack()); + AttemptRoll(gl, 0.33*lootrate, p, new DropRandomEnchantedBook(0,4).getItemStack()); + AttemptRoll(gl, 0.1*lootrate, p, new DropRandomEnchantedBook(0,6).getItemStack()); + AttemptRoll(gl, 0.15*lootrate, p, TwosideKeeper.HUNTERS_COMPASS.getItemStack()); + AttemptRoll(gl, 0.05*lootrate, p, getVial(diff)); + AttemptRoll(gl, 0.1*lootrate, p, CustomItem.DailyToken()); } - AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); - AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); - - AttemptRoll(gl, 0.75*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE, (int)(Math.random()*3)+1)); - switch (diff) { - case T1_MINIBOSS:{ - AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); - }break; - case T2_MINIBOSS:{ - AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); - }break; - case T3_MINIBOSS:{ - AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); - }break; - } - //Artifact.createRecipe(5, ArtifactItemType.SHOVEL) - AttemptRoll(gl, 0.08*lootrate, p, GetArtifactRecipe(diff)); - AttemptRoll(gl, 0.02*lootrate, p, GetMaterialKit(diff)); - AttemptRoll(gl, 0.5*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,100).getItemStack()); - AttemptRoll(gl, 0.33*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,500).getItemStack()); - AttemptRoll(gl, 0.1*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,1000).getItemStack()); - AttemptRoll(gl, 0.5*lootrate, p, new DropRandomEnchantedBook(0,2).getItemStack()); - AttemptRoll(gl, 0.33*lootrate, p, new DropRandomEnchantedBook(0,4).getItemStack()); - AttemptRoll(gl, 0.1*lootrate, p, new DropRandomEnchantedBook(0,6).getItemStack()); - AttemptRoll(gl, 0.15*lootrate, p, TwosideKeeper.HUNTERS_COMPASS.getItemStack()); - AttemptRoll(gl, 0.05*lootrate, p, getVial(diff)); - AttemptRoll(gl, 0.1*lootrate, p, CustomItem.DailyToken()); } } diff --git a/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java b/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java index fdb71d7..0467671 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java +++ b/src/sig/plugin/TwosideKeeper/Monster/SniperSkeleton.java @@ -148,6 +148,7 @@ public class SniperSkeleton extends GenericBoss{ if (mode!=ShotMode.NORMAL && shotmodeExpireTime<=TwosideKeeper.getServerTickTime()) { mode=ShotMode.NORMAL; + LivingEntityStructure.setCustomLivingEntityName(m, "Sniper Skeleton"); } } @@ -166,14 +167,23 @@ public class SniperSkeleton extends GenericBoss{ public Color getGlowColor() { if (isInIframe()) { - return Color.WHITE; - } else { - switch (mode) { + return Color.GRAY; + } else + if (Channel.isChanneling(m)) { + return Color.YELLOW; + } else + { + if (GenericFunctions.isSuppressed(m)) { + return Color.BLACK; + } else { + return Color.AQUA; + } + /*switch (mode) { case NORMAL: return Color.AQUA; case POISON: return Color.YELLOW; case BLEED: return Color.RED; default: return Color.AQUA; - } + }*/ } } @@ -216,8 +226,10 @@ public class SniperSkeleton extends GenericBoss{ } else { if (Math.random()<=0.5) { mode=ShotMode.POISON; + LivingEntityStructure.setCustomLivingEntityName(m, ChatColor.YELLOW+"Poison Skeleton"); } else { mode=ShotMode.BLEED; + LivingEntityStructure.setCustomLivingEntityName(m, ChatColor.RED+"Blood Skeleton"); } } MODE_SHIFT.setLastCastedTime(TwosideKeeper.getServerTickTime()); @@ -422,6 +434,7 @@ public class SniperSkeleton extends GenericBoss{ ()->{attemptSpellCast(CRIPPLING_INFECTION);}, }; final Runnable[] actions2 = new Runnable[]{ + ()->{performDodge();}, ()->{attemptSpellCast(MODE_SHIFT);}, ()->{attemptSpellCast(CRIPPLING_INFECTION);}, ()->{if (meetsConditionsForSiphon()) { @@ -459,6 +472,7 @@ public class SniperSkeleton extends GenericBoss{ ent.remove(); } } + LivingEntityStructure.setCustomLivingEntityName(m, "Sniper Skeleton"); } } @@ -676,57 +690,60 @@ public class SniperSkeleton extends GenericBoss{ LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m); GlobalLoot gl = GlobalLoot.spawnGlobalLoot(m.getLocation(), ChatColor.AQUA+""+ChatColor.BOLD+les.getDifficultyAndMonsterName()+ChatColor.AQUA+""+ChatColor.BOLD+" Miniboss Loot"); double lootrate=1.0; - for (Player p : participantlist) { - PlayerMode mode = getMostUsedPlayerMode(p); - switch (diff) { - case T2_MINIBOSS:{ - lootrate+=0.5; - }break; - case T3_MINIBOSS:{ - lootrate+=1.0; - }break; - } - double lootamt = lootrate; - while (lootamt>0) { - if ((lootamt-1)>=0 || - Math.random()<=lootamt) { - gl.addNewDropInventory(p,GetSetPiece(diff,mode)); //Guaranteed Loot Piece. + for (String s : dpslist.keySet()) { + Player p = Bukkit.getPlayer(s); + if (p!=null) { + PlayerMode mode = getMostUsedPlayerMode(p); + switch (diff) { + case T2_MINIBOSS:{ + lootrate+=0.5; + }break; + case T3_MINIBOSS:{ + lootrate+=1.0; + }break; } - lootamt--; + double lootamt = lootrate; + while (lootamt>0) { + if ((lootamt-1)>=0 || + Math.random()<=lootamt) { + gl.addNewDropInventory(p,GetSetPiece(diff,mode)); //Guaranteed Loot Piece. + } + lootamt--; + } + AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); + AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); + + AttemptRoll(gl, 0.75*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE, (int)(Math.random()*3)+1)); + switch (diff) { + case T1_MINIBOSS:{ + AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); + }break; + case T2_MINIBOSS:{ + AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); + }break; + case T3_MINIBOSS:{ + AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); + AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); + }break; + } + //Artifact.createRecipe(5, ArtifactItemType.SHOVEL) + AttemptRoll(gl, 0.08*lootrate, p, GetArtifactRecipe(diff)); + AttemptRoll(gl, 0.02*lootrate, p, GetMaterialKit(diff)); + AttemptRoll(gl, 0.5*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,100).getItemStack()); + AttemptRoll(gl, 0.33*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,500).getItemStack()); + AttemptRoll(gl, 0.1*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,1000).getItemStack()); + AttemptRoll(gl, 0.5*lootrate, p, new DropRandomEnchantedBook(0,2).getItemStack()); + AttemptRoll(gl, 0.33*lootrate, p, new DropRandomEnchantedBook(0,4).getItemStack()); + AttemptRoll(gl, 0.1*lootrate, p, new DropRandomEnchantedBook(0,6).getItemStack()); + AttemptRoll(gl, 0.15*lootrate, p, TwosideKeeper.HUNTERS_COMPASS.getItemStack()); + AttemptRoll(gl, 0.05*lootrate, p, getVial(diff)); + AttemptRoll(gl, 0.1*lootrate, p, CustomItem.DailyToken()); } - AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); - AttemptRoll(gl, 0.33*lootrate, p, GetSetPiece(diff,PlayerMode.values()[(int)(Math.random()*PlayerMode.values().length)])); - - AttemptRoll(gl, 0.75*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE, (int)(Math.random()*3)+1)); - switch (diff) { - case T1_MINIBOSS:{ - AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); - }break; - case T2_MINIBOSS:{ - AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); - }break; - case T3_MINIBOSS:{ - AttemptRoll(gl, 0.5*lootrate, p, Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.25*lootrate, p, Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE, (int)(Math.random()*3)+1)); - AttemptRoll(gl, 0.125*lootrate, p, Artifact.createArtifactItem(ArtifactItem.MALLEABLE_BASE, 1)); - }break; - } - //Artifact.createRecipe(5, ArtifactItemType.SHOVEL) - AttemptRoll(gl, 0.08*lootrate, p, GetArtifactRecipe(diff)); - AttemptRoll(gl, 0.02*lootrate, p, GetMaterialKit(diff)); - AttemptRoll(gl, 0.5*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,100).getItemStack()); - AttemptRoll(gl, 0.33*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,500).getItemStack()); - AttemptRoll(gl, 0.1*lootrate, p, new DropRandomFood((int)(Math.random()*10)+1,0,0.5,1000).getItemStack()); - AttemptRoll(gl, 0.5*lootrate, p, new DropRandomEnchantedBook(0,2).getItemStack()); - AttemptRoll(gl, 0.33*lootrate, p, new DropRandomEnchantedBook(0,4).getItemStack()); - AttemptRoll(gl, 0.1*lootrate, p, new DropRandomEnchantedBook(0,6).getItemStack()); - AttemptRoll(gl, 0.15*lootrate, p, TwosideKeeper.HUNTERS_COMPASS.getItemStack()); - AttemptRoll(gl, 0.05*lootrate, p, getVial(diff)); - AttemptRoll(gl, 0.1*lootrate, p, CustomItem.DailyToken()); } } diff --git a/src/sig/plugin/TwosideKeeper/Room.java b/src/sig/plugin/TwosideKeeper/Room.java index ea35c91..327646f 100644 --- a/src/sig/plugin/TwosideKeeper/Room.java +++ b/src/sig/plugin/TwosideKeeper/Room.java @@ -71,8 +71,8 @@ public class Room { public void onLeaveEvent(Player p) { } - public void onPlayerDeath(Player p) { - + public boolean onPlayerDeath(Player p) { + return false; } public double getTankRoomMultiplier() { diff --git a/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java index 943cf55..4f3e2f3 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java @@ -53,12 +53,14 @@ public class DPSChallengeRoom extends Room{ BossBar timer; HashMap modes = new HashMap(); boolean roomFinished=false; + boolean died=false; public DPSChallengeRoom(Player p, ChunkGenerator generator) { super(generator); this.p=p; this.dmg=0; this.expireTime=0; + boolean died=false; this.started=false; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.locBeforeInstance = p.getLocation().clone(); @@ -105,44 +107,50 @@ public class DPSChallengeRoom extends Room{ private void keepHealthbarUpdated() { if (timer!=null) { - if (expireTime-TwosideKeeper.getServerTickTime()>0) { - timer.setProgress((expireTime-TwosideKeeper.getServerTickTime())/1200d); - if (expireTime-TwosideKeeper.getServerTickTime()<400) { - timer.setColor(BarColor.RED); + if (!died) { + if (expireTime-TwosideKeeper.getServerTickTime()>0) { + timer.setProgress((expireTime-TwosideKeeper.getServerTickTime())/1200d); + if (expireTime-TwosideKeeper.getServerTickTime()<400) { + timer.setColor(BarColor.RED); + } + } else { + //Time is up. + timer.removeAll(); + timer=null; + SoundUtils.playGlobalSound(new Location(instance,ROOM_WIDTH/2,1,ROOM_LENGTH/2), Sound.BLOCK_NOTE_PLING, 1.0f, 0.7f); + instance.strikeLightningEffect(new Location(instance,0,20,0)); + instance.strikeLightningEffect(new Location(instance,ROOM_WIDTH,20,0)); + instance.strikeLightningEffect(new Location(instance,0,20,ROOM_LENGTH)); + instance.strikeLightningEffect(new Location(instance,ROOM_WIDTH,20,ROOM_LENGTH)); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + pd.customtitle.modifyLargeCenterTitle(ChatColor.RED+"TIME UP!", 60); + pd.dpstrackinglocked=false; + p.sendMessage(pd.damagedata.OutputResults()); + pd.damagelogging=false; + pd.damagepool=0; + double dmg = GetHealthDifferences(); + p.sendMessage(""); + p.setFireTicks(0); + DecimalFormat df = new DecimalFormat("0.00"); + TwosideKeeper.dpschallenge_recordsHOF.addRecord(p, dmg, getMostUsedPlayerMode(p)); + TwosideKeeper.dpschallenge_records.addRecord(p, dmg, getMostUsedPlayerMode(p)); + p.sendMessage("You dealt a total of "+ChatColor.YELLOW+""+df.format(dmg)+" dmg"+ChatColor.RESET+"."); + for (LivingEntity l : mobs) { + l.remove(); + } + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (p!=null && p.isValid()) { + p.teleport(pd.locBeforeInstance); + Room.awardSuccessfulClear(p, TwosideKeeper.dpschallenge_records.getName()); + pd.locBeforeInstance=null; + } + roomFinished=true; + }, 20*5); } } else { - //Time is up. timer.removeAll(); timer=null; - SoundUtils.playGlobalSound(new Location(instance,ROOM_WIDTH/2,1,ROOM_LENGTH/2), Sound.BLOCK_NOTE_PLING, 1.0f, 0.7f); - instance.strikeLightningEffect(new Location(instance,0,20,0)); - instance.strikeLightningEffect(new Location(instance,ROOM_WIDTH,20,0)); - instance.strikeLightningEffect(new Location(instance,0,20,ROOM_LENGTH)); - instance.strikeLightningEffect(new Location(instance,ROOM_WIDTH,20,ROOM_LENGTH)); - PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - pd.customtitle.modifyLargeCenterTitle(ChatColor.RED+"TIME UP!", 60); - pd.dpstrackinglocked=false; - p.sendMessage(pd.damagedata.OutputResults()); - pd.damagelogging=false; - pd.damagepool=0; - double dmg = GetHealthDifferences(); - p.sendMessage(""); - p.setFireTicks(0); - DecimalFormat df = new DecimalFormat("0.00"); - TwosideKeeper.dpschallenge_recordsHOF.addRecord(p, dmg, getMostUsedPlayerMode(p)); - TwosideKeeper.dpschallenge_records.addRecord(p, dmg, getMostUsedPlayerMode(p)); - p.sendMessage("You dealt a total of "+ChatColor.YELLOW+""+df.format(dmg)+" dmg"+ChatColor.RESET+"."); - for (LivingEntity l : mobs) { - l.remove(); - } - Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ - if (p!=null && p.isValid()) { - p.teleport(pd.locBeforeInstance); - Room.awardSuccessfulClear(p, TwosideKeeper.dpschallenge_records.getName()); - pd.locBeforeInstance=null; - } - roomFinished=true; - }, 20*5); + SoundUtils.playGlobalSound(new Location(instance,ROOM_WIDTH/2,1,ROOM_LENGTH/2), Sound.BLOCK_NOTE_PLING, 1.0f, 0.5f); } } } @@ -351,4 +359,23 @@ public class DPSChallengeRoom extends Room{ TwosideKeeper.custommonsters.put(z.getUniqueId(), new ChallengeZombie(z)); mobs.add(z); } + + + public boolean onPlayerDeath(Player p) { + if (p.equals(this.p) && started) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + pd.customtitle.modifyLargeCenterTitle(ChatColor.RED+"FAILED", 60); + died=true; + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (p!=null && p.isValid()) { + p.teleport(pd.locBeforeInstance); + p.setFireTicks(0); + pd.locBeforeInstance=null; + } + roomFinished=true; + }, 5); + return true; + } + return false; + } } diff --git a/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java index 19f662a..bfd5b1c 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java @@ -222,7 +222,7 @@ public class ParkourChallengeRoom extends Room{ private void StartChallenge() { startTime = TwosideKeeper.getServerTickTime(); - lastLavaTime = TwosideKeeper.getServerTickTime(); + lastLavaTime = TwosideKeeper.getServerTickTime()+200; Block chest = instance.getBlockAt(ROOM_WIDTH/2, 1, ROOM_LENGTH/2); chest.setType(Material.CHEST); Chest c = (Chest)(chest.getState()); @@ -346,7 +346,7 @@ public class ParkourChallengeRoom extends Room{ inv.addItem(levitationpotion); ItemStack speedpotion = createCustomPotion(PotionEffectType.SPEED,20*60,2); inv.addItem(speedpotion); - inv.addItem(new ItemStack(Material.PUMPKIN_PIE,64,(byte)1)); + inv.addItem(new ItemStack(Material.PUMPKIN_PIE,64)); } private ItemStack createCustomPotion(PotionEffectType type, int duration, int amplifier) { @@ -357,7 +357,7 @@ public class ParkourChallengeRoom extends Room{ ItemUtils.setDisplayName(finalpotion, "Potion of "+GenericFunctions.CapitalizeFirstLetters(effects.get(0).getType().getName().replaceAll("_", ""))); return finalpotion; } - public void onPlayerDeath(Player p) { + public boolean onPlayerDeath(Player p) { if (p.equals(this.p) && started) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.inParkourChallengeRoom=false; @@ -373,6 +373,8 @@ public class ParkourChallengeRoom extends Room{ } roomFinished=true; }, 5); + return true; } + return false; } } diff --git a/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java index ab61579..df0e7f9 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java @@ -235,7 +235,7 @@ public class TankChallengeRoom extends Room { } - public void onPlayerDeath(Player p) { + public boolean onPlayerDeath(Player p) { if (p.equals(this.p) && started && !finished) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.inTankChallengeRoom=false; @@ -262,7 +262,9 @@ public class TankChallengeRoom extends Room { } roomFinished=true; }, 20*5); + return true; } + return false; } public double getTankRoomMultiplier() { diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index f2d3ef1..7b66df8 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -1255,6 +1255,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { getServer().getScheduler().scheduleSyncRepeatingTask(this, new runServerHeartbeat(this), 20l, 20l); getServer().getScheduler().scheduleSyncRepeatingTask(this, new runServerTick(), 1l, 1l); + InitializeBotCommands(); //log(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)+"",0); /*MonsterTemplate newtemp = new MonsterTemplate(new File(filesave+"/monsterdata/KingSlime.md")); @@ -1264,7 +1265,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } private static void InitializeBotCommands() { - //aPlugin.API.addCommand(StatCommand, "stats"); + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + + aPlugin.API.addCommand(args->{ + if (args.length==1) { + aPlugin.API.discordSendRawItalicized("Possible completions: "); + aPlugin.API.discordSendRaw(" **!daily dps**"); + aPlugin.API.discordSendRaw(" **!daily tank**"); + aPlugin.API.discordSendRaw(" **!daily parkour**"); + } else + if (args.length==2) { + switch (args[1].toLowerCase()) { + case "dps":{ + dpschallenge_records.announceRecords(); + dpschallenge_recordsHOF.announceRecords(); + }break; + case "tank":{ + tankchallenge_records.announceRecords(); + tankchallenge_recordsHOF.announceRecords(); + }break; + case "parkour":{ + parkourchallenge_records.announceRecords(); + parkourchallenge_recordsHOF.announceRecords(); + }break; + } + } + },"daily"); + }, 90); } public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { @@ -2203,7 +2230,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.giveItem(p, shard); } case "INSTANCE":{ - new ParkourChallengeRoom(p,new ParkourRoom(32,32)); + //new ParkourChallengeRoom(p,new ParkourRoom(32,32)); + new DPSChallengeRoom(p,new DPSRoom(32,32)); }break; case "CHALLENGEZOMBIE":{ Zombie z = (Zombie)(p.getWorld().spawnEntity(p.getLocation(), EntityType.ZOMBIE)); @@ -2220,7 +2248,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { dpschallenge_records.announceRecords(); }break; case "DAILYTOKEN":{ - GenericFunctions.giveItem(p, CustomItem.DailyToken()); + if (args.length==1) { + GenericFunctions.giveItem(p, CustomItem.DailyToken()); + } else { + GenericFunctions.giveItem(Bukkit.getPlayer(args[1]), CustomItem.DailyToken()); + SoundUtils.playLocalSound(Bukkit.getPlayer(args[1]), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f); + Bukkit.getPlayer(args[1]).sendMessage(ChatColor.GREEN+"You have been given a Daily Challenge Token."); + } }break; case "CHALLENGEREWARDS":{ ChallengeReward.provideAwards(); @@ -4601,7 +4635,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.lastuseddailysign=TwosideKeeper.getServerTickTime(); p.sendMessage(ChatColor.GOLD+"Click this sign again to play "+pd.nameoflastdailysign+ChatColor.RESET+"."); } else { - p.sendMessage(ChatColor.GOLD+"You must wait 24 hours to play "+pd.nameoflastdailysign+ChatColor.RESET+" again."); + long tickdiff = (pd.lastdpsDailyChallenge+12096000)-TwosideKeeper.getServerTickTime(); + TwosideKeeper.log("tickdiff is "+tickdiff, 5); + DecimalFormat df = new DecimalFormat("00"); + p.sendMessage(ChatColor.GOLD+"You must wait "+ChatColor.AQUA+DisplayTimeDifference(tickdiff)+ChatColor.RESET+" to play "+pd.nameoflastdailysign+ChatColor.RESET+" again."); } } } else @@ -4619,7 +4656,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.lastuseddailysign=TwosideKeeper.getServerTickTime(); p.sendMessage(ChatColor.GOLD+"Click this sign again to play "+pd.nameoflastdailysign+ChatColor.RESET+"."); } else { - p.sendMessage(ChatColor.GOLD+"You must wait 24 hours to play "+pd.nameoflastdailysign+ChatColor.RESET+" again."); + long tickdiff = (pd.lasttankDailyChallenge+12096000)-TwosideKeeper.getServerTickTime(); + TwosideKeeper.log("tickdiff is "+tickdiff, 5); + DecimalFormat df = new DecimalFormat("00"); + p.sendMessage(ChatColor.GOLD+"You must wait "+ChatColor.AQUA+DisplayTimeDifference(tickdiff)+ChatColor.RESET+" to play "+pd.nameoflastdailysign+ChatColor.RESET+" again."); } } } else @@ -4637,7 +4677,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.lastuseddailysign=TwosideKeeper.getServerTickTime(); p.sendMessage(ChatColor.GOLD+"Click this sign again to play "+pd.nameoflastdailysign+ChatColor.RESET+"."); } else { - p.sendMessage(ChatColor.GOLD+"You must wait 24 hours to play "+pd.nameoflastdailysign+ChatColor.RESET+" again."); + + long tickdiff = (pd.lastparkourDailyChallenge+12096000)-TwosideKeeper.getServerTickTime(); + TwosideKeeper.log("tickdiff is "+tickdiff, 5); + DecimalFormat df = new DecimalFormat("00"); + p.sendMessage(ChatColor.GOLD+"You must wait "+ChatColor.AQUA+DisplayTimeDifference(tickdiff)+ChatColor.RESET+" to play "+pd.nameoflastdailysign+ChatColor.RESET+" again."); } } } @@ -5029,56 +5073,58 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void onPlayerDeath(PlayerDeathEvent ev) { //Modify the death message. This is a fix for getting rid of the healthbar from the player name. final Player p = ev.getEntity(); - if (!DeathManager.deathStructureExists(p)) { - PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - pd.playermode_on_death=pd.lastmode; - if (pd.target!=null && - pd.target.getCustomName()!=null) { - ev.setDeathMessage(ev.getDeathMessage().replace(pd.target.getCustomName(), GenericFunctions.getDisplayName(pd.target))); + if (!p.getWorld().getName().contains("Instance")) { + if (!DeathManager.deathStructureExists(p)) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + pd.playermode_on_death=pd.lastmode; + if (pd.target!=null && + pd.target.getCustomName()!=null) { + ev.setDeathMessage(ev.getDeathMessage().replace(pd.target.getCustomName(), GenericFunctions.getDisplayName(pd.target))); + } + String[] parsed_msg = ev.getDeathMessage().split(" "); + //Get rid of the name. + //NOTE: If you change how the suffix looks YOU MUST UPDATE THIS! + String newDeathMsg=""; + for (int i=2;i0) { + TwosideKeeper.dpschallenge_records.announceRecords(); + } + if (TwosideKeeper.tankchallenge_records.recordlist.size()>0) { + TwosideKeeper.tankchallenge_records.announceRecords(); + } + if (TwosideKeeper.parkourchallenge_records.recordlist.size()>0) { + TwosideKeeper.parkourchallenge_records.announceRecords(); + } + aPlugin.API.discordSendRawItalicized("All Weekly Challenge Leaderboards have been reset!"); TwosideKeeper.dpschallenge_records.resetRecords(); TwosideKeeper.tankchallenge_records.resetRecords(); @@ -851,7 +863,7 @@ final class runServerHeartbeat implements Runnable { private void DepleteDamagePool(final long serverTickTime, Player p, PlayerStructure pd) { if (pd.damagepool>0 && pd.damagepooltime+20<=serverTickTime) { - double transferdmg = CustomDamage.getTransferDamage(p)+(pd.damagepool*0.03); + double transferdmg = CustomDamage.getTransferDamage(p)+(pd.damagepool*0.02); TwosideKeeper.log("Transfer Dmg is "+transferdmg+". Damage Pool: "+pd.damagepool, 5); CustomDamage.ApplyDamage(transferdmg, null, p, null, "Damage Pool", CustomDamage.IGNORE_DAMAGE_TICK|CustomDamage.TRUEDMG|CustomDamage.IGNOREDODGE); if (pd.damagepool-transferdmg<1) { @@ -861,6 +873,24 @@ final class runServerHeartbeat implements Runnable { } pd.customtitle.updateSideTitleStats(p); } + if (pd.rage_time>TwosideKeeper.getServerTickTime()) { + //Set all armor to durability 0. + ItemStack[] items = GenericFunctions.getEquipment(p, true); + for (ItemStack i : items) { + i.setDurability((short)0); + } + p.getEquipment().setItemInMainHand(items[0]); + p.getEquipment().setItemInOffHand(items[1]); + p.getEquipment().setHelmet(items[2]); + p.getEquipment().setChestplate(items[3]); + p.getEquipment().setLeggings(items[4]); + p.getEquipment().setBoots(items[5]); + } + } + + private boolean RottenFleshOnHotbar(Player p) { + // TODO Auto-generated method stub + return false; } private void AdventurerModeSetExhaustion(Player p) { @@ -1156,6 +1186,7 @@ final class runServerHeartbeat implements Runnable { } private void AutoConsumeFoods(Player p) { + /* if (p.getFoodLevel()<20 && PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN) { ItemStack[] contents = p.getInventory().getStorageContents(); for (int i=0;i=1) { + if (PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN) { + for (int i=0;i<9;i++) { + if (p.getInventory().getItem(i)!=null && + GenericFunctions.isAutoConsumeFood(p.getInventory().getItem(i))) { + p.setFoodLevel(Math.min(20, p.getFoodLevel()+1)); + double basepercent = p.getMaxHealth()*0.01; + pd.damagepool = pd.damagepool*0.99; + GenericFunctions.HealEntity(p,basepercent); + //p.getInventory().removeItem(singlecopy); + ItemStack item = p.getInventory().getItem(i).clone(); + if (item.getAmount()>1) { + item.setAmount(item.getAmount()-1); + p.getInventory().setItem(i, item); + SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f); + } else { + p.getInventory().setItem(i, new ItemStack(Material.AIR)); + SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_BURP, 1.0f, 1.0f); + } + return; + } + } + } } }