Updated Boss Monster segregation code.

dev
sigonasr2 9 years ago
parent 5fced804b5
commit c04a91a834
  1. BIN
      TwosideKeeper.jar
  2. 6
      src/sig/plugin/TwosideKeeper/Boss/MegaWither.java
  3. 167
      src/sig/plugin/TwosideKeeper/BossMonster.java
  4. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  5. 8
      src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
  6. 14
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -38,7 +38,11 @@ public class MegaWither extends EliteMonster{
private void randomlyDropDown() {
if (last_dropdowntime+DROPDOWN_COOLDOWN<TwosideKeeper.getServerTickTime()) {
last_dropdowntime = TwosideKeeper.getServerTickTime();
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20, -9, m);
//GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20, -9, m);
}
if (last_dropdowntime+60>TwosideKeeper.getServerTickTime()) {
m.setVelocity(m.getVelocity().setY(-20f));
//m.teleport(m.getLocation().add(0,-5,0));
}
}

@ -0,0 +1,167 @@
package sig.plugin.TwosideKeeper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class BossMonster {
private String name;
private double maxhp;
private double hp_regen;
private double damagereduction;
private double attackstrength;
private double movespd;
private LivingEntity m;
private Collection<PotionEffect> buffs;
protected BossBar bar = null;
protected List<Player> targetlist = new ArrayList<Player>();
protected List<Player> participantlist = new ArrayList<Player>();
protected HashMap<String,Double> dpslist = new HashMap<String,Double>();
protected String arrow = "->";
int scroll=0;
public BossMonster(String name, double maxhp, double attackstrength, LivingEntity m) {
super();
this.name = name;
this.maxhp = maxhp;
this.attackstrength = attackstrength;
this.m = m;
this.damagereduction=0.0;
this.buffs=null;
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd;
this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
}
public BossMonster(String name, double maxhp, double damagereduction, double attackstrength, LivingEntity m) {
super();
this.name = name;
this.maxhp = maxhp;
this.damagereduction = damagereduction;
this.attackstrength = attackstrength;
this.m = m;
this.buffs=null;
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd;
this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
}
public BossMonster(String name, double maxhp, double damagereduction, double attackstrength, LivingEntity m,
Collection<PotionEffect> buffs) {
super();
this.name = name;
this.maxhp = maxhp;
this.damagereduction = damagereduction;
this.attackstrength = attackstrength;
this.m = m;
this.buffs = buffs;
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd;
this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
}
public BossMonster(String name, double maxhp, double damagereduction, double attackstrength, double movespd,
LivingEntity m, Collection<PotionEffect> buffs) {
super();
this.name = name;
this.maxhp = maxhp;
this.damagereduction = damagereduction;
this.attackstrength = attackstrength;
this.movespd = movespd;
this.m = m;
this.buffs = buffs;
this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
}
public BossMonster(String name, double maxhp, double hp_regen, double damagereduction, double attackstrength,
double movespd, LivingEntity m, Collection<PotionEffect> buffs) {
super();
this.name = name;
this.maxhp = maxhp;
this.hp_regen = hp_regen;
this.damagereduction = damagereduction;
this.attackstrength = attackstrength;
this.movespd = movespd;
this.m = m;
this.buffs = buffs;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
}
public double getMaxhp() {
return maxhp;
}
public double getHp_regen() {
return hp_regen;
}
public double getDamagereduction() {
return damagereduction;
}
public double getAttackstrength() {
return attackstrength;
}
public double getMovespd() {
return movespd;
}
public LivingEntity getM() {
return m;
}
public Collection<PotionEffect> getBuffs() {
return buffs;
}
public String getName() {
return name;
}
public void runTick() {
increaseBarTextScroll();
createBossHealthbar();
}
protected void increaseBarTextScroll() {
scroll++;
switch (scroll%22) {
case 11:{
arrow=" -";
}break;
case 12:{
arrow=" ";
}break;
case 13:{
arrow="> ";
}break;
case 14:{
arrow="->";
}break;
}
}
protected void createBossHealthbar() {
List<Player> currentplayers = bar.getPlayers();
for (int i=0;i<currentplayers.size();i++) {
if (!targetlist.contains(currentplayers.get(i))) {
bar.removePlayer(currentplayers.get(i));
}
}
bar.setProgress(m.getHealth()/m.getMaxHealth());
bar.setTitle(GenericFunctions.getDisplayName(m) + ((m instanceof Monster && ((Monster)m).getTarget()!=null && (((Monster)m).getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)((Monster)m).getTarget()).getName()):""));
for (int i=0;i<targetlist.size();i++) {
if (!currentplayers.contains(targetlist.get(i))) {
bar.addPlayer(targetlist.get(i));
}
}
}
}

@ -2188,7 +2188,8 @@ public class GenericFunctions {
(m.getType()==EntityType.GUARDIAN &&
((Guardian)m).isElder()) ||
m.getType()==EntityType.ENDER_DRAGON ||
m.getType()==EntityType.WITHER) {
m.getType()==EntityType.WITHER ||
LivingEntityStructure.getLivingEntityStructure(m).getLeader()) {
return true;
} else {
return false;

@ -22,6 +22,7 @@ public class LivingEntityStructure {
public HashMap<UUID,Long> hitlist = new HashMap<UUID,Long>();
public HashMap<Player,GlowAPI.Color> glowcolorlist = new HashMap<Player,GlowAPI.Color>();
public long lastSpiderBallThrow = 0;
public BossMonster bm = null;
public LivingEntityStructure(LivingEntity m) {
target=null;
@ -35,6 +36,13 @@ public class LivingEntityStructure {
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();
this.m=m;
this.bm=bm;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
}
public LivingEntity GetTarget() {
if (this.target!=null &&

@ -899,23 +899,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().setAbsorptionHearts(Float.valueOf(args[0]));
}*/
if (args.length>0) {
ItemStack quiver = p.getInventory().getExtraContents()[0];
switch (args[0]) {
case "ADD":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
ArrowQuiver.addContents(ArrowQuiver.getID(quiver), p.getInventory().getItemInMainHand());
ArrowQuiver.updateQuiverLore(quiver);
}break;
case "REMOVE":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
ArrowQuiver.removeContents(ArrowQuiver.getID(quiver), p.getInventory().getItemInMainHand());
ArrowQuiver.updateQuiverLore(quiver);
}break;
case "GET":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
p.sendMessage("Quiver Mode: "+ArrowQuiver.getArrowQuiverMode(quiver));
ArrowQuiver.updateQuiverLore(quiver);
}break;
case "SET":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
p.sendMessage("Quiver Mode: "+ArrowQuiver.setArrowQuiverMode(quiver, Integer.parseInt(args[1])));
p.sendMessage("Updated Quiver Mode: "+ArrowQuiver.getArrowQuiverMode(quiver));
ArrowQuiver.updateQuiverLore(quiver);
}break;
case "WITHER":{
Monster m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.WITHER), MonsterDifficulty.ELITE);
}break;
}
ArrowQuiver.updateQuiverLore(quiver);
}
/*
StackTraceElement[] stacktrace = new Throwable().getStackTrace();

Loading…
Cancel
Save