->Fighting Elite Monsters now displays a healthbar if you are targeting
one. ->Fixed Elite monster equipment drops to properly set enchantments on items. ->Players can now shoot arrows through each other. ->Hunter's Compass activation now occurs on a right-click while holding it in your hand. Updated the item's description accordingly. ->Fixed a bug where a Hunter's Compass will not disappear from your inventory when it breaks with only one left. ->Fixed a bug where non-hellfire mobs were dropping Hunter's Compasses. ->Fixed a bug where Elite monsters could be leaders. ->Fixed error messages being caused by clicking outside of inventory windows with certain items. ->Fixed a bug where Bow users would be targeted even though the monster was aggro'd by another player. ->Fixed a bug with Poison allowing players to instantly kill monsters. ->Fix explosion damage not properly applying damage to entities. ->Zombie Leaders no longer have random amounts of health. ->Breaking sound now plays when a Hunter's Compass breaks. ->Modify Zombie Leader health to much higher and consistent values. ->Elite monsters now have 50% more health. ->Set items will automatically update their descriptions more often now, so if you have an out-dated piece, it should auto-update. ->Vanilla behavior that subtracts durability based on damage taken is removed. All damage taken only removes 1 point of durability per hit. ->Headshot calculations are much more accurate now. ->New Craftable arrow types are now available! These will power up the Ranger class greatly when used properly! But can be quite expensive. http://puu.sh/quQUA/783d5a6d99.png
This commit is contained in:
parent
7a0a75a519
commit
a6bb37c374
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: TwosideKeeper
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.8.0r1
|
||||
version: 3.8.1
|
||||
commands:
|
||||
money:
|
||||
description: Tells the player the amount of money they are holding.
|
||||
|
@ -14,6 +14,10 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarFlag;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -65,6 +69,7 @@ public class EliteMonster {
|
||||
Location target_leap_loc = null;
|
||||
Location myspawn = null;
|
||||
HashMap<Block,Material> storedblocks = new HashMap<Block,Material>();
|
||||
BossBar bar = null;
|
||||
|
||||
List<Player> targetlist = new ArrayList<Player>();
|
||||
//Contains all functionality specific to Elite Monsters.
|
||||
@ -74,6 +79,7 @@ public class EliteMonster {
|
||||
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD);
|
||||
this.hp_before_burstcheck=m.getHealth();
|
||||
this.myspawn=m.getLocation();
|
||||
bar = m.getServer().createBossBar(m.getCustomName(), BarColor.RED, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
|
||||
}
|
||||
|
||||
public void runTick() {
|
||||
@ -83,6 +89,7 @@ public class EliteMonster {
|
||||
regenerateHealth();
|
||||
moveFasterToTarget();
|
||||
resetToSpawn();
|
||||
createBossHealthbar();
|
||||
if (m.isValid() && targetlist.size()>0) {
|
||||
weakenTeam();
|
||||
retargetInAir();
|
||||
@ -91,8 +98,19 @@ public class EliteMonster {
|
||||
}
|
||||
}
|
||||
|
||||
private void createBossHealthbar() {
|
||||
bar.removeAll();
|
||||
for (int i=0;i<targetlist.size();i++) {
|
||||
bar.addPlayer(targetlist.get(i));
|
||||
bar.setProgress(m.getHealth()/m.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
private void resetToSpawn() {
|
||||
if (targetlist.size()==0 && m.getLocation().distanceSquared(myspawn)>81) {
|
||||
while (myspawn.getBlock().getType()==Material.AIR && myspawn.getY()>0) {
|
||||
myspawn = myspawn.add(0,-1,0);
|
||||
}
|
||||
m.teleport(myspawn);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
}
|
||||
@ -237,6 +255,11 @@ public class EliteMonster {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8),true);
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,8),true);
|
||||
//m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,2),true);
|
||||
if (!enraged) {
|
||||
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
|
||||
m.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2833,6 +2833,7 @@ public class GenericFunctions {
|
||||
}
|
||||
boolean hitallowed=enoughTicksHavePassed(entity,damager);
|
||||
if (hitallowed) {
|
||||
TwosideKeeper.log("Damage is "+dmg, 3);
|
||||
updateNoDamageTickMap(entity,damager);
|
||||
if (damager instanceof Player) {
|
||||
Player p = (Player)damager;
|
||||
@ -2914,6 +2915,7 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (entity instanceof Player) {
|
||||
if (entity.getHealth()>dmg && entity instanceof Player) {
|
||||
if (!AttemptRevive((Player)entity,dmg)) {
|
||||
entity.setHealth(((Player)entity).getHealth()-dmg);
|
||||
@ -2930,6 +2932,14 @@ public class GenericFunctions {
|
||||
entity.damage(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (entity.getHealth()>dmg) {
|
||||
entity.setHealth((entity).getHealth()-dmg);
|
||||
aPlugin.API.sendEntityHurtAnimation(entity);
|
||||
} else {
|
||||
entity.damage(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3131,6 +3141,26 @@ public class GenericFunctions {
|
||||
player.getInventory().getItem(i).setItemMeta(m);
|
||||
}
|
||||
}
|
||||
if (player.getOpenInventory()!=null) {
|
||||
for (int i=0;i<player.getOpenInventory().getTopInventory().getSize();i++) {
|
||||
if (ItemSet.isSetItem(player.getOpenInventory().getTopInventory().getItem(i))) {
|
||||
//Update the lore. See if it's hardened. If it is, we will save just that piece.
|
||||
//Save the tier and type as well.
|
||||
ItemSet set = ItemSet.GetSet(player.getOpenInventory().getTopInventory().getItem(i));
|
||||
int tier = ItemSet.GetTier(player.getOpenInventory().getTopInventory().getItem(i));
|
||||
|
||||
List<String> newlore = new ArrayList<String>();
|
||||
|
||||
if (GenericFunctions.isHardenedItem(player.getOpenInventory().getTopInventory().getItem(i))) {
|
||||
newlore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+GenericFunctions.getHardenedItemBreaks(player.getOpenInventory().getTopInventory().getItem(i)));
|
||||
}
|
||||
newlore.addAll(ItemSet.GenerateLore(set, tier));
|
||||
ItemMeta m = player.getOpenInventory().getTopInventory().getItem(i).getItemMeta();
|
||||
m.setLore(newlore);
|
||||
player.getOpenInventory().getTopInventory().getItem(i).setItemMeta(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ExperienceOrb spawnXP(Location location, int expAmount) {
|
||||
@ -3190,6 +3220,7 @@ public class GenericFunctions {
|
||||
//We cleared the non-living entities, deal damage to the rest.
|
||||
for (int i=0;i<nearbyentities.size();i++) {
|
||||
double damage_mult = 2.0d/(l.distance(nearbyentities.get(i).getLocation())+1.0);
|
||||
TwosideKeeper.log("dmg mult is "+damage_mult,2);
|
||||
damage_mult*=TwosideKeeper.EXPLOSION_DMG_MULT;
|
||||
damage_mult*=CalculateBlastResistance((LivingEntity)nearbyentities.get(i));
|
||||
double dmg = basedmg * damage_mult;
|
||||
@ -3200,7 +3231,7 @@ public class GenericFunctions {
|
||||
}
|
||||
if (Math.random()>dodgechance) {
|
||||
//DealDamageToMob(dmg,(LivingEntity)nearbyentities.get(i),null,null,"Explosion");
|
||||
TwosideKeeper.log("dmg dealt is supposed to be "+dmg, 5);
|
||||
TwosideKeeper.log("dmg dealt is supposed to be "+dmg, 2);
|
||||
subtractHealth((LivingEntity)nearbyentities.get(i),null,NewCombat.CalculateDamageReduction(dmg, (LivingEntity)nearbyentities.get(i), null));
|
||||
} else {
|
||||
if (nearbyentities.get(i) instanceof Player) {
|
||||
@ -3381,4 +3412,19 @@ public class GenericFunctions {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Entity getNearestMonster(LivingEntity ent) {
|
||||
List<Entity> entities = ent.getNearbyEntities(16, 16, 16);
|
||||
List<Monster> ents = NewCombat.trimNonMonsterEntities(entities);
|
||||
double closest=9999999d;
|
||||
Monster m = null;
|
||||
for (int i=0;i<ents.size();i++) {
|
||||
double distance = ents.get(i).getLocation().distanceSquared(ent.getLocation());
|
||||
if (distance<closest) {
|
||||
closest = distance;
|
||||
m = ents.get(i);
|
||||
}
|
||||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ public enum MonsterDifficulty {
|
||||
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
||||
droplist.add(gen_loot);
|
||||
double randomness = Math.random();
|
||||
if (this==MonsterDifficulty.HELLFIRE || this==MonsterDifficulty.ELITE) {
|
||||
if (this.equals(MonsterDifficulty.HELLFIRE) || this.equals(MonsterDifficulty.ELITE)) {
|
||||
if (randomness<=0.5) {
|
||||
ItemStack hunters_compass = new ItemStack(Material.COMPASS);
|
||||
hunters_compass.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||
@ -337,7 +337,7 @@ public enum MonsterDifficulty {
|
||||
lore.add("directions of the guided arrow.");
|
||||
lore.add("");
|
||||
lore.add("You may need to calibrate it by");
|
||||
lore.add("holding it first.");
|
||||
lore.add("right-clicking with it first.");
|
||||
lore.add("");
|
||||
lore.add("The compass appears to be slightly");
|
||||
lore.add("unstable...");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -8,9 +9,14 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -31,6 +37,8 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.inventivetalent.glow.GlowAPI;
|
||||
import org.inventivetalent.glow.GlowAPI.Color;
|
||||
|
||||
import aPlugin.Utils;
|
||||
import net.minecraft.server.v1_9_R1.GenericAttributes;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemRarity;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Loot;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||
@ -68,7 +76,7 @@ public class MonsterController {
|
||||
MonsterStructure ms = TwosideKeeper.monsterdata.get(ent.getUniqueId());
|
||||
ms.SetLeader(true);
|
||||
//Set the HP of the leader to a more proper amount.
|
||||
}
|
||||
} else
|
||||
if (meetsConditionsToBeElite(ent) && !minion) {
|
||||
Monster m = (Monster)(ent);
|
||||
MonsterDifficulty md = MonsterDifficulty.ELITE;
|
||||
@ -85,7 +93,7 @@ public class MonsterController {
|
||||
} else {
|
||||
if (isZombieLeader(ent)) {
|
||||
Monster m = (Monster)ent;
|
||||
SetupCustomName("",m);
|
||||
convertMonster(m,MonsterDifficulty.NORMAL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -99,7 +107,7 @@ public class MonsterController {
|
||||
} else {
|
||||
if (isZombieLeader(ent)) {
|
||||
Monster m = (Monster)ent;
|
||||
SetupCustomName("",m);
|
||||
convertMonster(m,MonsterDifficulty.NORMAL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -113,7 +121,7 @@ public class MonsterController {
|
||||
} else {
|
||||
if (isZombieLeader(ent)) {
|
||||
Monster m = (Monster)ent;
|
||||
SetupCustomName("",m);
|
||||
convertMonster(m,MonsterDifficulty.NORMAL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -481,16 +489,16 @@ public class MonsterController {
|
||||
case 4:{
|
||||
ItemStack helm = new ItemStack(Material.GOLD_HELMET);
|
||||
m.getEquipment().setHelmet(helm);
|
||||
m.getEquipment().setHelmet(Loot.GenerateSetPiece(helm, true, 1));
|
||||
m.getEquipment().setHelmet(Loot.GenerateMegaPiece(helm.getType(), true, true, 1));
|
||||
helm = new ItemStack(Material.GOLD_CHESTPLATE);
|
||||
m.getEquipment().setChestplate(helm);
|
||||
m.getEquipment().setChestplate(Loot.GenerateSetPiece(helm, true, 1));
|
||||
m.getEquipment().setChestplate(Loot.GenerateMegaPiece(helm.getType(), true, true, 1));
|
||||
helm = new ItemStack(Material.GOLD_LEGGINGS);
|
||||
m.getEquipment().setLeggings(helm);
|
||||
m.getEquipment().setLeggings(Loot.GenerateSetPiece(helm, true, 1));
|
||||
m.getEquipment().setLeggings(Loot.GenerateMegaPiece(helm.getType(), true, true, 1));
|
||||
helm = new ItemStack(Material.GOLD_BOOTS);
|
||||
m.getEquipment().setBoots(helm);
|
||||
m.getEquipment().setBoots(Loot.GenerateSetPiece(helm, true, 1));
|
||||
m.getEquipment().setBoots(Loot.GenerateMegaPiece(helm.getType(), true, true, 1));
|
||||
TwosideKeeper.log("Helmet durability set to "+m.getEquipment().getHelmet().getDurability(), 5);
|
||||
TwosideKeeper.log("Chestplate durability set to "+m.getEquipment().getChestplate().getDurability(), 5);
|
||||
TwosideKeeper.log("Leggings durability set to "+m.getEquipment().getLeggings().getDurability(), 5);
|
||||
@ -504,10 +512,10 @@ public class MonsterController {
|
||||
ItemStack weapon;
|
||||
if (Math.random()<0.03) {
|
||||
weapon = new ItemStack(Material.GOLD_AXE);
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateSetPiece(weapon, true, 1));
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateMegaPiece(weapon.getType(), true, true, 1));
|
||||
} else {
|
||||
weapon = new ItemStack(Material.GOLD_SWORD);
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateSetPiece(weapon, true, 1));
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateMegaPiece(weapon.getType(), true, true, 1));
|
||||
}
|
||||
if (Math.random()<0.5) {
|
||||
ItemStack shield = new ItemStack(Material.SHIELD,1,(short)((Math.random()*DyeColor.values().length)));
|
||||
@ -515,11 +523,11 @@ public class MonsterController {
|
||||
}
|
||||
} else {
|
||||
ItemStack weapon = new ItemStack(Material.BOW);
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateSetPiece(weapon, true, 1));
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateMegaPiece(weapon.getType(), true, true, 1));
|
||||
}
|
||||
if (m.getType()==EntityType.PIG_ZOMBIE) {
|
||||
ItemStack weapon = new ItemStack(Material.GOLD_SWORD);
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateSetPiece(weapon, true, 1));
|
||||
m.getEquipment().setItemInMainHand(Loot.GenerateMegaPiece(weapon.getType(), true, true, 1));
|
||||
}
|
||||
m.getEquipment().setBootsDropChance(1.0f);
|
||||
m.getEquipment().setChestplateDropChance(1.0f);
|
||||
@ -672,52 +680,52 @@ public class MonsterController {
|
||||
public static Monster convertMonster(Monster m, MonsterDifficulty md) {
|
||||
switch (md) {
|
||||
case DANGEROUS: {
|
||||
SetupCustomName(ChatColor.DARK_AQUA+"Dangerous",m);
|
||||
m.setMaxHealth(m.getMaxHealth()*2.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
if (isAllowedToEquipItems(m)) {
|
||||
m.getEquipment().clear();
|
||||
RandomizeEquipment(m,1);
|
||||
}
|
||||
SetupCustomName(ChatColor.DARK_AQUA+"Dangerous",m);
|
||||
if(isZombieLeader(m))
|
||||
{
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,4));
|
||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||
m.setMaxHealth(60);
|
||||
m.setMaxHealth(800); //Target is 800 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
TwosideKeeper.log(m.getCustomName()+" health is "+m.getMaxHealth(), 5);
|
||||
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||
} else {
|
||||
m.setMaxHealth(m.getMaxHealth()*2.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
}
|
||||
if (!GenericFunctions.isArmoredMob(m)) {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1));
|
||||
}
|
||||
}break;
|
||||
case DEADLY: {
|
||||
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
||||
m.setMaxHealth(m.getMaxHealth()*3.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
if (isAllowedToEquipItems(m)) {
|
||||
m.getEquipment().clear();
|
||||
RandomizeEquipment(m,2);
|
||||
}
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1));
|
||||
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
||||
if(isZombieLeader(m))
|
||||
{
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,4));
|
||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||
m.setMaxHealth(120);
|
||||
m.setMaxHealth(1200); //Target is 1200 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||
} else {
|
||||
m.setMaxHealth(m.getMaxHealth()*3.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
}
|
||||
if (!GenericFunctions.isArmoredMob(m)) {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,3));
|
||||
}
|
||||
}break;
|
||||
case HELLFIRE:{
|
||||
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
||||
//m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob");
|
||||
//m.setCustomNameVisible(true);
|
||||
m.setMaxHealth(m.getMaxHealth()*4.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
if (m.getType()!=EntityType.ENDERMAN) {
|
||||
m.setFireTicks(Integer.MAX_VALUE);
|
||||
}
|
||||
@ -728,13 +736,17 @@ public class MonsterController {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1));
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,1));
|
||||
if (Math.random()<=0.2) {m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,1));}
|
||||
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
||||
if(isZombieLeader(m))
|
||||
{
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,4));
|
||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||
m.setMaxHealth(200);
|
||||
m.setMaxHealth(1600); //Target is 1600 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||
} else {
|
||||
m.setMaxHealth(m.getMaxHealth()*4.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
}
|
||||
if (!GenericFunctions.isArmoredMob(m)) {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,5));
|
||||
@ -744,7 +756,7 @@ public class MonsterController {
|
||||
SetupCustomName(ChatColor.DARK_PURPLE+"Elite",m);
|
||||
//m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob");
|
||||
//m.setCustomNameVisible(true);
|
||||
m.setMaxHealth(m.getMaxHealth()*40.0);
|
||||
m.setMaxHealth(m.getHealth()*60.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
GlowAPI.setGlowing(m, Color.DARK_PURPLE, Bukkit.getOnlinePlayers());
|
||||
if (isAllowedToEquipItems(m)) {
|
||||
@ -769,15 +781,32 @@ public class MonsterController {
|
||||
SetupCustomName("",m);
|
||||
if(isZombieLeader(m))
|
||||
{
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,4));
|
||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||
m.setMaxHealth(100);
|
||||
m.setMaxHealth(400);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
m.setCustomName("Zombie Leader");
|
||||
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||
} else {
|
||||
m.setMaxHealth(m.getMaxHealth()*1.0);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
}
|
||||
}break;
|
||||
}
|
||||
removeZombieLeaderAttribute(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
private static void removeZombieLeaderAttribute(Monster m) {
|
||||
final AttributeInstance attribute = m.getAttribute(Attribute.GENERIC_MAX_HEALTH);
|
||||
final Collection<AttributeModifier> modifiers = attribute.getModifiers();
|
||||
for (AttributeModifier modifier : modifiers) {
|
||||
if (modifier.getName().equals("Leader zombie bonus")) {
|
||||
attribute.removeModifier(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isAllowedToEquipItems(Monster m) {
|
||||
if (m.getType()==EntityType.ZOMBIE ||
|
||||
m.getType()==EntityType.PIG_ZOMBIE ||
|
||||
|
@ -28,6 +28,7 @@ import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.TippedArrow;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@ -584,6 +585,8 @@ public class NewCombat {
|
||||
headshot = headshot_mult>1.0;
|
||||
addMultiplierToPlayerLogger(damager,"Headshot Mult",headshot_mult);
|
||||
basemult*=headshot_mult;
|
||||
double arrow_mult = calculateArrowMultiplier(damager,weapon,target);
|
||||
basemult*=arrow_mult;
|
||||
//This is an arrow shot from a bow.
|
||||
}
|
||||
}
|
||||
@ -602,6 +605,27 @@ public class NewCombat {
|
||||
return basedmg * basemult;
|
||||
}
|
||||
|
||||
private static double calculateArrowMultiplier(Entity damager, ItemStack weapon, LivingEntity target) {
|
||||
double mult = 1.0;
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
if (shooter instanceof Player) {
|
||||
Player p = (Player)shooter;
|
||||
|
||||
if (damager instanceof TippedArrow) {
|
||||
TippedArrow a = (TippedArrow)damager;
|
||||
if (a.hasMetadata("DOUBLE_DAMAGE_ARR")) {
|
||||
mult*=2.0;
|
||||
addMultiplierToPlayerLogger(damager,"Handmade Arrow Mult",mult);
|
||||
}
|
||||
if (a.hasMetadata("QUADRUPLE_DAMAGE_ARR")) {
|
||||
mult*=4.0;
|
||||
addMultiplierToPlayerLogger(damager,"Diamond-Tipped Arrow Mult",mult);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mult;
|
||||
}
|
||||
|
||||
private static void setPlayerTarget(Entity damager, LivingEntity target, boolean headshot, boolean preemptive) {
|
||||
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
@ -967,6 +991,29 @@ public class NewCombat {
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
if ((shooter instanceof Player) && target!=null) {
|
||||
Player p = (Player)shooter;
|
||||
if (damager instanceof TippedArrow) {
|
||||
TippedArrow a = (TippedArrow)damager;
|
||||
if (a.hasMetadata("EXPLODE_ARR")) {
|
||||
//Create an explosion.
|
||||
TwosideKeeper.log("In here", 5);
|
||||
Location hitloc = aPlugin.API.getArrowHitLocation(target, a);
|
||||
GenericFunctions.DealExplosionDamageToEntities(hitloc, NewCombat.CalculateWeaponDamage(p,null)+40, 6);
|
||||
p.playSound(hitloc, Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.5f, 1.0f);
|
||||
aPlugin.API.sendSoundlessExplosion(hitloc, 2);
|
||||
}
|
||||
if (a.hasMetadata("TRAP_ARR")) {
|
||||
int slownesslv=0;
|
||||
if (target.hasPotionEffect(PotionEffectType.SLOW)) {
|
||||
slownesslv = GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, target)+1;
|
||||
target.removePotionEffect(PotionEffectType.SLOW);
|
||||
}
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20*5,slownesslv));
|
||||
}
|
||||
if (a.hasMetadata("POISON_ARR")) {
|
||||
int poisonlv=0;
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,20*20,0));
|
||||
}
|
||||
}
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
|
||||
double ratio = 1.0-CalculateDamageReduction(1,target,p);
|
||||
@ -1062,6 +1109,16 @@ public class NewCombat {
|
||||
return livinglist;
|
||||
}
|
||||
|
||||
public static List<Monster> trimNonMonsterEntities(List<Entity> entitylist) {
|
||||
List<Monster> livinglist = new ArrayList<Monster>();
|
||||
for (int i=0;i<entitylist.size();i++) {
|
||||
if ((entitylist.get(i) instanceof Monster) && !(entitylist.get(i) instanceof Player)) {
|
||||
livinglist.add((Monster)entitylist.get(i));
|
||||
}
|
||||
}
|
||||
return livinglist;
|
||||
}
|
||||
|
||||
static public double CalculateDamageReduction(double basedmg,LivingEntity target,Entity damager) {
|
||||
|
||||
double dmgreduction = 0.0;
|
||||
@ -1262,7 +1319,11 @@ public class NewCombat {
|
||||
Monster m = (Monster)target;
|
||||
Projectile proj = (Projectile)arrow;
|
||||
Location arrowLoc = proj.getLocation();
|
||||
if (proj instanceof Arrow) {
|
||||
arrowLoc = aPlugin.API.getArrowHitLocation(target, (Arrow)proj);
|
||||
}
|
||||
Location monsterHead = m.getEyeLocation();
|
||||
TwosideKeeper.log("Distance: "+(arrowLoc.distanceSquared(monsterHead)), 3);
|
||||
|
||||
double headshotvaly=0.22/TwosideKeeper.HEADSHOT_ACC;
|
||||
double directionvaly=0.25/TwosideKeeper.HEADSHOT_ACC;
|
||||
@ -1271,6 +1332,7 @@ public class NewCombat {
|
||||
Player p = (Player)proj.getShooter();
|
||||
if (GenericFunctions.isRanger(p) &&
|
||||
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) {
|
||||
aPlugin.API.sendSoundlessExplosion(arrowLoc, 1);
|
||||
headshotvaly *= 4;
|
||||
}
|
||||
|
||||
@ -1280,8 +1342,7 @@ public class NewCombat {
|
||||
}
|
||||
|
||||
if (proj.getTicksLived()>=4 || GenericFunctions.isRanger(p)) {
|
||||
if (arrowWithinYBounds(arrowLoc,monsterHead,headshotvaly) &&
|
||||
arrowWithinHelmetBounds(arrowLoc,m,directionvaly)) {
|
||||
if (arrowLoc.distanceSquared(monsterHead)<=0.3*headshotvaly) {
|
||||
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class Party {
|
||||
}
|
||||
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players set "+p.getName().toLowerCase()+" Party"+color+" "+partyplayers.size()*-1);
|
||||
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option "+p.getName().toLowerCase()+" color "+ConvertColor(color));
|
||||
|
||||
p.getScoreboard().getTeam(p.getName().toLowerCase()).setAllowFriendlyFire(false);
|
||||
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
|
||||
TwosideKeeper.setPlayerMaxHealth(p);
|
||||
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
|
||||
|
@ -103,6 +103,8 @@ public class PlayerStructure {
|
||||
public boolean preemptive=false;
|
||||
public boolean crit=false;
|
||||
|
||||
public long lastrightclick = 0;
|
||||
|
||||
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
|
||||
public PlayerStructure(Player p, long serverTickTime) {
|
||||
if (p!=null) {
|
||||
|
@ -12,7 +12,12 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.material.Dye;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
||||
@ -608,4 +613,115 @@ public class Recipes {
|
||||
huntercompass_recipe.addIngredient(Material.DIAMOND_BLOCK);
|
||||
Bukkit.addRecipe(huntercompass_recipe);
|
||||
}
|
||||
public static void Initialize_CustomArrow_Recipes() {
|
||||
|
||||
ItemStack handmadearrow = getArrowFromMeta("DOUBLE_DAMAGE_ARR");
|
||||
ShapelessRecipe handmadearrow_recipe = new ShapelessRecipe(handmadearrow);
|
||||
handmadearrow_recipe.addIngredient(Material.FLINT);
|
||||
handmadearrow_recipe.addIngredient(Material.STICK);
|
||||
handmadearrow_recipe.addIngredient(Material.FEATHER);
|
||||
Bukkit.addRecipe(handmadearrow_recipe);
|
||||
|
||||
ItemStack diamondtippedarrow = getArrowFromMeta("QUADRUPLE_DAMAGE_ARR");
|
||||
ShapelessRecipe diamondtippedarrow_recipe = new ShapelessRecipe(diamondtippedarrow);
|
||||
diamondtippedarrow_recipe.addIngredient(Material.TIPPED_ARROW);
|
||||
diamondtippedarrow_recipe.addIngredient(Material.DIAMOND);
|
||||
Bukkit.addRecipe(diamondtippedarrow_recipe);
|
||||
|
||||
|
||||
ItemStack poisonarrow = getArrowFromMeta("POISON_ARR");
|
||||
ShapelessRecipe poisonarrow_recipe = new ShapelessRecipe(poisonarrow);
|
||||
poisonarrow_recipe.addIngredient(Material.RAW_FISH,3);
|
||||
poisonarrow_recipe.addIngredient(Material.STICK);
|
||||
poisonarrow_recipe.addIngredient(Material.FEATHER);
|
||||
Bukkit.addRecipe(poisonarrow_recipe);
|
||||
|
||||
|
||||
ItemStack trappingarrow = getArrowFromMeta("TRAP_ARR");
|
||||
ShapelessRecipe trappingarrow_recipe = new ShapelessRecipe(trappingarrow);
|
||||
|
||||
trappingarrow_recipe.addIngredient(Material.WEB);
|
||||
trappingarrow_recipe.addIngredient(Material.STICK);
|
||||
trappingarrow_recipe.addIngredient(Material.FEATHER);
|
||||
Bukkit.addRecipe(trappingarrow_recipe);
|
||||
|
||||
|
||||
ItemStack explosionarrow = getArrowFromMeta("EXPLODE_ARR");
|
||||
ShapelessRecipe explosionarrow_recipe = new ShapelessRecipe(explosionarrow);
|
||||
explosionarrow_recipe.addIngredient(Material.SULPHUR);
|
||||
explosionarrow_recipe.addIngredient(Material.STICK);
|
||||
explosionarrow_recipe.addIngredient(Material.FEATHER);
|
||||
Bukkit.addRecipe(explosionarrow_recipe);
|
||||
}
|
||||
|
||||
public static ItemStack getArrowFromMeta(String string) {
|
||||
switch (string) {
|
||||
case "EXPLODE_ARR": {
|
||||
ItemStack explosionarrow = new ItemStack(Material.TIPPED_ARROW);
|
||||
PotionMeta pm = (PotionMeta)explosionarrow.getItemMeta();
|
||||
PotionData data = new PotionData(PotionType.INVISIBILITY);
|
||||
//pm.setBasePotionData(data);
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.INVISIBILITY,0,0),true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.GRAY+"Explodes on Contact (+40 dmg)");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName(ChatColor.GRAY+"Exploding Arrow");
|
||||
explosionarrow.setItemMeta(pm);
|
||||
return explosionarrow;
|
||||
}
|
||||
case "TRAP_ARR": {
|
||||
ItemStack trappingarrow = new ItemStack(Material.TIPPED_ARROW);
|
||||
PotionMeta pm = (PotionMeta)trappingarrow.getItemMeta();
|
||||
PotionData data = new PotionData(PotionType.WEAKNESS);
|
||||
//pm.setBasePotionData(data);
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.WEAKNESS,0,0),true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.GRAY+"Applies Stacking Slowness (0:05)");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName(ChatColor.DARK_GREEN+"Trapping Arrow");
|
||||
trappingarrow.setItemMeta(pm);
|
||||
return trappingarrow;
|
||||
}
|
||||
case "POISON_ARR": {
|
||||
ItemStack poisonarrow = new ItemStack(Material.TIPPED_ARROW);
|
||||
PotionMeta pm = (PotionMeta)poisonarrow.getItemMeta();
|
||||
PotionData data = new PotionData(PotionType.POISON);
|
||||
//pm.setBasePotionData(data);
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.POISON,0,0),true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.GRAY+"Applies Poison I (0:20)");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName(ChatColor.DARK_GREEN+"Poison-Tipped Arrow");
|
||||
poisonarrow.setItemMeta(pm);
|
||||
return poisonarrow;
|
||||
}
|
||||
case "QUADRUPLE_DAMAGE_ARR": {
|
||||
ItemStack diamondtippedarrow = new ItemStack(Material.TIPPED_ARROW);
|
||||
PotionMeta pm = (PotionMeta)diamondtippedarrow.getItemMeta();
|
||||
PotionData data = new PotionData(PotionType.SPEED);
|
||||
//pm.setBasePotionData(data);
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.SPEED,0,0),true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.GRAY+"x4 Damage");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName(ChatColor.AQUA+"Diamond-Tipped Arrow");
|
||||
diamondtippedarrow.setItemMeta(pm);
|
||||
return diamondtippedarrow;
|
||||
}
|
||||
case "DOUBLE_DAMAGE_ARR": {
|
||||
ItemStack handmadearrow = new ItemStack(Material.TIPPED_ARROW);
|
||||
PotionMeta pm = (PotionMeta)handmadearrow.getItemMeta();
|
||||
PotionData data = new PotionData(PotionType.FIRE_RESISTANCE);
|
||||
//pm.setBasePotionData(data);
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,0,0),true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.GRAY+"x2 Damage");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName(ChatColor.YELLOW+"Handmade Arrow");
|
||||
handmadearrow.setItemMeta(pm);
|
||||
return handmadearrow;
|
||||
}
|
||||
}
|
||||
return new ItemStack(Material.TIPPED_ARROW);
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,11 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.ShulkerBullet;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.TippedArrow;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.entity.EnderDragon.Phase;
|
||||
import org.bukkit.entity.Enderman;
|
||||
@ -150,6 +152,7 @@ import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
@ -331,6 +334,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
sig.plugin.TwosideKeeper.Recipes.Initialize_ArtifactHelper_Recipes();
|
||||
sig.plugin.TwosideKeeper.Recipes.Initialize_Check_Recipe();
|
||||
//sig.plugin.TwosideKeeper.Recipes.Initialize_HunterCompass_Recipe();
|
||||
sig.plugin.TwosideKeeper.Recipes.Initialize_CustomArrow_Recipes();
|
||||
|
||||
//Bukkit.createWorld(new WorldCreator("ItemCube"));
|
||||
|
||||
@ -1994,6 +1998,56 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString());
|
||||
}
|
||||
|
||||
//Check for a Hunter's Compass right-click.
|
||||
if (GenericFunctions.isHunterCompass(player.getEquipment().getItemInMainHand())) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player);
|
||||
if (pd.lastrightclick+100<=getServerTickTime()) {
|
||||
pd.lastrightclick=getServerTickTime();
|
||||
player.sendMessage("Calibrating "+player.getEquipment().getItemInMainHand().getItemMeta().getDisplayName()+ChatColor.WHITE+"...");
|
||||
String name = player.getEquipment().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (Math.random()<=0.5) {
|
||||
if (player.getEquipment().getItemInMainHand().getAmount()<=1) {
|
||||
player.getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_METAL_BREAK, 1.0f, 1.0f);
|
||||
} else {
|
||||
player.getEquipment().getItemInMainHand().setAmount(player.getEquipment().getItemInMainHand().getAmount()-1);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage("The "+name+ChatColor.WHITE+" is now...");
|
||||
}
|
||||
},15);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_METAL_BREAK, 1.0f, 1.0f);
|
||||
}
|
||||
},20);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage(ChatColor.ITALIC+" Oh my! It appears to have broke!");
|
||||
}
|
||||
},45);
|
||||
} else {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage("The "+name+ChatColor.WHITE+" is now properly calibrated!");
|
||||
}
|
||||
},15);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!");
|
||||
}
|
||||
},45);
|
||||
player.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check for a bow shift-right click.
|
||||
if (ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
|
||||
Player p = ev.getPlayer();
|
||||
@ -2994,6 +3048,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public void onInventoryOpen(InventoryOpenEvent ev) {
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
|
||||
pd.isViewingInventory=true;
|
||||
GenericFunctions.updateSetItems((Player)ev.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
@ -3089,49 +3144,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
setPlayerMaxHealth(player);
|
||||
}
|
||||
},1);
|
||||
if (GenericFunctions.isHunterCompass(player.getInventory().getItem(ev.getNewSlot()))) {
|
||||
player.sendMessage("Calibrating "+player.getInventory().getItem(ev.getNewSlot()).getItemMeta().getDisplayName()+ChatColor.WHITE+"...");
|
||||
String name = player.getInventory().getItem(ev.getNewSlot()).getItemMeta().getDisplayName();
|
||||
if (Math.random()<=0.5) {
|
||||
if (player.getInventory().getItem(ev.getNewSlot()).getAmount()<=1) {
|
||||
player.getInventory().getItem(ev.getNewSlot()).setType(Material.AIR);
|
||||
} else {
|
||||
player.getInventory().getItem(ev.getNewSlot()).setAmount(player.getInventory().getItem(ev.getNewSlot()).getAmount()-1);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage("The "+name+ChatColor.WHITE+" is now...");
|
||||
}
|
||||
},15);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_METAL_BREAK, 1.0f, 1.0f);
|
||||
}
|
||||
},20);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage(ChatColor.ITALIC+" Oh my! It appears to have broke!");
|
||||
}
|
||||
},45);
|
||||
} else {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage("The "+name+ChatColor.WHITE+" is now properly calibrated!");
|
||||
}
|
||||
},15);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!");
|
||||
}
|
||||
},45);
|
||||
player.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
@ -3249,7 +3261,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (playerHasArrowQuiver(p)) {
|
||||
boolean foundquiver=false;
|
||||
int slot=-1;
|
||||
if (p.getInventory().getItem(ev.getSlot())!=null &&
|
||||
if (ev.getSlot()>=0 && p.getInventory().getItem(ev.getSlot())!=null &&
|
||||
p.getInventory().getItem(ev.getSlot()).getType()==Material.TIPPED_ARROW &&
|
||||
p.getInventory().getItem(ev.getSlot()).getEnchantmentLevel(Enchantment.ARROW_INFINITE)==5) {
|
||||
//This is an arrow quiver.
|
||||
@ -3282,7 +3294,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (playerHasArrowQuiver(p)) {
|
||||
boolean foundquiver=false;
|
||||
int slot=-1;
|
||||
if (p.getInventory().getItem(ev.getSlot())!=null &&
|
||||
if (ev.getSlot()>=0 && p.getInventory().getItem(ev.getSlot())!=null &&
|
||||
p.getInventory().getItem(ev.getSlot()).getType()==Material.TIPPED_ARROW &&
|
||||
p.getInventory().getItem(ev.getSlot()).getEnchantmentLevel(Enchantment.ARROW_INFINITE)==5) {
|
||||
//This is an arrow quiver.
|
||||
@ -3309,7 +3321,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
pd = (PlayerStructure) playerdata.get(ev.getWhoClicked().getUniqueId());
|
||||
final InventoryClickEvent store = ev;
|
||||
if (pd.isViewingItemCube &&
|
||||
(ev.getInventory().getType()!=InventoryType.WORKBENCH ||
|
||||
((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
|
||||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.getInventory().getTitle().contains("Item Cube #")) {
|
||||
log("Item Cube window identified.",5);
|
||||
final int id=Integer.parseInt(ev.getInventory().getTitle().split("#")[1]);
|
||||
@ -3382,7 +3394,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}*/
|
||||
}
|
||||
|
||||
if ((ev.getInventory().getType()!=InventoryType.WORKBENCH ||
|
||||
if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
|
||||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.getCurrentItem()!=null) {
|
||||
if (ev.getCurrentItem().hasItemMeta() && (ev.getCurrentItem().getType()!=Material.AIR)) {
|
||||
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
||||
@ -3426,7 +3438,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}}}}
|
||||
|
||||
//WARNING! This only happens for ITEM CUBES! Do not add other items in here!
|
||||
if ((ev.getInventory().getType()!=InventoryType.WORKBENCH ||
|
||||
if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
|
||||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.isLeftClick() && ev.getCurrentItem()!=null && ev.getCursor()!=null) {
|
||||
if (ev.getCurrentItem().hasItemMeta() && (ev.getCursor().getType()!=Material.AIR)) {
|
||||
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
||||
@ -3563,7 +3575,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
//RIGHT CLICK STUFF DOWN HERE.
|
||||
log("Inventory click.",5);
|
||||
//WARNING! This only happens for ITEM CUBES! Do not add other items in here!
|
||||
if ((ev.getInventory().getType()!=InventoryType.WORKBENCH ||
|
||||
if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
|
||||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.isRightClick() && ev.getCurrentItem()!=null && ev.getCurrentItem().getAmount()==1) {
|
||||
log("Clicked Item: "+ev.getCurrentItem().toString(),5);
|
||||
if (ev.getCurrentItem().hasItemMeta()) {
|
||||
@ -3827,7 +3839,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
|
||||
int poisonlv = 0;
|
||||
/*
|
||||
if (l.hasPotionEffect(PotionEffectType.POISON)) {
|
||||
if ((l instanceof Player)) {
|
||||
for (int j=0;j<l.getActivePotionEffects().size();j++) {
|
||||
if (Iterables.get(l.getActivePotionEffects(), j).getType().equals(PotionEffectType.POISON)) {
|
||||
poisonlv = Iterables.get(l.getActivePotionEffects(), j).getAmplifier()+1;
|
||||
@ -3835,8 +3849,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
if (poisonlv>0 && ev.getCause()!=DamageCause.POISON) {
|
||||
ev.setDamage(ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
|
||||
log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,5);
|
||||
if (ev.getDamage()>=CUSTOM_DAMAGE_IDENTIFIER) {
|
||||
ev.setDamage(DamageModifier.BASE,CUSTOM_DAMAGE_IDENTIFIER-ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
|
||||
} else {
|
||||
ev.setDamage(DamageModifier.BASE,ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
|
||||
}
|
||||
log("New damage set to "+ev.getFinalDamage()+" from Poison "+poisonlv,5);
|
||||
}
|
||||
} else {
|
||||
poisonlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.POISON, l);
|
||||
l.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,GenericFunctions.getPotionEffectDuration(PotionEffectType.POISON, l),poisonlv));
|
||||
l.removePotionEffect(PotionEffectType.POISON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3850,11 +3873,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
if (poisonlv>0) {
|
||||
ev.setDamage(ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
|
||||
log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,5);
|
||||
}
|
||||
if (ev.getDamage()>=CUSTOM_DAMAGE_IDENTIFIER) {
|
||||
ev.setDamage(DamageModifier.BASE,CUSTOM_DAMAGE_IDENTIFIER - ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
|
||||
} else {
|
||||
ev.setDamage(DamageModifier.BASE,ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
|
||||
}
|
||||
log("New damage set to "+ev.getFinalDamage()+" from Poison "+poisonlv,2);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (e instanceof Player) {
|
||||
@ -4253,7 +4280,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
log("New Damage: "+ev.getFinalDamage(),4);
|
||||
log("New Damage: "+ev.getFinalDamage(),3);
|
||||
} else {
|
||||
double dmg = 0.0;
|
||||
boolean hitallowed=true;
|
||||
@ -4305,7 +4332,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
dmg = NewCombat.applyDamage((LivingEntity)ev.getEntity(), ev.getDamager());
|
||||
if (!(ev.getEntity() instanceof Monster) || !(ev.getDamager() instanceof Monster)) {
|
||||
log(GenericFunctions.GetEntityDisplayName(ev.getDamager())+ChatColor.GRAY+"->"+
|
||||
GenericFunctions.GetEntityDisplayName(ev.getEntity())+ChatColor.GRAY+": Damage dealt was "+dmg,4);
|
||||
GenericFunctions.GetEntityDisplayName(ev.getEntity())+ChatColor.GRAY+": Damage dealt was "+dmg,3);
|
||||
}
|
||||
}
|
||||
if (ev.getCause()==DamageCause.THORNS) {
|
||||
@ -4327,8 +4354,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
if (ev.getEntity() instanceof Player) {
|
||||
if (!GenericFunctions.AttemptRevive((Player)ev.getEntity(), dmg)) {
|
||||
if (dmg < 1) {
|
||||
ev.setDamage(DamageModifier.BASE,dmg);
|
||||
ev.setDamage(dmg);
|
||||
} else {
|
||||
ev.setDamage(1d);
|
||||
((Player)ev.getEntity()).setHealth(Math.max(((Player)ev.getEntity()).getHealth() - (dmg - 1d), 0.5));
|
||||
}
|
||||
} else {
|
||||
ev.setCancelled(true);
|
||||
}
|
||||
@ -4993,11 +5025,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void onArrowPickup(PlayerPickupArrowEvent ev) {
|
||||
if (ev.getArrow() instanceof TippedArrow) {
|
||||
TippedArrow a = (TippedArrow)ev.getArrow();
|
||||
ItemStack item = ev.getItem().getItemStack();
|
||||
if (a.hasMetadata("EXPLODE_ARR")) {item=Recipes.getArrowFromMeta("EXPLODE_ARR");}
|
||||
if (a.hasMetadata("TRAP_ARR")) {item=Recipes.getArrowFromMeta("TRAP_ARR");}
|
||||
if (a.hasMetadata("POISON_ARR")) {item=Recipes.getArrowFromMeta("POISON_ARR");}
|
||||
if (a.hasMetadata("QUADRUPLE_DAMAGE_ARR")) {item=Recipes.getArrowFromMeta("QUADRUPLE_DAMAGE_ARR");}
|
||||
if (a.hasMetadata("DOUBLE_DAMAGE_ARR")) {item=Recipes.getArrowFromMeta("DOUBLE_DAMAGE_ARR");}
|
||||
ev.getItem().remove();
|
||||
ev.setCancelled(true);
|
||||
ev.getPlayer().getInventory().addItem(item);
|
||||
//ev.getItem().setItemStack(item);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void onItemPickup(PlayerPickupItemEvent ev) {
|
||||
//Arrow quiver code goes here.
|
||||
log("Pickup Metadata: "+ev.getItem().getItemStack().getItemMeta().toString(),5);
|
||||
Player p = ev.getPlayer();
|
||||
GenericFunctions.updateSetItems(p);
|
||||
if (ev.getItem().getItemStack().getType()==Material.ARROW &&
|
||||
playerHasArrowQuiver(p)) {
|
||||
int arrowquiver_slot = playerGetArrowQuiver(p);
|
||||
@ -5126,8 +5176,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
newstruct.SetTarget(p);
|
||||
monsterdata.put(checkent.getUniqueId(), newstruct);
|
||||
Monster m = (Monster)checkent;
|
||||
if (!m.hasPotionEffect(PotionEffectType.GLOWING)) {
|
||||
m.setTarget(p);
|
||||
}
|
||||
}
|
||||
log("Setup new target: "+p.getName(),5);
|
||||
}
|
||||
if (GenericFunctions.isRanger(p)) {
|
||||
@ -5144,6 +5196,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
pd.lastarrowpower=arr.getVelocity().lengthSquared();
|
||||
pd.lastarrowwasinrangermode=(GenericFunctions.isRanger(p)&&GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE);
|
||||
log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5);
|
||||
|
||||
if (arr.getType()==EntityType.TIPPED_ARROW) {
|
||||
//This might be special. Let's get the potion meta.
|
||||
TippedArrow ta = (TippedArrow)arr;
|
||||
List<PotionEffect> eff = ta.getCustomEffects();
|
||||
//This is custom! Let's see what it is.
|
||||
for (int i=0;i<eff.size();i++) {
|
||||
PotionEffect pe = eff.get(i);
|
||||
if (pe.getDuration()==0) {
|
||||
log("This is special!",5);
|
||||
if (pe.getType().equals(PotionEffectType.FIRE_RESISTANCE)) {
|
||||
arr.setMetadata("DOUBLE_DAMAGE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
|
||||
} else
|
||||
if (pe.getType().equals(PotionEffectType.SPEED)) {
|
||||
arr.setMetadata("QUADRUPLE_DAMAGE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
|
||||
} else
|
||||
if (pe.getType().equals(PotionEffectType.POISON)) {
|
||||
arr.setMetadata("POISON_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
|
||||
} else
|
||||
if (pe.getType().equals(PotionEffectType.WEAKNESS)) {
|
||||
arr.setMetadata("TRAP_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
|
||||
} else
|
||||
if (pe.getType().equals(PotionEffectType.INVISIBILITY)) {
|
||||
arr.setMetadata("EXPLODE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5167,7 +5247,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
(ev.getProjectile().getType()==EntityType.ARROW ||
|
||||
ev.getProjectile().getType()==EntityType.TIPPED_ARROW)) {
|
||||
//Now we know this is a player who shot a regular old arrow.
|
||||
|
||||
final Player p = (Player)ev.getEntity();
|
||||
//We need to give one back to them.
|
||||
if (ev.getProjectile().getType()==EntityType.ARROW) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user