->Changing Bow Modes now immediately shows you the new mode you are on.
->Made switching bow modes with left click not so ridiculously fast when clicking blocks. ->Fixed a bug where upgraded enchantments would not transfer over to Artifact upgrades. ->Internal Improvements made to Player Mode switching and identification. ->Many optimizations made to code. Approximately 20% less calculation time all around. ->Removed Lingering Potion Effects due to Line Drive and Elite Monsters. ->Line Drive effect has been modified. ->Artifacts no longer have their AP directly attached to their level. Greed now consumes one Max AP when the buff is knocked off the artifact. Graceful Dodge properly removes 10 AP instead of 10 Levels now.
This commit is contained in:
parent
91d4d16db6
commit
0001c6e677
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: TwosideKeeper
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.8.5c
|
||||
version: 3.8.5dBUGSPLEASEGOAWAYWTFWHYAREYOUSTILLHEREOMGIHATETHISPLSFIXNOCOPYPASTERINO
|
||||
commands:
|
||||
money:
|
||||
description: Tells the player the amount of money they are holding.
|
||||
|
@ -12,8 +12,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
@ -74,7 +72,7 @@ public class AwakenedArtifact {
|
||||
//LEVEL UP!
|
||||
ItemStack item = addLV(artifact,totalval/1000, p);
|
||||
item = setEXP(item,totalval%1000);
|
||||
item = addAP(item,1);
|
||||
item = addAP(item,totalval/1000);
|
||||
double potentialred = 10.0d;
|
||||
potentialred *= 1 - GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d;
|
||||
TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 4);
|
||||
@ -145,7 +143,23 @@ public class AwakenedArtifact {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
int currentAP = getAP(artifact);
|
||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP)+"/"+getLV(artifact));
|
||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP+amt)+"/"+getMaxAP(artifact));
|
||||
m.setLore(lore);
|
||||
artifact.setItemMeta(m);
|
||||
return artifact;
|
||||
}
|
||||
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
|
||||
return null;
|
||||
}
|
||||
public static ItemStack setAP(ItemStack artifact, int newamt) {
|
||||
if (artifact!=null &&
|
||||
artifact.getType()!=Material.AIR &&
|
||||
artifact.hasItemMeta() &&
|
||||
artifact.getItemMeta().hasLore() &&
|
||||
Artifact.isArtifact(artifact)) {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+(newamt)+"/"+getMaxAP(artifact));
|
||||
m.setLore(lore);
|
||||
artifact.setItemMeta(m);
|
||||
return artifact;
|
||||
@ -159,18 +173,75 @@ public class AwakenedArtifact {
|
||||
artifact.hasItemMeta() &&
|
||||
artifact.getItemMeta().hasLore() &&
|
||||
Artifact.isArtifact(artifact)) {
|
||||
int level = getLV(artifact); //This is how many total we have.
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
String apline = lore.get(6);
|
||||
/*int level = getLV(artifact); //This is how many total we have.
|
||||
int apused = 0;
|
||||
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
||||
for (int i=0;i<enchants.values().size();i++) {
|
||||
apused += Iterables.get(enchants.values(), i); //Counts how many levels of each enchantment was applied. This correlates directly with how much AP was used.
|
||||
}
|
||||
return level-apused;
|
||||
//return Integer.parseInt(((apline.split("/")[0]).split(": ")[1]));
|
||||
return level-apused;*/
|
||||
return Integer.parseInt(((apline.split("/")[0]).split(": ")[1]));
|
||||
}
|
||||
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
|
||||
return -1;
|
||||
}
|
||||
public static ItemStack addMaxAP(ItemStack artifact, int amt) {
|
||||
if (artifact!=null &&
|
||||
artifact.getType()!=Material.AIR &&
|
||||
artifact.hasItemMeta() &&
|
||||
artifact.getItemMeta().hasLore() &&
|
||||
Artifact.isArtifact(artifact)) {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
int currentMaxAP = getMaxAP(artifact);
|
||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(currentMaxAP+amt));
|
||||
m.setLore(lore);
|
||||
artifact.setItemMeta(m);
|
||||
return artifact;
|
||||
}
|
||||
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
|
||||
return null;
|
||||
}
|
||||
public static ItemStack setMaxAP(ItemStack artifact, int newamt) {
|
||||
if (artifact!=null &&
|
||||
artifact.getType()!=Material.AIR &&
|
||||
artifact.hasItemMeta() &&
|
||||
artifact.getItemMeta().hasLore() &&
|
||||
Artifact.isArtifact(artifact)) {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(newamt));
|
||||
m.setLore(lore);
|
||||
artifact.setItemMeta(m);
|
||||
return artifact;
|
||||
}
|
||||
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
|
||||
return null;
|
||||
}
|
||||
public static int getMaxAP(ItemStack artifact) {
|
||||
if (artifact!=null &&
|
||||
artifact.getType()!=Material.AIR &&
|
||||
artifact.hasItemMeta() &&
|
||||
artifact.getItemMeta().hasLore() &&
|
||||
Artifact.isArtifact(artifact)) {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
String apline = lore.get(6);
|
||||
/*int level = getLV(artifact); //This is how many total we have.
|
||||
int apused = 0;
|
||||
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
||||
for (int i=0;i<enchants.values().size();i++) {
|
||||
apused += Iterables.get(enchants.values(), i); //Counts how many levels of each enchantment was applied. This correlates directly with how much AP was used.
|
||||
}
|
||||
return level-apused;*/
|
||||
return Integer.parseInt(((apline.split("/")[1])));
|
||||
}
|
||||
TwosideKeeper.log("Could not get the Max AP value for artifact "+artifact.toString(), 1);
|
||||
return -1;
|
||||
}
|
||||
public static ItemStack addLV(ItemStack artifact, int amt, Player p) {
|
||||
return setLV(artifact,getLV(artifact)+amt,p);
|
||||
}
|
||||
|
@ -39,15 +39,27 @@ public class Check {
|
||||
item.getType()==Material.PAPER &&
|
||||
item.getEnchantmentLevel(Enchantment.LUCK)==1 &&
|
||||
item.getItemMeta().hasLore() &&
|
||||
item.getItemMeta().getLore().size()==5 &&
|
||||
item.getItemMeta().getLore().get(3).equalsIgnoreCase(ChatColor.ITALIC+"Cash into any local bank") &&
|
||||
item.getItemMeta().getLore().get(4).equalsIgnoreCase(ChatColor.ITALIC+"for money!")) {
|
||||
item.getItemMeta().getLore().size()>=5 &&
|
||||
item.getItemMeta().getLore().contains(ChatColor.ITALIC+"Cash into any local bank") &&
|
||||
item.getItemMeta().getLore().contains(ChatColor.ITALIC+"for money!")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static ItemStack createSignedBankCheckItem(double amt, String signedby) {
|
||||
public static boolean isVerifiedBankCheck(ItemStack item) {
|
||||
if (item!=null &&
|
||||
item.getType()==Material.PAPER &&
|
||||
item.getEnchantmentLevel(Enchantment.LUCK)==1 &&
|
||||
item.getItemMeta().hasLore() &&
|
||||
item.getItemMeta().getLore().size()>=5 &&
|
||||
item.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Verified Check")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static ItemStack createSignedBankCheckItem(double amt, String signedby, boolean verified) {
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
ItemStack check = new ItemStack(Material.PAPER);
|
||||
check.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||
@ -56,6 +68,7 @@ public class Check {
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.ITALIC+""+ChatColor.WHITE+"Check for "+ChatColor.YELLOW+"$"+df.format(amt));
|
||||
lore.add(ChatColor.BLUE+"Signed by "+ChatColor.LIGHT_PURPLE+signedby);
|
||||
if (verified) {lore.add(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Verified Check");}
|
||||
lore.add("");
|
||||
lore.add(ChatColor.ITALIC+"Cash into any local bank");
|
||||
lore.add(ChatColor.ITALIC+"for money!");
|
||||
|
@ -35,8 +35,6 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
@ -53,7 +51,8 @@ public class CustomDamage {
|
||||
public static final int CRITICALSTRIKE = 1;
|
||||
public static final int IGNOREDODGE = 2;
|
||||
public static final int TRUEDMG = 4;
|
||||
public static final int SPECIALATTACK = 8; //Used internally to specifically define a special attack.
|
||||
public static final int IGNORE_DAMAGE_TICK = 8; //Ignores damage ticks, which guarantees this attack will land regardless if the player's gotten hit by this before.
|
||||
public static final int SPECIALATTACK = 16; //Used internally to specifically define a special attack.
|
||||
|
||||
//////////////////THE FLAGS BELOW ARE SYSTEM FLAGS!! DO NOT USE THEM!
|
||||
public static final int IS_CRIT = 1; //System Flag. Used for telling a player structure their last hit was a crit.
|
||||
@ -631,9 +630,9 @@ public class CustomDamage {
|
||||
|
||||
private static void rallyNearbyMonsters(Monster m, Player p, double range) {
|
||||
Collection<Entity> nearby =m.getLocation().getWorld().getNearbyEntities(m.getLocation(), range, range, range);
|
||||
for (int i=0;i<nearby.size();i++) {
|
||||
if (Iterables.get(nearby, i) instanceof Monster) {
|
||||
Monster mm = (Monster)(Iterables.get(nearby, i));
|
||||
for (Entity ent : nearby) {
|
||||
if (ent instanceof Monster) {
|
||||
Monster mm = (Monster)ent;
|
||||
mm.setTarget(p);
|
||||
MonsterStructure ms = MonsterStructure.getMonsterStructure(mm);
|
||||
ms.SetTarget(p);
|
||||
@ -746,11 +745,11 @@ public class CustomDamage {
|
||||
* @return Returns true if the target cannot be hit. False otherwise.
|
||||
*/
|
||||
static public boolean InvulnerableCheck(Entity damager, LivingEntity target, int flags) {
|
||||
if (GenericFunctions.enoughTicksHavePassed(target, damager)) {
|
||||
if (isFlagSet(flags,IGNORE_DAMAGE_TICK) || (GenericFunctions.enoughTicksHavePassed(target, damager) && canHitMobDueToWeakness(damager))) {
|
||||
TwosideKeeper.log("Enough ticks have passed.", 5);
|
||||
if (!PassesIframeCheck(target,damager) || isFlagSet(flags,IGNOREDODGE)) {
|
||||
if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) {
|
||||
TwosideKeeper.log("Not in an iframe.", 5);
|
||||
if (!PassesDodgeCheck(target,damager) || isFlagSet(flags,IGNOREDODGE)) {
|
||||
if (isFlagSet(flags,IGNOREDODGE) || !PassesDodgeCheck(target,damager)) {
|
||||
GenericFunctions.updateNoDamageTickMap(target, damager);
|
||||
TwosideKeeper.log("Did not dodge attack.", 5);
|
||||
return false;
|
||||
@ -769,6 +768,21 @@ public class CustomDamage {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean canHitMobDueToWeakness(Entity damager) {
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
if (shooter!=null &&
|
||||
shooter instanceof Player) {
|
||||
Player p = (Player)shooter;
|
||||
if (p.hasPotionEffect(PotionEffectType.WEAKNESS)) {
|
||||
int weaknesslv = GenericFunctions.getPotionEffectLevel(PotionEffectType.WEAKNESS, p);
|
||||
if (weaknesslv>=9) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void calculateGracefulDodgeTicks(LivingEntity target) {
|
||||
if (target instanceof Player) {
|
||||
ItemStack[] equip = GenericFunctions.getEquipment(target);
|
||||
@ -981,9 +995,9 @@ public class CustomDamage {
|
||||
|
||||
//Check for resistance effect.
|
||||
Collection<PotionEffect> target_effects = target.getActivePotionEffects();
|
||||
for (int i=0;i<target_effects.size();i++) {
|
||||
if (Iterables.get(target_effects, i).getType().equals(PotionEffectType.DAMAGE_RESISTANCE)) {
|
||||
resistlevel = Iterables.get(target_effects, i).getAmplifier()+1;
|
||||
for (PotionEffect pe : target_effects) {
|
||||
if (pe.getType().equals(PotionEffectType.DAMAGE_RESISTANCE)) {
|
||||
resistlevel = pe.getAmplifier()+1;
|
||||
TwosideKeeper.log("Resistance level is "+resistlevel,5);
|
||||
}
|
||||
}
|
||||
@ -1378,9 +1392,9 @@ public class CustomDamage {
|
||||
p.sendMessage(ChatColor.DARK_RED+"Headshot! x"+(headshotincrease)+" Damage");
|
||||
if (p.hasPotionEffect(PotionEffectType.SLOW)) {
|
||||
//Add to the current stack of SLOW.
|
||||
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
|
||||
if (Iterables.get(p.getActivePotionEffects(), i1).getType().equals(PotionEffectType.SLOW)) {
|
||||
int lv = Iterables.get(p.getActivePotionEffects(), i1).getAmplifier();
|
||||
for (PotionEffect pe : p.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(PotionEffectType.SLOW)) {
|
||||
int lv = pe.getAmplifier();
|
||||
TwosideKeeper.log("New Slowness level: "+lv,5);
|
||||
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.SLOW,p);
|
||||
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.SLOW,99,lv+1,p);
|
||||
@ -1412,9 +1426,9 @@ public class CustomDamage {
|
||||
if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) {
|
||||
if (m.hasPotionEffect(PotionEffectType.BLINDNESS)) {
|
||||
//Add to the current stack of BLINDNESS.
|
||||
for (int i1=0;i1<m.getActivePotionEffects().size();i1++) {
|
||||
if (Iterables.get(m.getActivePotionEffects(), i1).getType().equals(PotionEffectType.BLINDNESS)) {
|
||||
int lv = Iterables.get(m.getActivePotionEffects(), i1).getAmplifier();
|
||||
for (PotionEffect pe : m.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(PotionEffectType.BLINDNESS)) {
|
||||
int lv = pe.getAmplifier();
|
||||
TwosideKeeper.log("New BLINDNESS level: "+lv,5);
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f+((lv+1)*0.5f));
|
||||
m.removePotionEffect(PotionEffectType.BLINDNESS);
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class EliteMonster {
|
||||
ignoreAllOtherTargets();
|
||||
if (m.isValid() && targetlist.size()>0) {
|
||||
adjustWillpower();
|
||||
weakenTeam();
|
||||
//weakenTeam();
|
||||
retargetInAir();
|
||||
destroyLiquids(2);
|
||||
reapplyGlow();
|
||||
|
@ -169,11 +169,11 @@ public enum ArtifactAbility {
|
||||
}
|
||||
|
||||
private static String LevelCost(int i) {
|
||||
return "\n\n"+ChatColor.RED+"Costs "+i+" Artifact Level"+((i==1)?"":"s");
|
||||
return "\n\n"+ChatColor.RED+"Costs "+i+" AP";
|
||||
}
|
||||
|
||||
private static String TemporarySkill() {
|
||||
return "\n\n"+ChatColor.RED+"Costs 1 Artifact Level.";
|
||||
return "\n\n"+ChatColor.RED+"Consumes 1 Max AP Point when knocked off.";
|
||||
}
|
||||
|
||||
public String GetName() {
|
||||
@ -300,7 +300,7 @@ public enum ArtifactAbility {
|
||||
TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2);
|
||||
item = removeEnchantment(ab,item);
|
||||
}
|
||||
item = AwakenedArtifact.addAP(item, 0);
|
||||
item = AwakenedArtifact.setAP(item, AwakenedArtifact.getLV(item));
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -453,7 +453,7 @@ public enum ArtifactAbility {
|
||||
p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!");
|
||||
if (ability.equals(ArtifactAbility.GRACEFULDODGE)) {
|
||||
//Remove a level from using a temporary ability.
|
||||
AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-10, p);
|
||||
AwakenedArtifact.addAP(item, -9);
|
||||
}
|
||||
int apamt = AwakenedArtifact.getAP(item);
|
||||
if (apamt>0) {
|
||||
|
@ -38,8 +38,6 @@ import org.bukkit.util.Vector;
|
||||
import org.inventivetalent.glow.GlowAPI;
|
||||
import org.inventivetalent.glow.GlowAPI.Color;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import aPlugin.DiscordMessageSender;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
@ -308,12 +306,11 @@ public class GenericFunctions {
|
||||
|
||||
public static int getMaxThornsLevel(LivingEntity e) {
|
||||
int maxlv = 0;
|
||||
ItemStack[] equips = e.getEquipment().getArmorContents();
|
||||
for (int i=0;i<equips.length;i++) {
|
||||
if (equips[i]!=null &&
|
||||
equips[i].getType()!=Material.AIR) {
|
||||
if (equips[i].getEnchantmentLevel(Enchantment.THORNS)>=maxlv) {
|
||||
maxlv = equips[i].getEnchantmentLevel(Enchantment.THORNS);
|
||||
for (ItemStack equip : e.getEquipment().getArmorContents()) {
|
||||
if (equip!=null &&
|
||||
equip.getType()!=Material.AIR) {
|
||||
if (equip.getEnchantmentLevel(Enchantment.THORNS)>=maxlv) {
|
||||
maxlv = equip.getEnchantmentLevel(Enchantment.THORNS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1865,10 +1862,10 @@ public class GenericFunctions {
|
||||
*/
|
||||
public static int CountItems(Inventory it, ItemStack item) {
|
||||
int totalcount=0;
|
||||
for (int i=0;i<it.getSize();i++) {
|
||||
if (it.getItem(i)!=null &&
|
||||
it.getItem(i).isSimilar(item)) {
|
||||
totalcount+=it.getItem(i).getAmount();
|
||||
for (ItemStack i : it.getContents()) {
|
||||
if (i!=null &&
|
||||
i.isSimilar(item)) {
|
||||
totalcount+=i.getAmount();
|
||||
}
|
||||
}
|
||||
return totalcount;
|
||||
@ -1884,17 +1881,17 @@ public class GenericFunctions {
|
||||
*/
|
||||
public static int CountEmptySpace(Inventory it, ItemStack item) {
|
||||
int totalcount=0;
|
||||
for (int i=0;i<it.getSize();i++) {
|
||||
if (it.getItem(i)!=null &&
|
||||
(it.getItem(i).getType()==Material.AIR ||
|
||||
it.getItem(i).isSimilar(item))) {
|
||||
if (it.getItem(i).getAmount()!=item.getMaxStackSize()) {
|
||||
totalcount+=item.getMaxStackSize()-it.getItem(i).getAmount();
|
||||
for (ItemStack i : it.getContents()) {
|
||||
if (i!=null &&
|
||||
(i.getType()==Material.AIR ||
|
||||
i.isSimilar(item))) {
|
||||
if (i.getAmount()!=item.getMaxStackSize()) {
|
||||
totalcount+=item.getMaxStackSize()-i.getAmount();
|
||||
} else {
|
||||
//TwosideKeeper.log("This is equivalent to max stack size of "+item.getMaxStackSize(), 2);
|
||||
//totalcount+=item.getMaxStackSize();
|
||||
}
|
||||
} else if (it.getItem(i)==null) {
|
||||
} else if (i==null) {
|
||||
totalcount+=item.getMaxStackSize();
|
||||
}
|
||||
}
|
||||
@ -1940,9 +1937,9 @@ public class GenericFunctions {
|
||||
if (item.hasItemMeta() &&
|
||||
item.getItemMeta().hasLore()) {
|
||||
//TwosideKeeper.log("This item has lore...", 2);
|
||||
for (int i=0;i<item.getItemMeta().getLore().size();i++) {
|
||||
TwosideKeeper.log("Lore line is: "+item.getItemMeta().getLore().get(i), 5);
|
||||
if (item.getItemMeta().getLore().get(i).contains(ChatColor.GRAY+"Breaks Remaining:")) {
|
||||
for (String line : item.getItemMeta().getLore()) {
|
||||
TwosideKeeper.log("Lore line is: "+line, 5);
|
||||
if (line.contains(ChatColor.GRAY+"Breaks Remaining:")) {
|
||||
TwosideKeeper.log("Item "+item.toString()+" is hardened. Return it!", 5);
|
||||
return true;
|
||||
}
|
||||
@ -1957,9 +1954,9 @@ public class GenericFunctions {
|
||||
if (item.hasItemMeta() &&
|
||||
item.getItemMeta().hasLore()) {
|
||||
//TwosideKeeper.log("This item has lore...", 2);
|
||||
for (int i=0;i<item.getItemMeta().getLore().size();i++) {
|
||||
TwosideKeeper.log("Lore line is: "+item.getItemMeta().getLore().get(i), 5);
|
||||
if (item.getItemMeta().getLore().get(i).contains(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC)) {
|
||||
for (String line : item.getItemMeta().getLore()) {
|
||||
TwosideKeeper.log("Lore line is: "+line, 5);
|
||||
if (line.contains(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC)) {
|
||||
TwosideKeeper.log("Item "+item.toString()+" is obscured and hardened. Return it!", 5);
|
||||
return true;
|
||||
}
|
||||
@ -2085,11 +2082,10 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static boolean AllLeatherArmor(Player p) {
|
||||
ItemStack[] equipment = p.getEquipment().getArmorContents();
|
||||
boolean leather=true;
|
||||
for (int i=0;i<equipment.length;i++) {
|
||||
if (equipment[i]!=null &&
|
||||
!equipment[i].getType().toString().contains("LEATHER")) {
|
||||
for (ItemStack equip : p.getEquipment().getArmorContents()) {
|
||||
if (equip!=null &&
|
||||
!equip.getType().toString().contains("LEATHER")) {
|
||||
leather=false;
|
||||
break;
|
||||
}
|
||||
@ -2323,8 +2319,8 @@ public class GenericFunctions {
|
||||
|
||||
public static int CountDebuffs(Player p) {
|
||||
int debuffcount=0;
|
||||
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
|
||||
if (isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType())) {
|
||||
for (PotionEffect pe : p.getActivePotionEffects()) {
|
||||
if (isBadEffect(pe.getType())) {
|
||||
debuffcount++;
|
||||
}
|
||||
}
|
||||
@ -2364,9 +2360,9 @@ public class GenericFunctions {
|
||||
int stackamt = 0;
|
||||
if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
//Add to the current stack of unluck.
|
||||
for (int i1=0;i1<ent.getActivePotionEffects().size();i1++) {
|
||||
if (Iterables.get(ent.getActivePotionEffects(), i1).getType().equals(PotionEffectType.UNLUCK)) {
|
||||
int lv = Iterables.get(ent.getActivePotionEffects(), i1).getAmplifier();
|
||||
for (PotionEffect pe : ent.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(PotionEffectType.UNLUCK)) {
|
||||
int lv = pe.getAmplifier();
|
||||
ent.removePotionEffect(PotionEffectType.UNLUCK);
|
||||
TwosideKeeper.log("Death mark stack is now T"+(lv+1), 5);
|
||||
stackamt=lv+2;
|
||||
@ -2395,9 +2391,9 @@ public class GenericFunctions {
|
||||
public static int GetDeathMarkAmt(LivingEntity ent) {
|
||||
if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
//Add to the current stack of unluck.
|
||||
for (int i1=0;i1<ent.getActivePotionEffects().size();i1++) {
|
||||
if (Iterables.get(ent.getActivePotionEffects(), i1).getType().equals(PotionEffectType.UNLUCK)) {
|
||||
return Iterables.get(ent.getActivePotionEffects(), i1).getAmplifier()+1;
|
||||
for (PotionEffect pe : ent.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(PotionEffectType.UNLUCK)) {
|
||||
return pe.getAmplifier()+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2630,15 +2626,15 @@ public class GenericFunctions {
|
||||
// Chance: (11-tier)*5
|
||||
//Check for artifacts on all equips.
|
||||
boolean brokeone = false;
|
||||
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||
ItemStack item = p.getEquipment().getArmorContents()[i];
|
||||
for (ItemStack item : p.getEquipment().getArmorContents()) {
|
||||
if (isArtifactEquip(item) &&
|
||||
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
|
||||
TwosideKeeper.log("Found one.",5);
|
||||
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
|
||||
if (Math.random()<=((16-tier)*0.1d)/100d) {
|
||||
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
|
||||
AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
|
||||
//AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
|
||||
AwakenedArtifact.setMaxAP(item, AwakenedArtifact.getMaxAP(item)-1);
|
||||
brokeone=true;
|
||||
break;
|
||||
}
|
||||
@ -2671,10 +2667,10 @@ public class GenericFunctions {
|
||||
|
||||
public static int getPotionEffectLevel(PotionEffectType type, LivingEntity ent) {
|
||||
if (ent.hasPotionEffect(type)) {
|
||||
for (int j=0;j<ent.getActivePotionEffects().size();j++) {
|
||||
if (Iterables.get(ent.getActivePotionEffects(), j).getType().equals(type)) {
|
||||
for (PotionEffect pe : ent.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(type)) {
|
||||
//Get the level.
|
||||
return Iterables.get(ent.getActivePotionEffects(), j).getAmplifier();
|
||||
return pe.getAmplifier();
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("Something went wrong while getting potion effect level of "+type+" for Entity "+ent.getName()+"!", 1);
|
||||
@ -2686,10 +2682,10 @@ public class GenericFunctions {
|
||||
|
||||
public static int getPotionEffectDuration(PotionEffectType type, LivingEntity ent) {
|
||||
if (ent.hasPotionEffect(type)) {
|
||||
for (int j=0;j<ent.getActivePotionEffects().size();j++) {
|
||||
if (Iterables.get(ent.getActivePotionEffects(), j).getType().equals(type)) {
|
||||
for (PotionEffect pe : ent.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(type)) {
|
||||
//Get the level.
|
||||
return Iterables.get(ent.getActivePotionEffects(), j).getDuration();
|
||||
return pe.getDuration();
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("Something went wrong while getting potion effect duration of "+type+" for Entity "+ent.getName()+"!", 1);
|
||||
@ -3045,10 +3041,10 @@ public class GenericFunctions {
|
||||
|
||||
public static void updateSetItemsInInventory(Inventory inv) {
|
||||
TwosideKeeper.log("Inventory is size "+inv.getSize(),5);
|
||||
for (int i=0;i<inv.getSize();i++) {
|
||||
if (inv.getItem(i)!=null) {
|
||||
TwosideKeeper.log("Checking "+inv.getItem(i).toString(), 5);
|
||||
UpdateItemLore(inv.getItem(i));
|
||||
for (ItemStack it : inv.getContents()) {
|
||||
if (it!=null) {
|
||||
TwosideKeeper.log("Checking "+it.toString(), 5);
|
||||
UpdateItemLore(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3093,8 +3089,8 @@ public class GenericFunctions {
|
||||
//This is a special potion. Attempt to update it.
|
||||
boolean newpotion=false;
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
if (lore.get(i).contains(ChatColor.GRAY+"")) {
|
||||
for (String lo : lore) {
|
||||
if (lo.contains(ChatColor.GRAY+"")) {
|
||||
newpotion=true;
|
||||
break;
|
||||
}
|
||||
@ -3109,8 +3105,8 @@ public class GenericFunctions {
|
||||
private static ItemStack AddCustomPotionTag(ItemStack item) {
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
PotionMeta pm = (PotionMeta)item.getItemMeta();
|
||||
for (int i=0;i<pm.getCustomEffects().size();i++) {
|
||||
lore.add(0,ChatColor.GRAY+UserFriendlyPotionEffectTypeName(pm.getCustomEffects().get(i).getType())+" "+WorldShop.toRomanNumeral(pm.getCustomEffects().get(i).getAmplifier()+1)+" ("+WorldShop.toReadableDuration(pm.getCustomEffects().get(i).getDuration())+")");
|
||||
for (PotionEffect pe : pm.getCustomEffects()) {
|
||||
lore.add(0,ChatColor.GRAY+UserFriendlyPotionEffectTypeName(pe.getType())+" "+WorldShop.toRomanNumeral(pe.getAmplifier()+1)+" ("+WorldShop.toReadableDuration(pe.getDuration())+")");
|
||||
}
|
||||
pm.setLore(lore);
|
||||
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
@ -3339,9 +3335,7 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static void setGlowing(Monster m, Color color) {
|
||||
Object[] players = Bukkit.getOnlinePlayers().toArray();
|
||||
for (int i=0;i<players.length;i++) {
|
||||
Player p = (Player)players[i];
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
GlowAPI.setGlowing(m, false, p);
|
||||
if (!GlowAPI.isGlowing(m, p)) {
|
||||
GlowAPI.setGlowing(m, color, p);
|
||||
@ -3352,17 +3346,14 @@ public class GenericFunctions {
|
||||
public static void DealDamageToNearbyPlayers(Location l, double basedmg, int range, boolean knockup, double knockupamt, Entity damager, String reason, boolean truedmg) {
|
||||
List<Player> players = getNearbyPlayers(l,range);
|
||||
//We cleared the non-living entities, deal damage to the rest.
|
||||
for (int i=0;i<players.size();i++) {
|
||||
if (players.get(i) instanceof Player) {
|
||||
Player p = (Player)players.get(i);
|
||||
//TwosideKeeperAPI.DealDamageToEntity(NewCombat.CalculateDamageReduction(((fullcalculation)?NewCombat.CalculateWeaponDamage(damager, p):1.0)*basedmg,p,null), (Player)players.get(i), damager);
|
||||
/*if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack.
|
||||
for (Player p : players) {
|
||||
//TwosideKeeperAPI.DealDamageToEntity(NewCombat.CalculateDamageReduction(((fullcalculation)?NewCombat.CalculateWeaponDamage(damager, p):1.0)*basedmg,p,null), (Player)players.get(i), damager);
|
||||
/*if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack.
|
||||
p.setVelocity(new Vector(0,knockupamt,0));
|
||||
}*/
|
||||
if (CustomDamage.ApplyDamage(basedmg, damager, p, null, reason, (truedmg)?CustomDamage.TRUEDMG:CustomDamage.NONE)) {
|
||||
if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack.
|
||||
p.setVelocity(new Vector(0,knockupamt,0));
|
||||
}*/
|
||||
if (CustomDamage.ApplyDamage(basedmg, damager, p, null, reason, (truedmg)?CustomDamage.TRUEDMG:CustomDamage.NONE)) {
|
||||
if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack.
|
||||
p.setVelocity(new Vector(0,knockupamt,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3427,9 +3418,9 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static EliteMonster getEliteMonster(Monster m) {
|
||||
for (int i=0;i<TwosideKeeper.elitemonsters.size();i++) {
|
||||
if (TwosideKeeper.elitemonsters.get(i).getMonster().equals(m)) {
|
||||
return TwosideKeeper.elitemonsters.get(i);
|
||||
for (EliteMonster em : TwosideKeeper.elitemonsters) {
|
||||
if (em.getMonster().equals(m)) {
|
||||
return em;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -3470,11 +3461,11 @@ public class GenericFunctions {
|
||||
List<Monster> ents = CustomDamage.trimNonMonsterEntities(entities);
|
||||
double closest=9999999d;
|
||||
Monster m = null;
|
||||
for (int i=0;i<ents.size();i++) {
|
||||
double distance = ents.get(i).getLocation().distanceSquared(ent.getLocation());
|
||||
for (Monster enti : ents) {
|
||||
double distance = enti.getLocation().distanceSquared(ent.getLocation());
|
||||
if (distance<closest) {
|
||||
closest = distance;
|
||||
m = ents.get(i);
|
||||
m = enti;
|
||||
}
|
||||
}
|
||||
return m;
|
||||
@ -3604,9 +3595,9 @@ public class GenericFunctions {
|
||||
if (item!=null && isUpgradeShard(item)) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
if (lore.get(i).contains(ChatColor.GOLD+""+ChatColor.BOLD+"T")) {
|
||||
return Integer.valueOf(ChatColor.stripColor(lore.get(i).split(" ")[0].replace("T", "")));
|
||||
for (String lo : lore) {
|
||||
if (lo.contains(ChatColor.GOLD+""+ChatColor.BOLD+"T")) {
|
||||
return Integer.valueOf(ChatColor.stripColor(lo.split(" ")[0].replace("T", "")));
|
||||
}
|
||||
}
|
||||
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T1 Set Upgrade Shard");
|
||||
|
@ -6,12 +6,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
public class ItemCube {
|
||||
public static boolean isSomeoneViewingItemCube(int id, Player checker) {
|
||||
for (int i=0;i<Bukkit.getOnlinePlayers().size();i++) {
|
||||
Player p = Iterables.get(Bukkit.getOnlinePlayers(), i);
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!p.equals(checker)) {
|
||||
if (p.getOpenInventory()!=null && p.getOpenInventory().getTitle().contains("Item Cube #")) {
|
||||
//This is an item cube. Check if it's the same number.
|
||||
@ -25,8 +22,7 @@ public class ItemCube {
|
||||
return false; //Didn't find anyone, oh well..
|
||||
}
|
||||
public static Inventory getViewingItemCubeInventory(int id, Player checker) {
|
||||
for (int i=0;i<Bukkit.getOnlinePlayers().size();i++) {
|
||||
Player p = Iterables.get(Bukkit.getOnlinePlayers(), i);
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!p.equals(checker)) {
|
||||
if (p.getOpenInventory()!=null && p.getOpenInventory().getTitle().contains("Item Cube #"+id)) {
|
||||
//This is an item cube. Check if it's the same number.
|
||||
|
@ -66,7 +66,7 @@ public enum PlayerMode {
|
||||
+ ChatColor.WHITE+"->Slayers can use the Assassination ability. Press the Drop key while looking at an enemy to perform an assassination: You jump directly behind the enemy, gaining 0.5 seconds of invulnerability. If the next hit after Assassination is performed kills the target, you gain 1 Heart (2 Health) back along with a speed and strength buff. These buffs cap at Speed V and Strength X respectively. Assassination cooldown is reset whenever a target is instantly killed in this manner, and you get immediately put back into stealth, preventing further detection from other monsters.\n"),
|
||||
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
|
||||
ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"Summoner mode Perks: "+ChatColor.RESET+"\n"),
|
||||
NORMAL(ChatColor.WHITE,"","",
|
||||
NORMAL(ChatColor.WHITE,"","Normal",
|
||||
"This mode has no perks!");
|
||||
;
|
||||
|
||||
|
@ -35,8 +35,6 @@ import org.bukkit.inventory.meta.Repairable;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import sig.plugin.TwosideKeeper.Artifact;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.WorldShopManager;
|
||||
@ -745,8 +743,7 @@ public class WorldShop {
|
||||
|
||||
boolean item_here=false;
|
||||
Collection<Entity> entities = signloc.getWorld().getNearbyEntities(signloc, 0.2, 0.2, 0.2);
|
||||
for (int i=0;i<entities.size();i++) {
|
||||
Entity e = Iterables.get(entities, i);
|
||||
for (Entity e : entities) {
|
||||
if (e.getType()==EntityType.DROPPED_ITEM) {
|
||||
Item it = (Item)e;
|
||||
|
||||
@ -798,8 +795,7 @@ public class WorldShop {
|
||||
public static void removeShopItem(Sign s, WorldShop shop) {
|
||||
if (isWorldShopSign(s)) {
|
||||
Collection<Entity> nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3);
|
||||
for (int i=0;i<nearby.size();i++) {
|
||||
Entity e = Iterables.get(nearby, i);
|
||||
for (Entity e : nearby) {
|
||||
if (e.getType()==EntityType.DROPPED_ITEM) {
|
||||
TwosideKeeper.log("Found a drop.",5);
|
||||
Item it = (Item)e;
|
||||
@ -833,8 +829,7 @@ public class WorldShop {
|
||||
//See if a drop entity is already here.
|
||||
boolean item_here=false;
|
||||
Collection<Entity> entities = ev.getPlayer().getLocation().getWorld().getNearbyEntities(loc, 1, 1, 1);
|
||||
for (int i=0;i<entities.size();i++) {
|
||||
Entity e = Iterables.get(entities, i);
|
||||
for (Entity e : entities) {
|
||||
TwosideKeeper.log("Entity Location:"+e.getLocation().toString(),5);
|
||||
TwosideKeeper.log("Comparing locations: "+e.getLocation().toString()+":::"+loc.toString(),5);
|
||||
if (e.getType()==EntityType.DROPPED_ITEM) {
|
||||
|
@ -115,6 +115,7 @@ public class PlayerStructure {
|
||||
public boolean crit=false;
|
||||
public int storedbowxp=0;
|
||||
public long lasthittarget=0;
|
||||
public long lastbowmodeswitch=0;
|
||||
|
||||
public boolean isPlayingSpleef=false;
|
||||
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena;
|
||||
|
46
src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java
Normal file
46
src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java
Normal file
@ -0,0 +1,46 @@
|
||||
package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Removes an object from a collection. For thread safe delaying purposes.
|
||||
*
|
||||
*/
|
||||
public class ThreadSafeCollection implements Runnable{
|
||||
|
||||
Collection<? extends Object> obj = null;
|
||||
Object removal = null;
|
||||
Set<? extends Object> obj2 = null;
|
||||
List<? extends Object> obj3 = null;
|
||||
|
||||
public ThreadSafeCollection(Collection<? extends Object> obj, Object remove) {
|
||||
this.obj=obj;
|
||||
this.removal=remove;
|
||||
}
|
||||
|
||||
public ThreadSafeCollection(Set<? extends Object> obj, Object remove) {
|
||||
this.obj2=obj;
|
||||
this.removal=remove;
|
||||
}
|
||||
|
||||
public ThreadSafeCollection(List<? extends Object> obj, Object remove) {
|
||||
this.obj3=obj;
|
||||
this.removal=remove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.obj!=null) {
|
||||
this.obj.remove(this.removal);
|
||||
} else
|
||||
if (this.obj2!=null) {
|
||||
this.obj2.remove(this.removal);
|
||||
} else
|
||||
if (this.obj3!=null) {
|
||||
this.obj3.remove(removal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user