Compare commits
23 Commits
patch_bran
...
master
Author | SHA1 | Date | |
---|---|---|---|
c3dff18aef | |||
862b7399d6 | |||
fb8d30b9c5 | |||
1a285cbf7d | |||
ea59b4890c | |||
8e9053f308 | |||
bca56c165c | |||
6d82052571 | |||
ae2148bed7 | |||
65f025a640 | |||
506661479c | |||
ffe7d5adb5 | |||
b0f634c1d8 | |||
20a4a5dd14 | |||
bfd185d562 | |||
ffb784dcd2 | |||
85ec1bf6fc | |||
b4e8aed1f3 | |||
ba7af310ac | |||
5bcf1a2dea | |||
aa1b74716a | |||
|
6b7ca1808f | ||
|
1c79e6a3a0 |
@ -4,9 +4,9 @@
|
||||
<classpathentry kind="src" path="jgrapht"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/AutoPluginUpdate.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/GlowAPI_v1.4.4.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Documents/GlowAPI_v1.4.4.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Documents/Test Server/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/aPlugin (102).jar"/>
|
||||
<classpathentry kind="lib" path="D:/Documents/aPlugin.jar"/>
|
||||
<classpathentry kind="src" path="/AutoPluginUpdate"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
.*
|
||||
/bin
|
||||
/projectBuilder.xml
|
||||
|
7
.project
7
.project
@ -24,11 +24,4 @@
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>jgrapht</name>
|
||||
<type>2</type>
|
||||
<location>D:/Data/jgrapht-1.0.1/jgrapht-1.0.1/source/jgrapht-core/src/main/java</location>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: TwosideKeeper
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.12.1b1
|
||||
version: 3.X
|
||||
loadbefore: [aPlugin]
|
||||
commands:
|
||||
money:
|
||||
@ -188,3 +188,8 @@ commands:
|
||||
usage: /fb <player>
|
||||
permission: TwosideKeeper.money
|
||||
permission-message: No permissions!
|
||||
search:
|
||||
description: Displays a listing of items in Recycling Centers. Supply an argument to search for a specific item.
|
||||
usage: /search [Item Name]
|
||||
permission: TwosideKeeper.money
|
||||
permission-message: No permissions!
|
@ -88,6 +88,16 @@ public class ActionBarBuffUpdater{
|
||||
if (pd.vendetta_amt>0 && effectString.length()==0) {
|
||||
|
||||
}
|
||||
if (pd.lastusedRejuvenation+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATION_COOLDOWN, (Player)p)>TwosideKeeper.getServerTickTime()) {
|
||||
effectString.append(ChatColor.GREEN);
|
||||
effectString.append(ChatColor.BOLD);
|
||||
effectString.append(ChatColor.UNDERLINE);
|
||||
effectString.append("Rejuvenation");
|
||||
int timeRemaining = (int)((pd.lastusedRejuvenation+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATION_COOLDOWN, (Player)p))-TwosideKeeper.getServerTickTime());
|
||||
effectString.append(ConvertBuffTimeToIcon(timeRemaining));
|
||||
effectString.append(ChatColor.RESET);
|
||||
effectString.append(" ");
|
||||
}
|
||||
}
|
||||
HashMap<String,Buff> buffMap = Buff.getBuffData(p);
|
||||
for (String s : buffMap.keySet()) {
|
||||
|
@ -94,6 +94,7 @@ import sig.plugin.TwosideKeeper.Monster.HellfireGhast;
|
||||
import sig.plugin.TwosideKeeper.Monster.HellfireSpider;
|
||||
import sig.plugin.TwosideKeeper.Monster.Knight;
|
||||
import sig.plugin.TwosideKeeper.Monster.SniperSkeleton;
|
||||
import sig.plugin.TwosideKeeper.PlayerStructures.DefenderStance;
|
||||
|
||||
public class CustomDamage {
|
||||
|
||||
@ -113,6 +114,8 @@ public class CustomDamage {
|
||||
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.
|
||||
|
||||
public static final double BOSS_DAMAGE_LIMIT = 0.1;
|
||||
|
||||
static public boolean ApplyDamage(double damage, Entity damager, LivingEntity target, ItemStack weapon, String reason) {
|
||||
//TwosideKeeper.log("Weapon: "+weapon, 0);
|
||||
return ApplyDamage(damage,damager,target,weapon,reason,NONE);
|
||||
@ -152,7 +155,7 @@ public class CustomDamage {
|
||||
long time = System.nanoTime();
|
||||
if (!isFlagSet(flags,CONTROLLED)) {
|
||||
TwosideKeeper.damagequeue++;
|
||||
if (TwosideKeeper.damagequeue>8) {
|
||||
if (TwosideKeeper.damagequeue>TwosideKeeper.DAMAGE_QUEUE_MAX_BUFFER) {
|
||||
flags = setFlag(flags,CONTROLLED);
|
||||
TwosideKeeper.damagequeuelist.add(new DamageStructure(damage,damager,target,weapon,reason,flags));
|
||||
return false; //Run it later.
|
||||
@ -167,7 +170,9 @@ public class CustomDamage {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.lasthitproperties=NONE;
|
||||
}
|
||||
//TwosideKeeper.log(GenericFunctions.getDisplayName(target)+" has been hit for "+damage+" damage.", 0);
|
||||
if (!InvulnerableCheck(damager,damage,target,weapon,reason,flags)) {
|
||||
//TwosideKeeper.log("Passed Invulnerable check.", 0);
|
||||
double dmg = 0.0;
|
||||
if (isFlagSet(flags,TRUEDMG)) {
|
||||
//TwosideKeeper.log("Reason: "+reason, 0);
|
||||
@ -181,8 +186,6 @@ public class CustomDamage {
|
||||
} else {
|
||||
dmg = CalculateDamage(damage, damager, target, weapon, reason, flags);
|
||||
}
|
||||
dmg += CalculateBonusTrueDamage(damager, target, dmg);
|
||||
dmg += CalculatePVPDamageReduction(damager,target,dmg);
|
||||
if (damager!=null) {
|
||||
TwosideKeeper.logHealth(target,target.getHealth(),dmg,damager);
|
||||
}
|
||||
@ -193,6 +196,7 @@ public class CustomDamage {
|
||||
|
||||
setupDamagePropertiesForPlayer(damager,((reason!=null && reason.equalsIgnoreCase("thorns"))?IS_THORNS:0));
|
||||
if (!ev.isCancelled()) {
|
||||
dmg = ev.getDamage();
|
||||
//TwosideKeeper.log("Inside of here.", 0);
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
if (shooter instanceof Player && target instanceof Player) {
|
||||
@ -212,6 +216,22 @@ public class CustomDamage {
|
||||
}
|
||||
}
|
||||
|
||||
private static double CalculateWellTimedBlockDamage(double damage, LivingEntity target) {
|
||||
//TwosideKeeper.log("In here. Damage: "+damage+" Target: "+GenericFunctions.getDisplayName(target), 0);
|
||||
if (target instanceof Player && PlayerMode.isDefender((Player)target)) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)target);
|
||||
//TwosideKeeper.log("Time is "+TwosideKeeper.getServerTickTime()+". Last block was at "+pd.lastblock, 0);
|
||||
if (pd.lastblock+5>TwosideKeeper.getServerTickTime()) {
|
||||
/*TwosideKeeper.log("This is a well timed block! Halve the damage.", 0);
|
||||
TwosideKeeper.log("Old damage: "+damage,0);
|
||||
TwosideKeeper.log("New damage: "+(damage/2),0);*/
|
||||
pd.lastblock=0; //Reset so they can perform another block.
|
||||
return damage/2;
|
||||
}
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static double CalculatePVPDamageReduction(Entity damager, LivingEntity target, double dmg) {
|
||||
double dmgIncrease=0;
|
||||
LivingEntity shooter = getDamagerEntity(damager);
|
||||
@ -391,6 +411,9 @@ public class CustomDamage {
|
||||
|
||||
setupDamagePropertiesForPlayer(damager,((crit)?IS_CRIT:0)|((headshot)?IS_HEADSHOT:0)|((preemptive)?IS_PREEMPTIVE:0),true);
|
||||
dmg = hardCapDamage(dmg+armorpendmg,target,reason);
|
||||
dmg += CalculateBonusTrueDamage(damager, target, dmg);
|
||||
dmg += CalculatePVPDamageReduction(damager,target,dmg);
|
||||
dmg = CalculateWellTimedBlockDamage(dmg,target);
|
||||
return dmg;
|
||||
}
|
||||
|
||||
@ -664,6 +687,14 @@ public class CustomDamage {
|
||||
TwosideKeeper.log("Sending out "+(damage+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER)+" damage.",5);
|
||||
target.damage(damage+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,getDamagerEntity(damager));
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)getDamagerEntity(damager));
|
||||
if (!(target instanceof Player)) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
les.SetTarget(getDamagerEntity(damager));
|
||||
les.lastHitbyPlayer = TwosideKeeper.getServerTickTime();
|
||||
if (getDamagerEntity(damager) instanceof Player) {
|
||||
les.lastPlayerThatHit = (Player)getDamagerEntity(damager);
|
||||
}
|
||||
}
|
||||
EntityUtils.applyDamageIndicator(target, damage, (isFlagSet(pd.lasthitproperties,IS_CRIT))?IndicatorType.CRIT:IndicatorType.REGULAR);
|
||||
} else
|
||||
if (!(getDamagerEntity(damager) instanceof LivingEntity) || (damage!=0 && isFlagSet(flags,SPECIALATTACK))) {
|
||||
@ -723,7 +754,7 @@ public class CustomDamage {
|
||||
Player p = (Player)target;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (PlayerMode.isDefender(p)) {
|
||||
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
|
||||
//GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
|
||||
if (p.isBlocking() && ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) {
|
||||
ApplyVendettaStackTimer(pd);
|
||||
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.40;
|
||||
@ -771,6 +802,8 @@ public class CustomDamage {
|
||||
restoreHealthToPartyMembersWithProtectorSet(p);
|
||||
applySustenanceSetonHitEffects(p);
|
||||
reduceStrengthAmountForStealthSet(p);
|
||||
triggerPetHelp(p,damager);
|
||||
damage = handleBlockStacks(p,damage);
|
||||
if (!isFlagSet(flags,NOAOE)) {
|
||||
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
|
||||
}
|
||||
@ -804,7 +837,7 @@ public class CustomDamage {
|
||||
damage = preventPoisonDamageFromKilling(p, damage, reason);
|
||||
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
|
||||
TwosideKeeper.log("Is a Slayer.", 2);
|
||||
//TwosideKeeper.log("Is a Slayer.", 2);
|
||||
//PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (damage>2) {
|
||||
damage=2;
|
||||
@ -961,6 +994,7 @@ public class CustomDamage {
|
||||
pd.lastcombat=TwosideKeeper.getServerTickTime();
|
||||
increaseBarbarianStacks(p,weapon,reason);
|
||||
damage = applyBarbarianBonuses(p,target,weapon,damage,reason);
|
||||
applyShieldChargeEffect(p,weapon,reason);
|
||||
increaseWindCharges(p);
|
||||
applyWindSlashEffects(p,target,damage,reason);
|
||||
createFirePool(p,damager,target,damage,reason);
|
||||
@ -1061,6 +1095,37 @@ public class CustomDamage {
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static void triggerPetHelp(Player p, Entity damager) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.myPet!=null && pd.myPet.getEntity().isValid()) {
|
||||
if (getDamagerEntity(damager)!=null) {
|
||||
pd.myPet.setTarget(getDamagerEntity(damager));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyShieldChargeEffect(Player p, ItemStack weapon, String reason) {
|
||||
if (p.isSneaking() && (reason==null || !reason.equalsIgnoreCase("shield charge")) &&
|
||||
weapon!=null && weapon.equals(p.getEquipment().getItemInMainHand())) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
TwosideKeeper.PerformShieldCharge(p, pd);
|
||||
}
|
||||
}
|
||||
|
||||
private static double handleBlockStacks(Player p, double damage) {
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
DefenderStance ds = DefenderStance.getDefenderStance(p);
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (ds == DefenderStance.BLOCK) {
|
||||
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_ATTACK_KNOCKBACK, 1, 1);
|
||||
pd.blockStacks = Math.min(pd.blockStacks+1, 10);
|
||||
GenericFunctions.sendActionBarMessage(p, "", true);
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static void updateAggroValues(LivingEntity damager, LivingEntity target, double damage, String reason) {
|
||||
if (getDamagerEntity(damager)!=null && EntityUtils.isValidEntity(getDamagerEntity(damager))) {
|
||||
if (target!=null && EntityUtils.isValidEntity(target) && !(target instanceof Player)) {
|
||||
@ -1462,7 +1527,7 @@ public class CustomDamage {
|
||||
p.getWorld().strikeLightningEffect(target.getLocation());
|
||||
p.getWorld().strikeLightningEffect(target.getLocation());
|
||||
pd.lastlightningstrike=TwosideKeeper.getServerTickTime();
|
||||
GenericFunctions.DealDamageToNearbyMobs(target.getLocation(), 12, 1, p, TRUEDMG|IGNORE_DAMAGE_TICK);
|
||||
GenericFunctions.DealBlitzenLightningStrikeToNearbyMobs(target.getLocation(), 12, 1, p, TRUEDMG|IGNORE_DAMAGE_TICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2012,17 +2077,36 @@ public class CustomDamage {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (PlayerMode.isDefender(p) && p.isBlocking()) {
|
||||
if (PlayerMode.isDefender(p)) {
|
||||
if (DefenderStance.getDefenderStance(p)==DefenderStance.TANK) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
p.setVelocity(p.getVelocity().multiply(0));
|
||||
}
|
||||
},1);
|
||||
}
|
||||
if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.SHIELD &&
|
||||
p.getEquipment().getItemInOffHand()!=null && p.getEquipment().getItemInOffHand().getType()==Material.SHIELD){
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
p.setVelocity(p.getVelocity().multiply(0.5));
|
||||
}
|
||||
},1);
|
||||
}
|
||||
}
|
||||
/*if (PlayerMode.isDefender(p) && p.isBlocking()) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
p.setVelocity(p.getVelocity().multiply(0.25));
|
||||
}
|
||||
},1);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
static void setAggroGlowTickTime(Monster m, int duration) {
|
||||
public static void setAggroGlowTickTime(Monster m, int duration) {
|
||||
//m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,duration,0,true,true),true);
|
||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.GLOWING, duration, 0, m);
|
||||
}
|
||||
@ -2038,7 +2122,7 @@ public class CustomDamage {
|
||||
}
|
||||
}
|
||||
|
||||
static void provokeMonster(LivingEntity m, Player p, ItemStack weapon) {
|
||||
public static void provokeMonster(LivingEntity m, Player p, ItemStack weapon) {
|
||||
if (!m.hasPotionEffect(PotionEffectType.GLOWING)) {
|
||||
setMonsterTarget(m,p);
|
||||
}
|
||||
@ -2085,8 +2169,13 @@ public class CustomDamage {
|
||||
if (PlayerMode.isDefender(p)) {
|
||||
//TwosideKeeper.log("In here.", 0);
|
||||
RefreshVendettaStackTimer(p);
|
||||
setMonsterTarget(m,p);
|
||||
setAggroGlowTickTime(m,100);
|
||||
//setMonsterTarget(m,p);
|
||||
//setAggroGlowTickTime(m,100);
|
||||
DefenderStance ds = DefenderStance.getDefenderStance(p);
|
||||
if (ds == DefenderStance.AGGRESSION) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||
les.increaseAggro(p, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2361,6 +2450,9 @@ public class CustomDamage {
|
||||
if ((shooter!=null && shooter.isDead()) || (target!=null && target.isDead())) {
|
||||
return true;
|
||||
}
|
||||
if (shooter!=null && target!=null && LivingEntityStructure.isFriendly(shooter, target)) {
|
||||
return true; //Cancel all damage for friendly targets.
|
||||
}
|
||||
target.setLastDamage(0);
|
||||
target.setNoDamageTicks(0);
|
||||
target.setMaximumNoDamageTicks(0);
|
||||
@ -2481,19 +2573,32 @@ public class CustomDamage {
|
||||
|
||||
private static void refundRejuvenationCooldown(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.last_rejuvenate-=40;
|
||||
int remainingtime = GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN);
|
||||
pd.last_mobcontrol-=40;
|
||||
int remainingtime = GenericFunctions.GetRemainingCooldownTime(p, pd.last_mobcontrol, TwosideKeeper.MOBCONTROL_COOLDOWN);
|
||||
if (remainingtime>0) {
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.SHIELD, remainingtime);
|
||||
}
|
||||
}
|
||||
|
||||
private static double GetAttackRate(Entity damager) {
|
||||
public static double GetAttackRate(Entity damager) {
|
||||
double attackrate = 0.0;
|
||||
if (damager instanceof Player) {
|
||||
Player p = (Player)damager;
|
||||
attackrate += ItemSet.GetTotalBaseAmount(p, ItemSet.BLITZEN)/100d;
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
DefenderStance ds = DefenderStance.getDefenderStance(p);
|
||||
if (ds == DefenderStance.AGGRESSION) {
|
||||
attackrate+=0.25;
|
||||
}
|
||||
}
|
||||
for (Player pp : PartyManager.getPartyMembers(p)) {
|
||||
if (PlayerMode.getPlayerMode(pp) == PlayerMode.DEFENDER &&
|
||||
DefenderStance.getDefenderStance(pp)==DefenderStance.AGGRESSION) {
|
||||
attackrate+=0.25;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TwosideKeeper.log("Attack rate: "+attackrate,0);
|
||||
return attackrate;
|
||||
}
|
||||
|
||||
@ -2587,6 +2692,11 @@ public class CustomDamage {
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
GenericFunctions.HealEntity(p, p.getMaxHealth()*0.05);
|
||||
}
|
||||
if (pd.blockStacks>0) {
|
||||
pd.blockStacks--;
|
||||
GenericFunctions.sendActionBarMessage(p, "", true);
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -2654,9 +2764,9 @@ public class CustomDamage {
|
||||
}
|
||||
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d);
|
||||
if (p.isBlocking() || pd.lastblock+20*5<=TwosideKeeper.getServerTickTime()) {
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.SONGSTEEL));
|
||||
}
|
||||
/*if (p.isBlocking() || pd.lastblock+20*5<=TwosideKeeper.getServerTickTime()) {
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.SONGSTEEL)/3);
|
||||
}*/
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d);
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d);
|
||||
|
||||
@ -2694,7 +2804,8 @@ public class CustomDamage {
|
||||
}
|
||||
|
||||
if ((pd.fulldodge || pd.slayermegahit ||
|
||||
Buff.hasBuff(p, "BEASTWITHIN")) && !PVP.isPvPing(p)) {
|
||||
Buff.hasBuff(p, "BEASTWITHIN") ||
|
||||
(PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER && DefenderStance.getDefenderStance(p)==DefenderStance.TANK && pd.blockStacks>0)) && !PVP.isPvPing(p)) {
|
||||
dodgechance = 1.0;
|
||||
}
|
||||
|
||||
@ -2727,6 +2838,31 @@ public class CustomDamage {
|
||||
double tankydiv = 0;
|
||||
double artifactmult = 0;
|
||||
double dodgechancemult = 0;
|
||||
double defenderstancemult = 0;
|
||||
double defendersetmult = 0;
|
||||
|
||||
if (getDamagerEntity(damager) instanceof Player) {
|
||||
Player p = (Player)getDamagerEntity(damager);
|
||||
if (PlayerMode.getPlayerMode(p) == PlayerMode.DEFENDER) {
|
||||
DefenderStance ds = DefenderStance.getDefenderStance(p);
|
||||
if (ds==DefenderStance.AGGRESSION) {
|
||||
return basedmg;
|
||||
} else
|
||||
if (ds==DefenderStance.BLOCK) {
|
||||
defenderstancemult = 0.25;
|
||||
} else
|
||||
if (ds==DefenderStance.CHARGE) {
|
||||
defenderstancemult = 0.1;
|
||||
} else
|
||||
if (ds==DefenderStance.TANK) {
|
||||
defenderstancemult = 0.5;
|
||||
}
|
||||
}
|
||||
if (ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) {
|
||||
int tier = ItemSet.getHighestTierInSet(p, ItemSet.SONGSTEEL);
|
||||
defendersetmult = (0.1*tier)+0.2;
|
||||
}
|
||||
}
|
||||
|
||||
if (target instanceof LivingEntity) {
|
||||
ItemStack[] armor = GenericFunctions.getEquipment(target,true);
|
||||
@ -2746,10 +2882,12 @@ public class CustomDamage {
|
||||
dmgreductiondiv += ItemSet.GetTotalBaseAmount(p, ItemSet.PROTECTOR)/100d;
|
||||
for (Player pl : PartyManager.getPartyMembers(p)) {
|
||||
if (pl!=null && p!=null && !pl.equals(p)) {
|
||||
if (PlayerMode.getPlayerMode(pl)==PlayerMode.DEFENDER &&
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 2)) {
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 2)) {
|
||||
setbonusdiv += 0.1*ItemSet.GetPlayerModeSpecificMult(p);
|
||||
}
|
||||
if (ItemSet.hasFullSet(pl, ItemSet.PROTECTOR)) {
|
||||
setbonusdiv += (ItemSet.getHighestTierInSet(pl, ItemSet.PROTECTOR)*0.1)*ItemSet.GetPlayerModeSpecificMult(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -2975,9 +3113,11 @@ public class CustomDamage {
|
||||
*(1d-tankydiv)
|
||||
*(1d-artifactmult)
|
||||
*(1d-dodgechancemult)
|
||||
*(1d-defenderstancemult)
|
||||
*(1d-defendersetmult)
|
||||
*setbonus
|
||||
*((target instanceof Player && ((Player)target).isBlocking())?(PlayerMode.isDefender((Player)target))?0.30:0.50:1)
|
||||
*((target instanceof Player)?((PlayerMode.isDefender((Player)target))?0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1);
|
||||
*((target instanceof Player)?((PlayerMode.isDefender((Player)target))?(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.8:0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1);
|
||||
|
||||
if (basedmg!=finaldmg) {
|
||||
TwosideKeeper.log("Original damage was: "+basedmg,5);
|
||||
@ -3297,8 +3437,6 @@ public class CustomDamage {
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.WINDRY, 5) ||
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.SHARD, 5) ||
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.TOXIN, 5) ||
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.PROTECTOR, 5) ||
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.SUSTENANCE, 5) ||
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.LEGION, 5) ||
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.PRIDE, 5) ||
|
||||
(ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 9, 1, (Player)shooter)) ||
|
||||
@ -3467,7 +3605,7 @@ public class CustomDamage {
|
||||
for (int i=0;i<partymembers.size();i++) {
|
||||
Player check = partymembers.get(i);
|
||||
if (PartyManager.IsInSameParty(p, check)) {
|
||||
TwosideKeeper.log("In here",5);
|
||||
/*TwosideKeeper.log("In here",5);
|
||||
if (!PlayerMode.isDefender(p) && PlayerMode.isDefender(check) &&
|
||||
check.isBlocking() &&
|
||||
!p.equals(check) && NotTankReason(reason)) {
|
||||
@ -3479,13 +3617,13 @@ public class CustomDamage {
|
||||
ApplyDamage(defenderdmg, shooter, check, null, "Defender Tank", IGNOREDODGE|IGNORE_DAMAGE_TICK);
|
||||
//TwosideKeeper.log("Damage was absorbed by "+check.getName()+". Took "+defenderdmg+" reduced damage. Original damage: "+dmg,0);
|
||||
break;
|
||||
} else
|
||||
} else*/
|
||||
if (!isCupidTank(p) && isCupidTank(check) &&
|
||||
!p.equals(check) && NotTankReason(reason)) {
|
||||
//This is a defender. Transfer half the damage to them!
|
||||
//This is a cupid tank. Transfer half the damage to them!
|
||||
double origdmg = dmg;
|
||||
dmg = origdmg-(origdmg*(ItemSet.GetTotalBaseAmount(check, ItemSet.CUPID)/100d));
|
||||
//Send the rest of the damage to the defender.
|
||||
//Send the rest of the damage to the cupid tanker.
|
||||
double defenderdmg = origdmg*(ItemSet.GetTotalBaseAmount(check, ItemSet.CUPID)/100d);
|
||||
//defenderdmg=CalculateDamageReduction(dmg, check, entity);
|
||||
ApplyDamage(defenderdmg, shooter, check, null, "Cupid Set Tank", IGNOREDODGE|IGNORE_DAMAGE_TICK);
|
||||
@ -3540,7 +3678,7 @@ public class CustomDamage {
|
||||
if (shooter instanceof Player) {
|
||||
Player p = (Player)shooter;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
critchance = addMultiplicativeValue(critchance,(PlayerMode.isStriker(p)?0.2:0.0));
|
||||
critchance = addMultiplicativeValue(critchance,(PlayerMode.isStriker(p)?0.4:0.0));
|
||||
critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d);
|
||||
critchance = addMultiplicativeValue(critchance,(PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0));
|
||||
critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.MOONSHADOW, 5, 4)/100d);
|
||||
@ -3683,7 +3821,7 @@ public class CustomDamage {
|
||||
if (damager instanceof Player) {
|
||||
Player p = (Player)damager;
|
||||
if (PlayerMode.isStriker(p)) {
|
||||
mult+=0.1;
|
||||
mult+=0.2;
|
||||
}
|
||||
}
|
||||
return mult;
|
||||
@ -3811,12 +3949,6 @@ public class CustomDamage {
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 5)) {
|
||||
finaldmg += dmg*0.5*armorpenmult;
|
||||
} else
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PROTECTOR, 5)) {
|
||||
finaldmg += dmg*0.5*armorpenmult;
|
||||
} else
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.SUSTENANCE, 5)) {
|
||||
finaldmg += dmg*0.5*armorpenmult;
|
||||
} else
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LEGION, 5)) {
|
||||
finaldmg += dmg*0.5*armorpenmult;
|
||||
} else
|
||||
@ -4049,6 +4181,9 @@ public class CustomDamage {
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PRIDE,6)) {
|
||||
lifestealpct+=0.1d*ItemSet.GetItemTier(p.getEquipment().getItemInMainHand());
|
||||
}
|
||||
if (ItemSet.hasFullSet(p, ItemSet.SUSTENANCE)) {
|
||||
lifestealpct+=ItemSet.getHighestTierInSet(p, ItemSet.SUSTENANCE)*0.25;
|
||||
}
|
||||
lifestealpct+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LEGION, 2, 2)/100d;
|
||||
if (reason!=null && reason.equalsIgnoreCase("sweep up")) {
|
||||
lifestealpct*=2;
|
||||
@ -4060,9 +4195,26 @@ public class CustomDamage {
|
||||
if (damage<0) {
|
||||
damage=0;
|
||||
}
|
||||
double dmgLimit = getDamageLimit(target);
|
||||
if (dmgLimit<1 && damage>target.getMaxHealth()*dmgLimit) {
|
||||
//double olddamage = damage;
|
||||
damage = target.getMaxHealth()*dmgLimit;
|
||||
//TwosideKeeper.log("Damage limit reached (Hit for "+olddamage+". Lowering to "+damage, 1);
|
||||
}
|
||||
return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the percentage of max health that a player can deal to a target.
|
||||
*/
|
||||
private static double getDamageLimit(LivingEntity target) {
|
||||
double pct = 1.0;
|
||||
if (GenericFunctions.isBossMonster(target)) {
|
||||
pct = BOSS_DAMAGE_LIMIT;
|
||||
}
|
||||
return pct;
|
||||
}
|
||||
|
||||
public static boolean isFlagSet(int flags, int check) {
|
||||
return (flags&check)>0;
|
||||
}
|
||||
@ -4234,9 +4386,9 @@ public class CustomDamage {
|
||||
if (target!=null && shooter!=null && isBackstab(target,shooter) &&
|
||||
(shooter instanceof Player) && PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.SLAYER) {
|
||||
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 27, 3, (Player)shooter)) {
|
||||
mult+=5.0;
|
||||
mult+=7.0;
|
||||
} else {
|
||||
mult+=2.0;
|
||||
mult+=3.0;
|
||||
}
|
||||
if (PVP.isPvPing((Player)shooter)) {
|
||||
mult /= 3.0;
|
||||
|
@ -120,10 +120,12 @@ public class AdvancedTitle {
|
||||
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)) {
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
if (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);
|
||||
}
|
||||
//modifyLargeRightTitle(ChatColor.GOLD+Integer.toString((int)pd.thorns_amt),100);
|
||||
modifyLargeRightTitle(ChatColor.DARK_AQUA+Integer.toString(pd.blockStacks)+"☉",100);
|
||||
}
|
||||
}
|
||||
|
||||
|
31
src/sig/plugin/TwosideKeeper/HelperStructures/Book.java
Normal file
31
src/sig/plugin/TwosideKeeper/HelperStructures/Book.java
Normal file
@ -0,0 +1,31 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
|
||||
public enum Book {
|
||||
BEGINNERSGUIDE("NewPlayerGuide.txt"),
|
||||
COMMANDGUIDE("CommandGuide.txt"),
|
||||
STRIKERGUIDE("StrikerGuide.txt"),
|
||||
DEFENDERGUIDE("DefenderGuide.txt"),
|
||||
RANGERGUIDE("RangerGuide.txt"),
|
||||
SLAYERGUIDE("SlayerGuide.txt"),
|
||||
BARBARIANGUIDE("BarbarianGuide.txt"),
|
||||
SUMMONERGUIDE("SummonerGuide.txt"),
|
||||
ADVENTURERGUIDE("AdventurerGuide.txt");
|
||||
|
||||
String fileLoc;
|
||||
|
||||
Book(String loc) {
|
||||
this.fileLoc=loc;
|
||||
}
|
||||
|
||||
public File getBookFile() {
|
||||
return new File(TwosideKeeper.plugin.getDataFolder()+"/books/"+this.fileLoc);
|
||||
}
|
||||
|
||||
public String getBookFilepath() {
|
||||
return TwosideKeeper.plugin.getDataFolder()+"/books/"+this.fileLoc;
|
||||
}
|
||||
}
|
28
src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java
Normal file
28
src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java
Normal file
@ -0,0 +1,28 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.CastBarItem;
|
||||
|
||||
public class CastBar {
|
||||
List<CastBarItem> castbaritems = new ArrayList<CastBarItem>();
|
||||
|
||||
public CastBar(CastBarItem...items) {
|
||||
castbaritems = Arrays.asList(items);
|
||||
while (castbaritems.size()<9) {
|
||||
castbaritems.add(new CastBarItem(Material.AIR));
|
||||
}
|
||||
}
|
||||
|
||||
public void run(Player p) {
|
||||
aPlugin.API.setSlot(p, 9);
|
||||
for (int i=0;i<9;i++) {
|
||||
aPlugin.API.setItem(p, p.getOpenInventory(), i, castbaritems.get(i).getItemStack());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.EnderSignal;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||
|
||||
public class CloudRunnableRemoveLabel implements Runnable{
|
||||
AreaEffectCloud aec;
|
||||
Location loc;
|
||||
String str;
|
||||
double spd;
|
||||
int duration;
|
||||
|
||||
public CloudRunnableRemoveLabel(Location loc,String str,double spd,int duration) {
|
||||
this.loc=loc;
|
||||
this.str=str;
|
||||
this.spd=spd;
|
||||
this.duration=duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
aec = EntityUtils.CreateOverlayText(loc, str);
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, new CloudRunnable(aec,spd,duration), 1);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Common;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MathUtils;
|
||||
|
||||
public class ArmorStandProperties {
|
||||
final public static ArmorStandProperties SCEPTERBASE = new ArmorStandProperties();
|
||||
final public static ArmorStandProperties SCEPTERTOP = new ArmorStandProperties();
|
||||
|
||||
boolean arms = false;
|
||||
boolean baseplate = false;
|
||||
EulerAngle bodyPose = EulerAngle.ZERO;
|
||||
ItemStack boots = new ItemStack(Material.AIR);
|
||||
ItemStack chestplate = new ItemStack(Material.AIR);
|
||||
EulerAngle headPose = EulerAngle.ZERO;
|
||||
ItemStack helmet = new ItemStack(Material.AIR);
|
||||
ItemStack hand = new ItemStack(Material.AIR);
|
||||
EulerAngle leftArmPose = EulerAngle.ZERO;
|
||||
EulerAngle leftLegPose = EulerAngle.ZERO;
|
||||
ItemStack leggings = new ItemStack(Material.AIR);
|
||||
boolean marker = false;
|
||||
EulerAngle rightArmPose = EulerAngle.ZERO;
|
||||
EulerAngle rightLegPose = EulerAngle.ZERO;
|
||||
|
||||
boolean small = false;
|
||||
boolean visible=true;
|
||||
boolean customNameVisible=false;
|
||||
String customName="";
|
||||
Vector offset = new Vector();
|
||||
|
||||
public ArmorStandProperties() {
|
||||
|
||||
}
|
||||
|
||||
public boolean isArms() {
|
||||
return arms;
|
||||
}
|
||||
|
||||
public void setArms(boolean arms) {
|
||||
this.arms = arms;
|
||||
}
|
||||
|
||||
public boolean isBaseplate() {
|
||||
return baseplate;
|
||||
}
|
||||
|
||||
public void setBaseplate(boolean baseplate) {
|
||||
this.baseplate = baseplate;
|
||||
}
|
||||
|
||||
public EulerAngle getBodyPose() {
|
||||
return bodyPose;
|
||||
}
|
||||
|
||||
public void setBodyPose(EulerAngle bodyPose) {
|
||||
this.bodyPose = bodyPose;
|
||||
}
|
||||
|
||||
public ItemStack getBoots() {
|
||||
return boots;
|
||||
}
|
||||
|
||||
public void setBoots(ItemStack boots) {
|
||||
this.boots = boots;
|
||||
}
|
||||
|
||||
public ItemStack getChestplate() {
|
||||
return chestplate;
|
||||
}
|
||||
|
||||
public void setChestplate(ItemStack chestplate) {
|
||||
this.chestplate = chestplate;
|
||||
}
|
||||
|
||||
public EulerAngle getHeadPose() {
|
||||
return headPose;
|
||||
}
|
||||
|
||||
public void setHeadPose(EulerAngle headPose) {
|
||||
this.headPose = headPose;
|
||||
}
|
||||
|
||||
public ItemStack getHelmet() {
|
||||
return helmet;
|
||||
}
|
||||
|
||||
public void setHelmet(ItemStack helmet) {
|
||||
this.helmet = helmet;
|
||||
}
|
||||
|
||||
public ItemStack getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
public void setHand(ItemStack hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public EulerAngle getLeftArmPose() {
|
||||
return leftArmPose;
|
||||
}
|
||||
|
||||
public void setLeftArmPose(EulerAngle leftArmPose) {
|
||||
this.leftArmPose = leftArmPose;
|
||||
}
|
||||
|
||||
public EulerAngle getLeftLegPose() {
|
||||
return leftLegPose;
|
||||
}
|
||||
|
||||
public void setLeftLegPose(EulerAngle leftLegPose) {
|
||||
this.leftLegPose = leftLegPose;
|
||||
}
|
||||
|
||||
public ItemStack getLeggings() {
|
||||
return leggings;
|
||||
}
|
||||
|
||||
public void setLeggings(ItemStack leggings) {
|
||||
this.leggings = leggings;
|
||||
}
|
||||
|
||||
public boolean isMarker() {
|
||||
return marker;
|
||||
}
|
||||
|
||||
public void setMarker(boolean marker) {
|
||||
this.marker = marker;
|
||||
}
|
||||
|
||||
public EulerAngle getRightArmPose() {
|
||||
return rightArmPose;
|
||||
}
|
||||
|
||||
public void setRightArmPose(EulerAngle rightArmPose) {
|
||||
this.rightArmPose = rightArmPose;
|
||||
}
|
||||
|
||||
public boolean isSmall() {
|
||||
return small;
|
||||
}
|
||||
|
||||
public void setSmall(boolean small) {
|
||||
this.small = small;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public boolean isCustomNameVisible() {
|
||||
return customNameVisible;
|
||||
}
|
||||
|
||||
public void setCustomNameVisible(boolean customNameVisible) {
|
||||
this.customNameVisible = customNameVisible;
|
||||
}
|
||||
|
||||
public String getCustomName() {
|
||||
return customName;
|
||||
}
|
||||
|
||||
public void setCustomName(String customName) {
|
||||
this.customName = customName;
|
||||
}
|
||||
public EulerAngle getRightLegPose() {
|
||||
return rightLegPose;
|
||||
}
|
||||
|
||||
public void setRightLegPose(EulerAngle rightLegPose) {
|
||||
this.rightLegPose = rightLegPose;
|
||||
}
|
||||
|
||||
public Vector getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(Vector offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public static void defineAllModels() {
|
||||
SetupScepterBase();
|
||||
SetupScepterTop();
|
||||
}
|
||||
|
||||
private static void SetupScepterTop() {
|
||||
SCEPTERTOP.rightArmPose = MathUtils.getEulerAngleDegrees(-90, 0, 0);
|
||||
SCEPTERTOP.hand = new ItemStack(Material.DOUBLE_PLANT);
|
||||
SCEPTERTOP.offset = new Vector(-0.7,0,0.1);
|
||||
}
|
||||
|
||||
private static void SetupScepterBase() {
|
||||
SCEPTERBASE.rightArmPose = MathUtils.getEulerAngleDegrees(-90, 90, 0);
|
||||
SCEPTERBASE.small = true;
|
||||
SCEPTERBASE.hand = new ItemStack(Material.BONE);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Common;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||
|
||||
public class CastBarItem {
|
||||
ItemStack item;
|
||||
|
||||
public CastBarItem(Material mat) {
|
||||
this(mat,(short)0,1,null);
|
||||
}
|
||||
|
||||
public CastBarItem(Material mat, short data, String displayName) {
|
||||
this(mat,data,1,displayName);
|
||||
}
|
||||
|
||||
public CastBarItem(Material mat, short data, int amt, String displayName) {
|
||||
item = new ItemStack(mat,amt,data);
|
||||
if (displayName!=null) {
|
||||
ItemUtils.setDisplayName(item, displayName);
|
||||
}
|
||||
}
|
||||
|
||||
public CastBarItem(MaterialData matdata, String displayName) {
|
||||
item = new ItemStack(matdata.getItemType(),1,matdata.getData());
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return item;
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -45,6 +46,7 @@ import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@ -91,6 +93,7 @@ import sig.plugin.TwosideKeeper.Events.PlayerLineDriveEvent;
|
||||
import sig.plugin.TwosideKeeper.Events.PlayerTumbleEvent;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArrowBarrage;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Book;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
|
||||
@ -99,12 +102,14 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Effects.WindSlash;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Items.Scepter;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
|
||||
|
||||
@ -2252,11 +2257,11 @@ public class GenericFunctions {
|
||||
leather=false;
|
||||
break;
|
||||
}
|
||||
ItemSet set = ItemSet.GetItemSet(equip);
|
||||
/*ItemSet set = ItemSet.GetItemSet(equip);
|
||||
if (!ItemSet.isRangerSet(set) && !GenericFunctions.isArtifactArmor(equip)) {
|
||||
leather=false;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return leather;
|
||||
}
|
||||
@ -2280,9 +2285,10 @@ public class GenericFunctions {
|
||||
return tc;
|
||||
}
|
||||
|
||||
public static String PlayerModeInformation(String mode) {
|
||||
public static Book GetPlayerModeBook(String mode) {
|
||||
PlayerMode pm = PlayerMode.valueOf(mode.toUpperCase());
|
||||
return pm.getDesription();
|
||||
//return pm.getDesription();
|
||||
return pm.getBook();
|
||||
}
|
||||
|
||||
public static boolean holdingNoShield(Player p) {
|
||||
@ -2291,10 +2297,11 @@ public class GenericFunctions {
|
||||
|
||||
public static boolean isRareItem(ItemStack it) {
|
||||
if (it!=null &&
|
||||
it.getType()==Material.WRITTEN_BOOK || (
|
||||
it.getType()!=Material.AIR &&
|
||||
it.hasItemMeta() &&
|
||||
it.getItemMeta().hasDisplayName() &&
|
||||
it.getItemMeta().hasLore()
|
||||
it.getItemMeta().hasLore())
|
||||
) {
|
||||
TwosideKeeper.log("Returning it!", 5);
|
||||
return true;
|
||||
@ -2309,6 +2316,7 @@ public class GenericFunctions {
|
||||
((Guardian)m).isElder()) ||
|
||||
m.getType()==EntityType.ENDER_DRAGON ||
|
||||
m.getType()==EntityType.WITHER ||
|
||||
MonsterController.getLivingEntityDifficulty(m).name().contains("MINIBOSS") ||
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).getLeader() ||
|
||||
LivingEntityStructure.GetLivingEntityStructure(m).getElite()) {
|
||||
return true;
|
||||
@ -3016,6 +3024,9 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
public static String GetEntityDisplayName(Entity e) {
|
||||
if (e==null) {
|
||||
return "NULL";
|
||||
}
|
||||
if (e instanceof LivingEntity) {
|
||||
LivingEntity l = (LivingEntity)e;
|
||||
if (l.getCustomName()!=null) {
|
||||
@ -3203,14 +3214,44 @@ public class GenericFunctions {
|
||||
CustomDamage.addIframe(ticks, p);
|
||||
}
|
||||
|
||||
public static void PerformRejuvenate(Player player) {
|
||||
public static void PerformMobControl(Player player) {
|
||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(player.getUniqueId());
|
||||
if (pd.last_rejuvenate+GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player)<=TwosideKeeper.getServerTickTime()) {
|
||||
SoundUtils.playGlobalSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f);
|
||||
addIFrame(player,40);
|
||||
//GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.REGENERATION,200,9,player,true);
|
||||
aPluginAPIWrapper.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player));
|
||||
boolean hasFullSet = ItemSet.hasFullSet(player, ItemSet.DAWNTRACKER);
|
||||
List<LivingEntity> le = GenericFunctions.getNearbyMobsIncludingPlayers(player.getLocation(), 16);
|
||||
for (LivingEntity ent : le) {
|
||||
boolean allowed=true;
|
||||
if (ent instanceof Player && PVP.isFriendly(player, (Player)ent)) {
|
||||
allowed=false;
|
||||
}
|
||||
if (allowed) {
|
||||
/*if (ent instanceof LivingEntity) {
|
||||
GenericFunctions.addStackingPotionEffect(ent, PotionEffectType.WEAKNESS, 20*15, 5, 2);
|
||||
}*/
|
||||
if (ent instanceof Monster) {
|
||||
CustomDamage.provokeMonster((Monster)ent, player, player.getEquipment().getItemInMainHand());
|
||||
CustomDamage.setAggroGlowTickTime((Monster)ent, 20*15);
|
||||
}
|
||||
}
|
||||
}
|
||||
LivingEntity target = aPlugin.API.rayTraceTargetEntity(player, 32);
|
||||
if (target!=null) {
|
||||
Vector pullVelocity = MovementUtils.getVelocityTowardsLocation(target.getLocation(), player.getLocation(), Math.min(player.getLocation().distance(target.getLocation()),4));
|
||||
if (pullVelocity.getY()>0) {
|
||||
pullVelocity.setY(Math.min(pullVelocity.getY(), 1));
|
||||
} else {
|
||||
pullVelocity.setY(Math.max(pullVelocity.getY(), -1));
|
||||
}
|
||||
target.setVelocity(pullVelocity);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
les.increaseAggro(player, 1000);
|
||||
}
|
||||
TwosideKeeper.aggroMonsters(player,pd,(500+((hasFullSet)?(ItemSet.getHighestTierInSet(player, ItemSet.DAWNTRACKER)*1000):0)*pd.blockStacks),16);
|
||||
pd.last_mobcontrol = TwosideKeeper.getServerTickTime()-(pd.blockStacks*20);
|
||||
TwosideKeeper.log("Time is "+TwosideKeeper.getServerTickTime()+". Mob control is now "+pd.last_mobcontrol, 0);
|
||||
pd.blockStacks=0;
|
||||
GenericFunctions.sendActionBarMessage(player, "", true);
|
||||
pd.customtitle.updateSideTitleStats(player);
|
||||
aPluginAPIWrapper.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), GetModifiedCooldown((int)(TwosideKeeper.MOBCONTROL_COOLDOWN-(TwosideKeeper.getServerTickTime()-pd.last_mobcontrol)),player));
|
||||
}
|
||||
|
||||
public static boolean isArmoredMob(LivingEntity m) {
|
||||
@ -4087,8 +4128,8 @@ public class GenericFunctions {
|
||||
/**
|
||||
* ONLY FOR BLITZEN LIGHTNING STRIKE
|
||||
*/
|
||||
public static void DealDamageToNearbyMobs(Location l, double basedmg, int range, Entity damager, int flags) {
|
||||
List<LivingEntity> nearbyentities = getNearbyMobs(l,range);
|
||||
public static void DealBlitzenLightningStrikeToNearbyMobs(Location l, double basedmg, int range, Entity damager, int flags) {
|
||||
List<LivingEntity> nearbyentities = getNearbyMobsIncludingPlayers(l,range);
|
||||
for (LivingEntity ent : nearbyentities) {
|
||||
boolean allowed=true;
|
||||
if (ent instanceof Player && CustomDamage.getDamagerEntity(damager) instanceof Player &&
|
||||
@ -4134,6 +4175,7 @@ public class GenericFunctions {
|
||||
basedmg=origdmg;
|
||||
boolean isForcefulStrike = (reason!=null && reason.equalsIgnoreCase("forceful strike"));
|
||||
boolean isSweepUp = (reason!=null && reason.equalsIgnoreCase("sweep up"));
|
||||
boolean isShieldCharge = (reason!=null && reason.equalsIgnoreCase("shield charge"));
|
||||
if (isSweepUp) {
|
||||
aPlugin.API.sendSoundlessExplosion(m.getLocation(), 1.5f);
|
||||
if (damager instanceof Player) {
|
||||
@ -4141,6 +4183,12 @@ public class GenericFunctions {
|
||||
p.playEffect(m.getLocation(), Effect.LAVA_POP, null);
|
||||
}
|
||||
}
|
||||
if (isShieldCharge) {
|
||||
GenericFunctions.addSuppressionTime(m, (int)(20*0.5));
|
||||
Player p = (Player)damager;
|
||||
double dmg = CustomDamage.getBaseWeaponDamage(p.getEquipment().getItemInMainHand(), p, m);;
|
||||
CustomDamage.ApplyDamage(dmg*0.25, p, m, p.getEquipment().getItemInMainHand(), "Shield Charge", CustomDamage.IGNORE_DAMAGE_TICK|CustomDamage.TRUEDMG);
|
||||
}
|
||||
if (isForcefulStrike) {
|
||||
GenericFunctions.addSuppressionTime(m, 20*2);
|
||||
}
|
||||
@ -4152,7 +4200,7 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CustomDamage.ApplyDamage(basedmg, damager, m, weapon, reason)) {
|
||||
if (CustomDamage.ApplyDamage(basedmg, damager, m, weapon, reason, CustomDamage.IGNORE_DAMAGE_TICK)) {
|
||||
if (knockup) {
|
||||
m.setVelocity(new Vector(0,knockupamt,0));
|
||||
}
|
||||
@ -4177,7 +4225,7 @@ public class GenericFunctions {
|
||||
return (int)(GetModifiedCooldown(cooldown_time,p)-(TwosideKeeper.getServerTickTime()-current_cooldown));
|
||||
}
|
||||
|
||||
public static List<LivingEntity> getNearbyMobs(Location l, int range) {
|
||||
public static List<LivingEntity> getNearbyMobsIncludingPlayers(Location l, int range) {
|
||||
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
|
||||
List<LivingEntity> monsterlist = new ArrayList<LivingEntity>();
|
||||
for (Entity e : ents) {
|
||||
@ -5410,7 +5458,7 @@ public class GenericFunctions {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.last_siphon+GetModifiedCooldown(TwosideKeeper.SIPHON_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) {
|
||||
if (p.isOnGround()) {
|
||||
List<LivingEntity> list = GenericFunctions.getNearbyMobs(p.getLocation(), 16);
|
||||
List<LivingEntity> list = GenericFunctions.getNearbyMobsIncludingPlayers(p.getLocation(), 16);
|
||||
List<LivingEntity> poisonlist = new ArrayList<LivingEntity>();
|
||||
int totalpoisonstacks = 0;
|
||||
for (LivingEntity ent : list) {
|
||||
@ -5675,4 +5723,136 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onlyHoldingScepter(Player p) {
|
||||
return ((p.getEquipment().getItemInMainHand()!=null || p.getEquipment().getItemInMainHand().getType()!=Material.AIR) && Scepter.isScepter(p.getEquipment().getItemInMainHand()))
|
||||
^
|
||||
((p.getEquipment().getItemInOffHand()!=null || p.getEquipment().getItemInOffHand().getType()!=Material.AIR) && Scepter.isScepter(p.getEquipment().getItemInOffHand()));
|
||||
}
|
||||
|
||||
public static void refreshInventoryView(Player p) {
|
||||
InventoryView view = p.getOpenInventory();
|
||||
//TwosideKeeper.log("View size: "+view.countSlots(), 1);
|
||||
for (int i=0;i<view.countSlots()-1;i++) {
|
||||
//TwosideKeeper.log("Checking slot "+i, 1);
|
||||
aPlugin.API.setItem(p, p.getOpenInventory(), i, view.getItem(i));
|
||||
}
|
||||
}
|
||||
public static HashMap<String,List<ItemContainer>> getItemList(HashMap<String,List<ItemStack>> items) {
|
||||
HashMap<String,List<ItemContainer>> itemsList = new HashMap<String,List<ItemContainer>>();
|
||||
for (String key : items.keySet()) {
|
||||
for (ItemStack i: items.get(key)) {
|
||||
boolean found=false;
|
||||
if (itemsList.containsKey(key)) {
|
||||
List<ItemContainer> list = itemsList.get(key);
|
||||
for (ItemContainer ic : list) {
|
||||
if (ic.getItem().isSimilar(i)) {
|
||||
ic.setAmount(ic.getAmount()+i.getAmount());
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
list.add(new ItemContainer(i));
|
||||
}
|
||||
} else {
|
||||
List<ItemContainer> list = new ArrayList<ItemContainer>();
|
||||
list.add(new ItemContainer(i));
|
||||
itemsList.put(key,list);
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemsList;
|
||||
}
|
||||
public static String generateItemList(HashMap<String,List<ItemContainer>> items) {
|
||||
return generateItemList(items,null);
|
||||
}
|
||||
|
||||
public static String generateItemList(HashMap<String,List<ItemContainer>> items, String[] args) {
|
||||
return generateItemList(items,args,false);
|
||||
}
|
||||
|
||||
public static String generateItemList(HashMap<String,List<ItemContainer>> items, String[] args, boolean discordOutput) {
|
||||
List<String> filters = new ArrayList<String>();
|
||||
//TwosideKeeper.log(Arrays.toString(args), 1);
|
||||
if (args==null || args.length==0) {
|
||||
//No filters applied.
|
||||
} else {
|
||||
for (String str : args) {
|
||||
filters.add(str);
|
||||
}
|
||||
//TwosideKeeper.log("Filters: "+filters, 1);
|
||||
}
|
||||
//Sort from highest to least. Then in alphabetical order.
|
||||
HashMap<String,List<ItemContainer>> sortedmap = new HashMap<String,List<ItemContainer>>();
|
||||
for (String key : items.keySet()) {
|
||||
//TwosideKeeper.log("Items from "+key+": "+items.get(key).toString(), 1);
|
||||
List<ItemContainer> itemList = items.get(key);
|
||||
for (int i=0;i<itemList.size();i++) {
|
||||
//Try to insert it into the list.
|
||||
boolean found=false;
|
||||
ItemContainer currentItem = itemList.get(i);
|
||||
boolean matchesAll=true;
|
||||
String displayName = GenericFunctions.UserFriendlyMaterialName(currentItem.getItem())+(TwosideKeeperAPI.isSetItem(currentItem.getItem())?" (T"+TwosideKeeperAPI.getItemTier(currentItem.getItem())+")":"")+(currentItem.getAmount()>1?ChatColor.YELLOW+" x"+currentItem.getAmount():"");
|
||||
for (String s : filters) {
|
||||
if (!displayName.toLowerCase().contains(s.toLowerCase())) {
|
||||
//TwosideKeeper.log("Cannot find "+s+" in "+displayName, 1);
|
||||
matchesAll=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (matchesAll) {
|
||||
List<ItemContainer> sortedlist;
|
||||
if (sortedmap.containsKey(key)) {
|
||||
sortedlist = sortedmap.get(key);
|
||||
} else {
|
||||
sortedlist = new ArrayList<ItemContainer>();
|
||||
sortedmap.put(key, sortedlist);
|
||||
}
|
||||
for (int j=0;j<sortedlist.size();j++) {
|
||||
ItemContainer checkItem = sortedlist.get(j);
|
||||
if (currentItem.getAmount()>checkItem.getAmount()) {
|
||||
sortedlist.add(j,currentItem);
|
||||
found=true;
|
||||
break;
|
||||
} else
|
||||
if (currentItem.getAmount()==checkItem.getAmount() &&
|
||||
GenericFunctions.UserFriendlyMaterialName(currentItem.getItem()).compareTo(GenericFunctions.UserFriendlyMaterialName(checkItem.getItem()))<0) {
|
||||
sortedlist.add(j,currentItem);
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
sortedlist.add(currentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return generateItemsList(sortedmap, discordOutput);
|
||||
}
|
||||
|
||||
private static String generateItemsList(HashMap<String,List<ItemContainer>> map) {
|
||||
return generateItemsList(map,false);
|
||||
}
|
||||
|
||||
private static String generateItemsList(HashMap<String,List<ItemContainer>> map, boolean discordOutput) {
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
for (String key : map.keySet()) {
|
||||
List<ItemContainer> list = map.get(key);
|
||||
if (discordOutput) {
|
||||
sb.append("Items in **"+key+"**:\n\n");
|
||||
} else {
|
||||
sb.append("Items in "+ChatColor.BOLD+key+ChatColor.RESET+":\n\n");
|
||||
}
|
||||
for (int i=0;i<list.size();i++) {
|
||||
sb.append(ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(list.get(i).getItem())+(TwosideKeeperAPI.isSetItem(list.get(i).getItem())?" (T"+TwosideKeeperAPI.getItemTier(list.get(i).getItem())+")":"")+(list.get(i).getAmount()>1?ChatColor.YELLOW+" x"+list.get(i).getAmount():"")+ChatColor.RESET+(i+1!=list.size()?", ":""));
|
||||
}
|
||||
sb.append("\n ___________________ \n");
|
||||
}
|
||||
if (sb.length()==0) {
|
||||
sb.append("Could not find any items!");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ public class Habitation {
|
||||
|
||||
public void addKillToLocation(Location location) {
|
||||
String locationHash = getLocationHash(location);
|
||||
//TwosideKeeper.log("Location hash is "+locationHash, 0);
|
||||
locationhashes.put(locationHash, locationhashes.getOrDefault(locationHash, 0) + 1);
|
||||
}
|
||||
|
||||
@ -132,7 +133,7 @@ public class Habitation {
|
||||
|
||||
public String getLocationHash(Location location) {
|
||||
if (location != null) {
|
||||
return location.getChunk().getX() + ' ' + String.valueOf((int)location.getY() / 16) + ' ' + location.getChunk().getZ() + ' ' + location.getWorld().toString();
|
||||
return location.getChunk().getX() + ' ' + String.valueOf((int)location.getY() / 16) + ' ' + location.getChunk().getZ() + ' ' + location.getWorld().getName();
|
||||
} else {
|
||||
TwosideKeeper.log(
|
||||
"[ERROR][Habitat]Could not get Location Hash!!! Probably undefined Player->Enemy hit interaction!",
|
||||
|
@ -0,0 +1,55 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArmorStandProperties;
|
||||
|
||||
public class CustomModel {
|
||||
List<ArmorStandProperties> modelParts = new ArrayList<ArmorStandProperties>();
|
||||
List<ArmorStand> stands = new ArrayList<ArmorStand>();
|
||||
|
||||
public CustomModel(Location loc, ArmorStandProperties...modelParts) {
|
||||
for (ArmorStandProperties asp : modelParts) {
|
||||
this.modelParts.add(asp);
|
||||
this.stands.add(setupArmorStand(loc, asp));
|
||||
}
|
||||
}
|
||||
|
||||
private ArmorStand setupArmorStand(Location loc, ArmorStandProperties asp) {
|
||||
ArmorStand stand = (ArmorStand)loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
|
||||
stand.setArms(asp.isArms());
|
||||
stand.setBasePlate(asp.isBaseplate());
|
||||
stand.setBodyPose(asp.getBodyPose());
|
||||
stand.setBoots(asp.getBoots());
|
||||
stand.setChestplate(asp.getChestplate());
|
||||
stand.setHeadPose(asp.getHeadPose());
|
||||
stand.setHelmet(asp.getHelmet());
|
||||
stand.setItemInHand(asp.getHand());
|
||||
stand.setLeftArmPose(asp.getLeftArmPose());
|
||||
stand.setLeftLegPose(asp.getLeftLegPose());
|
||||
stand.setLeggings(asp.getLeggings());
|
||||
stand.setMarker(asp.isMarker());
|
||||
stand.setRightArmPose(asp.getRightArmPose());
|
||||
stand.setRightLegPose(asp.getRightLegPose());
|
||||
stand.setSmall(asp.isSmall());
|
||||
stand.setVisible(asp.isVisible());
|
||||
stand.setCustomNameVisible(asp.isCustomNameVisible());
|
||||
stand.setCustomName(asp.getCustomName());
|
||||
stand.teleport(loc.add(asp.getOffset()));
|
||||
return stand;
|
||||
}
|
||||
|
||||
public void displayModel(Location loc) {
|
||||
for (int i=0;i<stands.size();i++) {
|
||||
if (stands.get(i)!=null && stands.get(i).isValid()) {
|
||||
stands.get(i).teleport(loc.add(modelParts.get(i).getOffset()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.EnderSignal;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
@ -11,27 +12,35 @@ import org.bukkit.entity.FallingBlock;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||
|
||||
public class CloudRunnable implements Runnable{
|
||||
AreaEffectCloud aec;
|
||||
public class DamageLabel{
|
||||
ArmorStand aec;
|
||||
double spd;
|
||||
int duration;
|
||||
|
||||
public CloudRunnable(AreaEffectCloud aec, double spd, int duration) {
|
||||
public DamageLabel(ArmorStand aec, double spd, int duration) {
|
||||
this.aec=aec;
|
||||
this.spd=spd;
|
||||
this.duration=duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
public boolean run() {
|
||||
if (aec.isValid()) {
|
||||
duration--;
|
||||
if (duration>0) {
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, new CloudRunnableRemoveLabel(aec.getLocation().add(0,spd,0).clone(),aec.getCustomName(),spd,duration), 2);
|
||||
}
|
||||
/*if (duration>0) {
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, new CloudRunnableRemoveLabel(aec.getLocation().add(0,spd,0).clone(),aec.getCustomName(),spd,duration), 1);
|
||||
}*/
|
||||
aec.teleport(aec.getLocation().add(0,spd,0));
|
||||
if (duration<0) {
|
||||
aec.remove();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
aec.remove();
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import sig.plugin.TwosideKeeper.PVP;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.Events.InventoryUpdateEvent;
|
||||
import sig.plugin.TwosideKeeper.Events.InventoryUpdateEvent.UpdateReason;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||
|
||||
public class ItemPickupStructure {
|
||||
PlayerPickupItemEvent ev;
|
||||
|
||||
public ItemPickupStructure(PlayerPickupItemEvent itemEvent) {
|
||||
this.ev=itemEvent;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
//Arrow quiver code goes here.
|
||||
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] PlayerPickupItemEvent fired w/ "+ev.getItem().getItemStack(), 1);
|
||||
if (ev.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
Player p = ev.getPlayer();
|
||||
if (PVP.isPvPing(p)) {
|
||||
ev.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
//log("Item Right now: "+ev.getItem().getItemStack(),0);
|
||||
long time = System.nanoTime();
|
||||
long totaltime = System.nanoTime();
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
|
||||
InventoryUpdateEvent.TriggerUpdateInventoryEvent(p,ev.getItem().getItemStack(),UpdateReason.PICKEDUPITEM);
|
||||
}, 1);
|
||||
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()));
|
||||
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
if (ev.getRemaining()>0) {
|
||||
Item it = ev.getItem();
|
||||
it.getItemStack().setAmount(ev.getRemaining());
|
||||
//GenericFunctions.giveItem(p, it.getItemStack());
|
||||
GenericFunctions.dropItem(it.getItemStack(), p.getLocation());
|
||||
}
|
||||
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 &&
|
||||
playerHasArrowQuiver(p)) {
|
||||
int arrowquiver_slot = playerGetArrowQuiver(p);
|
||||
playerInsertArrowQuiver(p, arrowquiver_slot, ev.getItem().getItemStack().getAmount());
|
||||
log("Added "+ev.getItem().getItemStack().getAmount()+" arrow"+((ev.getItem().getItemStack().getAmount()==1)?"":"s")+" to quiver in slot "+arrowquiver_slot+". New amount: "+playerGetArrowQuiverAmt(p,arrowquiver_slot),4);
|
||||
//If we added it here, we destroy the item stack.
|
||||
p.sendMessage(ChatColor.DARK_GRAY+""+ev.getItem().getItemStack().getAmount()+" arrow"+((ev.getItem().getItemStack().getAmount()==1)?"":"s")+" "+((ev.getItem().getItemStack().getAmount()==1)?"was":"were")+" added to your arrow quiver. Arrow Count: "+ChatColor.GRAY+playerGetArrowQuiverAmt(p,arrowquiver_slot));
|
||||
ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, 1.0f);
|
||||
ev.getItem().remove();
|
||||
ev.setCancelled(true);
|
||||
}
|
||||
}*/
|
||||
|
||||
TwosideKeeper.HandlePickupAchievements(ev.getPlayer(), ev.getItem().getItemStack());
|
||||
TwosideKeeper.PickupLogger.AddEntry("Pickup Achievements", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
boolean handled = TwosideKeeper.AutoEquipItem(ev.getItem().getItemStack(), p);
|
||||
TwosideKeeper.PickupLogger.AddEntry("Auto Equip Item Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
if (handled) {
|
||||
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
ev.setCancelled(handled);
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (AutoConsumeItem(p,ev.getItem().getItemStack())) {
|
||||
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
|
||||
PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
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);
|
||||
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
|
||||
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
TwosideKeeper.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.
|
||||
*/
|
||||
|
||||
//TwosideKeeper.log("(1)Item is "+ev.getItem().getItemStack(), 0);
|
||||
if (InventoryUtils.isCarryingFilterCube(p)) {
|
||||
//Try to insert it into the Filter cube.
|
||||
//TwosideKeeper.log("(2)Item is "+ev.getItem().getItemStack(), 0);
|
||||
ItemStack[] remaining = InventoryUtils.insertItemsInFilterCube(p, ev.getItem().getItemStack());
|
||||
//TwosideKeeper.log("(3)Item is "+ev.getItem().getItemStack(), 0);
|
||||
if (remaining.length==0) {
|
||||
ev.setCancelled(true);
|
||||
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
|
||||
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
return;
|
||||
} else {
|
||||
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)) {
|
||||
//Try to insert it into the Vacuum cube.
|
||||
ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, ev.getItem().getItemStack());
|
||||
if (remaining.length==0) {
|
||||
ev.setCancelled(true);
|
||||
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
|
||||
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
|
||||
ev.getItem().remove();
|
||||
return;
|
||||
} else {
|
||||
ev.getItem().setItemStack(remaining[0]);
|
||||
}
|
||||
}
|
||||
TwosideKeeper.PickupLogger.AddEntry("Vacuum Cube Check", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
//ItemCubeUtils.pickupAndAddItemCubeToGraph(ev.getItem().getItemStack(), p);
|
||||
|
||||
ev.setCancelled(true);
|
||||
ItemStack givenitem = ev.getItem().getItemStack().clone();
|
||||
GenericFunctions.giveItem(p, givenitem);
|
||||
if (ev.getRemaining()>0) {
|
||||
givenitem.setAmount(ev.getRemaining());
|
||||
GenericFunctions.giveItem(p, givenitem);
|
||||
}
|
||||
TwosideKeeper.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;
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
|
||||
|
||||
public enum ItemSet {
|
||||
PANROS(1,1, 6,4, 10,10, 20,10, 1,6,10,20),
|
||||
SONGSTEEL(4,2, 6,2, 8,8, 20,10, 4, 6, 8, 20),
|
||||
SONGSTEEL(50,50, 10,5, 8,8, 30,10, 4, 6, 8, 20),
|
||||
DAWNTRACKER(2,2, 20,10, 10,5, 10,5, 2, 20, 10, 10),
|
||||
LORASYS(2,2, 0,0, 0,0, 0,0, 2, 0, 0, 0),
|
||||
JAMDAK(3,3, 5,1, 10,1, 10,2, 3, 5, 10, 10), //Graceful Dodge is in ticks.
|
||||
@ -51,12 +51,17 @@ public enum ItemSet {
|
||||
LUCI(2,2, 4,4, 1,0, 1,0, 2, 4, 1, 1),
|
||||
SHARD(2,1, 10,10, 20,20, 10,10, 2, 10, 20, 10),
|
||||
TOXIN(2,2, 20,5, 10,3, 10,3, 2, 20, 10, 10),
|
||||
PROTECTOR(5,2, 10,5, 10,10, 1,1, 5, 10, 10, 1),
|
||||
SUSTENANCE(8,4, 2,2, 1,1, 10,10, 8, 2, 1, 10),
|
||||
PROTECTOR(5,2, 20,5, 10,10, 1,1, 5, 10, 10, 1),
|
||||
SUSTENANCE(8,4, 6,4, 1,1, 10,10, 8, 2, 1, 10),
|
||||
LEGION(3,1, 12,12, 1,1, 1,1, 3, 12, 1, 1),
|
||||
PRIDE(10,10, 2,1, 2,2, 1,1, 10, 2, 2, 1),
|
||||
ASSASSIN(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
STEALTH(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0);
|
||||
STEALTH(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
ANDARSA(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
SARIS(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
LENT(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
ENTROPY(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
AQUIOS(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0);
|
||||
|
||||
final static String WINDCHARGE_LABEL = ChatColor.BOLD+""+ChatColor.GRAY+"Wind Charge"+ChatColor.RESET;
|
||||
final static String WINDCHARGE_PLURAL_LABEL = ChatColor.BOLD+""+ChatColor.GRAY+"Wind Charges"+ChatColor.RESET;
|
||||
@ -421,7 +426,7 @@ public enum ItemSet {
|
||||
case SONGSTEEL:{
|
||||
lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear");
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Songsteel Set");
|
||||
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Block Chance");
|
||||
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Threat Increase");
|
||||
}break;
|
||||
case DAWNTRACKER:{
|
||||
lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear");
|
||||
@ -611,12 +616,10 @@ public enum ItemSet {
|
||||
lore.add(ChatColor.GRAY+" time in another direction.");
|
||||
}break;
|
||||
case SONGSTEEL:{
|
||||
lore.add(ChatColor.WHITE+"Successful blocks reduce the cooldown of ");
|
||||
lore.add(ABILITY_LABEL+"Rejuvenation"+ABILITY_LABEL_END+" by 2 seconds.");
|
||||
lore.add(ChatColor.WHITE+""+ChatColor.ITALIC+"");
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Max Health");
|
||||
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Absorption Health (30 seconds)");
|
||||
lore.add(ChatColor.DARK_AQUA+" 3 - "+ABILITY_LABEL+" Rejuvenation removes all Debuffs"+ABILITY_LABEL_END);
|
||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Damage Reduction");
|
||||
lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Vendetta"+ABILITY_LABEL_END);
|
||||
lore.add(ChatColor.GRAY+" Blocking stores 40% of mitigation damage.");
|
||||
@ -625,6 +628,8 @@ public enum ItemSet {
|
||||
lore.add(ChatColor.GRAY+" all of your stored mitigation damage.");
|
||||
lore.add(ChatColor.GRAY+" Vendetta stacks wear off after 10 seconds.");
|
||||
lore.add(ChatColor.GRAY+" Can be refreshed by basic attacking monsters.");
|
||||
lore.add(ChatColor.WHITE+" +"+((10*tier)+20)+"% Damage Reduction");
|
||||
lore.add(ChatColor.WHITE+" +"+((tier*20)+30)+" Health");
|
||||
}break;
|
||||
case DAWNTRACKER:{
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||
@ -900,7 +905,7 @@ public enum ItemSet {
|
||||
lore.add(ChatColor.WHITE+" a backstab occurs.");
|
||||
if (tier>=3) {
|
||||
lore.add(ChatColor.DARK_AQUA+" T27 - ");
|
||||
lore.add(ChatColor.WHITE+" Backstabs deal 6x normal damage.");
|
||||
lore.add(ChatColor.WHITE+" Backstabs deal 8x normal damage.");
|
||||
if (tier>=4) {
|
||||
lore.add(ChatColor.DARK_AQUA+" T40 - ");
|
||||
lore.add(ChatColor.WHITE+" +30% Cooldown Reduction");
|
||||
@ -972,21 +977,23 @@ public enum ItemSet {
|
||||
break;
|
||||
case PROTECTOR:
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+PlayerMode.SLAYER.getColor()+PlayerMode.SLAYER.getName()+"s"+ChatColor.GOLD+" do not benefit from party effects");
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"of this set. "+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+"s"+ChatColor.GOLD+" receive only half the effects.");
|
||||
//TODO Enable when Summoner is released.
|
||||
//lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"of this set. "+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+"s "+ChatColor.GOLD+" and "+PlayerMode.SUMMONER.getColor()+PlayerMode.SUMMONER.getName()+"s "+ChatColor.GOLD+" receive only half the effects.");
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"of this set. "+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+"s "+ChatColor.GOLD+" receive only half the effects.");
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Damage Reduction to other party members");
|
||||
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health to other party members.");
|
||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Reinforce"+ABILITY_LABEL_END+" - Each hit taken restores");
|
||||
lore.add(" "+ChatColor.WHITE+" "+ItemSet.GetBaseAmount(set, tier, 4, p)+" Health to other party members.");
|
||||
lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Unstoppable Team"+ABILITY_LABEL_END);
|
||||
lore.add(ChatColor.GRAY+" Press the swap item key to channel for 3 seconds,");
|
||||
lore.add(ChatColor.GRAY+" creating a "+(tier*20)+" Health shield for 30");
|
||||
lore.add(ChatColor.GRAY+" seconds on all party members.");
|
||||
lore.add(ChatColor.GRAY+" Press the swap item key while Rejuvenation is on cooldown");
|
||||
lore.add(ChatColor.GRAY+" to channel for 3 seconds, creating a "+(tier*20)+" Health");
|
||||
lore.add(ChatColor.GRAY+" shield for 30 seconds on all party members.");
|
||||
lore.add(ChatColor.GRAY+" ");
|
||||
lore.add(ChatColor.GRAY+" (150 second cooldown)");
|
||||
lore.add(ChatColor.GRAY+" ");
|
||||
lore.add(ChatColor.WHITE+" +50% Armor Penetration");
|
||||
lore.add(ChatColor.WHITE+" +20 Damage");
|
||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Party Damage Reduction");
|
||||
lore.add(ChatColor.WHITE+" +"+(tier*5)+" Party Health");
|
||||
break;
|
||||
case SHARD:
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||
@ -1038,10 +1045,13 @@ public enum ItemSet {
|
||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Healing per Regeneration tick");
|
||||
lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Share the Life"+ABILITY_LABEL_END);
|
||||
lore.add(ChatColor.GRAY+" Increases the Regeneration Pool for other party");
|
||||
lore.add(ChatColor.GRAY+" members by "+(tier)+" whenever you get hit.");
|
||||
lore.add(ChatColor.GRAY+" members by "+(tier)+" whenever you get hit. When");
|
||||
lore.add(ChatColor.GRAY+" party members are below half health, they will slowly");
|
||||
lore.add(ChatColor.GRAY+" steal health from you as long as your Health is above");
|
||||
lore.add(ChatColor.GRAY+" 50%.");
|
||||
lore.add(ChatColor.GRAY+" ");
|
||||
lore.add(ChatColor.WHITE+" +50% Armor Penetration");
|
||||
lore.add(ChatColor.WHITE+" +20 Damage");
|
||||
lore.add(ChatColor.WHITE+" +"+(tier*25)+"% Lifesteal");
|
||||
lore.add(ChatColor.WHITE+" +"+(tier*25)+" Health");
|
||||
break;
|
||||
case TOXIN:
|
||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||
|
@ -0,0 +1,19 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Scepter {
|
||||
ItemStack item;
|
||||
|
||||
public Scepter(ItemStack item) {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isScepter(ItemStack item) {
|
||||
return item.getType()==Material.BONE && (item.hasItemMeta() &&
|
||||
item.getItemMeta().hasLore() &&
|
||||
item.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE+"Summoner Gear"));
|
||||
}
|
||||
}
|
@ -143,7 +143,8 @@ enum OptionName{
|
||||
HEALTHBARDISPLAY("Healthbar Display",ChatColor.GRAY+"Toggles the healthbar near the player's cursor\nwhen attacking or getting hit by mobs.",Material.BED,(byte)0),
|
||||
AUTOEQUIPARMOR("Auto-Equip Armor",ChatColor.GRAY+"Toggles automatically equipping appropriate armor.",Material.LEATHER_CHESTPLATE,(byte)0),
|
||||
AUTOEQUIPWEAPON("Auto-Equip Weapon",ChatColor.GRAY+"Toggles automatically equipping appropriate weapons.",Material.IRON_SWORD,(byte)0),
|
||||
SOUNDS("Login/Logout Sounds",ChatColor.GRAY+"Toggles the playing of login/logout sound\nnotifications as well as message sound notifications.",Material.RECORD_7,(byte)0);
|
||||
SOUNDS("Login/Logout Sounds",ChatColor.GRAY+"Toggles the playing of login/logout sound\nnotifications as well as message sound notifications.",Material.RECORD_7,(byte)0),
|
||||
MOUSEOVERHEALTHBAR("Mouseover Healthbar",ChatColor.GRAY+"Toggles the display of a mob's healthbar without having to attack it.",Material.WATCH,(byte)0);
|
||||
|
||||
String title;
|
||||
String description;
|
||||
@ -198,6 +199,12 @@ enum OptionName{
|
||||
}
|
||||
return pd.healthbardisplay;
|
||||
}
|
||||
case MOUSEOVERHEALTHBAR:{
|
||||
if (toggle) {
|
||||
pd.mouseoverhealthbar=!pd.mouseoverhealthbar;
|
||||
}
|
||||
return pd.mouseoverhealthbar;
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("WARNING! Value for Option "+title+" does not exist!", 1);
|
||||
return false;
|
||||
|
246
src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java
Normal file
246
src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java
Normal file
@ -0,0 +1,246 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import sig.plugin.TwosideKeeper.CustomDamage;
|
||||
import sig.plugin.TwosideKeeper.LivingEntityStructure;
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
|
||||
|
||||
public class Pet {
|
||||
final static public int LEASHRANGE = 16;
|
||||
final static public int LEASHRANGE_SQUARED = LEASHRANGE*LEASHRANGE;
|
||||
Player owner;
|
||||
Location targetLoc;
|
||||
Location lastPos;
|
||||
double moveSpd = 1;
|
||||
double jumpHeight = 3.0;
|
||||
int attackRate = 10;
|
||||
long lastAttacked = 0;
|
||||
LivingEntity ent;
|
||||
String name="";
|
||||
int stuckTimer=0;
|
||||
LivingEntity myTarget=null;
|
||||
|
||||
PetState myState = PetState.PASSIVE;
|
||||
double myDamage = 5;
|
||||
|
||||
public Pet(Player owner, EntityType ent, String nickname) {
|
||||
try {
|
||||
this.ent = (LivingEntity)owner.getLocation().getWorld().spawnEntity(owner.getLocation(), ent);
|
||||
this.owner = owner;
|
||||
this.name = nickname;
|
||||
this.setNickname(nickname);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(this.ent);
|
||||
les.isPet=true;
|
||||
les.petOwner=owner;
|
||||
} catch (ClassCastException e) {
|
||||
TwosideKeeper.log("ERROR! Specified invalid Entity Type when creating Pet!", 0);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (owner==null || !owner.isValid() || ent==null || !ent.isValid()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
grabEnemyTarget();
|
||||
|
||||
switch (myState) {
|
||||
case PASSIVE:{
|
||||
if (myTarget!=null && !myTarget.isValid()) {
|
||||
myTarget=null;
|
||||
//TwosideKeeper.log("My Target is now "+GenericFunctions.GetEntityDisplayName(myTarget), 1);
|
||||
} else
|
||||
if (myTarget!=null) { //This is a valid target. If we are too far away, move towards it. Perform an attack when close enough if possible.
|
||||
if (ent.getLocation().distanceSquared(myTarget.getLocation())>4) {
|
||||
setTargetLocation(myTarget.getLocation());
|
||||
setState(PetState.MOVING);
|
||||
} else {
|
||||
//We are in attack range. Prepare an attack.
|
||||
if (lastAttacked+attackRate<=TwosideKeeper.getServerTickTime()) {
|
||||
myState=PetState.ATTACKING;
|
||||
lastAttacked=TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (owner.getLocation().distanceSquared(ent.getLocation())>LEASHRANGE_SQUARED) {
|
||||
ent.teleport(owner.getLocation());
|
||||
}
|
||||
}break;
|
||||
case MOVING:{
|
||||
if (targetLoc!=null && ent.getLocation().distanceSquared(targetLoc)>2) {
|
||||
Location loc = MoveTowardsPoint(targetLoc);
|
||||
if (lastPos!=null) {
|
||||
if (lastPos.distanceSquared(ent.getLocation())<4) {
|
||||
stuckTimer++;
|
||||
//TwosideKeeper.log("Stuck Timer: "+stuckTimer, 1);
|
||||
} else {
|
||||
stuckTimer=0;
|
||||
lastPos=null;
|
||||
//setState(PetState.PASSIVE);
|
||||
}
|
||||
} else {
|
||||
lastPos = loc.clone();
|
||||
}
|
||||
}
|
||||
if (stuckTimer==20) {
|
||||
//Try jumping.
|
||||
ent.setVelocity(new Vector(0,jumpHeight,0));
|
||||
stuckTimer++;
|
||||
} else
|
||||
if (stuckTimer==50) {
|
||||
ent.teleport(owner);
|
||||
stuckTimer=0;
|
||||
lastPos=null;
|
||||
targetLoc=null;
|
||||
setState(PetState.PASSIVE);
|
||||
}
|
||||
if (targetLoc!=null && ent.getLocation().distanceSquared(targetLoc)<=2) {
|
||||
targetLoc=null;
|
||||
stuckTimer=0;
|
||||
setState(PetState.PASSIVE);
|
||||
}
|
||||
if (targetLoc==null) {
|
||||
stuckTimer=0;
|
||||
setState(PetState.PASSIVE);
|
||||
}
|
||||
}break;
|
||||
case ATTACKING:{
|
||||
if (myTarget!=null) {
|
||||
MoveTowardsPoint(myTarget.getLocation(),0.4);
|
||||
//Deal damage.
|
||||
CustomDamage.ApplyDamage(myDamage, ent, myTarget, null, "Pet Attack");
|
||||
}
|
||||
setState(PetState.PASSIVE);
|
||||
}break;
|
||||
}
|
||||
//TwosideKeeper.log("Pet State: "+myState, 1);
|
||||
}
|
||||
|
||||
private Location MoveTowardsPoint(Location targetLoc) {
|
||||
return MoveTowardsPoint(targetLoc,1);
|
||||
}
|
||||
|
||||
private Location MoveTowardsPoint(Location targetLoc, double mult) {
|
||||
Vector dirToMove = MovementUtils.getVelocityTowardsLocation(ent.getLocation(), targetLoc, moveSpd*mult);
|
||||
Location loc = ent.getLocation();
|
||||
loc.setDirection(dirToMove);
|
||||
ent.setVelocity(dirToMove);
|
||||
ent.teleport(loc);
|
||||
return loc;
|
||||
}
|
||||
|
||||
public void setTarget(LivingEntity target) {
|
||||
setTarget(target,false);
|
||||
}
|
||||
|
||||
public void setTarget(LivingEntity target, boolean force) {
|
||||
if (myTarget==null || myTarget.getLocation().distanceSquared(ent.getLocation())>64 || force) {
|
||||
myTarget = target;
|
||||
}
|
||||
}
|
||||
|
||||
private void grabEnemyTarget() {
|
||||
if (myTarget!=null){
|
||||
if (myTarget.isValid()) {
|
||||
if (!myTarget.getWorld().equals(ent.getWorld())) {
|
||||
myTarget=null;
|
||||
return;
|
||||
}
|
||||
if (myTarget.getLocation().distanceSquared(ent.getLocation())>64) {
|
||||
myTarget=null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ent.hasAI() && isFighting()) {
|
||||
ent.setAI(false);
|
||||
if (myTarget==null || !myTarget.isValid()) {
|
||||
//Attempt to find a target. Try the owner's target first.
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(owner);
|
||||
myTarget = pd.target;
|
||||
if (myTarget==null || !myTarget.isValid()) {
|
||||
//Try to find a nearby target.
|
||||
List<LivingEntity> ents = GenericFunctions.getNearbyMonsters(ent.getLocation(), 4);
|
||||
double closestrange = Integer.MAX_VALUE;
|
||||
LivingEntity selectedent = null;
|
||||
for (int i=0;i<ents.size();i++) {
|
||||
LivingEntity ent = ents.get(i);
|
||||
if (ent==this.ent || LivingEntityStructure.isFriendly(owner, ent)) {
|
||||
ents.remove(i--);
|
||||
} else {
|
||||
double dist = ent.getLocation().distanceSquared(this.ent.getLocation());
|
||||
if (closestrange>dist) {
|
||||
closestrange = dist;
|
||||
selectedent = ent;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selectedent!=null) {
|
||||
myTarget=selectedent;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (!ent.hasAI() && !isFighting()) {
|
||||
ent.setAI(true);
|
||||
}
|
||||
}
|
||||
|
||||
public PetState getState() {
|
||||
return myState;
|
||||
}
|
||||
|
||||
public void setTargetLocation(Location loc) {
|
||||
this.targetLoc=loc;
|
||||
}
|
||||
|
||||
public void setMoveSpeed(double spd) {
|
||||
this.moveSpd = spd;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.name=nickname;
|
||||
this.ent.setCustomName(nickname);
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Location getTargetLocation() {
|
||||
return targetLoc;
|
||||
}
|
||||
|
||||
public LivingEntity getEntity() {
|
||||
return ent;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
ent.remove();
|
||||
}
|
||||
|
||||
public boolean isFighting() {
|
||||
if (owner!=null && PlayerUtils.PlayerIsInCombat(owner)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(PetState state) {
|
||||
myState = state;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
public enum PetState {
|
||||
PASSIVE,
|
||||
MOVING,
|
||||
ATTACKING;
|
||||
}
|
@ -11,108 +11,22 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
|
||||
public enum PlayerMode {
|
||||
STRIKER(ChatColor.RED,"S","Striker",
|
||||
ChatColor.RED+""+ChatColor.BOLD+"Striker mode Perks: "+ChatColor.RESET+"\n"
|
||||
+ ChatColor.WHITE+"->Players are identified as 'Strikers' when they only carry a sword in their main hand. No off-hand items.\n"
|
||||
+ ChatColor.GRAY+"->10% passive damage increase.\n"
|
||||
+ ChatColor.WHITE+"->20% chance to critically strike.\n"
|
||||
+ ChatColor.WHITE+"->Getting hit increases Speed by 1 Level. Stacks up to Speed V (Lasts five seconds.)\n"
|
||||
+ ChatColor.GRAY+"->Swinging your weapon stops nearby flying arrows. Each arrow deflected will give you a Strength buff. Stacks up to Strength V (Lasts five seconds.)\n"
|
||||
+ ChatColor.WHITE+"->Press the drop key to perform a line drive. Enemies you charge through take x1-x5 damage, based on target's missing health. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
|
||||
+ ChatColor.GRAY+"->Strikers have a 20% chance to dodge incoming attacks from any damage source while moving.\n"
|
||||
+ ChatColor.WHITE+"->Hitting a target when they have not noticed you yet does x3 normal damage.\n"),
|
||||
RANGER(ChatColor.DARK_GREEN,"R","Ranger",
|
||||
ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger mode Perks: "+ChatColor.RESET+"\n"
|
||||
+ ChatColor.WHITE+"->Players are identified as 'Rangers' when they carry a bow or a quiver in one of their hands. Off-hand items are permitted, except for a shield. Can only be wearing leather armor, or no armor.\n"
|
||||
+ ChatColor.GRAY+"->Left-clicking mobs will cause them to be knocked back extremely far, basically in headshot range, when walls permit.\n"
|
||||
+ ChatColor.WHITE+"->Base Arrow Damage increases from x2->x4.\n"
|
||||
+ ChatColor.GRAY+"->You can dodge 40% of all incoming attacks from any damage sources.\n"
|
||||
+ ChatColor.WHITE+"You have immunity to all Thorns damage.\n"
|
||||
+ ChatColor.GRAY+"Shift-Right Click to change Bow Modes.\n"
|
||||
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Close Range Mode (Default):"+ChatColor.RESET+ChatColor.WHITE+" \n"
|
||||
+ ChatColor.GRAY+" You gain the ability to deal headshots from any distance, even directly onto an enemy's face. Each kill made in this mode gives you 100% dodge chance for the next hit taken. You can tumble and gain invulnerability for 1 second by dropping your bow. Sneak while dropping it to tumble backwards.\n"
|
||||
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Sniping Mode:"+ChatColor.RESET+ChatColor.WHITE+" \n"
|
||||
+ ChatColor.GRAY+" Headshot collision area increases by x3. Headshots will deal an extra x0.125 damage for each headshot landed, up to a cap of 8 stacks. Each stack also increases your Slowness level by 1. You lose 10% dodge chance per Slowness stack, but gain one Resistance level and 10% critical chance per Slowness stack.\n"
|
||||
+ ChatColor.WHITE+" Arrows are lightning-fast in Sniping Mode.\n"
|
||||
+ ChatColor.GRAY+" Press the drop key in Sniping Mode to unleash 26 piercing arrows rapidly against your enemies.\n\n"
|
||||
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Debilitation Mode:"+ChatColor.RESET+ChatColor.WHITE+" \n"
|
||||
+ ChatColor.GRAY+" Adds a stack of Poison when hitting non-poisoned targets (15 second duration). Headshots made in this mode will increase the level of Poison on the mob, making the mob more and more vulnerable.\n"
|
||||
+ ChatColor.WHITE+" Press the drop key in Debilitation Mode when at least 1 poisoned target is nearby. Deals (Poison Level x 10) True Damage and Slows all targets the same level as the number of poison stacks applied to nearby targets for 15 seconds, and grants 4 Absorption health (2 hearts) to the Ranger per poison stack. Refreshes Poison duration on all nearby poisoned targets.\n"),
|
||||
DEFENDER(ChatColor.GRAY,"D","Defender",
|
||||
ChatColor.GRAY+""+ChatColor.BOLD+"Defender mode Perks: "+ChatColor.RESET+"\n"
|
||||
+ ChatColor.WHITE+"->Players are identified as 'Defenders' when they use a shield in their main hand.\n"
|
||||
+ ChatColor.GRAY+"->Base Damage reduction from shields increases from 5%->10%\n"
|
||||
+ ChatColor.WHITE+"->Blocking damage reduction increases from 50->70%\n"
|
||||
+ ChatColor.GRAY+"->When not blocking, you have Regeneration I. Blocking applies Regeneration II.\n"
|
||||
+ ChatColor.WHITE+"->Blocking gives 8 health (4 hearts) of Absorption damage.\n"
|
||||
+ ChatColor.GRAY+"->When hit while blocking, you build up Resistance, one level per hit, up to Resistance V (lasts 2 seconds)\n"
|
||||
+ ChatColor.WHITE+"->While blocking, you absorb 50% of all damage taken by party members.\n"
|
||||
+ ChatColor.GRAY+"->Blocking will aggro all nearby mobs to the blocking defender. They will glow indicate the aggro shift.\n"
|
||||
+ ChatColor.WHITE+"->Base Health increased by 10 (5 hearts)\n"
|
||||
+ ChatColor.GRAY+"->Getting hit as a defender increases saturation.\n"
|
||||
+ ChatColor.WHITE+"->Hitting mobs as a Defender aggros them to you.\n"
|
||||
+ ChatColor.GRAY+"->Knockback from attacks reduced by 75% while blocking.\n"
|
||||
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Rejuvenation"+ChatColor.RESET+ChatColor.WHITE+"\n"
|
||||
+ ChatColor.GRAY+"->Dropping your shield will give you 10 seconds of massive health regeneration and 2 seconds of invulnerability. It also costs 400 shield durability!\n"),
|
||||
BARBARIAN(ChatColor.GOLD,"B","Barbarian",
|
||||
ChatColor.GOLD+""+ChatColor.BOLD+"Barbarian mode Perks: "+ChatColor.RESET+"\n"
|
||||
+ ChatColor.WHITE+"->Players are identified as 'Barbarians' by wielding an axe in both the main hand and the offhand.\n"
|
||||
+ ChatColor.GRAY+"->Barbarians swing their off-hand by right-clicking.\n"
|
||||
+ ChatColor.WHITE+"->Barbarians gain 2 HP (1 Heart) per 1% of Damage reduction.\n"
|
||||
+ ChatColor.GRAY+"->When Barbarians are hit, they take damage as if they had 0% Damage reduction.\n"
|
||||
+ ChatColor.WHITE+"->Barbarians deal 20% more damage for every 20% of an enemy's missing health.\n"
|
||||
+ ChatColor.GRAY+"->Barbarians gain Bonus Lifesteal stacks as they hit enemies. Each stack increases Lifesteal by 1%, up to a cap of 100% extra Lifesteal. The stacks refresh every hit, but wear off after 5 seconds.\n"
|
||||
+ ChatColor.WHITE+"->Barbarians do not instantly take full damage when hit. Instead, the HP is stored in a 'Damage Pool' and distributed every second.\n"
|
||||
+ ChatColor.GRAY+"->If Barbarians have points in their 'Damage Pool', they will take up to 15 damage (+2% of their damage pool) every second. The amount taken goes down by wearing Barbarian gear.\n"
|
||||
+ ChatColor.WHITE+"->When a monster is killed by a Barbarian, the amount of remaining damage in their Damage Pool is divided by 75%. If an ally kills one, the damage pool is divided by 33%\n"
|
||||
+ ChatColor.GRAY+"->Extra health from Lifestealing that is not used for healing your health will heal up your Damage Pool instead."
|
||||
+ ChatColor.WHITE+"->Barbarians automatically consume Rotten Flesh and Spider Eyes that are picked up. Each one heals for 1% of their health. Rotten Flesh and Spider Eyes in a Barbarian's inventory will automatically be consumed as the Barbarian gets hungry.\n"
|
||||
+ ChatColor.GRAY+"->Barbarians build up Weapon Charges in two ways: +1 Charge for attacking an enemy with the main hand weapon and +2 Charges for taking damage.\n"
|
||||
+ ChatColor.WHITE+"->Barbarians have 70% knockback resistance.\n"
|
||||
+ ChatColor.GRAY+"->Barbarians can release their Weapon Charges by using a variety of commands:\n"
|
||||
+ ChatColor.WHITE+"->Right-Click (Costs 10 Charges): Power Swing - Swing your off-hand weapon to deal an attack with +100% Lifesteal and +100% Crit Chance bonus. Gives 10 Bonus Lifesteal stacks.\n"
|
||||
+ ChatColor.GRAY+"->Shift Left-Click (Costs 30 Charges): Forceful Strike - Hit all enemies in a line in front of you, dealing double damage and suppressing them for 3 seconds.\n"
|
||||
+ ChatColor.WHITE+"->Shift Right-Click (Costs 30 Charges): Sweep Up - Performs a sweeping attack which knocks up and damages all enemies within a 4m radius of you. Doubles your Bonus Lifesteal stacks. Lifesteal effects are doubled during this attack.\n"
|
||||
+ ChatColor.GRAY+"->Swap Item Key (100 Charges Minimum, Costs ALL Charges): Barbarian's Rage - Converts your missing health into Absorption Hearts and applies powerful buffs. This ability is stronger the more stacks consumed.\n"
|
||||
+ ChatColor.WHITE+" Barbarian's Rage: \n"
|
||||
+ ChatColor.GRAY+" -- Strength Level: +1 per 10 charges\n"
|
||||
+ ChatColor.WHITE+" -- LifeSteal: +1% per 2 charges\n"
|
||||
+ ChatColor.GRAY+" -- Speed V\n"
|
||||
+ ChatColor.WHITE+" -- Duration of Rage: +1 second per 10 charges\n"
|
||||
+ ChatColor.GRAY+" -- +2 seconds of invulnerability per 100 charges\n"
|
||||
+ ChatColor.WHITE+"During Rage you gain double the number of Bonus Lifesteal stacks. You do not gain Weapon Charges during Barbarian's Rage.\n"
|
||||
+ ChatColor.GRAY+"->Leaping Strike: Barbarians that take fall damage deal triple the damage taken from the fall as damage to all enemies nearby. The range of this attack increases based on how fast the Barbarian falls.\n"
|
||||
+ ChatColor.WHITE+"->Mock: Press the drop key to perform a Mock attack to all enemies near you. Affected enemies become aggro'd to the Barbarian for 15 seconds and receive 2 stacks of Weakness that lasts 15 seconds. This can stack up to Weakness VI. 20 second cooldown.\n"
|
||||
STRIKER(ChatColor.RED,"S","Striker",Book.STRIKERGUIDE),
|
||||
RANGER(ChatColor.DARK_GREEN,"R","Ranger",Book.RANGERGUIDE),
|
||||
DEFENDER(ChatColor.GRAY,"D","Defender",Book.DEFENDERGUIDE),
|
||||
BARBARIAN(ChatColor.GOLD,"B","Barbarian",Book.BARBARIANGUIDE
|
||||
),
|
||||
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",
|
||||
ChatColor.DARK_BLUE+""+ChatColor.BOLD+"Slayer mode Perks: "+ChatColor.RESET+"\n"
|
||||
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble Pouch in their off hand.\n"
|
||||
+ ChatColor.GRAY+"->Slayers can make use of up to 9 Baubles by placing them in their Bauble Pouch. Each Bauble adds a certain amount of stats to the Slayer, making them more efficient.\n"
|
||||
+ ChatColor.WHITE+"->Slayers take a maximum of 1 Heart (2 HP) in damage from all attacks, making this mode essentially 5 lives.\n"
|
||||
+ ChatColor.GRAY+"->Slayers are not affected by any Health Recovery and Health Regeneration effects. This mode only heals from kills, being out of combat for 1 minute, using the Amulet's set effect, or sleeping. However, Absorption will still work for a Slayer. Absorption hearts just get removed with normal damage calculation rules.\n"
|
||||
+ ChatColor.WHITE+"->Whenever a Slayer kills a target, they recover 1 Heart (2 HP). This can be modified by a special weapon.\n"
|
||||
+ ChatColor.GRAY+"->Slayers can enter Stealth mode by pressing Sneak. Once in Stealth mode, Slayers will not leave stealth until they take damage or Sneak again. Stealth mode drains 1 Durability every second from tools on your hotbar.\n"
|
||||
+ ChatColor.WHITE+"->While in Stealth mode, nothing will be able to detect you. Note this does not get rid of aggression from targets that have already aggro'd you.\n"
|
||||
+ ChatColor.GRAY+"->Slayers can Backstab targets by getting behind them and hitting them. A backstab does triple the normal damage of an attack.\n"
|
||||
+ ChatColor.WHITE+"->Whenever a Slayer critically strikes, it suppresses a target for 0.75 seconds. Suppression prevents movement, attacking, teleporting, and exploding. Suppressed targets glow Black.\n"
|
||||
+ ChatColor.GRAY+"->Slayers thrive in 1vs1 situations. If a target is completely alone, they will glow white to the Slayer. Isolated targets take 50% more damage from the Slayer. Slayer's Dodge Chance increases by 40% against isolated targets.\n"
|
||||
+ ChatColor.WHITE+"->Slayers can use the Assassination ability. Press the Drop key while looking at an enemy to perform an assassination: You jump directly behind the enemy, gaining 0.5 seconds of invulnerability. If the next hit after Assassination is performed kills the target, you gain a speed and strength buff. These buffs cap at Speed V and Strength X respectively and last 10 seconds. Assassination cooldown is reset whenever a target is instantly killed in this manner, and you get immediately put back into stealth, preventing further detection from other monsters.\n"),
|
||||
/*SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
|
||||
ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"Summoner mode Perks: "+ChatColor.RESET+"\n"),*/
|
||||
NORMAL(ChatColor.WHITE,"A","Adventurer",
|
||||
ChatColor.WHITE+""+ChatColor.BOLD+"Adventurer mode Perks: "+ChatColor.RESET+"\n"
|
||||
+ ChatColor.WHITE+"->Players are identified as 'Adventurers' by default.\n"
|
||||
+ ChatColor.GRAY+"->Adventurers gain +10 Health.\n"
|
||||
+ ChatColor.WHITE+"->Adventurers gain +20% Damage Reduction.\n"
|
||||
+ ChatColor.GRAY+"->Adventurers gain +50% Health Regeneration.\n"
|
||||
+ ChatColor.WHITE+"->If Adventurers are killed, their Buy-Backs are 50% cheaper.\n"
|
||||
+ ChatColor.GRAY+"->Adventurers do not get exhausted when performing light activities.\n");
|
||||
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",Book.SLAYERGUIDE),
|
||||
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
|
||||
Book.SUMMONERGUIDE),
|
||||
NORMAL(ChatColor.WHITE,"A","Adventurer",Book.ADVENTURERGUIDE);
|
||||
;
|
||||
|
||||
final public static int UPDATE_GRACE_PERIOD=9; //How often to update the mode of the player.
|
||||
|
||||
ChatColor col=ChatColor.WHITE;
|
||||
String symbol="";
|
||||
Book storedBook;
|
||||
|
||||
public ChatColor getColor() {
|
||||
return col;
|
||||
@ -148,6 +62,9 @@ public enum PlayerMode {
|
||||
} else
|
||||
if (Check_isRanger(p)) {
|
||||
pd.lastmode=PlayerMode.RANGER;
|
||||
} else
|
||||
if (Check_isSummoner(p)) {
|
||||
pd.lastmode=PlayerMode.SUMMONER;
|
||||
} else {
|
||||
pd.lastmode=PlayerMode.NORMAL;
|
||||
}
|
||||
@ -232,6 +149,19 @@ public enum PlayerMode {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSummoner(Player p) {
|
||||
if (p!=null && !p.isDead()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (needsUpdating(pd)) {
|
||||
return getPlayerMode(p)==PlayerMode.SUMMONER;
|
||||
} else {
|
||||
return pd.lastmode==PlayerMode.SUMMONER;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNormal(Player p) {
|
||||
if (p!=null && !p.isDead()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
@ -338,23 +268,43 @@ public enum PlayerMode {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean Check_isSummoner(Player p) {
|
||||
if (p!=null && !p.isDead()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (needsUpdating(pd)) {
|
||||
if (GenericFunctions.onlyHoldingScepter(p) &&
|
||||
GenericFunctions.AllLeatherArmor(p)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return pd.lastmode==PlayerMode.SUMMONER;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String name="";
|
||||
String desription="";
|
||||
Book helperBook;
|
||||
|
||||
public String getDesription() {
|
||||
return desription;
|
||||
public Book getBook() {
|
||||
return helperBook;
|
||||
}
|
||||
|
||||
public void setDesription(String desription) {
|
||||
this.desription = desription;
|
||||
public void setBook(Book book) {
|
||||
this.helperBook = book;
|
||||
}
|
||||
|
||||
PlayerMode(ChatColor col, String abbreviation, String fullname, String desc) {
|
||||
PlayerMode(ChatColor col, String abbreviation, String fullname, Book descBook) {
|
||||
this.col=col;
|
||||
this.symbol=abbreviation;
|
||||
this.name=fullname;
|
||||
this.desription=desc;
|
||||
this.helperBook=descBook;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isLeatherPlayerMode(PlayerMode mode) {
|
||||
return mode==PlayerMode.RANGER || mode==PlayerMode.SUMMONER;
|
||||
}
|
||||
}
|
||||
|
@ -6,23 +6,21 @@ public class RecyclingCenterNode {
|
||||
private Location loc;
|
||||
private boolean toolsAllowed=true;
|
||||
private boolean itemsAllowed=true;
|
||||
private String recyclingCenterName="Recycling Center";
|
||||
|
||||
public RecyclingCenterNode(Location loc) {
|
||||
this.loc=loc.clone();
|
||||
this.toolsAllowed=true;
|
||||
this.itemsAllowed=true;
|
||||
public RecyclingCenterNode(Location loc, String name) {
|
||||
this(loc,name,true);
|
||||
}
|
||||
|
||||
public RecyclingCenterNode(Location loc, boolean toolsAllowed) {
|
||||
this.loc=loc.clone();
|
||||
this.toolsAllowed=toolsAllowed;
|
||||
this.itemsAllowed=true;
|
||||
public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed) {
|
||||
this(loc,name,toolsAllowed,true);
|
||||
}
|
||||
|
||||
public RecyclingCenterNode(Location loc, boolean toolsAllowed, boolean itemsAllowed) {
|
||||
public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed, boolean itemsAllowed) {
|
||||
this.loc=loc.clone();
|
||||
this.toolsAllowed=toolsAllowed;
|
||||
this.itemsAllowed=itemsAllowed;
|
||||
this.recyclingCenterName=name;
|
||||
}
|
||||
|
||||
public boolean areToolsAllowed() {
|
||||
@ -42,11 +40,19 @@ public class RecyclingCenterNode {
|
||||
this.itemsAllowed = itemsAllowed;
|
||||
}
|
||||
|
||||
public String getRecyclingCenterName() {
|
||||
return recyclingCenterName;
|
||||
}
|
||||
|
||||
public void setRecyclingCenterName(String name) {
|
||||
this.recyclingCenterName = name;
|
||||
}
|
||||
|
||||
public Location getRecyclingCenterLocation() {
|
||||
return loc;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "RecyclingCenterNode(x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")";
|
||||
return "RecyclingCenterNode(Name="+recyclingCenterName+",x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")";
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Book;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
|
||||
public class BookUtils {
|
||||
public static void GiveBookToPlayer(Player p,Book book) {
|
||||
File file = book.getBookFile();
|
||||
if (file.exists()) {
|
||||
ItemStack bookItem = new ItemStack(Material.WRITTEN_BOOK);
|
||||
BookMeta meta = (BookMeta)bookItem.getItemMeta();
|
||||
String[] contents = FileUtils.readFromFile(book.getBookFilepath());
|
||||
List<String> bookContents = new ArrayList<String>();
|
||||
for (int i=0;i<contents.length;i++) {
|
||||
bookContents.add(ChatColor.translateAlternateColorCodes('&', contents[i]).replace("\\n", "\n"));
|
||||
}
|
||||
//meta.setTitle(bookContents.remove(0));
|
||||
meta.setDisplayName(bookContents.remove(0));
|
||||
meta.setAuthor(bookContents.remove(0));
|
||||
meta.setPages(bookContents);
|
||||
bookItem.setItemMeta(meta);
|
||||
GenericFunctions.giveItem(p, bookItem);
|
||||
} else {
|
||||
try {
|
||||
TwosideKeeper.log("WARNING! Book "+book.name()+" does not exist! Create a file in "+file.getCanonicalPath(), 1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@ public enum ColoredParticle {
|
||||
}
|
||||
String name;
|
||||
public void send(Location location, List<Player> players, int r, int g, int b) {
|
||||
ParticleEffect.valueOf(name).display(r/255, g / 255, b / 255, 1, 0, location, players);
|
||||
ParticleEffect.valueOf(name).display(r/255f, g / 255f, b / 255f, 1, 0, location, players);
|
||||
}
|
||||
public void send(Location location, int Distance, int r, int g, int b) {
|
||||
ParticleEffect.valueOf(name).display(r/255, g / 255, b / 255, 1, 0, location, Distance);
|
||||
ParticleEffect.valueOf(name).display(r/255f, g / 255f, b / 255f, 1, 0, location, Distance);
|
||||
}
|
||||
|
||||
}
|
@ -10,6 +10,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.EnderCrystal;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -24,7 +25,7 @@ import sig.plugin.TwosideKeeper.LivingEntityStructure;
|
||||
import sig.plugin.TwosideKeeper.MonsterController;
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CloudRunnable;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DamageLabel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
||||
@ -78,17 +79,21 @@ public class EntityUtils {
|
||||
public static void applyDamageIndicator(Entity e, double damage, IndicatorType type) {
|
||||
Location offsetloc = e.getLocation().add(Math.random()/2-0.25,0.5,Math.random()/2-0.25);
|
||||
if (damage>=1) {
|
||||
AreaEffectCloud aec = CreateOverlayText(offsetloc,((damage>=100)?ChatColor.BOLD+" ":"")+type.getColor()+Integer.toString((int)damage)+((damage>=100)?" ":""));
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,new CloudRunnable(aec,0.15*Math.min(Math.max(1,(double)damage/50),2),(int)(10*Math.min(Math.max(1,(double)damage/50),2))),1);
|
||||
ArmorStand aec = CreateOverlayText(offsetloc,((damage>=100)?ChatColor.BOLD+" ":"")+type.getColor()+Integer.toString((int)damage)+((damage>=100)?" ":""));
|
||||
TwosideKeeper.labelqueue.add(new DamageLabel(aec,0.1,(int)(10*Math.min(Math.max(1,(double)damage/50),2))));
|
||||
}
|
||||
}
|
||||
|
||||
public static AreaEffectCloud CreateOverlayText(Location loc, String overlay) {
|
||||
AreaEffectCloud aec = (AreaEffectCloud)loc.getWorld().spawnEntity(loc, EntityType.AREA_EFFECT_CLOUD);
|
||||
public static ArmorStand CreateOverlayText(Location loc, String overlay) {
|
||||
ArmorStand aec = (ArmorStand)loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
|
||||
aec.setCustomName(overlay);
|
||||
aec.setGravity(false);
|
||||
aec.setRemoveWhenFarAway(true);
|
||||
aec.setCustomNameVisible(true);
|
||||
aec.setRadius(0);
|
||||
aec.setParticle(Particle.ITEM_TAKE);
|
||||
aec.setVisible(false);
|
||||
aec.setMarker(true);
|
||||
//aec.setRadius(0);
|
||||
//aec.setParticle(Particle.ITEM_TAKE);
|
||||
//Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,new CloudRunnable(aec,0.15,10),1);
|
||||
return aec;
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
public class MathUtils {
|
||||
public static EulerAngle getEulerAngleDegrees(double degX,double degY,double degZ) {
|
||||
return new EulerAngle(Math.toRadians(degX),Math.toRadians(degY),Math.toRadians(degZ));
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class MovementUtils {
|
||||
public static Vector moveTowardsLocation(Location currloc, Location targetloc, double spd) {
|
||||
public static Vector getVelocityTowardsLocation(Location currloc, Location targetloc, double spd) {
|
||||
/*double deltax = currloc.getX()-targetloc.getX();
|
||||
double deltay = currloc.getY()-targetloc.getY();
|
||||
double deltaz = currloc.getZ()-targetloc.getZ();
|
||||
|
@ -25,29 +25,37 @@ public class SoundUtils {
|
||||
*/
|
||||
public static void playIndividualGlobalSound(Location loc, Sound sound, float vol, float pitch) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!p.isDead()) {
|
||||
p.playSound(loc, sound, vol, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Plays a sound at the player's location, as if they were hearing a regular sound in the client.
|
||||
*/
|
||||
public static void playLocalSound(Player p, Sound sound, float vol, float pitch) {
|
||||
if (!p.isDead()) {
|
||||
SoundUtils.playLocalSound(p,p.getLocation(), sound, vol, pitch);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Plays a sound at the specified location for a single player, as if they were hearing a regular sound in the client.
|
||||
*/
|
||||
public static void playLocalSound(Player p, Location loc, Sound sound, float vol, float pitch) {
|
||||
if (!p.isDead()) {
|
||||
p.playSound(loc, sound, vol, pitch);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Plays a sound at the player's location for every player, as if they were hearing a regular sound in the client. Useful for notifications/pings.
|
||||
*/
|
||||
public static void playLocalGlobalSound(Sound sound, float vol, float pitch) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!p.isDead()) {
|
||||
SoundUtils.playLocalSound(p, sound, vol, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static float DetermineItemPitch(ItemStack item) {
|
||||
double pitch = 1.0f;
|
||||
|
@ -181,7 +181,8 @@ public class WorldShop {
|
||||
}
|
||||
|
||||
private double ModifyPriceBasedOnLocation(double price) {
|
||||
if (!loc.getWorld().equals(TwosideKeeper.TWOSIDE_LOCATION.getWorld())) {
|
||||
////NO LONGER INCREASES BASED ON DISTANCE OR WORLD!!
|
||||
/*if (!loc.getWorld().equals(TwosideKeeper.TWOSIDE_LOCATION.getWorld())) {
|
||||
//This is in another world. Automatically increase price by x4.
|
||||
price *= 4;
|
||||
} else {
|
||||
@ -202,7 +203,7 @@ public class WorldShop {
|
||||
if (loc.getBlockY()<=16) {
|
||||
price *= 1.5;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return Math.round(price*100)/100d;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,6 +18,7 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
import org.inventivetalent.glow.GlowAPI;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
||||
@ -49,9 +51,13 @@ public class LivingEntityStructure {
|
||||
public long lastCrippleTick=0;
|
||||
public long lastBurnTick=0;
|
||||
public long lastHit=0;
|
||||
public long lastHitbyPlayer=0;
|
||||
public Player lastPlayerThatHit=null;
|
||||
public float MoveSpeedMultBeforeCripple=1f;
|
||||
public Channel currentChannel=null;
|
||||
public boolean isImportantGlowEnemy=true;
|
||||
public boolean isPet=false;
|
||||
public Player petOwner=null;
|
||||
public HashMap<UUID,Integer> aggro_table = new HashMap<UUID,Integer>();
|
||||
|
||||
final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET;
|
||||
@ -189,11 +195,13 @@ public class LivingEntityStructure {
|
||||
}
|
||||
|
||||
public void setGlow(Player p, GlowAPI.Color col) {
|
||||
GlowAPI.setGlowing(m, col, p);
|
||||
glowcolorlist.put(p.getUniqueId(), col);
|
||||
}
|
||||
|
||||
public void setGlobalGlow(GlowAPI.Color col) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
GlowAPI.setGlowing(m, col, p);
|
||||
glowcolorlist.put(p.getUniqueId(), col);
|
||||
}
|
||||
}
|
||||
@ -263,7 +271,7 @@ public class LivingEntityStructure {
|
||||
}
|
||||
}
|
||||
}catch (NullPointerException npe) {
|
||||
|
||||
GlowAPI.setGlowing(m, false, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -406,8 +414,19 @@ public class LivingEntityStructure {
|
||||
}
|
||||
|
||||
public void increaseAggro(LivingEntity target, int amt) {
|
||||
amt = getNewAggroBasedOnAggroMultipliers(target,amt);
|
||||
setAggro(target,getAggroRating(target)+amt);
|
||||
}
|
||||
private int getNewAggroBasedOnAggroMultipliers(LivingEntity target, int amt) {
|
||||
if (target instanceof Player) {
|
||||
Player p = (Player)target;
|
||||
amt += amt * ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL);
|
||||
if (ItemSet.hasFullSet(p, ItemSet.PRIDE)) {
|
||||
return amt * ItemSet.getHighestTierInSet(p, ItemSet.PRIDE);
|
||||
}
|
||||
}
|
||||
return amt;
|
||||
}
|
||||
public void decreaseAggro(LivingEntity target, int amt) {
|
||||
increaseAggro(target,-amt);
|
||||
}
|
||||
@ -494,6 +513,43 @@ public class LivingEntityStructure {
|
||||
if (target!=null && !EntityUtils.isValidEntity(target)) {
|
||||
aggro_table.remove(target.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFriendly(LivingEntity ent1, LivingEntity ent2) {
|
||||
if (!(ent1 instanceof Player) &&
|
||||
!(ent2 instanceof Player)) {
|
||||
LivingEntityStructure les1 = LivingEntityStructure.GetLivingEntityStructure(ent1);
|
||||
LivingEntityStructure les2 = LivingEntityStructure.GetLivingEntityStructure(ent2);
|
||||
if (les1.isPet && les2.isPet) {
|
||||
if (les1.petOwner!=null && les2.petOwner!=null) {
|
||||
return PVP.isFriendly(les1.petOwner, les2.petOwner);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
if (!(ent1 instanceof Player) ^
|
||||
!(ent2 instanceof Player)) {
|
||||
if (ent1 instanceof Player) { //ent2 is the pet.
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent2);
|
||||
if (les.isPet && les.petOwner!=null) {
|
||||
return PVP.isFriendly(les.petOwner,(Player)ent1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else { //ent1 is the pet.
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent1);
|
||||
if (les.isPet && les.petOwner!=null) {
|
||||
return PVP.isFriendly(les.petOwner,(Player)ent2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
return PVP.isFriendly((Player)ent1,(Player)ent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
src/sig/plugin/TwosideKeeper/Modes/Summoner.java
Normal file
39
src/sig/plugin/TwosideKeeper/Modes/Summoner.java
Normal file
@ -0,0 +1,39 @@
|
||||
package sig.plugin.TwosideKeeper.Modes;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PetState;
|
||||
|
||||
public class Summoner {
|
||||
/**
|
||||
*
|
||||
* @return False means stop the action from passing onto other sections of code.
|
||||
*/
|
||||
public static boolean HandleSummonerInteraction(Event e) {
|
||||
if (e instanceof PlayerInteractEvent) {
|
||||
PlayerInteractEvent ev = (PlayerInteractEvent)e;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
|
||||
if (ev.getAction()==Action.RIGHT_CLICK_BLOCK && pd.myPet!=null && pd.myPet.getState()==PetState.PASSIVE) {
|
||||
PetMoveCommand(ev.getClickedBlock().getLocation(),ev.getPlayer());
|
||||
}
|
||||
} else
|
||||
if (e instanceof PlayerInteractEntityEvent) {
|
||||
PlayerInteractEntityEvent ev = (PlayerInteractEntityEvent)e;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void PetMoveCommand(Location targetLoc, Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.myPet!=null) {
|
||||
pd.myPet.setTargetLocation(targetLoc);
|
||||
pd.myPet.setState(PetState.MOVING);
|
||||
}
|
||||
}
|
||||
}
|
@ -51,11 +51,11 @@ public class HellfireGhast extends CustomMonster{
|
||||
//Begin charging towards player.
|
||||
m.setAI(false);
|
||||
if (target!=null && target.isValid() && !target.isDead() && target.getWorld().equals(m.getWorld())) {
|
||||
m.setVelocity(MovementUtils.moveTowardsLocation(m.getLocation(), target.getLocation(), 2));
|
||||
m.setVelocity(MovementUtils.getVelocityTowardsLocation(m.getLocation(), target.getLocation(), 2));
|
||||
} else {
|
||||
target = FindClosestNearbyTarget();
|
||||
if (target!=null) {
|
||||
m.setVelocity(MovementUtils.moveTowardsLocation(m.getLocation(), target.getLocation(), 2));
|
||||
m.setVelocity(MovementUtils.getVelocityTowardsLocation(m.getLocation(), target.getLocation(), 2));
|
||||
}
|
||||
}
|
||||
if (m.getLocation().distanceSquared(target.getLocation())<49) {
|
||||
|
@ -231,7 +231,7 @@ public class MonsterController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return (/*dist<4096*/ dist<2304 && (GenericFunctions.getNearbyMobs(ent.getLocation(), 16).size()<(nearbyplayers*2)+1));
|
||||
return (/*dist<4096*/ dist<2304 && (GenericFunctions.getNearbyMobsIncludingPlayers(ent.getLocation(), 16).size()<(nearbyplayers*2)+1));
|
||||
}
|
||||
|
||||
private static boolean meetsConditionsToBeElite(LivingEntity ent) {
|
||||
|
@ -17,22 +17,34 @@ import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.AdvancedTitle;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Book;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomModel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.OptionsMenu;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Pet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BookUtils;
|
||||
import sig.plugin.TwosideKeeper.Logging.DamageLogger;
|
||||
|
||||
//import com.google.common.graph.*;
|
||||
@ -91,7 +103,7 @@ public class PlayerStructure {
|
||||
public boolean fulldodge=false;
|
||||
public long last_arrowbarrage=TwosideKeeper.getServerTickTime();
|
||||
public long last_laugh_time=TwosideKeeper.getServerTickTime();
|
||||
public long last_rejuvenate=TwosideKeeper.getServerTickTime();
|
||||
public long last_mobcontrol=TwosideKeeper.getServerTickTime();
|
||||
public DamageLogger damagedata;
|
||||
public boolean damagelogging=false;
|
||||
public boolean hasDied=false;
|
||||
@ -180,6 +192,12 @@ public class PlayerStructure {
|
||||
public boolean firstPVPMatch=true;
|
||||
public String lastPVPHitReason="";
|
||||
public double lastPVPHitDamage=0;
|
||||
public boolean blocking=false;
|
||||
public long lastShieldCharge=0;
|
||||
public LivingEntity lastTarget=null;
|
||||
public long lastGrabbedTarget=0;
|
||||
public UUID lastViewedTarget=null;
|
||||
public boolean mouseoverhealthbar=true;
|
||||
/*State 1
|
||||
* 1: Best of 3 Rounds
|
||||
* 2: Best of 5 Rounds
|
||||
@ -252,11 +270,15 @@ public class PlayerStructure {
|
||||
public long lastInfectionTick=0;
|
||||
public long lastCrippleTick=0;
|
||||
public long lastBurnTick=0;
|
||||
public long lastusedRejuvenation=0;
|
||||
public float MoveSpeedMultBeforeCripple=1f;
|
||||
public Channel currentChannel=null;
|
||||
public long lastFailedCastTime=0;
|
||||
public Location locBeforeInstance=null;
|
||||
|
||||
public Pet myPet=null;
|
||||
public int petID=0;
|
||||
|
||||
List<ItemStack> equipmentset = new ArrayList<ItemStack>();
|
||||
|
||||
public HashMap<Material,List<Integer>> filtercubestructure = new HashMap<Material, List<Integer>>();
|
||||
@ -282,6 +304,7 @@ public class PlayerStructure {
|
||||
public int unafkLength = 0;
|
||||
public int gracePeriod = 0;
|
||||
public long lastActiveActivity = 0; //Includes disenchanting / alchemizing.
|
||||
public int blockStacks = 0;
|
||||
|
||||
//Prevent Automatic AFK moving the camera just to avoid the system.
|
||||
public long lastAdjustmentReading = 0; //When the last adjustment reading started.
|
||||
@ -290,8 +313,11 @@ public class PlayerStructure {
|
||||
public double averageAdjustmentsMade = 0; //Avg Number of adjustments made.
|
||||
public int averageAdjustmentsMadeCount = 0; //Stored number of adjustments used in average.
|
||||
public boolean tooConsistentAdjustments = false; //Adjustments are too consistent.
|
||||
public ArmorStand myStand=null;
|
||||
public CustomModel myModel=null;
|
||||
|
||||
public String lastplayerHitBy = ""; //The last player that hurt this player.
|
||||
public String recyclingCenterNodeSelectionName = "";
|
||||
|
||||
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -338,13 +364,14 @@ public class PlayerStructure {
|
||||
this.isViewingInventory=false;
|
||||
this.destroyedminecart=false;
|
||||
this.last_laugh_time=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.last_rejuvenate=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.last_mobcontrol=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.lastassassinatetime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.lastlifesavertime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.lastusedwindslash=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.icewandused=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.lastusedbeastwithin=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.lastusedunstoppableteam=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.lastusedRejuvenation=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
|
||||
this.damagedata = new DamageLogger(p);
|
||||
this.damagelogging=false;
|
||||
this.isPlayingSpleef=false;
|
||||
@ -355,6 +382,7 @@ public class PlayerStructure {
|
||||
this.customtitle = new AdvancedTitle(p);
|
||||
this.lastLocationChange = TwosideKeeper.getServerTickTime();
|
||||
this.lastblock = TwosideKeeper.getServerTickTime();
|
||||
//this.myPet = new Pet(p,EntityType.OCELOT,"Test");
|
||||
//Set defaults first, in case this is a new user.
|
||||
loadConfig();
|
||||
//p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
||||
@ -380,13 +408,16 @@ public class PlayerStructure {
|
||||
p.getInventory().addItem(new ItemStack(Material.LEATHER_LEGGINGS,1));
|
||||
p.getInventory().addItem(new ItemStack(Material.TORCH,8));
|
||||
p.getInventory().addItem(new ItemStack(Material.BREAD,16));*/
|
||||
ItemStack manual = new ItemStack(Material.WRITTEN_BOOK);
|
||||
/*ItemStack manual = new ItemStack(Material.WRITTEN_BOOK);
|
||||
BookMeta bm = (BookMeta)manual.getItemMeta();
|
||||
bm.setAuthor("Sig's Minecraft");
|
||||
//bm.setPage(arg0, arg1);
|
||||
|
||||
CreateBeginnersManual(bm);
|
||||
manual.setItemMeta(bm);
|
||||
p.getInventory().addItem(manual);
|
||||
|
||||
*/
|
||||
BookUtils.GiveBookToPlayer(p, Book.COMMANDGUIDE);
|
||||
BookUtils.GiveBookToPlayer(p, Book.BEGINNERSGUIDE);
|
||||
//Make sure it's not already there...?
|
||||
if (Bukkit.getServer().getScoreboardManager().getMainScoreboard().getTeam(this.name.toLowerCase())==null) {
|
||||
Bukkit.getServer().getScoreboardManager().getMainScoreboard().registerNewTeam(this.name.toLowerCase()).addPlayer(p);
|
||||
@ -414,13 +445,24 @@ public class PlayerStructure {
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateBeginnersManual(BookMeta bm) {
|
||||
TextComponent com = new TextComponent("This is a test component");
|
||||
com.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/stats"));
|
||||
com.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Hello").create()));
|
||||
|
||||
List<String> bookContents = new ArrayList<String>();
|
||||
|
||||
bm.setPages();
|
||||
|
||||
}
|
||||
|
||||
public static void setDefaultCooldowns(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.BOW, GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, TwosideKeeper.DODGE_COOLDOWN));
|
||||
applyCooldownToAllTypes(p,"HOE",GenericFunctions.GetRemainingCooldownTime(p, pd.last_deathmark, TwosideKeeper.DEATHMARK_COOLDOWN));
|
||||
applyCooldownToAllTypes(p,"SPADE",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedearthwave, TwosideKeeper.EARTHWAVE_COOLDOWN));
|
||||
applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN));
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN));
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, pd.last_mobcontrol, TwosideKeeper.MOBCONTROL_COOLDOWN));
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN));
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN));
|
||||
aPluginAPIWrapper.sendCooldownPacket(p, Material.WATCH, GenericFunctions.GetRemainingCooldownTime(p, pd.icewandused, TwosideKeeper.ICEWAND_COOLDOWN));
|
||||
@ -506,7 +548,7 @@ public class PlayerStructure {
|
||||
workable.set("COOLDOWN_usedearthwave", lastusedearthwave);
|
||||
workable.set("COOLDOWN_arrowbarrage", last_arrowbarrage);
|
||||
workable.set("COOLDOWN_laughtime", last_laugh_time);
|
||||
workable.set("COOLDOWN_rejuvenate", last_rejuvenate);
|
||||
workable.set("COOLDOWN_rejuvenate", last_mobcontrol);
|
||||
workable.set("COOLDOWN_swordhit", last_swordhit);
|
||||
workable.set("COOLDOWN_strikerspell", last_strikerspell);
|
||||
workable.set("COOLDOWN_absorptionhealthgiven", lastabsorptionhealthgiven);
|
||||
@ -532,6 +574,7 @@ public class PlayerStructure {
|
||||
workable.set("tooConsistentAdjustments", tooConsistentAdjustments);
|
||||
workable.set("freshBlood", freshBlood);
|
||||
workable.set("firstPVPMatch", firstPVPMatch);
|
||||
workable.set("mouseoverhealthbar", mouseoverhealthbar);
|
||||
int buffcounter=0;
|
||||
for (String key : buffs.keySet()) {
|
||||
Buff b = buffs.get(key);
|
||||
@ -618,7 +661,7 @@ public class PlayerStructure {
|
||||
workable.addDefault("COOLDOWN_usedearthwave", lastusedearthwave);
|
||||
workable.addDefault("COOLDOWN_arrowbarrage", last_arrowbarrage);
|
||||
workable.addDefault("COOLDOWN_laughtime", last_laugh_time);
|
||||
workable.addDefault("COOLDOWN_rejuvenate", last_rejuvenate);
|
||||
workable.addDefault("COOLDOWN_rejuvenate", last_mobcontrol);
|
||||
workable.addDefault("COOLDOWN_swordhit", last_swordhit);
|
||||
workable.addDefault("COOLDOWN_strikerspell", last_strikerspell);
|
||||
workable.addDefault("COOLDOWN_absorptionhealthgiven", lastabsorptionhealthgiven);
|
||||
@ -650,6 +693,7 @@ public class PlayerStructure {
|
||||
workable.addDefault("tooConsistentAdjustments",tooConsistentAdjustments);
|
||||
workable.addDefault("freshBlood",freshBlood);
|
||||
workable.addDefault("firstPVPMatch",firstPVPMatch);
|
||||
workable.addDefault("mouseoverhealthbar",mouseoverhealthbar);
|
||||
|
||||
workable.options().copyDefaults();
|
||||
|
||||
@ -692,7 +736,7 @@ public class PlayerStructure {
|
||||
this.lastusedearthwave = workable.getLong("COOLDOWN_usedearthwave");
|
||||
this.last_arrowbarrage = workable.getLong("COOLDOWN_arrowbarrage");
|
||||
this.last_laugh_time = workable.getLong("COOLDOWN_laughtime");
|
||||
this.last_rejuvenate = workable.getLong("COOLDOWN_rejuvenate");
|
||||
this.last_mobcontrol = workable.getLong("COOLDOWN_rejuvenate");
|
||||
this.last_swordhit = workable.getLong("COOLDOWN_swordhit");
|
||||
this.last_strikerspell = workable.getLong("COOLDOWN_strikerspell");
|
||||
this.lastabsorptionhealthgiven = workable.getLong("COOLDOWN_absorptionhealthgiven");
|
||||
@ -726,6 +770,7 @@ public class PlayerStructure {
|
||||
String tempworld = workable.getString("restartloc_world");
|
||||
this.freshBlood = workable.getBoolean("freshBlood");
|
||||
this.firstPVPMatch = workable.getBoolean("firstPVPMatch");
|
||||
this.mouseoverhealthbar = workable.getBoolean("mouseoverhealthbar");
|
||||
if (!workable.getString("instanceloc_world").equalsIgnoreCase("null")) {
|
||||
locBeforeInstance = new Location(
|
||||
Bukkit.getWorld(workable.getString("instanceloc_world")),
|
||||
@ -815,4 +860,8 @@ public class PlayerStructure {
|
||||
mult += Math.max(Math.min(Math.pow(pd.actionRecords/10, 1.05)-1,1000),0);
|
||||
return mult;
|
||||
}
|
||||
|
||||
public boolean isBlocking() {
|
||||
return blocking;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package sig.plugin.TwosideKeeper.PlayerStructures;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
||||
|
||||
public enum DefenderStance {
|
||||
AGGRESSION("Aggressive",false,false), //0
|
||||
BLOCK("Block",true,false), //2
|
||||
CHARGE("Charge",false,true), //1
|
||||
TANK("Tank",true,true); //3
|
||||
|
||||
String name;
|
||||
boolean block;
|
||||
boolean sneak;
|
||||
|
||||
DefenderStance(String realname, boolean requiresBlock, boolean requiresSneak) {
|
||||
this.name = realname;
|
||||
this.block = requiresBlock;
|
||||
this.sneak = requiresSneak;
|
||||
}
|
||||
|
||||
public static DefenderStance getDefenderStance(Player p) {
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
for (DefenderStance check : DefenderStance.values()) {
|
||||
if (p.isSneaking()==check.sneak && pd.isBlocking()==check.block) {
|
||||
return check;
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("WARNING! We could not find a stance for Player "+p.getName()+"! None of the states match!", 1);
|
||||
DebugUtils.showStackTrace();
|
||||
return null;
|
||||
} else {
|
||||
TwosideKeeper.log("WARNING! We could not find a stance for Player "+p.getName()+"! They are not a Defender! You should probably remove this call.", 1);
|
||||
DebugUtils.showStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ public class RecyclingCenter {
|
||||
List<RecyclingCenterNode> nodes;
|
||||
HashMap<Material,Integer> itemmap;
|
||||
int totalitems=0;
|
||||
final static int CONFIGFILE_VERSION = 2;
|
||||
|
||||
boolean choosing = false;
|
||||
|
||||
@ -36,8 +37,8 @@ public class RecyclingCenter {
|
||||
itemmap = new HashMap<Material,Integer>();
|
||||
}
|
||||
|
||||
public void AddNode(World world, int locx,int locy,int locz,boolean toolsAllowed,boolean itemsAllowed) {
|
||||
nodes.add(new RecyclingCenterNode(new Location(world,locx,locy,locz),toolsAllowed,itemsAllowed));
|
||||
public void AddNode(World world, int locx,int locy,int locz,String name,boolean toolsAllowed,boolean itemsAllowed) {
|
||||
nodes.add(new RecyclingCenterNode(new Location(world,locx,locy,locz),name,toolsAllowed,itemsAllowed));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,14 +75,20 @@ public class RecyclingCenter {
|
||||
if (config.exists()) {
|
||||
TwosideKeeper.log("Config exists. Entering.",5);
|
||||
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
|
||||
if (workable.getInt("version",0)>=2) {
|
||||
int nodecount = workable.getInt("nodeCount",0);
|
||||
for (int i=0;i<nodecount;i++) {
|
||||
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), workable.getString("name"+i), workable.getBoolean("toolsAllowed"+i,true), workable.getBoolean("itemsAllowed"+i,true));
|
||||
}
|
||||
} else
|
||||
if (workable.getInt("version",0)>=1) { //Default version is 0. So if we can't find the version key, then we know we have to set it up.
|
||||
int nodecount = workable.getInt("nodeCount",0);
|
||||
for (int i=0;i<nodecount;i++) {
|
||||
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), workable.getBoolean("toolsAllowed"+i,true), workable.getBoolean("itemsAllowed"+i,true));
|
||||
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), "Recycling Center", workable.getBoolean("toolsAllowed"+i,true), workable.getBoolean("itemsAllowed"+i,true));
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<workable.getKeys(false).size()/4;i++) {
|
||||
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i),true,true);
|
||||
this.AddNode(Bukkit.getWorld(workable.getString("world"+i)), workable.getInt("blockx"+i), workable.getInt("blocky"+i), workable.getInt("blockz"+i), "Recycling Center", true,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,7 +107,7 @@ public class RecyclingCenter {
|
||||
config = new File(TwosideKeeper.filesave,"recyclingcenters.data");
|
||||
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
workable.set("version", 1);
|
||||
workable.set("version", CONFIGFILE_VERSION);
|
||||
workable.set("nodeCount", nodes.size());
|
||||
|
||||
//workable.set("recycling_center.count", nodes.size());
|
||||
@ -110,6 +117,7 @@ public class RecyclingCenter {
|
||||
workable.set("blockx"+i, nodes.get(i).getRecyclingCenterLocation().getBlockX());
|
||||
workable.set("blocky"+i, nodes.get(i).getRecyclingCenterLocation().getBlockY());
|
||||
workable.set("blockz"+i, nodes.get(i).getRecyclingCenterLocation().getBlockZ());
|
||||
workable.set("name"+i, nodes.get(i).getRecyclingCenterName());
|
||||
workable.set("toolsAllowed"+i, nodes.get(i).areToolsAllowed());
|
||||
workable.set("itemsAllowed"+i, nodes.get(i).areItemsAllowed());
|
||||
}
|
||||
@ -174,7 +182,14 @@ public class RecyclingCenter {
|
||||
}
|
||||
|
||||
public static boolean isRecyclingCenter(Block b) {
|
||||
return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
|
||||
for (RecyclingCenterNode node : TwosideKeeper.TwosideRecyclingCenter.nodes) {
|
||||
Block b2 = node.getRecyclingCenterLocation().getBlock();
|
||||
if (b2.equals(b)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
//return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
|
||||
}
|
||||
|
||||
public void AddItemToRecyclingCenter(ItemStack i) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,6 +52,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.DamageStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Pet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
@ -64,10 +65,13 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
||||
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||
import sig.plugin.TwosideKeeper.Monster.Dummy;
|
||||
import sig.plugin.TwosideKeeper.PlayerStructures.DefenderStance;
|
||||
|
||||
final public class runServerHeartbeat implements Runnable {
|
||||
/**
|
||||
@ -106,7 +110,7 @@ final public class runServerHeartbeat implements Runnable {
|
||||
if (TwosideKeeper.SERVER_TYPE!=ServerType.QUIET) {
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
DecimalFormat df2 = new DecimalFormat("0");
|
||||
aPlugin.API.discordSendRaw("*The Deal of the Day has been updated!*\n **"+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)+"** ~~$"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM))+"~~ $"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)*(1-TwosideKeeper.DEAL_OF_THE_DAY_PCT))+" **"+df2.format(TwosideKeeper.DEAL_OF_THE_DAY_PCT*100)+"% Off!**");
|
||||
//aPlugin.API.discordSendRaw("*The Deal of the Day has been updated!*\n **"+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)+"** ~~$"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM))+"~~ $"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)*(1-TwosideKeeper.DEAL_OF_THE_DAY_PCT))+" **"+df2.format(TwosideKeeper.DEAL_OF_THE_DAY_PCT*100)+"% Off!**");
|
||||
//MessageUtils.announceMessage("The Deal of the Day has been updated!");
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
@ -117,7 +121,7 @@ final public class runServerHeartbeat implements Runnable {
|
||||
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY && TwosideKeeper.LAST_WEEKLY_RESET+6912000<=TwosideKeeper.getServerTickTime()) {
|
||||
TwosideKeeper.LAST_WEEKLY_RESET = TwosideKeeper.getServerTickTime();
|
||||
|
||||
aPlugin.API.discordSendRaw("__**Last Week's Challenge Standings**__ *(Use !daily to see Hall of Fame)*");
|
||||
//aPlugin.API.discordSendRaw("__**Last Week's Challenge Standings**__ *(Use !daily to see Hall of Fame)*");
|
||||
if (TwosideKeeper.dpschallenge_records.recordlist.size()>0) {
|
||||
TwosideKeeper.dpschallenge_records.announceRecords();
|
||||
}
|
||||
@ -128,7 +132,7 @@ final public class runServerHeartbeat implements Runnable {
|
||||
TwosideKeeper.parkourchallenge_records.announceRecords();
|
||||
}
|
||||
|
||||
aPlugin.API.discordSendRawItalicized("All Weekly Challenge Leaderboards have been reset!");
|
||||
//aPlugin.API.discordSendRawItalicized("All Weekly Challenge Leaderboards have been reset!");
|
||||
TwosideKeeper.dpschallenge_records.resetRecords();
|
||||
TwosideKeeper.tankchallenge_records.resetRecords();
|
||||
TwosideKeeper.parkourchallenge_records.resetRecords();
|
||||
@ -313,6 +317,10 @@ final public class runServerHeartbeat implements Runnable {
|
||||
|
||||
PerformStealthSetRegen(p,pd);
|
||||
|
||||
performRejuvenationHealing(p,pd);
|
||||
|
||||
RemoveTargetIfInvalid(p,pd);
|
||||
|
||||
updateCustomTitle(p, pd);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Update Custom Title", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
@ -338,8 +346,6 @@ final public class runServerHeartbeat implements Runnable {
|
||||
AdventurerModeSetExhaustion(p);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Adventurer Mode Exhaustion", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
CalculateHealthRegeneration(serverTickTime, p, pd, equips);
|
||||
|
||||
ResetSwordCombo(serverTickTime, p, pd);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Reset Sword Combo", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
@ -366,6 +372,11 @@ final public class runServerHeartbeat implements Runnable {
|
||||
|
||||
checkForHealthUpdate(p);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Check for Health Update.", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
UpdatePlayerBlockStatus(p);
|
||||
increaseAbsorptionHealth(p);
|
||||
increaseAggroTowardsTarget(p);
|
||||
//TwosideKeeper.log("Defender Stance: "+DefenderStance.getDefenderStance(p), 0);
|
||||
}
|
||||
//TwosideKeeper.outputArmorDurability(p,">");
|
||||
}
|
||||
@ -409,6 +420,66 @@ final public class runServerHeartbeat implements Runnable {
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime();
|
||||
}
|
||||
|
||||
private void RemoveTargetIfInvalid(Player p, PlayerStructure pd) {
|
||||
if (pd.lastTarget!=null && !pd.lastTarget.isValid()) {
|
||||
pd.lastTarget=null;
|
||||
} else
|
||||
if (pd.lastTarget!=null && pd.lastTarget.isValid() &&
|
||||
p.getLocation().distanceSquared(pd.lastTarget.getLocation())>Pet.LEASHRANGE_SQUARED) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(pd.lastTarget);
|
||||
les.setGlow(p, null);
|
||||
pd.lastTarget=null;
|
||||
}
|
||||
}
|
||||
|
||||
private void performRejuvenationHealing(Player p, PlayerStructure pd) {
|
||||
if (pd.lastusedRejuvenation+200>TwosideKeeper.getServerTickTime()) {
|
||||
//Regenerate health.
|
||||
GenericFunctions.HealEntity(p, p.getMaxHealth()*0.05);
|
||||
}
|
||||
}
|
||||
|
||||
private void increaseAggroTowardsTarget(Player p) {
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
if (DefenderStance.getDefenderStance(p)==DefenderStance.BLOCK) {
|
||||
LivingEntity target = aPlugin.API.rayTraceTargetEntity(p, 20);
|
||||
if (target!=null && !(target instanceof Player)) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
les.increaseAggro(p, 100);
|
||||
les.lastHit = TwosideKeeper.getServerTickTime();
|
||||
//TwosideKeeper.log(les.displayAggroTable(), 0);
|
||||
Vector dir = MovementUtils.pointTowardsLocation(target.getLocation(), p.getLocation());
|
||||
for (int i=0;i<p.getLocation().distance(target.getLocation())*4;i++) {
|
||||
Vector newdir = dir.clone();
|
||||
newdir.multiply(i*0.25);
|
||||
newdir.setY(newdir.getY()+2);
|
||||
ColoredParticle.RED_DUST.send(target.getLocation().add(newdir), 50, 255, 255, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void increaseAbsorptionHealth(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
|
||||
if (DefenderStance.getDefenderStance(p)==DefenderStance.BLOCK &&
|
||||
pd.isBlocking()) {
|
||||
CustomDamage.setAbsorptionHearts(p, CustomDamage.getAbsorptionHearts(p)+2);
|
||||
}
|
||||
}
|
||||
if (CustomDamage.getAbsorptionHearts(p)>p.getMaxHealth()) {
|
||||
CustomDamage.setAbsorptionHearts(p, (float)p.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePlayerBlockStatus(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (!p.isBlocking() && pd.blocking) {
|
||||
pd.blocking=p.isBlocking();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckPlayerLocationAndActionQueue(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.leashedLoc==null) {
|
||||
@ -769,14 +840,22 @@ final public class runServerHeartbeat implements Runnable {
|
||||
}
|
||||
|
||||
public static void resetDamageQueue() {
|
||||
for (int i=0;i<8;i++) {
|
||||
for (int i=0;i<TwosideKeeper.DAMAGE_QUEUE_MAX_BUFFER;i++) {
|
||||
if (TwosideKeeper.damagequeuelist.size()>0) {
|
||||
TwosideKeeper.damagequeuelist.remove(0).run();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<TwosideKeeper.ITEM_QUEUE_MAX_BUFFER;i++) {
|
||||
if (TwosideKeeper.pickupitemqueuelist.size()>0) {
|
||||
TwosideKeeper.pickupitemqueuelist.remove(0).run();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
TwosideKeeper.damagequeue=TwosideKeeper.damagequeuelist.size();
|
||||
TwosideKeeper.pickupitemqueue=TwosideKeeper.pickupitemqueuelist.size();
|
||||
}
|
||||
|
||||
private void adjustMiningFatigue(Player p) {
|
||||
@ -925,6 +1004,11 @@ final public class runServerHeartbeat implements Runnable {
|
||||
spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d;
|
||||
}
|
||||
spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.STEALTH)/100d;
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER &&
|
||||
p.getEquipment().getItemInOffHand()!=null &&
|
||||
p.getEquipment().getItemInOffHand().getType()==Material.SHIELD) {
|
||||
spdmult -= 0.5;
|
||||
}
|
||||
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
|
||||
}
|
||||
|
||||
@ -961,6 +1045,9 @@ final public class runServerHeartbeat implements Runnable {
|
||||
pd.lastattacked=0;
|
||||
pd.lifestealstacks=0;
|
||||
}
|
||||
if (pd.lastcombat+(20*60)<serverTickTime) {
|
||||
pd.blockStacks=0;
|
||||
}
|
||||
}
|
||||
|
||||
private void ManageSnowmanHunt() {
|
||||
@ -1046,6 +1133,32 @@ final public class runServerHeartbeat implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p.getHealth()>p.getMaxHealth()/2 && ItemSet.hasFullSet(p, ItemSet.SUSTENANCE)) {
|
||||
double healAmt = p.getHealth()*0.05;
|
||||
Player lowestHPPlayer = null;
|
||||
List<Player> partymembers = PartyManager.getPartyMembers(p);
|
||||
for (Player pl : partymembers) {
|
||||
if (!pl.equals(p)) {
|
||||
if (pl.getHealth()<pl.getMaxHealth()/2) {
|
||||
if (lowestHPPlayer==null || (lowestHPPlayer.getHealth()/lowestHPPlayer.getMaxHealth())>(pl.getHealth()/pl.getMaxHealth())) {
|
||||
lowestHPPlayer = pl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lowestHPPlayer!=null) {
|
||||
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_NOTE_HAT, 1.0f, 0.8f);
|
||||
p.setHealth(Math.max(0, p.getHealth()-healAmt));
|
||||
lowestHPPlayer.setHealth(Math.min(lowestHPPlayer.getMaxHealth(), lowestHPPlayer.getHealth()+healAmt));
|
||||
Vector dir = MovementUtils.pointTowardsLocation(lowestHPPlayer.getLocation(), p.getLocation());
|
||||
for (int i=0;i<p.getLocation().distance(lowestHPPlayer.getLocation())*4;i++) {
|
||||
Vector newdir = dir.clone();
|
||||
newdir.multiply(i*0.25);
|
||||
newdir.setY(newdir.getY()+1);
|
||||
ColoredParticle.RED_DUST.send(lowestHPPlayer.getLocation().add(newdir), 50, 0, 255, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyCometRegenBonus(Player p) {
|
||||
@ -1078,13 +1191,6 @@ final public class runServerHeartbeat implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateHealthRegeneration(final long serverTickTime, Player p, PlayerStructure pd,
|
||||
ItemStack[] equips) {
|
||||
if (PlayerMode.isDefender(p)) {
|
||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.REGENERATION,60,(p.isBlocking())?3:1,p,false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void performTimingsReport() {
|
||||
performTimingsReport(false);
|
||||
}
|
||||
@ -1170,7 +1276,7 @@ final public class runServerHeartbeat implements Runnable {
|
||||
ignoredItems.add(it.getUniqueId());
|
||||
}
|
||||
count++;
|
||||
if (count>=8) {
|
||||
if (count>=TwosideKeeper.ITEM_QUEUE_MAX_BUFFER) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,16 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.inventivetalent.glow.GlowAPI;
|
||||
import org.inventivetalent.glow.GlowAPI.Color;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomModel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DamageLabel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
||||
|
||||
@ -20,6 +28,51 @@ public class runServerTick implements Runnable{
|
||||
bmq.run();
|
||||
}
|
||||
}
|
||||
for (int i=0;i<TwosideKeeper.labelqueue.size();i++) {
|
||||
if (!TwosideKeeper.labelqueue.get(i).run()) {
|
||||
TwosideKeeper.labelqueue.remove(i--);
|
||||
}
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (!aPluginAPIWrapper.isAFK(p)) {
|
||||
//pd.myModel.displayModel(p.getLocation());
|
||||
if (pd.myPet!=null) {
|
||||
pd.myPet.run();
|
||||
}
|
||||
if (PlayerMode.isSummoner(p)) {
|
||||
//long timer = System.nanoTime();
|
||||
LivingEntity targetent = aPlugin.API.rayTraceTargetEntity(p, 16);
|
||||
if (targetent!=null) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(targetent);
|
||||
if (LivingEntityStructure.isFriendly(p,targetent)) {
|
||||
les.setGlow(p, Color.DARK_AQUA);
|
||||
} else {
|
||||
les.setGlow(p, Color.DARK_GRAY);
|
||||
}
|
||||
if (pd.lastTarget!=null && pd.lastTarget!=targetent) {
|
||||
LivingEntityStructure les2 = LivingEntityStructure.GetLivingEntityStructure(pd.lastTarget);
|
||||
les2.setGlow(p, null);
|
||||
pd.lastTarget.setGlowing(false);
|
||||
GlowAPI.setGlowing(pd.lastTarget, null, p);
|
||||
pd.lastTarget=null;
|
||||
}
|
||||
pd.lastTarget=targetent;
|
||||
}
|
||||
//TwosideKeeper.log("Time Execution took: "+((System.nanoTime()-timer)/1000000)+"ms", 1);
|
||||
}
|
||||
if (pd.mouseoverhealthbar && pd.lastGrabbedTarget+10<=TwosideKeeper.getServerTickTime()) {
|
||||
LivingEntity targetent = aPlugin.API.rayTraceTargetEntity(p, 16);
|
||||
if (targetent!=null && (!(targetent instanceof ArmorStand) || (targetent instanceof ArmorStand && ((ArmorStand)targetent).isVisible())) &&
|
||||
!targetent.hasPotionEffect(PotionEffectType.INVISIBILITY) && (pd.lastViewedTarget==null || !pd.lastViewedTarget.equals(targetent.getUniqueId()))
|
||||
&& targetent.hasLineOfSight(p)) {
|
||||
pd.customtitle.updateCombatBar(p, targetent);
|
||||
pd.lastGrabbedTarget=TwosideKeeper.getServerTickTime();
|
||||
pd.lastViewedTarget = targetent.getUniqueId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
runServerHeartbeat.resetDamageQueue();
|
||||
/*if (Bukkit.getPlayer("sigonasr2")!=null) {
|
||||
Player p = Bukkit.getPlayer("sigonasr2");
|
||||
|
Loading…
x
Reference in New Issue
Block a user