+>Added damage display indicators.
+>Decreased the chance Infinity gets knocked off of Bows. +>Added buff display indicators and improved handling of custom buffs/debuffs. +>Protection enchantment on shields now works properly when calculating Damage Reduction. >Increased Earth Wave artifact ability's level cap from 100 to 10000. >Fixed a bug causing dodge chance to be incorrectly calculated. >Fixed a duping bug with Vacuum Cubes. >Improved efficiency of Filter Cube code so it causes less lag when processing. >Fixed a bug with duplicating ender cubes not working. >Fixed a bug with Tumble cooldown being incorrect visually when the player also had Cooldown Reduction. >Re-did handling of Death Mark stack application. Now works on all enemies.
This commit is contained in:
parent
44c1d79072
commit
ec0fb8e22b
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: TwosideKeeper
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.10.9e
|
||||
version: 3.10.9f
|
||||
loadbefore: [aPlugin]
|
||||
commands:
|
||||
money:
|
||||
|
@ -1,6 +1,9 @@
|
||||
package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -20,6 +23,7 @@ public class ActionBarBuffUpdater{
|
||||
}
|
||||
}
|
||||
actionbardisplay.append(AddAdditionalEffects(p));
|
||||
//TwosideKeeper.log(actionbardisplay.toString(), 0);
|
||||
if (actionbardisplay.toString().contains(" ")) {
|
||||
return actionbardisplay.toString().substring(0, actionbardisplay.toString().lastIndexOf(" "));
|
||||
} else {
|
||||
@ -32,42 +36,69 @@ public class ActionBarBuffUpdater{
|
||||
if (p instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)p);
|
||||
if (p.getFireTicks()>=20) {
|
||||
effectString.append(ChatColor.GOLD+"⚠");
|
||||
effectString.append(ChatColor.GOLD);
|
||||
effectString.append("⚠");
|
||||
effectString.append(AppendAmplifier((p.getFireTicks()/20)-1,false));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.lifestealstacks>4) {
|
||||
effectString.append(ChatColor.AQUA+"❣");
|
||||
effectString.append(ChatColor.AQUA);
|
||||
effectString.append("❣");
|
||||
effectString.append(AppendAmplifier(pd.lifestealstacks-1));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.weaponcharges>4) {
|
||||
effectString.append(ChatColor.DARK_AQUA+"☤");
|
||||
effectString.append(ChatColor.DARK_AQUA);
|
||||
effectString.append("☤");
|
||||
effectString.append(AppendAmplifier(pd.weaponcharges-1));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.damagepool>4) {
|
||||
effectString.append(ChatColor.DARK_PURPLE+"♥");
|
||||
effectString.append(ChatColor.DARK_PURPLE);
|
||||
effectString.append("♥");
|
||||
effectString.append(AppendAmplifier((int)(pd.damagepool-1)));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime() &&
|
||||
ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
||||
effectString.append(ChatColor.GRAY+"☉");
|
||||
effectString.append(ChatColor.GRAY);
|
||||
effectString.append("☉");
|
||||
effectString.append(AppendAmplifier(((int)((pd.lastvendettastack+200)-TwosideKeeper.getServerTickTime())/20)-1,false));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.swiftaegisamt>4) {
|
||||
effectString.append(ChatColor.YELLOW+"❈");
|
||||
effectString.append(ChatColor.YELLOW);
|
||||
effectString.append("❈");
|
||||
effectString.append(AppendAmplifier((int)(GenericFunctions.getSwiftAegisAmt((Player)p)-1)));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.regenpool>0) {
|
||||
effectString.append(ChatColor.BLUE+""+ChatColor.BOLD+"✙");
|
||||
effectString.append(ChatColor.BLUE);
|
||||
effectString.append(ChatColor.BOLD);
|
||||
effectString.append("✙");
|
||||
effectString.append(AppendAmplifier((int)(pd.regenpool)));
|
||||
effectString.append(" ");
|
||||
}
|
||||
}
|
||||
HashMap<String,Buff> buffMap = Buff.getBuffData(p);
|
||||
for (String s : buffMap.keySet()) {
|
||||
Buff b = buffMap.get(s);
|
||||
|
||||
if (b.getRemainingBuffTime()>0) {
|
||||
effectString.append(b.getBuffIcon());
|
||||
effectString.append(" ");
|
||||
if (p instanceof Player) {
|
||||
effectString.append(b.getDisplayName());
|
||||
}
|
||||
effectString.append(ConvertBuffAmplifierToIcon(b.getAmplifier()));
|
||||
effectString.append(" ");
|
||||
if (b.getRemainingBuffTime()<=200) {
|
||||
effectString.append(ConvertBuffTimeToIcon(b.getRemainingBuffTime()));
|
||||
}
|
||||
effectString.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
if (effectString.length()>0) {
|
||||
return effectString.toString()+ChatColor.RESET;
|
||||
} else {
|
||||
@ -75,33 +106,115 @@ public class ActionBarBuffUpdater{
|
||||
}
|
||||
}
|
||||
|
||||
private static String ConvertBuffAmplifierToIcon(int amplifier) {
|
||||
if (amplifier==1) {
|
||||
return "Ⅰ";
|
||||
} else
|
||||
if (amplifier==2) {
|
||||
return "Ⅱ";
|
||||
} else
|
||||
if (amplifier==3) {
|
||||
return "Ⅲ";
|
||||
} else
|
||||
if (amplifier==4) {
|
||||
return "Ⅳ";
|
||||
} else
|
||||
if (amplifier==5) {
|
||||
return "Ⅴ";
|
||||
} else
|
||||
if (amplifier==6) {
|
||||
return "Ⅵ";
|
||||
} else
|
||||
if (amplifier==7) {
|
||||
return "Ⅶ";
|
||||
} else
|
||||
if (amplifier==8) {
|
||||
return "Ⅷ";
|
||||
} else
|
||||
if (amplifier==9) {
|
||||
return "Ⅸ";
|
||||
} else
|
||||
if (amplifier==10) {
|
||||
return "Ⅹ";
|
||||
} else
|
||||
if (amplifier==11) {
|
||||
return "Ⅺ";
|
||||
} else
|
||||
if (amplifier==12) {
|
||||
return "Ⅻ";
|
||||
} else {
|
||||
return Integer.toString(amplifier);
|
||||
}
|
||||
}
|
||||
|
||||
private static String ConvertBuffTimeToIcon(long remainingBuffTime) {
|
||||
if (remainingBuffTime>180) {
|
||||
return "➓";
|
||||
} else
|
||||
if (remainingBuffTime>160) {
|
||||
return "➒";
|
||||
} else
|
||||
if (remainingBuffTime>140) {
|
||||
return "➑";
|
||||
} else
|
||||
if (remainingBuffTime>120) {
|
||||
return "➐";
|
||||
} else
|
||||
if (remainingBuffTime>100) {
|
||||
return "➏";
|
||||
} else
|
||||
if (remainingBuffTime>80) {
|
||||
return "➎";
|
||||
} else
|
||||
if (remainingBuffTime>60) {
|
||||
return "➍";
|
||||
} else
|
||||
if (remainingBuffTime>40) {
|
||||
return "➌";
|
||||
} else
|
||||
if (remainingBuffTime>20) {
|
||||
return "➋";
|
||||
} else
|
||||
{
|
||||
return "➊";
|
||||
}
|
||||
}
|
||||
|
||||
private static String ParseEffect(LivingEntity p, PotionEffect pe) {
|
||||
StringBuilder effectString=new StringBuilder("");
|
||||
PotionEffectType pet = pe.getType();
|
||||
if (pet.equals(PotionEffectType.INCREASE_DAMAGE)) {
|
||||
effectString.append(ChatColor.GOLD+"⚔");
|
||||
effectString.append(ChatColor.GOLD);
|
||||
effectString.append("⚔");
|
||||
} else
|
||||
if (pet.equals(PotionEffectType.DAMAGE_RESISTANCE)) {
|
||||
effectString.append(ChatColor.BLUE+"❈");
|
||||
effectString.append(ChatColor.BLUE);
|
||||
effectString.append("❈");
|
||||
} else
|
||||
if (pet.equals(PotionEffectType.REGENERATION)) {
|
||||
effectString.append(ChatColor.GREEN+"✙");
|
||||
effectString.append(ChatColor.GREEN);
|
||||
effectString.append("✙");
|
||||
} else
|
||||
if (pet.equals(PotionEffectType.SPEED)) {
|
||||
effectString.append(ChatColor.WHITE+"➠");
|
||||
effectString.append(ChatColor.WHITE);
|
||||
effectString.append("➠");
|
||||
} else
|
||||
if (pet.equals(PotionEffectType.POISON) ||
|
||||
(pet.equals(PotionEffectType.BLINDNESS) && (p instanceof LivingEntity && !(p instanceof Player)))) {
|
||||
effectString.append(ChatColor.YELLOW+"☣");
|
||||
} else
|
||||
if ((pet.equals(PotionEffectType.UNLUCK) && (p instanceof LivingEntity && !(p instanceof Player)))) {
|
||||
effectString.append(ChatColor.DARK_RED+"☠");
|
||||
effectString.append(ChatColor.YELLOW);
|
||||
effectString.append("☣");
|
||||
} else
|
||||
/*if ((pet.equals(PotionEffectType.UNLUCK) && (p instanceof LivingEntity && !(p instanceof Player)))) {
|
||||
effectString.append(ChatColor.DARK_RED);
|
||||
effectString.append("☠");
|
||||
} else*/
|
||||
if (pet.equals(PotionEffectType.SLOW)) {
|
||||
effectString.append(ChatColor.DARK_AQUA+"♒");
|
||||
effectString.append(ChatColor.DARK_AQUA);
|
||||
effectString.append("♒");
|
||||
} else
|
||||
if (pet.equals(PotionEffectType.WEAKNESS) || pet.equals(PotionEffectType.SLOW_DIGGING)) {
|
||||
effectString.append(ChatColor.RED+"✘");
|
||||
effectString.append(ChatColor.RED);
|
||||
effectString.append("✘");
|
||||
}
|
||||
if (effectString.length()>0) {
|
||||
effectString.append(AppendAmplifier(pe.getAmplifier()));
|
||||
|
@ -41,7 +41,7 @@ public class BossMonster {
|
||||
this.m = m;
|
||||
this.damagereduction=0.0;
|
||||
this.buffs=null;
|
||||
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd;
|
||||
this.movespd=LivingEntityStructure.GetLivingEntityStructure(m).original_movespd;
|
||||
this.hp_regen=0;
|
||||
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class BossMonster {
|
||||
this.attackstrength = attackstrength;
|
||||
this.m = m;
|
||||
this.buffs=null;
|
||||
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd;
|
||||
this.movespd=LivingEntityStructure.GetLivingEntityStructure(m).original_movespd;
|
||||
this.hp_regen=0;
|
||||
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class BossMonster {
|
||||
this.attackstrength = attackstrength;
|
||||
this.m = m;
|
||||
this.buffs = buffs;
|
||||
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd;
|
||||
this.movespd=LivingEntityStructure.GetLivingEntityStructure(m).original_movespd;
|
||||
this.hp_regen=0;
|
||||
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
|
||||
}
|
||||
|
@ -1,10 +1,186 @@
|
||||
package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
|
||||
|
||||
public class Buff {
|
||||
String displayName;
|
||||
long expireTime;
|
||||
int level;
|
||||
Color col;
|
||||
private String displayName;
|
||||
private long expireTime;
|
||||
private int level;
|
||||
private Color col;
|
||||
private String icon;
|
||||
|
||||
public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon) {
|
||||
this.displayName=displayName;
|
||||
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
|
||||
this.level=amplifier;
|
||||
this.col=buffcolor;
|
||||
this.icon=icon;
|
||||
}
|
||||
|
||||
public static boolean hasBuffInHashMap(LivingEntity l, String name) {
|
||||
if (l instanceof Player) {
|
||||
Player p = (Player)l;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
return pd.buffs.containsKey(name);
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
return les.buffs.containsKey(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasBuff(LivingEntity l, String name) {
|
||||
if (l instanceof Player) {
|
||||
Player p = (Player)l;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.buffs.containsKey(name)) {
|
||||
Buff b = pd.buffs.get(name);
|
||||
return hasBuffExpired(b);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
if (les.buffs.containsKey(name)) {
|
||||
Buff b = les.buffs.get(name);
|
||||
return hasBuffExpired(b);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void outputBuffs(LivingEntity l) {
|
||||
if (l instanceof Player) {
|
||||
Player p = (Player)l;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
TwosideKeeper.log(TextUtils.outputHashmap(pd.buffs),0);
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
TwosideKeeper.log(TextUtils.outputHashmap(les.buffs),0);
|
||||
}
|
||||
}
|
||||
|
||||
public static HashMap<String,Buff>getBuffData(LivingEntity l) {
|
||||
if (l instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
|
||||
return pd.buffs;
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
return les.buffs;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <b>null</b> if no buff found! Use <b>hasBuff()</b> to verify they have
|
||||
* a buff beforehand.
|
||||
*/
|
||||
public static Buff getBuff(LivingEntity l, String name) {
|
||||
if (hasBuff(l,name)) {
|
||||
if (l instanceof Player) {
|
||||
Player p = (Player)l;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.buffs.containsKey(name)) {
|
||||
return pd.buffs.get(name);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
if (les.buffs.containsKey(name)) {
|
||||
Buff b = les.buffs.get(name);
|
||||
return b;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static void addBuff(LivingEntity l, String name, Buff buff) {
|
||||
if (l instanceof Player) {
|
||||
Player p = (Player)l;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.buffs.put(name, buff);
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
les.buffs.put(name, buff);
|
||||
}
|
||||
}
|
||||
public static void removeBuff(LivingEntity l, String name) {
|
||||
if (l instanceof Player) {
|
||||
Player p = (Player)l;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.buffs.remove(name);
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
les.buffs.remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void increaseStacks(int amt) {
|
||||
level+=amt;
|
||||
}
|
||||
public void decreaseStacks(int amt) {
|
||||
level-=amt;
|
||||
}
|
||||
public void setStacks(int amt) {
|
||||
level=amt;
|
||||
}
|
||||
public void increaseDuration(int duration) {
|
||||
expireTime+=duration;
|
||||
}
|
||||
public void decreaseDuration(int duration) {
|
||||
expireTime-=duration;
|
||||
}
|
||||
public void setDuration(int duration) {
|
||||
refreshDuration(duration);
|
||||
}
|
||||
public void refreshDuration(int duration) {
|
||||
expireTime=TwosideKeeper.getServerTickTime()+duration;
|
||||
}
|
||||
|
||||
private static boolean hasBuffExpired(Buff b) {
|
||||
if (b.expireTime<TwosideKeeper.getServerTickTime()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public long getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public int getAmplifier() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public Color getBuffParticleColor() {
|
||||
return col;
|
||||
}
|
||||
|
||||
public long getRemainingBuffTime() {
|
||||
return Math.max(expireTime-TwosideKeeper.getServerTickTime(),0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Buff(Name="+displayName+",Time="+expireTime+",Level="+level+",Color="+col+",Icon="+getBuffIcon()+")";
|
||||
}
|
||||
|
||||
public String getBuffIcon() {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ public class CustomDamage {
|
||||
}
|
||||
if (getDamagerEntity(damager) instanceof LivingEntity) {
|
||||
LivingEntity m = getDamagerEntity(damager);
|
||||
LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure md = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
md.SetTarget(target);
|
||||
}
|
||||
increaseStrikerSpeed(p);
|
||||
@ -631,16 +631,16 @@ public class CustomDamage {
|
||||
}
|
||||
|
||||
final List<LivingEntity> finallist = hitlist;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
|
||||
/*Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
|
||||
public void run() {
|
||||
for (LivingEntity le : finallist) {
|
||||
if (le!=null && !le.isDead() && !le.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
GenericFunctions.ResetMobName(le);
|
||||
if (le!=null && !le.isDead() && !Buff.hasBuff(le, "DeathMark")) {
|
||||
LivingEntityStructure.UpdateMobName(le);
|
||||
//They don't have death marks anymore, so we just remove their name color.
|
||||
}
|
||||
}
|
||||
}}
|
||||
,100);
|
||||
,100);*/
|
||||
|
||||
increaseSwordComboCount(weapon, p);
|
||||
}
|
||||
@ -732,7 +732,7 @@ public class CustomDamage {
|
||||
private static double IncreaseDamageDealtByElites(Player p, Entity damager, double damage) {
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
if (shooter!=null) {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(shooter);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(shooter);
|
||||
if (les.isElite) {
|
||||
for (EliteMonster bm : TwosideKeeper.elitemonsters) {
|
||||
if (bm.getMonster().getUniqueId().equals(shooter.getUniqueId())) {
|
||||
@ -1177,7 +1177,7 @@ public class CustomDamage {
|
||||
private static void triggerEliteBreakEvent(LivingEntity target) {
|
||||
if (target instanceof Monster &&
|
||||
TwosideKeeper.livingentitydata.containsKey(target.getUniqueId())) {
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure((LivingEntity)target);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)target);
|
||||
if (ms.getElite()) {
|
||||
boolean exists=false;
|
||||
for (int i=0;i<TwosideKeeper.elitemonsters.size();i++) {
|
||||
@ -1223,7 +1223,7 @@ public class CustomDamage {
|
||||
private static void triggerEliteHitEvent(Player p, LivingEntity target, double dmg) {
|
||||
if (target instanceof Monster &&
|
||||
TwosideKeeper.livingentitydata.containsKey(target.getUniqueId())) {
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure((Monster)target);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure((Monster)target);
|
||||
if (ms.getElite()) {
|
||||
boolean exists=false;
|
||||
for (int i=0;i<TwosideKeeper.elitemonsters.size();i++) {
|
||||
@ -1400,7 +1400,7 @@ public class CustomDamage {
|
||||
}
|
||||
|
||||
static void leaderRallyNearbyMonsters(Monster m, Player p) {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if ((MonsterController.isZombieLeader(m) || (
|
||||
m.getCustomName()!=null && m.getCustomName().contains(ChatColor.MAGIC+"")
|
||||
)) &&
|
||||
@ -1416,7 +1416,7 @@ public class CustomDamage {
|
||||
if (ent instanceof Monster) {
|
||||
Monster mm = (Monster)ent;
|
||||
mm.setTarget(p);
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(mm);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(mm);
|
||||
ms.SetTarget(p);
|
||||
ms.hasRallied=true;
|
||||
}
|
||||
@ -1623,7 +1623,7 @@ public class CustomDamage {
|
||||
|
||||
if (damager instanceof Monster) {
|
||||
Monster m = (Monster)damager;
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if (les.isElite) {
|
||||
for (EliteMonster em : TwosideKeeper.elitemonsters) {
|
||||
if (em.m.equals(m)) {
|
||||
@ -1896,7 +1896,7 @@ public class CustomDamage {
|
||||
double artifactmult = 0;
|
||||
|
||||
if (target instanceof LivingEntity) {
|
||||
ItemStack[] armor = GenericFunctions.getArmor(target);
|
||||
ItemStack[] armor = GenericFunctions.getEquipment(target,true);
|
||||
if (target instanceof Player) {
|
||||
Player p = (Player)target;
|
||||
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), p, ItemSet.DARNYS, 2, 2)/100d;
|
||||
@ -1910,7 +1910,7 @@ public class CustomDamage {
|
||||
darknessdiv += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH)/100d;
|
||||
}
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(target);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
if (!les.checkedforcubes) {
|
||||
LivingEntityDifficulty diff = EntityUtils.GetStrongestNearbyEntityDifficulty(EntityType.MAGMA_CUBE, target, 4);
|
||||
double reduction = 0.0d;
|
||||
|
@ -67,6 +67,7 @@ import net.minecraft.server.v1_9_R1.TileEntityHopper;
|
||||
import sig.plugin.TwosideKeeper.ActionBarBuffUpdater;
|
||||
import sig.plugin.TwosideKeeper.Artifact;
|
||||
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
||||
import sig.plugin.TwosideKeeper.Buff;
|
||||
import sig.plugin.TwosideKeeper.CustomDamage;
|
||||
import sig.plugin.TwosideKeeper.EliteMonster;
|
||||
import sig.plugin.TwosideKeeper.MonsterController;
|
||||
@ -91,6 +92,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||
@ -123,12 +125,7 @@ public class GenericFunctions {
|
||||
|
||||
public static ItemStack breakHardenedItem(ItemStack item, Player p) {
|
||||
|
||||
StackTraceElement[] stacktrace = new Throwable().getStackTrace();
|
||||
StringBuilder stack = new StringBuilder("Mini stack tracer:");
|
||||
for (int i=0;i<Math.min(10, stacktrace.length);i++) {
|
||||
stack.append("\n"+stacktrace[i].getClassName()+": **"+stacktrace[i].getFileName()+"** "+stacktrace[i].getMethodName()+"():"+stacktrace[i].getLineNumber());
|
||||
}
|
||||
TwosideKeeper.log("Trace:"+stack, 0);
|
||||
showStackTrace();
|
||||
int break_count = getHardenedItemBreaks(item);
|
||||
if (break_count>0) {
|
||||
ItemMeta m = item.getItemMeta();
|
||||
@ -189,6 +186,10 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
private static void showStackTrace() {
|
||||
DebugUtils.showStackTrace();
|
||||
}
|
||||
|
||||
public static ItemStack convertArtifactToDust(ItemStack item) {
|
||||
//Add one line of lore to indicate it's broken dust.
|
||||
item = addObscureHardenedItemBreaks(item,1);
|
||||
@ -2195,7 +2196,8 @@ public class GenericFunctions {
|
||||
item.getType()!=Material.AIR && (item.getType().toString().contains("BOOTS") ||
|
||||
item.getType().toString().contains("CHESTPLATE") ||
|
||||
item.getType().toString().contains("LEGGINGS") ||
|
||||
item.getType().toString().contains("HELMET"))) {
|
||||
item.getType().toString().contains("HELMET") ||
|
||||
item.getType().toString().contains("SHIELD"))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -2291,8 +2293,8 @@ public class GenericFunctions {
|
||||
((Guardian)m).isElder()) ||
|
||||
m.getType()==EntityType.ENDER_DRAGON ||
|
||||
m.getType()==EntityType.WITHER ||
|
||||
LivingEntityStructure.getLivingEntityStructure(m).getLeader() ||
|
||||
LivingEntityStructure.getLivingEntityStructure(m).getElite()) {
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).getLeader() ||
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).getElite()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -2510,7 +2512,7 @@ public class GenericFunctions {
|
||||
|
||||
public static void ApplyDeathMark(LivingEntity ent) {
|
||||
int stackamt = 0;
|
||||
if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
/*if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
//Add to the current stack of unluck.
|
||||
for (PotionEffect pe : ent.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(PotionEffectType.UNLUCK)) {
|
||||
@ -2527,8 +2529,22 @@ public class GenericFunctions {
|
||||
TwosideKeeper.log("Death mark stack is now T1", 5);
|
||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.UNLUCK,99,0));
|
||||
stackamt=1;
|
||||
}
|
||||
}*/
|
||||
//Modify the color of the name of the monster.
|
||||
HashMap<String,Buff> buffdata = Buff.getBuffData(ent);
|
||||
if (Buff.hasBuff(ent, "DeathMark")) {
|
||||
Buff deathmarkBuff = buffdata.get("DeathMark");
|
||||
deathmarkBuff.increaseStacks(1);
|
||||
deathmarkBuff.refreshDuration(99);
|
||||
stackamt = deathmarkBuff.getAmplifier();
|
||||
} else {
|
||||
buffdata.put("DeathMark", new Buff("Death Mark",99,1,org.bukkit.Color.MAROON,ChatColor.DARK_RED+"☠"));
|
||||
stackamt = 1;
|
||||
}
|
||||
RefreshBuffColor(ent, stackamt);
|
||||
}
|
||||
|
||||
public static void RefreshBuffColor(LivingEntity ent, int stackamt) {
|
||||
if (ent instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)ent;
|
||||
m.setCustomNameVisible(true);
|
||||
@ -2541,35 +2557,20 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static int GetDeathMarkAmt(LivingEntity ent) {
|
||||
if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
/*if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) {
|
||||
//Add to the current stack of unluck.
|
||||
for (PotionEffect pe : ent.getActivePotionEffects()) {
|
||||
if (pe.getType().equals(PotionEffectType.UNLUCK)) {
|
||||
return pe.getAmplifier()+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
HashMap<String,Buff> buffdata = Buff.getBuffData(ent);
|
||||
if (Buff.hasBuff(ent, "DeathMark")) {
|
||||
return buffdata.get("DeathMark").getAmplifier();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void ResetMobName(LivingEntity ent) {
|
||||
if (ent instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)ent;
|
||||
m.setCustomNameVisible(false);
|
||||
if (m.getCustomName()!=null) {
|
||||
m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
|
||||
if (m.getCustomName().contains("Dangerous")) {
|
||||
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
|
||||
}
|
||||
if (m.getCustomName().contains("Deadly")) {
|
||||
m.setCustomName(ChatColor.GOLD+m.getCustomName());
|
||||
}
|
||||
if (m.getCustomName().contains("Hellfire")) {
|
||||
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
|
||||
}
|
||||
CustomDamage.appendDebuffsToName(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack RemovePermEnchantmentChance(ItemStack item, Player p) {
|
||||
@ -2588,7 +2589,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)));
|
||||
}
|
||||
if (infinitylv>0 && Math.random()<=0.005*(isHarvestingTool(item)?0.75:1d)) {
|
||||
if (infinitylv>0 && Math.random()<=0.0015*(isHarvestingTool(item)?0.75:1d)) {
|
||||
infinitylv--;
|
||||
if (infinitylv>0) {
|
||||
item.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, infinitylv);
|
||||
@ -2872,7 +2873,7 @@ public class GenericFunctions {
|
||||
Bukkit.getPluginManager().callEvent(ev);
|
||||
if (!ev.isCancelled()) {
|
||||
pd.last_dodge=TwosideKeeper.getServerTickTime();
|
||||
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
|
||||
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.DODGE_COOLDOWN,p));
|
||||
SoundUtils.playLocalSound(p, Sound.ENTITY_DONKEY_CHEST, 1.0f, 1.0f);
|
||||
|
||||
int dodgeduration = 20;
|
||||
@ -3049,7 +3050,7 @@ public class GenericFunctions {
|
||||
} else
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)entity;
|
||||
LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure md = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if (damager!=null) {
|
||||
if (damager instanceof Projectile) {
|
||||
if (CustomDamage.getDamagerEntity(damager)!=null) {
|
||||
@ -3094,7 +3095,7 @@ public class GenericFunctions {
|
||||
} else
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)entity;
|
||||
LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure md = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if (damager!=null) {
|
||||
if (damager instanceof Player) {
|
||||
Player p = (Player)damager;
|
||||
@ -3131,7 +3132,7 @@ public class GenericFunctions {
|
||||
} else
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)entity;
|
||||
LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure md = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if (damager!=null) {
|
||||
if (damager instanceof Projectile) {
|
||||
if (CustomDamage.getDamagerEntity(damager)!=null) {
|
||||
@ -3698,7 +3699,6 @@ public class GenericFunctions {
|
||||
return revived;
|
||||
}
|
||||
|
||||
//TODO Fix Bauble Breaking.
|
||||
public static void RandomlyBreakBaubles(Player p) {
|
||||
/*for (int i=0;i<9;i++) {
|
||||
ItemSet set = ItemSet.GetSet(hotbar[i]);
|
||||
@ -3919,7 +3919,7 @@ public class GenericFunctions {
|
||||
GlowAPI.setGlowing(m, color, p);
|
||||
}
|
||||
}*/
|
||||
LivingEntityStructure.getLivingEntityStructure(m).setGlobalGlow(color);
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).setGlobalGlow(color);
|
||||
}
|
||||
|
||||
public static void DealDamageToNearbyPlayers(Location l, double basedmg, int range, boolean knockup, double knockupamt, Entity damager, String reason, boolean truedmg) {
|
||||
@ -4037,7 +4037,7 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static boolean isEliteMonster(LivingEntity m) {
|
||||
LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure md = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
return md.getElite();
|
||||
}
|
||||
|
||||
@ -4717,8 +4717,8 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static boolean isSpecialGlowMonster(Monster m) {
|
||||
return LivingEntityStructure.getLivingEntityStructure(m).isLeader ||
|
||||
LivingEntityStructure.getLivingEntityStructure(m).isElite;
|
||||
return LivingEntityStructure.GetLivingEntityStructure(m).isLeader ||
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).isElite;
|
||||
}
|
||||
|
||||
public static boolean isSuppressed(Entity ent) {
|
||||
@ -4764,7 +4764,7 @@ public class GenericFunctions {
|
||||
}
|
||||
if (ent instanceof LivingEntity) {
|
||||
//MonsterStructure.getMonsterStructure((Monster)ent).setGlobalGlow(GlowAPI.Color.BLACK);
|
||||
LivingEntityStructure.getLivingEntityStructure((LivingEntity)ent).UpdateGlow();
|
||||
LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ent).UpdateGlow();
|
||||
} else {
|
||||
GlowAPI.setGlowing(ent, GlowAPI.Color.BLACK, Bukkit.getOnlinePlayers());
|
||||
}
|
||||
|
@ -46,5 +46,7 @@ public class RecyclingCenterNode {
|
||||
return loc;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return "RecyclingCenterNode(x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")";
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
|
||||
public class ArrayUtils {
|
||||
public static String toString(Object[] items) {
|
||||
StringBuilder string = new StringBuilder();
|
||||
@ -21,4 +24,32 @@ public class ArrayUtils {
|
||||
}
|
||||
return string.toString();
|
||||
}
|
||||
|
||||
public static String[] combineArguments(String[] args) {
|
||||
List<String> newargs = new ArrayList<String>();
|
||||
String collective = "";
|
||||
Character lookingfor = ' ';
|
||||
for (int i=0;i<args.length;i++) {
|
||||
if ((args[i].charAt(0)=='\"' ||
|
||||
args[i].charAt(0)=='\'') &&
|
||||
collective.length()==0) {
|
||||
collective = args[i].substring(Math.min(args[i].length(),1), args[i].length());
|
||||
lookingfor = args[i].charAt(0);
|
||||
} else
|
||||
if (collective.length()>0) {
|
||||
if (args[i].charAt(args[i].length()-2)!='\\' && args[i].charAt(args[i].length()-1)==lookingfor) {
|
||||
collective = collective + " " + args[i].substring(0, Math.max(0,args[i].length()-1));
|
||||
newargs.add(collective);
|
||||
collective = "";
|
||||
lookingfor = ' ';
|
||||
} else {
|
||||
collective = collective + " " + args[i];
|
||||
TwosideKeeper.log(collective, 0);
|
||||
}
|
||||
} else {
|
||||
newargs.add(args[i]);
|
||||
}
|
||||
}
|
||||
return newargs.toArray(new String[newargs.size()]);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
|
||||
public class DebugUtils {
|
||||
|
||||
public static void showStackTrace() {
|
||||
StackTraceElement[] stacktrace = new Throwable().getStackTrace();
|
||||
StringBuilder stack = new StringBuilder("Mini stack tracer:");
|
||||
for (int i=0;i<Math.min(10, stacktrace.length);i++) {
|
||||
stack.append("\n"+stacktrace[i].getClassName()+": **"+stacktrace[i].getFileName()+"** "+stacktrace[i].getMethodName()+"():"+stacktrace[i].getLineNumber());
|
||||
}
|
||||
TwosideKeeper.log("Trace:"+stack, 0);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -16,11 +17,14 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import sig.plugin.TwosideKeeper.Buff;
|
||||
import sig.plugin.TwosideKeeper.LivingEntityStructure;
|
||||
import sig.plugin.TwosideKeeper.MonsterController;
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CloudRunnable;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
|
||||
public class EntityUtils {
|
||||
public static int CountNearbyEntityType(EntityType type, Entity ent, double range) {
|
||||
@ -37,8 +41,8 @@ public class EntityUtils {
|
||||
List<Entity> ents = ent.getNearbyEntities(range, range, range);
|
||||
LivingEntityDifficulty strongest = null;
|
||||
for (Entity e : ents) {
|
||||
if (e instanceof LivingEntity) {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure((LivingEntity)e);
|
||||
if (e instanceof LivingEntity && !(e instanceof Player)) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)e);
|
||||
les.checkedforcubes=true;
|
||||
LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty((LivingEntity)e);
|
||||
if (e!=null && e.getType()==type && (strongest==null || !strongest.isStronger(diff))) {
|
||||
@ -83,10 +87,79 @@ public class EntityUtils {
|
||||
return aec;
|
||||
}
|
||||
|
||||
public static void createPotionEffectSwirls(LivingEntity l,Color col) {
|
||||
public static void createPotionEffectSwirls(LivingEntity l, Color col, int delay) {
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
|
||||
AreaEffectCloud aec = (AreaEffectCloud)l.getWorld().spawnEntity(l.getLocation(), EntityType.AREA_EFFECT_CLOUD);
|
||||
aec.setColor(col);
|
||||
aec.setDuration(5);
|
||||
aec.setRadius(0.1f);
|
||||
},delay);
|
||||
}
|
||||
|
||||
public static void applyBuff(LivingEntity l, String buffname, Buff buff) {
|
||||
HashMap<String,Buff> buffMap;
|
||||
if (l instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
|
||||
buffMap = pd.buffs;
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
buffMap = les.buffs;
|
||||
}
|
||||
buffMap.put(buffname, buff);
|
||||
updateBuffDisplay(l);
|
||||
}
|
||||
|
||||
public static void applyBuffs(LivingEntity l, String[] buffnames, Buff ... buffArr) {
|
||||
HashMap<String,Buff> buffMap;
|
||||
if (buffnames.length==buffArr.length) {
|
||||
if (l instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
|
||||
buffMap = pd.buffs;
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
buffMap = les.buffs;
|
||||
}
|
||||
for (int i=0;i<buffArr.length;i++) {
|
||||
buffMap.put(buffnames[i], buffArr[i]);
|
||||
}
|
||||
updateBuffDisplay(l);
|
||||
} else {
|
||||
TwosideKeeper.log("ERROR!! The number of buff names does not match the size of applied buffArr! Size of buffnames: "+buffnames.length+"; Size of buffArr: "+buffArr.length, 0);
|
||||
DebugUtils.showStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeBuff(LivingEntity l, String buffName) {
|
||||
HashMap<String,Buff> buffMap;
|
||||
if (l instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
|
||||
buffMap = pd.buffs;
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
buffMap = les.buffs;
|
||||
}
|
||||
buffMap.remove(buffName);
|
||||
updateBuffDisplay(l);
|
||||
}
|
||||
|
||||
public static void removeBuffs(LivingEntity l, String ... buffNames) {
|
||||
HashMap<String,Buff> buffMap;
|
||||
if (l instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
|
||||
buffMap = pd.buffs;
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
buffMap = les.buffs;
|
||||
}
|
||||
for (int i=0;i<buffNames.length;i++) {
|
||||
buffMap.remove(buffNames[i]);
|
||||
}
|
||||
updateBuffDisplay(l);
|
||||
}
|
||||
|
||||
private static void updateBuffDisplay(LivingEntity l) {
|
||||
if (l instanceof Player) {
|
||||
GenericFunctions.sendActionBarMessage((Player)l, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,6 @@ public class ItemUtils {
|
||||
}
|
||||
|
||||
public static boolean isValidItem(ItemStack[] equips) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
@ -11,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import org.inventivetalent.glow.GlowAPI;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
||||
|
||||
public class LivingEntityStructure {
|
||||
public LivingEntity target;
|
||||
@ -26,16 +28,18 @@ public class LivingEntityStructure {
|
||||
public boolean checkedforcubes=false;
|
||||
public boolean hasRallied=false;
|
||||
public HashMap<String,Buff> buffs = new HashMap<String,Buff>();
|
||||
public long lastpotionparticles=0;
|
||||
|
||||
public LivingEntityStructure(LivingEntity m) {
|
||||
target=null;
|
||||
original_name="";
|
||||
original_name=GetOriginalName(m);
|
||||
//TwosideKeeper.log("Original name is "+original_name, 0);
|
||||
this.m=m;
|
||||
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
|
||||
}
|
||||
public LivingEntityStructure(LivingEntity m, LivingEntity target) {
|
||||
this.target=target;
|
||||
original_name="";
|
||||
original_name=GetOriginalName(m);
|
||||
this.m=m;
|
||||
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
|
||||
}
|
||||
@ -47,6 +51,14 @@ public class LivingEntityStructure {
|
||||
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
|
||||
}
|
||||
|
||||
private String GetOriginalName(LivingEntity m) {
|
||||
if (m.getCustomName()!=null) {
|
||||
return m.getCustomName();
|
||||
} else {
|
||||
return GenericFunctions.CapitalizeFirstLetters(m.getType().name().replace("_", " "));
|
||||
}
|
||||
}
|
||||
|
||||
public LivingEntity GetTarget() {
|
||||
if (this.target!=null &&
|
||||
!this.target.isDead()) {
|
||||
@ -135,15 +147,47 @@ public class LivingEntityStructure {
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateMobName(LivingEntity ent) {
|
||||
if (ent instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)ent;
|
||||
m.setCustomNameVisible(false);
|
||||
if (m.getCustomName()!=null) {
|
||||
m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
|
||||
if (m.getCustomName().contains("Dangerous")) {
|
||||
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
|
||||
}
|
||||
if (m.getCustomName().contains("Deadly")) {
|
||||
m.setCustomName(ChatColor.GOLD+m.getCustomName());
|
||||
}
|
||||
if (m.getCustomName().contains("Hellfire")) {
|
||||
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
|
||||
}
|
||||
m.setCustomName(ChatColor.DARK_RED+m.getCustomName()+ChatColor.RESET+" ");
|
||||
if (Buff.hasBuff(m, "DeathMark")) {
|
||||
GenericFunctions.RefreshBuffColor(m, Buff.getBuff(m, "DeathMark").getAmplifier());
|
||||
}
|
||||
CustomDamage.appendDebuffsToName(m);
|
||||
if (m.getCustomName().contains(" ")) {
|
||||
m.setCustomNameVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Either gets a monster structure that exists or creates a new one.
|
||||
public static LivingEntityStructure getLivingEntityStructure(LivingEntity m2) {
|
||||
UUID id = m2.getUniqueId();
|
||||
public static LivingEntityStructure GetLivingEntityStructure(LivingEntity m) {
|
||||
if (m instanceof Player) {
|
||||
TwosideKeeper.log("ERROR!! We are trying to retrieve a LivingEntityStructure for a Player!", 0);
|
||||
DebugUtils.showStackTrace();
|
||||
return null;
|
||||
} else {
|
||||
UUID id = m.getUniqueId();
|
||||
if (TwosideKeeper.livingentitydata.containsKey(id)) {
|
||||
return TwosideKeeper.livingentitydata.get(id);
|
||||
} else {
|
||||
LivingEntityStructure newstruct = new LivingEntityStructure(m2);
|
||||
LivingEntityStructure newstruct = new LivingEntityStructure(m);
|
||||
TwosideKeeper.livingentitydata.put(id,newstruct);
|
||||
return TwosideKeeper.livingentitydata.get(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,10 +82,12 @@ public class MonsterController {
|
||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));
|
||||
//Monster m = (Monster)ent;
|
||||
LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(ent.getUniqueId());
|
||||
if (ms!=null) {
|
||||
LivingEntityDifficulty led = getLivingEntityDifficulty(ent);
|
||||
ms.SetLeader(true);
|
||||
convertLivingEntity(ent,led);
|
||||
TwosideKeeper.log(" Converted "+GenericFunctions.GetEntityDisplayName(ent)+" to Leader!",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||
}
|
||||
//Set the HP of the leader to a more proper amount.
|
||||
} else
|
||||
if (meetsConditionsToBeElite(ent) && !minion) {
|
||||
@ -901,7 +903,7 @@ public class MonsterController {
|
||||
m.setMaxHealth(800); //Target is 800 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
TwosideKeeper.log(m.getCustomName()+" health is "+m.getMaxHealth(), 5);
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting an entity with Difficulty "+led.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -928,7 +930,7 @@ public class MonsterController {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||
m.setMaxHealth(1200); //Target is 1200 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting an entity with Difficulty "+led.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -960,12 +962,12 @@ public class MonsterController {
|
||||
{
|
||||
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
m.setMaxHealth(1600); //Target is 1600 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
LivingEntityStructure.getLivingEntityStructure(m).SetLeader(true);
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).SetLeader(true);
|
||||
TwosideKeeper.log("->Setting an entity with Difficulty "+led.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
} else {
|
||||
m.setMaxHealth(m.getMaxHealth()*4.0);
|
||||
@ -994,7 +996,7 @@ public class MonsterController {
|
||||
}
|
||||
m.setCustomNameVisible(true);
|
||||
m.setRemoveWhenFarAway(false);
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetElite(true);
|
||||
ms.UpdateGlow();
|
||||
m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(72.0);
|
||||
@ -1013,7 +1015,7 @@ public class MonsterController {
|
||||
m.setMaxHealth(400);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
m.setCustomName("Zombie Leader");
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting an entity with Difficulty "+led.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -1040,7 +1042,7 @@ public class MonsterController {
|
||||
{
|
||||
m.setMaxHealth(32000); //Target is 1600 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting an entity with Difficulty "+led.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -1076,7 +1078,7 @@ public class MonsterController {
|
||||
m.setMaxHealth(800); //Target is 800 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
TwosideKeeper.log(m.getCustomName()+" health is "+m.getMaxHealth(), 5);
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -1102,7 +1104,7 @@ public class MonsterController {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||
m.setMaxHealth(1200); //Target is 1200 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -1133,12 +1135,12 @@ public class MonsterController {
|
||||
if(isZombieLeader(m))
|
||||
{
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
m.setMaxHealth(1600); //Target is 1600 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
LivingEntityStructure.getLivingEntityStructure(m).SetLeader(true);
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).SetLeader(true);
|
||||
TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
} else {
|
||||
m.setMaxHealth(m.getMaxHealth()*4.0);
|
||||
@ -1167,7 +1169,7 @@ public class MonsterController {
|
||||
}
|
||||
m.setCustomNameVisible(true);
|
||||
m.setRemoveWhenFarAway(false);
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetElite(true);
|
||||
ms.UpdateGlow();
|
||||
m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(72.0);
|
||||
@ -1186,7 +1188,7 @@ public class MonsterController {
|
||||
m.setMaxHealth(400);
|
||||
m.setHealth(m.getMaxHealth());
|
||||
m.setCustomName("Zombie Leader");
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -1213,7 +1215,7 @@ public class MonsterController {
|
||||
{
|
||||
m.setMaxHealth(32000); //Target is 1600 HP.
|
||||
m.setHealth(m.getMaxHealth());
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
ms.SetLeader(true);
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
|
||||
@ -1312,7 +1314,7 @@ public class MonsterController {
|
||||
/*if (ent.getLocation().getY()<54) {
|
||||
|
||||
} else */ {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(ent);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent);
|
||||
les.SetLeader(true);
|
||||
les.m.setMaxHealth(480000);
|
||||
les.m.setCustomName(ChatColor.RED+"Leader Wither");
|
||||
|
@ -197,6 +197,7 @@ public class PlayerStructure {
|
||||
public boolean vacuumsuckup=true;
|
||||
public boolean equipweapons=true;
|
||||
public boolean equiparmor=true;
|
||||
public long lastpotionparticles=0;
|
||||
public Location restartLoc = null; //Set to a value when the player has to be re-teleported after being controlled by a camera.
|
||||
|
||||
List<ItemStack> equipmentset = new ArrayList<ItemStack>();
|
||||
|
@ -688,6 +688,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public void run(){
|
||||
//Control charge zombies..
|
||||
long time = System.nanoTime();
|
||||
long totaltime = System.nanoTime();
|
||||
for (ChargeZombie cz : chargezombies.values()) {
|
||||
if (cz.m==null || !cz.m.isValid() || !cz.isAlive() || !cz.hasTarget() || (cz.GetZombie().getWorld().getName().equalsIgnoreCase("world") && cz.GetZombie().getLocation().getY()>32)) {
|
||||
//This has to be removed...
|
||||
@ -797,7 +798,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (e==null || !e.isValid() ||
|
||||
GenericFunctions.getSuppressionTime(e)<=0) {
|
||||
if (e!=null && e.isValid() && e instanceof LivingEntity) {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure((LivingEntity)e);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)e);
|
||||
((LivingEntity)e).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(les.original_movespd);
|
||||
((LivingEntity)e).setAI(true);
|
||||
}
|
||||
@ -848,6 +849,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Camera Handling", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
if ((int)(System.nanoTime()-totaltime)/1000000d>50) {
|
||||
TwosideKeeper.log("WARNING! Structure Handling took longer than 1 tick! "+((int)(System.nanoTime()-totaltime)/1000000d)+"ms", 0);
|
||||
}
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Structure Handling", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime();
|
||||
}
|
||||
|
||||
private void UpdateLavaBlock(Block lavamod) {
|
||||
@ -1103,7 +1108,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
/*MonsterTemplate newtemp = new MonsterTemplate(new File(filesave+"/monsterdata/KingSlime.md"));
|
||||
int newint = (int)newtemp.getValue("timeToLive");
|
||||
log(Integer.toString(newint),0);*/
|
||||
log(" This is here to change the file size if necessary Kappa Kappa Kappa No Copy-pasterino Kappachino Lulu c: Please update version number.",5);
|
||||
log(" This is here to change the file size if necessary Kappa Kappa Kappa No Copy-pasterino Kappachino Lulu c: Please update version number. lololol",5);
|
||||
}
|
||||
|
||||
private static void InitializeBotCommands() {
|
||||
@ -1177,6 +1182,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
args = ArrayUtils.combineArguments(args);
|
||||
//TwosideKeeper.log(Arrays.toString(args), 0);
|
||||
if (cmd.getName().equalsIgnoreCase("log")) {
|
||||
LOGGING_LEVEL = (LOGGING_LEVEL+1) % 6;
|
||||
sender.sendMessage("Debugging Log Level is now "+ChatColor.RED+LOGGING_LEVEL+".");
|
||||
@ -1802,6 +1809,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
aec.setDuration(5);
|
||||
aec.setRadius(0.1f);
|
||||
}break;
|
||||
case "APPLYBUFF":{
|
||||
//p.spawnParticle(Particle.SPELL_MOB_AMBIENT, p.getLocation(), 30);
|
||||
//EntityUtils.applyBuff(p, args[1], new Buff(args[2],20*10*60,2,Color.BLUE,"✌"));
|
||||
//Buff.outputBuffs(p);
|
||||
/*EntityUtils.applyBuffs(p, new String[]{"Poison","Slow","Bleed"}, new Buff[]{
|
||||
new Buff("Poison",20*20,3,Color.YELLOW,ChatColor.YELLOW+"☠"),
|
||||
new Buff("Slowness",20*17,1,Color.GRAY,ChatColor.GRAY+"≈"),
|
||||
new Buff("Bleeding",20*14,5,Color.MAROON,ChatColor.RED+"☣"),
|
||||
});*/
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2604,7 +2621,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
|
||||
for (UUID id : livingentitydata.keySet()) {
|
||||
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(livingentitydata.get(id).m);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(livingentitydata.get(id).m);
|
||||
les.setGlow(ev.getPlayer(), null);
|
||||
}
|
||||
|
||||
@ -4240,7 +4257,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
for (int i=0;i<nearby.size();i++) {
|
||||
if (nearby.get(i) instanceof LivingEntity) {
|
||||
LivingEntity m = (LivingEntity)nearby.get(i);
|
||||
if (m.hasPotionEffect(PotionEffectType.UNLUCK) && !m.isDead()) {
|
||||
if (Buff.hasBuff(m, "DeathMark") && !m.isDead()) {
|
||||
//This has stacks, burst!
|
||||
bursted=true;
|
||||
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240);
|
||||
@ -4253,10 +4270,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
reset=true;
|
||||
}
|
||||
if (stackamt<5) {
|
||||
m.removePotionEffect(PotionEffectType.UNLUCK);
|
||||
Buff.removeBuff(m, "DeathMark");
|
||||
} else {
|
||||
m.addPotionEffect(new PotionEffect(PotionEffectType.UNLUCK,99,stackamt/2),true);
|
||||
GenericFunctions.ApplyDeathMark(m);
|
||||
Buff.addBuff(m, "DeathMark", new Buff("Death Mark",99,stackamt/2,Color.MAROON,ChatColor.DARK_RED+"☠"));
|
||||
GenericFunctions.RefreshBuffColor(m, stackamt/2);
|
||||
}
|
||||
//player.playSound(m.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f);
|
||||
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f);
|
||||
@ -5918,7 +5935,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
|
||||
public void updateMonsterFlags(LivingEntity m) {
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if (m instanceof Monster) {
|
||||
MonsterDifficulty md = MonsterController.getMonsterDifficulty((Monster)m);
|
||||
if (md == MonsterDifficulty.ELITE) {
|
||||
@ -5947,10 +5964,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void MonsterSpawnEvent(CreatureSpawnEvent ev) {
|
||||
if (ev.getEntity() instanceof LivingEntity) {
|
||||
LivingEntity m = ev.getEntity();
|
||||
LivingEntityStructure.getLivingEntityStructure(m);
|
||||
}
|
||||
if ((ev.getSpawnReason().equals(SpawnReason.DISPENSE_EGG) ||
|
||||
ev.getSpawnReason().equals(SpawnReason.EGG)) &&
|
||||
CustomDamage.trimNonLivingEntities(ev.getEntity().getNearbyEntities(8, 8, 8)).size()>20) {
|
||||
@ -5994,6 +6007,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
{
|
||||
TwosideKeeper.log(" This is a normal mob.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||
if (!ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) && !ev.getSpawnReason().equals(SpawnReason.SLIME_SPLIT)) {
|
||||
if (ev.getEntity() instanceof LivingEntity) {
|
||||
LivingEntity m = ev.getEntity();
|
||||
LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
}
|
||||
if (!habitat_data.addNewStartingLocation(ev.getEntity())) {
|
||||
ev.getEntity().remove();
|
||||
ev.setCancelled(true);
|
||||
@ -6041,6 +6058,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ev.getEntity() instanceof LivingEntity) {
|
||||
LivingEntity m = ev.getEntity();
|
||||
LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
}
|
||||
}
|
||||
|
||||
private void convertToStrongerShulker(LivingEntity entity) {
|
||||
@ -6110,7 +6131,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Nerf Durability
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void dodgeEvent(PlayerDodgeEvent ev) {
|
||||
Player p = ev.getPlayer();
|
||||
@ -6652,7 +6672,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||
LivingEntityStructure ms = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
if (ms.getElite()) {
|
||||
log("Target reason is "+ev.getReason(),5);
|
||||
EliteMonster em = null;
|
||||
@ -6798,19 +6818,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (ev.getEntity() instanceof LivingEntity) {
|
||||
List<ItemStack> droplist = ev.getDrops();
|
||||
LivingEntity m = (LivingEntity)ev.getEntity();
|
||||
|
||||
double dropmult = 0.0d;
|
||||
boolean isBoss=false;
|
||||
boolean isElite=false;
|
||||
boolean killedByPlayer = false;
|
||||
final Location deathloc = m.getLocation();
|
||||
LivingEntityStructure ms = null;
|
||||
if (livingentitydata.containsKey(m.getUniqueId())) {
|
||||
/*if (livingentitydata.containsKey(m.getUniqueId())) {
|
||||
ms = (LivingEntityStructure)livingentitydata.get(m.getUniqueId());
|
||||
if (ms.hasOriginalName()) {
|
||||
m.setCustomName(ms.getOriginalName());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (ms!=null && (ms.GetTarget() instanceof Player)) {
|
||||
if ((m instanceof Slime) ||
|
||||
@ -7349,10 +7368,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
private Chest SpawnALootChest(int i, int j, int k) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
private void AwardDeathAchievements(Player p, LivingEntity entity) {
|
||||
if (p.hasAchievement(Achievement.BUILD_SWORD) && (entity instanceof Monster) && !p.hasAchievement(Achievement.KILL_ENEMY)) {
|
||||
p.awardAchievement(Achievement.KILL_ENEMY);
|
||||
|
@ -2,6 +2,7 @@ package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@ -24,6 +25,7 @@ import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
@ -49,6 +51,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
|
||||
@ -81,6 +84,8 @@ final class runServerHeartbeat implements Runnable {
|
||||
//SAVE SERVER SETTINGS.
|
||||
final long serverTickTime = TwosideKeeper.getServerTickTime();
|
||||
long time = System.nanoTime();
|
||||
long totaltime = System.nanoTime();
|
||||
|
||||
if (serverTickTime-TwosideKeeper.LASTSERVERCHECK>=TwosideKeeper.SERVERCHECKERTICKS) { //15 MINUTES (DEFAULT)
|
||||
if (TwosideKeeper.LAST_DEAL!=Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
|
||||
//This means the deal of the day has to be updated!
|
||||
@ -297,6 +302,9 @@ final class runServerHeartbeat implements Runnable {
|
||||
|
||||
adjustMiningFatigue(p);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Adjust Mining Fatigue", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
createPotionParticles(p);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Potion Effect Particles", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
//TwosideKeeper.outputArmorDurability(p,">");
|
||||
}
|
||||
@ -325,6 +333,48 @@ final class runServerHeartbeat implements Runnable {
|
||||
|
||||
resetPigmanAggro();
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Reset Pigman Aggro", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
if ((int)(System.nanoTime()-totaltime)/1000000d>50) {
|
||||
TwosideKeeper.log("WARNING! Server heartbeat took longer than 1 tick! "+((int)(System.nanoTime()-totaltime)/1000000d)+"ms", 0);
|
||||
}
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime();
|
||||
}
|
||||
|
||||
private void createPotionParticles(LivingEntity l) {
|
||||
if (l instanceof Player) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
|
||||
if (pd.lastpotionparticles+100<TwosideKeeper.getServerTickTime()) {
|
||||
List<org.bukkit.Color> colors = new ArrayList<org.bukkit.Color>();
|
||||
for (String s : pd.buffs.keySet()) {
|
||||
Buff b = pd.buffs.get(s);
|
||||
if (b.getRemainingBuffTime()>0) {
|
||||
colors.add(b.getBuffParticleColor());
|
||||
}
|
||||
}
|
||||
if (colors.size()>0) {
|
||||
for (int i=0;i<colors.size();i++) {
|
||||
EntityUtils.createPotionEffectSwirls(l, colors.get(i), i*(100/colors.size()));
|
||||
}
|
||||
}
|
||||
pd.lastpotionparticles=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
} else {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||
if (les.lastpotionparticles+100<TwosideKeeper.getServerTickTime()) {
|
||||
List<org.bukkit.Color> colors = new ArrayList<org.bukkit.Color>();
|
||||
for (String s : les.buffs.keySet()) {
|
||||
Buff b = les.buffs.get(s);
|
||||
if (b.getRemainingBuffTime()>0) {
|
||||
colors.add(b.getBuffParticleColor());
|
||||
}
|
||||
}
|
||||
if (colors.size()>0) {
|
||||
for (int i=0;i<colors.size();i++) {
|
||||
EntityUtils.createPotionEffectSwirls(l, colors.get(i), i*(100/colors.size()));
|
||||
}
|
||||
}
|
||||
les.lastpotionparticles=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetDamageQueue() {
|
||||
@ -841,6 +891,7 @@ final class runServerHeartbeat implements Runnable {
|
||||
TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms);
|
||||
TwosideKeeper.ScheduleRemoval(data, id);
|
||||
TwosideKeeper.ScheduleRemoval(TwosideKeeper.habitat_data.startinglocs, id);
|
||||
ms.m.setCustomName(ms.getOriginalName());
|
||||
TwosideKeeper.log("Removed Monster Structure for "+id+".", 5);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Removed Monster Structure Data.", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
} else {
|
||||
@ -855,6 +906,10 @@ final class runServerHeartbeat implements Runnable {
|
||||
}
|
||||
ms.UpdateGlow();
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Update Glow", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
createPotionParticles(ms.m);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Create Potion Particles", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
LivingEntityStructure.UpdateMobName(ms.m);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Update Mob Names", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user