Updated naming scheme for monsters. Fixed minor bugs with setting

monster's difficulties. Implemented most of Protector set. Fixed bugs
with Suppression not working on players.
patch_branch
sigonasr2 8 years ago
parent c75d629eb3
commit b3e44fdcda
  1. BIN
      TwosideKeeper.jar
  2. 2
      projectBuilder.xml
  3. 2
      src/plugin.yml
  4. 6
      src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java
  5. 7
      src/sig/plugin/TwosideKeeper/Boss/MegaWither.java
  6. 72
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  7. 35
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  8. 20
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  9. 99
      src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
  10. 4
      src/sig/plugin/TwosideKeeper/Monster/Dummy.java
  11. 9
      src/sig/plugin/TwosideKeeper/Monster/Wither.java
  12. 49
      src/sig/plugin/TwosideKeeper/MonsterController.java
  13. 88
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  14. 14
      src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java
  15. 12
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

@ -3,6 +3,6 @@
<project name="TwosideKeeper.makejar" default="makejar" basedir=".">
<target name ="makejar" description="Create a jar for the TwosideKeeper project">
<jar jarfile="TwosideKeeper.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
<jar jarfile="C:\Users\sigon\Documents\Test Stream Server\plugins\TwosideKeeper.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
<jar jarfile="D:\Documents\Test Server\plugins\TwosideKeeper.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
</target>
</project>

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.10.12
version: 3.10.13
loadbefore: [aPlugin]
commands:
money:

