diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 831c06e..cb06c62 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java index 7520caf..6e9e9ad 100644 --- a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java +++ b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java @@ -70,8 +70,13 @@ public class AutoUpdatePlugin implements Runnable { if ((plugins.get(i).hash==null || !md5.equalsIgnoreCase(plugins.get(i).hash))) { //This plugin is different! Update the hash for it. Prepare for a restart of the server! if (!TwosideKeeper.restarting_server) { - DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!"); - Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!\n\n"+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); + if (Bukkit.getOnlinePlayers().size()!=0) { + DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!"); + Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!\n\n"+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); + } else { + DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+"."); + Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); + } restarting=true; TwosideKeeper.restarting_server=true; //Save the new plugin hash. diff --git a/src/sig/plugin/TwosideKeeper/ChargeZombie.java b/src/sig/plugin/TwosideKeeper/ChargeZombie.java index c8b5289..bd0fcfb 100644 --- a/src/sig/plugin/TwosideKeeper/ChargeZombie.java +++ b/src/sig/plugin/TwosideKeeper/ChargeZombie.java @@ -4,9 +4,12 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.Monster; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import net.minecraft.server.v1_9_R1.BlockPosition; import sig.plugin.TwosideKeeper.HelperStructures.BlockToughness; +import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; public class ChargeZombie { Monster m; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 671b5ef..5d30955 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -2885,4 +2885,13 @@ public class GenericFunctions { return true; } } + + public static boolean containsLore(ItemStack item) { + if (item!=null && + item.hasItemMeta() && + item.getItemMeta().hasLore()) { + return true; + } + return false; + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index f8d7798..73736bb 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -102,7 +102,9 @@ public class Loot { } ItemStack GenerateSetPiece(ItemStack item) { - + if (item.getType().toString().contains("IRON")) { //This is a tier 1 piece. + + } return item; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterType.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterType.java index ba0b7bc..70ebf64 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterType.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterType.java @@ -7,6 +7,7 @@ public enum MonsterType { CAVESPIDER, CREEPER, ENDERMAN, + ENDERMITE, GIANT, GUARDIAN, PIGZOMBIE, @@ -15,5 +16,5 @@ public enum MonsterType { SPIDER, WITCH, WITHER, - ZOMBIE + ZOMBIE, } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java b/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java index 99cff0a..840ad3f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java @@ -572,11 +572,11 @@ public class WorldShop { return false; } - public static boolean shopSignExists(Location block) { + public static boolean shopSignExists(Block block) { return !(grabShopSign(block)==null); } - public static Sign grabShopSign(Location block) { + public static Sign grabShopSign(Block block) { //Look for a sign in all directions. boolean found=false; Block signblock = null; @@ -584,8 +584,8 @@ public class WorldShop { for (int i=-1;i<2;i++) { for (int j=-1;j<2;j++) { if (i!=0^j!=0) { - Block testblock = block.getBlock().getRelative(i,0,j); - if (testblock.getType().equals(block.getBlock().getType())) { + Block testblock = block.getRelative(i,0,j); + if (testblock.getType().equals(block.getType())) { //We found a double chest. signblock2=testblock; TwosideKeeper.log("Found a double chest @ "+i+","+j,5); @@ -596,7 +596,7 @@ public class WorldShop { Sign s = (Sign)(testblock.getState()); //See if the attached block is this block. org.bukkit.material.Sign s1 = (org.bukkit.material.Sign)(testblock.getState().getData()); - if (testblock.getLocation().getBlock().getRelative(s1.getAttachedFace()).getLocation().equals(block) //We want to make sure the sign is attached to this block. + if (testblock.getRelative(s1.getAttachedFace()).equals(block) //We want to make sure the sign is attached to this block. && WorldShop.isWorldShopSign(s)) { //This is a shop sign. We found it. signblock = testblock; @@ -620,7 +620,7 @@ public class WorldShop { //This might be a world shop sign. Check. Sign s = (Sign)(testblock.getState()); org.bukkit.material.Sign s1 = (org.bukkit.material.Sign)(testblock.getState().getData()); - if (testblock.getLocation().getBlock().getRelative(s1.getAttachedFace()).getLocation().equals(signblock2.getLocation()) //We want to make sure the sign is attached to this block. + if (testblock.getRelative(s1.getAttachedFace()).getLocation().equals(signblock2.getLocation()) //We want to make sure the sign is attached to this block. && WorldShop.isWorldShopSign(s)) { //This is a shop sign. We found it. TwosideKeeper.log("------------",5); @@ -640,7 +640,7 @@ public class WorldShop { return s.getBlock().getRelative(s1.getAttachedFace()); } - public static void updateShopSign(Location shopblock) { + public static void updateShopSign(Block shopblock) { //This will first attempt to grab the shop sign. //Upon finding it, we will load up the shop and update it to the correct value inside the chest inventory. Sign s = grabShopSign(shopblock); @@ -649,7 +649,7 @@ public class WorldShop { //Load up the shop. WorldShop shop = TwosideKeeper.TwosideShops.LoadWorldShopData(s); //Now detect the amount inside the double chest. - Chest c = (Chest)shopblock.getBlock().getState(); + Chest c = (Chest)shopblock.getState(); Inventory chest_inventory = c.getInventory(); int amt = 0; if (isPurchaseShopSign(s)) { @@ -815,7 +815,7 @@ public class WorldShop { } } - public static boolean canPlaceShopSignOnBlock(Location block_loc) { - return (!shopSignExists(block_loc) && GenericFunctions.isDumpableContainer(block_loc.getBlock().getType())); + public static boolean canPlaceShopSignOnBlock(Block block) { + return (!shopSignExists(block) && GenericFunctions.isDumpableContainer(block.getType())); } } diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index d0476cd..34bd572 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -26,6 +26,8 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.material.MaterialData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.inventivetalent.glow.GlowAPI; +import org.inventivetalent.glow.GlowAPI.Color; import sig.plugin.TwosideKeeper.HelperStructures.ItemRarity; import sig.plugin.TwosideKeeper.HelperStructures.Loot; @@ -48,14 +50,18 @@ public class MonsterController { int ylv = ent.getLocation().getBlockY(); if (minion) { ylv+=16; - ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); - ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,0)); - ent.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,3)); - ent.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,999999,4)); + ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1)); + ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,Integer.MAX_VALUE,0)); + ent.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,3)); + ent.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,4)); + if (isZombieLeader(ent)) { //Not allowed. We do not want more leaders from Minions to be spawning. + ent.remove(); + return false; + } } if (isZombieLeader(ent)) { //Zombie leaders have faster movement. - ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); + ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1)); //Set the HP of the leader to a more proper amount. } if (ylv>=128) { @@ -208,14 +214,14 @@ public class MonsterController { if (Math.random()<0.5) { weapon = new ItemStack(Material.WOOD_AXE); } else { - weapon = new ItemStack(Material.STONE_AXE); + weapon = new ItemStack(Material.AIR); } m.getEquipment().setItemInMainHand(weapon); } else { if (Math.random()<0.5) { weapon = new ItemStack(Material.WOOD_SWORD); } else { - weapon = new ItemStack(Material.STONE_SWORD); + weapon = new ItemStack(Material.AIR); } m.getEquipment().setItemInMainHand(weapon); } @@ -297,21 +303,21 @@ public class MonsterController { //Equip a sword or rarely, an axe. ItemStack weapon; if (Math.random()<0.03) { - if (Math.random()<0.4) { + if (Math.random()<0.8) { + weapon = new ItemStack(Material.WOOD_AXE); + } else if (Math.random()<0.8) { weapon = new ItemStack(Material.STONE_AXE); - } if (Math.random()<0.4) { - weapon = new ItemStack(Material.IRON_AXE); } else { weapon = new ItemStack(Material.DIAMOND_AXE); } m.getEquipment().setItemInMainHand(weapon); } else { - if (Math.random()<0.4) { + if (Math.random()<0.8) { + weapon = new ItemStack(Material.WOOD_SWORD); + } else if (Math.random()<0.8) { weapon = new ItemStack(Material.STONE_SWORD); - } if (Math.random()<0.4) { - weapon = new ItemStack(Material.IRON_SWORD); } else { - weapon = new ItemStack(Material.DIAMOND_SWORD); + weapon = new ItemStack(Material.IRON_SWORD); } m.getEquipment().setItemInMainHand(weapon); } @@ -409,14 +415,20 @@ public class MonsterController { //Equip a sword or rarely, an axe. ItemStack weapon; if (Math.random()<0.03) { - if (Math.random()<0.6) { + if (Math.random()<0.8) { + weapon = new ItemStack(Material.IRON_AXE); + } else + if (Math.random()<0.8) { weapon = new ItemStack(Material.DIAMOND_AXE); } else { weapon = new ItemStack(Material.GOLD_AXE); } m.getEquipment().setItemInMainHand(weapon); } else { - if (Math.random()<0.6) { + if (Math.random()<0.8) { + weapon = new ItemStack(Material.IRON_SWORD); + } else + if (Math.random()<0.8) { weapon = new ItemStack(Material.DIAMOND_SWORD); } else { weapon = new ItemStack(Material.GOLD_SWORD); @@ -476,17 +488,17 @@ public class MonsterController { //Equip a sword or rarely, an axe. ItemStack weapon; if (Math.random()<0.03) { - if (Math.random()<0.5) { + if (Math.random()<0.2) { weapon = new ItemStack(Material.WOOD_AXE); } else { - weapon = new ItemStack(Material.STONE_AXE); + weapon = new ItemStack(Material.AIR); } m.getEquipment().setItemInMainHand(weapon); } else { if (Math.random()<0.5) { weapon = new ItemStack(Material.WOOD_SWORD); } else { - weapon = new ItemStack(Material.STONE_SWORD); + weapon = new ItemStack(Material.AIR); } m.getEquipment().setItemInMainHand(weapon); } @@ -592,6 +604,7 @@ public class MonsterController { } if(isZombieLeader(m)) { + GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(20); m.setHealth(m.getMaxHealth()); } @@ -610,6 +623,7 @@ public class MonsterController { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,1)); if(isZombieLeader(m)) { + GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(50); m.setHealth(m.getMaxHealth()); } @@ -635,6 +649,7 @@ public class MonsterController { if (Math.random()<=0.2) {m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,99999,1));} if(isZombieLeader(m)) { + GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(200); m.setHealth(m.getMaxHealth()); } @@ -650,6 +665,7 @@ public class MonsterController { SetupCustomName("",m); if(isZombieLeader(m)) { + GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(40); m.setHealth(m.getMaxHealth()); } @@ -684,6 +700,9 @@ public class MonsterController { case ENDERMAN: et=EntityType.ENDERMAN; break; + case ENDERMITE: + et=EntityType.ENDERMITE; + break; case GIANT: et=EntityType.GIANT; break; diff --git a/src/sig/plugin/TwosideKeeper/MonsterStructure.java b/src/sig/plugin/TwosideKeeper/MonsterStructure.java index 6eaf811..b9eec40 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterStructure.java +++ b/src/sig/plugin/TwosideKeeper/MonsterStructure.java @@ -4,12 +4,15 @@ import org.bukkit.entity.LivingEntity; public class MonsterStructure { public LivingEntity target; + public String original_name; public MonsterStructure() { target=null; + original_name=""; } public MonsterStructure(LivingEntity target) { this.target=target; + original_name=""; } public LivingEntity GetTarget() { @@ -23,4 +26,16 @@ public class MonsterStructure { public void SetTarget(LivingEntity target) { this.target=target; } + + public boolean hasOriginalName() { + return !this.original_name.equalsIgnoreCase(""); + } + + public String getOriginalName() { + if (hasOriginalName()) { + return this.original_name; + } else { + return ""; + } + } } diff --git a/src/sig/plugin/TwosideKeeper/NewCombat.java b/src/sig/plugin/TwosideKeeper/NewCombat.java index 02570ca..51e43b2 100644 --- a/src/sig/plugin/TwosideKeeper/NewCombat.java +++ b/src/sig/plugin/TwosideKeeper/NewCombat.java @@ -15,6 +15,7 @@ import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Arrow; import org.bukkit.entity.Creeper; +import org.bukkit.entity.Enderman; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.FallingBlock; @@ -44,6 +45,8 @@ import com.google.common.collect.Iterables; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbilityApplyEffects; import sig.plugin.TwosideKeeper.HelperStructures.BowMode; +import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; +import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.Common.DamageType; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; @@ -1269,6 +1272,16 @@ public class NewCombat { p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,100,resistlevel)); } } + if (damager instanceof Enderman) { + if (MonsterController.getMonsterDifficulty(((Monster)damager))==MonsterDifficulty.HELLFIRE) { + for (int i=0;i<4;i++) { + if (Math.random()<=0.2) { + Monster mm = MonsterController.spawnAdjustedMonster(MonsterType.ENDERMITE, damager.getLocation().add(0,1,0)); + mm.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,2)); + } + } + } + } } } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index fd331e2..5d3d926 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -63,6 +63,7 @@ import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.Witch; import org.bukkit.entity.EnderDragon.Phase; +import org.bukkit.entity.Enderman; import org.bukkit.event.Event.Result; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -85,6 +86,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; @@ -2003,7 +2006,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { (ev.getClickedBlock().getType()==Material.CHEST || ev.getClickedBlock().getType()==Material.TRAPPED_CHEST)) { //Now check if it's a shop chest. - Sign shopsign = WorldShop.grabShopSign(ev.getClickedBlock().getLocation()); + Sign shopsign = WorldShop.grabShopSign(ev.getClickedBlock()); if (shopsign!=null) { //Now grab the owner of the shop. WorldShop shop = TwosideShops.LoadWorldShopData(shopsign); @@ -2136,7 +2139,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { boolean allowed=true; String owner=""; if (WorldShop.hasShopSignAttached(ev.getClickedBlock())) { - WorldShop s = TwosideShops.LoadWorldShopData(WorldShop.grabShopSign(ev.getClickedBlock().getLocation())); + WorldShop s = TwosideShops.LoadWorldShopData(WorldShop.grabShopSign(ev.getClickedBlock())); if (!s.GetOwner().equalsIgnoreCase(ev.getPlayer().getName())) { allowed=false; owner=s.GetOwner(); @@ -2204,7 +2207,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Save the Item Cube. itemCube_saveConfig(itemcube_id,save_items); //This may have been a shop. Update the shop too. - WorldShop.updateShopSign(ev.getClickedBlock().getLocation()); + WorldShop.updateShopSign(ev.getClickedBlock()); } else { ev.getPlayer().sendMessage("This shop is owned by "+ChatColor.LIGHT_PURPLE+owner+ChatColor.WHITE+". You cannot dump item cubes into others' shops!"); //ev.setCancelled(true); @@ -2226,7 +2229,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (chest.getType()==Material.CHEST || chest.getType()==Material.TRAPPED_CHEST) { if (s.getLine(0).equalsIgnoreCase("shop")) { - if (!WorldShop.shopSignExists(chest.getLocation())) { + if (!WorldShop.shopSignExists(chest)) { log("This is a shop sign.",5); //Create a new shop. ItemStack item = player.getEquipment().getItemInMainHand(); @@ -2311,7 +2314,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } else if (s.getLine(0).equalsIgnoreCase("buyshop")) { - if (!WorldShop.shopSignExists(chest.getLocation())) { + if (!WorldShop.shopSignExists(chest)) { //Create a new buy shop. ItemStack item = player.getEquipment().getItemInMainHand(); if (item.getType()!=Material.AIR) { @@ -2499,8 +2502,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { for (int z=-1;z<2;z++) { if ((x!=0)^(z!=0) && ev.getBlockPlaced().getLocation().add(x,0,z).getBlock().getType()==ev.getBlockPlaced().getType()) { //This is the same type of block. Make sure there's no shop sign attached to it. - if (WorldShop.hasShopSignAttached(ev.getBlockPlaced().getLocation().add(x,0,z).getBlock())) { - Sign s = WorldShop.grabShopSign(ev.getBlockPlaced().getLocation().add(x,0,z)); + if (WorldShop.hasShopSignAttached(ev.getBlockPlaced().getRelative(x,0,z))) { + Sign s = WorldShop.grabShopSign(ev.getBlockPlaced().getRelative(x,0,z)); WorldShop shop = TwosideShops.LoadWorldShopData(s); if (!shop.GetOwner().equalsIgnoreCase(ev.getPlayer().getName())) { //This is not allowed! We can't expand shops that are not ours. @@ -2876,8 +2879,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (b.getType()==Material.CHEST || b.getType()==Material.TRAPPED_CHEST) { //This is a valid shop. Now update the shop sign for it. final Chest c = (Chest)b.getState(); - WorldShop.updateShopSign(b.getLocation()); - final Sign s = WorldShop.grabShopSign(b.getLocation()); + WorldShop.updateShopSign(b); + final Sign s = WorldShop.grabShopSign(b); if (s!=null) { final int ID = TwosideShops.GetShopID(s); Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { @@ -3422,7 +3425,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { e.setItemStack(i.getItemStack()); e.setCustomNameVisible(i.isCustomNameVisible()); e.setVelocity(new Vector(0,0,0)); - e.setPickupDelay(999999999); + e.setPickupDelay(Integer.MAX_VALUE); e.teleport(i.getLocation()); log("Respawn this shop item.",5); } @@ -3860,6 +3863,23 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) + public void entityTargetEvent(EntityTargetLivingEntityEvent ev) { + if (ev.getEntity() instanceof LivingEntity && + ev.getReason()==TargetReason.PIG_ZOMBIE_TARGET) { + LivingEntity l = (LivingEntity)ev.getEntity(); + if (l.hasPotionEffect(PotionEffectType.GLOWING)) { + if (monsterdata.containsKey(l.getUniqueId())) { + ev.setTarget(monsterdata.get(l.getUniqueId()).target); + } + } + } + if ((ev.getEntity() instanceof Monster) && GenericFunctions.isBossMonster((Monster)ev.getEntity())) { + Monster m = (Monster)ev.getEntity(); + GlowAPI.setGlowing(m, GlowAPI.Color.DARK_RED, Bukkit.getOnlinePlayers()); + } + } + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void entityHitEvent(EntityDamageByEntityEvent ev) { if (ev.getDamage()>=CUSTOM_DAMAGE_IDENTIFIER) { @@ -3985,6 +4005,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { MonsterStructure ms = null; if (monsterdata.containsKey(m.getUniqueId())) { ms = (MonsterStructure)monsterdata.get(m.getUniqueId()); + if (ms.hasOriginalName()) { + m.setCustomName(ms.getOriginalName()); + } } if (ms!=null && (ms.GetTarget() instanceof Player)) { @@ -4380,7 +4403,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (ev.getBlock().getType()==Material.WALL_SIGN) { s = (Sign)(ev.getBlock().getState()); } else { - s = WorldShop.grabShopSign(ev.getBlock().getLocation()); + s = WorldShop.grabShopSign(ev.getBlock()); } if (s!=null) { if (s.getLine(0).equalsIgnoreCase(ChatColor.BLUE+"-- SHOP --")) { @@ -4565,7 +4588,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Inventory source = ev.getSource(); Location l = source.getLocation(); //See if this block is a world shop. - if (WorldShop.grabShopSign(l)!=null) { + if (WorldShop.grabShopSign(l.getBlock())!=null) { //This is a world shop. DO NOT allow this to happen. ev.setCancelled(true); final Location l1=ev.getDestination().getLocation(); @@ -4578,7 +4601,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Inventory destination = ev.getDestination(); l = destination.getLocation(); //See if this block is a world shop. - if (WorldShop.grabShopSign(l)!=null) { + if (WorldShop.grabShopSign(l.getBlock())!=null) { //This is a world shop. DO NOT allow this to happen. ev.setCancelled(true); final Location l1=source.getLocation(); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java index 34616a1..09c0fc9 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java @@ -176,8 +176,8 @@ public final class TwosideKeeperAPI { } //World Shop COMMANDS. - public static boolean isWorldShop(Location l) { - return WorldShop.shopSignExists(l); + public static boolean isWorldShop(Block b) { + return WorldShop.shopSignExists(b); } public static boolean hasPermissionToBreakWorldShopSign(Sign s, Player p) { return WorldShop.hasPermissionToBreakWorldShopSign(s,p); @@ -185,8 +185,8 @@ public final class TwosideKeeperAPI { public static void removeWorldShopDisplayItem(Sign s) { WorldShop.removeShopItem(s); } - public static boolean canPlaceShopSignOnBlock(Location block_loc) { - return WorldShop.canPlaceShopSignOnBlock(block_loc); + public static boolean canPlaceShopSignOnBlock(Block block) { + return WorldShop.canPlaceShopSignOnBlock(block); } //Recycling Center COMMANDS.