->Plugin update messages no longer appear twice in special

circumstances.
->You no longer auto-pickup shields if you are in Striker mode.
->You can no longer accidently drop a sword while sneaking, even if you
are wearing a shield.
->Fix a bug where Line Drive's cast direction could be modified
mid-cast.
->Fix a bug where a mob would get hurt multiple times from one Line
Drive cast.
->Normal Loot from monsters will drop regardless if a player has killed
them or not.
->Bow artifacts now apply experience after launching the arrow instead
of when the arrow hits an enemy. If an arrow lands its mark, you will
gain extra experience for the next arrow fired. Headshots will give even
more bonus experience for the artifact bow.
->Fix Drops and experience drops when the player kills mobs indirectly.
->Vanilla Minecraft drops from mobs will now appear properly even when
players do not directly kill the monster.
->Mending for Harvesting tools has a slightly less likely chance to fall
off than on weapons and armor.
->Lowered 'Auto Repair' base values to be a little less ridiculous.
Artifacts with Auto Repair will not repair as quickly while underground
(no sunlight).
This commit is contained in:
sigonasr2 2016-07-15 01:31:13 -05:00
parent 97f5183596
commit cc52679a55
7 changed files with 210 additions and 83 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.5.3 version: 3.5.4
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

View File

@ -64,7 +64,7 @@ public enum ArtifactAbility {
new double[]{1.0,0.90,0.85,0.8,0.75,0.7,0.6,0.55,0.5,0.45},100,1,UpgradePath.ARMOR), new double[]{1.0,0.90,0.85,0.8,0.75,0.7,0.6,0.55,0.5,0.45},100,1,UpgradePath.ARMOR),
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5}, STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5},
new double[]{4.0,3.85,3.70,3.55,3.40,3.25,3.10,2.95,2.80,2.65},100,1,UpgradePath.ARMOR), new double[]{4.0,3.85,3.70,3.55,3.40,3.25,3.10,2.95,2.80,2.65},100,1,UpgradePath.ARMOR),
SHADOWWALKER("Shadow Walker",ChatColor.GRAY+"Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5}, SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{1.5,1.4,1.3,1.2,1.1,1.0,0.9,0.8,0.7,0.55},100,10,UpgradePath.ARMOR), new double[]{1.5,1.4,1.3,1.2,1.1,1.0,0.9,0.8,0.7,0.55},100,10,UpgradePath.ARMOR),
/*SURVIVOR("Survivor",ChatColor.GRAY+"[Unimplemented] Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and restoring your health.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0}, /*SURVIVOR("Survivor",ChatColor.GRAY+"[Unimplemented] Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and restoring your health.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ARMOR),*/ new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ARMOR),*/
@ -107,9 +107,9 @@ public enum ArtifactAbility {
new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375},100,10,UpgradePath.SCYTHE), new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375},100,10,UpgradePath.SCYTHE),
//General abilities //General abilities
AUTOREPAIR("Auto Repair","1% chance to repair [VAL] durability to the artifact item every second.\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work.",new double[]{15,16,17,18,19,20,21,22,23,24}, AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{6,7,8,9,10,11,12,13,14,15},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL),
GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Greed per level up.",new double[]{50,50,50,50,50,50,50,50,50,50}, GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Greed per level up.",new double[]{50,55,60,65,70,75,80,85,90,95},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10,UpgradePath.ALL), new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10,UpgradePath.ALL),
/*GROWTH("Growth",ChatColor.GRAY+"[Unimplemented] Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100}, /*GROWTH("Growth",ChatColor.GRAY+"[Unimplemented] Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),*/ new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),*/

View File

