Add debuffs to players and enemies. Fix memory leak.
This commit is contained in:
parent
47a5b508dc
commit
91caf89c04
Binary file not shown.
@ -1,14 +1,72 @@
|
|||||||
package sig.plugin.TwosideKeeper;
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Monster;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class ActionBarBuffUpdater implements Runnable{
|
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||||
PotionEffectType type;
|
|
||||||
int ticks_remaining;
|
|
||||||
|
|
||||||
@Override
|
public class ActionBarBuffUpdater{
|
||||||
public void run() {
|
|
||||||
|
|
||||||
|
public static String getActionBarPrefix(LivingEntity p) {
|
||||||
|
StringBuilder actionbardisplay = new StringBuilder("");
|
||||||
|
for (PotionEffect pe : p.getActivePotionEffects()) {
|
||||||
|
if (pe.getAmplifier()>3) {
|
||||||
|
actionbardisplay.append(ParseEffect(p,pe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (actionbardisplay.toString().contains(" ")) {
|
||||||
|
return actionbardisplay.toString().substring(0, actionbardisplay.toString().lastIndexOf(" "));
|
||||||
|
} else {
|
||||||
|
return actionbardisplay.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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+"⚔");
|
||||||
|
} else
|
||||||
|
if (pet.equals(PotionEffectType.DAMAGE_RESISTANCE)) {
|
||||||
|
effectString.append(ChatColor.BLUE+"❈");
|
||||||
|
} else
|
||||||
|
if (pet.equals(PotionEffectType.REGENERATION)) {
|
||||||
|
effectString.append(ChatColor.GREEN+"✙");
|
||||||
|
} else
|
||||||
|
if (pet.equals(PotionEffectType.SPEED)) {
|
||||||
|
effectString.append(ChatColor.WHITE+"➠");
|
||||||
|
} else
|
||||||
|
if (pet.equals(PotionEffectType.POISON) ||
|
||||||
|
(pet.equals(PotionEffectType.BLINDNESS) && (p instanceof Monster))) {
|
||||||
|
effectString.append(ChatColor.YELLOW+"☣");
|
||||||
|
} else
|
||||||
|
if ((pet.equals(PotionEffectType.UNLUCK) && p instanceof Monster)) {
|
||||||
|
effectString.append(ChatColor.DARK_RED+"☠");
|
||||||
|
} else
|
||||||
|
if (pet.equals(PotionEffectType.SLOW)) {
|
||||||
|
effectString.append(ChatColor.DARK_AQUA+"♒");
|
||||||
|
} else
|
||||||
|
if (pet.equals(PotionEffectType.WEAKNESS) || pet.equals(PotionEffectType.SLOW_DIGGING)) {
|
||||||
|
effectString.append(ChatColor.RED+"✘");
|
||||||
|
}
|
||||||
|
if (effectString.length()>0) {
|
||||||
|
effectString.append(AppendAmplifier(pe.getAmplifier()));
|
||||||
|
effectString.append(" ");
|
||||||
|
}
|
||||||
|
if (effectString.length()>0) {
|
||||||
|
return effectString.toString()+ChatColor.RESET;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String AppendAmplifier(int amplifier) {
|
||||||
|
StringBuilder amp = new StringBuilder(" ");
|
||||||
|
amp.append(ChatColor.GRAY+WorldShop.toRomanNumeral(amplifier+1));
|
||||||
|
return amp.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ public class CustomDamage {
|
|||||||
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
|
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
|
||||||
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
||||||
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.3;
|
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.3;
|
||||||
aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getDamagerEntity(damager) instanceof Enderman) {
|
if (getDamagerEntity(damager) instanceof Enderman) {
|
||||||
@ -482,6 +482,8 @@ public class CustomDamage {
|
|||||||
GenericFunctions.RemoveNewDebuffs(p);
|
GenericFunctions.RemoveNewDebuffs(p);
|
||||||
}
|
}
|
||||||
},1);
|
},1);
|
||||||
|
|
||||||
|
appendDebuffsToName(target);
|
||||||
}
|
}
|
||||||
if (target instanceof Monster) {
|
if (target instanceof Monster) {
|
||||||
if (reason!=null && reason.equalsIgnoreCase("SUFFOCATION")) {
|
if (reason!=null && reason.equalsIgnoreCase("SUFFOCATION")) {
|
||||||
@ -491,6 +493,28 @@ public class CustomDamage {
|
|||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void appendDebuffsToName(LivingEntity target) {
|
||||||
|
if (target instanceof Monster) {
|
||||||
|
if (target.getCustomName()==null) {
|
||||||
|
//Setup name.
|
||||||
|
target.setCustomName(GenericFunctions.CapitalizeFirstLetters(target.getType().name().replace("_", " ")));
|
||||||
|
}
|
||||||
|
if (!target.getCustomName().contains(ChatColor.RESET+" ")) { //Append our separator character.
|
||||||
|
target.setCustomName(target.getCustomName()+ChatColor.RESET+" ");
|
||||||
|
}
|
||||||
|
//Now split it using that as our separator.
|
||||||
|
String[] split = target.getCustomName().split(ChatColor.RESET+" ");
|
||||||
|
|
||||||
|
String suffix = ActionBarBuffUpdater.getActionBarPrefix(target);
|
||||||
|
|
||||||
|
if (suffix.length()>0) {
|
||||||
|
target.setCustomName(split[0]+ChatColor.RESET+" "+suffix);
|
||||||
|
} else {
|
||||||
|
target.setCustomName(split[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void reduceSwiftAegisBuff(Player p) {
|
private static void reduceSwiftAegisBuff(Player p) {
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (pd.swiftaegisamt>0) {
|
if (pd.swiftaegisamt>0) {
|
||||||
@ -509,9 +533,9 @@ public class CustomDamage {
|
|||||||
TwosideKeeper.log(pd.swiftaegisamt+" stacks of Aegis remaining.", 5);
|
TwosideKeeper.log(pd.swiftaegisamt+" stacks of Aegis remaining.", 5);
|
||||||
}
|
}
|
||||||
if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
|
if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
|
||||||
aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1));
|
GenericFunctions.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1));
|
||||||
} else {
|
} else {
|
||||||
aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Swift Aegis Resistance Removed.");
|
GenericFunctions.sendActionBarMessage(p, ChatColor.GRAY+"Swift Aegis Resistance Removed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -882,7 +906,7 @@ public class CustomDamage {
|
|||||||
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*rawdmg);
|
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*rawdmg);
|
||||||
aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class EliteMonster {
|
|||||||
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD);
|
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD);
|
||||||
this.hp_before_burstcheck=m.getHealth();
|
this.hp_before_burstcheck=m.getHealth();
|
||||||
this.myspawn=m.getLocation();
|
this.myspawn=m.getLocation();
|
||||||
bar = m.getServer().createBossBar(m.getCustomName(), BarColor.WHITE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
|
bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
|
||||||
willpower_bar = m.getServer().createBossBar("Willpower", BarColor.PINK, BarStyle.SOLID, BarFlag.CREATE_FOG);
|
willpower_bar = m.getServer().createBossBar("Willpower", BarColor.PINK, BarStyle.SOLID, BarFlag.CREATE_FOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,13 +158,13 @@ public class EliteMonster {
|
|||||||
last_willpower_increase=TwosideKeeper.getServerTickTime();
|
last_willpower_increase=TwosideKeeper.getServerTickTime();
|
||||||
if (!first_willpower_notification && willpower>20) {
|
if (!first_willpower_notification && willpower>20) {
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.ITALIC+"The "+m.getCustomName()+ChatColor.RESET+ChatColor.ITALIC+" gains morale and the will to fight from its minions!");
|
targetlist.get(i).sendMessage(ChatColor.ITALIC+"The "+GenericFunctions.getDisplayName(m)+ChatColor.RESET+ChatColor.ITALIC+" gains morale and the will to fight from its minions!");
|
||||||
}
|
}
|
||||||
first_willpower_notification=true;
|
first_willpower_notification=true;
|
||||||
}
|
}
|
||||||
if (willpower>=100) {
|
if (willpower>=100) {
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.RED+"The "+m.getCustomName()+ChatColor.RED+" unleashes its Willpower!");
|
targetlist.get(i).sendMessage(ChatColor.RED+"The "+GenericFunctions.getDisplayName(m)+ChatColor.RED+" unleashes its Willpower!");
|
||||||
}
|
}
|
||||||
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
|
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
|
||||||
final int previous_str_level = GenericFunctions.getPotionEffectLevel(PotionEffectType.INCREASE_DAMAGE, m);
|
final int previous_str_level = GenericFunctions.getPotionEffectLevel(PotionEffectType.INCREASE_DAMAGE, m);
|
||||||
@ -181,7 +181,7 @@ public class EliteMonster {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.DARK_RED+"The "+m.getCustomName()+ChatColor.DARK_RED+" is now focused on its target!");
|
targetlist.get(i).sendMessage(ChatColor.DARK_RED+"The "+GenericFunctions.getDisplayName(m)+ChatColor.DARK_RED+" is now focused on its target!");
|
||||||
}
|
}
|
||||||
my_only_target = ChooseRandomTarget();
|
my_only_target = ChooseRandomTarget();
|
||||||
last_ignoretarget_time = TwosideKeeper.getServerTickTime();
|
last_ignoretarget_time = TwosideKeeper.getServerTickTime();
|
||||||
@ -236,7 +236,7 @@ public class EliteMonster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bar.setProgress(m.getHealth()/m.getMaxHealth());
|
bar.setProgress(m.getHealth()/m.getMaxHealth());
|
||||||
bar.setTitle(m.getCustomName() + ((m.getTarget()!=null && (m.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)m.getTarget()).getName()):""));
|
bar.setTitle(GenericFunctions.getDisplayName(m) + ((m.getTarget()!=null && (m.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)m.getTarget()).getName()):""));
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
if (!currentplayers.contains(targetlist.get(i))) {
|
if (!currentplayers.contains(targetlist.get(i))) {
|
||||||
bar.addPlayer(targetlist.get(i));
|
bar.addPlayer(targetlist.get(i));
|
||||||
@ -263,10 +263,10 @@ public class EliteMonster {
|
|||||||
m.teleport(myspawn);
|
m.teleport(myspawn);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
if (dpslist.size()>0) {
|
if (dpslist.size()>0) {
|
||||||
Bukkit.getServer().broadcastMessage(m.getCustomName()+" Takedown Failed...");
|
Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed...");
|
||||||
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
|
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
|
||||||
Bukkit.getServer().broadcastMessage(generateDPSReport());
|
Bukkit.getServer().broadcastMessage(generateDPSReport());
|
||||||
aPlugin.API.discordSendRaw(m.getCustomName()+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
|
aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
|
||||||
}
|
}
|
||||||
bar.setColor(BarColor.WHITE);
|
bar.setColor(BarColor.WHITE);
|
||||||
first_willpower_notification=false;
|
first_willpower_notification=false;
|
||||||
@ -489,7 +489,7 @@ public class EliteMonster {
|
|||||||
last_storingenergy_time=TwosideKeeper.getServerTickTime();
|
last_storingenergy_time=TwosideKeeper.getServerTickTime();
|
||||||
storingenergy=true;
|
storingenergy=true;
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+m.getCustomName()+ChatColor.GOLD+" is absorbing energy!");
|
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GOLD+" is absorbing energy!");
|
||||||
}
|
}
|
||||||
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0f);
|
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0f);
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||||
@ -503,7 +503,7 @@ public class EliteMonster {
|
|||||||
if (last_storingenergy_health-m.getHealth()>0) {
|
if (last_storingenergy_health-m.getHealth()>0) {
|
||||||
storingenergy_hit=(last_storingenergy_health-m.getHealth())*500d;
|
storingenergy_hit=(last_storingenergy_health-m.getHealth())*500d;
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+m.getCustomName()+ChatColor.GOLD+"'s next hit is stronger!");
|
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GOLD+"'s next hit is stronger!");
|
||||||
targetlist.get(i).sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+" \"DIE "+target.getName()+ChatColor.DARK_RED+"! DIEE!\"");
|
targetlist.get(i).sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+" \"DIE "+target.getName()+ChatColor.DARK_RED+"! DIEE!\"");
|
||||||
}
|
}
|
||||||
m.setTarget(target);
|
m.setTarget(target);
|
||||||
@ -522,13 +522,13 @@ public class EliteMonster {
|
|||||||
if (last_enrage_time+ENRAGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
|
if (last_enrage_time+ENRAGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
|
||||||
last_enrage_time=TwosideKeeper.getServerTickTime();
|
last_enrage_time=TwosideKeeper.getServerTickTime();
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.BOLD+""+ChatColor.YELLOW+"WARNING!"+ChatColor.RESET+ChatColor.GREEN+"The "+m.getCustomName()+ChatColor.GREEN+" is going into a tantrum!");
|
targetlist.get(i).sendMessage(ChatColor.BOLD+""+ChatColor.YELLOW+"WARNING!"+ChatColor.RESET+ChatColor.GREEN+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GREEN+" is going into a tantrum!");
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!m.isDead()) {
|
if (!m.isDead()) {
|
||||||
for (int i=0;i<targetlist.size();i++) {
|
for (int i=0;i<targetlist.size();i++) {
|
||||||
targetlist.get(i).sendMessage(ChatColor.RED+"The "+m.getCustomName()+ChatColor.RED+" becomes much stronger!");
|
targetlist.get(i).sendMessage(ChatColor.RED+"The "+GenericFunctions.getDisplayName(m)+ChatColor.RED+" becomes much stronger!");
|
||||||
}
|
}
|
||||||
enraged=true;
|
enraged=true;
|
||||||
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
|
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
|
||||||
|
@ -47,6 +47,7 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
|||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import sig.plugin.TwosideKeeper.ActionBarBuffUpdater;
|
||||||
import sig.plugin.TwosideKeeper.Artifact;
|
import sig.plugin.TwosideKeeper.Artifact;
|
||||||
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
||||||
import sig.plugin.TwosideKeeper.CustomDamage;
|
import sig.plugin.TwosideKeeper.CustomDamage;
|
||||||
@ -2390,7 +2391,7 @@ public class GenericFunctions {
|
|||||||
Monster m = (Monster)ent;
|
Monster m = (Monster)ent;
|
||||||
m.setCustomNameVisible(true);
|
m.setCustomNameVisible(true);
|
||||||
if (m.getCustomName()!=null) {
|
if (m.getCustomName()!=null) {
|
||||||
m.setCustomName(getDeathMarkColor(stackamt)+ChatColor.stripColor(m.getCustomName()));
|
m.setCustomName(getDeathMarkColor(stackamt)+ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
|
||||||
} else {
|
} else {
|
||||||
m.setCustomName(getDeathMarkColor(stackamt)+CapitalizeFirstLetters(m.getType().toString().replace("_", " ")));
|
m.setCustomName(getDeathMarkColor(stackamt)+CapitalizeFirstLetters(m.getType().toString().replace("_", " ")));
|
||||||
}
|
}
|
||||||
@ -2414,7 +2415,7 @@ public class GenericFunctions {
|
|||||||
Monster m = (Monster)ent;
|
Monster m = (Monster)ent;
|
||||||
m.setCustomNameVisible(false);
|
m.setCustomNameVisible(false);
|
||||||
if (m.getCustomName()!=null) {
|
if (m.getCustomName()!=null) {
|
||||||
m.setCustomName(ChatColor.stripColor(m.getCustomName()));
|
m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
|
||||||
if (m.getCustomName().contains("Dangerous")) {
|
if (m.getCustomName().contains("Dangerous")) {
|
||||||
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
|
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
|
||||||
}
|
}
|
||||||
@ -2424,6 +2425,7 @@ public class GenericFunctions {
|
|||||||
if (m.getCustomName().contains("Hellfire")) {
|
if (m.getCustomName().contains("Hellfire")) {
|
||||||
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
|
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
|
||||||
}
|
}
|
||||||
|
CustomDamage.appendDebuffsToName(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2790,7 +2792,7 @@ public class GenericFunctions {
|
|||||||
if (e instanceof LivingEntity) {
|
if (e instanceof LivingEntity) {
|
||||||
LivingEntity l = (LivingEntity)e;
|
LivingEntity l = (LivingEntity)e;
|
||||||
if (l.getCustomName()!=null) {
|
if (l.getCustomName()!=null) {
|
||||||
return l.getCustomName();
|
return GenericFunctions.getDisplayName(l);
|
||||||
}
|
}
|
||||||
if (l instanceof Player) {
|
if (l instanceof Player) {
|
||||||
Player p = (Player)l;
|
Player p = (Player)l;
|
||||||
@ -2803,7 +2805,7 @@ public class GenericFunctions {
|
|||||||
if (proj.getShooter() instanceof LivingEntity) {
|
if (proj.getShooter() instanceof LivingEntity) {
|
||||||
LivingEntity l = (LivingEntity)proj.getShooter();
|
LivingEntity l = (LivingEntity)proj.getShooter();
|
||||||
if (l.getCustomName()!=null) {
|
if (l.getCustomName()!=null) {
|
||||||
return finalname+"("+l.getCustomName()+ChatColor.GRAY+")";
|
return finalname+"("+GenericFunctions.getDisplayName(l)+ChatColor.GRAY+")";
|
||||||
}
|
}
|
||||||
if (l instanceof Player) {
|
if (l instanceof Player) {
|
||||||
Player p = (Player)l;
|
Player p = (Player)l;
|
||||||
@ -3782,7 +3784,7 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
TwosideKeeper.log("New Aegis level: "+pd.swiftaegisamt,5);
|
TwosideKeeper.log("New Aegis level: "+pd.swiftaegisamt,5);
|
||||||
aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1));
|
GenericFunctions.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4174,4 +4176,25 @@ public class GenericFunctions {
|
|||||||
pl.getInventory().getContents()[8],
|
pl.getInventory().getContents()[8],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Automatically appends status effect buffs to the beginning of it.
|
||||||
|
public static void sendActionBarMessage(Player p, String message) {
|
||||||
|
String prefix=ActionBarBuffUpdater.getActionBarPrefix(p);
|
||||||
|
if (prefix.length()>0) {
|
||||||
|
aPlugin.API.sendActionBarMessage(p, message+" "+prefix);
|
||||||
|
} else {
|
||||||
|
if (message.length()>0) {
|
||||||
|
aPlugin.API.sendActionBarMessage(p, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDisplayName(LivingEntity ent) {
|
||||||
|
//Strips off the suffix of a mob.
|
||||||
|
if (ent.getCustomName()==null) {
|
||||||
|
return GenericFunctions.CapitalizeFirstLetters(ent.getType().name().replace("_", " "));
|
||||||
|
} else {
|
||||||
|
return ent.getCustomName().split(ChatColor.RESET+" ")[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,7 @@ public class MonsterStructure {
|
|||||||
for (EliteMonster em : TwosideKeeper.elitemonsters) {
|
for (EliteMonster em : TwosideKeeper.elitemonsters) {
|
||||||
if (em.getMonster().equals(m)) {
|
if (em.getMonster().equals(m)) {
|
||||||
setGlow(p,em.getGlow());
|
setGlow(p,em.getGlow());
|
||||||
|
handled=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
|
@ -378,7 +378,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public static void ScheduleRemoval(Set<? extends Object> list, Object remove) {
|
public static void ScheduleRemoval(Set<? extends Object> list, Object remove) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1);
|
||||||
}
|
}
|
||||||
public void ScheduleRemoval(HashMap<? extends Object,? extends Object> map, Object remove) {
|
public static void ScheduleRemoval(HashMap<? extends Object,? extends Object> map, Object remove) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(map,remove),1);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(map,remove),1);
|
||||||
}
|
}
|
||||||
public static void ScheduleRemoval(Collection<? extends Object> list, Object remove) {
|
public static void ScheduleRemoval(Collection<? extends Object> list, Object remove) {
|
||||||
@ -866,9 +866,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
stack.append("\n"+stacktrace[i].getClassName()+": **"+stacktrace[i].getFileName()+"** "+stacktrace[i].getMethodName()+"():"+stacktrace[i].getLineNumber());
|
stack.append("\n"+stacktrace[i].getClassName()+": **"+stacktrace[i].getFileName()+"** "+stacktrace[i].getMethodName()+"():"+stacktrace[i].getLineNumber());
|
||||||
}
|
}
|
||||||
DiscordMessageSender.sendToSpam(stack.toString());*/
|
DiscordMessageSender.sendToSpam(stack.toString());*/
|
||||||
/*Monster m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
Monster m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
||||||
m.setHealth(m.getMaxHealth()/16d);*/
|
|
||||||
//aPlugin.API.sendActionBarMessage(p, "Testing/nMultiple Lines.\nLolz");
|
//GenericFunctions.sendActionBarMessage(p, "Testing/nMultiple Lines.\nLolz");
|
||||||
//TwosideKeeperAPI.setItemSet(p.getEquipment().getItemInMainHand(), ItemSet.PANROS);
|
//TwosideKeeperAPI.setItemSet(p.getEquipment().getItemInMainHand(), ItemSet.PANROS);
|
||||||
//p.getWorld().dropItemNaturally(p.getLocation(), TwosideKeeperAPI.generateMegaPiece(Material.LEATHER_CHESTPLATE, true, true, 5));
|
//p.getWorld().dropItemNaturally(p.getLocation(), TwosideKeeperAPI.generateMegaPiece(Material.LEATHER_CHESTPLATE, true, true, 5));
|
||||||
//p.getWorld().dropItemNaturally(p.getLocation(), HUNTERS_COMPASS.getItemStack());
|
//p.getWorld().dropItemNaturally(p.getLocation(), HUNTERS_COMPASS.getItemStack());
|
||||||
@ -2684,6 +2684,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//Modify the death message. This is a fix for getting rid of the healthbar from the player name.
|
//Modify the death message. This is a fix for getting rid of the healthbar from the player name.
|
||||||
final Player p = ev.getEntity();
|
final Player p = ev.getEntity();
|
||||||
if (!DeathManager.deathStructureExists(p)) {
|
if (!DeathManager.deathStructureExists(p)) {
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
if (pd.target!=null &&
|
||||||
|
pd.target.getCustomName()!=null) {
|
||||||
|
ev.setDeathMessage(ev.getDeathMessage().replace(pd.target.getCustomName(), GenericFunctions.getDisplayName(pd.target)));
|
||||||
|
}
|
||||||
String[] parsed_msg = ev.getDeathMessage().split(" ");
|
String[] parsed_msg = ev.getDeathMessage().split(" ");
|
||||||
//Get rid of the name.
|
//Get rid of the name.
|
||||||
//NOTE: If you change how the suffix looks YOU MUST UPDATE THIS!
|
//NOTE: If you change how the suffix looks YOU MUST UPDATE THIS!
|
||||||
@ -2695,7 +2700,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
newDeathMsg+=" "+parsed_msg[i];
|
newDeathMsg+=" "+parsed_msg[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
|
||||||
if (pd.lasthitdesc!=null) {
|
if (pd.lasthitdesc!=null) {
|
||||||
newDeathMsg = getFancyDeathMessage(p);
|
newDeathMsg = getFancyDeathMessage(p);
|
||||||
}
|
}
|
||||||
@ -3738,7 +3743,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
m.setTarget(((Monster)ev.getEntity()).getTarget());
|
m.setTarget(((Monster)ev.getEntity()).getTarget());
|
||||||
MonsterController.MobHeightControl(m,true);
|
MonsterController.MobHeightControl(m,true);
|
||||||
if (m.getCustomName()!=null) {
|
if (m.getCustomName()!=null) {
|
||||||
m.setCustomName(m.getCustomName()+" Minion");
|
m.setCustomName(GenericFunctions.getDisplayName(m)+" Minion");
|
||||||
} else {
|
} else {
|
||||||
m.setCustomName("Zombie Minion");
|
m.setCustomName("Zombie Minion");
|
||||||
}
|
}
|
||||||
@ -3981,7 +3986,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
GenericFunctions.removeNoDamageTick((LivingEntity)ev.getEntity(), ev.getDamager());
|
GenericFunctions.removeNoDamageTick((LivingEntity)ev.getEntity(), ev.getDamager());
|
||||||
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
|
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
|
||||||
pd.vendetta_amt=0.0;
|
pd.vendetta_amt=0.0;
|
||||||
aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
|
||||||
} else {
|
} else {
|
||||||
CustomDamage.ApplyDamage(0, ev.getDamager(), (LivingEntity)ev.getEntity(), weapon, null);
|
CustomDamage.ApplyDamage(0, ev.getDamager(), (LivingEntity)ev.getEntity(), weapon, null);
|
||||||
if (ev.getDamager() instanceof Projectile) {
|
if (ev.getDamager() instanceof Projectile) {
|
||||||
@ -4441,8 +4446,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
|
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
|
||||||
Bukkit.getServer().broadcastMessage(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" have successfully slain "+m.getCustomName()+ChatColor.WHITE+"!");
|
Bukkit.getServer().broadcastMessage(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" have successfully slain "+GenericFunctions.getDisplayName(m)+ChatColor.WHITE+"!");
|
||||||
aPlugin.API.discordSendRaw(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" have successfully slain **"+m.getCustomName()+ChatColor.WHITE+"**!");
|
aPlugin.API.discordSendRaw(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" have successfully slain **"+GenericFunctions.getDisplayName(m)+ChatColor.WHITE+"**!");
|
||||||
m.getWorld().spawnEntity(m.getLocation(), EntityType.LIGHTNING);
|
m.getWorld().spawnEntity(m.getLocation(), EntityType.LIGHTNING);
|
||||||
m.getWorld().setStorm(true);
|
m.getWorld().setStorm(true);
|
||||||
m.getWorld().setWeatherDuration(20*60*15);
|
m.getWorld().setWeatherDuration(20*60*15);
|
||||||
@ -4703,7 +4708,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
|
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
|
||||||
pd.velocity = new Vector(ev.getFrom().getX(),0,ev.getFrom().getZ()).distanceSquared(new Vector(ev.getTo().getX(),0,ev.getTo().getZ()));
|
pd.velocity = new Vector(ev.getFrom().getX(),0,ev.getFrom().getZ()).distanceSquared(new Vector(ev.getTo().getX(),0,ev.getTo().getZ()));
|
||||||
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
|
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
|
||||||
aPlugin.API.sendActionBarMessage(ev.getPlayer(), drawVelocityBar(pd.velocity,pd.highwinderdmg));
|
GenericFunctions.sendActionBarMessage(ev.getPlayer(), drawVelocityBar(pd.velocity,pd.highwinderdmg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6399,16 +6404,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (Bukkit.getPlayer(pd2.name)!=null && pd2.target!=null) {
|
if (Bukkit.getPlayer(pd2.name)!=null && pd2.target!=null) {
|
||||||
String MonsterName = pd2.target.getType().toString().toLowerCase();
|
String MonsterName = pd2.target.getType().toString().toLowerCase();
|
||||||
if (pd2.target.getCustomName()!=null) {
|
if (pd2.target.getCustomName()!=null) {
|
||||||
MonsterName = pd2.target.getCustomName();
|
MonsterName = GenericFunctions.getDisplayName(pd2.target);
|
||||||
if (pd2.target.getCustomName()!=null &&
|
if (GenericFunctions.getDisplayName(pd2.target)!=null &&
|
||||||
!pd2.target.getCustomName().contains("Leader") &&
|
!GenericFunctions.getDisplayName(pd2.target).contains("Leader") &&
|
||||||
MonsterController.isZombieLeader(pd2.target)) {
|
MonsterController.isZombieLeader(pd2.target)) {
|
||||||
pd2.target.setCustomName(pd2.target.getCustomName()+" Leader");
|
pd2.target.setCustomName(GenericFunctions.getDisplayName(pd2.target)+" Leader");
|
||||||
MonsterName = pd2.target.getCustomName();
|
MonsterName = GenericFunctions.getDisplayName(pd2.target);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MonsterName = GenericFunctions.CapitalizeFirstLetters(MonsterName.replace("_", " "));
|
MonsterName = GenericFunctions.CapitalizeFirstLetters(MonsterName.replace("_", " "));
|
||||||
}
|
}
|
||||||
|
if (MonsterName.contains(ChatColor.RESET+" ")) {
|
||||||
|
MonsterName = MonsterName.split(ChatColor.RESET+" ")[0];
|
||||||
|
}
|
||||||
final String finalMonsterName = MonsterName;
|
final String finalMonsterName = MonsterName;
|
||||||
String heartdisplay = "", remainingheartdisplay = "";
|
String heartdisplay = "", remainingheartdisplay = "";
|
||||||
int color1=0,color2=1;
|
int color1=0,color2=1;
|
||||||
|
@ -47,7 +47,8 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
sendAllLoggedMessagesToSpam();
|
sendAllLoggedMessagesToSpam();
|
||||||
|
|
||||||
//SAVE SERVER SETTINGS.
|
//SAVE SERVER SETTINGS.
|
||||||
if (TwosideKeeper.getServerTickTime()-TwosideKeeper.LASTSERVERCHECK>=TwosideKeeper.SERVERCHECKERTICKS) { //15 MINUTES (DEFAULT)
|
final long serverTickTime = TwosideKeeper.getServerTickTime();
|
||||||
|
if (serverTickTime-TwosideKeeper.LASTSERVERCHECK>=TwosideKeeper.SERVERCHECKERTICKS) { //15 MINUTES (DEFAULT)
|
||||||
ServerHeartbeat.saveOurData();
|
ServerHeartbeat.saveOurData();
|
||||||
|
|
||||||
//Advertisement messages could go here.
|
//Advertisement messages could go here.
|
||||||
@ -67,13 +68,13 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
getServer().broadcastMessage(" ");
|
getServer().broadcastMessage(" ");
|
||||||
*/
|
*/
|
||||||
//End Advertisements.
|
//End Advertisements.
|
||||||
TwosideKeeper.LASTSERVERCHECK=TwosideKeeper.getServerTickTime();
|
TwosideKeeper.LASTSERVERCHECK=serverTickTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Bukkit.getWorld("world").getTime()>=12000) {
|
if (Bukkit.getWorld("world").getTime()>=12000) {
|
||||||
Collection<? extends Player> players = ServerHeartbeat.getServer().getOnlinePlayers();
|
Collection<? extends Player> players = ServerHeartbeat.getServer().getOnlinePlayers();
|
||||||
//Count the number of players sleeping. Compare to "sleepingplayers" count.
|
//Count the number of players sleeping. Compare to "sleepingplayers" count.
|
||||||
TwosideKeeper.log("[DEBUG] Time: "+Bukkit.getWorld("world").getTime()+" Full Time: "+Bukkit.getWorld("world").getFullTime() + " SERVERTICKTIME: "+TwosideKeeper.getServerTickTime(),4);
|
TwosideKeeper.log("[DEBUG] Time: "+Bukkit.getWorld("world").getTime()+" Full Time: "+Bukkit.getWorld("world").getFullTime() + " SERVERTICKTIME: "+serverTickTime,4);
|
||||||
//This functionality only makes sense when two or more players are on.
|
//This functionality only makes sense when two or more players are on.
|
||||||
int sleeping=0;
|
int sleeping=0;
|
||||||
for (Player p : players) {
|
for (Player p : players) {
|
||||||
@ -118,8 +119,8 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
||||||
GenericFunctions.RemoveNewDebuffs(p);
|
GenericFunctions.RemoveNewDebuffs(p);
|
||||||
|
|
||||||
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<TwosideKeeper.getServerTickTime()) {
|
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<serverTickTime) {
|
||||||
pd.lastsprintcheck=TwosideKeeper.getServerTickTime();
|
pd.lastsprintcheck=serverTickTime;
|
||||||
GenericFunctions.ApplySwiftAegis(p);
|
GenericFunctions.ApplySwiftAegis(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,13 +159,13 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
pd.velocity=0;
|
pd.velocity=0;
|
||||||
}
|
}
|
||||||
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
|
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
|
||||||
aPlugin.API.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,pd.highwinderdmg));
|
GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,pd.highwinderdmg));
|
||||||
}
|
}
|
||||||
if (pd.target!=null && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())>256) {
|
if (pd.target!=null && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())>256) {
|
||||||
pd.target=null;
|
pd.target=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pd.lasthittarget+20*15<=TwosideKeeper.getServerTickTime() && pd.storedbowxp>0 && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
if (pd.lasthittarget+20*15<=serverTickTime && pd.storedbowxp>0 && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||||
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
|
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
|
||||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.storedbowxp, p);
|
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.storedbowxp, p);
|
||||||
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 2);
|
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 2);
|
||||||
@ -184,15 +185,15 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
|
|
||||||
ItemStack[] equips = p.getEquipment().getArmorContents();
|
ItemStack[] equips = p.getEquipment().getArmorContents();
|
||||||
|
|
||||||
if (pd.last_regen_time+TwosideKeeper.HEALTH_REGENERATION_RATE<=TwosideKeeper.getServerTickTime()) {
|
if (pd.last_regen_time+TwosideKeeper.HEALTH_REGENERATION_RATE<=serverTickTime) {
|
||||||
pd.last_regen_time=TwosideKeeper.getServerTickTime();
|
pd.last_regen_time=serverTickTime;
|
||||||
//See if this player needs to be healed.
|
//See if this player needs to be healed.
|
||||||
if (p!=null &&
|
if (p!=null &&
|
||||||
!p.isDead() && //Um, don't heal them if they're dead...That's just weird.
|
!p.isDead() && //Um, don't heal them if they're dead...That's just weird.
|
||||||
p.getHealth()<p.getMaxHealth() &&
|
p.getHealth()<p.getMaxHealth() &&
|
||||||
p.getFoodLevel()>=16) {
|
p.getFoodLevel()>=16) {
|
||||||
|
|
||||||
if (PlayerMode.getPlayerMode(p)!=PlayerMode.SLAYER || pd.lastcombat+(20*60)<TwosideKeeper.getServerTickTime()) {
|
if (PlayerMode.getPlayerMode(p)!=PlayerMode.SLAYER || pd.lastcombat+(20*60)<serverTickTime) {
|
||||||
double totalregen = 1+(p.getMaxHealth()*0.05);
|
double totalregen = 1+(p.getMaxHealth()*0.05);
|
||||||
double bonusregen = 0.0;
|
double bonusregen = 0.0;
|
||||||
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 4, 4);
|
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 4, 4);
|
||||||
@ -221,8 +222,8 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
|
if (p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
|
||||||
if (pd.endnotification+72000<TwosideKeeper.getServerTickTime()) {
|
if (pd.endnotification+72000<serverTickTime) {
|
||||||
pd.endnotification=TwosideKeeper.getServerTickTime();
|
pd.endnotification=serverTickTime;
|
||||||
playEndWarningNotification(p);
|
playEndWarningNotification(p);
|
||||||
}
|
}
|
||||||
randomlyAggroNearbyEndermen(p);
|
randomlyAggroNearbyEndermen(p);
|
||||||
@ -251,12 +252,12 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
|
||||||
pd.last_swordhit+40<TwosideKeeper.getServerTickTime()) {
|
pd.last_swordhit+40<serverTickTime) {
|
||||||
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
|
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerMode.isSlayer(p)) {
|
if (PlayerMode.isSlayer(p)) {
|
||||||
if (pd.lastsneak+50<=TwosideKeeper.getServerTickTime() &&
|
if (pd.lastsneak+50<=serverTickTime &&
|
||||||
p.isSneaking() &&
|
p.isSneaking() &&
|
||||||
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) {
|
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) {
|
||||||
GenericFunctions.deAggroNearbyTargets(p);
|
GenericFunctions.deAggroNearbyTargets(p);
|
||||||
@ -281,6 +282,7 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericFunctions.sendActionBarMessage(p, "");
|
||||||
GenericFunctions.AutoRepairItems(p);
|
GenericFunctions.AutoRepairItems(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,11 +296,14 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
|
|
||||||
private void MaintainMonsterData() {
|
private void MaintainMonsterData() {
|
||||||
Set<UUID> data= TwosideKeeper.monsterdata.keySet();
|
Set<UUID> data= TwosideKeeper.monsterdata.keySet();
|
||||||
|
TwosideKeeper.log("Size: "+TwosideKeeper.monsterdata.size(), 2);
|
||||||
for (UUID id : data) {
|
for (UUID id : data) {
|
||||||
MonsterStructure ms = TwosideKeeper.monsterdata.get(id);
|
MonsterStructure ms = TwosideKeeper.monsterdata.get(id);
|
||||||
if (ms.m==null || !ms.m.isValid()) {
|
if (!ms.m.isValid()) {
|
||||||
TwosideKeeper.monsterdata.remove(data);
|
//TwosideKeeper.monsterdata.remove(data);
|
||||||
TwosideKeeper.log("Removed Monster Structure for "+id+". New Size: "+TwosideKeeper.monsterdata.size(), 5);
|
TwosideKeeper.ScheduleRemoval(TwosideKeeper.monsterdata, ms);
|
||||||
|
TwosideKeeper.ScheduleRemoval(data, id);
|
||||||
|
TwosideKeeper.log("Removed Monster Structure for "+id+".", 2);
|
||||||
} else {
|
} else {
|
||||||
AddEliteStructureIfOneDoesNotExist(ms);
|
AddEliteStructureIfOneDoesNotExist(ms);
|
||||||
ms.UpdateGlow();
|
ms.UpdateGlow();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user