diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar
index 5329ee4..babdcd2 100644
Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ
diff --git a/src/plugin.yml b/src/plugin.yml
index ae424a5..bf37256 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
-version: 3.10.0a
+version: 3.10.0b
commands:
money:
description: Tells the player the amount of money they are holding.
diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java
index e3875c5..f6ae30f 100644
--- a/src/sig/plugin/TwosideKeeper/CustomDamage.java
+++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java
@@ -1385,30 +1385,32 @@ public class CustomDamage {
@SuppressWarnings("deprecation")
public static double CalculateDodgeChance(Player p, Entity damager) {
double dodgechance = 0.0d;
- dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, p.getEquipment().getItemInMainHand()))/100d);
-
- for (int i=0;i
=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
- dodgechance+=0.01*p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK);
- }
- /*ItemStack equip = p.getEquipment().getArmorContents()[i];
- if (GenericFunctions.isRanger(p) && equip!=null
- && equip.getType()!=Material.AIR &&
- equip.hasItemMeta() && equip.getItemMeta().hasLore()) {
- if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Jamdak Set")) {
- dodgechance+=0.03;
- } else
- if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Darnys Set")) {
- dodgechance+=0.05;
- } else
- if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Alikahn Set")) {
- dodgechance+=0.08;
- } else
- if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) {
- dodgechance+=0.11;
+ for (ItemStack it : GenericFunctions.getArmor(p)) {
+ if (it!=null) {
+ if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, it) &&
+ p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
+ dodgechance+=0.01*it.getEnchantmentLevel(Enchantment.LUCK);
}
- }*/
+ dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, it.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, it))/100d);
+
+ /*ItemStack equip = p.getEquipment().getArmorContents()[i];
+ if (GenericFunctions.isRanger(p) && equip!=null
+ && equip.getType()!=Material.AIR &&
+ equip.hasItemMeta() && equip.getItemMeta().hasLore()) {
+ if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Jamdak Set")) {
+ dodgechance+=0.03;
+ } else
+ if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Darnys Set")) {
+ dodgechance+=0.05;
+ } else
+ if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Alikahn Set")) {
+ dodgechance+=0.08;
+ } else
+ if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) {
+ dodgechance+=0.11;
+ }
+ }*/
+ }
}
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS)/100d;
diff --git a/src/sig/plugin/TwosideKeeper/DropDeathItems.java b/src/sig/plugin/TwosideKeeper/DropDeathItems.java
index d12a25d..8987d0e 100644
--- a/src/sig/plugin/TwosideKeeper/DropDeathItems.java
+++ b/src/sig/plugin/TwosideKeeper/DropDeathItems.java
@@ -7,32 +7,57 @@ import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
+import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
+
public class DropDeathItems implements Runnable{
Player p = null;
Location deathloc = null;
List contents;
+ Inventory inv_contents;
DropDeathItems(Player p, List contents, Location deathloc) {
this.p=p;
this.deathloc=deathloc;
this.contents=contents;
+ this.inv_contents = Bukkit.createInventory(p, 36);
+ for (ItemStack it : contents) {
+ if (it!=null) {
+ inv_contents.addItem(it);
+ }
+ }
}
@Override
public void run() {
if (!AttemptToDropItems(p,deathloc)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new DropDeathItems(p,contents,deathloc),1); //Keep trying until the chunk is loaded!!!
+ TwosideKeeper.temporary_chunks.clear();
}
}
public boolean AttemptToDropItems(Player p, Location deathloc) {
- deathloc.getWorld().loadChunk(deathloc.getChunk());
+ TwosideKeeper.temporary_chunks.add(deathloc.getChunk());
+ deathloc.getChunk().load();
if (deathloc.getChunk().isLoaded()) {
TwosideKeeper.log("Respawn and Dropping...", 2);
- while (contents.size()>0) {
+ while (!InventoryUtils.hasEmptyInventory(inv_contents)) {
+ if (deathloc.getChunk().isLoaded()) {
+ Item it = deathloc.getWorld().dropItemNaturally(deathloc, InventoryUtils.getFirstItemThatIsNotEmpty(inv_contents));
+ if (it!=null) {
+ inv_contents.removeItem(it.getItemStack());
+ TwosideKeeper.log("Dropping "+it.getItemStack().toString()+" at Death location "+deathloc,2);
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ /*while (contents.size()>0) {
if (deathloc.getChunk().isLoaded()) {
Item it = null;
do {
@@ -41,11 +66,12 @@ public class DropDeathItems implements Runnable{
TwosideKeeper.temporary_chunks.add(deathloc.getChunk());} while (it==null || !it.isValid());
it.setInvulnerable(true);
TwosideKeeper.log("Dropping "+contents.get(0).toString()+" at Death location "+deathloc,2);
- contents.remove(0);
+ //contents.remove(0);
+
} else {
deathloc.getWorld().loadChunk(deathloc.getChunk());
}
- }
+ }*/
for (Chunk c : TwosideKeeper.temporary_chunks) {
c.unload(true);
}
diff --git a/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java b/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
index caaf020..6b3f71c 100644
--- a/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
+++ b/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
@@ -133,7 +133,7 @@ public class SigDrop extends Drop{
item = Loot.GenerateMegaPiece(item.getType(), isHardened);
}break;
default:{
- TwosideKeeper.log("Something went terrible wrong generating the item! DIRT is being returned! Check your switch statement for 'isWeapon'.", 0);
+ TwosideKeeper.log("Something went terribly wrong generating the item! DIRT is being returned! Check your switch statement for 'isWeapon'.", 0);
item = new ItemStack(Material.DIRT);
}
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
index d9642e3..95c8735 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
@@ -4253,7 +4253,8 @@ public class GenericFunctions {
public static void PerformAssassinate(Player player, Material name) {
//Try to find a target to look at.
- LivingEntity target = aPlugin.API.rayTraceTargetEntity(player, 100);
+ //LivingEntity target = aPlugin.API.rayTraceTargetEntity(player, 100);
+ LivingEntity target = aPlugin.API.getTargetEntity(player, 100);
if (target!=null && !target.isDead()) {
//We found a target, try to jump behind them now.
double mult = 0.0;
@@ -4340,7 +4341,8 @@ public class GenericFunctions {
}
public static boolean isIsolatedTarget(LivingEntity m, Player p) {
- return (GenericFunctions.GetNearbyMonsterCount(m, 12)==0) &&
+ return (p.getWorld().equals(m.getWorld()) && p.getLocation().distanceSquared(m.getLocation())<=1024 &&
+ GenericFunctions.GetNearbyMonsterCount(m, 12)==0) &&
PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER;
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
index b132312..7c5cc19 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
@@ -102,4 +102,32 @@ public class InventoryUtils {
}
return true;
}
+ public static boolean hasEmptyInventory(Inventory inv) {
+ ItemStack[] inventory = inv.getContents();
+ for (ItemStack i : inventory) {
+ if (i!=null && i.getType()!=Material.AIR) {
+ TwosideKeeper.log("Item is "+i, 0);
+ return false;
+ }
+ }
+ return true;
+ }
+ public static boolean hasEmptyInventory(Player p) {
+ ItemStack[] inv = p.getInventory().getStorageContents();
+ for (ItemStack i : inv) {
+ if (i!=null && i.getType()!=Material.AIR) {
+ return false;
+ }
+ }
+ return true;
+ }
+ public static ItemStack getFirstItemThatIsNotEmpty(Inventory inv) {
+ ItemStack[] inventory = inv.getContents();
+ for (ItemStack it : inventory) {
+ if (it!=null && it.getType()!=Material.AIR) {
+ return it;
+ }
+ }
+ return null;
+ }
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
index 16f381d..6145051 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
@@ -3,6 +3,7 @@ package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import java.util.ArrayList;
import java.util.List;
+import org.bukkit.ChatColor;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@@ -87,7 +88,7 @@ public class ItemUtils {
} else {
return "";
}
- }
+ }
return "";
}
@@ -102,5 +103,14 @@ public class ItemUtils {
private static boolean isValidItem(ItemStack item) {
return (item!=null && item.hasItemMeta());
}
-
+
+ public static boolean isArtifactDust(ItemStack item) {
+ if (isValidLoreItem(item) &&
+ LoreContainsSubstring(item,ChatColor.BLUE+""+ChatColor.MAGIC)) {
+ //TwosideKeeper.log("This is Artifact Dust.", 0);
+ return true;
+ } else {
+ return false;
+ }
+ }
}
diff --git a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
index c0047ef..19d8b52 100644
--- a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
+++ b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
@@ -83,13 +83,11 @@ public class LivingEntityStructure {
public void setGlow(Player p, GlowAPI.Color col) {
glowcolorlist.put(p, col);
- GlowAPI.setGlowing(m, col, p);
}
public void setGlobalGlow(GlowAPI.Color col) {
for (Player p : Bukkit.getOnlinePlayers()) {
glowcolorlist.put(p, col);
- GlowAPI.setGlowing(m, col, p);
}
}
@@ -121,6 +119,7 @@ public class LivingEntityStructure {
//No glow.
setGlow(p,null);
}
+ GlowAPI.setGlowing(m, glowcolorlist.get(p), p);
}
}
diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java
index 42c48be..431b8fe 100644
--- a/src/sig/plugin/TwosideKeeper/MonsterController.java
+++ b/src/sig/plugin/TwosideKeeper/MonsterController.java
@@ -101,7 +101,6 @@ public class MonsterController {
return false;
} else {
if (isZombieLeader(ent)) {
-
convertLivingEntity(ent,LivingEntityDifficulty.NORMAL);
}
return true;
@@ -129,7 +128,6 @@ public class MonsterController {
return false;
} else {
if (isZombieLeader(ent)) {
-
convertLivingEntity(ent,LivingEntityDifficulty.NORMAL);
}
return true;
diff --git a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java
index 72f170d..f477dda 100644
--- a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java
+++ b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java
@@ -19,6 +19,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
+import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class RecyclingCenter {
//Each Recycling center has nodes which contain all the chests.
@@ -60,7 +61,7 @@ public class RecyclingCenter {
public boolean IsItemAllowed(ItemStack item) {
//Artifact type of items are not allowed to be sent to the Recycling Center. Only artifact equipment will be sent over.
- if (Artifact.isArtifact(item) && !GenericFunctions.isArtifactEquip(item)) {
+ if (Artifact.isArtifact(item) && !GenericFunctions.isArtifactEquip(item) && !ItemUtils.isArtifactDust(item)) {
return false;
}
return true;
@@ -181,8 +182,8 @@ public class RecyclingCenter {
int itemslot = (int)Math.floor(Math.random()*27);
ItemStack oldItem = c.getBlockInventory().getItem(itemslot);
//There is also a chance to move this item to another random spot.
- if (!isCommon(i.getType())) {
- if (oldItem!=null && Math.random()*100<=TwosideKeeper.RECYCLECHANCE) {
+ if (!isCommon(i.getType()) || mustBeRecycled(i)) {
+ if (oldItem!=null && (Math.random()*100<=TwosideKeeper.RECYCLECHANCE || mustBeRecycled(i))) {
int itemslot2 = (int)Math.floor(Math.random()*27);
c.getBlockInventory().setItem(itemslot2, oldItem);
}
@@ -201,6 +202,14 @@ public class RecyclingCenter {
}
}
}
+
+ public static boolean mustBeRecycled(ItemStack it) {
+ if (GenericFunctions.isArtifactEquip(it) || ItemUtils.isArtifactDust(it)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
private boolean isCommon(Material m) {
if (itemmap.containsKey(m)) {
diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
index 8ae4e42..31adeb0 100644
--- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
+++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
@@ -1032,6 +1032,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}break;
+ case "GLOWNEARBY":{
+ List nearby = p.getNearbyEntities(10, 10, 10);
+ for (Entity e : nearby) {
+ if (!(e instanceof Player)) {
+ if (e.getCustomName()!=null) {
+ e.setCustomName(ChatColor.AQUA+e.getCustomName());
+ }
+ GlowAPI.setGlowing(e, GlowAPI.Color.AQUA, p);
+ }
+ }
+ }break;
}
}
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
@@ -5449,6 +5460,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void updateHealthbarRespawnEvent(PlayerRespawnEvent ev) {
final Player p = ev.getPlayer();
+ //ev.setRespawnLocation(new Location(Bukkit.getWorld("world"),Math.random()*2000-1000,72,Math.random()*2000-1000));
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (p!=null) {