Added buff methods to API. Fixed minor issues with buff system. Fixed

implementation of Toxin set.
This commit is contained in:
sigonasr2 2017-05-14 11:48:32 -07:00
parent dcf5629e76
commit 5e14364761
10 changed files with 369 additions and 72 deletions

Binary file not shown.

View File

@ -17,7 +17,17 @@ public class Buff {
private Color col; private Color col;
private String icon; private String icon;
private boolean isGoodBuff; //If false, it's a debuff. private boolean isGoodBuff; //If false, it's a debuff.
private boolean permanentBuff; //Whether or not this buff/debuff cannot be removed by normal means.
/**
* Creates a new Buff structure.
* @param displayName The name that will show up in the action bar for players if they have this buff.
* @param duration The amount of time in ticks the buff will remain active.
* @param amplifier The amplifier/level/stack amount of this buff.
* @param buffcolor The color of the particles this buff creates.
* @param icon An icon that appears for the buff in the action bar and status bar for monster name tags. This typically includes a chat color code as well to distinguish this buff's color.
* @param isGoodBuff Whether or not this is a good buff. Debuffs should have this set to false.
*/
public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon, boolean isGoodBuff) { public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon, boolean isGoodBuff) {
this.displayName=displayName; this.displayName=displayName;
this.expireTime=TwosideKeeper.getServerTickTime()+duration; this.expireTime=TwosideKeeper.getServerTickTime()+duration;
@ -25,6 +35,27 @@ public class Buff {
this.col=buffcolor; this.col=buffcolor;
this.icon=icon; this.icon=icon;
this.isGoodBuff=isGoodBuff; this.isGoodBuff=isGoodBuff;
this.permanentBuff=false;
}
/**
* Creates a new Buff structure.
* @param displayName The name that will show up in the action bar for players if they have this buff.
* @param duration The amount of time in ticks the buff will remain active.
* @param amplifier The amplifier/level/stack amount of this buff.
* @param buffcolor The color of the particles this buff creates.
* @param icon An icon that appears for the buff in the action bar and status bar for monster name tags. This typically includes a chat color code as well to distinguish this buff's color.
* @param isGoodBuff Whether or not this is a good buff. Debuffs should have this set to false.
* @param permanentBuff Whether or not this buff cannot be removed. When set to true, the method buffCanBeRemoved() returns false, notifying the programmers that this buff should not be removed. This make the use of removeBuff() for this buff do absolutely nothing.
*/
public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon, boolean isGoodBuff, boolean permanentBuff) {
this.displayName=displayName;
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
this.level=amplifier;
this.col=buffcolor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=permanentBuff;
} }
public static boolean hasBuffInHashMap(LivingEntity l, String name) { public static boolean hasBuffInHashMap(LivingEntity l, String name) {
@ -111,7 +142,11 @@ public class Buff {
public static void addBuff(LivingEntity l, String name, Buff buff) { public static void addBuff(LivingEntity l, String name, Buff buff) {
addBuff(l,name,buff,false); addBuff(l,name,buff,false);
} }
/**
* Attempts to add a buff to the target. This will not necessarily add the buff if the amplifier
* is weaker than what is currently applied, or the amplifier is the same but the duration is less.
* This follows the same rules established by all other buff mechanics added previously to the server.
*/
public static void addBuff(LivingEntity l, String name, Buff buff, boolean stacking) { public static void addBuff(LivingEntity l, String name, Buff buff, boolean stacking) {
if (l instanceof Player) { if (l instanceof Player) {
Player p = (Player)l; Player p = (Player)l;
@ -170,43 +205,77 @@ public class Buff {
if (l instanceof Player) { if (l instanceof Player) {
Player p = (Player)l; Player p = (Player)l;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.buffs.remove(name); Buff b = pd.buffs.remove(name);
if (b!=null && !b.buffCanBeRemoved()) {
pd.buffs.put(name, b);
}
} else { } else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l); LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.buffs.remove(name); Buff b = les.buffs.remove(name);
if (b!=null && !b.buffCanBeRemoved()) {
les.buffs.put(name, b);
}
} }
} }
/**
* Increases the level relative to the amt provided.
*/
public void increaseStacks(int amt) { public void increaseStacks(int amt) {
level+=amt; level+=amt;
} }
/**
* Decreases the level relative to the amt provided. Can go negative.
*/
public void decreaseStacks(int amt) { public void decreaseStacks(int amt) {
level-=amt; level-=amt;
} }
/**
* Sets the level of the buff directly to amt.
*/
public void setStacks(int amt) { public void setStacks(int amt) {
level=amt; level=amt;
} }
/**
* Increases the duration of the buff by <b>duration</b> number of ticks.
*/
public void increaseDuration(int duration) { public void increaseDuration(int duration) {
expireTime+=duration; expireTime+=duration;
} }
/**
* Decreases duration of the buff by <b>duration</b> number of ticks.
*/
public void decreaseDuration(int duration) { public void decreaseDuration(int duration) {
expireTime-=duration; expireTime-=duration;
} }
/**
* Sets the duration of the buff to <b>duration</b> ticks.
*/
public void setDuration(int duration) { public void setDuration(int duration) {
refreshDuration(duration); refreshDuration(duration);
} }
/**
* Refreshes the buff's duration so time starts at the original duration again.
*/
public void refreshDuration(int duration) { public void refreshDuration(int duration) {
expireTime=TwosideKeeper.getServerTickTime()+duration; expireTime=TwosideKeeper.getServerTickTime()+duration;
} }
/**
* Whether or not this is considered a good buff (true) or a bad buff (false)
*/
public boolean isGoodBuff() { public boolean isGoodBuff() {
return isGoodBuff; return isGoodBuff;
} }
/**
* Whether or not this is considered a bad buff (true) or a good buff (false)
*/
public boolean isDebuff() { public boolean isDebuff() {
return !isGoodBuff; return !isGoodBuff;
} }
/**
private static boolean hasBuffExpired(Buff b) { * Whether or not this buff has ran out of time.
*/
public static boolean hasBuffExpired(Buff b) {
if (b.expireTime<TwosideKeeper.getServerTickTime()) { if (b.expireTime<TwosideKeeper.getServerTickTime()) {
return false; return false;
} else { } else {
@ -214,36 +283,66 @@ public class Buff {
} }
} }
/**
* Gets the name that shows up in the action bar for the player.
*/
public String getDisplayName() { public String getDisplayName() {
return displayName; return displayName;
} }
/**
* Gets the expiration time of the buff in ticks, to be compared with TwosideKeeper.getServerTickTime().
*/
public long getExpireTime() { public long getExpireTime() {
return expireTime; return expireTime;
} }
/**
* Gets the level/amplifier/stack amount of this buff.
*/
public int getAmplifier() { public int getAmplifier() {
return level; return level;
} }
/**
* Gets the swirly particle colors that appear when this buff is applied.
*/
public Color getBuffParticleColor() { public Color getBuffParticleColor() {
return col; return col;
} }
/**
* Gets the remaining amount of time this buff is still active on this entity. Returns 0 if it has already expired.
*/
public long getRemainingBuffTime() { public long getRemainingBuffTime() {
return Math.max(expireTime-TwosideKeeper.getServerTickTime(),0); return Math.max(expireTime-TwosideKeeper.getServerTickTime(),0);
} }
/**
* Returns a print-friendly version of this structure.
*/
public String toString() { public String toString() {
return "Buff(Name="+displayName+",Time="+expireTime+",Level="+level+",Color="+col+",Icon="+getBuffIcon()+")"; return "Buff(Name="+displayName+",Time="+expireTime+",Level="+level+",Color="+col+",Icon="+getBuffIcon()+")";
} }
/**
* Returns the string that consistss of the buff icon for this buff. Usually includes a chat color code.
*/
public String getBuffIcon() { public String getBuffIcon() {
return icon; return icon;
} }
/**
* Whether or not this buff can be removed.
*/
public boolean buffCanBeRemoved() {
return !permanentBuff;
}
public static boolean buffCanBeRemoved() { /**
//For now, there are no buffs that cannot be removed. * Whether or not the specified buff can be removed.
return true; */
public static boolean buffCanBeRemoved(Buff b) {
return !b.permanentBuff;
} }
} }

View File

@ -14,6 +14,7 @@ import org.bukkit.Difficulty;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -67,6 +68,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlockNode;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.IndicatorType; import sig.plugin.TwosideKeeper.HelperStructures.Utils.IndicatorType;
@ -487,7 +489,7 @@ public class CustomDamage {
aPlugin.API.sendEntityHurtAnimation(target); aPlugin.API.sendEntityHurtAnimation(target);
} }
if (damager==null && (reason.equalsIgnoreCase("POISON") || reason.equalsIgnoreCase("Shrapnel")) && !(target instanceof Player)) { if (damager==null && (isDot(reason)) && !(target instanceof Player)) {
EntityUtils.applyDamageIndicator(target, damage, IndicatorType.DOT); EntityUtils.applyDamageIndicator(target, damage, IndicatorType.DOT);
} }
@ -501,6 +503,12 @@ public class CustomDamage {
} }
} }
private static boolean isDot(String reason) {
return reason.equalsIgnoreCase("POISON") || reason.equalsIgnoreCase("Shrapnel") ||
reason.equalsIgnoreCase("BLEEDING") || reason.equalsIgnoreCase("CRIPPLE") ||
reason.equalsIgnoreCase("BURN");
}
/** /**
* Applies all on-hit effects when something gets hit. * Applies all on-hit effects when something gets hit.
* @param damage * @param damage
@ -691,8 +699,8 @@ public class CustomDamage {
performMegaKnockback(damager,target); performMegaKnockback(damager,target);
if ((damager!=null && damager instanceof Arrow) || (weapon!=null && weapon.getType()!=Material.BOW)) { if ((damager!=null && damager instanceof Arrow) || (weapon!=null && weapon.getType()!=Material.BOW)) {
removePermEnchantments(p,weapon); removePermEnchantments(p,weapon);
applyShrapnel(p,target); applyShrapnel(damager,p,target);
applyDoTs(p,target); applyDoTs(damager,p,target);
} }
//GenericFunctions.knockOffGreed(p); //GenericFunctions.knockOffGreed(p);
castEruption(p,target,weapon); castEruption(p,target,weapon);
@ -710,6 +718,7 @@ public class CustomDamage {
damage = applyBarbarianBonuses(p,target,weapon,damage,reason); damage = applyBarbarianBonuses(p,target,weapon,damage,reason);
increaseWindCharges(p); increaseWindCharges(p);
applyWindSlashEffects(p,target,damage,reason); applyWindSlashEffects(p,target,damage,reason);
createFirePool(p,damager,target,damage,reason);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
if (isFlagSet(pd.lasthitproperties,IS_CRIT)) { if (isFlagSet(pd.lasthitproperties,IS_CRIT)) {
@ -778,26 +787,36 @@ public class CustomDamage {
return damage; return damage;
} }
private static void applyDoTs(Player p, LivingEntity target) { private static void createFirePool(Player p, Entity damager, LivingEntity target, double damage, String reason) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 2)) { if (damager instanceof Projectile) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 2, 2)/100d; if (ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN); new TemporaryBlockNode(target.getLocation(),3,100,"FIREPOOL",Particle.DRIP_LAVA,60);
if (Math.random()<=(basechance + calculateDebuffChance(p))) {
Buff.addBuff(target, "BLEEDING", new Buff("Bleeding",20*15,tier,Color.MAROON,ChatColor.DARK_RED+"",false));
} }
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 3)) { }
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 3, 3)/100d;
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN); private static void applyDoTs(Entity damager, Player p, LivingEntity target) {
if (Math.random()<=(basechance + calculateDebuffChance(p))) { if (damager instanceof Projectile) {
Buff.addBuff(target, "INFECTION", new Buff("Infection",20*10,tier,Color.GRAY,ChatColor.GRAY+"",false)); if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 2)) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 2, 2)/100d;
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN);
if (Math.random()<=(basechance + calculateDebuffChance(p))) {
Buff.addBuff(target, "BLEEDING", new Buff("Bleeding",20*15,tier,Color.MAROON,ChatColor.DARK_RED+"",false));
}
} }
} if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 3)) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 4)) { double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 3, 3)/100d;
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 4, 4)/100d; int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN);
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN); if (Math.random()<=(basechance + calculateDebuffChance(p))) {
if (Math.random()<=(basechance + calculateDebuffChance(p))) { Buff.addBuff(target, "INFECTION", new Buff("Infection",20*10,tier,Color.GRAY,ChatColor.GRAY+"",false));
Buff.addBuff(target, "CRIPPLE", new Buff("Cripple",20*10,tier,Color.WHITE,ChatColor.WHITE+"",false)); }
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 4)) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 4, 4)/100d;
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN);
if (Math.random()<=(basechance + calculateDebuffChance(p))) {
Buff.addBuff(target, "CRIPPLE", new Buff("Cripple",20*10,tier,Color.WHITE,ChatColor.WHITE+"",false));
}
} }
} }
} }
@ -818,10 +837,12 @@ public class CustomDamage {
} }
} }
private static void applyShrapnel(Player p, LivingEntity target) { private static void applyShrapnel(Entity damager, Player p, LivingEntity target) {
if (ItemSet.hasFullSet(p, ItemSet.SHARD)) { if (damager instanceof Projectile) {
int shrapnellv = ItemSet.getHighestTierInSet(p, ItemSet.SHARD); if (ItemSet.hasFullSet(p, ItemSet.SHARD)) {
Buff.addBuff(target, "SHRAPNEL", new Buff("Shrapnel",20*10,shrapnellv,Color.RED,ChatColor.RED+"",false), true); int shrapnellv = ItemSet.getHighestTierInSet(p, ItemSet.SHARD);
Buff.addBuff(target, "SHRAPNEL", new Buff("Shrapnel",20*10,shrapnellv,Color.RED,ChatColor.RED+"",false), true);
}
} }
} }

View File

@ -4409,7 +4409,7 @@ public class GenericFunctions {
for (String key : buffdata.keySet()) { for (String key : buffdata.keySet()) {
Buff b = buffdata.get(key); Buff b = buffdata.get(key);
if (b.isDebuff()) { if (b.isDebuff()) {
if (Math.random()<=removechance/100 && Buff.buffCanBeRemoved()) { if (Math.random()<=removechance/100 && b.buffCanBeRemoved()) {
Buff.removeBuff(p, key); Buff.removeBuff(p, key);
p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(b.getDisplayName().replace("_", " "))); p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(b.getDisplayName().replace("_", " ")));
} }

View File

@ -195,6 +195,7 @@ public class TemporaryBlock {
public static boolean isTemporaryBlock(Block b) { public static boolean isTemporaryBlock(Block b) {
return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b)); return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b));
} }
@Deprecated
public static boolean isStandingOnSpecialBlock(Location l, String specialKey) { public static boolean isStandingOnSpecialBlock(Location l, String specialKey) {
//return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b)); //return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b));
Block b = l.getBlock(); Block b = l.getBlock();
@ -205,6 +206,7 @@ public class TemporaryBlock {
return false; return false;
} }
} }
@Deprecated
public static boolean isInRangeOfSpecialBlock(Location l, double range, String specialKey) { public static boolean isInRangeOfSpecialBlock(Location l, double range, String specialKey) {
Block b = l.getBlock(); Block b = l.getBlock();
//TwosideKeeper.log(b.toString(), 0); //TwosideKeeper.log(b.toString(), 0);

View File

@ -1,7 +1,21 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects; package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.Buff;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class TemporaryBlockNode { public class TemporaryBlockNode {
Location l; Location l;
@ -10,6 +24,7 @@ public class TemporaryBlockNode {
String specialKey; String specialKey;
Particle effect; Particle effect;
int particleDensity; //Number of particles per second. int particleDensity; //Number of particles per second.
long lastAppliedEffect=TwosideKeeper.getServerTickTime();
public TemporaryBlockNode(Location l, double range, int duration, String key) { public TemporaryBlockNode(Location l, double range, int duration, String key) {
this.l=l; this.l=l;
@ -18,6 +33,7 @@ public class TemporaryBlockNode {
this.duration=duration; this.duration=duration;
this.effect=null; this.effect=null;
this.particleDensity=0; this.particleDensity=0;
TwosideKeeper.blocknodes.add(this);
} }
public TemporaryBlockNode(Location l, double range, int duration, String key, Particle effect, int density) { public TemporaryBlockNode(Location l, double range, int duration, String key, Particle effect, int density) {
@ -27,13 +43,99 @@ public class TemporaryBlockNode {
this.duration=duration; this.duration=duration;
this.effect=effect; this.effect=effect;
this.particleDensity=density; this.particleDensity=density;
TwosideKeeper.blocknodes.add(this);
} }
public boolean runTick() { public boolean runTick() {
if (duration--<0) { playParticleEffects();
affectEntitiesBasedOnKey();
duration-=5;
if (duration<0) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
private void affectEntitiesBasedOnKey() {
switch (specialKey) {
case "TESTNODE":{
for (Entity e : getNonPlayersOnNode()) {
if (e instanceof LivingEntity) {
CustomDamage.ApplyDamage(1, null, (LivingEntity)e, null, "Test Damage");
}
}
}break;
case "FIREPOOL":{
if (lastAppliedEffect+20<TwosideKeeper.getServerTickTime()) {
lastAppliedEffect = TwosideKeeper.getServerTickTime();
for (Entity e : getNonPlayersOnNode()) {
if (e instanceof LivingEntity) {
Buff.addBuff((LivingEntity)e, "BURN", new Buff("Burn",100,1,Color.ORANGE,ChatColor.GOLD+"",false),true);
}
}
}
}break;
}
}
private void playParticleEffects() {
if (effect!=null) {
for (int i=0;i<particleDensity/4;i++) {
SpawnParticleInRandomLocation();
}
if (Math.random()<=(particleDensity%20)*0.05) {
SpawnParticleInRandomLocation();
}
}
}
private void SpawnParticleInRandomLocation() {
l.getWorld().spawnParticle(effect, new Location(l.getWorld(),l.getX()+Math.random()*range-(Math.random()*(range*2))
,l.getY()+Math.random()*range-(Math.random()*(range*2))
,l.getZ()+Math.random()*range-(Math.random()*(range*2))), 2);
}
public Entity[] getEntitiesOnNode() {
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
return ents.toArray(new Entity[ents.size()]);
}
public List<Entity> getPlayersOnNode() {
long time = System.nanoTime();
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
List<Entity> list = new ArrayList<Entity>();
for (Entity e : ents) {
if (e instanceof Player) {
list.add(e);
}
}
TwosideKeeper.log("Calculation time via nearby entities: "+(System.nanoTime()-time), TwosideKeeper.TIMINGS_DEBUG);
return list;
}
public List<Entity> getNonPlayersOnNode() {
long time = System.nanoTime();
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
List<Entity> list = new ArrayList<Entity>();
for (Entity e : ents) {
if (!(e instanceof Player)) {
list.add(e);
}
}
TwosideKeeper.log("Calculation time via nearby entities: "+(System.nanoTime()-time), TwosideKeeper.TIMINGS_DEBUG);
return list;
}
@Deprecated
public List<Entity> getPlayersOnNodeViaDistanceSearch() {
long time = System.nanoTime();
List<Entity> list = new ArrayList<Entity>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getLocation().distance(l)<=range) {
list.add(p);
}
}
TwosideKeeper.log("Calculation time via distance search: "+(System.nanoTime()-time), TwosideKeeper.TIMINGS_DEBUG);
return list;
}
} }

View File

@ -958,10 +958,10 @@ public enum ItemSet {
lore.add(ChatColor.GRAY+" this target has to nearby targets.)"); lore.add(ChatColor.GRAY+" this target has to nearby targets.)");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Chance of projectiles applying Cripple "+WorldShop.toRomanNumeral(tier)+" to target (10 sec)."); lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Chance of projectiles applying Cripple "+WorldShop.toRomanNumeral(tier)+" to target (10 sec).");
lore.add(ChatColor.GRAY+" (Cripple slows the target and decreases target's damage"); lore.add(ChatColor.GRAY+" (Cripple slows the target and decreases target's damage");
lore.add(ChatColor.GRAY+" outpu t by 10% per level.)"); lore.add(ChatColor.GRAY+" output by 10% per level.)");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Fire Cesspool"+ABILITY_LABEL_END); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Fire Cesspool"+ABILITY_LABEL_END);
lore.add(ChatColor.GRAY+" Shooting projectiles at the ground converts the land into"); lore.add(ChatColor.GRAY+" When projectiles hit a target, a temporary file pool");
lore.add(ChatColor.GRAY+" a temporary fire pool, applying stacking Burn to all"); lore.add(ChatColor.GRAY+" is created around it, applying stacking Burn to all");
lore.add(ChatColor.GRAY+" enemy targets in the fire pool. (Burn deals more damage"); lore.add(ChatColor.GRAY+" enemy targets in the fire pool. (Burn deals more damage");
lore.add(ChatColor.GRAY+" as the number of stacks increase.)"); lore.add(ChatColor.GRAY+" as the number of stacks increase.)");
break; break;

View File

@ -231,6 +231,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Effects.EarthWaveTask;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume; import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.ReplaceBlockTask; import sig.plugin.TwosideKeeper.HelperStructures.Effects.ReplaceBlockTask;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlock; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlock;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlockNode;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.WindSlash; import sig.plugin.TwosideKeeper.HelperStructures.Effects.WindSlash;
@ -452,6 +453,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int COMBAT_DEBUG = 3; public static final int COMBAT_DEBUG = 3;
public static final int GRAPH_DEBUG = 5; public static final int GRAPH_DEBUG = 5;
public static final int GRAPH_DEBUG2 = 0; public static final int GRAPH_DEBUG2 = 0;
public static final int TIMINGS_DEBUG = 5;
public static double worldShopDistanceSquared = 1000000; public static double worldShopDistanceSquared = 1000000;
public static double worldShopPriceMult = 2.0; //How much higher the price increases for every increment of worlsShopDistanceSquared. public static double worldShopPriceMult = 2.0; //How much higher the price increases for every increment of worlsShopDistanceSquared.
@ -478,6 +480,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static List<Camera> cameras = new ArrayList<Camera>(); public static List<Camera> cameras = new ArrayList<Camera>();
public static List<Arena> arenas = new ArrayList<Arena>(); public static List<Arena> arenas = new ArrayList<Arena>();
public static List<WindSlash> windslashes = new ArrayList<WindSlash>(); public static List<WindSlash> windslashes = new ArrayList<WindSlash>();
public static List<TemporaryBlockNode> blocknodes = new ArrayList<TemporaryBlockNode>();
public static HashMap<String,TemporaryBlock> temporaryblocks = new HashMap<String,TemporaryBlock>(); public static HashMap<String,TemporaryBlock> temporaryblocks = new HashMap<String,TemporaryBlock>();
//public static stats StatCommand = new stats(); //public static stats StatCommand = new stats();
@ -848,6 +851,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Wind Slash Handling", (int)(System.nanoTime()-time));time=System.nanoTime(); TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Wind Slash Handling", (int)(System.nanoTime()-time));time=System.nanoTime();
for (TemporaryBlockNode tbn : blocknodes) {
if (!tbn.runTick()) {
ScheduleRemoval(blocknodes,tbn);
}
}
TwosideKeeper.HeartbeatLogger.AddEntry("Temporary Block Node Handling", (int)(System.nanoTime()-time));time=System.nanoTime();
if ((int)(System.nanoTime()-totaltime)/1000000d>50) { 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.log("WARNING! Structure Handling took longer than 1 tick! "+((int)(System.nanoTime()-totaltime)/1000000d)+"ms", 0);
} }
@ -1879,6 +1889,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case "PARKOUR":{ case "PARKOUR":{
p.sendMessage("PARKOUR!!"); p.sendMessage("PARKOUR!!");
}break; }break;
case "TEMPORARYNODE":{
TemporaryBlockNode tbn = new TemporaryBlockNode(p.getLocation(),5,200,"TESTNODE",Particle.CRIT,30);
/*tbn.getPlayersOnNodeViaDistanceSearch();
tbn.getPlayersOnNodeViaNearbyEntities();*/
}break;
} }
} }
@ -3131,32 +3146,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onArrowHitBlock(ProjectileHitEvent ev) { public void onArrowHitBlock(ProjectileHitEvent ev) {
Projectile proj = ev.getEntity();
LivingEntity shooter = CustomDamage.getDamagerEntity(proj);
if (shooter!=null && shooter instanceof Player) {
Player p = (Player)shooter;
if (ItemSet.hasFullSet(p, ItemSet.SHARD)) {
GenericFunctions.DealExplosionDamageToEntities(ev.getEntity().getLocation(), 40f+shooter.getHealth()*0.1, 2, shooter, "Shrapnel Explosion");
aPlugin.API.sendSoundlessExplosion(ev.getEntity().getLocation(), 1);
SoundUtils.playGlobalSound(ev.getEntity().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 0.5f);
}
else
if (!proj.hasMetadata("FIREPOOL") && ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
//new TemporaryBlockNode(proj.getLocation(),3,100,"FIREPOOL",Particle.DRIP_LAVA,40);
TemporaryBlock.createTemporaryBlockCircle(proj.getLocation().add(0,-2,0), 2, Material.REDSTONE_BLOCK, (byte)0, 100, "FIRECESSPOOL");
proj.setMetadata("FIREPOOL", new FixedMetadataValue(this,true));
}
}
if (ev.getEntity() instanceof Arrow) { if (ev.getEntity() instanceof Arrow) {
Arrow a = (Arrow)ev.getEntity(); Arrow a = (Arrow)ev.getEntity();
LivingEntity shooter = CustomDamage.getDamagerEntity(a);
if (shooter!=null && shooter instanceof Player) {
Player p = (Player)shooter;
if (ItemSet.hasFullSet(p, ItemSet.SHARD)) {
GenericFunctions.DealExplosionDamageToEntities(ev.getEntity().getLocation(), 40f+shooter.getHealth()*0.1, 2, shooter, "Shrapnel Explosion");
aPlugin.API.sendSoundlessExplosion(ev.getEntity().getLocation(), 1);
SoundUtils.playGlobalSound(ev.getEntity().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 0.5f);
}
else
if (!a.hasMetadata("FIREPOOL") && ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
//TemporaryBlock.createTemporaryBlockCircle(a.getLocation().add(0,-2,0), 2, Material.REDSTONE_BLOCK, (byte)0, 100, "FIRECESSPOOL");
//a.setMetadata("FIREPOOL", new FixedMetadataValue(this,true));
AreaEffectCloud aec = (AreaEffectCloud)a.getWorld().spawnEntity(a.getLocation().getBlock().getLocation(), EntityType.AREA_EFFECT_CLOUD);
aec.setCustomName("FIREPOOL");
aec.setParticle(Particle.DRIP_LAVA);
aec.setDurationOnUse(20*5);
aec.setDuration(20*5);
aec.setRadius(2);
aec.setGlowing(true);
aec.setReapplicationDelay(20);
aec.setWaitTime(0);
aec.addCustomEffect(new PotionEffect(PotionEffectType.HARM,0,0), true);
}
}
a.setCustomName("HIT"); a.setCustomName("HIT");
return; return;
} }

View File

@ -1,6 +1,7 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
@ -615,4 +616,66 @@ public final class TwosideKeeperAPI {
public static double getCooldownReduction(Player p) { public static double getCooldownReduction(Player p) {
return CustomDamage.calculateCooldownReduction(p); return CustomDamage.calculateCooldownReduction(p);
} }
//Buff COMMANDS.
/**
* Returns whether or not a particular buff is active or not. Note that this is not the same
* as seeing if it exists in a player's buff data structure as expired buffs exist in those.
*/
public static boolean isBuffActive(LivingEntity l, String buffname) {
return Buff.hasBuff(l,buffname);
}
/**
* Outputs all buffs a particular LivingEntity has to the console.
*/
public static void outputBuffsToConsole(LivingEntity l) {
Buff.outputBuffs(l);
}
/**
* Returns a HashMap containing ALL buffs, expired or not that have been
* applied to this LivingEntity. Try isBuffExpired() to check which ones are
* active and which ones are not.
*/
public static HashMap<String,Buff> getBuffData(LivingEntity l) {
return Buff.getBuffData(l);
}
/**
* Returns whether or not this particular buff has expired. Note that past expired
* buffs are included in a player's buff data, so checking for expiration is
* important.
*/
public static boolean isBuffExpired(Buff b) {
return Buff.hasBuffExpired(b);
}
/**
* Returns the remaining buff time in ticks of this particular buff. Returns 0 if the buff has expired already.
*/
public static long getRemainingBuffTime(Buff b) {
return b.getRemainingBuffTime();
}
/**
* Returns the tick at which this buff expires.
*/
public static long getBuffExpirationTickTime(Buff b) {
return b.getExpireTime();
}
/**
* Adds a buff to the player's buff data structure, overwriting the buff if it contains
* the same name. A new Buff data structure has to be created and filled in.
*/
public static void addBuff(LivingEntity l, String name, Buff buff, boolean stacking) {
Buff.addBuff(l, name, buff, stacking);
}
/**
* Removes a buff, if possible.
*/
public static void removeBuff(LivingEntity l, String name) {
Buff.removeBuff(l, name);
}
/**
* Returns whether or not a buff can be removed. (If it's not permanent)
*/
public static boolean buffCanBeRemoved(Buff b) {
return Buff.buffCanBeRemoved(b);
}
} }

View File

@ -348,7 +348,7 @@ final class runServerHeartbeat implements Runnable {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)ent); PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)ent);
if (Buff.hasBuff(ent, "Poison") && pd.lastPoisonTick+getPoisonTickDelay(ent)<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "Poison") && pd.lastPoisonTick+getPoisonTickDelay(ent)<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "Poison")) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastPoisonTick=TwosideKeeper.getServerTickTime(); pd.lastPoisonTick=TwosideKeeper.getServerTickTime();
} }
@ -356,7 +356,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "SHRAPNEL") && pd.lastShrapnelTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "SHRAPNEL") && pd.lastShrapnelTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "SHRAPNEL")) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastShrapnelTick=TwosideKeeper.getServerTickTime(); pd.lastShrapnelTick=TwosideKeeper.getServerTickTime();
SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f); SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
@ -366,7 +366,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "BLEEDING") && pd.lastBleedingTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "BLEEDING") && pd.lastBleedingTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "BLEEDING")) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastBleedingTick=TwosideKeeper.getServerTickTime(); pd.lastBleedingTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f); //SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
@ -381,7 +381,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "INFECTION") && pd.lastInfectionTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "INFECTION") && pd.lastInfectionTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "INFECTION")) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "INFECTION").getAmplifier(), null, ent, null, "Infection", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage(Buff.getBuff(ent, "INFECTION").getAmplifier(), null, ent, null, "Infection", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastInfectionTick=TwosideKeeper.getServerTickTime(); pd.lastInfectionTick=TwosideKeeper.getServerTickTime();
infectNearbyPlayers(ent,pd.buffs); infectNearbyPlayers(ent,pd.buffs);
@ -399,7 +399,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "BURN") && pd.lastBurnTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "BURN") && pd.lastBurnTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "BURN")) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "BURN").getAmplifier(), null, ent, null, "Burn", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage(Buff.getBuff(ent, "BURN").getAmplifier(), null, ent, null, "Burn", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastBurnTick=TwosideKeeper.getServerTickTime(); pd.lastBurnTick=TwosideKeeper.getServerTickTime();
} }
@ -412,7 +412,7 @@ final class runServerHeartbeat implements Runnable {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent); LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent);
if (Buff.hasBuff(ent, "Poison") && les.lastPoisonTick+getPoisonTickDelay(ent)<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "Poison") && les.lastPoisonTick+getPoisonTickDelay(ent)<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "Poison")) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastPoisonTick=TwosideKeeper.getServerTickTime(); les.lastPoisonTick=TwosideKeeper.getServerTickTime();
} }
@ -420,7 +420,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "SHRAPNEL") && les.lastShrapnelTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "SHRAPNEL") && les.lastShrapnelTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "SHRAPNEL")) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastShrapnelTick=TwosideKeeper.getServerTickTime(); les.lastShrapnelTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f); //SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
@ -437,7 +437,7 @@ final class runServerHeartbeat implements Runnable {
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f); //SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
//ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5); //ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "BLEEDING")) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
} }
}, 10); //Bleeding DOT is twice as fast. }, 10); //Bleeding DOT is twice as fast.
@ -446,7 +446,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "INFECTION") && les.lastInfectionTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "INFECTION") && les.lastInfectionTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "INFECTION")) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "INFECTION").getAmplifier(), null, ent, null, "Infection", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage(Buff.getBuff(ent, "INFECTION").getAmplifier(), null, ent, null, "Infection", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastInfectionTick=TwosideKeeper.getServerTickTime(); les.lastInfectionTick=TwosideKeeper.getServerTickTime();
infectNearbyEntities(ent,les.buffs); infectNearbyEntities(ent,les.buffs);
@ -464,7 +464,7 @@ final class runServerHeartbeat implements Runnable {
} }
if (Buff.hasBuff(ent, "BURN") && les.lastBurnTick<=TwosideKeeper.getServerTickTime()) { if (Buff.hasBuff(ent, "BURN") && les.lastBurnTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) { if (ent!=null && Buff.hasBuff(ent, "BURN")) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "BURN").getAmplifier(), null, ent, null, "Burn", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK); CustomDamage.ApplyDamage(Buff.getBuff(ent, "BURN").getAmplifier(), null, ent, null, "Burn", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastBurnTick=TwosideKeeper.getServerTickTime(); les.lastBurnTick=TwosideKeeper.getServerTickTime();
} }
@ -543,6 +543,7 @@ final class runServerHeartbeat implements Runnable {
} }
} }
if (colors.size()>0) { if (colors.size()>0) {
//TwosideKeeper.log("Colors are: "+colors.toString(), 0);
for (int i=0;i<colors.size();i++) { for (int i=0;i<colors.size();i++) {
EntityUtils.createPotionEffectSwirls(l, colors.get(i), i*(100/colors.size())); EntityUtils.createPotionEffectSwirls(l, colors.get(i), i*(100/colors.size()));
} }
@ -560,6 +561,7 @@ final class runServerHeartbeat implements Runnable {
} }
} }
if (colors.size()>0) { if (colors.size()>0) {
//TwosideKeeper.log("->Colors are: "+colors.toString(), 0);
for (int i=0;i<colors.size();i++) { for (int i=0;i<colors.size();i++) {
EntityUtils.createPotionEffectSwirls(l, colors.get(i), i*(100/colors.size())); EntityUtils.createPotionEffectSwirls(l, colors.get(i), i*(100/colors.size()));
} }