diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index b37776b..21b3a6b 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 41350d5..74e415e 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.6.2a +version: 3.6.2r1 commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index 0c103c2..6caf9da 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -176,10 +176,12 @@ public enum ArtifactAbility { } public double GetBaseValue(int tier) { + if (tier<=0) {tier=1;} return this.baseval[tier-1]; } public double GetDecayValue(int tier) { + if (tier<=0) {tier=1;} return this.decayval[tier-1]; } @@ -195,7 +197,6 @@ public enum ArtifactAbility { public static double calculateValue(ArtifactAbility ability, int artifacttier, int abilitylevel) { double sum=0; - if (artifacttier<=0) {artifacttier=1;} TwosideKeeper.log("Ability "+ability.GetName(), 4); for(int i=0;i lore = m.getLore(); String material_name = lore.get(1).split("'")[1]; + if (lore.get(1).contains("Arrow of")) { + return "Tipped Arrow"; + } else + if (lore.get(1).contains("Splash Potion")) { + return "Splash Potion"; + } else + if (lore.get(1).contains("Lingering Potion")) { + return "Lingering Potion"; + } else + if (lore.get(1).contains("Potion")) { + return "Potion"; + } else if (lore.get(1).contains("Jack o")) { return "Jack o'Lantern"; } else { diff --git a/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java b/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java new file mode 100644 index 0000000..e4a44e2 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java @@ -0,0 +1,81 @@ +package sig.plugin.TwosideKeeper; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.InventoryView; + +import sig.plugin.TwosideKeeper.HelperStructures.ItemCube; + +public class ItemCubeWindow { + int id = 0; + int size = 0; + + public ItemCubeWindow(int id, int size) { + this.id=id; + this.size=size; + } + + public static void addItemCubeWindow(Player p, int id, int size) { + PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId()); + pd.openeditemcube.add(new ItemCubeWindow(id, size)); + pd.opened_inventory = true; + TwosideKeeper.log("Item Cube Window added. List is now size "+pd.openeditemcube.size(),2); + } + + public static void popItemCubeWindow(Player p) { + PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId()); + if (!pd.opened_inventory && + pd.openeditemcube.size()>0) { + ItemCubeWindow window = pd.openeditemcube.remove(pd.openeditemcube.size()-1); + TwosideKeeper.log("Item Cube Window removed. List is now size "+pd.openeditemcube.size(),2); + pd.opened_inventory=true; + openItemCube(p,window.id,window.size,false); //Open this item cube without adding it to the list. We're not nesting this one. + } + TwosideKeeper.log("pd.opened_inventory was "+pd.opened_inventory+". List size is "+pd.openeditemcube.size(),2); + } + + public static void removeAllItemCubeWindows(Player p) { + PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId()); + pd.openeditemcube.clear(); + } + + //New open item cube method to handle all opening of item cubes. + public static void openItemCube(Player p, int id, int size, boolean addToList) { + TwosideKeeper.log("Called.", 2); + PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId()); + if (addToList && + isViewingItemCubeInventory(p)) { + addItemCubeWindow(p,getViewingItemCubeID(p),getViewingItemCubeInventorySize(p)); + } + if (!ItemCube.isSomeoneViewingItemCube(id,p)) { + InventoryView newinv = p.openInventory(Bukkit.getServer().createInventory(p, size, "Item Cube #"+id)); + TwosideKeeper.loadItemCubeInventory(newinv.getTopInventory(),newinv); + p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f); + } else { + //ItemCube.displayErrorMessage(p); + p.openInventory(ItemCube.getViewingItemCubeInventory(id, p)); + p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f); + } + pd.isViewingItemCube=true; + pd.opened_inventory=false; + } + + public static boolean isViewingItemCubeInventory(Player p) { + PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId()); + TwosideKeeper.log("Are we viewing it? "+pd.isViewingItemCube,2); + return pd.isViewingItemCube; + } + + public static int getViewingItemCubeID(Player p) { + if (p.getOpenInventory().getTitle().contains("#")) { + String inventoryTitle = p.getOpenInventory().getTitle(); + return Integer.parseInt(inventoryTitle.split("#")[1]); + } + return -1; + } + + public static int getViewingItemCubeInventorySize(Player p) { + return p.getOpenInventory().getTopInventory().getSize(); + } +} diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index 201c72c..6841a69 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -602,9 +602,7 @@ public class MonsterController { m.setHealth(m.getMaxHealth()); if (m.getType()!=EntityType.ENDERMAN) { m.setFireTicks(999999); - } else { - m.setFireTicks(120); - } + } if (isAllowedToEquipItems(m)) { m.getEquipment().clear(); RandomizeEquipment(m,3); diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index efe7a8a..facff77 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -65,7 +65,7 @@ public class PlayerStructure { public boolean hasfullrangerset=false; public double lastarrowpower=0; public int headshotcombo=0; - public List itemcubeviews; + public List openeditemcube; public boolean openinginventory=false; public boolean fulldodge=false; public long last_dodge=TwosideKeeper.getServerTickTime(); @@ -110,7 +110,7 @@ public class PlayerStructure { this.nextarrowxp=0; this.hasfullrangerset=false; this.last_strikerspell=TwosideKeeper.getServerTickTime(); - this.itemcubeviews = new ArrayList(); + this.openeditemcube = new ArrayList(); this.openinginventory = false; this.fulldodge=false; this.last_dodge=TwosideKeeper.getServerTickTime(); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index ab9909d..e79b9ef 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -611,12 +611,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener { for (int i3=0;i3=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { - p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,20,2)); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,20,1)); } } if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) && p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { - p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,20,2)); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,20,1)); //log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2); } @@ -834,7 +834,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.getLocation().add(0,0,0).getBlock().setType(Material.AIR); } if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) { - TwosideKeeperAPI.spawnAdjustedMonster(MonsterType.GIANT, p.getLocation()); + //TwosideKeeperAPI.spawnAdjustedMonster(MonsterType.GIANT, p.getLocation()); + + 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())); /*for (int i=0;i=4 || GenericFunctions.isRanger(p)) { if (Math.abs(arrowLoc.getY()-monsterHead.getY())<=headshotvaly) { if (Math.abs(arrowLoc.getZ()-monsterHead.getZ())<=headshotvalz && @@ -4984,16 +4993,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void onArrowShoot(ProjectileLaunchEvent ev) { if (ev.getEntity() instanceof Arrow) { Arrow arr = (Arrow)ev.getEntity(); - if (arr.getShooter() instanceof Player) { + //Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12); + ev.setCancelled(true); + if (arr.getShooter() instanceof Player && + arr.getCustomName()==null) { Player p = (Player)arr.getShooter(); if (GenericFunctions.isRanger(p)) { - arr.setVelocity(arr.getVelocity().multiply(4)); + //arr.setVelocity(arr.getVelocity().multiply(4)); if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 3); //p.getEquipment().getItemInMainHand().setDurability((short)(p.getEquipment().getItemInMainHand().getDurability()+1)); } //p.getWorld().spawnArrow(arr.getLocation(), arr.getLocation().getDirection(), 20, 1); } + Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getLocation().getDirection(), 1, 12); + newarrow.setCustomName("HIT"); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); pd.lastarrowpower=arr.getVelocity().lengthSquared(); log("Arrow velocity is "+arr.getVelocity().lengthSquared(),4); @@ -5006,13 +5020,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (ev.getEntity() instanceof Arrow) { Arrow ar = (Arrow)ev.getEntity(); if (ar.getShooter()!=null && + ar.getCustomName()==null && (ar.getShooter() instanceof Player)) { Player p = (Player)ar.getShooter(); - if (GenericFunctions.isRanger(p) - && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { - //This arrow was shot from a sniper. - aPlugin.API.sendSoundlessExplosion(ar.getLocation(), 1); - } } } } @@ -6137,7 +6147,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { String MonsterName = pd2.target.getType().toString().toLowerCase(); if (pd2.target.getCustomName()!=null) { MonsterName = pd2.target.getCustomName(); - if (MonsterName.contains(ChatColor.DARK_RED+"Hellfire")) { + if (MonsterName.contains(ChatColor.DARK_RED+"Hellfire") && + pd2.target.getType()!=EntityType.ENDERMAN) { pd2.target.setFireTicks(99999); } if (pd2.target.getCustomName()!=null && @@ -6301,6 +6312,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (GenericFunctions.isHardenedItem(weapon)) { basedmg*=2; + log("Damage: "+basedmg,2); } if (weapon.getType()==Material.BOW) {