+> Fixed Ranger Mode issues and controls with Rangers not being able to

use their bow when cooldown meters were displayed.
+> Elite Monsters now gain 25% more health and 5% more base damage for
every player that joins after the 4th when fighting Elite Monsters.
>Party buff maximum cap reduced from 90% Bonus Damage/Defense to 60%
Bonus Damage/Defense Max.
>Fixed a bug causing Poison to kill players. This is unintended.
>Fixed a bug causing players in Slayer mode to not be revived properly.
>Fixed a bug causing players to be teleported above their revival
location on automatic buy-back thanks to the Sweet Candies.
testdev
sigonasr2 8 years ago
parent 464531b06e
commit 9b22eb4bb3
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 12
      src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
  4. 63
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  5. 18
      src/sig/plugin/TwosideKeeper/EliteMonster.java
  6. 43
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  7. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java
  8. 2
      src/sig/plugin/TwosideKeeper/PartyManager.java
  9. 2
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  10. 33
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.10.1 version: 3.10.2
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

@ -341,6 +341,11 @@ public class EliteZombie extends EliteMonster{
bar.setColor(BarColor.RED); bar.setColor(BarColor.RED);
if (!targetlist.contains(damager) && (damager instanceof Player)) { if (!targetlist.contains(damager) && (damager instanceof Player)) {
targetlist.add((Player)damager); targetlist.add((Player)damager);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
if (!participantlist.contains(damager) && (damager instanceof Player)) { if (!participantlist.contains(damager) && (damager instanceof Player)) {
participantlist.add((Player)damager); participantlist.add((Player)damager);
@ -526,9 +531,9 @@ public class EliteZombie extends EliteMonster{
} else { } else {
b.setType(storedblocks.get(b)); b.setType(storedblocks.get(b));
} }
aPlugin.API.sendSoundlessExplosion(target_leap_loc, 4);
SoundUtils.playGlobalSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f); SoundUtils.playGlobalSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
} }
aPlugin.API.sendSoundlessExplosion(target_leap_loc, 4);
storedblocks.clear(); storedblocks.clear();
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f); SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
List<Player> nearbyplayers = GenericFunctions.getNearbyPlayers(target_leap_loc, radius); List<Player> nearbyplayers = GenericFunctions.getNearbyPlayers(target_leap_loc, radius);
@ -549,6 +554,11 @@ public class EliteZombie extends EliteMonster{
public void hitEvent(LivingEntity ent) { public void hitEvent(LivingEntity ent) {
if (!targetlist.contains(ent) && (ent instanceof Player)) { if (!targetlist.contains(ent) && (ent instanceof Player)) {
targetlist.add((Player)ent); targetlist.add((Player)ent);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
if (Math.random()<=0.33) { if (Math.random()<=0.33) {
if (ent.hasPotionEffect(PotionEffectType.POISON)) { if (ent.hasPotionEffect(PotionEffectType.POISON)) {

@ -380,7 +380,11 @@ public class CustomDamage {
if (getDamagerEntity(damager) instanceof Player) { if (getDamagerEntity(damager) instanceof Player) {
Player p = (Player)getDamagerEntity(damager); Player p = (Player)getDamagerEntity(damager);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return pd.partybonus*0.1; if (pd.partybonus>6) {
return 6*0.1d;
} else {
return pd.partybonus*0.1;
}
} }
return 0.0; return 0.0;
} }
@ -513,13 +517,17 @@ public class CustomDamage {
removePermEnchantments(p,item); removePermEnchantments(p,item);
} }
damage = IncreaseDamageDealtByElites(p, damager, damage);
damage = calculateDefenderAbsorption(p, damager, damage, reason); damage = calculateDefenderAbsorption(p, damager, damage, reason);
damage = sendDamageToDamagePool(p, damage, reason); damage = sendDamageToDamagePool(p, damage, reason);
damage = modifyFateBasedOnHolidayTreats(p, damage); damage = modifyFateBasedOnHolidayTreats(p, damage);
if (GenericFunctions.AttemptRevive(p, damage, reason)) { damage = preventPoisonDamageFromKilling(p, damage, reason);
if (damage>0 && GenericFunctions.AttemptRevive(p, damage, reason)) {
damage=0; damage=0;
} }
} }
@ -688,6 +696,33 @@ public class CustomDamage {
return damage; return damage;
} }
private static double IncreaseDamageDealtByElites(Player p, Entity damager, double damage) {
LivingEntity shooter = getDamagerEntity(damager);
if (shooter!=null) {
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(shooter);
if (les.isElite) {
for (EliteMonster bm : TwosideKeeper.elitemonsters) {
if (bm.getMonster().getUniqueId().equals(shooter.getUniqueId())) {
if (bm.getTargetList().size()>4) {
damage += damage*((bm.getTargetList().size()-4)*0.05);
}
}
}
}
}
return damage;
}
private static double preventPoisonDamageFromKilling(Player p, double damage, String reason) {
if (reason!=null && reason.equalsIgnoreCase("POISON") && p.getHealth()<=damage) {
p.setHealth(1);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.slayermodehp=1;
return 0;
}
return damage;
}
private static double modifyFateBasedOnHolidayTreats(Player p, double damage) { private static double modifyFateBasedOnHolidayTreats(Player p, double damage) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) { if (pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) {
@ -702,8 +737,11 @@ public class CustomDamage {
RemoveOneItem(p.getInventory(),item,i); RemoveOneItem(p.getInventory(),item,i);
Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!"); Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!"); aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f); SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
p.setHealth(p.getMaxHealth()); p.setHealth(p.getMaxHealth());
GenericFunctions.RevivePlayer(p,p.getMaxHealth());
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p);
GenericFunctions.RandomlyBreakBaubles(p, hotbar);
consumed=true; consumed=true;
return 0; return 0;
} }
@ -1477,9 +1515,6 @@ public class CustomDamage {
GenericFunctions.updateNoDamageTickMap(target, damager); GenericFunctions.updateNoDamageTickMap(target, damager);
return true; return true;
} }
if (LowEnoughToResistPoison(target,reason)) {
return true;
}
if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) { if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) {
@ -1524,7 +1559,7 @@ public class CustomDamage {
return attackrate; return attackrate;
} }
private static boolean LowEnoughToResistPoison(LivingEntity target, String reason) { private static boolean LowEnoughToResistPoison(LivingEntity target, double damage, String reason) {
TwosideKeeper.log("Target health: "+target.getHealth(), 5); TwosideKeeper.log("Target health: "+target.getHealth(), 5);
if (reason!=null && reason.equalsIgnoreCase("POISON") && target.getHealth()<=2) { if (reason!=null && reason.equalsIgnoreCase("POISON") && target.getHealth()<=2) {
return true; return true;
@ -1860,7 +1895,7 @@ public class CustomDamage {
Player p = (Player)target; Player p = (Player)target;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
partylevel = pd.partybonus; partylevel = pd.partybonus;
if (partylevel>9) {partylevel=9;} if (partylevel>6) {partylevel=6;}
if (p.getLocation().getY()>=0) {TwosideKeeper.log("Light level: "+p.getLocation().add(0,0,0).getBlock().getLightLevel(),5);} if (p.getLocation().getY()>=0) {TwosideKeeper.log("Light level: "+p.getLocation().add(0,0,0).getBlock().getLightLevel(),5);}
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) &&
@ -2265,7 +2300,7 @@ public class CustomDamage {
TwosideKeeper.log("We somehow made it to here???", 5); TwosideKeeper.log("We somehow made it to here???", 5);
Player p = (Player)proj.getShooter(); Player p = (Player)proj.getShooter();
if (PlayerMode.isRanger(p) && if (PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) { GenericFunctions.getBowMode(p)==BowMode.SNIPE) {
aPlugin.API.sendSoundlessExplosion(arrowLoc, 1); aPlugin.API.sendSoundlessExplosion(arrowLoc, 1);
headshotvaly *= 4; headshotvaly *= 4;
} }
@ -2280,7 +2315,7 @@ public class CustomDamage {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p)==BowMode.SNIPE) {
if (pd.headshotcombo<8) {pd.headshotcombo++;} if (pd.headshotcombo<8) {pd.headshotcombo++;}
double headshotincrease = (2+(pd.headshotcombo*0.25)); double headshotincrease = (2+(pd.headshotcombo*0.25));
mult+=headshotincrease; mult+=headshotincrease;
@ -2321,7 +2356,7 @@ public class CustomDamage {
} }
} }
if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) { if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p)==BowMode.DEBILITATION) {
if (m.hasPotionEffect(PotionEffectType.BLINDNESS) && isheadshot) { if (m.hasPotionEffect(PotionEffectType.BLINDNESS) && isheadshot) {
//Add to the current stack of BLINDNESS. //Add to the current stack of BLINDNESS.
for (PotionEffect pe : m.getActivePotionEffects()) { for (PotionEffect pe : m.getActivePotionEffects()) {
@ -2458,7 +2493,7 @@ public class CustomDamage {
Player p = (Player)getDamagerEntity(damager); Player p = (Player)getDamagerEntity(damager);
if (GenericFunctions.HasFullRangerSet(p) && if (GenericFunctions.HasFullRangerSet(p) &&
PlayerMode.isRanger(p) && PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) { GenericFunctions.getBowMode(p)==BowMode.SNIPE) {
critdmg+=1.0; critdmg+=1.0;
} }
critdmg+=API.getPlayerBonuses(p).getBonusCriticalDamage(); critdmg+=API.getPlayerBonuses(p).getBonusCriticalDamage();
@ -2575,7 +2610,7 @@ public class CustomDamage {
} }
if (GenericFunctions.HasFullRangerSet(p) && if (GenericFunctions.HasFullRangerSet(p) &&
PlayerMode.isRanger(p) && PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.DEBILITATION) { GenericFunctions.getBowMode(p)==BowMode.DEBILITATION) {
finaldmg += dmg*0.5; finaldmg += dmg*0.5;
} }
finaldmg += API.getPlayerBonuses(p).getBonusArmorPenetration(); finaldmg += API.getPlayerBonuses(p).getBonusArmorPenetration();

@ -50,6 +50,7 @@ public class EliteMonster {
protected boolean chasing=false; protected boolean chasing=false;
protected boolean enraged=false; protected boolean enraged=false;
protected boolean storingenergy=false; protected boolean storingenergy=false;
public double baseHP = 0.0;
protected List<Player> targetlist = new ArrayList<Player>(); protected List<Player> targetlist = new ArrayList<Player>();
protected List<Player> participantlist = new ArrayList<Player>(); protected List<Player> participantlist = new ArrayList<Player>();
@ -63,6 +64,7 @@ public class EliteMonster {
this.myspawn=m.getLocation(); this.myspawn=m.getLocation();
bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG); bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
willpower_bar = m.getServer().createBossBar("Willpower", BarColor.PINK, BarStyle.SOLID, BarFlag.CREATE_FOG); willpower_bar = m.getServer().createBossBar("Willpower", BarColor.PINK, BarStyle.SOLID, BarFlag.CREATE_FOG);
this.baseHP = m.getMaxHealth();
} }
public void runTick() { public void runTick() {
@ -214,6 +216,12 @@ public class EliteMonster {
bar.setColor(BarColor.GREEN); bar.setColor(BarColor.GREEN);
m.setHealth(Math.min(m.getHealth()+1,m.getMaxHealth())); m.setHealth(Math.min(m.getHealth()+1,m.getMaxHealth()));
} }
if (m.getMaxHealth()>(baseHP+(baseHP*(0.25*((targetlist.size()>4)?(targetlist.size()-4):0))))) {
m.setMaxHealth((baseHP+(baseHP*(0.25*((targetlist.size()>4)?(targetlist.size()-4):0)))));
if (m.getHealth()>m.getMaxHealth()) {
m.setHealth(m.getMaxHealth());
}
}
} }
public void runPlayerLeaveEvent(Player p) { public void runPlayerLeaveEvent(Player p) {
@ -227,6 +235,11 @@ public class EliteMonster {
bar.setColor(BarColor.RED); bar.setColor(BarColor.RED);
if (!targetlist.contains(damager) && (damager instanceof Player)) { if (!targetlist.contains(damager) && (damager instanceof Player)) {
targetlist.add((Player)damager); targetlist.add((Player)damager);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
if (!participantlist.contains(damager) && (damager instanceof Player)) { if (!participantlist.contains(damager) && (damager instanceof Player)) {
participantlist.add((Player)damager); participantlist.add((Player)damager);
@ -263,6 +276,11 @@ public class EliteMonster {
public void hitEvent(LivingEntity ent) { public void hitEvent(LivingEntity ent) {
if (!targetlist.contains(ent) && (ent instanceof Player)) { if (!targetlist.contains(ent) && (ent instanceof Player)) {
targetlist.add((Player)ent); targetlist.add((Player)ent);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
} }

@ -2571,8 +2571,9 @@ public class GenericFunctions {
return pd.hasfullrangerset;*/ return pd.hasfullrangerset;*/
} }
public static ItemStack applyModeName(ItemStack item) { @Deprecated
if (item!=null && public static void applyModeName(ItemStack item) {
/*if (item!=null &&
item.getType()!=Material.AIR && item.getType()!=Material.AIR &&
item.hasItemMeta()) { item.hasItemMeta()) {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
@ -2599,12 +2600,12 @@ public class GenericFunctions {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
String newname = UserFriendlyMaterialName(item)+" "+ChatColor.GREEN+"("+CapitalizeFirstLetters(getBowMode(item).GetCoolName())+" Mode)"+ChatColor.WHITE; String newname = UserFriendlyMaterialName(item)+" "+ChatColor.GREEN+"("+CapitalizeFirstLetters(getBowMode(item).GetCoolName())+" Mode)"+ChatColor.WHITE;
m.setDisplayName(newname); m.setDisplayName(newname);
item.setItemMeta(m); item.setItemMeta(m);*/
return item; //return item;
} }
public static BowMode getBowMode(ItemStack item) { public static BowMode getBowMode(Player p) {
if (item!=null && /*if (item!=null &&
item.getType()!=Material.AIR && item.getType()!=Material.AIR &&
item.hasItemMeta()) { item.hasItemMeta()) {
if (!item.getItemMeta().hasLore()) { if (!item.getItemMeta().hasLore()) {
@ -2621,11 +2622,13 @@ public class GenericFunctions {
} }
} else { } else {
return BowMode.CLOSE; return BowMode.CLOSE;
} }*/
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return pd.rangermode;
} }
public static ItemStack setBowMode(ItemStack item, BowMode mode) { public static void setBowMode(Player p, BowMode mode) {
if (item!=null && /*if (item!=null &&
item.getType()!=Material.AIR && item.getType()!=Material.AIR &&
item.hasItemMeta()) { item.hasItemMeta()) {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
@ -2650,6 +2653,10 @@ public class GenericFunctions {
} }
} }
return item; return item;
*/
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.rangermode = mode;
GenericFunctions.sendActionBarMessage(p, ChatColor.BLUE+"Bow Mode: "+ChatColor.GOLD+mode.GetCoolName()+" Mode"+ChatColor.RESET, true);
} }
public static void AutoRepairItems(Player p) { public static void AutoRepairItems(Player p) {
@ -2783,7 +2790,7 @@ public class GenericFunctions {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void PerformDodge(Player p) { public static void PerformDodge(Player p) {
if (p.isOnGround() && PlayerMode.isRanger(p) && if (p.isOnGround() && PlayerMode.isRanger(p) &&
(GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE)) { (GenericFunctions.getBowMode(p)==BowMode.CLOSE)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.last_dodge+GetModifiedCooldown(TwosideKeeper.DODGE_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) { if (pd.last_dodge+GetModifiedCooldown(TwosideKeeper.DODGE_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) {
PlayerTumbleEvent ev = new PlayerTumbleEvent(p); PlayerTumbleEvent ev = new PlayerTumbleEvent(p);
@ -3447,6 +3454,7 @@ public class GenericFunctions {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.lastdamagetaken=dmg; pd.lastdamagetaken=dmg;
pd.lasthitdesc=reason; pd.lasthitdesc=reason;
pd.slayermodehp = p.getMaxHealth();
ItemStack[] equips = p.getEquipment().getArmorContents(); ItemStack[] equips = p.getEquipment().getArmorContents();
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p); ItemStack[] hotbar = GenericFunctions.getHotbarItems(p);
@ -3455,7 +3463,6 @@ public class GenericFunctions {
pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) { pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) {
pd.lastlifesavertime=TwosideKeeper.getServerTickTime(); pd.lastlifesavertime=TwosideKeeper.getServerTickTime();
RevivePlayer(p,p.getMaxHealth()); RevivePlayer(p,p.getMaxHealth());
pd.slayermodehp = p.getMaxHealth();
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {GenericFunctions.applyStealth(p,false);} if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {GenericFunctions.applyStealth(p,false);}
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 20*10, 3, p, true); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 20*10, 3, p, true);
deAggroNearbyTargets(p); deAggroNearbyTargets(p);
@ -3489,7 +3496,7 @@ public class GenericFunctions {
return revived; return revived;
} }
private static void RandomlyBreakBaubles(Player p, ItemStack[] hotbar) { public static void RandomlyBreakBaubles(Player p, ItemStack[] hotbar) {
for (int i=0;i<9;i++) { for (int i=0;i<9;i++) {
ItemSet set = ItemSet.GetSet(hotbar[i]); ItemSet set = ItemSet.GetSet(hotbar[i]);
if (set!=null) { if (set!=null) {
@ -3529,8 +3536,8 @@ public class GenericFunctions {
} }
} }
private static void RevivePlayer(Player p, double healdmg) { public static void RevivePlayer(Player p, double healdmg) {
p.setHealth(healdmg); p.setHealth(Math.min(healdmg,p.getMaxHealth()));
SoundUtils.playLocalSound(p, Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.5f); SoundUtils.playLocalSound(p, Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.5f);
for (PotionEffect eff : p.getActivePotionEffects()) { for (PotionEffect eff : p.getActivePotionEffects()) {
if (isBadEffect(eff.getType())) { if (isBadEffect(eff.getType())) {
@ -3540,6 +3547,8 @@ public class GenericFunctions {
}, 1); }, 1);
} }
} }
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.slayermodehp = Math.min(healdmg,p.getMaxHealth());
p.setFireTicks(0); p.setFireTicks(0);
CustomDamage.addIframe(40, p); CustomDamage.addIframe(40, p);
//p.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,20,0)); //p.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,20,0));
@ -4473,7 +4482,7 @@ public class GenericFunctions {
finalmsg=message+" "+prefix; finalmsg=message+" "+prefix;
if (important || (pd.lastimportantactionbarmsg+20<TwosideKeeper.getServerTickTime())) { if (important || (pd.lastimportantactionbarmsg+20<TwosideKeeper.getServerTickTime())) {
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Sent Message", 0); //TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Sent Message", 0);
if (prefix.length()>0) { if (prefix.length()>0 || aPlugin.API.getLastXPBar(p).length() > 2) {
aPlugin.API.sendActionBarMessage(p, String.format(aPlugin.API.getLastXPBar(p), finalmsg)); aPlugin.API.sendActionBarMessage(p, String.format(aPlugin.API.getLastXPBar(p), finalmsg));
} else { } else {
if (message.length()>0) { if (message.length()>0) {
@ -4666,7 +4675,7 @@ public class GenericFunctions {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void PerformArrowBarrage(Player p) { public static void PerformArrowBarrage(Player p) {
if (p.isOnGround() && PlayerMode.isRanger(p) && if (p.isOnGround() && PlayerMode.isRanger(p) &&
(GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE)) { (GenericFunctions.getBowMode(p)==BowMode.SNIPE)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.last_arrowbarrage+GetModifiedCooldown(TwosideKeeper.ARROWBARRAGE_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) { if (pd.last_arrowbarrage+GetModifiedCooldown(TwosideKeeper.ARROWBARRAGE_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) {
pd.last_arrowbarrage=TwosideKeeper.getServerTickTime(); pd.last_arrowbarrage=TwosideKeeper.getServerTickTime();
@ -4679,7 +4688,7 @@ public class GenericFunctions {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void PerformSiphon(Player p) { public static void PerformSiphon(Player p) {
if (p.isOnGround() && PlayerMode.isRanger(p) && if (p.isOnGround() && PlayerMode.isRanger(p) &&
(GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION)) { (GenericFunctions.getBowMode(p)==BowMode.DEBILITATION)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.last_siphon+GetModifiedCooldown(TwosideKeeper.SIPHON_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) { if (pd.last_siphon+GetModifiedCooldown(TwosideKeeper.SIPHON_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) {
List<LivingEntity> list = GenericFunctions.getNearbyMobs(p.getLocation(), 16); List<LivingEntity> list = GenericFunctions.getNearbyMobs(p.getLocation(), 16);

@ -29,7 +29,7 @@ public class EntityUtils {
for (Entity e : ents) { for (Entity e : ents) {
if (e instanceof LivingEntity) { if (e instanceof LivingEntity) {
LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty((LivingEntity)e); LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty((LivingEntity)e);
if (e.getType()==type && !strongest.isStronger(diff)) { if (e!=null && e.getType()==type && (strongest==null || !strongest.isStronger(diff))) {
strongest = diff; strongest = diff;
} }
} }

@ -90,7 +90,7 @@ public class PartyManager {
int membercount = partymembers.size(); int membercount = partymembers.size();
StringBuilder partydisplay = new StringBuilder(""); StringBuilder partydisplay = new StringBuilder("");
if (membercount>=2) { if (membercount>=2) {
int dmgbonus=((membercount-1)<10)?(membercount-1)*10:90; int dmgbonus=((membercount-1)<6)?(membercount-1)*10:60;
partydisplay.append(" +"+dmgbonus+"%DMG/DEF"); partydisplay.append(" +"+dmgbonus+"%DMG/DEF");
} }
return partydisplay.toString(); return partydisplay.toString();

@ -21,6 +21,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
@ -156,6 +157,7 @@ public class PlayerStructure {
public long lastsneak=0; public long lastsneak=0;
public long lastcombat=0; public long lastcombat=0;
public long lastsantabox=0; public long lastsantabox=0;
public BowMode rangermode=BowMode.CLOSE;
public boolean isPlayingSpleef=false; public boolean isPlayingSpleef=false;

@ -1073,6 +1073,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case "WITHER":{ case "WITHER":{
LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.WITHER), MonsterDifficulty.ELITE); LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.WITHER), MonsterDifficulty.ELITE);
}break; }break;
case "ELITE":{
LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
}break;
case "VACUUM":{ case "VACUUM":{
ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, new ItemStack(Material.ENDER_PEARL,16), new ItemStack(Material.IRON_PICKAXE,1), new ItemStack(Material.GOLDEN_APPLE,64)); ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, new ItemStack(Material.ENDER_PEARL,16), new ItemStack(Material.IRON_PICKAXE,1), new ItemStack(Material.GOLDEN_APPLE,64));
for (ItemStack items : remaining) { for (ItemStack items : remaining) {
@ -2636,7 +2639,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (PlayerMode.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { if (PlayerMode.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
//Rotate Bow Modes. //Rotate Bow Modes.
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.SLOW,p); GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.SLOW,p);
BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand()); BowMode mode = GenericFunctions.getBowMode(p);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ev.getAction().name().contains("RIGHT")) { if (ev.getAction().name().contains("RIGHT")) {
if (pd.lastbowmodeswitch+6>=getServerTickTime()) { if (pd.lastbowmodeswitch+6>=getServerTickTime()) {
@ -2645,17 +2648,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
switch (mode) { switch (mode) {
case CLOSE:{ case CLOSE:{
SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f); SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE); GenericFunctions.setBowMode(p,BowMode.SNIPE);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN));
}break; }break;
case SNIPE:{ case SNIPE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.DEBILITATION); GenericFunctions.setBowMode(p,BowMode.DEBILITATION);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN));
}break; }break;
case DEBILITATION:{ case DEBILITATION:{
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f); SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.CLOSE); GenericFunctions.setBowMode(p,BowMode.CLOSE);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN));
}break; }break;
} }
@ -2667,24 +2670,28 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
switch (mode) { switch (mode) {
case CLOSE:{ case CLOSE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.DEBILITATION); GenericFunctions.setBowMode(p,BowMode.DEBILITATION);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN));
}break; }break;
case SNIPE:{ case SNIPE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f); SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.CLOSE); GenericFunctions.setBowMode(p,BowMode.CLOSE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN));
}break; }break;
case DEBILITATION:{ case DEBILITATION:{
SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f); SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE); GenericFunctions.setBowMode(p,BowMode.SNIPE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN));
}break; }break;
} }
pd.lastbowmodeswitch=getServerTickTime(); pd.lastbowmodeswitch=getServerTickTime();
} }
GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
ev.setCancelled(true); ev.setCancelled(true);
return; return;
} }
@ -5658,7 +5665,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (PlayerMode.isRanger(p) && if (PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) { GenericFunctions.getBowMode(p)==BowMode.CLOSE) {
pd.fulldodge=true; pd.fulldodge=true;
} }
@ -5782,7 +5789,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
if (isRanger) { if (isRanger) {
switch (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())) { switch (GenericFunctions.getBowMode(p)) {
case CLOSE:{ case CLOSE:{
BowLogger.AddCloseMode(); BowLogger.AddCloseMode();
}break; }break;
@ -7006,7 +7013,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (PlayerMode.isRanger(p)) { if (PlayerMode.isRanger(p)) {
LivingEntity findtarget = aPlugin.API.rayTraceTargetEntity(p,100); LivingEntity findtarget = aPlugin.API.rayTraceTargetEntity(p,100);
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { if (GenericFunctions.getBowMode(p)==BowMode.SNIPE) {
if (findtarget==null || !p.hasLineOfSight(findtarget)) { if (findtarget==null || !p.hasLineOfSight(findtarget)) {
arr.setVelocity(arr.getVelocity().multiply(1000)); arr.setVelocity(arr.getVelocity().multiply(1000));
} else { } else {
@ -7023,7 +7030,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
pd.lastarrowpower=arr.getVelocity().lengthSquared(); pd.lastarrowpower=arr.getVelocity().lengthSquared();
pd.lastarrowwasinrangermode=(PlayerMode.isRanger(p)&&GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE); pd.lastarrowwasinrangermode=(PlayerMode.isRanger(p)&&GenericFunctions.getBowMode(p)==BowMode.SNIPE);
log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5); log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5);
arr.setCustomName("HIT"); arr.setCustomName("HIT");
if (arr.hasMetadata("INFINITEARROW")) { if (arr.hasMetadata("INFINITEARROW")) {

Loading…
Cancel
Save