diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 3ae32ae..829e1b5 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 4731bc4..0c872ef 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.10.15 +version: 3.10.16 loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index a16c096..c955455 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -73,6 +73,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlockNode; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.IndicatorType; import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils; @@ -103,6 +104,7 @@ public class CustomDamage { public static final int IS_THORNS = 8; //System Flag. Used for telling a player structure their last hit was with thorns. static public boolean ApplyDamage(double damage, Entity damager, LivingEntity target, ItemStack weapon, String reason) { + TwosideKeeper.log("Weapon: "+weapon, 0); return ApplyDamage(damage,damager,target,weapon,reason,NONE); } @@ -193,6 +195,13 @@ public class CustomDamage { } } + private static void UpdateWeaponUsedForShooting(Entity damager) { + if (getDamagerEntity(damager) instanceof Player) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)(getDamagerEntity(damager))); + pd.weaponUsedForShooting=null; + } + } + private static double CalculateBonusTrueDamage(Entity damager, LivingEntity target, double dmg) { //TwosideKeeper.log("Run here. Damage: "+dmg, 0); if (getDamagerEntity(damager) instanceof Player) { @@ -223,14 +232,17 @@ public class CustomDamage { if (shooter!=null && (shooter instanceof Player)) { if (weapon!=null) { dmg+=getBaseWeaponDamage(damage, weapon, damager, target, reason); + TwosideKeeper.log("Weapon: "+weapon, 0); + DebugUtils.showStackTrace(); if (weapon.getType()==Material.BOW) { if ((damager instanceof Projectile)) { - TwosideKeeper.log("This is a projectile! Reason: "+reason+", Damager: "+damager.toString(), 5); + TwosideKeeper.log("This is a projectile! Reason: "+reason+", Damager: "+damager.toString(), 0); dmg += addToPlayerLogger(damager,target,"Custom Arrow",calculateCustomArrowDamageIncrease(weapon,damager,target)); dmg += addMultiplierToPlayerLogger(damager,target,"Ranger Mult",dmg * calculateRangerMultiplier(weapon,damager)); double headshotdmg = addMultiplierToPlayerLogger(damager,target,"Headshot Mult",dmg * calculateHeadshotMultiplier(weapon,damager,target)); if (headshotdmg!=0.0) {headshot=true;} dmg += headshotdmg; + TwosideKeeper.log("Damage currently is: "+dmg, 0); dmg += addMultiplierToPlayerLogger(damager,target,"Bow Drawback Mult",dmg * calculateBowDrawbackMultiplier(weapon,damager,target)); } } diff --git a/src/sig/plugin/TwosideKeeper/Events/InventoryUpdateEvent.java b/src/sig/plugin/TwosideKeeper/Events/InventoryUpdateEvent.java index 3c7ae5a..df4b748 100644 --- a/src/sig/plugin/TwosideKeeper/Events/InventoryUpdateEvent.java +++ b/src/sig/plugin/TwosideKeeper/Events/InventoryUpdateEvent.java @@ -42,8 +42,10 @@ public class InventoryUpdateEvent extends Event{ } public static void TriggerUpdateInventoryEvent(Player p, ItemStack item, UpdateReason reason) { - InventoryUpdateEvent ev = new InventoryUpdateEvent(p, item, reason); - Bukkit.getPluginManager().callEvent(ev); + if (item!=null) { + InventoryUpdateEvent ev = new InventoryUpdateEvent(p, item, reason); + Bukkit.getPluginManager().callEvent(ev); + } //TwosideKeeper.log("Triggered because of "+reason, 0); } diff --git a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java index 65e131f..37223e4 100644 --- a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java +++ b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java @@ -44,6 +44,7 @@ public class LivingEntityStructure { public long lastBurnTick=0; public float MoveSpeedMultBeforeCripple=1f; public Channel currentChannel=null; + public boolean isImportantGlowEnemy=true; final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET; final static String MODIFIED_NAME_DELIMITER = ChatColor.RESET+";"+ChatColor.RESET; @@ -193,7 +194,8 @@ public class LivingEntityStructure { //Updates the glow color for all players. We base it on default statuses here. CALL THIS INSTEAD OF // SETTING THE GLOW DIRECTLY ANYMORE! for (Player p : Bukkit.getOnlinePlayers()) { - if (p!=null && p.isValid() && !p.isDead()) { + //if (p!=null && p.isValid() && !p.isDead()) { + if (isImportantGlowEnemy) { if (GenericFunctions.isSuppressed(m)) { setGlow(p,GlowAPI.Color.BLACK); } else @@ -210,11 +212,13 @@ public class LivingEntityStructure { } } else if (getLeader() || (m instanceof Monster && GenericFunctions.isBossMonster((Monster)m))) { + //TwosideKeeper.log("Monster "+GenericFunctions.getDisplayName(m)+" is a Leader. Set the Glow.", 0); setGlow(p,GlowAPI.Color.DARK_RED); + //TwosideKeeper.log("Is glowing? "+GlowAPI.isGlowing(m, p)+", Glow color list contains key? "+glowcolorlist.containsKey(p.getUniqueId()), 0); } else if (GenericFunctions.isIsolatedTarget(m, p)) { setGlow(p,GlowAPI.Color.WHITE); - } + } else if (Knight.isKnight(m)) { setGlow(p,GlowAPI.Color.AQUA); } @@ -225,11 +229,18 @@ public class LivingEntityStructure { GlowAPI.setGlowing(m, null, p); glowcolorlist.remove(p.getUniqueId()); } + isImportantGlowEnemy=false; } - if (!GlowAPI.isGlowing(m, p) && glowcolorlist.containsKey(p.getUniqueId())) { - GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p); - } else - if (GlowAPI.isGlowing(m, p) && (p==null || !glowcolorlist.get(p.getUniqueId()).equals(GlowAPI.getGlowColor(m, p)))) { + //} + } + if (!GlowAPI.isGlowing(m, p) && glowcolorlist.containsKey(p.getUniqueId())) { + //TwosideKeeper.log("Set glow of "+GenericFunctions.getDisplayName(m)+" to "+glowcolorlist.get(p.getUniqueId()), 0); + GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p); + } else + if (GlowAPI.isGlowing(m, p) && (GlowAPI.getGlowColor(m, p)==null || !glowcolorlist.get(p.getUniqueId()).equals(GlowAPI.getGlowColor(m, p)))) { + if (GlowAPI.getGlowColor(m, p)==null) { + GlowAPI.setGlowing(m, null, p); + } else { GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p); } } diff --git a/src/sig/plugin/TwosideKeeper/Monster/Knight.java b/src/sig/plugin/TwosideKeeper/Monster/Knight.java index e26e0ca..81b7e9f 100644 --- a/src/sig/plugin/TwosideKeeper/Monster/Knight.java +++ b/src/sig/plugin/TwosideKeeper/Monster/Knight.java @@ -784,7 +784,11 @@ public class Knight extends CustomMonster{ Spider ss = DarkSpider.InitializeDarkSpider(m); //ss.setPassenger(s); //Determine distance from Twoside for Difficulty. - double chancer = TwosideKeeper.TWOSIDE_LOCATION.distanceSquared(m.getLocation()); + Location compareloc = TwosideKeeper.TWOSIDE_LOCATION; + if (!compareloc.getWorld().equals(s.getWorld())) { + compareloc = new Location(s.getWorld(),0,0,0); + } + double chancer = compareloc.distanceSquared(m.getLocation()); if (Math.random()*chancer<4000000) { MonsterController.convertLivingEntity(m, LivingEntityDifficulty.T1_MINIBOSS); } else diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index fb7dc23..4b2406a 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -208,7 +208,7 @@ public class PlayerStructure { public long lastActionBarMessageTime=0; public long lastsantabox2; public double regenpool=0; - public boolean vacuumsuckup=true; + //public boolean vacuumsuckup=true; public boolean equipweapons=true; public boolean equiparmor=true; public long lastpotionparticles=0; @@ -231,6 +231,7 @@ public class PlayerStructure { public HashMap> itemsets = new HashMap>(); //HashMap<"Set Name",HashMap<"Tier","Amt">> public boolean damagenumbers=true; public OptionsMenu optionsmenu; + public ItemStack weaponUsedForShooting; //Needs the instance of the player object to get all other info. Only to be called at the beginning. @SuppressWarnings("deprecation") @@ -288,7 +289,7 @@ public class PlayerStructure { this.damagelogging=false; this.isPlayingSpleef=false; this.iframetime=TwosideKeeper.getServerTickTime(); - this.vacuumsuckup=true; + //this.vacuumsuckup=true; this.equipweapons=true; this.equiparmor=true; this.customtitle = new AdvancedTitle(p); @@ -396,7 +397,7 @@ public class PlayerStructure { workable.set("holidaychest3", holidaychest3); workable.set("holidaychest4", holidaychest4); workable.set("lastsantabox2", lastsantabox2); - workable.set("vacuumsuckup", vacuumsuckup); + //workable.set("vacuumsuckup", vacuumsuckup); workable.set("equipweapons", equipweapons); workable.set("equiparmor", equiparmor); workable.set("healthbardisplay", healthbardisplay); @@ -517,7 +518,7 @@ public class PlayerStructure { workable.addDefault("holidaychest3", holidaychest3); workable.addDefault("holidaychest4", holidaychest4); workable.addDefault("lastsantabox2", lastsantabox2); - workable.addDefault("vacuumsuckup", vacuumsuckup); + //workable.addDefault("vacuumsuckup", vacuumsuckup); workable.addDefault("equipweapons", equipweapons); workable.addDefault("equiparmor", equiparmor); workable.addDefault("playermode_on_death", playermode_on_death.name()); @@ -605,7 +606,7 @@ public class PlayerStructure { this.lastusedwindslash = workable.getLong("COOLDOWN_lastusedwindslash"); this.lastusedbeastwithin = workable.getLong("COOLDOWN_lastusedbeastwithin"); this.lastusedunstoppableteam = workable.getLong("COOLDOWN_lastusedunstoppableteam"); - this.vacuumsuckup = workable.getBoolean("vacuumsuckup"); + //this.vacuumsuckup = workable.getBoolean("vacuumsuckup"); this.equipweapons = workable.getBoolean("equipweapons"); this.equiparmor = workable.getBoolean("equiparmor"); this.rangermode = BowMode.valueOf(workable.getString("rangermode")); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 7937c40..b7720a5 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -534,7 +534,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static List weather_watch_users = new ArrayList(); - public final static int MAX_PIGMEN_AGGRO_AT_ONCE = 4; + public final static int MAX_PIGMEN_AGGRO_AT_ONCE = 8; public static long lastPigmanAggroTime = 0; public static long pigmanAggroCount = 0; @@ -2474,13 +2474,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.sendMessage(aPlugin.API.getHabitatMap(p, 7)); return true; } else - if (cmd.getName().equalsIgnoreCase("vac")) { - Player p = (Player)sender; - PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - pd.vacuumsuckup=!pd.vacuumsuckup; - p.sendMessage("Vacuum Cube suction is now turned "+(pd.vacuumsuckup?ChatColor.GREEN+"ON":ChatColor.RED+"OFF")+ChatColor.RESET+"."); - return true; - } else if (cmd.getName().equalsIgnoreCase("equip_weapon")) { Player p = (Player)sender; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); @@ -3325,6 +3318,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { TemporaryBlock.createTemporaryBlockCircle(proj.getLocation().add(0,-2,0), 2, Material.REDSTONE_BLOCK, (byte)0, 100, "FIRECESSPOOL"); proj.setMetadata("FIREPOOL", new FixedMetadataValue(this,true)); }*/ + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + //pd.weaponUsedForShooting=null; } if (ev.getEntity() instanceof Arrow) { @@ -5626,7 +5621,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { return; } - InventoryUpdateEvent.TriggerUpdateInventoryEvent(player,ev.getCursor(),UpdateReason.INVENTORYUPDATE); + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (ev.getClick()==ClickType.LEFT) { + InventoryUpdateEvent.TriggerUpdateInventoryEvent(player,ev.getCursor(),UpdateReason.INVENTORYUPDATE); + InventoryUpdateEvent.TriggerUpdateInventoryEvent(player,ev.getCurrentItem(),UpdateReason.INVENTORYUPDATE); + } else { + InventoryUpdateEvent.TriggerUpdateInventoryEvent(player,new ItemStack(Material.HOPPER_MINECART),UpdateReason.INVENTORYUPDATE); + } + },1); if (DeathManager.deathStructureExists(player) && ev.getInventory().getTitle().equalsIgnoreCase("Death Loot")) { //See how many items are in our inventory. Determine final balance. @@ -6829,6 +6831,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.customtitle.updateSideTitleStats(p); ev.setCancelled(true); } else { + if (weapon.getType()==Material.AIR && pd.weaponUsedForShooting!=null) { + TwosideKeeper.log("Using weapon "+pd.weaponUsedForShooting+" as a substitute", 0); + weapon=pd.weaponUsedForShooting.clone(); + pd.weaponUsedForShooting=null; + } CustomDamage.ApplyDamage(0, ev.getDamager(), (LivingEntity)ev.getEntity(), weapon, null); if (ev.getDamager() instanceof Projectile) { Projectile proj = (Projectile)ev.getDamager(); @@ -7275,7 +7282,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } if (ev.getEntity() instanceof LivingEntity && ev.getReason()==TargetReason.PIG_ZOMBIE_TARGET) { - if (pigmanAggroCount{ + InventoryUpdateEvent.TriggerUpdateInventoryEvent(p,ev.getItem().getItemStack(),UpdateReason.PICKEDUPITEM); + }, 1); ItemStack newstack = InventoryUtils.AttemptToFillPartialSlotsFirst(p,ev.getItem().getItemStack()); TwosideKeeper.PickupLogger.AddEntry("Fill Partial Slots First", (int)(System.nanoTime()-time));time=System.nanoTime(); //TwosideKeeper.log(" New Stack is: "+newstack,0); @@ -8445,7 +8456,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (ev.getRemaining()>0) { Item it = ev.getItem(); it.getItemStack().setAmount(ev.getRemaining()); - GenericFunctions.giveItem(p, it.getItemStack()); + //GenericFunctions.giveItem(p, it.getItemStack()); + GenericFunctions.dropItem(it.getItemStack(), p.getLocation()); } ev.getItem().remove();ev.setCancelled(true);return;} TwosideKeeper.PickupLogger.AddEntry("Pickup Item when it's null", (int)(System.nanoTime()-time));time=System.nanoTime(); @@ -8965,9 +8977,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (arr.getShooter() instanceof Player) { Player p = (Player)(arr.getShooter()); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{ ItemStack tempitem = p.getEquipment().getItemInMainHand().clone(); Location loc = p.getLocation().clone(); + pd.weaponUsedForShooting = tempitem; p.getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{ if (p!=null && p.isValid()) { diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java index 32b2091..2f038c8 100644 --- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java +++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java @@ -1033,9 +1033,7 @@ final class runServerHeartbeat implements Runnable { } } } else { - if (pd.vacuumsuckup) { - ent.setVelocity(new Vector(xvel,yvel,zvel)); - } + ent.setVelocity(new Vector(xvel,yvel,zvel)); } /*if (ent.getLocation().getX()