Majorly improved overlay system to have multiple sections that are timed
separately.
This commit is contained in:
parent
d83be25465
commit
91841bba18
Binary file not shown.
@ -47,24 +47,24 @@ public class ActionBarBuffUpdater{
|
||||
effectString.append(AppendAmplifier((p.getFireTicks()/20)-1,false));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.lifestealstacks>0) {
|
||||
/*if (pd.lifestealstacks>0) {
|
||||
effectString.append(ChatColor.AQUA);
|
||||
effectString.append("❣");
|
||||
effectString.append(AppendAmplifier(pd.lifestealstacks-1));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.weaponcharges>0) {
|
||||
}*/
|
||||
/*if (pd.weaponcharges>0) {
|
||||
effectString.append(ChatColor.DARK_AQUA);
|
||||
effectString.append("☤");
|
||||
effectString.append(AppendAmplifier(pd.weaponcharges-1));
|
||||
effectString.append(" ");
|
||||
}
|
||||
if (pd.damagepool>0) {
|
||||
}*/
|
||||
/*if (pd.damagepool>0) {
|
||||
effectString.append(ChatColor.DARK_PURPLE);
|
||||
effectString.append("♥");
|
||||
effectString.append(AppendAmplifier((int)(pd.damagepool-1)));
|
||||
effectString.append(" ");
|
||||
}
|
||||
}*/
|
||||
if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime() &&
|
||||
ItemSet.hasFullSet((Player)p, ItemSet.SONGSTEEL)) {
|
||||
effectString.append(ChatColor.GRAY);
|
||||
|
@ -13,6 +13,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
|
||||
|
||||
public class Artifact {
|
||||
public static ItemStack createArtifactItem(ArtifactItem type) {
|
||||
@ -191,7 +192,7 @@ public class Artifact {
|
||||
(GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") ||
|
||||
item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item") ||
|
||||
(ItemUtils.LoreContainsSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T") &&
|
||||
ItemUtils.LoreContainsSubstring(item, " Artifact")))) {
|
||||
ItemUtils.LoreContainsSubstring(item, " Artifact") && TextUtils.hasNoSpaceBeforeAndAfter(ChatColor.GOLD+""+ChatColor.BOLD+"T"," Artifact",item.getItemMeta().getLore())))) {
|
||||
//This is an artifact.
|
||||
return true;
|
||||
} else {
|
||||
|
@ -58,6 +58,7 @@ import aPlugin.API;
|
||||
import sig.plugin.TwosideKeeper.Boss.EliteZombie;
|
||||
import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent;
|
||||
import sig.plugin.TwosideKeeper.Events.PlayerDodgeEvent;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.AdvancedTitle;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DamageStructure;
|
||||
@ -94,6 +95,7 @@ public class CustomDamage {
|
||||
public static final int IS_CRIT = 1; //System Flag. Used for telling a player structure their last hit was a crit.
|
||||
public static final int IS_HEADSHOT = 2; //System Flag. Used for telling a player structure their last hit was a headshot.
|
||||
public static final int IS_PREEMPTIVE = 4; //System Flag. Used for telling a player structure their last hit was a preemptive strike.
|
||||
public static final int IS_THORNS = 8; //System Flag. Used for telling a player structure their last hit was with thorns.
|
||||
|
||||
static public boolean ApplyDamage(double damage, Entity damager, LivingEntity target, ItemStack weapon, String reason) {
|
||||
return ApplyDamage(damage,damager,target,weapon,reason,NONE);
|
||||
@ -170,6 +172,8 @@ public class CustomDamage {
|
||||
if (!Dummy.isDummy(target)) {
|
||||
Bukkit.getPluginManager().callEvent(ev);
|
||||
}
|
||||
|
||||
setupDamagePropertiesForPlayer(damager,((reason!=null && reason.equalsIgnoreCase("thorns"))?IS_THORNS:0));
|
||||
if (!ev.isCancelled()) {
|
||||
//TwosideKeeper.log("Inside of here.", 0);
|
||||
DealDamageToEntity(dmg, damager, target, weapon, reason, flags);
|
||||
@ -309,6 +313,7 @@ public class CustomDamage {
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("Damage: "+dmg+", Armor Pen Damage: "+armorpendmg, 3);
|
||||
|
||||
setupDamagePropertiesForPlayer(damager,((crit)?IS_CRIT:0)|((headshot)?IS_HEADSHOT:0)|((preemptive)?IS_PREEMPTIVE:0));
|
||||
dmg = hardCapDamage(dmg+armorpendmg,target,reason);
|
||||
return dmg;
|
||||
@ -320,7 +325,7 @@ public class CustomDamage {
|
||||
Player p = (Player)shooter;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.damagepool>0) {
|
||||
mult+=pd.damagepool*(ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LEGION, 4, 4)/100d);
|
||||
mult+=(pd.damagepool/100d)*((ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LEGION, 4, 4)/100d));
|
||||
}
|
||||
}
|
||||
return mult;
|
||||
@ -560,6 +565,8 @@ public class CustomDamage {
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
GenericFunctions.sendActionBarMessage(p, "", true);
|
||||
//pd.customtitle.updateTitle(p);
|
||||
pd.customtitle.updateCombatBar(p, getDamagerEntity(damager));
|
||||
//GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+" Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+((pd.thorns_amt>0)?"/"+ChatColor.GOLD+df.format(pd.thorns_amt):"")+ChatColor.GREEN+" dmg stored",true);
|
||||
}
|
||||
}
|
||||
@ -637,6 +644,10 @@ public class CustomDamage {
|
||||
if (damage>0 && GenericFunctions.AttemptRevive(p, damage, reason)) {
|
||||
damage=0;
|
||||
}
|
||||
|
||||
//pd.customtitle.updateTitle(p);
|
||||
pd.customtitle.updateCombatBar(p, getDamagerEntity(damager));
|
||||
pd.lastattack=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
if ((shooter instanceof Player) && target!=null) {
|
||||
@ -789,6 +800,11 @@ public class CustomDamage {
|
||||
AwardDamageAchievement(p,damage);
|
||||
|
||||
appendDebuffsToName(target);
|
||||
|
||||
/*if ((reason!=null && !reason.equalsIgnoreCase("thorns")) || pd.customtitle.getTitles()[1].length()==0) {
|
||||
pd.customtitle.updateCombatBar(p, target, damage, pd.lasthitproperties);
|
||||
}*/
|
||||
pd.lastattack=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
if (target instanceof Monster) {
|
||||
if (reason!=null && reason.equalsIgnoreCase("SUFFOCATION")) {
|
||||
@ -1238,7 +1254,8 @@ public class CustomDamage {
|
||||
if (reason.equalsIgnoreCase("power swing")) {
|
||||
IncreaseLifestealStacks(p,10);
|
||||
pd.weaponcharges-=10;
|
||||
GenericFunctions.sendActionBarMessage(p, "");
|
||||
//GenericFunctions.sendActionBarMessage(p, "");
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
}
|
||||
if (p.isSneaking() && pd.weaponcharges>=30 && (reason==null || !reason.equalsIgnoreCase("forceful strike")) &&
|
||||
@ -1257,7 +1274,7 @@ public class CustomDamage {
|
||||
GenericFunctions.DealDamageToNearbyMobs(attackloc, dmg, 1, true, 0.6, p, weapon, false, "Forceful Strike");
|
||||
}
|
||||
pd.weaponcharges-=30;
|
||||
GenericFunctions.sendActionBarMessage(p, "");
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
}
|
||||
return dmg;
|
||||
@ -1277,7 +1294,7 @@ public class CustomDamage {
|
||||
amt*=2;
|
||||
}
|
||||
pd.weaponcharges+=amt;
|
||||
GenericFunctions.sendActionBarMessage(p, "");
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1287,7 +1304,6 @@ public class CustomDamage {
|
||||
amt*=2;
|
||||
}
|
||||
pd.lifestealstacks=Math.min(100,pd.lifestealstacks+amt*((pd.rage_time>TwosideKeeper.getServerTickTime())?2:1));
|
||||
GenericFunctions.sendActionBarMessage(p, "");
|
||||
}
|
||||
|
||||
private static double sendDamageToDamagePool(Player p, double damage, String reason) {
|
||||
@ -1525,6 +1541,7 @@ public class CustomDamage {
|
||||
pd.regenpool-=pd.damagepool;
|
||||
}
|
||||
pd.damagepool = Math.max(pd.damagepool-pd.regenpool, 0);
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
} else {
|
||||
pd.regenpool += lifestealamt;
|
||||
}
|
||||
@ -2025,6 +2042,7 @@ public class CustomDamage {
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
GenericFunctions.sendActionBarMessage(p, "", true);
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
//GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+" Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+((pd.thorns_amt>0)?"/"+ChatColor.GOLD+df.format(pd.thorns_amt):"")+ChatColor.GREEN+" dmg stored",true);
|
||||
}
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.VIXEN, 4)) {
|
||||
@ -2743,7 +2761,7 @@ public class CustomDamage {
|
||||
double headshotvaly=0.22/TwosideKeeper.HEADSHOT_ACC;
|
||||
TwosideKeeper.log("In here.", 5);
|
||||
if (proj.getShooter() instanceof Player) {
|
||||
TwosideKeeper.log("We somehow made it to here???", 5);
|
||||
TwosideKeeper.log("We somehow made it to here???", 0);
|
||||
Player p = (Player)proj.getShooter();
|
||||
if (PlayerMode.isRanger(p) &&
|
||||
GenericFunctions.getBowMode(p)==BowMode.SNIPE) {
|
||||
@ -2801,8 +2819,8 @@ public class CustomDamage {
|
||||
mult+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SHARD, 2, 2)/100d;
|
||||
}
|
||||
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage");
|
||||
isheadshot=true;
|
||||
}
|
||||
isheadshot=true;
|
||||
}
|
||||
|
||||
if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p)==BowMode.DEBILITATION) {
|
||||
@ -2838,6 +2856,12 @@ public class CustomDamage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (isheadshot) {
|
||||
pd.customtitle.modifyLargeCenterTitle(ChatColor.DARK_RED+"HEADSHOT !", 20);
|
||||
//pd.customtitle.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
172
src/sig/plugin/TwosideKeeper/HelperStructures/AdvancedTitle.java
Normal file
172
src/sig/plugin/TwosideKeeper/HelperStructures/AdvancedTitle.java
Normal file
@ -0,0 +1,172 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
|
||||
|
||||
public class AdvancedTitle {
|
||||
TitlePart large_lefttitle = new TitlePart("",0);
|
||||
TitlePart large_centertitle = new TitlePart("",0);
|
||||
TitlePart large_righttitle = new TitlePart("",0);
|
||||
TitlePart small_centertitle = new TitlePart("",0);
|
||||
Player p;
|
||||
|
||||
public AdvancedTitle(Player p) {
|
||||
this.p=p;
|
||||
}
|
||||
|
||||
public void modifyLargeLeftTitle(String title, int duration) {
|
||||
large_lefttitle.setTitle(title);
|
||||
large_lefttitle.setDuration(duration);
|
||||
update();
|
||||
}
|
||||
public void modifyLargeCenterTitle(String title, int duration) {
|
||||
large_centertitle.setTitle(title);
|
||||
large_centertitle.setDuration(duration);
|
||||
update();
|
||||
}
|
||||
public void modifyLargeRightTitle(String title, int duration) {
|
||||
large_righttitle.setTitle(title);
|
||||
large_righttitle.setDuration(duration);
|
||||
update();
|
||||
}
|
||||
public void modifySmallCenterTitle(String title, int duration) {
|
||||
small_centertitle.setTitle(title);
|
||||
small_centertitle.setDuration(duration);
|
||||
update();
|
||||
}
|
||||
|
||||
public void checkExpiredTitles() {
|
||||
boolean refreshnames=false;
|
||||
if (large_lefttitle.isExpired()) {
|
||||
large_lefttitle.clear();
|
||||
refreshnames=true;
|
||||
}
|
||||
if (large_centertitle.isExpired()) {
|
||||
large_centertitle.clear();
|
||||
refreshnames=true;
|
||||
}
|
||||
if (large_righttitle.isExpired()) {
|
||||
large_righttitle.clear();
|
||||
refreshnames=true;
|
||||
}
|
||||
if (small_centertitle.isExpired()) {
|
||||
small_centertitle.clear();
|
||||
refreshnames=true;
|
||||
}
|
||||
if (refreshnames) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
p.sendTitle(combineLargeTitles(), combineSmallTitles());
|
||||
}
|
||||
|
||||
private String combineSmallTitles() {
|
||||
StringBuilder sb = new StringBuilder(small_centertitle.getTitle());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String combineLargeTitles() {
|
||||
StringBuilder sb = new StringBuilder(large_lefttitle.getTitle());
|
||||
sb.append(ChatColor.RESET);
|
||||
if (large_lefttitle.getTitle().length()>0 ||
|
||||
large_righttitle.getTitle().length()>0) {
|
||||
if (large_centertitle.getTitle().length()==0) {
|
||||
sb.append(" ");
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(large_centertitle.getTitle());
|
||||
sb.append(ChatColor.RESET);
|
||||
sb.append(" ");
|
||||
}
|
||||
} else {
|
||||
sb.append(large_centertitle.getTitle());
|
||||
sb.append(ChatColor.RESET);
|
||||
}
|
||||
sb.append(large_righttitle.getTitle());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void updateCombatBar(Player p, LivingEntity target) {
|
||||
updateSideTitleStats(p);
|
||||
TwosideKeeper.updateHealthbarDisplay(p, target);
|
||||
update();
|
||||
}
|
||||
|
||||
public void updateCombatBar(Player p, LivingEntity target, double damage, int flags) {
|
||||
updateSideTitleStats(p);
|
||||
TwosideKeeper.updateHealthbarDisplay(p, target, damage, flags);
|
||||
update();
|
||||
}
|
||||
|
||||
public void updateSideTitleStats(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN) {
|
||||
modifyLargeLeftTitle(ChatColor.DARK_AQUA+"☤"+Integer.toString((int)pd.weaponcharges),100);
|
||||
modifyLargeRightTitle(ChatColor.DARK_PURPLE+Integer.toString((int)pd.damagepool)+"♥",100);
|
||||
}
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER &&
|
||||
ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) {
|
||||
modifyLargeLeftTitle(ChatColor.YELLOW+Integer.toString((int)pd.vendetta_amt),100);
|
||||
modifyLargeRightTitle(ChatColor.GOLD+Integer.toString((int)pd.thorns_amt),100);
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getTitles() {
|
||||
return new String[]{large_lefttitle.getTitle(),large_centertitle.getTitle(),large_righttitle.getTitle()};
|
||||
}
|
||||
}
|
||||
|
||||
class TitlePart {
|
||||
String title;
|
||||
long expiretime;
|
||||
boolean hasExpired=false;
|
||||
|
||||
TitlePart(String title, int duration) {
|
||||
this.title=title;
|
||||
this.expiretime=TwosideKeeper.getServerTickTime()+duration;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
title="";
|
||||
hasExpired=true;
|
||||
}
|
||||
|
||||
void setTitle(String title) {
|
||||
this.title=title;
|
||||
}
|
||||
|
||||
void setDuration(int duration) {
|
||||
this.expiretime=TwosideKeeper.getServerTickTime()+duration;
|
||||
hasExpired=false;
|
||||
}
|
||||
|
||||
boolean alreadyExpired() {
|
||||
return hasExpired;
|
||||
}
|
||||
|
||||
boolean isExpired() {
|
||||
return !hasExpired && expiretime<=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
|
||||
String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
long getExpirationTime() {
|
||||
return expiretime;
|
||||
}
|
||||
}
|
@ -3683,7 +3683,7 @@ public class GenericFunctions {
|
||||
Buff.addBuff(p, "COOLDOWN_UNDYING_RAGE", new Buff("Undying Rage Cooldown",20*60,0,null,ChatColor.WHITE+"",true));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//return true;
|
||||
}
|
||||
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 5) &&
|
||||
|
@ -848,7 +848,7 @@ public enum ItemSet {
|
||||
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Lifesteal");
|
||||
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage per 10 Weapon Charges");
|
||||
lore.add(ChatColor.AQUA+" ( Max. 200 stacks - "+(ItemSet.GetBaseAmount(set, tier, 3)*200)+"% Damage )");
|
||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage per 100 Damage Pool");
|
||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage per 100 Damage Pool Stacks");
|
||||
lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Undying Rage"+ABILITY_LABEL_END);
|
||||
lore.add(ChatColor.GRAY+" When taking fatal damage, removes all Damage");
|
||||
lore.add(ChatColor.GRAY+" Pool stacks and prevents your health from");
|
||||
|
@ -9,7 +9,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
public class PlayerUtils {
|
||||
public static boolean PlayerIsInCombat(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
return (pd.target!=null && pd.target.isValid() && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<256);
|
||||
return (pd.lastattack+250<=TwosideKeeper.getServerTickTime() || (pd.target!=null && pd.target.isValid() && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<256));
|
||||
}
|
||||
public static boolean cooldownAvailable(long basetimer, int cooldown, Player p) {
|
||||
return (basetimer+GenericFunctions.GetModifiedCooldown(cooldown, p)<=TwosideKeeper.getServerTickTime());
|
||||
|
@ -82,4 +82,20 @@ public class TextUtils {
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasNoSpaceBeforeAndAfter(String str1, String str2, List<String> baselist) {
|
||||
//int pos = str
|
||||
for (int i=0;i<baselist.size();i++) {
|
||||
String s = baselist.get(i);
|
||||
if (s.contains(str1) && s.contains(str2)) {
|
||||
int pos1 = s.indexOf(str1);
|
||||
int pos2 = s.indexOf(str2);
|
||||
if (pos1>0 || pos2+str2.length()<s.length()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -115,19 +115,19 @@ public class LivingEntityStructure {
|
||||
}
|
||||
public String getActualName() {
|
||||
StringBuilder sb = new StringBuilder(prefix);
|
||||
if (prefix.length()>0 && difficulty_modifier.length()>0) {
|
||||
if (sb.length()>0 && difficulty_modifier.length()>0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(difficulty_modifier);
|
||||
if (difficulty_modifier.length()>0 && base_name.length()>0) {
|
||||
if (sb.length()>0 && base_name.length()>0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(base_name);
|
||||
if (base_name.length()>0 && suffix.length()>0) {
|
||||
if (sb.length()>0 && suffix.length()>0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(suffix);
|
||||
if (suffix.length()>0 && suffix_bar.length()>0) {
|
||||
if (sb.length()>0 && suffix_bar.length()>0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(suffix_bar);
|
||||
@ -230,6 +230,8 @@ public class LivingEntityStructure {
|
||||
LivingEntity m = (LivingEntity)ent;
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
m.setCustomNameVisible(false);
|
||||
if (les.GetTarget()!=null && m.hasLineOfSight(les.GetTarget()) ||
|
||||
hasLineOfSightWithAPlayer(m)) {
|
||||
String actualName = les.getActualName();
|
||||
if (actualName.length()>0) {
|
||||
//m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
|
||||
@ -255,6 +257,16 @@ public class LivingEntityStructure {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private static boolean hasLineOfSightWithAPlayer(LivingEntity ent) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.getWorld().equals(ent.getWorld()) && p.getLocation().distanceSquared(ent.getLocation())<=625 &&
|
||||
p.hasLineOfSight(ent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//Either gets a monster structure that exists or creates a new one.
|
||||
public static LivingEntityStructure GetLivingEntityStructure(LivingEntity m) {
|
||||
if (m instanceof Player) {
|
||||
|
@ -23,6 +23,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.AdvancedTitle;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
|
||||
@ -120,6 +121,7 @@ public class PlayerStructure {
|
||||
public double slayermodehp=0;
|
||||
public long lastassassinatetime=0;
|
||||
public long lastlifesavertime=0;
|
||||
public long lastusedbarbability=0;
|
||||
public boolean slayermegahit=false;
|
||||
public double thorns_amt = 0.0;
|
||||
public long lastimportantactionbarmsg=0;
|
||||
@ -153,6 +155,9 @@ public class PlayerStructure {
|
||||
public long lastusedbeastwithin = TwosideKeeper.getServerTickTime();
|
||||
public long lastusedunstoppableteam = TwosideKeeper.getServerTickTime();
|
||||
public boolean had3pieceprotecterset = false;
|
||||
public AdvancedTitle customtitle;
|
||||
public long lastattack = TwosideKeeper.getServerTickTime();
|
||||
public boolean lastHitWasThorns=false;
|
||||
|
||||
public long iframetime = 0;
|
||||
|
||||
@ -280,6 +285,7 @@ public class PlayerStructure {
|
||||
this.vacuumsuckup=true;
|
||||
this.equipweapons=true;
|
||||
this.equiparmor=true;
|
||||
this.customtitle = new AdvancedTitle(p);
|
||||
//Set defaults first, in case this is a new user.
|
||||
loadConfig();
|
||||
p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
||||
|
@ -474,6 +474,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public static BowModeLogger BowLogger; //The logger for Bow Modes.
|
||||
public static LootLogger Loot_Logger; //The logger for Loot.
|
||||
public static sig.plugin.TwosideKeeper.Logging.HeartbeatLogger HeartbeatLogger; //Diagnostics for heartbeat speed.
|
||||
public static sig.plugin.TwosideKeeper.Logging.HeartbeatLogger PickupLogger; //Diagnostics for heartbeat speed.
|
||||
//public static AutoUpdatePlugin pluginupdater;
|
||||
public static boolean restarting_server=false;
|
||||
public static List<String> log_messages=new ArrayList<String>();
|
||||
@ -1029,6 +1030,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
BowLogger = new BowModeLogger();
|
||||
Loot_Logger = new LootLogger();
|
||||
HeartbeatLogger = new sig.plugin.TwosideKeeper.Logging.HeartbeatLogger();
|
||||
PickupLogger = new sig.plugin.TwosideKeeper.Logging.HeartbeatLogger();
|
||||
habitat_data = new Habitation();
|
||||
habitat_data.loadLocationHashesFromConfig();
|
||||
|
||||
@ -1331,11 +1333,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
sender.sendMessage(ChatColor.WHITE+"To view a specific player's usage, use "+ChatColor.GREEN+"\"/debugreport <name>\"");
|
||||
sender.sendMessage(ChatColor.WHITE+"To view specific entities' usage, use "+ChatColor.GREEN+"\"/debugreport ALLENTS\"");
|
||||
sender.sendMessage(ChatColor.WHITE+"To view heartbeat timings, use "+ChatColor.GREEN+"\"/debugreport heartbeat\"");
|
||||
sender.sendMessage(ChatColor.WHITE+"To view item pickup timings, use "+ChatColor.GREEN+"\"/debugreport pickup\"");
|
||||
} else {
|
||||
if (args[0].equalsIgnoreCase("heartbeat")) {
|
||||
sender.sendMessage("Heartbeat Timings:");
|
||||
sender.sendMessage(HeartbeatLogger.outputReport());
|
||||
} else
|
||||
if (args[0].equalsIgnoreCase("pickup")) {
|
||||
sender.sendMessage("Item Pickup Timings:");
|
||||
sender.sendMessage(PickupLogger.outputReport());
|
||||
} else
|
||||
if (args[0].equalsIgnoreCase("ALLENTS")) {
|
||||
sender.sendMessage("Individual Structures for all Living Entities:");
|
||||
int count=0;
|
||||
@ -2742,6 +2749,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
//Update player max health. Check equipment too.
|
||||
setPlayerMaxHealth(ev.getPlayer());
|
||||
FilterCubeItem.populateFilterCubeItemList(ev.getPlayer());
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard players set "+ev.getPlayer().getName()+" Deaths "+ev.getPlayer().getStatistic(Statistic.DEATHS));
|
||||
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.GLOWING,ev.getPlayer());
|
||||
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.NIGHT_VISION,ev.getPlayer());
|
||||
@ -3343,12 +3351,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
*/
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN && ev.getRightClicked() instanceof LivingEntity) {
|
||||
aPlugin.API.swingOffHand(p);
|
||||
if (pd.weaponcharges>=10 && (pd.weaponcharges<30 || !p.isSneaking())) {
|
||||
if (pd.weaponcharges>=10 && (pd.weaponcharges<30 || !p.isSneaking()) && pd.lastusedbarbability+10<=TwosideKeeper.getServerTickTime()) {
|
||||
//Apply a stronger attack.
|
||||
pd.lastusedbarbability=TwosideKeeper.getServerTickTime();
|
||||
CustomDamage.ApplyDamage(0, p, (LivingEntity)ev.getRightClicked(), p.getInventory().getExtraContents()[0], "Power Swing");
|
||||
} else
|
||||
if (pd.weaponcharges>=30 && p.isSneaking()) {
|
||||
if (pd.weaponcharges>=30 && p.isSneaking() && pd.lastusedbarbability+10<=TwosideKeeper.getServerTickTime()) {
|
||||
//Apply Sweep Up Attack.
|
||||
|
||||
pd.lastusedbarbability=TwosideKeeper.getServerTickTime();
|
||||
pd.weaponcharges-=30;
|
||||
CustomDamage.IncreaseLifestealStacks(p, pd.lifestealstacks);
|
||||
GenericFunctions.sendActionBarMessage(p, "");
|
||||
@ -4512,7 +4523,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (!Christmas.ChristmasPlaceEvent(ev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TwosideKeeper.log("1- Cancelled? "+ev.isCancelled(), 0);
|
||||
if (ev.getBlockPlaced().getType()==Material.CHEST ||
|
||||
ev.getBlockPlaced().getType()==Material.TRAPPED_CHEST) {
|
||||
//Check for a chest or trapped chest around each side of the block.
|
||||
@ -4535,6 +4546,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
TwosideKeeper.log("2- Cancelled? "+ev.isCancelled(), 0);
|
||||
if (WorldShop.isPlaceableWorldShop(ev.getItemInHand())) {
|
||||
if (BlockUtils.LocationInFrontOfBlockIsFree(ev.getBlockPlaced())) {
|
||||
//ev.getPlayer().sendMessage("ALLOWED!");
|
||||
@ -4545,6 +4557,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
TwosideKeeper.log("3- Cancelled? "+ev.isCancelled(), 0);
|
||||
|
||||
if (ev.getItemInHand().hasItemMeta() &&
|
||||
ev.getItemInHand().getItemMeta().hasLore() &&
|
||||
@ -4555,20 +4568,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
TwosideKeeper.log("4- Cancelled? "+ev.isCancelled(), 0);
|
||||
if (Artifact.isArtifact(ev.getItemInHand()) && !GenericFunctions.isArtifactEquip(ev.getItemInHand())) {
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
TwosideKeeper.log("5- Cancelled? "+ev.isCancelled(), 0);
|
||||
|
||||
if (ItemSet.isSetItem(ev.getItemInHand())) {
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TwosideKeeper.log("6- Cancelled? "+ev.isCancelled(), 0);
|
||||
if (BaublePouch.isBaublePouch(ev.getItemInHand())) { //Do not allow bauble pouches to be built.
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
TwosideKeeper.log("7- Cancelled? "+ev.isCancelled(), 0);
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled = true)
|
||||
@ -5029,15 +5046,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public static void sendNotReadyCastMessage(Player p, String string) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.lastFailedCastTime+20<TwosideKeeper.getServerTickTime()) {
|
||||
p.sendTitle("", string+" not ready to cast!");
|
||||
//p.sendTitle("", string+" not ready to cast!");
|
||||
pd.customtitle.modifySmallCenterTitle(string+" not ready to cast!", 40);
|
||||
pd.lastFailedCastTime=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
}
|
||||
public static void sendSuccessfulCastMessage(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.lastFailedCastTime+100>=TwosideKeeper.getServerTickTime()) {
|
||||
if (pd.lastFailedCastTime+40>=TwosideKeeper.getServerTickTime()) {
|
||||
pd.lastFailedCastTime=TwosideKeeper.getServerTickTime();
|
||||
p.sendTitle("", "");
|
||||
pd.customtitle.modifySmallCenterTitle("", 0);
|
||||
}
|
||||
}
|
||||
private void UpdateUnstoppableTeamBuff(Player p, PlayerStructure pd) {
|
||||
@ -5339,6 +5357,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
ItemSet.updateItemSets(p);
|
||||
if (ev.getInventory().getType()==InventoryType.HOPPER &&
|
||||
ev.getInventory().getTitle()!=null) {
|
||||
FilterCubeItem.populateFilterCubeItemList((Player)ev.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DropDeathInventoryContents(Player p, Location deathloc) {
|
||||
@ -5485,7 +5507,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void onInventoryUpdate(InventoryUpdateEvent ev) {
|
||||
if (ItemCubeUtils.isItemCubeMaterial(ev.getItemStack().getType())) {
|
||||
FilterCubeItem.populateFilterCubeItemList(ev.getPlayer());
|
||||
}
|
||||
ClearOutIgnoredUUIDs(ev.getPlayer());
|
||||
}
|
||||
|
||||
@ -6652,6 +6676,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
//Spill some XP out of the damaged target.
|
||||
dmgdealt += pd.thorns_amt;
|
||||
pd.thorns_amt=0;
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
CustomDamage.ApplyDamage(dmgdealt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, ev.getCause().name(), CustomDamage.TRUEDMG);
|
||||
ev.setCancelled(true);
|
||||
@ -6679,7 +6704,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
int flags = pd.lasthitproperties;
|
||||
pd.target=(LivingEntity)ev.getEntity();
|
||||
pd.damagedealt=dmgdealt;
|
||||
displayTitle(shooter,pd,flags);
|
||||
pd.lastattack=TwosideKeeper.getServerTickTime();
|
||||
//displayTitle(shooter,pd,flags);
|
||||
LivingEntity lasttarget = pd.target;
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, () -> {
|
||||
updateHealthbarDisplay(shooter,lasttarget,pd.damagedealt,flags);
|
||||
pd.customtitle.update();
|
||||
},1);
|
||||
}
|
||||
} else {
|
||||
ItemStack weapon = null;
|
||||
@ -6696,6 +6727,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
|
||||
pd.vendetta_amt=0.0;
|
||||
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored",true);
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
ev.setCancelled(true);
|
||||
} else {
|
||||
CustomDamage.ApplyDamage(0, ev.getDamager(), (LivingEntity)ev.getEntity(), weapon, null);
|
||||
@ -6746,6 +6778,109 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateHealthbarDisplay(Player p, LivingEntity target, double damage, int flags) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
updateHealthbarDisplay(p,target);
|
||||
if (pd.damagelogging) {
|
||||
if (Bukkit.getPlayer(pd.name)!=null && target!=null) {
|
||||
if (Bukkit.getPlayer(pd.name)!=null && target!=null) {
|
||||
ChatColor col = ChatColor.AQUA;
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_CRIT)) {
|
||||
col = ChatColor.YELLOW;
|
||||
} else
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) {
|
||||
pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20);
|
||||
col = ChatColor.BLUE;
|
||||
} else
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_HEADSHOT)) {
|
||||
col = ChatColor.DARK_RED;
|
||||
} else
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_THORNS)) {
|
||||
col = ChatColor.GRAY;
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
if (!CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_THORNS) ||
|
||||
pd.customtitle.getTitles()[1].length()==0) {
|
||||
pd.customtitle.modifyLargeCenterTitle(col+""+df.format(pd.damagedealt), 20);
|
||||
}
|
||||
//updateTitle(shooter,col+""+df.format(pd.damagedealt));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateHealthbarDisplay(Player p, LivingEntity target) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (Bukkit.getPlayer(pd.name)!=null && target!=null) {
|
||||
String MonsterName = target.getType().toString().toLowerCase();
|
||||
MonsterName = GenericFunctions.getDisplayName(target);
|
||||
|
||||
final String finalMonsterName = MonsterName;
|
||||
String heartdisplay = "", remainingheartdisplay = "";
|
||||
int color1=0,color2=1;
|
||||
double health=target.getHealth();
|
||||
double maxhealth=target.getMaxHealth();
|
||||
final double orghealth = health;
|
||||
if (health>20) {
|
||||
while (health>20) {
|
||||
color1++;
|
||||
color2++;
|
||||
health-=20;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<health/2;i++) {
|
||||
remainingheartdisplay+=Character.toString('♥');
|
||||
}
|
||||
if (maxhealth>20) {
|
||||
if (orghealth>20) {
|
||||
for (int i=0;i<10;i++) {
|
||||
heartdisplay+=Character.toString('♥');
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<10;i++) {
|
||||
heartdisplay+=Character.toString('♡');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<maxhealth/2;i++) {
|
||||
heartdisplay+=Character.toString('♡');
|
||||
}
|
||||
}
|
||||
|
||||
ChatColor finalcolor = GetHeartColor(color1);
|
||||
ChatColor finalcolor2 = GetHeartColor(color2);
|
||||
String finalheartdisplay=finalcolor2+((finalcolor2==ChatColor.MAGIC)?remainingheartdisplay.replace((char)0x2665, 'A'):remainingheartdisplay)+finalcolor+((finalcolor==ChatColor.MAGIC)?heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()).replace((char)0x2665, 'A'):heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()));
|
||||
if (target.getHealth()>2000) {
|
||||
finalheartdisplay=GetHeartColor(GetFactorialAmt(target.getHealth()))+FinalHealthDisplay(target.getHealth())+" / "+FinalHealthDisplay(target.getMaxHealth());
|
||||
//p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET);
|
||||
pd.customtitle.modifySmallCenterTitle(finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET, 100);
|
||||
} else {
|
||||
pd.customtitle.modifySmallCenterTitle(finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1), 100);
|
||||
//p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1));
|
||||
}
|
||||
}
|
||||
//pd.customtitle.updateTitle(p, true);
|
||||
}
|
||||
|
||||
|
||||
private static String FinalHealthDisplay(double maxHealth) {
|
||||
DecimalFormat df = new DecimalFormat("0");
|
||||
if (maxHealth>=1000000) {
|
||||
return df.format(maxHealth/1000000)+"M";
|
||||
} else {
|
||||
return df.format(maxHealth/1000)+"k";
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetFactorialAmt(double health) {
|
||||
double startingamt = health;
|
||||
int numb = 0;
|
||||
while (startingamt>1000) {
|
||||
startingamt/=1000;
|
||||
numb++;
|
||||
}
|
||||
return numb;
|
||||
}
|
||||
private int getNumberofPiecesWithThorns(Player p) {
|
||||
int pieces=0;
|
||||
for (ItemStack item : GenericFunctions.getArmor(p)) {
|
||||
@ -8166,8 +8301,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
Player p = ev.getPlayer();
|
||||
//log("Item Right now: "+ev.getItem().getItemStack(),0);
|
||||
long time = System.nanoTime();
|
||||
long totaltime = System.nanoTime();
|
||||
|
||||
InventoryUpdateEvent.TriggerUpdateInventoryEvent(p,ev.getItem().getItemStack(),UpdateReason.PICKEDUPITEM);
|
||||
TwosideKeeper.PickupLogger.AddEntry("Trigger Update Inventory Event", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
ItemStack newstack = InventoryUtils.AttemptToFillPartialSlotsFirst(p,ev.getItem().getItemStack());
|
||||
TwosideKeeper.PickupLogger.AddEntry("Fill Partial Slots First", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
//TwosideKeeper.log(" New Stack is: "+newstack,0);
|
||||
if (newstack==null || newstack.getType()==Material.AIR) {
|
||||
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
|
||||
@ -8177,10 +8317,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
GenericFunctions.giveItem(p, it.getItemStack());
|
||||
}
|
||||
ev.getItem().remove();ev.setCancelled(true);return;}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Pickup Item when it's null", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
ev.getItem().setItemStack(newstack);
|
||||
//log("Pickup Metadata: "+ev.getItem().getItemStack().getItemMeta().toString(),0);
|
||||
//GenericFunctions.updateSetItems(p.getInventory());
|
||||
GenericFunctions.UpdateItemLore(ev.getItem().getItemStack());
|
||||
TwosideKeeper.PickupLogger.AddEntry("Update Item Lore", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
/*//LEGACY CODE
|
||||
if (!ev.isCancelled()) {
|
||||
if (ev.getItem().getItemStack().getType()==Material.ARROW &&
|
||||
@ -8197,8 +8339,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}*/
|
||||
|
||||
HandlePickupAchievements(ev.getPlayer(), ev.getItem().getItemStack());
|
||||
TwosideKeeper.PickupLogger.AddEntry("Pickup Achievements", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
boolean handled = AutoEquipItem(ev.getItem().getItemStack(), p);
|
||||
TwosideKeeper.PickupLogger.AddEntry("Auto Equip Item Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
if (handled) {
|
||||
PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
@ -8213,12 +8357,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Auto Consume Item Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
if (ev.getItem().hasMetadata("INFINITEARROW")) { //Not allowed to be picked up, this was an infinite arrow.
|
||||
TwosideKeeper.log("INFINITE PICKUP", 5);
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Infinite Arrow Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
if (GenericFunctions.isValidArrow(ev.getItem().getItemStack()) && ArrowQuiver.getArrowQuiverInPlayerInventory(p)!=null) {
|
||||
ev.setCancelled(true);
|
||||
@ -8228,6 +8374,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
AddToPlayerInventory(ev.getItem().getItemStack(), p);
|
||||
return;
|
||||
}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Valid Arrow check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
/**
|
||||
* MUST BE HANDLED AFTER EVERYTHING ELSE.
|
||||
@ -8249,6 +8396,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.getItem().setItemStack(remaining[0]);
|
||||
}
|
||||
}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Filter Cube Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
//TwosideKeeper.log("(1)Item is "+ev.getItem().getItemStack(), 0);
|
||||
if (ev.getItem().getItemStack().getType().isBlock() && InventoryUtils.isCarryingVacuumCube(p)) {
|
||||
@ -8264,6 +8412,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.getItem().setItemStack(remaining[0]);
|
||||
}
|
||||
}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Vacuum Cube Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
//ItemCubeUtils.pickupAndAddItemCubeToGraph(ev.getItem().getItemStack(), p);
|
||||
|
||||
@ -8277,6 +8426,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
ItemSet.updateItemSets(ev.getPlayer());
|
||||
TwosideKeeper.PickupLogger.AddEntry("Update Item Sets", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
return;
|
||||
}
|
||||
public static void PlayPickupParticle(Player p, Item item) {
|
||||
@ -8309,6 +8459,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
public static boolean AutoEquipItem(ItemStack item, Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL && PlayerUtils.PlayerIsInCombat(p)) {
|
||||
return false;
|
||||
}
|
||||
if (item.getType().toString().contains("BOOTS") ||
|
||||
item.getType().toString().contains("LEGGINGS") ||
|
||||
item.getType().toString().contains("CHESTPLATE") ||
|
||||
@ -8370,7 +8523,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
return true;
|
||||
} else
|
||||
if (armor.getType().toString().contains("_AXE") &&
|
||||
(p.getEquipment().getItemInMainHand().getType()==Material.AIR || p.getInventory().getExtraContents()[0]==null) &&
|
||||
PlayerMode.getPlayerMode(p)!=PlayerMode.RANGER &&
|
||||
((p.getEquipment().getItemInMainHand().getType()==Material.AIR) || p.getInventory().getExtraContents()[0]==null) &&
|
||||
pd.equipweapons) {
|
||||
if (p.getEquipment().getItemInMainHand().getType()==Material.AIR) {
|
||||
p.getEquipment().setItemInMainHand(armor);
|
||||
@ -10076,141 +10230,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static void updateTitle(final Player p, boolean headshot, boolean preemptive) {
|
||||
if (preemptive) {
|
||||
updateTitle(p,ChatColor.BLUE+"!");
|
||||
/*
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
public void run() {
|
||||
updateTitle(p);
|
||||
}
|
||||
},15);*/
|
||||
} else {
|
||||
updateTitle(p, headshot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void updateTitle(final Player p, boolean headshot) {
|
||||
if (headshot) {
|
||||
updateTitle(p,ChatColor.DARK_RED+"HEADSHOT !");
|
||||
TwosideKeeper.log("Run here.", 5);
|
||||
/*
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
public void run() {
|
||||
updateTitle(p);
|
||||
}
|
||||
},15);*/
|
||||
} else {
|
||||
updateTitle(p);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateTitle(final Player p, PlayerStructure pd) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||
public void run() {
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
updateTitle(p,ChatColor.AQUA+""+df.format(pd.damagedata.getLastDamageDealt()));
|
||||
}
|
||||
},1);
|
||||
}
|
||||
|
||||
public static void updateTitle(final Player p) {
|
||||
updateTitle(p, "");
|
||||
}
|
||||
|
||||
public static void updateTitle(final Player p, final String message1) {
|
||||
//Updates the target title for this player.
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
final PlayerStructure pd2=pd;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
|
||||
@SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
if (Bukkit.getPlayer(pd2.name)!=null && pd2.target!=null) {
|
||||
String MonsterName = pd2.target.getType().toString().toLowerCase();
|
||||
MonsterName = GenericFunctions.getDisplayName(pd2.target);
|
||||
|
||||
final String finalMonsterName = MonsterName;
|
||||
String heartdisplay = "", remainingheartdisplay = "";
|
||||
int color1=0,color2=1;
|
||||
double health=pd2.target.getHealth();
|
||||
double maxhealth=pd2.target.getMaxHealth();
|
||||
final double orghealth = health;
|
||||
if (health>20) {
|
||||
while (health>20) {
|
||||
color1++;
|
||||
color2++;
|
||||
health-=20;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<health/2;i++) {
|
||||
remainingheartdisplay+=Character.toString('♥');
|
||||
}
|
||||
if (maxhealth>20) {
|
||||
if (orghealth>20) {
|
||||
for (int i=0;i<10;i++) {
|
||||
heartdisplay+=Character.toString('♥');
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<10;i++) {
|
||||
heartdisplay+=Character.toString('♡');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<maxhealth/2;i++) {
|
||||
heartdisplay+=Character.toString('♡');
|
||||
}
|
||||
}
|
||||
|
||||
ChatColor finalcolor = GetHeartColor(color1);
|
||||
ChatColor finalcolor2 = GetHeartColor(color2);
|
||||
String finalheartdisplay=finalcolor2+((finalcolor2==ChatColor.MAGIC)?remainingheartdisplay.replace((char)0x2665, 'A'):remainingheartdisplay)+finalcolor+((finalcolor==ChatColor.MAGIC)?heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()).replace((char)0x2665, 'A'):heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()));
|
||||
TwosideKeeper.log("Message 1 is "+message1, 5);
|
||||
if (pd2.target.getHealth()>2000) {
|
||||
finalheartdisplay=GetHeartColor(GetFactorialAmt(pd2.target.getHealth()))+FinalHealthDisplay(pd2.target.getHealth())+" / "+FinalHealthDisplay(pd2.target.getMaxHealth());
|
||||
p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET);
|
||||
} else {
|
||||
p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(pd2.target.getHealth()/20+1));
|
||||
}
|
||||
}}
|
||||
|
||||
private String FinalHealthDisplay(double maxHealth) {
|
||||
DecimalFormat df = new DecimalFormat("0");
|
||||
if (maxHealth>=1000000) {
|
||||
return df.format(maxHealth/1000000)+"M";
|
||||
} else {
|
||||
return df.format(maxHealth/1000)+"k";
|
||||
}
|
||||
}
|
||||
|
||||
private int GetFactorialAmt(double health) {
|
||||
double startingamt = health;
|
||||
int numb = 0;
|
||||
while (startingamt>1000) {
|
||||
startingamt/=1000;
|
||||
numb++;
|
||||
}
|
||||
return numb;
|
||||
}}
|
||||
,1);
|
||||
if (Bukkit.getPlayer(pd2.name)!=null) {
|
||||
if (pd.title_task!=-1) {
|
||||
Bukkit.getScheduler().cancelTask(pd.title_task);
|
||||
pd.title_task=-1;
|
||||
}
|
||||
pd.title_task=Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
|
||||
@SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
if (Bukkit.getPlayer(pd2.name)!=null) {
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
pd.title_task=-1;
|
||||
p.sendTitle("","");
|
||||
}
|
||||
}
|
||||
},15);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
final double basedmg = 0.0; //Sets the damage we will be dealing before calculating defenses.
|
||||
@ -10518,7 +10539,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
return tc;
|
||||
}
|
||||
|
||||
private void displayTitle(Player shooter, PlayerStructure pd, int flags) {
|
||||
/* private void displayTitle(Player shooter, PlayerStructure pd, int flags) {
|
||||
if (!pd.damagelogging) {
|
||||
updateTitle(shooter,CustomDamage.isFlagSet(flags, CustomDamage.IS_HEADSHOT),CustomDamage.isFlagSet(flags, CustomDamage.IS_PREEMPTIVE));
|
||||
} else {
|
||||
@ -10535,7 +10556,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
updateTitle(shooter,col+""+df.format(pd.damagedealt));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static void logHealth(final LivingEntity l,final double hp,final double dmg, Entity damager) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||
|
@ -266,6 +266,9 @@ final class runServerHeartbeat implements Runnable {
|
||||
AutoConsumeFoods(p);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Auto Consume Food", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
|
||||
updateCustomTitle(p, pd);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Update Custom Title", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.BOLD+"->Not AFK Functions"+ChatColor.RESET, (int)(System.nanoTime()-notafktime));
|
||||
|
||||
@ -347,6 +350,11 @@ final class runServerHeartbeat implements Runnable {
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime();
|
||||
}
|
||||
|
||||
private void updateCustomTitle(Player p, PlayerStructure pd) {
|
||||
//pd.customtitle.updateTitle(p);
|
||||
pd.customtitle.checkExpiredTitles();
|
||||
}
|
||||
|
||||
private void removeRegenerationStacks(Player p) {
|
||||
if (Buff.hasBuff(p, "REGENERATION")) {
|
||||
Buff b = Buff.getBuff(p, "REGENERATION");
|
||||
@ -725,9 +733,11 @@ final class runServerHeartbeat implements Runnable {
|
||||
pd.vendetta_amt=0;
|
||||
pd.thorns_amt=0;
|
||||
pd.weaponcharges=0;
|
||||
pd.customtitle.updateSideTitleStats(Bukkit.getPlayer(pd.name));
|
||||
}
|
||||
if (pd.vendetta_amt>0 && pd.lastvendettastack+200<serverTickTime) {
|
||||
pd.vendetta_amt=0;
|
||||
pd.customtitle.updateSideTitleStats(Bukkit.getPlayer(pd.name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -774,6 +784,7 @@ final class runServerHeartbeat implements Runnable {
|
||||
} else {
|
||||
pd.damagepool-=transferdmg;
|
||||
}
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user