@ -151,7 +151,11 @@ public class ActionBarBuffUpdater{
if (amplifier==12) {
return "Ⅻ";
} else {
return Integer.toString(amplifier);
if (amplifier!=0) {
return Integer.toString(amplifier);
} else {
return "";
}
}
}

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper.Boss;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.potion.PotionEffectType;
@ -7,6 +8,7 @@ import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.ChargeZombie;
import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class MegaWither extends EliteMonster{
@ -27,8 +29,13 @@ public class MegaWither extends EliteMonster{
ignoreAllOtherTargets();
randomlyDropDown();
destroyNearbyBlocks();
setupName();
}
private void setupName() {
TwosideKeeperAPI.setCustomLivingEntityName(m, ChatColor.DARK_RED+"Mega Wither");
}
private void destroyNearbyBlocks() {
if (targetlist.size()>0) {
ChargeZombie.BreakBlocksAroundArea(m, 2);

@ -565,6 +565,7 @@ public class CustomDamage {
giveAbsorptionHealth(p);
reduceKnockback(p);
reduceSwiftAegisBuff(p);
restoreHealthToPartyMembersWithProtectorSet(p);
if (!isFlagSet(flags,NOAOE)) {
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
}
@ -698,6 +699,7 @@ public class CustomDamage {
}
performMegaKnockback(damager,target);
if ((damager!=null && damager instanceof Arrow) || (weapon!=null && weapon.getType()!=Material.BOW)) {
//TwosideKeeper.log("Entered here.", 0);
removePermEnchantments(p,weapon);
applyShrapnel(damager,p,target);
applyDoTs(damager,p,target);
@ -787,6 +789,17 @@ public class CustomDamage {
return damage;
}
private static void restoreHealthToPartyMembersWithProtectorSet(Player p) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PROTECTOR, 4)) {
double healamt = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.PROTECTOR, 4, 4);
for (Player pl : PartyManager.getPartyMembers(p)) {
if (!pl.equals(p)) {
GenericFunctions.HealEntity(pl, healamt);
}
}
}
}
private static void createFirePool(Player p, Entity damager, LivingEntity target, double damage, String reason) {
if (damager instanceof Projectile) {
if (ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
@ -842,6 +855,9 @@ public class CustomDamage {
if (ItemSet.hasFullSet(p, ItemSet.SHARD)) {
int shrapnellv = ItemSet.getHighestTierInSet(p, ItemSet.SHARD);
Buff.addBuff(target, "SHRAPNEL", new Buff("Shrapnel",20*10,shrapnellv,Color.RED,ChatColor.RED+"❂",false), true);
GenericFunctions.DealExplosionDamageToEntities(target.getLocation(), 40f+target.getHealth()*0.1, 2, null, "Shrapnel Explosion");
aPlugin.API.sendSoundlessExplosion(target.getLocation(), 1);
SoundUtils.playGlobalSound(target.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 0.5f);
}
}
}
@ -1263,24 +1279,26 @@ public class CustomDamage {
}
public static void appendDebuffsToName(LivingEntity target) {
if (target instanceof LivingEntity) {
if (target.getCustomName()==null) {
//Setup name.
target.setCustomName(GenericFunctions.CapitalizeFirstLetters(target.getType().name().replace("_", " ")));
}
if (!target.getCustomName().contains(ChatColor.RESET+" ")) { //Append our separator character.
target.setCustomName(target.getCustomName()+ChatColor.RESET+" ");
}
//Now split it using that as our separator.
String[] split = target.getCustomName().split(ChatColor.RESET+" ");
String suffix = ActionBarBuffUpdater.getActionBarPrefix(target);
if (suffix.length()>0) {
target.setCustomName(split[0]+ChatColor.RESET+" "+suffix);
} else {
target.setCustomName(split[0]);
}
/*if (target.getCustomName()==null) {
//Setup name.
target.setCustomName(GenericFunctions.CapitalizeFirstLetters(target.getType().name().replace("_", " ")));
}
if (!target.getCustomName().contains(ChatColor.RESET+" ")) { //Append our separator character.
target.setCustomName(target.getCustomName()+ChatColor.RESET+" ");
}
//Now split it using that as our separator.
String[] split = target.getCustomName().split(ChatColor.RESET+" ");
String suffix = ActionBarBuffUpdater.getActionBarPrefix(target);
if (suffix.length()>0) {
target.setCustomName(split[0]+ChatColor.RESET+" "+suffix);
} else {
target.setCustomName(split[0]);
}*/
if (!(target instanceof Player)) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
les.suffix_bar=ActionBarBuffUpdater.getActionBarPrefix(target);
}
}
@ -1817,6 +1835,7 @@ public class CustomDamage {
if (!p.isBlocking()) {
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
} else {
refundRejuvenationCooldown(p);
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.2f, 3.0f);
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
@ -1834,6 +1853,12 @@ public class CustomDamage {
return true;
}
private static void refundRejuvenationCooldown(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.last_rejuvenate-=40;
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN));
}
private static double GetAttackRate(Entity damager) {
double attackrate = 0.0;
if (damager instanceof Player) {
@ -2060,6 +2085,7 @@ public class CustomDamage {
double darknessdiv = 0;
double playermodediv = 0;
double witherdiv = 0;
double setbonusdiv = 0;
double artifactmult = 0;
if (target instanceof LivingEntity) {
@ -2077,6 +2103,15 @@ public class CustomDamage {
darknessdiv += ItemSet.GetTotalBaseAmount(p, ItemSet.RUDOLPH)/100d;
}
dmgreductiondiv += ItemSet.GetTotalBaseAmount(p, ItemSet.LUCI)/100d;
dmgreductiondiv += ItemSet.GetTotalBaseAmount(p, ItemSet.PROTECTOR)/100d;
for (Player pl : PartyManager.getPartyMembers(p)) {
if (!pl.equals(p)) {
if (PlayerMode.getPlayerMode(pl)==PlayerMode.DEFENDER &&
ItemSet.HasSetBonusBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 2)) {
setbonusdiv += 0.1*ItemSet.GetPlayerModeSpecificMult(p);
}
}
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
if (!les.checkedforcubes) {
@ -2262,6 +2297,7 @@ public class CustomDamage {
*(1d-dmgreductiondiv)
*(1d-magmacubediv)
*(1d-darknessdiv)
*(1d-setbonusdiv)
*(1d-((partylevel*10d)/100d))
*(1d-tacticspct)
*(1d-playermodediv)

@ -2547,14 +2547,17 @@ public class GenericFunctions {
}
public static void RefreshBuffColor(LivingEntity ent, int stackamt) {
if (ent instanceof LivingEntity) {
if (ent instanceof LivingEntity && !(ent instanceof Player)) {
LivingEntity m = (LivingEntity)ent;
m.setCustomNameVisible(true);
/*
if (m.getCustomName()!=null) {
m.setCustomName(getDeathMarkColor(stackamt)+ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
} else {
m.setCustomName(getDeathMarkColor(stackamt)+CapitalizeFirstLetters(m.getType().toString().replace("_", " ")));
}
}*/
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
les.prefix=getDeathMarkColor(stackamt)+"";
}
}
@ -3836,7 +3839,7 @@ public class GenericFunctions {
TwosideKeeper.log("dmg mult is "+damage_mult,4);
dmg = basedmg * damage_mult;
if (ent instanceof Player) {TwosideKeeper.log("Damage is "+dmg, 5);}
CustomDamage.ApplyDamage(dmg, damager, (LivingEntity)ent, null, reason, CustomDamage.NONE);
CustomDamage.ApplyDamage(dmg, damager, (LivingEntity)ent, null, reason, CustomDamage.IGNORE_DAMAGE_TICK);
//subtractHealth((LivingEntity)nearbyentities.get(i),null,NewCombat.CalculateDamageReduction(dmg, (LivingEntity)nearbyentities.get(i), null));
}
}
@ -4789,14 +4792,19 @@ public class GenericFunctions {
if (!TwosideKeeper.suppressed_entities.contains(ent)) {
TwosideKeeper.suppressed_entities.add(ent);
}
if (ent instanceof LivingEntity) {
//MonsterStructure.getMonsterStructure((Monster)ent).setGlobalGlow(GlowAPI.Color.BLACK);
LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ent).UpdateGlow();
} else {
GlowAPI.setGlowing(ent, GlowAPI.Color.BLACK, Bukkit.getOnlinePlayers());
}
if (ent instanceof LivingEntity) {
LivingEntity l = (LivingEntity)ent;
Buff.addBuff(l, "SUPPRESSION", new Buff("Suppression", ticks, 0, org.bukkit.Color.NAVY, ChatColor.DARK_GRAY+""+ChatColor.BOLD+"✖", false));
if (!(ent instanceof Player)) {
//MonsterStructure.getMonsterStructure((Monster)ent).setGlobalGlow(GlowAPI.Color.BLACK);
LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ent).UpdateGlow();
} else {
if (ent instanceof Player) {
Player p = (Player)ent;
aPlugin.API.setPlayerSpeedMultiplier(p, 0);
}
GlowAPI.setGlowing(ent, GlowAPI.Color.BLACK, Bukkit.getOnlinePlayers());
}
//l.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,ticks,99));
TwosideKeeper.log("Base Value: "+l.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue(), 5);
l.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0d);
@ -4883,10 +4891,17 @@ public class GenericFunctions {
public static String getDisplayName(LivingEntity ent) {
//Strips off the suffix of a mob.
if (ent.getCustomName()==null) {
/*if (ent.getCustomName()==null) {
return GenericFunctions.CapitalizeFirstLetters(ent.getType().name().replace("_", " "));
} else {
return ent.getCustomName().split(ChatColor.RESET+" ")[0];
}*/
if (!(ent instanceof Player)) {
LivingEntityStructure struct = LivingEntityStructure.GetLivingEntityStructure(ent);
return struct.getActualName();
} else {
Player p = (Player)ent;
return p.getName();
}
}

@ -551,6 +551,9 @@ 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)+" Max Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Absorption Health (30 seconds)");
@ -892,9 +895,9 @@ public enum ItemSet {
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)+"% Damage Reduction to other party members");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Health to other party members.");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" 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)+"Health to your party members.");
lore.add(" "+ChatColor.WHITE+" "+ItemSet.GetBaseAmount(set, tier, 4)+" 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 1 second,");
lore.add(ChatColor.GRAY+" creating a "+(tier*20)+" Health shield for 30");
@ -1119,4 +1122,17 @@ public enum ItemSet {
public static int GetTier(ItemStack item) {
return GetItemTier(item);
}
/**
* Returns Mode-specific reductions in terms of HP gains.
*/
public static double GetPlayerModeSpecificMult(Player p) {
if (PlayerMode.isSlayer(p)) {
return 0;
} else
if (PlayerMode.isRanger(p)) {
return 0.5;
} else
return 1;
}
}

@ -16,7 +16,11 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
public class LivingEntityStructure {
public LivingEntity target;
public String original_name="";
public String base_name="";
public String difficulty_modifier="";
public String prefix="";
public String suffix="";
public String suffix_bar="";
public LivingEntity m;
public boolean isLeader=false;
public boolean isElite=false;
@ -37,22 +41,26 @@ public class LivingEntityStructure {
public long lastBurnTick=0;
public float MoveSpeedMultBeforeCripple=1f;
final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET;
final static String MODIFIED_NAME_DELIMITER = ChatColor.RESET+";"+ChatColor.RESET;
public LivingEntityStructure(LivingEntity m) {
target=null;
original_name=GetOriginalName(m);
//TwosideKeeper.log("Original name is "+original_name, 0);
base_name=GetOriginalName(m);
//TwosideKeeper.log("Original name is "+base_name, 0);
this.m=m;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
}
public LivingEntityStructure(LivingEntity m, LivingEntity target) {
this.target=target;
original_name=GetOriginalName(m);
base_name=GetOriginalName(m);
//TwosideKeeper.log("Original name is "+base_name, 0);
this.m=m;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
}
public LivingEntityStructure(LivingEntity m, LivingEntity target, BossMonster bm) {
this.target=target;
original_name=bm.getName();
base_name=bm.getName();
this.m=m;
this.bm=bm;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
@ -60,12 +68,48 @@ public class LivingEntityStructure {
private String GetOriginalName(LivingEntity m) {
if (m.getCustomName()!=null) {
return m.getCustomName();
//TwosideKeeper.log("Custom Name is "+m.getCustomName(), 0);
if (!isModifiedName(m.getCustomName())) {
//TwosideKeeper.log(" NOT A MODIFIED NAME! "+m.getCustomName(), 0);
return m.getCustomName();
} else {
String[] splitter = m.getCustomName().split(MODIFIED_NAME_DELIMITER);
difficulty_modifier = splitter[0];
//TwosideKeeper.log(" Set Difficulty to "+splitter[0], 0);
//TwosideKeeper.log(" Set Base Name to "+splitter[1], 0);
return splitter[1];
}
} else {
return GenericFunctions.CapitalizeFirstLetters(m.getType().name().replace("_", " "));
}
}
private boolean isModifiedName(String customName) {
return customName.contains(MODIFIED_NAME_DELIMITER);
}
public String getActualName() {
StringBuilder sb = new StringBuilder(prefix);
if (prefix.length()>0 && difficulty_modifier.length()>0) {
sb.append(" ");
}
sb.append(difficulty_modifier);
if (difficulty_modifier.length()>0 && base_name.length()>0) {
sb.append(" ");
}
sb.append(base_name);
if (base_name.length()>0 && suffix.length()>0) {
sb.append(" ");
}
sb.append(suffix);
if (suffix.length()>0 && suffix_bar.length()>0) {
sb.append(" ");
}
sb.append(suffix_bar);
sb.append(MODIFIED_NAME_CODE);
//TwosideKeeper.log(prefix+","+difficulty_modifier+","+base_name+","+suffix+","+suffix_bar, 0);
return sb.toString();
}
public LivingEntity GetTarget() {
if (this.target!=null &&
!this.target.isDead()) {
@ -79,18 +123,19 @@ public class LivingEntityStructure {
}
public void SetLeader(boolean leader) {
this.isLeader=leader;
//suffix=(suffix.length()>0)?suffix+" Leader":"Leader";
}
public void SetElite(boolean elite) {
this.isElite=elite;
}
public boolean hasOriginalName() {
return !this.original_name.equalsIgnoreCase("");
return !this.base_name.equalsIgnoreCase("");
}
public String getOriginalName() {
if (hasOriginalName()) {
return this.original_name;
return this.base_name;
} else {
return "";
}
@ -155,28 +200,32 @@ public class LivingEntityStructure {
}
public static void UpdateMobName(LivingEntity ent) {
if (ent instanceof LivingEntity) {
if (ent instanceof LivingEntity && !(ent instanceof Player)) {
LivingEntity m = (LivingEntity)ent;
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
m.setCustomNameVisible(false);
if (m.getCustomName()!=null) {
m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
if (m.getCustomName().contains("Dangerous")) {
String actualName = les.getActualName();
if (actualName.length()>0) {
//m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
/*if (m.getCustomName().contains("Dangerous")) {
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
}
} else
if (m.getCustomName().contains("Deadly")) {
m.setCustomName(ChatColor.GOLD+m.getCustomName());
}
} else
if (m.getCustomName().contains("Hellfire")) {
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
}
m.setCustomName(ChatColor.DARK_RED+m.getCustomName()+ChatColor.RESET+" ");
} else {
m.setCustomName(ChatColor.WHITE+m.getCustomName()+ChatColor.RESET+" ");
}*/
if (Buff.hasBuff(m, "DeathMark")) {
GenericFunctions.RefreshBuffColor(m, Buff.getBuff(m, "DeathMark").getAmplifier());
}
CustomDamage.appendDebuffsToName(m);
if (m.getCustomName().contains(" ")) {
if (les.suffix_bar.length()>0) {
m.setCustomNameVisible(true);
}
m.setCustomName(actualName);
}
}
}
@ -197,4 +246,20 @@ public class LivingEntityStructure {
}
}
}
public String getUnloadedName() {
StringBuilder sb = new StringBuilder(difficulty_modifier);
sb.append(ChatColor.RESET);
sb.append(";");
sb.append(ChatColor.RESET);
sb.append(base_name);
return sb.toString();
}
public static void setCustomLivingEntityName(LivingEntity l, String name) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.base_name = name;
}
public static String getCustomLivingEntityName(LivingEntity l) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.base_name;
}
}

@ -15,6 +15,7 @@ import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MovementModifier;
@ -29,7 +30,8 @@ public class Dummy extends CustomMonster{
public Dummy(LivingEntity m) {
super(m);
m.setCustomName(ChatColor.MAGIC+" "+ChatColor.RESET+"Test Dummy"+ChatColor.MAGIC+" ");
//m.setCustomName(ChatColor.MAGIC+" "+ChatColor.RESET+"Test Dummy"+ChatColor.MAGIC+" ");
TwosideKeeperAPI.setCustomLivingEntityName(m, ChatColor.MAGIC+" "+ChatColor.RESET+"Test Dummy"+ChatColor.MAGIC+" ");
m.setCustomNameVisible(true);
this.spawnLoc = m.getLocation();
//m.setCollidable(false);

@ -22,6 +22,7 @@ import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
@ -69,6 +70,7 @@ public class Wither extends CustomMonster{
public void runTick() {
if (m instanceof Monster) {
RemoveInactivePlayers();
setupName();
if (activeplayers.size()==0 && dmgbreakdown.size()>0) {
DisplayFailedDPSReport();
@ -120,7 +122,8 @@ public class Wither extends CustomMonster{
MonsterController.convertLivingEntity(ws, LivingEntityDifficulty.HELLFIRE);
ws.setMaxHealth(ws.getMaxHealth()*6);
ws.setHealth(ws.getMaxHealth());
ws.setCustomName(ChatColor.RED+"Hellfire Wither Skeleton Minion");
//ws.setCustomName(ChatColor.RED+"Hellfire Wither Skeleton Minion");
TwosideKeeperAPI.setCustomLivingEntityName(ws, ChatColor.RED+"Wither Skeleton Minion");
if (((Monster) m).getTarget()!=null && ((Monster) m).getTarget().isValid() &&
!((Monster) m).getTarget().isDead()) {
ws.setTarget(((Monster) m).getTarget());
@ -130,6 +133,10 @@ public class Wither extends CustomMonster{
}
}
}
private void setupName() {
TwosideKeeperAPI.setCustomLivingEntityName(m, ChatColor.DARK_RED+"Leader Wither");
}
private void RemoveInactivePlayers() {
for (Player pl : activeplayers) {

@ -818,7 +818,7 @@ public class MonsterController {
}
public static LivingEntityDifficulty getLivingEntityDifficulty(LivingEntity m) {
if (m.getCustomName()!=null) {
/*if (m.getCustomName()!=null) {
if (m.getCustomName().contains("Dangerous")) {
return LivingEntityDifficulty.DANGEROUS;
} else
@ -839,12 +839,32 @@ public class MonsterController {
}
} else {
return LivingEntityDifficulty.NORMAL;
}*/
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
String difficulty_modifier = les.difficulty_modifier;
if (difficulty_modifier.contains("Dangerous")) {
return LivingEntityDifficulty.DANGEROUS;
} else
if (difficulty_modifier.contains("Deadly")) {
return LivingEntityDifficulty.DEADLY;
} else
if (difficulty_modifier.contains("Hellfire")) {
return LivingEntityDifficulty.HELLFIRE;
} else
if (difficulty_modifier.contains("Elite")) {
return LivingEntityDifficulty.ELITE;
} else
if (difficulty_modifier.contains("End ")) {
return LivingEntityDifficulty.END;
} else
{
return LivingEntityDifficulty.NORMAL;
}
}
@Deprecated
public static MonsterDifficulty getMonsterDifficulty(Monster m) {
if (m.getCustomName()!=null) {
/*if (m.getCustomName()!=null) {
if (m.getCustomName().contains("Dangerous")) {
return MonsterDifficulty.DANGEROUS;
} else
@ -865,6 +885,26 @@ public class MonsterController {
}
} else {
return MonsterDifficulty.NORMAL;
}*/
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
String difficulty_modifier = les.difficulty_modifier;
if (difficulty_modifier.contains("Dangerous")) {
return MonsterDifficulty.DANGEROUS;
} else
if (difficulty_modifier.contains("Deadly")) {
return MonsterDifficulty.DEADLY;
} else
if (difficulty_modifier.contains("Hellfire")) {
return MonsterDifficulty.HELLFIRE;
} else
if (difficulty_modifier.contains("Elite")) {
return MonsterDifficulty.ELITE;
} else
if (difficulty_modifier.contains("End ")) {
return MonsterDifficulty.END;
} else
{
return MonsterDifficulty.NORMAL;
}
}
@ -882,7 +922,10 @@ public class MonsterController {
MonsterName = "guardian boss";
}
}
m.setCustomName(prefix.equalsIgnoreCase("")?"":(prefix+" ")+GenericFunctions.CapitalizeFirstLetters(MonsterName.replaceAll("_", " ")+(isZombieLeader(m)?" Leader":"")));
//m.setCustomName(prefix.equalsIgnoreCase("")?"":(prefix+" ")+GenericFunctions.CapitalizeFirstLetters(MonsterName.replaceAll("_", " ")+(isZombieLeader(m)?" Leader":"")));
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
les.difficulty_modifier = prefix;
les.suffix = (isZombieLeader(m)?"Leader":"");
}
public static LivingEntity convertLivingEntity(LivingEntity m, LivingEntityDifficulty led) {

@ -427,7 +427,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int EARTHWAVE_COOLDOWN=100;
public static final int ERUPTION_COOLDOWN=100;
public static final int LINEDRIVE_COOLDOWN=240;
public static final int REJUVENATE_COOLDOWN=2400;
public static final int REJUVENATE_COOLDOWN=6000;
public static final int ASSASSINATE_COOLDOWN=200;
public static final int LIFESAVER_COOLDOWN=6000;
public static final int ARROWBARRAGE_COOLDOWN=2400;
@ -793,10 +793,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
for (Entity e : suppressed_entities) {
if (e==null || !e.isValid() ||
GenericFunctions.getSuppressionTime(e)<=0) {
if (e!=null && e.isValid() && e instanceof LivingEntity) {
if (e!=null && e.isValid() && (e instanceof LivingEntity && !(e instanceof Player))) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)e);
((LivingEntity)e).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(les.original_movespd);
((LivingEntity)e).setAI(true);
} else {
if (e instanceof Player) {
Player p = (Player)e;
aPlugin.API.setPlayerSpeedMultiplier(p, 1);
}
GlowAPI.setGlowing(e, null, Bukkit.getOnlinePlayers());
}
ScheduleRemoval(suppressed_entities,e);
}
@ -1194,6 +1200,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ReplaceBlockTask.CleanupTemporaryBlock(tb);
}
log(ChatColor.YELLOW+" "+(System.currentTimeMillis()-betweentime)+"ms",CLEANUP_DEBUG);
log("Resetting Mob Names ["+livingentitydata.size()+"]",CLEANUP_DEBUG);
for (UUID id : livingentitydata.keySet()) {
//TemporaryBlock tb = temporaryblocks.get(ss);
//ReplaceBlockTask.CleanupTemporaryBlock(tb);
LivingEntityStructure les = livingentitydata.get(id);
les.m.setCustomName(les.getUnloadedName());
TwosideKeeper.log("Saving unloaded monster "+les.getUnloadedName(), 0);
}
log(ChatColor.YELLOW+" "+(System.currentTimeMillis()-betweentime)+"ms",CLEANUP_DEBUG);
long endtime = System.currentTimeMillis();
log("Cleanup Maintenance completed. Total Time: "+(endtime-starttime)+"ms.",CLEANUP_DEBUG);
}
@ -1648,12 +1663,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
new ItemStack(Material.GOLD_CHESTPLATE),
new ItemStack(Material.GOLD_LEGGINGS),
new ItemStack(Material.GOLD_BOOTS),
new ItemStack(Material.GOLD_SWORD),
new ItemStack(Material.GOLD_AXE),
new ItemStack(Material.SHIELD),
}) {
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+Integer.parseInt(args[2])+" "+ItemSet.valueOf(args[1])+" Set");
ItemMeta m = item.getItemMeta();
m.setLore(lore);
item.setItemMeta(m);
TwosideKeeperAPI.addHardenedItemBreaks(item, 999999);
p.getWorld().dropItemNaturally(p.getLocation(), item);
}
}break;
case "GIVEFULLRANGERSET":{
for (ItemStack item : new ItemStack[]{
new ItemStack(Material.LEATHER_HELMET),
new ItemStack(Material.LEATHER_CHESTPLATE),
new ItemStack(Material.LEATHER_LEGGINGS),
new ItemStack(Material.LEATHER_BOOTS),
new ItemStack(Material.BOW),
}) {
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+Integer.parseInt(args[2])+" "+ItemSet.valueOf(args[1])+" Set");
ItemMeta m = item.getItemMeta();
m.setLore(lore);
item.setItemMeta(m);
TwosideKeeperAPI.addHardenedItemBreaks(item, 999999);
p.getWorld().dropItemNaturally(p.getLocation(), item);
}
}break;
@ -1894,6 +1930,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
/*tbn.getPlayersOnNodeViaDistanceSearch();
tbn.getPlayersOnNodeViaNearbyEntities();*/
}break;
case "SUPPRESSME":{
GenericFunctions.addSuppressionTime(p, 200);
}break;
}
}
@ -3150,17 +3189,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
LivingEntity shooter = CustomDamage.getDamagerEntity(proj);
if (shooter!=null && shooter instanceof Player) {
Player p = (Player)shooter;
if (ItemSet.hasFullSet(p, ItemSet.SHARD)) {
GenericFunctions.DealExplosionDamageToEntities(ev.getEntity().getLocation(), 40f+shooter.getHealth()*0.1, 2, shooter, "Shrapnel Explosion");
/*if (ItemSet.hasFullSet(p, ItemSet.SHARD)) {
//GenericFunctions.DealExplosionDamageToEntities(ev.getEntity().getLocation(), 40f+shooter.getHealth()*0.1, 2, shooter, "Shrapnel Explosion");
aPlugin.API.sendSoundlessExplosion(ev.getEntity().getLocation(), 1);
SoundUtils.playGlobalSound(ev.getEntity().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 0.5f);
}
else
if (!proj.hasMetadata("FIREPOOL") && ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
//new TemporaryBlockNode(proj.getLocation(),3,100,"FIREPOOL",Particle.DRIP_LAVA,40);
}
else */
/*if (!proj.hasMetadata("FIREPOOL") && ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
new TemporaryBlockNode(proj.getLocation(),3,100,"FIREPOOL",Particle.DRIP_LAVA,40);
TemporaryBlock.createTemporaryBlockCircle(proj.getLocation().add(0,-2,0), 2, Material.REDSTONE_BLOCK, (byte)0, 100, "FIRECESSPOOL");
proj.setMetadata("FIREPOOL", new FixedMetadataValue(this,true));
}
}*/
}
if (ev.getEntity() instanceof Arrow) {
@ -3231,6 +3270,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (ev.getPlayer().getEquipment().getItemInMainHand().getType()==Material.NAME_TAG && (ev.getRightClicked() instanceof LivingEntity)) {
if (ev.getPlayer().getEquipment().getItemInMainHand().hasItemMeta() &&
ev.getPlayer().getEquipment().getItemInMainHand().getItemMeta().hasDisplayName()) {
if (!(ev.getRightClicked() instanceof Player)) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ev.getRightClicked());
les.base_name = ev.getPlayer().getEquipment().getItemInMainHand().getItemMeta().getDisplayName();
}
}
}
/*if (ev.getPlayer().getEquipment().getItemInMainHand().getType()==Material.NAME_TAG && (ev.getRightClicked() instanceof LivingEntity)) {
//TwosideKeeper.log("Check this out.", 2);
LivingEntity m = (LivingEntity)ev.getRightClicked();
//MonsterController.convertMonster(m,md);
@ -3246,7 +3294,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
},1);
}
*/
if (PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN && ev.getRightClicked() instanceof LivingEntity) {
aPlugin.API.swingOffHand(p);
if (pd.weaponcharges>=10 && (pd.weaponcharges<30 || !p.isSneaking())) {
@ -6056,6 +6104,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
for (Entity e : ev.getChunk().getEntities()) {
if (e instanceof LivingEntity) {
LivingEntity l = (LivingEntity)e;
if (l.isValid()) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
l.setCustomName(les.getUnloadedName());
}
}
}
}
public void updateMonsterFlags(LivingEntity m) {
@ -9739,9 +9796,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 4, 4);*/
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SHARD, 4, 4);
TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Shard HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime();
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER,6)) {
hp+=0.25d*ItemSet.GetItemTier(p.getEquipment().getItemInMainHand());
}
TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dawntracker bonus HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime();
for (Player pl : PartyManager.getPartyMembers(p)) {
if (!pl.equals(p)) {
if (PlayerMode.getPlayerMode(pl)==PlayerMode.DEFENDER) {
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 3, 3)*ItemSet.GetPlayerModeSpecificMult(p);
}
}
}
TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Protector Set Calculation", (int)(System.nanoTime()-time));time = System.nanoTime();
if (PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL) {
TwosideKeeper.log("Player Mode is Normal.", 5);

@ -102,6 +102,20 @@ public final class TwosideKeeperAPI {
public static LivingEntityDifficulty getLivingEntityDifficulty(LivingEntity m) {
return MonsterController.getLivingEntityDifficulty(m);
}
/**
* Sets the custom display name for a Living Entity. Because Sig's Plugin handles
* its naming internally, you have to force a name through this method for it to appear,
* otherwise it gets reset.
*/
public static void setCustomLivingEntityName(LivingEntity m, String name) {
LivingEntityStructure.setCustomLivingEntityName(m,name);
}
/**
* Retrieves the base display name for a LivingEntity.
*/
public static String getCustomLivingEntityName(LivingEntity m) {
return LivingEntityStructure.getCustomLivingEntityName(m);
}
//Christmas Commands.
public static ItemStack getSmallCandyItem() {

@ -21,6 +21,7 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Animals;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
@ -431,7 +432,7 @@ final class runServerHeartbeat implements Runnable {
}
if (Buff.hasBuff(ent, "BLEEDING") && les.lastBleedingTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (ent!=null) {
if (ent!=null && Buff.hasBuff(ent, "BLEEDING")) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastBleedingTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
@ -1087,16 +1088,17 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.ScheduleRemoval(TwosideKeeper.custommonsters, id);
TwosideKeeper.ScheduleRemoval(data, id);
TwosideKeeper.ScheduleRemoval(TwosideKeeper.habitat_data.startinglocs, id);
ms.m.setCustomName(ms.getOriginalName());
ms.m.setCustomName(ms.getUnloadedName());
//TwosideKeeper.log("Saving unloaded monster "+ms.getUnloadedName(), 0);
TwosideKeeper.log("Removed Monster Structure for "+id+".", 5);
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Removed Monster Structure Data.", (int)(System.nanoTime()-time));time=System.nanoTime();
} else {
AddEliteStructureIfOneDoesNotExist(ms);
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Add Elite Structure", (int)(System.nanoTime()-time));time=System.nanoTime();
if (ms.GetTarget()!=null && ms.GetTarget().isValid() && !ms.GetTarget().isDead() && ms.m.hasAI() && !Dummy.isDummy(ms.m)) {
if (!(ms.m instanceof Animals) && ms.GetTarget()!=null && ms.GetTarget().isValid() && !ms.GetTarget().isDead() && ms.m.hasAI() && !Dummy.isDummy(ms.m)) {
//Randomly move this monster a tiny bit in case they are stuck.
double xdir=((ms.m.getLocation().getX()>ms.GetTarget().getLocation().getX())?-0.25:0.25)+(Math.random()/8)-(Math.random()/8);
double zdir=((ms.m.getLocation().getZ()>ms.GetTarget().getLocation().getZ())?-0.25:0.25)+(Math.random()/8)-(Math.random()/8);
double xdir=((ms.m.getLocation().getX()>ms.GetTarget().getLocation().getX())?-0.1:0.1)+(Math.random()/8)-(Math.random()/8);
double zdir=((ms.m.getLocation().getZ()>ms.GetTarget().getLocation().getZ())?-0.1:0.1)+(Math.random()/8)-(Math.random()/8);
ms.m.setVelocity(ms.m.getVelocity().add(new Vector(xdir,0,zdir)));
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Randomly Move this Monster", (int)(System.nanoTime()-time));time=System.nanoTime();
}

Loading…
Cancel
Save