CustomTagFix support changing and removing of names.
This commit is contained in:
parent
4b7a4a4d5c
commit
21d9f5767e
@ -253,45 +253,62 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
|
||||
if (metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a))
|
||||
{
|
||||
String entityName = "";
|
||||
boolean nameShowing = _entityMap.get(owner.getName()).containsKey(metaPacket.a);
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>)metaPacket.b)
|
||||
boolean spawnedAlready = _entityMap.get(owner.getName()).containsKey(metaPacket.a);
|
||||
String currentName = _entityNameMap.get(owner.getName()).get(metaPacket.a);
|
||||
|
||||
if (currentName == null)
|
||||
{
|
||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1)
|
||||
currentName = "";
|
||||
}
|
||||
|
||||
String newName = currentName;
|
||||
boolean newDisplay = spawnedAlready;
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>) metaPacket.b)
|
||||
{
|
||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte)
|
||||
{
|
||||
nameShowing = true;
|
||||
newDisplay = ((Byte) watchable.b()) == 1;
|
||||
}
|
||||
|
||||
if ((watchable.a() == 10 || watchable.a() == 2) && watchable.b() instanceof String)
|
||||
{
|
||||
entityName = (String)watchable.b();
|
||||
newName = (String) watchable.b();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_entityMap.get(owner.getName()).containsKey(metaPacket.a)
|
||||
|| !_entityMap.get(owner.getName()).get(metaPacket.a).equals(entityName))
|
||||
// If the name has changed and the name should be showing, or the name display status has changed.
|
||||
if ((!newName.equals(currentName) && newDisplay) || newDisplay != spawnedAlready)
|
||||
{
|
||||
if (nameShowing && !entityName.isEmpty())
|
||||
// If name should be changing, we are just going to spawn a new one or change the existing
|
||||
if (newDisplay)
|
||||
{
|
||||
int newId;
|
||||
|
||||
if (_entityMap.get(owner.getName()).containsKey(metaPacket.a))
|
||||
if (spawnedAlready)
|
||||
{
|
||||
newId = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
newId = UtilEnt.getNewEntityId();
|
||||
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
||||
}
|
||||
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, entityName, verifier,
|
||||
!_entityMap.get(owner.getName()).containsKey(metaPacket.a));
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, newName, verifier, !spawnedAlready);
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(metaPacket.a, entityName);
|
||||
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
||||
_entityNameMap.get(owner.getName()).put(metaPacket.a, newName);
|
||||
}
|
||||
else if (!entityName.isEmpty())
|
||||
{
|
||||
else
|
||||
{ // Lets delete it
|
||||
int id = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
id
|
||||
}));
|
||||
|
||||
_entityMap.get(owner.getName()).remove(metaPacket.a);
|
||||
_entityNameMap.get(owner.getName()).remove(metaPacket.a);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class DisguiseCaveSpider extends DisguiseMonster
|
||||
{
|
||||
|
||||
public DisguiseCaveSpider(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
super(EntityType.CAVE_SPIDER, entity);
|
||||
|
||||
DataWatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
public boolean bT()
|
||||
{
|
||||
return (DataWatcher.getByte(16) & 0x01) != 0;
|
||||
}
|
||||
|
||||
public void a(boolean flag)
|
||||
{
|
||||
byte b0 = DataWatcher.getByte(16);
|
||||
|
||||
if (flag)
|
||||
b0 = (byte) (b0 | 0x1);
|
||||
else
|
||||
b0 = (byte) (b0 & 0xFFFFFFFE);
|
||||
|
||||
DataWatcher.watch(16, Byte.valueOf(b0));
|
||||
}
|
||||
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.spider.say";
|
||||
}
|
||||
|
||||
}
|
@ -48,7 +48,8 @@ public class KingHill extends WorldEvent
|
||||
|
||||
public KingHill(WorldEventManager eventManager, Location centerLocation)
|
||||
{
|
||||
super(eventManager.getDamage(), eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "King of the Hill", centerLocation);
|
||||
super(eventManager.getClans().getDisguiseManager(), eventManager.getClans().getProjectile(), eventManager.getDamage(),
|
||||
eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "King of the Hill", centerLocation);
|
||||
_clansManager = eventManager.getClans();
|
||||
_scoreMap = new HashMap<ClanInfo, CaptureData>();
|
||||
_hill = LOADED_HILLS.get(0);
|
||||
|
@ -44,7 +44,8 @@ public class UndeadCamp extends WorldEvent
|
||||
|
||||
public UndeadCamp(WorldEventManager eventManager, Location centerLocation)
|
||||
{
|
||||
super(eventManager.getDamage(), eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "Undead Camp", centerLocation);
|
||||
super(eventManager.getClans().getDisguiseManager(), eventManager.getClans().getProjectile(), eventManager.getDamage(),
|
||||
eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "Undead Camp", centerLocation);
|
||||
|
||||
_campSize = CampSize.getCampSize(UtilServer.getPlayers().length);
|
||||
_campType = CampType.values()[getRandom().nextInt(CampType.values().length)];
|
||||
|
@ -47,7 +47,7 @@ public abstract class BossAbility<T extends EventCreature, Y extends Entity> imp
|
||||
|
||||
public int getCooldown()
|
||||
{
|
||||
return 60;
|
||||
return 3;
|
||||
}
|
||||
|
||||
public Y getEntity()
|
||||
|
@ -4,6 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -28,6 +30,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
|
||||
// Creature Data
|
||||
private String _name;
|
||||
private String _displayName;
|
||||
private boolean _useName;
|
||||
private double _health;
|
||||
private double _maxHealth;
|
||||
@ -45,6 +48,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
_spawnLocation = spawnLocation;
|
||||
|
||||
_name = name;
|
||||
_displayName = name;
|
||||
_useName = useName;
|
||||
_health = health;
|
||||
_maxHealth = health;
|
||||
@ -78,7 +82,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
|
||||
protected void updateName()
|
||||
{
|
||||
String name = _name;
|
||||
String name = _displayName;
|
||||
|
||||
if (_showHealthName)
|
||||
{
|
||||
@ -91,9 +95,16 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
name += " " + C.cWhite + "(" + healthString + C.cWhite + ")";
|
||||
}
|
||||
|
||||
_entity.setCustomName( name);
|
||||
DisguiseBase disguise = getEvent().getDisguiseManager().getDisguise(getEntity());
|
||||
|
||||
if (disguise != null && disguise instanceof DisguiseInsentient)
|
||||
{
|
||||
((DisguiseInsentient) disguise).setName(name);
|
||||
((DisguiseInsentient) disguise).setCustomNameVisible(_useName);
|
||||
}
|
||||
|
||||
_entity.setCustomName(name);
|
||||
_entity.setCustomNameVisible(_useName);
|
||||
System.out.print(name);
|
||||
}
|
||||
|
||||
public void remove()
|
||||
@ -104,7 +115,18 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
public void remove(boolean removeFromEvent)
|
||||
{
|
||||
if (_entity != null)
|
||||
_entity.remove();
|
||||
{
|
||||
if (getHealth() > 0)
|
||||
{
|
||||
_entity.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
_entity.setHealth(0);
|
||||
_entity.setCustomName("");
|
||||
_entity.setCustomNameVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (removeFromEvent)
|
||||
_event.removeCreature(this);
|
||||
@ -165,6 +187,11 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
_spawnLocation = spawnLocation;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return _displayName;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
@ -172,7 +199,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
_name = name;
|
||||
_displayName = name == null ? _name : name;
|
||||
updateName();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
@ -39,6 +41,8 @@ public abstract class WorldEvent implements Listener
|
||||
|
||||
private DamageManager _damageManager;
|
||||
private ConditionManager _conditionManager;
|
||||
private DisguiseManager _disguiseManager;
|
||||
private ProjectileManager _projectileManager;
|
||||
|
||||
private String _name;
|
||||
private EventState _state;
|
||||
@ -56,15 +60,18 @@ public abstract class WorldEvent implements Listener
|
||||
private boolean _isArcade;
|
||||
private double _difficulty = 1;
|
||||
|
||||
public WorldEvent(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager, String name,
|
||||
Location cornerLocation)
|
||||
public WorldEvent(DisguiseManager disguiseManager, ProjectileManager projectileManager, DamageManager damageManager,
|
||||
BlockRestore blockRestore, ConditionManager conditionManager, String name, Location cornerLocation)
|
||||
{
|
||||
this(damageManager, blockRestore, conditionManager, name, cornerLocation, null);
|
||||
this(disguiseManager, projectileManager, damageManager, blockRestore, conditionManager, name, cornerLocation, null);
|
||||
}
|
||||
|
||||
public WorldEvent(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager, String name,
|
||||
Location cornerLocation, String schematicName)
|
||||
public WorldEvent(DisguiseManager disguiseManager, ProjectileManager projectileManager, DamageManager damageManager,
|
||||
BlockRestore blockRestore, ConditionManager conditionManager, String name, Location cornerLocation,
|
||||
String schematicName)
|
||||
{
|
||||
_disguiseManager = disguiseManager;
|
||||
_projectileManager = projectileManager;
|
||||
_damageManager = damageManager;
|
||||
_conditionManager = conditionManager;
|
||||
|
||||
@ -94,11 +101,21 @@ public abstract class WorldEvent implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public DisguiseManager getDisguiseManager()
|
||||
{
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public ProjectileManager getProjectileManager()
|
||||
{
|
||||
return _projectileManager;
|
||||
}
|
||||
|
||||
public void setDifficulty(double difficulty)
|
||||
{
|
||||
_difficulty = difficulty;
|
||||
}
|
||||
|
||||
|
||||
public void setArcadeGame(boolean isArcade)
|
||||
{
|
||||
_isArcade = isArcade;
|
||||
@ -283,13 +300,13 @@ public abstract class WorldEvent implements Listener
|
||||
{
|
||||
return _map;
|
||||
}
|
||||
|
||||
|
||||
public void setMap(EventMap map, final Runnable onComplete)
|
||||
{
|
||||
_map = map;
|
||||
|
||||
SchematicRunnable task = new SchematicRunnable(_damageManager.getPlugin(), map.getSchematic(), _cornerLocation.getBlock(),
|
||||
new Callback<List<BlockData>>()
|
||||
SchematicRunnable task = new SchematicRunnable(_damageManager.getPlugin(), map.getSchematic(),
|
||||
_cornerLocation.getBlock(), new Callback<List<BlockData>>()
|
||||
{
|
||||
@Override
|
||||
public void run(List<BlockData> data)
|
||||
|
@ -1,6 +1,8 @@
|
||||
package mineplex.minecraft.game.core.boss.ironwizard;
|
||||
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
@ -13,9 +15,10 @@ import org.bukkit.Location;
|
||||
public class GolemBoss extends WorldEvent
|
||||
{
|
||||
|
||||
public GolemBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager, Location corner)
|
||||
public GolemBoss(DisguiseManager disguiseManager, ProjectileManager projectileManager, DamageManager damageManager,
|
||||
BlockRestore blockRestore, ConditionManager conditionManager, Location cornerLocation)
|
||||
{
|
||||
super(damageManager, blockRestore, conditionManager, "Iron Wizard", corner, "schematic/Golem.schematic");
|
||||
super(disguiseManager, projectileManager, damageManager, blockRestore, conditionManager, "Iron Wizard", cornerLocation, "schematic/Golem.schematic");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.block.schematic.Schematic;
|
||||
import mineplex.core.common.block.schematic.UtilSchematic;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.EventMap;
|
||||
@ -23,19 +24,11 @@ public class SlimeBoss extends WorldEvent
|
||||
{
|
||||
private static final int MAX_SIZE = 16;
|
||||
private static final int MIN_SIZE = 2;
|
||||
private ProjectileManager _projectileManager;
|
||||
|
||||
public SlimeBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager,
|
||||
ProjectileManager projectileManager, Location corner)
|
||||
public SlimeBoss(DisguiseManager disguiseManager, ProjectileManager projectileManager, DamageManager damageManager,
|
||||
BlockRestore blockRestore, ConditionManager conditionManager, Location cornerLocation)
|
||||
{
|
||||
super(damageManager, blockRestore, conditionManager, "Slime King", corner, "schematic/ClansSlime.schematic");
|
||||
|
||||
_projectileManager = projectileManager;
|
||||
}
|
||||
|
||||
public ProjectileManager getProjectileManager()
|
||||
{
|
||||
return _projectileManager;
|
||||
super(disguiseManager, projectileManager, damageManager, blockRestore, conditionManager, "Slime King", cornerLocation, "schematic/ClansSlime.schematic");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,6 +4,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
@ -13,10 +15,11 @@ import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
public class SnakeBoss extends WorldEvent
|
||||
{
|
||||
|
||||
public SnakeBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager,
|
||||
Location cornerLocation)
|
||||
public SnakeBoss(DisguiseManager disguiseManager, ProjectileManager projectileManager, DamageManager damageManager,
|
||||
BlockRestore blockRestore, ConditionManager conditionManager, Location cornerLocation)
|
||||
{
|
||||
super(damageManager, blockRestore, conditionManager, "Snaaaake", cornerLocation, "schematic/Golem.schematic");
|
||||
super(disguiseManager, projectileManager, damageManager, blockRestore, conditionManager, "Snaaaake", cornerLocation,
|
||||
"schematic/Golem.schematic");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,7 +67,7 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
||||
for (int i = 0; i < getHealth() / 50; i++)
|
||||
{
|
||||
SnakeSegment tail = new SnakeSegment(getSpawnLocation().toVector().subtract(dir.clone().multiply(-i)),
|
||||
new ItemStack(i == 0 ? Material.CHEST : Material.DROPPER));
|
||||
new ItemStack(i == 0 ? Material.DROPPER : Material.BEDROCK));
|
||||
|
||||
_segments.add(tail);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class SnakeSegment
|
||||
_prevDir = vec;
|
||||
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(1, 0);
|
||||
watcher.a(10, (byte) 0);
|
||||
|
||||
@ -129,7 +129,6 @@ public class SnakeSegment
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(1, 0);
|
||||
|
||||
packet.a = getId();
|
||||
@ -140,6 +139,7 @@ public class SnakeSegment
|
||||
|
||||
if (_item != null)
|
||||
{
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(10, (byte) 0);
|
||||
|
||||
for (int i = 11; i < 17; i++)
|
||||
@ -162,6 +162,7 @@ public class SnakeSegment
|
||||
}
|
||||
else
|
||||
{
|
||||
watcher.a(0, (byte) 0);
|
||||
packet.b = EntityType.MAGMA_CUBE.getTypeId();
|
||||
|
||||
return new Packet[]
|
||||
|
@ -4,6 +4,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
@ -13,11 +15,11 @@ import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
public class SpiderBoss extends WorldEvent
|
||||
{
|
||||
|
||||
public SpiderBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager,
|
||||
Location cornerLocation)
|
||||
public SpiderBoss(DisguiseManager disguiseManager, ProjectileManager projectileManager, DamageManager damageManager,
|
||||
BlockRestore blockRestore, ConditionManager conditionManager, Location cornerLocation)
|
||||
{
|
||||
super(damageManager, blockRestore, conditionManager, "Brood Mother", cornerLocation, "schematic/Golem.schematic");
|
||||
super(disguiseManager, projectileManager, damageManager, blockRestore, conditionManager, "Brood Mother", cornerLocation, "schematic/Golem.schematic");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,7 +56,7 @@ public class SpiderBoss extends WorldEvent
|
||||
|
||||
public SpiderMinionCreature spawnMinion(Location location)
|
||||
{
|
||||
SpiderMinionCreature slimeCreature = new SpiderMinionCreature(this, location, 2500);
|
||||
SpiderMinionCreature slimeCreature = new SpiderMinionCreature(this, location, 5);
|
||||
registerCreature(slimeCreature);
|
||||
return slimeCreature;
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -22,14 +24,16 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import mineplex.minecraft.game.core.boss.spider.attacks.SpiderCeilingCling;
|
||||
import mineplex.minecraft.game.core.boss.spider.attacks.SpiderEggplosm;
|
||||
|
||||
public class SpiderCreature extends EventCreature<Spider>
|
||||
public class SpiderCreature extends EventCreature<Pig>
|
||||
{
|
||||
private ArrayList<BossAbility> _currentAbilities = new ArrayList<BossAbility>();
|
||||
private int _lastAbility;
|
||||
@ -37,10 +41,26 @@ public class SpiderCreature extends EventCreature<Spider>
|
||||
private long _reverseWalk;
|
||||
private Location _standing;
|
||||
private Vector _afkWalk = new Vector();
|
||||
private HashMap<Class, Long> _cooldowns = new HashMap<Class, Long>();
|
||||
|
||||
public SpiderCreature(SpiderBoss boss, Location location, double maxHealth)
|
||||
{
|
||||
super(boss, location, "Brood Mother", true, maxHealth, Spider.class);
|
||||
super(boss, location, "Brood Mother", true, maxHealth, Pig.class);
|
||||
|
||||
spawnEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntity(Pig entity)
|
||||
{
|
||||
super.setEntity(entity);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
DisguiseSpider disguise = new DisguiseSpider(getEntity());
|
||||
|
||||
((SpiderBoss) getEvent()).getDisguiseManager().disguise(disguise);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,7 +96,9 @@ public class SpiderCreature extends EventCreature<Spider>
|
||||
_lastAbility = 20;// _currentAbility.getCooldown();
|
||||
|
||||
HandlerList.unregisterAll(ability);
|
||||
System.out.print("Unregistered golem ability " + ability.getClass().getSimpleName());
|
||||
System.out.print("Unregistered spider ability " + ability.getClass().getSimpleName());
|
||||
|
||||
_cooldowns.put(ability.getClass(), System.currentTimeMillis() + (ability.getCooldown() * 1000));
|
||||
}
|
||||
else if (!ability.inProgress())
|
||||
{
|
||||
@ -102,18 +124,31 @@ public class SpiderCreature extends EventCreature<Spider>
|
||||
{// Egg explosion
|
||||
ArrayList<Player> players = getPlayers(dist, 30);
|
||||
|
||||
if (!players.isEmpty())
|
||||
if (getHealthPercent() < 0.8 && !players.isEmpty())
|
||||
{
|
||||
weight.put(SpiderEggplosm.class, 4);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Web hang
|
||||
weight.put(SpiderCeilingCling.class, 2);
|
||||
}
|
||||
}
|
||||
|
||||
for (BossAbility ability : _currentAbilities)
|
||||
{
|
||||
weight.remove(ability.getClass());
|
||||
}
|
||||
|
||||
for (Class c : _cooldowns.keySet())
|
||||
{
|
||||
if (_cooldowns.get(c) > System.currentTimeMillis())
|
||||
{
|
||||
weight.remove(c);
|
||||
}
|
||||
}
|
||||
|
||||
BossAbility ability = null;
|
||||
|
||||
if (!weight.isEmpty())
|
||||
@ -139,7 +174,7 @@ public class SpiderCreature extends EventCreature<Spider>
|
||||
{
|
||||
ability = (BossAbility) entry.getKey().getConstructor(SpiderCreature.class).newInstance(this);
|
||||
|
||||
if (ability.getTarget() == null)
|
||||
if (ability.getTarget() == null || ability.hasFinished())
|
||||
{
|
||||
ability = null;
|
||||
}
|
||||
@ -265,8 +300,8 @@ public class SpiderCreature extends EventCreature<Spider>
|
||||
{
|
||||
// if (vec.length() > 1)
|
||||
{
|
||||
UtilEnt.CreatureMoveFast(getEntity(), getEntity().getLocation().add(vec),
|
||||
(target != null ? 1.8F : 1.1F) + (superWalk ? 0.4F : 0));
|
||||
UtilEnt.CreatureMoveFast(getEntity(), getEntity().getLocation().add(vec), (target != null ? 1.8F : 1.1F)
|
||||
+ (superWalk ? 0.4F : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package mineplex.minecraft.game.core.boss.spider;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.CaveSpider;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@ -12,21 +12,46 @@ import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguiseCaveSpider;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
|
||||
public class SpiderMinionCreature extends EventCreature<CaveSpider>
|
||||
public class SpiderMinionCreature extends EventCreature<Pig>
|
||||
{
|
||||
private long _lastAttack;
|
||||
|
||||
public SpiderMinionCreature(SpiderBoss boss, Location location, double maxHealth)
|
||||
{
|
||||
super(boss, location, "Spider Minion", false, maxHealth, CaveSpider.class);
|
||||
super(boss, location, "Spider Minion", false, maxHealth, Pig.class);
|
||||
|
||||
DisguiseCaveSpider disguise = new DisguiseCaveSpider(null);
|
||||
|
||||
boss.getDisguiseManager().addFutureDisguise(disguise);
|
||||
spawnEntity();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@Override
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (getEntity() == null || getEntity().isDead() || !getEntity().isValid())
|
||||
{
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spawnCustom()
|
||||
{
|
||||
UtilEnt.Vegetate(getEntity());
|
||||
|
||||
getEntity().setVelocity(new Vector(UtilMath.rr(0.5, true), 0.5, UtilMath.rr(0.5, true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,24 +67,30 @@ public class SpiderMinionCreature extends EventCreature<CaveSpider>
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = UtilPlayer.getClosest(getEntity().getLocation());
|
||||
|
||||
UtilEnt.CreatureMoveFast(getEntity(), target.getLocation(), 1.4F);
|
||||
|
||||
if (UtilMath.r(50) == 0)
|
||||
{
|
||||
getEntity().getWorld().playSound(getEntity().getLocation(), Sound.SPIDER_IDLE, 2.5F, 1);
|
||||
}
|
||||
|
||||
if (target.getLocation().distance(getEntity().getLocation()) < 2)
|
||||
Player target = UtilPlayer.getClosest(getEntity().getLocation());
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilEnt.CreatureMoveFast(getEntity(), target.getLocation(), 1F);
|
||||
|
||||
if (UtilTime.elapsed(_lastAttack, 3000) && target.getLocation().distance(getEntity().getLocation()) < 2)
|
||||
{
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
Vector vec = UtilAlg.getTrajectory2d(getEntity(), target);
|
||||
vec.multiply(0.4).setY(0.3);
|
||||
|
||||
getEntity().setVelocity(vec);
|
||||
|
||||
getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.ENTITY_ATTACK,
|
||||
6 * getDifficulty(), true, false, false, "Spider Minion Attack", "Spider Minion Attack");
|
||||
2 * getDifficulty(), true, false, false, "Spider Minion Attack", "Spider Minion Attack");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,199 @@
|
||||
package mineplex.minecraft.game.core.boss.spider.attacks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.disguise.disguises.DisguiseMonster;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.spider.SpiderBoss;
|
||||
import mineplex.minecraft.game.core.boss.spider.SpiderCreature;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class SpiderCeilingCling extends BossAbility<SpiderCreature, Pig>
|
||||
{
|
||||
private double _startedHealth;
|
||||
private boolean _isClinging;
|
||||
private int _tick;
|
||||
private Location _clingTo;
|
||||
private double _y;
|
||||
|
||||
public SpiderCeilingCling(SpiderCreature creature)
|
||||
{
|
||||
super(creature);
|
||||
|
||||
_startedHealth = creature.getHealth();
|
||||
_y = getLocation().getY();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Location loc = getLocation().add(UtilMath.rr(10, true), 12, UtilMath.rr(10, true));
|
||||
|
||||
if (UtilAlg.HasSight(getLocation(), loc))
|
||||
{
|
||||
while (loc.getBlock().getRelative(BlockFace.UP).getType() == Material.AIR)
|
||||
{
|
||||
loc.add(0, 1, 0);
|
||||
}
|
||||
|
||||
if (UtilAlg.HasSight(getLocation(), loc))
|
||||
{
|
||||
_clingTo = loc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMove()
|
||||
{
|
||||
return !_isClinging;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCooldown()
|
||||
{
|
||||
return 90;
|
||||
}
|
||||
|
||||
public Player getTarget()
|
||||
{
|
||||
List<Player> targets = UtilPlayer.getNearby(getLocation(), 35, true);
|
||||
|
||||
Collections.shuffle(targets);
|
||||
|
||||
for (Player player : targets)
|
||||
{
|
||||
if (UtilAlg.HasSight(getLocation(), player))
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFinished()
|
||||
{
|
||||
return _clingTo == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inProgress()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (!event.GetDamageeEntity().equals(getEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_isClinging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.SetKnockback(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFinished()
|
||||
{
|
||||
getBoss().setUseName(true);
|
||||
getBoss().setShowHealthName(true);
|
||||
getBoss().setName(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if (_tick == 0)
|
||||
{
|
||||
getBoss().setUseName(false);
|
||||
getBoss().setShowHealthName(false);
|
||||
getBoss().setName("Dinnerbone");
|
||||
}
|
||||
|
||||
if (!_isClinging)
|
||||
{
|
||||
if (getLocation().distance(_clingTo) < 1)
|
||||
{
|
||||
_isClinging = true;
|
||||
}
|
||||
else if (!UtilBlock.airFoliage(getLocation().getBlock().getRelative(BlockFace.UP)) && getLocation().getY() - _y > 10)
|
||||
{
|
||||
_isClinging = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (_isClinging)
|
||||
{
|
||||
getEntity().setVelocity(new Vector(0, 1, 0));
|
||||
|
||||
if (_tick % 20 == 0)
|
||||
{
|
||||
Player target = getTarget();
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
Item item = getLocation().getWorld().dropItem(getLocation(), new ItemStack(Material.SLIME_BALL));
|
||||
|
||||
item.setVelocity(UtilAlg.getTrajectory(getEntity(), target));
|
||||
|
||||
new SpiderPoison(getBoss(), item);
|
||||
|
||||
getLocation().getWorld().playSound(getLocation(), Sound.CREEPER_HISS, 2, 0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (_tick > 30 * 20 || _startedHealth - getBoss().getHealth() > 150)
|
||||
{
|
||||
_isClinging = false;
|
||||
_clingTo = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (Location loc : UtilShapes.getLinesDistancedPoints(getLocation(), _clingTo, 0.1))
|
||||
{
|
||||
if (i++ % 3 == _tick % 3)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, loc, 0F, 0F, 0F, 0, 1, ViewDist.NORMAL,
|
||||
UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
|
||||
getEntity().setVelocity(UtilAlg.getTrajectory(getLocation(), _clingTo).multiply(0.4));
|
||||
}
|
||||
|
||||
_tick++;
|
||||
}
|
||||
|
||||
}
|
@ -13,8 +13,10 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -36,9 +38,9 @@ import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.MovingObjectPosition;
|
||||
import net.minecraft.server.v1_7_R4.Vec3D;
|
||||
|
||||
public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
public class SpiderEggplosm extends BossAbility<SpiderCreature, Pig>
|
||||
{
|
||||
private int _eggsToSpray = 30;
|
||||
private int _eggsToSpray = 25;
|
||||
private HashMap<Block, Long> _eggs = new HashMap<Block, Long>();
|
||||
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
|
||||
private int _tick;
|
||||
@ -49,9 +51,16 @@ public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
{
|
||||
super(creature);
|
||||
|
||||
_eggsToSpray = 5 + (int) Math.ceil(30 * (1 - creature.getHealthPercent()));
|
||||
|
||||
_addYaw = 360F / _eggsToSpray;
|
||||
}
|
||||
|
||||
public int getCooldown()
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMove()
|
||||
{
|
||||
@ -77,9 +86,14 @@ public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
_eggs.remove(block);
|
||||
|
||||
block.setType(Material.AIR);
|
||||
block.getWorld().playSound(block.getLocation(), Sound.FALL_BIG, 2.5F, 0F);
|
||||
block.getWorld().playSound(block.getLocation(), Sound.DIG_SNOW, 2.5F, 0F);
|
||||
block.getWorld().playSound(block.getLocation(), Sound.BURP, 2.5F, 1.5F);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(Material.SNOW_BLOCK, 0),
|
||||
block.getLocation().add(0.5, 0.4, 0.5), 0.4F, 0.4F, 0.4F, 0, 40, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(Material.DRAGON_EGG, 0),
|
||||
block.getLocation().add(0.5, 0.6, 0.5), 0.6F, 0.5F, 0.6F, 0, 100, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
block.getLocation().add(0.5, 0.6, 0.5), 0.6F, 0.5F, 0.6F, 0, 80, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
|
||||
}
|
||||
|
||||
@ -124,11 +138,13 @@ public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
|
||||
vec.setY(0).normalize().setY(0.4 + (UtilMath.rr(0.4, false)));
|
||||
|
||||
FallingBlock block = getLocation().getWorld().spawnFallingBlock(vec.toLocation(getLocation().getWorld()),
|
||||
Material.WEB, (byte) 0);
|
||||
FallingBlock block = getLocation().getWorld().spawnFallingBlock(getLocation(), Material.DRAGON_EGG, (byte) 0);
|
||||
block.setDropItem(false);
|
||||
block.setVelocity(vec);
|
||||
|
||||
_fallingBlocks.add(block);
|
||||
|
||||
getLocation().getWorld().playSound(getLocation(), Sound.SHEEP_SHEAR, 2.5F, 0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -142,14 +158,27 @@ public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
{
|
||||
itel.remove();
|
||||
entry.getKey().setType(Material.AIR);
|
||||
|
||||
entry.getKey().getWorld().playEffect(entry.getKey().getLocation(), Effect.STEP_SOUND,
|
||||
Material.DRAGON_EGG.getId());
|
||||
|
||||
((SpiderBoss) getBoss().getEvent()).spawnMinion(entry.getKey().getLocation().add(0.5, 0.1, 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEggTeleport(BlockFromToEvent event)
|
||||
{
|
||||
if (!_eggs.containsKey(event.getBlock()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
@ -170,8 +199,12 @@ public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
fallingIterator.remove();
|
||||
|
||||
Block block = cur.getLocation().getBlock();
|
||||
block.setType(Material.DRAGON_EGG);
|
||||
_eggs.put(block, System.currentTimeMillis() + 10000 + UtilMath.r(10000));
|
||||
|
||||
if (UtilBlock.airFoliage(block) || block.getType() == Material.DRAGON_EGG)
|
||||
{
|
||||
block.setType(Material.DRAGON_EGG);
|
||||
_eggs.put(block, System.currentTimeMillis() + 10000 + UtilMath.r(10000));
|
||||
}
|
||||
|
||||
// Expire
|
||||
if (cur.getTicksLived() > 400
|
||||
@ -214,8 +247,11 @@ public class SpiderEggplosm extends BossAbility<SpiderCreature, Spider>
|
||||
nmsEntity.locY -= nmsEntity.motY / f2 * 0.0500000007450581D;
|
||||
nmsEntity.locZ -= nmsEntity.motZ / f2 * 0.0500000007450581D;
|
||||
|
||||
block.setType(Material.DRAGON_EGG);
|
||||
_eggs.put(block, System.currentTimeMillis() + 10000 + UtilMath.r(10000));
|
||||
if (UtilBlock.airFoliage(block) || block.getType() == Material.DRAGON_EGG)
|
||||
{
|
||||
block.setType(Material.DRAGON_EGG);
|
||||
_eggs.put(block, System.currentTimeMillis() + 10000 + UtilMath.r(10000));
|
||||
}
|
||||
|
||||
fallingIterator.remove();
|
||||
cur.remove();
|
||||
|
@ -0,0 +1,65 @@
|
||||
package mineplex.minecraft.game.core.boss.spider.attacks;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.minecraft.game.core.boss.spider.SpiderBoss;
|
||||
import mineplex.minecraft.game.core.boss.spider.SpiderCreature;
|
||||
|
||||
public class SpiderPoison implements IThrown
|
||||
{
|
||||
private SpiderCreature _boss;
|
||||
|
||||
public SpiderPoison(SpiderCreature boss, Item item)
|
||||
{
|
||||
_boss = boss;
|
||||
|
||||
((SpiderBoss) boss.getEvent()).getProjectileManager().AddThrow(item, boss.getEntity(), this, -1, true, true, true, false,
|
||||
2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target instanceof Player)
|
||||
{
|
||||
_boss.getEvent().getCondition().Factory().Poison("Spider Poison", target, _boss.getEntity(), 60, 1, false, true,
|
||||
false);
|
||||
_boss.getEvent().getDamageManager().NewDamageEvent(target, _boss.getEntity(), null, DamageCause.PROJECTILE, 2, true,
|
||||
false, false, "Spider Poison", "Spider Poison");
|
||||
}
|
||||
|
||||
burst(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
burst(data);
|
||||
}
|
||||
|
||||
private void burst(ProjectileUser data)
|
||||
{
|
||||
data.GetThrown().remove();
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.ICON_CRACK.getParticle(Material.SLIME_BALL, 0), data.GetThrown().getLocation(),
|
||||
0.3F, 0.3F, 0.3F, 0, 30, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
burst(data);
|
||||
}
|
||||
|
||||
}
|
@ -23,6 +23,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
import mineplex.minecraft.game.core.boss.slimeking.SlimeBoss;
|
||||
import mineplex.minecraft.game.core.boss.spider.SpiderBoss;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
@ -38,12 +39,12 @@ import nautilus.game.arcade.kit.Kit;
|
||||
public class BossBattles extends TeamGame
|
||||
{
|
||||
private WorldEvent _currentBoss;
|
||||
private BattleBoss _chosenBoss = BattleBoss.values()[UtilMath
|
||||
.r(BattleBoss.values().length)];
|
||||
private BattleBoss _chosenBoss = BattleBoss.values()[UtilMath.r(BattleBoss
|
||||
.values().length)];
|
||||
private ArrayList<BossDisplay> _displays = new ArrayList<BossDisplay>();
|
||||
|
||||
public BossBattles(ArcadeManager manager)
|
||||
{
|
||||
{
|
||||
super(manager, GameType.BossBattles, new Kit[]
|
||||
{
|
||||
new KitBrute(manager), new KitRanger(manager),
|
||||
@ -51,7 +52,7 @@ public class BossBattles extends TeamGame
|
||||
new KitAssassin(manager),
|
||||
}, new String[]
|
||||
{
|
||||
"Fight some bosses"
|
||||
"Fight some bosses"
|
||||
});
|
||||
|
||||
HungerSet = 20;
|
||||
@ -242,8 +243,8 @@ public class BossBattles extends TeamGame
|
||||
{
|
||||
Location loc = locations.get(i).clone();
|
||||
|
||||
loc.setDirection(UtilAlg.getTrajectory(loc,
|
||||
Manager.GetLobby().GetSpawn()));
|
||||
loc.setDirection(UtilAlg.getTrajectory(loc, Manager.GetLobby()
|
||||
.GetSpawn()));
|
||||
|
||||
Constructor<? extends BossDisplay> constructor = boss
|
||||
.getBossDisplay().getConstructor(BossBattles.class,
|
||||
@ -260,8 +261,8 @@ public class BossBattles extends TeamGame
|
||||
|
||||
_displays.add(bossDisplay);
|
||||
|
||||
System.out.print(
|
||||
"Registered " + bossDisplay.getClass().getSimpleName());
|
||||
System.out.print("Registered "
|
||||
+ bossDisplay.getClass().getSimpleName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -305,21 +306,13 @@ public class BossBattles extends TeamGame
|
||||
{
|
||||
for (Constructor<?> con : clazz.getConstructors())
|
||||
{
|
||||
if (clazz != SlimeBoss.class)
|
||||
{
|
||||
worldEvent = (WorldEvent) con.newInstance(
|
||||
getArcadeManager().GetDamage(),
|
||||
getArcadeManager().GetBlockRestore(),
|
||||
getArcadeManager().GetCondition(), centerLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldEvent = (WorldEvent) con.newInstance(
|
||||
getArcadeManager().GetDamage(),
|
||||
getArcadeManager().GetBlockRestore(),
|
||||
getArcadeManager().GetCondition(),
|
||||
getArcadeManager().GetProjectile(), centerLocation);
|
||||
}
|
||||
|
||||
worldEvent = (WorldEvent) con.newInstance(getArcadeManager()
|
||||
.GetDisguise(), getArcadeManager().GetProjectile(),
|
||||
getArcadeManager().GetDamage(), getArcadeManager()
|
||||
.GetBlockRestore(), getArcadeManager()
|
||||
.GetCondition(), centerLocation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -332,8 +325,8 @@ public class BossBattles extends TeamGame
|
||||
|
||||
private void setNewBoss(BattleBoss boss)
|
||||
{
|
||||
_currentBoss = createInstance(boss.getBoss(),
|
||||
new Location(WorldData.World, 0, 6, 0));
|
||||
_currentBoss = createInstance(boss.getBoss(), new Location(
|
||||
WorldData.World, 0, 6, 0));
|
||||
|
||||
_currentBoss.setArcadeGame(true);
|
||||
_currentBoss.setDifficulty(0.6);
|
||||
|
Loading…
Reference in New Issue
Block a user