@ -18,6 +18,9 @@ import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -32,6 +35,7 @@ import com.google.common.collect.Iterables;
import sig.plugin.TwosideKeeper.Artifact; import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.AwakenedArtifact; import sig.plugin.TwosideKeeper.AwakenedArtifact;
import sig.plugin.TwosideKeeper.MonsterController; import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.MonsterStructure;
import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
@ -2036,7 +2040,7 @@ public class GenericFunctions {
item.getType()!=Material.AIR) { item.getType()!=Material.AIR) {
int mendinglv = item.getEnchantmentLevel(Enchantment.MENDING); int mendinglv = item.getEnchantmentLevel(Enchantment.MENDING);
int infinitylv = item.getEnchantmentLevel(Enchantment.ARROW_INFINITE); int infinitylv = item.getEnchantmentLevel(Enchantment.ARROW_INFINITE);
if (mendinglv>0 && Math.random()<=0.00048828125) { if (mendinglv>0 && Math.random()<=0.00048828125*(isHarvestingTool(item)?0.75:1d)) {
mendinglv--; mendinglv--;
if (mendinglv>0) { if (mendinglv>0) {
item.addUnsafeEnchantment(Enchantment.MENDING, mendinglv); item.addUnsafeEnchantment(Enchantment.MENDING, mendinglv);
@ -2045,7 +2049,7 @@ public class GenericFunctions {
} }
p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Mending"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item))); p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Mending"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
} }
if (infinitylv>0 && Math.random()<=0.00048828125) { if (infinitylv>0 && Math.random()<=0.00048828125*(isHarvestingTool(item)?0.75:1d)) {
infinitylv--; infinitylv--;
if (infinitylv>0) { if (infinitylv>0) {
item.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, infinitylv); item.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, infinitylv);
@ -2064,12 +2068,12 @@ public class GenericFunctions {
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) &&
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
dodgechance+=0.01*p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK); dodgechance+=0.01*p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK);
} }
} }
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK); dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK);
} }
@ -2089,6 +2093,10 @@ public class GenericFunctions {
if (Math.random() <= repairamt%1) { if (Math.random() <= repairamt%1) {
repairamt++; repairamt++;
} }
if (p.getLocation().getY()>=0 && p.getLocation().getBlock().getLightFromSky()==0) {
repairamt/=2.0d;
//TwosideKeeper.log("In Darkness.",2);
}
double chance = 1; double chance = 1;
if (Math.random()<=chance/100d) { if (Math.random()<=chance/100d) {
if (p.getInventory().getItem(i).getDurability()-repairamt<0) { if (p.getInventory().getItem(i).getDurability()-repairamt<0) {
@ -2110,6 +2118,10 @@ public class GenericFunctions {
if (Math.random() <= repairamt%1) { if (Math.random() <= repairamt%1) {
repairamt++; repairamt++;
} }
if (p.getLocation().getY()>=0 && p.getLocation().getBlock().getLightFromSky()==0) {
repairamt/=2.0d;
//TwosideKeeper.log("In Darkness.",2);
}
double chance = 1; double chance = 1;
if (Math.random()<=chance/100d) { if (Math.random()<=chance/100d) {
if (equip.getDurability()-repairamt<0) { if (equip.getDurability()-repairamt<0) {
@ -2139,40 +2151,24 @@ public class GenericFunctions {
if ((target instanceof Monster) && damager!=null) { if ((target instanceof Monster) && damager!=null) {
Monster m = (Monster)target; Monster m = (Monster)target;
m.setTarget(damager); m.setTarget(damager);
if (TwosideKeeper.monsterdata.containsKey(m.getUniqueId())) {
MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId());
ms.SetTarget(damager);
} else {
TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(damager));
}
} }
if (target.getHealth()>finaldmg) { if (target.getHealth()>finaldmg) {
TwosideKeeper.log("NOT FULL HEALTH", 5);
target.setHealth(target.getHealth()-finaldmg); target.setHealth(target.getHealth()-finaldmg);
if (damager!=null) {
target.damage(0.01); target.damage(0.01);
if (target instanceof Monster) { target.setNoDamageTicks(20);
Monster m = (Monster)target;
m.setTarget(damager);
}
} else { } else {
target.damage(0.01,damager); //Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,target,DamageCause.ENTITY_ATTACK,finaldmg));
} //target.setHealth(0);
} else { target.setHealth(0.1);
if (target instanceof Monster) { target.damage(9999999);
Monster m = (Monster)target; target.setNoDamageTicks(20);
m.setTarget(damager);
}
target.setHealth(0.0001);
target.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
if (damager!=null) {
target.damage(0.1);
if (target instanceof Monster) {
Monster m = (Monster)target;
m.setTarget(damager);
}
if (!(target instanceof Player)) {
target.setHealth(0.0);
}
} else {
target.damage(0.1,damager);
if (!(target instanceof Player)) {
target.setHealth(0.0);
}
}
} }
} }
} }

View File

@ -0,0 +1,26 @@
package sig.plugin.TwosideKeeper;
import org.bukkit.entity.LivingEntity;
public class MonsterStructure {
public LivingEntity target;
public MonsterStructure() {
target=null;
}
public MonsterStructure(LivingEntity target) {
this.target=target;
}
public LivingEntity GetTarget() {
if (this.target!=null &&
!this.target.isDead()) {
return this.target;
} else {
return null;
}
}
public void SetTarget(LivingEntity target) {
this.target=target;
}
}

View File

@ -60,6 +60,7 @@ public class PlayerStructure {
public long last_strikerspell=TwosideKeeper.getServerTickTime(); public long last_strikerspell=TwosideKeeper.getServerTickTime();
public boolean highwinder=false; public boolean highwinder=false;
public double highwinderdmg=0.0; public double highwinderdmg=0.0;
public int nextarrowxp = 0; //How much bonus XP to give to an Artifact Bow.
public double prev_weapondmg=0.0; public double prev_weapondmg=0.0;
public double prev_buffdmg=0.0; public double prev_buffdmg=0.0;
@ -98,6 +99,7 @@ public class PlayerStructure {
this.last_swordhit=TwosideKeeper.getServerTickTime(); this.last_swordhit=TwosideKeeper.getServerTickTime();
this.highwinder=false; this.highwinder=false;
this.highwinderdmg=0.0; this.highwinderdmg=0.0;
this.nextarrowxp=0;
this.last_strikerspell=TwosideKeeper.getServerTickTime(); this.last_strikerspell=TwosideKeeper.getServerTickTime();
//Set defaults first, in case this is a new user. //Set defaults first, in case this is a new user.
loadConfig(); loadConfig();

View File

@ -10,6 +10,7 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
@ -216,6 +217,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static ServerType SERVER_TYPE=ServerType.TEST; //The type of server this is running on. public static ServerType SERVER_TYPE=ServerType.TEST; //The type of server this is running on.
public static File filesave; public static File filesave;
public static HashMap playerdata; public static HashMap playerdata;
public static HashMap monsterdata;
public static SpleefManager TwosideSpleefGames; public static SpleefManager TwosideSpleefGames;
public static WorldShopManager TwosideShops; public static WorldShopManager TwosideShops;
public static MysteriousEssenceLogger EssenceLogger; //The logger for Essences. public static MysteriousEssenceLogger EssenceLogger; //The logger for Essences.
@ -321,8 +323,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideShops = new WorldShopManager(); TwosideShops = new WorldShopManager();
//Initialize Player Data structure. //Initialize Player Data structure.
playerdata = new HashMap(); playerdata = new HashMap<UUID,PlayerStructure>();
banksessions = new HashMap(); banksessions = new HashMap();
monsterdata = new HashMap<UUID,MonsterStructure>();
//tpstracker = new Lag(); //tpstracker = new Lag();
@ -332,7 +335,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//playerdata.add(new PlayerStructure((Player)Bukkit.getOnlinePlayers().toArray()[i],getServerTickTime())); //playerdata.add(new PlayerStructure((Player)Bukkit.getOnlinePlayers().toArray()[i],getServerTickTime()));
} }
Player p; Player p;
//Announce the server has restarted soon after. //Announce the server has restarted soon after.
if (SERVER_TYPE!=ServerType.QUIET) { if (SERVER_TYPE!=ServerType.QUIET) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@ -390,8 +392,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (SERVER_TYPE==ServerType.MAIN) { //Only perform this on the official servers. Test servers do not require constant updating. if (SERVER_TYPE==ServerType.MAIN) { //Only perform this on the official servers. Test servers do not require constant updating.
//Every 5 minutes, check for a plugin update. //Every 5 minutes, check for a plugin update.
if (!restarting_server) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, pluginupdater, 20*300, 20*300); Bukkit.getScheduler().scheduleSyncRepeatingTask(this, pluginupdater, 20*300, 20*300);
} }
}
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
public void run(){ public void run(){
@ -599,12 +603,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}*/ }*/
for (int i3=0;i3<p.getEquipment().getArmorContents().length;i3++) { for (int i3=0;i3<p.getEquipment().getArmorContents().length;i3++) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i3]) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i3]) &&
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { 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,2));
} }
} }
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { 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,2));
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2); //log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
} }
@ -1751,6 +1755,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//This has stacks, burst! //This has stacks, burst!
bursted=true; bursted=true;
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240); aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240);
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240);
pd.last_deathmark = getServerTickTime(); pd.last_deathmark = getServerTickTime();
int stackamt = GenericFunctions.GetDeathMarkAmt(m); int stackamt = GenericFunctions.GetDeathMarkAmt(m);
GenericFunctions.DealDamageToMob(stackamt*dmg, m, player, true); GenericFunctions.DealDamageToMob(stackamt*dmg, m, player, true);
@ -2513,23 +2518,37 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
if (ev.getPlayer().isOnGround() && if (ev.getPlayer().isOnGround() &&
pd.last_strikerspell+160<getServerTickTime()) { pd.last_strikerspell+160<getServerTickTime()) {
if (pd.target!=null &&
!pd.target.isDead()) {
pd.target.setNoDamageTicks(0);
}
ev.getItemDrop().setPickupDelay(0); ev.getItemDrop().setPickupDelay(0);
final Vector facing = ev.getPlayer().getLocation().getDirection().setY(0); final Vector facing = ev.getPlayer().getLocation().getDirection().setY(0);
ev.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW,15,20)); ev.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW,15,20));
aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160); aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160);
aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160);
pd.last_strikerspell=getServerTickTime(); pd.last_strikerspell=getServerTickTime();
ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 1.0f); ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
aPlugin.API.damageItem(ev.getPlayer(), ev.getItemDrop().getItemStack(), ev.getItemDrop().getItemStack().getType().getMaxDurability()/20);
final PlayerDropItemEvent ev1 = ev; final PlayerDropItemEvent ev1 = ev;
final Player p1 = ev1.getPlayer();
int mult=2;
final double xspd=ev1.getPlayer().getLocation().getDirection().getX()*mult;
final double yspd=0;
final double zspd=ev1.getPlayer().getLocation().getDirection().getZ()*mult;
final double xpos=ev1.getPlayer().getLocation().getX();
final double ypos=ev1.getPlayer().getLocation().getY();
final double zpos=ev1.getPlayer().getLocation().getZ();
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() { public void run() {
ev1.getPlayer().setVelocity(facing.multiply(8)); ev1.getPlayer().setVelocity(facing.multiply(8));
ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f); ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f);
final Player p1 = ev1.getPlayer();
AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(ev1.getPlayer().getLocation(), EntityType.AREA_EFFECT_CLOUD); AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(ev1.getPlayer().getLocation(), EntityType.AREA_EFFECT_CLOUD);
lp.setColor(Color.OLIVE); lp.setColor(Color.OLIVE);
DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.00");
lp.setCustomName("LD "+df.format(CalculateWeaponDamage(ev1.getPlayer(),null)*10)+" "+ev1.getPlayer().getName()); lp.setCustomName("LD "+df.format(CalculateWeaponDamage(ev1.getPlayer(),null)*7)+" "+ev1.getPlayer().getName());
lp.setRadius(2f); lp.setRadius(2f);
lp.setDuration(1); lp.setDuration(1);
lp.setReapplicationDelay(5); lp.setReapplicationDelay(5);
@ -2537,13 +2556,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
lp.setParticle(Particle.FLAME); lp.setParticle(Particle.FLAME);
ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f); ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f);
int mult=2;
double xspd=ev1.getPlayer().getLocation().getDirection().getX()*mult;
double yspd=0;
double zspd=ev1.getPlayer().getLocation().getDirection().getZ()*mult;
double xpos=ev1.getPlayer().getLocation().getX();
double ypos=ev1.getPlayer().getLocation().getY();
double zpos=ev1.getPlayer().getLocation().getZ();
int range=8; int range=8;
final String customname = lp.getCustomName(); final String customname = lp.getCustomName();
for (int i=0;i<range;i++) { for (int i=0;i<range;i++) {
@ -2557,7 +2569,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE)); lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE));
lp.setRadius(2f); lp.setRadius(2f);
lp.setDuration(1); lp.setDuration(1);
lp.setReapplicationDelay(1); lp.setReapplicationDelay(5);
lp.setParticle(Particle.FLAME); lp.setParticle(Particle.FLAME);
p1.playSound(lp.getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.3f); p1.playSound(lp.getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.3f);
} }
@ -3612,6 +3624,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
mm.setTarget(p); mm.setTarget(p);
if (monsterdata.containsKey(mm.getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get(mm.getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put(mm.getUniqueId(),new MonsterStructure(p));
}
} }
double rawdmg = ev.getDamage()*dmgmult*ENEMY_DMG_MULT; double rawdmg = ev.getDamage()*dmgmult*ENEMY_DMG_MULT;
@ -3682,7 +3700,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.getHealth()==p.getMaxHealth() && p.getHealth()==p.getMaxHealth() &&
m.getHealth()==m.getMaxHealth()) { m.getHealth()==m.getMaxHealth()) {
//Deal triple damage. //Deal triple damage.
log("Triple damage!",2); log("Triple damage!",5);
ev.setDamage(ev.getDamage()*3); ev.setDamage(ev.getDamage()*3);
} }
@ -3702,6 +3720,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (m instanceof Monster) { if (m instanceof Monster) {
Monster mon = (Monster)m; Monster mon = (Monster)m;
mon.setTarget(p); mon.setTarget(p);
if (monsterdata.containsKey(mon.getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get(mon.getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put(mon.getUniqueId(),new MonsterStructure(p));
}
} }
} }
} }
@ -3722,6 +3746,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (Iterables.get(nearby, i) instanceof Monster) { if (Iterables.get(nearby, i) instanceof Monster) {
Monster mm = (Monster)(Iterables.get(nearby, i)); Monster mm = (Monster)(Iterables.get(nearby, i));
mm.setTarget(p); mm.setTarget(p);
if (monsterdata.containsKey(mm.getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get(mm.getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put(mm.getUniqueId(),new MonsterStructure(p));
}
} }
} }
} }
@ -3730,6 +3760,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,100,0)); m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,100,0));
} }
((Monster)m).setTarget(p); ((Monster)m).setTarget(p);
if (monsterdata.containsKey(((Monster)m).getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get(((Monster)m).getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put(((Monster)m).getUniqueId(),new MonsterStructure(p));
}
} }
} }
@ -3757,6 +3793,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ent instanceof Monster) { if (ent instanceof Monster) {
if (!ent.hasPotionEffect(PotionEffectType.GLOWING)) { if (!ent.hasPotionEffect(PotionEffectType.GLOWING)) {
((Monster)ent).setTarget(p); ((Monster)ent).setTarget(p);
if (monsterdata.containsKey(((Monster)ent).getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get(((Monster)ent).getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put(((Monster)ent).getUniqueId(),new MonsterStructure(p));
}
} }
if (applyDeathmark) { if (applyDeathmark) {
hitlist.add(ent); hitlist.add(ent);
@ -3820,6 +3862,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.playSound(p.getLocation(), Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f);
p.playEffect(p.getLocation(), Effect.LARGE_SMOKE, 0); p.playEffect(p.getLocation(), Effect.LARGE_SMOKE, 0);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
pd.last_shovelspell=getServerTickTime()+100; pd.last_shovelspell=getServerTickTime()+100;
} }
} }
@ -3836,7 +3879,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
//ev.setCancelled(true); //ev.setCancelled(true);
GenericFunctions.DealDamageToMob(0, m, p, false);
m.setNoDamageTicks(20); m.setNoDamageTicks(20);
//Make this monster the player's new target. //Make this monster the player's new target.
@ -3876,6 +3918,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
mm.setTarget(p); mm.setTarget(p);
if (monsterdata.containsKey((mm).getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get((mm).getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put((mm).getUniqueId(),new MonsterStructure(p));
}
} }
log("Original damage: "+ev.getDamage(),5); log("Original damage: "+ev.getDamage(),5);
@ -3924,6 +3972,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
LivingEntity m = (LivingEntity)ev.getEntity(); LivingEntity m = (LivingEntity)ev.getEntity();
if (m instanceof Monster) { if (m instanceof Monster) {
((Monster)m).setTarget(p); ((Monster)m).setTarget(p);
if (monsterdata.containsKey(((Monster)m).getUniqueId())) {
MonsterStructure ms = (MonsterStructure)monsterdata.get(((Monster)m).getUniqueId());
ms.SetTarget(p);
} else {
monsterdata.put(((Monster)m).getUniqueId(),new MonsterStructure(p));
}
} }
//Headshot detection. //Headshot detection.
@ -3987,7 +4041,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) && if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) { GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
log("EXP ratio is "+ratio,5); log("EXP ratio is "+ratio,5);
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)(ratio*20)+5, p); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
pd.nextarrowxp=(int)(ratio*20)+5+(headshot?10:0);
} }
//Artifact armor will receive a tiny bit of EXP. //Artifact armor will receive a tiny bit of EXP.
@ -4019,6 +4074,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
public void monsterDeathEvent(final EntityDeathEvent ev) { public void monsterDeathEvent(final EntityDeathEvent ev) {
log("Has died.",5);
if (ev.getEntity() instanceof Bat) { if (ev.getEntity() instanceof Bat) {
//Drop an essence. //Drop an essence.
if (Math.random()<=0.3) { if (Math.random()<=0.3) {
@ -4029,21 +4085,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (ev.getEntity() instanceof Monster) { if (ev.getEntity() instanceof Monster) {
List<ItemStack> droplist = ev.getDrops(); List<ItemStack> droplist = ev.getDrops();
log("Drop list contains "+droplist.size()+" elements.",2);
log(" Drops ["+droplist.size()+"]: "+droplist.toString(),3);
Monster m = (Monster)ev.getEntity(); Monster m = (Monster)ev.getEntity();
double dropmult = 0.0d; double dropmult = 0.0d;
boolean isBoss=false; boolean isBoss=false;
boolean killedByPlayer = false; boolean killedByPlayer = false;
final Location deathloc = m.getLocation(); final Location deathloc = m.getLocation();
MonsterStructure ms = null;
if (m.getTarget()!=null && (m.getTarget() instanceof Player)) { if (monsterdata.containsKey(m.getUniqueId())) {
log("Killed by a player.",5);
killedByPlayer = true; killedByPlayer = true;
ms = (MonsterStructure)monsterdata.get(m.getUniqueId());
} }
if (m.getTarget() instanceof Player) { if (ms!=null && (ms.GetTarget() instanceof Player)) {
Player p = (Player)m.getTarget(); Player p = (Player)ms.GetTarget();
if (p!=null && p.isOnline()) {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
dropmult+=pd.partybonus*0.33; //Party bonus increases drop rate by 33% per party member. dropmult+=pd.partybonus*0.33; //Party bonus increases drop rate by 33% per party member.
ItemStack item = p.getEquipment().getItemInMainHand(); ItemStack item = p.getEquipment().getItemInMainHand();
@ -4061,6 +4118,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
dropmult+=ArtifactAbility.calculateValue(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()))/100d; dropmult+=ArtifactAbility.calculateValue(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()))/100d;
} }
} else {
killedByPlayer=false;
}
} }
@ -4087,7 +4147,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Get the player that killed the monster. //Get the player that killed the monster.
int luckmult = 0; int luckmult = 0;
int unluckmult = 0; int unluckmult = 0;
Player p = (Player)m.getTarget(); ms = (MonsterStructure)monsterdata.get(m.getUniqueId());
Player p = (Player)ms.GetTarget();
if (p.hasPotionEffect(PotionEffectType.LUCK) || if (p.hasPotionEffect(PotionEffectType.LUCK) ||
p.hasPotionEffect(PotionEffectType.UNLUCK)) { p.hasPotionEffect(PotionEffectType.UNLUCK)) {
for (int i=0;i<p.getActivePotionEffects().size();i++) { for (int i=0;i<p.getActivePotionEffects().size();i++) {
@ -4106,6 +4167,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Modified luck rate is now "+dropmult,3); log("Modified luck rate is now "+dropmult,3);
} }
List<ItemStack> originaldroplist = new ArrayList<ItemStack>();
for (int i=0;i<droplist.size();i++) {
originaldroplist.add(droplist.get(i));
droplist.remove(i);
i--;
}
droplist.addAll(MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).RandomizeDrops(dropmult, isBoss)); droplist.addAll(MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).RandomizeDrops(dropmult, isBoss));
final List<ItemStack> drop = new ArrayList<ItemStack>(); final List<ItemStack> drop = new ArrayList<ItemStack>();
drop.addAll(droplist); drop.addAll(droplist);
@ -4115,9 +4182,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Determine EXP amount and explosion type. //Determine EXP amount and explosion type.
switch (MonsterController.getMonsterDifficulty(m)) { switch (MonsterController.getMonsterDifficulty(m)) {
case NORMAL:
droplist.addAll(originaldroplist);
break;
case DANGEROUS: case DANGEROUS:
totalexp=ev.getDroppedExp()*4; totalexp=ev.getDroppedExp()*4;
ev.setDroppedExp((int)(totalexp*0.75)); ev.setDroppedExp((int)(totalexp*0.75));
droplist.addAll(originaldroplist);
break; break;
case DEADLY: case DEADLY:
m.getWorld().playSound(m.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1.0f, 1.0f); m.getWorld().playSound(m.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1.0f, 1.0f);
@ -4126,6 +4197,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
final Monster mer = m; final Monster mer = m;
final int expdrop = totalexp; final int expdrop = totalexp;
droplist.clear(); //Clear the drop list. We are going to delay the drops. droplist.clear(); //Clear the drop list. We are going to delay the drops.
droplist.addAll(originaldroplist);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() { public void run() {
if (mer.getLocation().getBlockY()<48) { if (mer.getLocation().getBlockY()<48) {
@ -4152,6 +4224,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
final Monster mer1 = m; final Monster mer1 = m;
final int expdrop1 = totalexp; final int expdrop1 = totalexp;
droplist.clear(); //Clear the drop list. We are going to delay the drops. droplist.clear(); //Clear the drop list. We are going to delay the drops.
droplist.addAll(originaldroplist);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() { public void run() {
if (mer1.getLocation().getBlockY()<48) { if (mer1.getLocation().getBlockY()<48) {
@ -4172,7 +4245,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
,50); ,50);
break; break;
} }
log("Drop list contains "+(droplist.size()+originaldroplist.size())+" elements.",5);
log(" Drops ["+(drop.size()+originaldroplist.size())+"]: "+originaldroplist.toString()+","+drop.toString(),3);
}
if (monsterdata.containsKey(m.getUniqueId())) {
monsterdata.remove(m.getUniqueId());
} }
} }
} }
@ -4269,14 +4347,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
List<LivingEntity> affected = ev.getAffectedEntities(); List<LivingEntity> affected = ev.getAffectedEntities();
for (int i=0;i<affected.size();i++) { for (int i=0;i<affected.size();i++) {
if (affected.get(i) instanceof Monster) { if (affected.get(i) instanceof Monster) {
if (ev.getEntity().getCustomName()!=null) { if (ev.getEntity().getCustomName()!=null && ((Monster)affected.get(i)).getNoDamageTicks()==0) {
log("Custom name is "+ev.getEntity().getCustomName(),2); log("Custom name is "+ev.getEntity().getCustomName(),5);
if (ev.getEntity().getCustomName().contains("EW ")) { if (ev.getEntity().getCustomName().contains("EW ")) {
double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]); double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]);
GenericFunctions.DealDamageToMob(dmgdealt, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), false); GenericFunctions.DealDamageToMob(dmgdealt, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), false);
} else } else
if (ev.getEntity().getCustomName().contains("LD ")) { if (ev.getEntity().getCustomName().contains("LD ")) {
double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]); double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]);
log("Dealing "+dmgdealt+" damage",4);
GenericFunctions.DealDamageToMob(dmgdealt, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), false); GenericFunctions.DealDamageToMob(dmgdealt, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), false);
((Monster)affected.get(i)).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,2,100));} ((Monster)affected.get(i)).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,2,100));}
} }
@ -4318,6 +4397,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_SHOOT, 1.0f, 0.5f); p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_SHOOT, 1.0f, 0.5f);
pd.last_shovelspell=getServerTickTime()+300; pd.last_shovelspell=getServerTickTime()+300;
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 300); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 300);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 300);
int mult=2; int mult=2;
double xspd=p.getLocation().getDirection().getX()*mult; double xspd=p.getLocation().getDirection().getX()*mult;
@ -4574,6 +4654,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (WorldShop.grabShopSign(l)!=null) { if (WorldShop.grabShopSign(l)!=null) {
//This is a world shop. DO NOT allow this to happen. //This is a world shop. DO NOT allow this to happen.
ev.setCancelled(true); ev.setCancelled(true);
final Location l1=ev.getDestination().getLocation();
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
l1.getBlock().breakNaturally();
}}
,1);
} }
Inventory destination = ev.getDestination(); Inventory destination = ev.getDestination();
l = destination.getLocation(); l = destination.getLocation();
@ -4581,6 +4667,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (WorldShop.grabShopSign(l)!=null) { if (WorldShop.grabShopSign(l)!=null) {
//This is a world shop. DO NOT allow this to happen. //This is a world shop. DO NOT allow this to happen.
ev.setCancelled(true); ev.setCancelled(true);
final Location l1=source.getLocation();
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
l1.getBlock().breakNaturally();
}}
,1);
} }
} }
@ -4598,6 +4690,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
public void onArrowShot(EntityShootBowEvent ev) { public void onArrowShot(EntityShootBowEvent ev) {
//Check if it's a player. //Check if it's a player.
if (ev.getEntityType()==EntityType.PLAYER &&
GenericFunctions.isArtifactEquip(ev.getEntity().getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(ev.getEntity().getEquipment().getItemInMainHand())) {
Player p = (Player)ev.getEntity();
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (pd.nextarrowxp>0) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.nextarrowxp, p);
pd.nextarrowxp=0;
}
}
if (ev.getEntityType()==EntityType.PLAYER && if (ev.getEntityType()==EntityType.PLAYER &&
(ev.getProjectile().getType()==EntityType.ARROW || (ev.getProjectile().getType()==EntityType.ARROW ||
ev.getProjectile().getType()==EntityType.TIPPED_ARROW)) { ev.getProjectile().getType()==EntityType.TIPPED_ARROW)) {
@ -6095,9 +6197,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
partylevel = pd.partybonus; partylevel = pd.partybonus;
if (partylevel>9) {partylevel=9;} if (partylevel>9) {partylevel=9;}
log("Light level: "+p.getLocation().add(0,0,0).getBlock().getLightLevel(),5); if (p.getLocation().getY()>=0) {log("Light level: "+p.getLocation().add(0,0,0).getBlock().getLightLevel(),5);}
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) &&
p.getLocation().getY()>=0 &&
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
double dmgreduce = 1d-(ArtifactAbility.calculateValue(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]))/100d); double dmgreduce = 1d-(ArtifactAbility.calculateValue(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]))/100d);
basedmg *= dmgreduce; basedmg *= dmgreduce;