->Leather artifact armor pieces now go up to Unbreaking XV. These
unbreaking levels also display properly on the items. ->Vendetta is now used by Defenders by shift-left clicking, allowing Defenders to still use left-click for basic provoking. ->Vendetta now stores 1% of mitigation damage as Thorns true damage, to be applied the next time something hits a Defender. ->Vendetta mitigation damage percent lowered from 30% -> 25%. ->Defender damage absorption was non-existent since the damage calculation rework. It has now been reimplemented properly. ->Vendetta tooltip updated. ->A sound effect now plays when Slayers leave or get hit out of stealth. ->Added AddItemToRecyclingCenter() to API. ->getCooldownReduction() is now visible in the API. ->Death Loot now safely fails if something bad happens, and no longer stores a mirror inventory on the server; this prevents items from being permanently lost, or being duped.
This commit is contained in:
parent
ff86174fd4
commit
c270d91fb7
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.8.6b
|
version: 3.8.6c
|
||||||
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.
|
||||||
|
@ -40,7 +40,7 @@ public class AwakenedArtifact {
|
|||||||
artifact.hasItemMeta() &&
|
artifact.hasItemMeta() &&
|
||||||
artifact.getItemMeta().hasLore() &&
|
artifact.getItemMeta().hasLore() &&
|
||||||
Artifact.isArtifact(artifact)) {
|
Artifact.isArtifact(artifact)) {
|
||||||
String expline = artifact.getItemMeta().getLore().get(4);
|
String expline = artifact.getItemMeta().getLore().get(findPotentialLine(artifact.getItemMeta().getLore()));
|
||||||
String exp = (expline.split("\\(")[1]).split("/")[0];
|
String exp = (expline.split("\\(")[1]).split("/")[0];
|
||||||
int expval = Integer.parseInt(exp);
|
int expval = Integer.parseInt(exp);
|
||||||
return expval;
|
return expval;
|
||||||
@ -57,8 +57,8 @@ public class AwakenedArtifact {
|
|||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
DecimalFormat df = new DecimalFormat("00");
|
DecimalFormat df = new DecimalFormat("00");
|
||||||
lore.set(3, ChatColor.YELLOW+"EXP"+ChatColor.RESET+" ["+drawEXPMeter(amt)+"] "+df.format((((double)amt/1000)*100))+"%"); //Update the EXP bar.
|
lore.set(findEXPBarLine(lore), ChatColor.YELLOW+"EXP"+ChatColor.RESET+" ["+drawEXPMeter(amt)+"] "+df.format((((double)amt/1000)*100))+"%"); //Update the EXP bar.
|
||||||
lore.set(4, ChatColor.BLUE+" ("+amt+"/1000) "+"Potential: "+drawPotential(artifact,getPotential(artifact)));
|
lore.set(findPotentialLine(lore), ChatColor.BLUE+" ("+amt+"/1000) "+"Potential: "+drawPotential(artifact,getPotential(artifact)));
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -66,6 +66,24 @@ public class AwakenedArtifact {
|
|||||||
//TwosideKeeper.log("Could not set the EXP value for artifact "+artifact.toString(), 1);
|
//TwosideKeeper.log("Could not set the EXP value for artifact "+artifact.toString(), 1);
|
||||||
return artifact;
|
return artifact;
|
||||||
}
|
}
|
||||||
|
private static int findPotentialLine(List<String> lore) {
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(ChatColor.BLUE+" (")) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TwosideKeeper.log("Could not find the Potential line for this item!!! This should never happen!\nLore Set: "+lore.toString(), 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
private static int findEXPBarLine(List<String> lore) {
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(ChatColor.YELLOW+"EXP"+ChatColor.RESET+" [")) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TwosideKeeper.log("Could not find the EXP line for this item!!! This should never happen!\nLore Set: "+lore.toString(), 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
public static ItemStack addEXP(ItemStack artifact, int amt, Player p) {
|
public static ItemStack addEXP(ItemStack artifact, int amt, Player p) {
|
||||||
int totalval = getEXP(artifact)+amt;
|
int totalval = getEXP(artifact)+amt;
|
||||||
if (totalval>=1000) {
|
if (totalval>=1000) {
|
||||||
@ -108,7 +126,7 @@ public class AwakenedArtifact {
|
|||||||
artifact.hasItemMeta() &&
|
artifact.hasItemMeta() &&
|
||||||
artifact.getItemMeta().hasLore() &&
|
artifact.getItemMeta().hasLore() &&
|
||||||
Artifact.isArtifact(artifact)) {
|
Artifact.isArtifact(artifact)) {
|
||||||
String lvline = artifact.getItemMeta().getLore().get(5);
|
String lvline = artifact.getItemMeta().getLore().get(findLVLine(artifact.getItemMeta().getLore()));
|
||||||
String lv = lvline.split(" ")[1];
|
String lv = lvline.split(" ")[1];
|
||||||
int LV = Integer.parseInt(lv);
|
int LV = Integer.parseInt(lv);
|
||||||
return LV;
|
return LV;
|
||||||
@ -116,6 +134,15 @@ public class AwakenedArtifact {
|
|||||||
//TwosideKeeper.log("Could not retrieve LV value for artifact "+artifact.toString(), 1);
|
//TwosideKeeper.log("Could not retrieve LV value for artifact "+artifact.toString(), 1);
|
||||||
return -1; //If we got here, something bad happened.
|
return -1; //If we got here, something bad happened.
|
||||||
}
|
}
|
||||||
|
private static int findLVLine(List<String> lore) {
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(ChatColor.GRAY+"Level ")) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TwosideKeeper.log("Could not find the Level line for this item!!! This should never happen!\nLore Set: "+lore.toString(), 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
public static ItemStack setLV(ItemStack artifact, int amt, Player p) {
|
public static ItemStack setLV(ItemStack artifact, int amt, Player p) {
|
||||||
if (artifact!=null &&
|
if (artifact!=null &&
|
||||||
artifact.getType()!=Material.AIR &&
|
artifact.getType()!=Material.AIR &&
|
||||||
@ -125,8 +152,8 @@ public class AwakenedArtifact {
|
|||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
DecimalFormat df = new DecimalFormat("000");
|
DecimalFormat df = new DecimalFormat("000");
|
||||||
lore.set(5, ChatColor.GRAY+"Level "+df.format(amt));
|
lore.set(findLVLine(lore), ChatColor.GRAY+"Level "+df.format(amt));
|
||||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+amt);
|
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+amt);
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -134,6 +161,15 @@ public class AwakenedArtifact {
|
|||||||
//TwosideKeeper.log("Could not set the LV value for artifact "+artifact.toString(), 1);
|
//TwosideKeeper.log("Could not set the LV value for artifact "+artifact.toString(), 1);
|
||||||
return artifact;
|
return artifact;
|
||||||
}
|
}
|
||||||
|
public static int findAPLine(List<String> lore) {
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(ChatColor.GOLD+"Ability Points: ")) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TwosideKeeper.log("Could not find the AP line for this item!!! This should never happen!\nLore Set: "+lore.toString(), 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
public static ItemStack addAP(ItemStack artifact, int amt) {
|
public static ItemStack addAP(ItemStack artifact, int amt) {
|
||||||
if (artifact!=null &&
|
if (artifact!=null &&
|
||||||
artifact.getType()!=Material.AIR &&
|
artifact.getType()!=Material.AIR &&
|
||||||
@ -143,7 +179,7 @@ public class AwakenedArtifact {
|
|||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
int currentAP = getAP(artifact);
|
int currentAP = getAP(artifact);
|
||||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP+amt)+"/"+getMaxAP(artifact));
|
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+(currentAP+amt)+"/"+getMaxAP(artifact));
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -159,7 +195,7 @@ public class AwakenedArtifact {
|
|||||||
Artifact.isArtifact(artifact)) {
|
Artifact.isArtifact(artifact)) {
|
||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+(newamt)+"/"+getMaxAP(artifact));
|
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+(newamt)+"/"+getMaxAP(artifact));
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -175,7 +211,7 @@ public class AwakenedArtifact {
|
|||||||
Artifact.isArtifact(artifact)) {
|
Artifact.isArtifact(artifact)) {
|
||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
String apline = lore.get(6);
|
String apline = lore.get(findAPLine(lore));
|
||||||
/*int level = getLV(artifact); //This is how many total we have.
|
/*int level = getLV(artifact); //This is how many total we have.
|
||||||
int apused = 0;
|
int apused = 0;
|
||||||
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
||||||
@ -197,7 +233,7 @@ public class AwakenedArtifact {
|
|||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
int currentMaxAP = getMaxAP(artifact);
|
int currentMaxAP = getMaxAP(artifact);
|
||||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(currentMaxAP+amt));
|
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(currentMaxAP+amt));
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -213,7 +249,7 @@ public class AwakenedArtifact {
|
|||||||
Artifact.isArtifact(artifact)) {
|
Artifact.isArtifact(artifact)) {
|
||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(newamt));
|
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(newamt));
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -229,7 +265,7 @@ public class AwakenedArtifact {
|
|||||||
Artifact.isArtifact(artifact)) {
|
Artifact.isArtifact(artifact)) {
|
||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
String apline = lore.get(6);
|
String apline = lore.get(findAPLine(lore));
|
||||||
/*int level = getLV(artifact); //This is how many total we have.
|
/*int level = getLV(artifact); //This is how many total we have.
|
||||||
int apused = 0;
|
int apused = 0;
|
||||||
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
||||||
@ -249,7 +285,7 @@ public class AwakenedArtifact {
|
|||||||
if (GenericFunctions.isArtifactEquip(artifact)) {
|
if (GenericFunctions.isArtifactEquip(artifact)) {
|
||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
String potentialline = lore.get(4);
|
String potentialline = lore.get(findPotentialLine(lore));
|
||||||
return Integer.parseInt(ChatColor.stripColor(potentialline.split("Potential: ")[1].replace("%", "")));
|
return Integer.parseInt(ChatColor.stripColor(potentialline.split("Potential: ")[1].replace("%", "")));
|
||||||
} else {
|
} else {
|
||||||
//TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
|
//TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
|
||||||
@ -261,8 +297,8 @@ public class AwakenedArtifact {
|
|||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
int potential = amt;
|
int potential = amt;
|
||||||
String potentialline = lore.get(4).split("Potential: ")[0]+"Potential: "+drawPotential(artifact,potential);
|
String potentialline = lore.get(findPotentialLine(lore)).split("Potential: ")[0]+"Potential: "+drawPotential(artifact,potential);
|
||||||
lore.set(4, potentialline);
|
lore.set(findPotentialLine(lore), potentialline);
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -276,8 +312,8 @@ public class AwakenedArtifact {
|
|||||||
ItemMeta m = artifact.getItemMeta();
|
ItemMeta m = artifact.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
int potential = getPotential(artifact)+amt;
|
int potential = getPotential(artifact)+amt;
|
||||||
String potentialline = lore.get(4).split("Potential: ")[0]+"Potential: "+drawPotential(artifact,potential);
|
String potentialline = lore.get(findPotentialLine(lore)).split("Potential: ")[0]+"Potential: "+drawPotential(artifact,potential);
|
||||||
lore.set(4, potentialline);
|
lore.set(findPotentialLine(lore), potentialline);
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
|
@ -321,8 +321,12 @@ public class CustomDamage {
|
|||||||
if (PlayerMode.isDefender(p)) {
|
if (PlayerMode.isDefender(p)) {
|
||||||
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
|
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
|
||||||
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
||||||
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.3;
|
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.25;
|
||||||
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
if (TwosideKeeper.getMaxThornsLevelOnEquipment(target)>0) {
|
||||||
|
pd.thorns_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.01;
|
||||||
|
}
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+((pd.thorns_amt>0)?"/"+ChatColor.GOLD+df.format(pd.thorns_amt):"")+ChatColor.GREEN+" dmg stored");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getDamagerEntity(damager) instanceof Enderman) {
|
if (getDamagerEntity(damager) instanceof Enderman) {
|
||||||
@ -365,6 +369,8 @@ public class CustomDamage {
|
|||||||
pd.slayermegahit=false;
|
pd.slayermegahit=false;
|
||||||
pd.lastcombat=TwosideKeeper.getServerTickTime();
|
pd.lastcombat=TwosideKeeper.getServerTickTime();
|
||||||
|
|
||||||
|
damage = calculateDefenderAbsorption(p, damager, damage);
|
||||||
|
|
||||||
if (GenericFunctions.AttemptRevive(p, damage, reason)) {
|
if (GenericFunctions.AttemptRevive(p, damage, reason)) {
|
||||||
damage=0;
|
damage=0;
|
||||||
}
|
}
|
||||||
@ -906,8 +912,12 @@ public class CustomDamage {
|
|||||||
double rawdmg = CalculateDamage(0,damager,target,null,null,TRUEDMG)*(1d/CalculateDamageReduction(1,target,damager));
|
double rawdmg = CalculateDamage(0,damager,target,null,null,TRUEDMG)*(1d/CalculateDamageReduction(1,target,damager));
|
||||||
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*rawdmg);
|
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*(rawdmg*0.95));
|
||||||
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
if (TwosideKeeper.getMaxThornsLevelOnEquipment(target)>0) {
|
||||||
|
pd.thorns_amt+=((1-CalculateDamageReduction(1,target,damager))*(rawdmg*0.01));
|
||||||
|
}
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+((pd.thorns_amt>0)?"/"+ChatColor.GOLD+df.format(pd.thorns_amt):"")+ChatColor.GREEN+" dmg stored");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1565,10 +1575,11 @@ public class CustomDamage {
|
|||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double calculateDefenderAbsorption(LivingEntity entity, double dmg) {
|
public static double calculateDefenderAbsorption(LivingEntity entity, Entity damager, double dmg) {
|
||||||
//See if we're in a party with a defender.
|
//See if we're in a party with a defender.
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
Player p = (Player)entity;
|
Player p = (Player)entity;
|
||||||
|
LivingEntity shooter = getDamagerEntity(damager);
|
||||||
List<Player> partymembers = TwosideKeeperAPI.getPartyMembers(p);
|
List<Player> partymembers = TwosideKeeperAPI.getPartyMembers(p);
|
||||||
for (int i=0;i<partymembers.size();i++) {
|
for (int i=0;i<partymembers.size();i++) {
|
||||||
Player check = partymembers.get(i);
|
Player check = partymembers.get(i);
|
||||||
@ -1581,9 +1592,9 @@ public class CustomDamage {
|
|||||||
dmg = dmg/2;
|
dmg = dmg/2;
|
||||||
//Send the rest of the damage to the defender.
|
//Send the rest of the damage to the defender.
|
||||||
double defenderdmg = dmg;
|
double defenderdmg = dmg;
|
||||||
defenderdmg=CalculateDamageReduction(dmg, check, entity);
|
//defenderdmg=CalculateDamageReduction(dmg, check, entity);
|
||||||
ApplyDamage(defenderdmg, p, check, null, "Defender Tank");
|
ApplyDamage(defenderdmg, shooter, check, null, "Defender Tank", IGNOREDODGE|IGNORE_DAMAGE_TICK);
|
||||||
TwosideKeeper.log("Damage was absorbed by "+check.getName()+". Took "+defenderdmg+" reduced damage. Original damage: "+dmg,2);
|
//TwosideKeeper.log("Damage was absorbed by "+check.getName()+". Took "+defenderdmg+" reduced damage. Original damage: "+dmg,0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,35 +110,7 @@ public class DeathManager {
|
|||||||
DeathStructure structure = getDeathStructure(p);
|
DeathStructure structure = getDeathStructure(p);
|
||||||
|
|
||||||
Inventory deathinv = Bukkit.getServer().createInventory(p, 45, "Death Loot");
|
Inventory deathinv = Bukkit.getServer().createInventory(p, 45, "Death Loot");
|
||||||
for (int i=0;i<structure.deathinventory.size();i++) {
|
GenericFunctions.TransferItemsToInventory(p.getInventory(), deathinv);
|
||||||
/*
|
|
||||||
if (i>=36) {
|
|
||||||
if (pd.deathinventory.get(i).getType().toString().contains("BOOTS")) {
|
|
||||||
p.getInventory().setBoots(pd.deathinventory.get(i));
|
|
||||||
} else
|
|
||||||
if (pd.deathinventory.get(i).getType().toString().contains("SHIELD")) {
|
|
||||||
p.getInventory().setItemInOffHand(pd.deathinventory.get(i));
|
|
||||||
} else
|
|
||||||
if (pd.deathinventory.get(i).getType().toString().contains("LEGGINGS")) {
|
|
||||||
p.getInventory().setLeggings(pd.deathinventory.get(i));
|
|
||||||
} else
|
|
||||||
if (pd.deathinventory.get(i).getType().toString().contains("CHESTPLATE")) {
|
|
||||||
p.getInventory().setChestplate(pd.deathinventory.get(i));
|
|
||||||
} else
|
|
||||||
if (pd.deathinventory.get(i).getType().toString().contains("HELMET")) {
|
|
||||||
p.getInventory().setHelmet(pd.deathinventory.get(i));
|
|
||||||
} else {
|
|
||||||
//What is this? Just drop it.
|
|
||||||
p.getLocation().getWorld().dropItem(p.getLocation(), pd.deathinventory.get(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p.getInventory().addItem(pd.deathinventory.get(i));
|
|
||||||
}*/
|
|
||||||
if (structure.deathinventory.get(i)!=null &&
|
|
||||||
structure.deathinventory.get(i).getType()!=Material.AIR) {
|
|
||||||
deathinv.addItem(structure.deathinventory.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double totalmoney = TwosideKeeper.getPlayerMoney(Bukkit.getPlayer(p.getName()))+TwosideKeeper.getPlayerBankMoney(Bukkit.getPlayer(p.getName()));
|
double totalmoney = TwosideKeeper.getPlayerMoney(Bukkit.getPlayer(p.getName()))+TwosideKeeper.getPlayerBankMoney(Bukkit.getPlayer(p.getName()));
|
||||||
int price = 1;
|
int price = 1;
|
||||||
if (structure.deathloc.getBlockY()<=60) {
|
if (structure.deathloc.getBlockY()<=60) {
|
||||||
|
@ -222,7 +222,7 @@ public enum ArtifactAbility {
|
|||||||
if (GenericFunctions.isArtifactEquip(item)) {
|
if (GenericFunctions.isArtifactEquip(item)) {
|
||||||
List<String> lore = item.getItemMeta().getLore();
|
List<String> lore = item.getItemMeta().getLore();
|
||||||
//From Element 7 and onwards, we know these are abilities added to the item. Retrieve them.
|
//From Element 7 and onwards, we know these are abilities added to the item. Retrieve them.
|
||||||
for (int i=7;i<lore.size();i++) {
|
for (int i=AwakenedArtifact.findAPLine(lore)+1;i<lore.size();i++) {
|
||||||
String[] splitstring = lore.get(i).split(" ");
|
String[] splitstring = lore.get(i).split(" ");
|
||||||
TwosideKeeper.log(splitstring.length+"",5);
|
TwosideKeeper.log(splitstring.length+"",5);
|
||||||
String newstring = "";
|
String newstring = "";
|
||||||
|
@ -588,7 +588,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 1);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 2);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
@ -622,7 +622,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 2);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 2);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 4);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 4);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
@ -656,7 +656,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 4);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 4);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 4);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 4);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 6);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 6);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
@ -691,7 +691,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 7);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 7);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 7);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 7);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 7);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 7);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 11);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
@ -729,7 +729,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 8);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 8);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 8);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 8);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 8);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 8);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 13);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
@ -766,7 +766,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 9);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 9);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 9);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 9);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 9);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 9);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 9);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 14);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
@ -804,7 +804,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
|
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 15);
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.TOOL ||
|
if (upgrade==UpgradePath.TOOL ||
|
||||||
upgrade==UpgradePath.SHOVEL ||
|
upgrade==UpgradePath.SHOVEL ||
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -3108,15 +3109,51 @@ public class GenericFunctions {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateArtifactItemType(ItemStack item) {
|
public static void UpdateArtifactItemType(ItemStack item) {
|
||||||
if (isArtifactArmor(item) &&
|
if (isArtifactArmor(item) &&
|
||||||
item.getType()!=Material.SULPHUR) {
|
item.getType()!=Material.SULPHUR) {
|
||||||
double durabilityratio = item.getDurability()/item.getType().getMaxDurability();
|
double durabilityratio = item.getDurability()/item.getType().getMaxDurability();
|
||||||
item.setType(Material.valueOf("LEATHER_"+item.getType().name().split("_")[1]));
|
item.setType(Material.valueOf("LEATHER_"+item.getType().name().split("_")[1]));
|
||||||
item.setDurability((short)(durabilityratio*item.getType().getMaxDurability()));
|
item.setDurability((short)(durabilityratio*item.getType().getMaxDurability()));
|
||||||
|
UpdateDisplayedEnchantments(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UpdateDisplayedEnchantments(ItemStack item) {
|
||||||
|
ItemMeta m = item.getItemMeta();
|
||||||
|
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
m.setLore(ClearAllPreviousEnchantmentLines(m.getLore()));
|
||||||
|
item.setItemMeta(m);
|
||||||
|
AddNewEnchantmentLines(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddNewEnchantmentLines(ItemStack item) {
|
||||||
|
Set<Enchantment> map = item.getEnchantments().keySet();
|
||||||
|
ItemMeta m = item.getItemMeta();
|
||||||
|
List<String> lore = m.getLore();
|
||||||
|
int artifact_lv = item.getEnchantmentLevel(Enchantment.LUCK);
|
||||||
|
for (Enchantment e : map) {
|
||||||
|
int lv = item.getEnchantments().get(e);
|
||||||
|
if (!e.getName().equalsIgnoreCase("luck")) {
|
||||||
|
lore.add(0," "+ChatColor.BLACK+ChatColor.WHITE+ChatColor.GRAY+WorldShop.getRealName(e)+" "+WorldShop.toRomanNumeral(lv));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lore.add(0,ChatColor.GOLD+""+ChatColor.BLACK+ChatColor.GOLD+"Tier "+artifact_lv+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact");
|
||||||
|
m.setLore(lore);
|
||||||
|
item.setItemMeta(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> ClearAllPreviousEnchantmentLines(List<String> lore) {
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(" "+ChatColor.BLACK+ChatColor.WHITE+ChatColor.GRAY) ||
|
||||||
|
lore.get(i).contains(ChatColor.GOLD+""+ChatColor.BLACK+ChatColor.GOLD+"Tier ")) {
|
||||||
|
lore.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lore;
|
||||||
|
}
|
||||||
|
|
||||||
private static void UpdateHuntersCompass(ItemStack item) {
|
private static void UpdateHuntersCompass(ItemStack item) {
|
||||||
if (item.getType()==Material.COMPASS &&
|
if (item.getType()==Material.COMPASS &&
|
||||||
item.containsEnchantment(Enchantment.LUCK)) {
|
item.containsEnchantment(Enchantment.LUCK)) {
|
||||||
@ -3941,6 +3978,7 @@ public class GenericFunctions {
|
|||||||
public static void removeStealth(Player p) {
|
public static void removeStealth(Player p) {
|
||||||
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
|
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
|
||||||
GenericFunctions.addIFrame(p, 10);
|
GenericFunctions.addIFrame(p, 10);
|
||||||
|
p.playSound(p.getLocation(), Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasStealth(Player p) {
|
public static boolean hasStealth(Player p) {
|
||||||
@ -4099,7 +4137,7 @@ public class GenericFunctions {
|
|||||||
public static boolean isIsolatedTarget(Monster m, Player p) {
|
public static boolean isIsolatedTarget(Monster m, Player p) {
|
||||||
return ((GlowAPI.isGlowing(m, p) &&
|
return ((GlowAPI.isGlowing(m, p) &&
|
||||||
GlowAPI.getGlowColor(m, p).equals(Color.WHITE)) ||
|
GlowAPI.getGlowColor(m, p).equals(Color.WHITE)) ||
|
||||||
GenericFunctions.GetNearbyMonsterCount(m, 10)==0) &&
|
GenericFunctions.GetNearbyMonsterCount(m, 12)==0) &&
|
||||||
PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER;
|
PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4197,4 +4235,21 @@ public class GenericFunctions {
|
|||||||
return ent.getCustomName().split(ChatColor.RESET+" ")[0];
|
return ent.getCustomName().split(ChatColor.RESET+" ")[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void TransferItemsToInventory(Inventory from, Inventory to) {
|
||||||
|
List<ItemStack> inventory = new ArrayList<ItemStack>();
|
||||||
|
for (int i=0;i<from.getContents().length;i++) {
|
||||||
|
if (from.getItem(i)!=null) {
|
||||||
|
inventory.add(from.getItem(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ItemStack[] list = inventory.toArray(new ItemStack[inventory.size()]);
|
||||||
|
HashMap<Integer,ItemStack> items = to.addItem(list);
|
||||||
|
for (int i=0;i<items.size();i++) {
|
||||||
|
//from.addItem(items.get(i));
|
||||||
|
TwosideKeeper.log("Could not add "+items.get(i).toString()+" to inventory. Recycling it... THIS SHOULD NOT HAPPEN THOUGH!", 0);
|
||||||
|
TwosideKeeperAPI.addItemToRecyclingCenter(items.get(i));
|
||||||
|
}
|
||||||
|
from.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,17 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class DeathStructure {
|
public class DeathStructure {
|
||||||
|
|
||||||
public List<ItemStack> deathinventory;
|
//public List<ItemStack> deathinventory;
|
||||||
public Location deathloc;
|
public Location deathloc;
|
||||||
public String p;
|
public String p;
|
||||||
|
|
||||||
public DeathStructure(List<ItemStack> di, Location dl, Player p) {
|
public DeathStructure(List<ItemStack> di, Location dl, Player p) {
|
||||||
this.deathinventory=di;
|
//this.deathinventory=di;
|
||||||
this.deathloc=dl;
|
this.deathloc=dl;
|
||||||
this.p=p.getName();
|
this.p=p.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Death Inventory: "+deathinventory.size()+" items, belongs to Player "+p+". Death location is "+deathloc.toString();
|
return "Belongs to Player "+p+". Death location is "+deathloc.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,9 +294,10 @@ public enum ItemSet {
|
|||||||
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Absorption Health (30 seconds)");
|
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Absorption Health (30 seconds)");
|
||||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage Reduction");
|
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage Reduction");
|
||||||
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Vendetta");
|
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Vendetta");
|
||||||
lore.add(ChatColor.GRAY+" Blocking stores 30% of mitigation damage.");
|
lore.add(ChatColor.GRAY+" Blocking stores 25% of mitigation damage.");
|
||||||
lore.add(ChatColor.GRAY+" Attacking with a shield unleashes all stored");
|
lore.add(ChatColor.GRAY+" 1% of damage is stored as thorns true damage.");
|
||||||
lore.add(ChatColor.GRAY+" mitigation damage.");
|
lore.add(ChatColor.GRAY+" Shift+Left-Click with a shield to unleash");
|
||||||
|
lore.add(ChatColor.GRAY+" all of your stored mitigation damage.");
|
||||||
}break;
|
}break;
|
||||||
case DAWNTRACKER:{
|
case DAWNTRACKER:{
|
||||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||||
|
@ -108,13 +108,13 @@ public class WorldShop {
|
|||||||
public static String GetItemInfo(ItemStack item) {
|
public static String GetItemInfo(ItemStack item) {
|
||||||
//Gets all the info about this item in one gigantic string. (Separated by new lines. Useful for tellraw()).
|
//Gets all the info about this item in one gigantic string. (Separated by new lines. Useful for tellraw()).
|
||||||
String message = "";
|
String message = "";
|
||||||
if (GenericFunctions.isArtifactEquip(item)) {
|
if (GenericFunctions.isArtifactEquip(item) && !GenericFunctions.isArtifactArmor(item) /*Artifact armor already has this info displayed.*/) {
|
||||||
if (item.hasItemMeta() &&
|
if (item.hasItemMeta() &&
|
||||||
item.getItemMeta().hasDisplayName()) {
|
item.getItemMeta().hasDisplayName()) {
|
||||||
message+="\n"+ChatColor.GOLD+ChatColor.BOLD+"T"+item.getEnchantmentLevel(Enchantment.LUCK)+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact \n";
|
message+="\n"+ChatColor.GOLD+ChatColor.BOLD+"T"+item.getEnchantmentLevel(Enchantment.LUCK)+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact \n";
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (item.hasItemMeta() &&
|
if (!GenericFunctions.isArtifactArmor(item) && item.hasItemMeta() &&
|
||||||
item.getItemMeta().hasDisplayName()) {
|
item.getItemMeta().hasDisplayName()) {
|
||||||
message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item.getType())+"\n";
|
message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item.getType())+"\n";
|
||||||
}
|
}
|
||||||
@ -531,7 +531,7 @@ public class WorldShop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getRealName(Enchantment enchant) {
|
public static String getRealName(Enchantment enchant) {
|
||||||
if (enchant.getName().equalsIgnoreCase("arrow_damage")) {return "Power";}
|
if (enchant.getName().equalsIgnoreCase("arrow_damage")) {return "Power";}
|
||||||
if (enchant.getName().equalsIgnoreCase("arrow_fire")) {return "Flame";}
|
if (enchant.getName().equalsIgnoreCase("arrow_fire")) {return "Flame";}
|
||||||
if (enchant.getName().equalsIgnoreCase("arrow_infinite")) {return "Infinity";}
|
if (enchant.getName().equalsIgnoreCase("arrow_infinite")) {return "Infinity";}
|
||||||
|
@ -109,6 +109,7 @@ public class PlayerStructure {
|
|||||||
public long lastassassinatetime=0;
|
public long lastassassinatetime=0;
|
||||||
public long lastlifesavertime=0;
|
public long lastlifesavertime=0;
|
||||||
public boolean slayermegahit=false;
|
public boolean slayermegahit=false;
|
||||||
|
public double thorns_amt = 0.0;
|
||||||
|
|
||||||
public long iframetime = 0;
|
public long iframetime = 0;
|
||||||
|
|
||||||
@ -257,18 +258,18 @@ public class PlayerStructure {
|
|||||||
workable.set("spleef_wins", spleef_wins);
|
workable.set("spleef_wins", spleef_wins);
|
||||||
workable.set("sounds_enabled", sounds_enabled);
|
workable.set("sounds_enabled", sounds_enabled);
|
||||||
workable.set("hasDied", hasDied);
|
workable.set("hasDied", hasDied);
|
||||||
ConfigurationSection deathlootlist = workable.createSection("deathloot");
|
//ConfigurationSection deathlootlist = workable.createSection("deathloot");
|
||||||
if (DeathManager.deathStructureExists(Bukkit.getPlayer(name))) {
|
if (DeathManager.deathStructureExists(Bukkit.getPlayer(name))) {
|
||||||
DeathStructure ds = DeathManager.getDeathStructure(Bukkit.getPlayer(name));
|
DeathStructure ds = DeathManager.getDeathStructure(Bukkit.getPlayer(name));
|
||||||
deathloc_x = ds.deathloc.getX();
|
deathloc_x = ds.deathloc.getX();
|
||||||
deathloc_y = ds.deathloc.getY();
|
deathloc_y = ds.deathloc.getY();
|
||||||
deathloc_z = ds.deathloc.getZ();
|
deathloc_z = ds.deathloc.getZ();
|
||||||
deathloc_world = ds.deathloc.getWorld().getName();
|
deathloc_world = ds.deathloc.getWorld().getName();
|
||||||
for (int i=0;i<ds.deathinventory.size();i++) {
|
/*for (int i=0;i<ds.deathinventory.size();i++) {
|
||||||
if (ds.deathinventory.get(i)!=null) {
|
if (ds.deathinventory.get(i)!=null) {
|
||||||
deathlootlist.set("item"+i, ds.deathinventory.get(i));
|
deathlootlist.set("item"+i, ds.deathinventory.get(i));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
workable.set("deathloc_x", deathloc_x);
|
workable.set("deathloc_x", deathloc_x);
|
||||||
workable.set("deathloc_y", deathloc_y);
|
workable.set("deathloc_y", deathloc_y);
|
||||||
|
@ -164,9 +164,9 @@ public class RecyclingCenter {
|
|||||||
return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
|
return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddItemToRecyclingCenter(Item i) {
|
public void AddItemToRecyclingCenter(ItemStack i) {
|
||||||
//There is a % chance of it going to a recycling center.
|
//There is a % chance of it going to a recycling center.
|
||||||
if (IsItemAllowed(i.getItemStack())) {
|
if (IsItemAllowed(i)) {
|
||||||
//Recycle allowed. Now figure out which node to go to.
|
//Recycle allowed. Now figure out which node to go to.
|
||||||
if (getNumberOfNodes()>0) {
|
if (getNumberOfNodes()>0) {
|
||||||
Location rand_node=getRandomNode();
|
Location rand_node=getRandomNode();
|
||||||
@ -177,20 +177,20 @@ public class RecyclingCenter {
|
|||||||
if (b.getState()!=null) {
|
if (b.getState()!=null) {
|
||||||
Chest c = (Chest) b.getState();
|
Chest c = (Chest) b.getState();
|
||||||
for (int j=0;j<27;j++) {
|
for (int j=0;j<27;j++) {
|
||||||
if (c.getBlockInventory().getItem(j)!=null && c.getBlockInventory().getItem(j).getType()==i.getItemStack().getType()) {
|
if (c.getBlockInventory().getItem(j)!=null && c.getBlockInventory().getItem(j).getType()==i.getType()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int itemslot = (int)Math.floor(Math.random()*27);
|
int itemslot = (int)Math.floor(Math.random()*27);
|
||||||
ItemStack oldItem = c.getBlockInventory().getItem(itemslot);
|
ItemStack oldItem = c.getBlockInventory().getItem(itemslot);
|
||||||
//There is also a chance to move this item to another random spot.
|
//There is also a chance to move this item to another random spot.
|
||||||
if (!isCommon(i.getItemStack().getType())) {
|
if (!isCommon(i.getType())) {
|
||||||
if (oldItem!=null && Math.random()*100<=TwosideKeeper.RECYCLECHANCE) {
|
if (oldItem!=null && Math.random()*100<=TwosideKeeper.RECYCLECHANCE) {
|
||||||
int itemslot2 = (int)Math.floor(Math.random()*27);
|
int itemslot2 = (int)Math.floor(Math.random()*27);
|
||||||
c.getBlockInventory().setItem(itemslot2, oldItem);
|
c.getBlockInventory().setItem(itemslot2, oldItem);
|
||||||
}
|
}
|
||||||
c.getBlockInventory().setItem(itemslot, i.getItemStack());
|
c.getBlockInventory().setItem(itemslot, i);
|
||||||
populateItemList(i.getItemStack());
|
populateItemList(i);
|
||||||
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i.getItemStack())+((i.getItemStack().getAmount()>1)?ChatColor.YELLOW+" x"+i.getItemStack().getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),2);
|
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i)+((i.getAmount()>1)?ChatColor.YELLOW+" x"+i.getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2723,7 +2723,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
pd = PlayerStructure.GetPlayerStructure(p);
|
pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
pd.hasDied=true;
|
pd.hasDied=true;
|
||||||
pd.vendetta_amt=0.0;
|
pd.vendetta_amt=0.0;
|
||||||
p.getInventory().clear();
|
//p.getInventory().clear();
|
||||||
}
|
}
|
||||||
for (int i=0;i<elitemonsters.size();i++) {
|
for (int i=0;i<elitemonsters.size();i++) {
|
||||||
EliteMonster em = elitemonsters.get(i);
|
EliteMonster em = elitemonsters.get(i);
|
||||||
@ -3676,7 +3676,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TwosideRecyclingCenter.AddItemToRecyclingCenter(i);
|
TwosideRecyclingCenter.AddItemToRecyclingCenter(i.getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
@ -3920,7 +3920,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getMaxThornsLevelOnEquipment(Entity damager) {
|
public static double getMaxThornsLevelOnEquipment(Entity damager) {
|
||||||
int maxthornslevel = 0;
|
int maxthornslevel = 0;
|
||||||
LivingEntity shooter = CustomDamage.getDamagerEntity(damager);
|
LivingEntity shooter = CustomDamage.getDamagerEntity(damager);
|
||||||
if (shooter instanceof LivingEntity) {
|
if (shooter instanceof LivingEntity) {
|
||||||
@ -3953,6 +3953,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
ev.getEntity().getWorld().playSound(ev.getEntity().getLocation(), Sound.ENCHANT_THORNS_HIT, 1.0f, 1.0f);
|
ev.getEntity().getWorld().playSound(ev.getEntity().getLocation(), Sound.ENCHANT_THORNS_HIT, 1.0f, 1.0f);
|
||||||
CustomDamage.setupTrueDamage(ev);
|
CustomDamage.setupTrueDamage(ev);
|
||||||
|
if (ev.getDamager() instanceof Player) {
|
||||||
|
Player p = (Player)ev.getDamager();
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
dmgdealt += pd.thorns_amt;
|
||||||
|
pd.thorns_amt=0;
|
||||||
|
}
|
||||||
CustomDamage.ApplyDamage(dmgdealt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, ev.getCause().name(), CustomDamage.TRUEDMG);
|
CustomDamage.ApplyDamage(dmgdealt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, ev.getCause().name(), CustomDamage.TRUEDMG);
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
} else
|
} else
|
||||||
@ -3981,7 +3987,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (CustomDamage.getDamagerEntity(ev.getDamager()) instanceof Player) {
|
if (CustomDamage.getDamagerEntity(ev.getDamager()) instanceof Player) {
|
||||||
Player p = (Player)CustomDamage.getDamagerEntity(ev.getDamager());
|
Player p = (Player)CustomDamage.getDamagerEntity(ev.getDamager());
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (PlayerMode.isDefender(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL,5) && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead.
|
if (PlayerMode.isDefender(p) && p.isSneaking() && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL,5) && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead.
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f);
|
p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f);
|
||||||
GenericFunctions.removeNoDamageTick((LivingEntity)ev.getEntity(), ev.getDamager());
|
GenericFunctions.removeNoDamageTick((LivingEntity)ev.getEntity(), ev.getDamager());
|
||||||
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
|
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
|
||||||
|
@ -348,6 +348,9 @@ public final class TwosideKeeperAPI {
|
|||||||
public static boolean isRecyclingCenter(Block b) {
|
public static boolean isRecyclingCenter(Block b) {
|
||||||
return RecyclingCenter.isRecyclingCenter(b);
|
return RecyclingCenter.isRecyclingCenter(b);
|
||||||
}
|
}
|
||||||
|
public static void addItemToRecyclingCenter(ItemStack item) {
|
||||||
|
TwosideKeeper.TwosideRecyclingCenter.AddItemToRecyclingCenter(item);
|
||||||
|
}
|
||||||
|
|
||||||
//Item Set COMMANDS.
|
//Item Set COMMANDS.
|
||||||
public static boolean isSetItem(ItemStack item) {
|
public static boolean isSetItem(ItemStack item) {
|
||||||
@ -433,7 +436,7 @@ public final class TwosideKeeperAPI {
|
|||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public double getCooldownReduction(Player p) {
|
public static double getCooldownReduction(Player p) {
|
||||||
return CustomDamage.calculateCooldownReduction(p);
|
return CustomDamage.calculateCooldownReduction(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,9 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
||||||
GenericFunctions.RemoveNewDebuffs(p);
|
GenericFunctions.RemoveNewDebuffs(p);
|
||||||
|
|
||||||
|
ItemStack[] equips2 = GenericFunctions.getEquipment(p);
|
||||||
|
for (int i=0;i<equips2.length;i++) {GenericFunctions.UpdateArtifactItemType(equips2[i]);}
|
||||||
|
|
||||||
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<serverTickTime) {
|
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<serverTickTime) {
|
||||||
pd.lastsprintcheck=serverTickTime;
|
pd.lastsprintcheck=serverTickTime;
|
||||||
GenericFunctions.ApplySwiftAegis(p);
|
GenericFunctions.ApplySwiftAegis(p);
|
||||||
@ -184,6 +187,11 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
|
|
||||||
ItemStack[] equips = p.getEquipment().getArmorContents();
|
ItemStack[] equips = p.getEquipment().getArmorContents();
|
||||||
|
|
||||||
|
if (pd.lastcombat+(20*60)<serverTickTime) {
|
||||||
|
pd.vendetta_amt=0;
|
||||||
|
pd.thorns_amt=0;
|
||||||
|
}
|
||||||
|
|
||||||
if (pd.last_regen_time+TwosideKeeper.HEALTH_REGENERATION_RATE<=serverTickTime) {
|
if (pd.last_regen_time+TwosideKeeper.HEALTH_REGENERATION_RATE<=serverTickTime) {
|
||||||
pd.last_regen_time=serverTickTime;
|
pd.last_regen_time=serverTickTime;
|
||||||
//See if this player needs to be healed.
|
//See if this player needs to be healed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user