diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 155ea3a..2324f94 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 5033910..1a2351b 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.10.6 +version: 3.10.6a loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java b/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java new file mode 100644 index 0000000..5097fbb --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java @@ -0,0 +1,80 @@ +package sig.plugin.TwosideKeeper.Boss; + +import java.util.List; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import sig.plugin.TwosideKeeper.EliteMonster; +import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; + +public class EliteGuardian extends EliteMonster{ + Location firstHitLoc = null; + boolean cutsceneplayed=false; + STATE state = STATE.WAITINGFORCUTSCENE; + int cutscenetimer=0; + + public EliteGuardian(Monster m) { + super(m); + } + + public void runTick() { + //This monster constantly gives itself its buffs as it may lose some (Debilitation mode). + increaseBarTextScroll(); + dontDrown(); + regenerateHealth(); + resetToSpawn(); + createBossHealthbar(); + ignoreAllOtherTargets(); + runStateMachine(); + if (m.isValid() && targetlist.size()>0) { + getGlow(); + } + } + + private void runStateMachine() { + switch (state) { + case PASSIVE: + m.setAI(true); + break; + case WAITINGFORCUTSCENE: + List nearby = GenericFunctions.getNearbyPlayers(m.getLocation(), 4); + if (nearby.size()>0) { + List nearby2 = GenericFunctions.getNearbyPlayers(m.getLocation(), 16); + //Play the cutscene for all of these players. + for (Player p : nearby2) { + p.setVelocity(new Vector(0,0,0)); + if (cutscenetimer==0) { + p.setGameMode(GameMode.SPECTATOR); + p.setSpectatorTarget(m); + } + } + if (cutscenetimer==0) { + GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 40, 1, m); + } + cutscenetimer++; + if (cutscenetimer>100) { + state=STATE.PASSIVE; + } + } + m.setAI(false); + break; + default: + break; + } + } + + public void runHitEvent(LivingEntity damager, double dmg) { + super.runHitEvent(damager,dmg); + } + + enum STATE { + PASSIVE, //Just works like vanilla Minecraft behavior. + WAITINGFORCUTSCENE, //A mode where the game is waiting for a cutscene to occur. The Elite Guardian does not move during this time. + } +} diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 09f2818..fc5f67d 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -247,10 +247,12 @@ public class CustomDamage { dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"POISON Mult",dmg * calculatePoisonEffectMultiplier(target)); dmg += addMultiplierToPlayerLogger(damager,target,"Airborne Mult",dmg * calculateAirborneAttackMultiplier(shooter)); - double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags)); - if (critdmg!=0.0) {crit=true; - aPlugin.API.critEntity(target, 15);} - dmg += critdmg; + if (reason==null || !reason.equalsIgnoreCase("Test Damage")) { + double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags)); + if (critdmg!=0.0) {crit=true; + aPlugin.API.critEntity(target, 15);} + dmg += critdmg; + } double armorpendmg = addToPlayerLogger(damager,target,"Armor Pen",calculateArmorPen(damager,dmg,weapon)); if (!isFlagSet(flags, TRUEDMG) && (target instanceof Player && PlayerMode.getPlayerMode((Player)target)!=PlayerMode.BARBARIAN)) { dmg -= getDamageFromBarbarianSetBonus(target); diff --git a/src/sig/plugin/TwosideKeeper/EliteMonster.java b/src/sig/plugin/TwosideKeeper/EliteMonster.java index fdbafe0..4253588 100644 --- a/src/sig/plugin/TwosideKeeper/EliteMonster.java +++ b/src/sig/plugin/TwosideKeeper/EliteMonster.java @@ -140,15 +140,9 @@ public class EliteMonster { } m.teleport(myspawn); m.setHealth(m.getMaxHealth()); - if (dpslist.size()>0) { - Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed..."); - Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:"); - Bukkit.getServer().broadcastMessage(generateDPSReport()); - aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```"); - } + AnnounceFailedTakedown(); bar.setColor(BarColor.WHITE); first_willpower_notification=false; - dpslist.clear(); willpower=0; bar.removeAll(); willpower_bar.removeAll(); @@ -168,6 +162,16 @@ public class EliteMonster { } } + private void AnnounceFailedTakedown() { + if (dpslist.size()>0) { + Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed..."); + Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:"); + Bukkit.getServer().broadcastMessage(generateDPSReport()); + aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```"); + dpslist.clear(); + } + } + protected void dontDrown() { m.setRemainingAir(m.getMaximumAir()); } @@ -259,6 +263,7 @@ public class EliteMonster { currentdps = dpslist.get(p.getName()); } dpslist.put(p.getName(), currentdps+dmg); + TwosideKeeper.log(p.getName()+"'s Damage: "+dpslist.get(p.getName()), 0); } last_regen_time=TwosideKeeper.getServerTickTime(); } @@ -358,6 +363,7 @@ public class EliteMonster { public void Cleanup() { // Remove all healthbars before destroying. + AnnounceFailedTakedown(); removeAllHealthbars(); } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 669c64a..80a3544 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -69,6 +69,7 @@ import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.Recipes; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeperAPI; +import sig.plugin.TwosideKeeper.Boss.EliteGuardian; import sig.plugin.TwosideKeeper.Boss.EliteZombie; import sig.plugin.TwosideKeeper.Boss.MegaWither; import sig.plugin.TwosideKeeper.Events.PlayerLineDriveEvent; @@ -111,6 +112,13 @@ public class GenericFunctions { } public static ItemStack breakHardenedItem(ItemStack item, Player p) { + + /*StackTraceElement[] stacktrace = new Throwable().getStackTrace(); + StringBuilder stack = new StringBuilder("Mini stack tracer:"); + for (int i=0;i0) { ItemMeta m = item.getItemMeta(); @@ -159,8 +167,7 @@ public class GenericFunctions { if (p!=null) { p.sendMessage(ChatColor.LIGHT_PURPLE+"You still feel the artifact's presence inside of you..."); } - convertArtifactToDust(item); - return null; + return convertArtifactToDust(item); } return null; } @@ -189,7 +196,7 @@ public class GenericFunctions { item.setItemMeta(m); item.setType(Material.SULPHUR); item.setDurability((short)0); - item.setAmount(1); + //item.setAmount(1); return item; } @@ -4632,6 +4639,13 @@ public class GenericFunctions { target.setHealth(188000); return new MegaWither(target); } + if (TwosideKeeper.ELITEGUARDIANS_ACTIVATED) { + if (target instanceof Guardian) { + target.setMaxHealth(120000); + target.setHealth(120000); + return new EliteGuardian(target); + } + } TwosideKeeper.log("Elite Monster for monster "+target.getName()+" UNDEFINED. Defaulting to EliteZombie type.", 0); return new EliteZombie(target); } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java index eddc34c..c3b483d 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java @@ -150,7 +150,7 @@ public class ItemUtils { if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) { //See what the previous time was. time = Long.parseLong(ChatColor.stripColor(oldlore.get(i))); - return (time+12096000 - TwosideKeeper.getServerTickTime()); + return (time + 12096000 - TwosideKeeper.getServerTickTime()); } } } @@ -160,7 +160,7 @@ public class ItemUtils { /** * Set a new amount of time in ticks required before the item will turn from dust back into an artifact. - * Returns a new modified version of the item. + * Returns a new modified version of the item. If the time remaining of the Artifact Dust is 0 or lower, it will automatically turn into a regular item again! */ public static ItemStack setArtifactDustTimeRemaining(ItemStack item, long newtime) { if (isArtifactDust(item)) { @@ -170,12 +170,15 @@ public class ItemUtils { if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) { //See what the previous time was. time = Long.parseLong(ChatColor.stripColor(oldlore.get(i))); - oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+(TwosideKeeper.getServerTickTime()-newtime+12096000)); + oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+(TwosideKeeper.getServerTickTime() - 12096000 + newtime)); } } ItemMeta m = item.getItemMeta(); m.setLore(oldlore); item.setItemMeta(m); + if (newtime<=0) { + item = GenericFunctions.convertArtifactDustToItem(item); + } } return item; } @@ -188,7 +191,7 @@ public class ItemUtils { *

* Returns a modified version of the item. */ - public static void addArtifactDustTime(ItemStack item, long amt) { + public static ItemStack addArtifactDustTime(ItemStack item, long amt) { if (isArtifactDust(item)) { long time = TwosideKeeper.getServerTickTime(); List oldlore = item.getItemMeta().getLore(); @@ -197,7 +200,7 @@ public class ItemUtils { //See what the previous time was. time = Long.parseLong(ChatColor.stripColor(oldlore.get(i))); time += amt; - oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime()); + oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+time); TwosideKeeper.log("Time is "+time, 5); break; } @@ -209,6 +212,7 @@ public class ItemUtils { item = GenericFunctions.convertArtifactDustToItem(item); } } + return item; } public static ItemStack createRandomFirework() { diff --git a/src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java b/src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java index ccfec7b..f030e79 100644 --- a/src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java +++ b/src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java @@ -13,7 +13,7 @@ import sig.plugin.TwosideKeeper.TwosideKeeper; public class DamageLogger { public HashMap breakdownlist; double totaldmg; - double actualtotaldmg=0.0; + public double actualtotaldmg=0.0; double calculatedtotaldmg=0.0; double totalmult=0.0; double lasttotaldmg=0.0; diff --git a/src/sig/plugin/TwosideKeeper/Monster/Wither.java b/src/sig/plugin/TwosideKeeper/Monster/Wither.java index 88e524b..f2efc85 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/Wither.java +++ b/src/sig/plugin/TwosideKeeper/Monster/Wither.java @@ -193,4 +193,10 @@ public class Wither extends CustomMonster{ } return closestplayer; } + + public void Cleanup() { + if (dmgbreakdown.size()>0) { + DisplayFailedDPSReport(); + } + } } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index fc66c49..91e3ffd 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -44,6 +44,7 @@ import org.bukkit.entity.AreaEffectCloud; import org.bukkit.entity.Arrow; import org.bukkit.entity.Bat; import org.bukkit.entity.Blaze; +import org.bukkit.entity.Chicken; import org.bukkit.entity.Creeper; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon.Phase; @@ -53,6 +54,7 @@ import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Fireball; import org.bukkit.entity.Ghast; +import org.bukkit.entity.Guardian; import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Variant; @@ -485,6 +487,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public final static boolean CHRISTMASEVENT_ACTIVATED=false; public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false; //Limited Christmas drops/functionality remain while the majority of it is turned off. + public final static boolean ELITEGUARDIANS_ACTIVATED=true; + public static final Set LIVING_ENTITY_TYPES = ImmutableSet.of( EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN, EntityType.COW,EntityType.CREEPER,EntityType.HORSE,EntityType.GUARDIAN,EntityType.ENDER_DRAGON, @@ -728,6 +732,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { for (CustomMonster cs : custommonsters.values()) { if (cs.m==null || !cs.m.isValid() || !cs.isAlive()) { //This has to be removed... + if (cs instanceof sig.plugin.TwosideKeeper.Monster.Wither) { + sig.plugin.TwosideKeeper.Monster.Wither w = (sig.plugin.TwosideKeeper.Monster.Wither)cs; + w.Cleanup(); + } ScheduleRemoval(custommonsters,cs.m.getUniqueId()); } else { cs.runTick(); @@ -736,6 +744,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Control elite monsters. for (EliteMonster em : elitemonsters) { if (!em.m.isValid()) { + em.Cleanup(); ScheduleRemoval(elitemonsters,em); } else { em.runTick(); @@ -1073,13 +1082,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { int spl = TwosideSpleefGames.spleef_game_list.size(); int nod = TwosideRecyclingCenter.nodes.size(); int ite = TwosideRecyclingCenter.itemmap.size(); - HashMap ope = GetFullStructureMap("ope"); - HashMap dam = GetFullStructureMap("dam"); - HashMap dea = GetFullStructureMap("dea"); - HashMap hit = GetFullStructureMap("hit"); - HashMap ite2 = GetFullStructureMap("ite"); - HashMap las = GetFullStructureMap("las"); - HashMap blo2 = GetFullStructureMap("blo2"); + int pri = WorldShop.pricelist.size(); + int ope = GetFullStructureMap("ope"); + int dam = GetFullStructureMap("dam"); + int dea = GetFullStructureMap("dea"); + int hit = GetFullStructureMap("hit"); + int ite2 = GetFullStructureMap("ite"); + int las = GetFullStructureMap("las"); + int blo2 = GetFullStructureMap("blo2"); DecimalFormat df = new DecimalFormat("0.00"); sender.sendMessage(ChatColor.WHITE+"TPS: "+GetTPSColor(tps)+df.format(tps)); sender.sendMessage(ChatColor.WHITE+Display("SNO",sno)+Display("PLA",pla)+Display("LIV",liv)); @@ -1090,9 +1100,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { sender.sendMessage(ChatColor.WHITE+Display("VAL",val)+Display("TEM4",tem4)+Display("NOT",not)); sender.sendMessage(ChatColor.WHITE+Display("SUP",sup)+Display("LAV",lav)+Display("LOC",loc)); sender.sendMessage(ChatColor.WHITE+Display("STA",sta)+Display("SPL",spl)+Display("NOD",nod)); - sender.sendMessage(ChatColor.WHITE+Display("ITE",ite)+Display("P-OPE",ope.size())+Display("P-DAM",dam.size())); - sender.sendMessage(ChatColor.WHITE+Display("P-DEA",dea.size())+Display("P-HIT",hit.size())+Display("P-ITE2",ite2.size())); - sender.sendMessage(ChatColor.WHITE+Display("P-LAS",las.size())+Display("P-BLO2",blo2.size())); + sender.sendMessage(ChatColor.WHITE+Display("ITE",ite)+Display("PRI",pri)+Display("P-OPE",ope)); + sender.sendMessage(ChatColor.WHITE+Display("P-DEA",dea)+Display("P-HIT",hit)+Display("P-ITE2",ite2)); + sender.sendMessage(ChatColor.WHITE+Display("P-LAS",las)+Display("P-BLO2",blo2)+Display("P-DAM",dam)); sender.sendMessage(ChatColor.WHITE+DisplayPlayerBar()); sender.sendMessage(ChatColor.WHITE+"To view a specific player's usage, use "+ChatColor.GREEN+"\"/debugreport \""); sender.sendMessage(ChatColor.WHITE+"To view specific entities' usage, use "+ChatColor.GREEN+"\"/debugreport ALLENTS\""); @@ -2019,34 +2029,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener { return totalsize; } - private HashMap GetFullStructureMap(String string) { - HashMap newmap = new HashMap(); + private int GetFullStructureMap(String string) { + int total = 0; for (Player p : Bukkit.getOnlinePlayers()) { switch (string) { case "ope":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).openeditemcube.size()); + total+=PlayerStructure.GetPlayerStructure(p).openeditemcube.size(); }break; case "dam":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).damagedata.breakdownlist.size()); + total+=PlayerStructure.GetPlayerStructure(p).damagedata.breakdownlist.size(); }break; case "dea":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).deathloot.size()); + total+=PlayerStructure.GetPlayerStructure(p).deathloot.size(); }break; case "hit":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).hitlist.size()); + total+=PlayerStructure.GetPlayerStructure(p).hitlist.size(); }break; case "ite":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).itemcubelist.size()); + total+=PlayerStructure.GetPlayerStructure(p).itemcubelist.size(); }break; case "las":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).lasteffectlist.size()); + total+=PlayerStructure.GetPlayerStructure(p).lasteffectlist.size(); }break; case "blo":{ - newmap.put(p, PlayerStructure.GetPlayerStructure(p).blockscanlist.size()); + total+=PlayerStructure.GetPlayerStructure(p).blockscanlist.size(); }break; } } - return newmap; + return total; } @@ -5362,7 +5372,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener { @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void onChunkLoadEvent(ChunkLoadEvent ev) { //Grab all entities. Create monster structures for all monsters. Detect elites and leaders and set their status accordingly. - if (TwosideKeeper.livingentitydata!=null) { for (Entity e : ev.getChunk().getEntities()) { if (e!=null && e.isValid() && (e instanceof LivingEntity)) { @@ -5419,6 +5428,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (m instanceof Wither) { ms.SetLeader(true); } + if (TwosideKeeper.ELITEGUARDIANS_ACTIVATED) { + if (m instanceof Guardian) { + Guardian g = (Guardian)m; + if (g.isElder()) { + ms.SetElite(true); + g.setCustomName(ChatColor.LIGHT_PURPLE+"Elite Guardian"); + g.setCustomNameVisible(true); + } + } + } } } @@ -6459,7 +6478,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { AttemptToPlaceChest(m.getLocation(),1,1,1,aPlugin.API.Chests.LOOT_CUSTOM_5); for (UUID id : custommonsters.keySet()) { - if (id.equals(m.getUniqueId())) { + if (id.equals(m.getUniqueId())) { sig.plugin.TwosideKeeper.Monster.Wither w = (sig.plugin.TwosideKeeper.Monster.Wither)custommonsters.get(id); w.DisplaySuccessfulDPSReport(); break; @@ -6477,7 +6496,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Player pl = participants.get(i); if (pl!=null && pl.isOnline()) { ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300); - exp.setInvulnerable(true); + exp.setInvulnerable(true); if (m instanceof Zombie) { Zombie z = (Zombie)m; if (z.isBaby()) { @@ -6797,7 +6816,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } - @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) + @EventHandler(priority=EventPriority.LOW) public void onBrokenItem(PlayerItemBreakEvent ev) { //When an item breaks, check if it has the ChatColor.GRAY+"Breaks Remaining: " line. //If it does, that means it can still be alive longer and not break. @@ -6812,8 +6831,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ItemStack test = GenericFunctions.breakHardenedItem(item,p); if (test!=null) { //We have to give this player the item! - TwosideKeeper.log("We have to give this player the item", 0); - GenericFunctions.giveItem(p, test); + if (test.getAmount()==0) { + test.setAmount(1); //We can't give 0 of something. + } + //Scan the inventory for this item. If it already exists do not give one. + boolean foundone=false; + for (ItemStack items : p.getInventory().getContents()) { + if (test.isSimilar(items)) { + foundone=true; + TwosideKeeper.log("Found one of these in the player's inventory already. Do not allow this item to be duplicated!", 0); + break; + } + } + if (!foundone) { + GenericFunctions.giveItem(p, test); + } } breakdownItem(item,p); } @@ -7018,7 +7050,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void onaPluginPickupEvent(PlayerGainItemEvent ev) { - //TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] PlayerGainItemEvent fired w/ "+ev.getItemStack(), 1); + TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] PlayerGainItemEvent fired w/ "+ev.getItemStack(), 1); Player p = ev.getPlayer(); ItemStack newstack = InventoryUtils.AttemptToFillPartialSlotsFirst(p,ev.getItemStack()); if (newstack==null) { @@ -9167,7 +9199,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener { boolean all = (additional.equalsIgnoreCase("all")); boolean equip = (additional.equalsIgnoreCase("equip")); if (all) {receiver.sendMessage("Habitat Quality: "+habitat_data.getHabitationLevel(p.getLocation()));} + Arrow temporaryarrow = (Arrow)p.getWorld().spawnArrow(p.getLocation().add(0,1000000,0), new Vector(1,1,1), 0.6f, 12f); + temporaryarrow.setShooter(p); + if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) { + store2=CustomDamage.getBaseWeaponDamage(p.getEquipment().getItemInMainHand(), temporaryarrow, null); + } receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2)); + Chicken temporarychicken = (Chicken)p.getWorld().spawnEntity(p.getLocation().add(0,1000000,0), EntityType.CHICKEN); //Why are you so cruel to the chicken sig. + HashMap origmap = (HashMap) pd.damagedata.breakdownlist.clone(); + double origdmg = pd.damagedata.actualtotaldmg; + if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) { + receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Applied Damage: "+ChatColor.RESET+""+ChatColor.LIGHT_PURPLE+df.format(CustomDamage.CalculateDamage(store2,temporaryarrow,temporarychicken,null, "Test Damage"))); + } else { + receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Applied Damage: "+ChatColor.RESET+""+ChatColor.LIGHT_PURPLE+df.format(CustomDamage.CalculateDamage(store2,p,temporarychicken,p.getEquipment().getItemInMainHand(), "Test Damage"))); + } + pd.damagedata.actualtotaldmg=origdmg; + pd.damagedata.breakdownlist=origmap; + temporarychicken.remove(); + temporaryarrow.remove(); double damagereduction = (1.0-store1)*100; if (all || damagereduction>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%");} double lifestealamt = CustomDamage.calculateLifeStealAmount(p,p.getEquipment().getItemInMainHand())*100; diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java index 7d4dd27..0031eb7 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java @@ -28,6 +28,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils; public final class TwosideKeeperAPI { //MONEY COMMANDS. @@ -175,6 +176,45 @@ public final class TwosideKeeperAPI { return AwakenedArtifact.addMaxAP(item, maxap); } + //Artifact Dust Commands. + /** + * Returns true if the item is an Artifact Dust. False otherwise. + */ + public static boolean isArtifactDust(ItemStack item) { + return ItemUtils.isArtifactDust(item); + } + /** + * Returns the amount of time in ticks remaining before the Artifact Dust will + * successfully convert back to an item. + */ + public static long getArtifactDustTimeRemaining(ItemStack item) { + return ItemUtils.getArtifactDustTimeRemaining(item); + } + /** + * Sets the amount of time in ticks remaining before the Artifact Dust will + * successfully convert back to an item. + *

+ * If newtime is set to 0 or less, the item will automatically convert + * back to its original artifact state. + * + * @return The ItemStack modified. + */ + public static ItemStack setArtifactDustTimeRemaining(ItemStack item, long newtime) { + return ItemUtils.setArtifactDustTimeRemaining(item, newtime); + } + /** + * Adjusts the amount of time in ticks remaining before the Artifact Dust will + * successfully convert back to an item. + *

+ * If the value of amt is negative and Math.abs(amt) is greater than the + * amount of dust time currently on the item, it will automatically convert back + * to its original artifact state. + * @return The ItemStack modified. + */ + public static ItemStack addArtifactDustTimeRemaining(ItemStack item, long amt) { + return ItemUtils.addArtifactDustTime(item, amt); + } + //Time Commands. public static long getServerTickTime() { return TwosideKeeper.getServerTickTime(); diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java index 74f1256..67b7d15 100644 --- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java +++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java @@ -782,6 +782,7 @@ final class runServerHeartbeat implements Runnable { } } if (!hasstruct) { + TwosideKeeper.log("Added Elite Monster "+ms.m, 0); TwosideKeeper.elitemonsters.add(GenericFunctions.getProperEliteMonster((Monster)(ms.m))); } }