Merge branch 'dev'

This commit is contained in:
BuildTools 2016-11-28 18:51:23 -06:00
commit 1df9b0765d
6 changed files with 194 additions and 4 deletions

Binary file not shown.

View File

@ -38,7 +38,11 @@ public class MegaWither extends EliteMonster{
private void randomlyDropDown() { private void randomlyDropDown() {
if (last_dropdowntime+DROPDOWN_COOLDOWN<TwosideKeeper.getServerTickTime()) { if (last_dropdowntime+DROPDOWN_COOLDOWN<TwosideKeeper.getServerTickTime()) {
last_dropdowntime = 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));
} }
} }

View File

@ -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));
}
}
}
}

View File

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

View File

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

View File

@ -942,23 +942,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().setAbsorptionHearts(Float.valueOf(args[0])); ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().setAbsorptionHearts(Float.valueOf(args[0]));
}*/ }*/
if (args.length>0) { if (args.length>0) {
ItemStack quiver = p.getInventory().getExtraContents()[0];
switch (args[0]) { switch (args[0]) {
case "ADD":{ case "ADD":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
ArrowQuiver.addContents(ArrowQuiver.getID(quiver), p.getInventory().getItemInMainHand()); ArrowQuiver.addContents(ArrowQuiver.getID(quiver), p.getInventory().getItemInMainHand());
ArrowQuiver.updateQuiverLore(quiver);
}break; }break;
case "REMOVE":{ case "REMOVE":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
ArrowQuiver.removeContents(ArrowQuiver.getID(quiver), p.getInventory().getItemInMainHand()); ArrowQuiver.removeContents(ArrowQuiver.getID(quiver), p.getInventory().getItemInMainHand());
ArrowQuiver.updateQuiverLore(quiver);
}break; }break;
case "GET":{ case "GET":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
p.sendMessage("Quiver Mode: "+ArrowQuiver.getArrowQuiverMode(quiver)); p.sendMessage("Quiver Mode: "+ArrowQuiver.getArrowQuiverMode(quiver));
ArrowQuiver.updateQuiverLore(quiver);
}break; }break;
case "SET":{ case "SET":{
ItemStack quiver = p.getInventory().getExtraContents()[0];
p.sendMessage("Quiver Mode: "+ArrowQuiver.setArrowQuiverMode(quiver, Integer.parseInt(args[1]))); p.sendMessage("Quiver Mode: "+ArrowQuiver.setArrowQuiverMode(quiver, Integer.parseInt(args[1])));
p.sendMessage("Updated Quiver Mode: "+ArrowQuiver.getArrowQuiverMode(quiver)); 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; }break;
} }
ArrowQuiver.updateQuiverLore(quiver);
} }
/* /*
StackTraceElement[] stacktrace = new Throwable().getStackTrace(); StackTraceElement[] stacktrace = new Throwable().getStackTrace();