diff --git a/.classpath b/.classpath index 043ba81..f80780e 100644 --- a/.classpath +++ b/.classpath @@ -6,5 +6,6 @@ + diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 3fa3c5a..e78d94a 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 508ce71..c34fb8b 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.10.9c +version: 3.10.9dr1 loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/Boss/Arena.java b/src/sig/plugin/TwosideKeeper/Boss/Arena.java index 5376cd1..c0d69e7 100644 --- a/src/sig/plugin/TwosideKeeper/Boss/Arena.java +++ b/src/sig/plugin/TwosideKeeper/Boss/Arena.java @@ -97,6 +97,7 @@ public class Arena { } } for (Player p : Bukkit.getOnlinePlayers()) { + TwosideKeeper.log("Checking for "+p.getName(), 0); if (p.getGameMode()==GameMode.SURVIVAL) { if (arenaplayers.contains(p)) { if (!insideBoundaries(p)) { diff --git a/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java b/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java index a457811..0daac04 100644 --- a/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java +++ b/src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java @@ -23,6 +23,7 @@ public class EliteGuardian extends EliteMonster{ int cutscenetimer=0; Camera cam; Arena arena; + Location startedspot; public EliteGuardian(Monster m) { super(m); @@ -95,9 +96,11 @@ public class EliteGuardian extends EliteMonster{ arena.AddPlayers(nearby2.toArray(new Player[nearby2.size()])); arena.AssembleArena(); TwosideKeeper.arenas.add(arena); + startedspot = m.getLocation().clone(); } } m.setAI(false); + m.setVelocity(new Vector(0,0,0)); break; case RUNNINGCUTSCENE: cutscenetimer++; @@ -106,6 +109,8 @@ public class EliteGuardian extends EliteMonster{ cam.Cleanup(); } m.setAI(false); + m.setVelocity(new Vector(0,0,0)); + m.teleport(startedspot); break; default: break; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index 3f004b0..42909f1 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -80,10 +80,18 @@ public enum ArtifactAbility { new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.825,0.8,0.75,0.7,0.65,0.6,0.55,0.5},10000,40,UpgradePath.SWORD,1), //Pickaxe abilities - SCAVENGE("Scavenge",ChatColor.GRAY+"[Unimplemented] Breaks off resources from armor. [VAL]% chance per hit.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + /*SCAVENGE("Scavenge",ChatColor.GRAY+"[Unimplemented] Breaks off resources from armor. [VAL]% chance per hit.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE,1), MINES("Land Mine",ChatColor.GRAY+"[Unimplemented]While in combat, throw your pickaxe to send land mines towards your enemies. On contact they deal [VAL] damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE,1), + new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE,1),*/ + MINES("Land Mine",ChatColor.GOLD+"Shift+Right-click"+ChatColor.RESET+" air to place down a land mine. Land mines detonate when enemies step near the mine location, dealing [VAL] damage. Mines will automatically detonate after 15 seconds of no activity.\n\nYou can place a maximum of "+ChatColor.GOLD+"[MINEAMT]"+ChatColor.RESET+" mine[MINEAMTPLURAL] at once.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,40,UpgradePath.PICKAXE,1), + OREHARVESTER("Ore Harvester",ChatColor.GOLD+"Shift+Right-click"+ChatColor.RESET+" an ore block to convert the block into a temporary buff. The buff lasts for [VAL] seconds. Duration can be stacked for longer buffs.\n\n "+DisplayOreBonus("Coal Ore","+[COALORE_BONUS]% Critical Damage")+"\n"+DisplayOreBonus("Iron Ore","+[IRONORE_BONUS]% Block Chance")+"\n"+DisplayOreBonus("Gold Ore","+[GOLDORE_BONUS]% Critical Strike Chance")+"\n"+DisplayOreBonus("Redstone Ore","+[REDSTONEORE_BONUS] Maximum Health")+"\n"+DisplayOreBonus("Lapis Lazuli Ore","+[LAPISORE_BONUS] Health Regeneration")+"\n"+DisplayOreBonus("Diamond Ore","+[COALORE_BONUS]% Damage Reduction")+"\n"+DisplayOreBonus("Emerald Ore","+[COALORE_BONUS] Base Damage")+"\n"+LevelCost(40),new double[]{10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0}, + new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,100,UpgradePath.PICKAXE,40), + IMPACT("Impact","Damaging an enemy deals [VAL]% of an enemy's health as bonus physical damage on hit."+LevelCost(5),new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},250,20,UpgradePath.PICKAXE,5), + FORCESTRIKE("Force Strike","Perform an attack that slams an enemy against a wall. Enemies take [FORCESTRIKEVAL] damage on a successful slam, crumbling the walls behind them.\n\n"+ChatColor.YELLOW+"15 second cooldown",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0}, + new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,350,UpgradePath.PICKAXE,1), //Shovel abilities SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n" @@ -636,7 +644,13 @@ public enum ArtifactAbility { text=DisplayAbility(EARTHWAVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } else if (path==UpgradePath.PICKAXE) { - text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + //text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) { + text=DisplayAbility(MINES,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(OREHARVESTER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(IMPACT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(FORCESTRIKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + } } } @@ -650,6 +664,10 @@ public enum ArtifactAbility { return msg1; } + static String DisplayOreBonus(String oretype, String bonus) { + return ChatColor.LIGHT_PURPLE+oretype+": "+ChatColor.YELLOW+" "+bonus; + } + public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval) { //Level to display information for. String msg = ability.GetDescription(); DecimalFormat df = new DecimalFormat("0.00"); @@ -666,6 +684,7 @@ public enum ArtifactAbility { msg=msg.replace("[AOEVAL]", ChatColor.BLUE+df.format(1+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); msg=msg.replace("[POTVAL]", ChatColor.BLUE+df.format(5+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); msg=msg.replace("[GRACEFULVAL]", ChatColor.BLUE+df.format(0.1+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); + msg=msg.replace("[FORCESTRIKEVAL]", ChatColor.BLUE+df.format(60+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); return msg; } public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for. @@ -684,6 +703,7 @@ public enum ArtifactAbility { msg=msg.replace("[AOEVAL]", DisplayChangedValue(df.format(1+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(1+calculateValue(ability,tier,tolv))+ChatColor.RESET)); msg=msg.replace("[POTVAL]", DisplayChangedValue(df.format(5+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(5+calculateValue(ability,tier,tolv))+ChatColor.RESET)); msg=msg.replace("[GRACEFULVAL]", DisplayChangedValue(df.format(0.1+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(0.1+calculateValue(ability,tier,tolv))+ChatColor.RESET)); + msg=msg.replace("[FORCESTRIKEVAL]", DisplayChangedValue(df.format(60+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(60+calculateValue(ability,tier,tolv))+ChatColor.RESET)); return msg; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Camera.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Camera.java index c4efc2a..d11b382 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Camera.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Camera.java @@ -64,7 +64,7 @@ public class Camera { Player p = Bukkit.getPlayer(id); if (p!=null && p.isValid()) { p.setGameMode(GameMode.SPECTATOR); - p.setFlying(true); + if (p.getAllowFlight()) {p.setFlying(true);} p.setSpectatorTarget(p); } else { TwosideKeeper.ScheduleRemoval(camera_viewerlocs, p); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 824026a..3a45908 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -123,12 +123,12 @@ public class GenericFunctions { public static ItemStack breakHardenedItem(ItemStack item, Player p) { - /*StackTraceElement[] stacktrace = new Throwable().getStackTrace(); + StackTraceElement[] stacktrace = new Throwable().getStackTrace(); StringBuilder stack = new StringBuilder("Mini stack tracer:"); for (int i=0;i0) { ItemMeta m = item.getItemMeta(); @@ -150,6 +150,9 @@ public class GenericFunctions { if ((break_count-1)<0) { break_count=0; } + if (p!=null) { + SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f); + } TwosideKeeper.log("Setting breaks remaining to "+(break_count-1),3); break; } @@ -163,22 +166,25 @@ public class GenericFunctions { break_count--; if (p!=null && break_count==0) { p.sendMessage(ChatColor.GOLD+"WARNING!"+ChatColor.GREEN+ " Your "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.WHITE+" is going to break soon!"); - SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f); } return item; //By setting the amount to 1, you refresh the item in the player's inventory. } else { //This item is technically destroyed. + TwosideKeeper.log("Break count was 0.", 0); if (p!=null) { SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f); + TwosideKeeper.log("Played break sound.", 0); } if (isArtifactEquip(item)) { //We can turn it into dust! + TwosideKeeper.log("This is an artifact equip.", 0); if (p!=null) { p.sendMessage(ChatColor.LIGHT_PURPLE+"You still feel the artifact's presence inside of you..."); } return convertArtifactToDust(item); } + TwosideKeeper.log("Return null here.", 0); return null; } } @@ -3367,6 +3373,7 @@ public class GenericFunctions { //This is an item cube. Update its lore. int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]); ItemCubeUtils.updateVacuumCubeSuctionLoreLine(item); + //ItemCubeUtils.updateFilterCubeFilterLoreLine(item); if (TwosideKeeper.PLAYERJOINTOGGLE) { ItemCubeUtils.updateItemCubeUpdateList(item); } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemCube.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemCube.java index cc15090..92e9131 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemCube.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemCube.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils; public class ItemCube { @@ -41,25 +42,27 @@ public class ItemCube { public static void addToViewersOfItemCube(int idnumb, ItemStack cursor, Player check) { Inventory inv = getViewingItemCubeInventory(idnumb, check); - if (inv!=null) { + if (inv!=null && cursor!=null) { inv.addItem(cursor); } } public static void addToViewersOfItemCube(int idnumb, ItemStack[] cursor, Player check) { Inventory inv = getViewingItemCubeInventory(idnumb, check); + cursor = InventoryUtils.RemoveAllNullItems(cursor); if (inv!=null) { inv.addItem(cursor); } } public static void removeFromViewersofItemCube(int idnumb, ItemStack cursor, Player check) { Inventory inv = getViewingItemCubeInventory(idnumb, check); - if (inv!=null) { + if (inv!=null && cursor!=null) { inv.removeItem(cursor); } } public static void removeFromViewersofItemCube(int idnumb, ItemStack[] cursor, Player check) { Inventory inv = getViewingItemCubeInventory(idnumb, check); + cursor = InventoryUtils.RemoveAllNullItems(cursor); if (inv!=null) { inv.removeItem(cursor); } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java index dcdcc55..cfb6576 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java @@ -1,6 +1,7 @@ package sig.plugin.TwosideKeeper.HelperStructures.Utils; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -61,7 +62,13 @@ public class InventoryUtils { } } } - ItemCube.addToViewersOfItemCube(id,remaining,null); + + Inventory collectionOfItems = AddItemsThatHaveBeenAddedToOurInventoryForOtherVacuumCubeViewers(p, + remaining, itemCubeContents, remainingitems); + + //TwosideKeeper.log(Arrays.toString(collectionOfItems.getContents()), 0); + + ItemCube.addToViewersOfItemCube(id,collectionOfItems.getContents(),null); TwosideKeeper.itemCube_saveConfig(id, itemslist, CubeType.VACUUM); TwosideKeeper.itemcube_updates.put(id, itemcube_list);//This Item Cube can be saved. /*for (ItemStack i : remainingitems.values()) { @@ -74,6 +81,20 @@ public class InventoryUtils { } return remaining; } + public static Inventory AddItemsThatHaveBeenAddedToOurInventoryForOtherVacuumCubeViewers(Player p, + ItemStack[] remaining, List itemCubeContents, HashMap remainingitems) { + Inventory collectionOfItems = Bukkit.createInventory(p, itemCubeContents.size()); + + for (int i=0;i items = new ArrayList(); + for (int i=0;i itemcube_list = new ArrayList(); for (ItemStack items : ItemCubeUtils.getItemCubeContents(ItemCubeUtils.getItemCubeID(item))) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java index 5f6e23d..4c9fcb9 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java @@ -316,4 +316,27 @@ public class ItemUtils { public static boolean hasDisplayName(ItemStack item) { return getDisplayName(item)!=null; } + + public static void reduceEquipDurability(Player p, boolean mainhand, boolean offhand, boolean armor, int amt, double pct) { + if (mainhand && GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { + aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), amt+(int)(p.getEquipment().getItemInMainHand().getType().getMaxDurability()*pct+1)); + } + if (offhand && GenericFunctions.isEquip(p.getEquipment().getItemInOffHand())) { + aPlugin.API.damageItem(p, p.getEquipment().getItemInOffHand(), amt+(int)(p.getEquipment().getItemInOffHand().getType().getMaxDurability()*pct+1)); + } + if (armor) { + if (GenericFunctions.isEquip(p.getEquipment().getHelmet())) { + aPlugin.API.damageItem(p, p.getEquipment().getHelmet(), amt+(int)(p.getEquipment().getHelmet().getType().getMaxDurability()*pct+1)); + } + if (GenericFunctions.isEquip(p.getEquipment().getChestplate())) { + aPlugin.API.damageItem(p, p.getEquipment().getChestplate(), amt+(int)(p.getEquipment().getChestplate().getType().getMaxDurability()*pct+1)); + } + if (GenericFunctions.isEquip(p.getEquipment().getLeggings())) { + aPlugin.API.damageItem(p, p.getEquipment().getLeggings(), amt+(int)(p.getEquipment().getLeggings().getType().getMaxDurability()*pct+1)); + } + if (GenericFunctions.isEquip(p.getEquipment().getBoots())) { + aPlugin.API.damageItem(p, p.getEquipment().getBoots(), amt+(int)(p.getEquipment().getBoots().getType().getMaxDurability()*pct+1)); + } + } + } } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index e1d8f47..ddfde51 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -676,6 +676,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { private final class ControlChargeZombies implements Runnable { public void run(){ //Control charge zombies.. + long time = System.nanoTime(); for (ChargeZombie cz : chargezombies.values()) { if (cz.m==null || !cz.m.isValid() || !cz.isAlive() || !cz.hasTarget() || (cz.GetZombie().getWorld().getName().equalsIgnoreCase("world") && cz.GetZombie().getLocation().getY()>32)) { //This has to be removed... @@ -757,6 +758,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } } + TwosideKeeper.HeartbeatLogger.AddEntry("Charge Zombie Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (CustomMonster cs : custommonsters.values()) { if (cs.m==null || !cs.m.isValid() || !cs.isAlive()) { //This has to be removed... @@ -769,6 +771,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { cs.runTick(); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Custom Monster Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); //Control elite monsters. for (EliteMonster em : elitemonsters) { if (!em.m.isValid()) { @@ -778,6 +781,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { em.runTick(); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Elite Monster Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (Entity e : suppressed_entities) { if (e==null || !e.isValid() || GenericFunctions.getSuppressionTime(e)<=0) { @@ -789,16 +793,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ScheduleRemoval(suppressed_entities,e); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Suppressed Entity Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (LavaPlume lp : lavaplume_list) { if (!lp.runTick()) { ScheduleRemoval(lavaplume_list,lp); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Lava Plume Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (Player p : Bukkit.getOnlinePlayers()) { + long time1 = System.nanoTime(); runServerHeartbeat.runFilterCubeCollection(p); + TwosideKeeper.HeartbeatLogger.AddEntry("Player Cycle Handling->Filter Cube Handling", (int)(System.nanoTime()-time1));time1=System.nanoTime(); runServerHeartbeat.runVacuumCubeSuckup(p); + TwosideKeeper.HeartbeatLogger.AddEntry("Player Cycle Handling->Vacuum Cube Handling", (int)(System.nanoTime()-time1));time1=System.nanoTime(); if (PlayerStructure.GetPlayerStructure(p).last_rejuvenate+200>TwosideKeeper.getServerTickTime()) { GenericFunctions.HealEntity(p, 5); + TwosideKeeper.HeartbeatLogger.AddEntry("Player Cycle Handling->Rejuvenate Handling", (int)(System.nanoTime()-time1));time1=System.nanoTime(); } /*if (p.getVehicle() instanceof EnderDragon) { EnderDragon ed = (EnderDragon)p.getVehicle(); @@ -806,21 +816,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ed.teleport(ed.getLocation().setDirection(p.getLocation().getDirection())); }*/ } + TwosideKeeper.HeartbeatLogger.AddEntry("Player Cycle Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (TemporaryLava tl : temporary_lava_list) { if (!tl.runTick()) { ScheduleRemoval(temporary_lava_list,tl); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Lava Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (TemporaryIce tl : temporary_ice_list) { if (!tl.run()) { ScheduleRemoval(temporary_ice_list,tl); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Ice Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); for (Camera cam : cameras) { if (!cam.runTick()) { ScheduleRemoval(cameras,cam); } } + TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Camera Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); } private void UpdateLavaBlock(Block lavamod) { @@ -1069,7 +1083,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { getServer().getScheduler().scheduleSyncRepeatingTask(this, new runServerTick(), 1l, 1l); //log(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)+"",0); - log("This is here to change the file size if necessary Kappa",5); + log("This is here to change the file size if necessary Kappa Kappa Kappa No Copy-pasterino Kappachino Lulu c: Please update version number.",5); } private static void InitializeBotCommands() { @@ -1732,6 +1746,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener { c.setCameraAroundCircle(Double.parseDouble(args[1]), Double.parseDouble(args[2]), new Location(Bukkit.getWorld("world"),0,64,0), 5); } }break; + case "DAMAGE":{ + int val = Integer.parseInt(args[1]); + ItemUtils.reduceEquipDurability(p, true, true, true, val, 0); + }break; + case "BREAK":{ + ItemStack[] armor = GenericFunctions.getArmor(p,true); + for (ItemStack item : armor) { + if (GenericFunctions.isEquip(item)) { + PlayerItemBreakEvent ev = new PlayerItemBreakEvent(p,item); + Bukkit.getPluginManager().callEvent(ev); + } + } + }break; } } //LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE); @@ -1820,6 +1847,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { h.getInventory().setItem(0, new ItemStack(Material.DIAMOND_BARDING)); h.setPassenger(s);*/ + ItemStack shield = new ItemStack(Material.SHIELD); + shield.setDurability((short) (shield.getType().getMaxDurability()-1)); + GenericFunctions.giveItem(p, shield); + //Arrow newar = p.getWorld().spawnArrow(p.getLocation(), p.getLocation().getDirection(), 1f, 12f); //GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(), BowMode.SNIPE); //p.sendMessage("This is bow mode "+GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())); @@ -5148,6 +5179,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ItemStack item = ev.getCurrentItem(); if (CustomItem.isFilterCube(item)) { int cubeid = ItemCubeUtils.getItemCubeID(item); + //ItemCubeUtils.toggleFilter(cubeid); Hopper targethopper = ItemCubeUtils.getFilterCubeHopper(cubeid); targethopper.getChunk().load(); GenericFunctions.renameHopper(targethopper, ChatColor.stripColor(((ItemUtils.hasDisplayName(item))?ItemUtils.getDisplayName(item):"Filter Inventory ID#"+cubeid))); @@ -6039,20 +6071,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (!pm.isRanger(p)) { if (p.isBlocking() || pm.isDefender(p)) { //Only reduce durability of the shield. - ItemStack[] equips = GenericFunctions.getEquipment(p, true); + /*ItemStack[] equips = GenericFunctions.getEquipment(p, true); if (GenericFunctions.isEquip(equips[0])) { aPlugin.API.damageItem(p, equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1))); } if (GenericFunctions.isEquip(equips[1])) { aPlugin.API.damageItem(p, equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1))); - } + }*/ + ItemUtils.reduceEquipDurability(p, true, true, false, 3, 0.01); } else { - ItemStack[] equips = GenericFunctions.getArmor(p, false); + /*ItemStack[] equips = GenericFunctions.getArmor(p, false); for (ItemStack equip : equips) { if (GenericFunctions.isEquip(equip)) { aPlugin.API.damageItem(p, equip, 3+((int)((equip.getType().getMaxDurability()*0.01)+1))); } - } + }*/ + ItemUtils.reduceEquipDurability(p, false, false, true, 3, 0.01); } } } @@ -7366,13 +7400,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Player p = ev.getPlayer(); ItemStack item = ev.getBrokenItem(); //See if this item has lore. + TwosideKeeper.log("Break item event triggered for "+item, 0); if (GenericFunctions.getHardenedItemBreaks(item)>0) { //item.setAmount(1); + TwosideKeeper.log("Hardened Item Breaks is greater than 0", 0); GenericFunctions.breakHardenedItem(item,p); } else { + TwosideKeeper.log("Hardened Item Breaks is less than or equal to 0... Breaking.", 0); ItemStack test = GenericFunctions.breakHardenedItem(item,p); if (test!=null) { + TwosideKeeper.log("Exited hardened item break. Result returned was not null! "+test, 0); //We have to give this player the item! if (test.getAmount()==0) { test.setAmount(1); //We can't give 0 of something. @@ -7389,6 +7427,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (!foundone) { GenericFunctions.giveItem(p, test); } + } else { + TwosideKeeper.log("Exited hardened item break. Result returned was null!", 0); } breakdownItem(item,p); }