Further improve raids
This commit is contained in:
parent
97efeca225
commit
9da5b367fd
@ -14,6 +14,7 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
|
import mineplex.core.blood.Blood;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
@ -67,6 +68,8 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
|||||||
|
|
||||||
_skillFactory = skillFactory;
|
_skillFactory = skillFactory;
|
||||||
|
|
||||||
|
new Blood(plugin);
|
||||||
|
|
||||||
_raidManager = new RaidManager(plugin);
|
_raidManager = new RaidManager(plugin);
|
||||||
|
|
||||||
updateNextEventTime();
|
updateNextEventTime();
|
||||||
|
@ -2,6 +2,15 @@ package mineplex.game.clans.clans.worldevent.api;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -13,15 +22,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
|
||||||
|
|
||||||
public abstract class EventCreature<T extends LivingEntity> implements Listener
|
public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||||
{
|
{
|
||||||
protected static final boolean DEBUG_MODE = true;
|
protected static final boolean DEBUG_MODE = true;
|
||||||
@ -75,7 +75,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
|||||||
{
|
{
|
||||||
return getEvent().getDifficulty();
|
return getEvent().getDifficulty();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void spawnEntity()
|
protected void spawnEntity()
|
||||||
{
|
{
|
||||||
Location spawnLocation = _entity == null ? _spawnLocation : _entity.getLocation();
|
Location spawnLocation = _entity == null ? _spawnLocation : _entity.getLocation();
|
||||||
@ -352,7 +352,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.GetDamageeEntity().equals(_entity))
|
if (!event.GetDamageeEntity().equals(_entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -362,6 +362,8 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
|||||||
|
|
||||||
applyDamage(event.GetDamage());
|
applyDamage(event.GetDamage());
|
||||||
updateName();
|
updateName();
|
||||||
|
|
||||||
|
_lastDamaged = System.currentTimeMillis();
|
||||||
|
|
||||||
_event.updateLastActive();
|
_event.updateLastActive();
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public abstract class WorldEvent implements Listener, ScoreboardElement
|
|||||||
|
|
||||||
public void registerCreature(EventCreature<?> creature)
|
public void registerCreature(EventCreature<?> creature)
|
||||||
{
|
{
|
||||||
UtilServer.getServer().getPluginManager().registerEvents(creature, UtilServer.getPlugin());
|
UtilServer.RegisterEvents(creature);
|
||||||
_creatures.add(creature);
|
_creatures.add(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ public abstract class WorldEvent implements Listener, ScoreboardElement
|
|||||||
}
|
}
|
||||||
setState(EventState.LIVE);
|
setState(EventState.LIVE);
|
||||||
customStart();
|
customStart();
|
||||||
Bukkit.getPluginManager().registerEvents(this, UtilServer.getPlugin());
|
UtilServer.RegisterEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void announceStart()
|
public void announceStart()
|
||||||
|
@ -47,12 +47,12 @@ public abstract class RaidChallenge<T extends RaidWorldEvent> implements Listene
|
|||||||
|
|
||||||
public void complete()
|
public void complete()
|
||||||
{
|
{
|
||||||
complete(false);
|
complete(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void complete(boolean onDisable)
|
public void complete(boolean allowCustom)
|
||||||
{
|
{
|
||||||
if (!onDisable)
|
if (allowCustom)
|
||||||
{
|
{
|
||||||
customComplete();
|
customComplete();
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,10 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.utils.UtilScheduler;
|
import mineplex.core.utils.UtilScheduler;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.worldevent.api.EventState;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.command.StartRaidCommand;
|
import mineplex.game.clans.clans.worldevent.raid.command.StartRaidCommand;
|
||||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||||
@ -108,8 +110,8 @@ public class RaidManager extends MiniPlugin
|
|||||||
inside.forEach(in -> UtilPlayer.message(in, F.main(type.getRaidName() + " Raid", "Summoning ancient power...")));
|
inside.forEach(in -> UtilPlayer.message(in, F.main(type.getRaidName() + " Raid", "Summoning ancient power...")));
|
||||||
createNewRaid(type, raid -> inside.forEach(in ->
|
createNewRaid(type, raid -> inside.forEach(in ->
|
||||||
{
|
{
|
||||||
raid.addPlayer(player);
|
raid.addPlayer(in);
|
||||||
player.getWorld().strikeLightningEffect(player.getLocation());
|
in.getWorld().strikeLightningEffect(in.getLocation());
|
||||||
}));
|
}));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -126,6 +128,7 @@ public class RaidManager extends MiniPlugin
|
|||||||
RaidWorldEvent event = type.getClazz().getConstructor(WorldData.class, RaidManager.class).newInstance(data, this);
|
RaidWorldEvent event = type.getClazz().getConstructor(WorldData.class, RaidManager.class).newInstance(data, this);
|
||||||
raidConsumer.accept(event);
|
raidConsumer.accept(event);
|
||||||
event.start();
|
event.start();
|
||||||
|
_raids.add(event);
|
||||||
}
|
}
|
||||||
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e)
|
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e)
|
||||||
{
|
{
|
||||||
@ -139,6 +142,28 @@ public class RaidManager extends MiniPlugin
|
|||||||
data.LoadChecker = task;
|
data.LoadChecker = task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void update(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() == UpdateType.TICK)
|
||||||
|
{
|
||||||
|
UtilServer.getPlayersCollection()
|
||||||
|
.stream()
|
||||||
|
.filter(player -> isInRaid(player.getLocation()))
|
||||||
|
.forEach(player ->
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().getItemMapManager().removeMap(player);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_raids.removeIf(e -> e.getState() == EventState.STOPPED);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteract(PlayerInteractEvent event)
|
public void onInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
|
@ -9,10 +9,12 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
@ -38,10 +40,12 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
|
|
||||||
protected final int Id;
|
protected final int Id;
|
||||||
|
|
||||||
protected List<Player> Players = new ArrayList<>();
|
private List<Player> _players = new ArrayList<>();
|
||||||
|
|
||||||
protected long _forceEnd = -1;
|
protected long _forceEnd = -1;
|
||||||
|
|
||||||
|
private boolean _cleanup = false;
|
||||||
|
|
||||||
public RaidWorldEvent(String name, WorldData data, RaidManager manager)
|
public RaidWorldEvent(String name, WorldData data, RaidManager manager)
|
||||||
{
|
{
|
||||||
super(name, new Location(data.World, data.MinX + ((data.MaxX - data.MinX) / 2), data.MinY + ((data.MaxY - data.MinY) / 2), data.MinZ + ((data.MaxZ - data.MinZ) / 2)), UtilMath.getMax((data.MaxX - data.MinX) / 2, (data.MaxY - data.MinY) / 2, (data.MaxZ - data.MinZ) / 2), false, manager.getDisguiseManager(), manager.getProjectileManager(), manager.getDamageManager(), manager.getBlockRestore(), manager.getConditionManager());
|
super(name, new Location(data.World, data.MinX + ((data.MaxX - data.MinX) / 2), data.MinY + ((data.MaxY - data.MinY) / 2), data.MinZ + ((data.MaxZ - data.MinZ) / 2)), UtilMath.getMax((data.MaxX - data.MinX) / 2, (data.MaxY - data.MinY) / 2, (data.MaxZ - data.MinZ) / 2), false, manager.getDisguiseManager(), manager.getProjectileManager(), manager.getDamageManager(), manager.getBlockRestore(), manager.getConditionManager());
|
||||||
@ -81,7 +85,9 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
|
|
||||||
public List<Player> getPlayers()
|
public List<Player> getPlayers()
|
||||||
{
|
{
|
||||||
return Players;
|
List<Player> players = new ArrayList<>();
|
||||||
|
players.addAll(_players);
|
||||||
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId()
|
public int getId()
|
||||||
@ -95,7 +101,7 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
_forceEnd = System.currentTimeMillis() + UtilTime.convert(90, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
_forceEnd = System.currentTimeMillis() + UtilTime.convert(90, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
||||||
int spawnIndex = 0;
|
int spawnIndex = 0;
|
||||||
List<Location> spawns = WorldData.SpawnLocs.get("Red");
|
List<Location> spawns = WorldData.SpawnLocs.get("Red");
|
||||||
for (Player player : Players)
|
for (Player player : _players)
|
||||||
{
|
{
|
||||||
if (spawnIndex >= spawns.size())
|
if (spawnIndex >= spawns.size())
|
||||||
{
|
{
|
||||||
@ -110,21 +116,28 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
@Override
|
@Override
|
||||||
public void customCleanup(boolean onDisable)
|
public void customCleanup(boolean onDisable)
|
||||||
{
|
{
|
||||||
Players.forEach(player -> player.teleport(Spawn.getNorthSpawn()));
|
_cleanup = true;
|
||||||
Players.clear();
|
_players.forEach(player -> player.teleport(Spawn.getNorthSpawn()));
|
||||||
|
_players.clear();
|
||||||
|
getCreatures().forEach(creature ->
|
||||||
|
{
|
||||||
|
HandlerList.unregisterAll(creature);
|
||||||
|
creature.getEntity().remove();
|
||||||
|
});
|
||||||
|
getCreatures().clear();
|
||||||
if (onDisable)
|
if (onDisable)
|
||||||
{
|
{
|
||||||
WorldData.uninitialize();
|
WorldData.uninitialize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UtilServer.runSyncLater(WorldData::uninitialize, 120);
|
UtilServer.runSyncLater(WorldData::uninitialize, 20 * 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(Player player)
|
public void addPlayer(Player player)
|
||||||
{
|
{
|
||||||
Players.add(player);
|
_players.add(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForceEnd(long end)
|
public void setForceEnd(long end)
|
||||||
@ -143,7 +156,7 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Players.isEmpty())
|
if (_players.isEmpty())
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
@ -178,7 +191,7 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChunkUnload(ChunkUnloadEvent event)
|
public void onChunkUnload(ChunkUnloadEvent event)
|
||||||
{
|
{
|
||||||
if (getState() == EventState.STOPPED || this.getState() == EventState.REMOVED)
|
if (getState() == EventState.STOPPED || getState() == EventState.REMOVED || _cleanup)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -229,10 +242,14 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
UtilPlayer.message(player, F.main(getName(), "You cannot build here!"));
|
UtilPlayer.message(player, F.main(getName(), "You cannot build here!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onQuit(PlayerQuitEvent event)
|
public void onQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
if (Players.remove(event.getPlayer()))
|
if (_cleanup)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_players.remove(event.getPlayer()))
|
||||||
{
|
{
|
||||||
event.getPlayer().teleport(Spawn.getNorthSpawn());
|
event.getPlayer().teleport(Spawn.getNorthSpawn());
|
||||||
}
|
}
|
||||||
@ -241,22 +258,52 @@ public abstract class RaidWorldEvent extends WorldEvent
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onDie(PlayerDeathEvent event)
|
public void onDie(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
if (Players.remove(event.getEntity()))
|
if (_cleanup)
|
||||||
{
|
{
|
||||||
UtilServer.runSyncLater(() -> event.getEntity().teleport(Spawn.getNorthSpawn()), 5);
|
return;
|
||||||
|
}
|
||||||
|
if (_players.remove(event.getEntity()))
|
||||||
|
{
|
||||||
|
event.getEntity().setHealth(event.getEntity().getMaxHealth());
|
||||||
|
getCondition().Clean(event.getEntity());
|
||||||
|
event.getEntity().getActivePotionEffects().forEach(pe -> event.getEntity().removePotionEffect(pe.getType()));
|
||||||
|
event.getEntity().setExp(0);
|
||||||
|
event.getEntity().setLevel(0);
|
||||||
|
event.getEntity().teleport(Spawn.getNorthSpawn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onTeleport(PlayerTeleportEvent event)
|
||||||
|
{
|
||||||
|
if (_cleanup)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!event.getTo().getWorld().equals(WorldData.World))
|
||||||
|
{
|
||||||
|
_players.remove(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTpHome(ClansCommandExecutedEvent event)
|
public void onTpHome(ClansCommandExecutedEvent event)
|
||||||
{
|
{
|
||||||
|
if (!_players.contains(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getCommand().equalsIgnoreCase("tphome") || event.getCommand().equalsIgnoreCase("stuck"))
|
if (event.getCommand().equalsIgnoreCase("tphome") || event.getCommand().equalsIgnoreCase("stuck"))
|
||||||
{
|
{
|
||||||
if (Players.contains(event.getPlayer()))
|
event.setCancelled(true);
|
||||||
{
|
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport while in a raid!"));
|
||||||
event.setCancelled(true);
|
return;
|
||||||
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport while in a raid!"));
|
}
|
||||||
}
|
if (event.getCommand().equalsIgnoreCase("claim") || event.getCommand().equalsIgnoreCase("unclaim") || event.getCommand().equalsIgnoreCase("unclaimall") || event.getCommand().equalsIgnoreCase("homeset"))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot manage your clan's territory while in a raid!"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.Difficulty;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import mineplex.core.common.timing.TimingManager;
|
import mineplex.core.common.timing.TimingManager;
|
||||||
@ -26,8 +27,9 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.common.util.WorldUtil;
|
import mineplex.core.common.util.WorldUtil;
|
||||||
import mineplex.core.common.util.ZipUtil;
|
import mineplex.core.common.util.ZipUtil;
|
||||||
import mineplex.core.common.util.worldgen.WorldGenCleanRoom;
|
import mineplex.core.common.util.worldgen.WorldGenCleanRoom;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
|
||||||
public class WorldData
|
public class WorldData
|
||||||
{
|
{
|
||||||
public int Id = -1;
|
public int Id = -1;
|
||||||
|
|
||||||
@ -56,10 +58,10 @@ public class WorldData
|
|||||||
|
|
||||||
public WorldData(String raidName)
|
public WorldData(String raidName)
|
||||||
{
|
{
|
||||||
|
RaidName = raidName;
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
Id = getNewId();
|
Id = getNewId();
|
||||||
RaidName = raidName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> loadFiles()
|
private List<String> loadFiles()
|
||||||
@ -136,6 +138,8 @@ public class WorldData
|
|||||||
|
|
||||||
World.setDifficulty(Difficulty.HARD);
|
World.setDifficulty(Difficulty.HARD);
|
||||||
World.setGameRuleValue("showDeathMessages", "false");
|
World.setGameRuleValue("showDeathMessages", "false");
|
||||||
|
((CraftWorld)World).getHandle().allowAnimals = false;
|
||||||
|
((CraftWorld)World).getHandle().allowMonsters = false;
|
||||||
|
|
||||||
TimingManager.start("WorldData loading WorldConfig.");
|
TimingManager.start("WorldData loading WorldConfig.");
|
||||||
//Load World Data
|
//Load World Data
|
||||||
@ -380,6 +384,8 @@ public class WorldData
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
World.getPlayers().forEach(player -> player.teleport(Spawn.getNorthSpawn()));
|
||||||
|
|
||||||
//Wipe World
|
//Wipe World
|
||||||
MapUtil.UnloadWorld(UtilServer.getPlugin(), World);
|
MapUtil.UnloadWorld(UtilServer.getPlugin(), World);
|
||||||
MapUtil.ClearWorldReferences(World.getName());
|
MapUtil.ClearWorldReferences(World.getName());
|
||||||
|
@ -5,8 +5,8 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventState;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidManager;
|
import mineplex.game.clans.clans.worldevent.raid.RaidManager;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidType;
|
import mineplex.game.clans.clans.worldevent.raid.RaidType;
|
||||||
@ -18,10 +18,11 @@ import mineplex.game.clans.clans.worldevent.raid.wither.challenge.seven.Challeng
|
|||||||
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.three.ChallengeThree;
|
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.three.ChallengeThree;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.two.ChallengeTwo;
|
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.two.ChallengeTwo;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
|
|
||||||
public class WitherRaid extends RaidWorldEvent
|
public class WitherRaid extends RaidWorldEvent
|
||||||
{
|
{
|
||||||
private final List<Class<? extends RaidChallenge<WitherRaid>>> _challenges = new LinkedList<>();
|
private List<Class<? extends RaidChallenge<WitherRaid>>> _challenges;
|
||||||
private RaidChallenge<WitherRaid> _currentChallenge;
|
private RaidChallenge<WitherRaid> _currentChallenge;
|
||||||
|
|
||||||
public WitherRaid(mineplex.game.clans.clans.worldevent.raid.WorldData data, RaidManager manager)
|
public WitherRaid(mineplex.game.clans.clans.worldevent.raid.WorldData data, RaidManager manager)
|
||||||
@ -53,7 +54,7 @@ public class WitherRaid extends RaidWorldEvent
|
|||||||
private void teleportToAltar()
|
private void teleportToAltar()
|
||||||
{
|
{
|
||||||
Location altar = WorldData.getCustomLocs("MAIN_ALTAR").get(0);
|
Location altar = WorldData.getCustomLocs("MAIN_ALTAR").get(0);
|
||||||
Players.forEach(player -> player.teleport(altar));
|
getPlayers().forEach(player -> player.teleport(altar));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,6 +62,7 @@ public class WitherRaid extends RaidWorldEvent
|
|||||||
{
|
{
|
||||||
WorldData.World.setGameRuleValue("doDaylightCycle", "false");
|
WorldData.World.setGameRuleValue("doDaylightCycle", "false");
|
||||||
WorldData.World.setTime(14000);
|
WorldData.World.setTime(14000);
|
||||||
|
_challenges = new LinkedList<>();
|
||||||
_challenges.add(ChallengeOne.class);
|
_challenges.add(ChallengeOne.class);
|
||||||
_challenges.add(ChallengeTwo.class);
|
_challenges.add(ChallengeTwo.class);
|
||||||
_challenges.add(ChallengeThree.class);
|
_challenges.add(ChallengeThree.class);
|
||||||
@ -83,7 +85,10 @@ public class WitherRaid extends RaidWorldEvent
|
|||||||
{
|
{
|
||||||
if (_currentChallenge.isComplete())
|
if (_currentChallenge.isComplete())
|
||||||
{
|
{
|
||||||
teleportToAltar();
|
if (_challenges.size() < 6)
|
||||||
|
{
|
||||||
|
teleportToAltar();
|
||||||
|
}
|
||||||
nextChallenge();
|
nextChallenge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +99,16 @@ public class WitherRaid extends RaidWorldEvent
|
|||||||
{
|
{
|
||||||
if (_currentChallenge != null)
|
if (_currentChallenge != null)
|
||||||
{
|
{
|
||||||
_currentChallenge.complete(getState() == EventState.REMOVED);
|
_currentChallenge.complete(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockToss(SkillTriggerEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetSkillName().equals("Block Toss") && getPlayers().contains(event.GetPlayer()))
|
||||||
|
{
|
||||||
|
event.SetCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
@ -19,6 +20,7 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
||||||
|
import mineplex.game.clans.clans.worldevent.api.EventCreatureDeathEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.creature.archer.DecayingArcher;
|
import mineplex.game.clans.clans.worldevent.raid.wither.creature.archer.DecayingArcher;
|
||||||
@ -82,6 +84,8 @@ public class ChallengeFive extends RaidChallenge<WitherRaid>
|
|||||||
_gates.add(new IronGate(this, getRaid().getWorldData().getCustomLocs("C_FIVE_G" + i), creatures));
|
_gates.add(new IronGate(this, getRaid().getWorldData().getCustomLocs("C_FIVE_G" + i), creatures));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
_goliath = new Goliath(this, getRaid().getWorldData().getCustomLocs("C_FIVE_GIANT").get(0));
|
||||||
|
getRaid().registerCreature(_goliath);
|
||||||
getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Use the third gate!")));
|
getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Use the third gate!")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +103,7 @@ public class ChallengeFive extends RaidChallenge<WitherRaid>
|
|||||||
gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
||||||
gate.setType(Material.SKULL);
|
gate.setType(Material.SKULL);
|
||||||
gate.setData((byte)1);
|
gate.setData((byte)1);
|
||||||
|
_altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), new ItemStack(Material.EMERALD, UtilMath.rRange(15, 17)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -124,7 +129,7 @@ public class ChallengeFive extends RaidChallenge<WitherRaid>
|
|||||||
{
|
{
|
||||||
Location to = gate.getCenter().clone();
|
Location to = gate.getCenter().clone();
|
||||||
to.setY(_goliath.getEntity().getLocation().getY());
|
to.setY(_goliath.getEntity().getLocation().getY());
|
||||||
_goliath.getEntity().setVelocity(UtilAlg.getTrajectory(_goliath.getEntity().getLocation(), to).normalize().multiply(0.5));
|
_goliath.getEntity().setVelocity(UtilAlg.getTrajectory(_goliath.getEntity().getLocation(), to).normalize().multiply(0.15));
|
||||||
}
|
}
|
||||||
if (gate.update())
|
if (gate.update())
|
||||||
{
|
{
|
||||||
@ -161,4 +166,16 @@ public class ChallengeFive extends RaidChallenge<WitherRaid>
|
|||||||
event.SetCancelled(true);
|
event.SetCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onDeath(EventCreatureDeathEvent event)
|
||||||
|
{
|
||||||
|
if (event.getCreature().getEvent() instanceof WitherRaid)
|
||||||
|
{
|
||||||
|
if (((WitherRaid)event.getCreature().getEvent()).getId() == getRaid().getId())
|
||||||
|
{
|
||||||
|
_gates.forEach(gate -> gate.handleDeath(event.getCreature()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -64,19 +64,16 @@ public class IronGate
|
|||||||
|
|
||||||
public boolean update()
|
public boolean update()
|
||||||
{
|
{
|
||||||
int alive = 0;
|
if (_guardians.size() < 1)
|
||||||
for (EventCreature<?> guardian : _guardians)
|
|
||||||
{
|
|
||||||
if (guardian.getHealth() > 0)
|
|
||||||
{
|
|
||||||
alive++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (alive < 0)
|
|
||||||
{
|
{
|
||||||
open();
|
open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleDeath(EventCreature<?> creature)
|
||||||
|
{
|
||||||
|
_guardians.remove(creature);
|
||||||
|
}
|
||||||
}
|
}
|
@ -9,7 +9,9 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -18,7 +20,6 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.creature.silverfish.PitSwarmer;
|
|
||||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
|
|
||||||
public class ChallengeFour extends RaidChallenge<WitherRaid>
|
public class ChallengeFour extends RaidChallenge<WitherRaid>
|
||||||
@ -26,6 +27,7 @@ public class ChallengeFour extends RaidChallenge<WitherRaid>
|
|||||||
private Location _altar;
|
private Location _altar;
|
||||||
private boolean _teleported = false;
|
private boolean _teleported = false;
|
||||||
private List<FakeBlock> _blocks = new ArrayList<>();
|
private List<FakeBlock> _blocks = new ArrayList<>();
|
||||||
|
private double[] _damageYRange = new double[2];
|
||||||
|
|
||||||
public ChallengeFour(WitherRaid raid)
|
public ChallengeFour(WitherRaid raid)
|
||||||
{
|
{
|
||||||
@ -41,26 +43,6 @@ public class ChallengeFour extends RaidChallenge<WitherRaid>
|
|||||||
UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Complete the parkour!"));
|
UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Complete the parkour!"));
|
||||||
player.teleport(getRaid().getWorldData().getCustomLocs("C_FOUR_ENTER").get(0));
|
player.teleport(getRaid().getWorldData().getCustomLocs("C_FOUR_ENTER").get(0));
|
||||||
});
|
});
|
||||||
Location pos1 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(0);
|
|
||||||
Location pos2 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(1);
|
|
||||||
int minX = Math.min(pos1.getBlockX(), pos2.getBlockX());
|
|
||||||
int maxX = Math.max(pos1.getBlockX(), pos2.getBlockX());
|
|
||||||
int minY = Math.min(pos1.getBlockY(), pos2.getBlockY());
|
|
||||||
int maxY = Math.max(pos1.getBlockY(), pos2.getBlockY());
|
|
||||||
int minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ());
|
|
||||||
int maxZ = Math.max(pos1.getBlockZ(), pos2.getBlockZ());
|
|
||||||
|
|
||||||
for (int x = minX; x <= maxX; x++)
|
|
||||||
{
|
|
||||||
for (int y = minY; y <= maxY; y++)
|
|
||||||
{
|
|
||||||
for (int z = minZ; z <= maxZ; z++)
|
|
||||||
{
|
|
||||||
Block block = getRaid().getWorldData().World.getBlockAt(x, y, z);
|
|
||||||
getRaid().registerCreature(new PitSwarmer(this, block.getLocation()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,8 +51,13 @@ public class ChallengeFour extends RaidChallenge<WitherRaid>
|
|||||||
for (Location loc : getRaid().getWorldData().getCustomLocs("C_FOUR_FB"))
|
for (Location loc : getRaid().getWorldData().getCustomLocs("C_FOUR_FB"))
|
||||||
{
|
{
|
||||||
loc.getBlock().setType(Material.NETHER_BRICK);
|
loc.getBlock().setType(Material.NETHER_BRICK);
|
||||||
|
_blocks.add(new FakeBlock(this, loc.getBlock()));
|
||||||
}
|
}
|
||||||
getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Use the second gate!")));
|
getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Use the second gate!")));
|
||||||
|
Location pos1 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(0);
|
||||||
|
Location pos2 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(1);
|
||||||
|
_damageYRange[0] = Math.min(pos1.getY(), pos2.getY());
|
||||||
|
_damageYRange[1] = Math.max(pos1.getY(), pos2.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -87,12 +74,13 @@ public class ChallengeFour extends RaidChallenge<WitherRaid>
|
|||||||
gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
||||||
gate.setType(Material.SKULL);
|
gate.setType(Material.SKULL);
|
||||||
gate.setData((byte)1);
|
gate.setData((byte)1);
|
||||||
|
_altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), new ItemStack(Material.EMERALD, UtilMath.rRange(13, 17)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onUpdate(UpdateEvent event)
|
public void onUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.SEC)
|
if (event.getType() == UpdateType.SEC && _teleported)
|
||||||
{
|
{
|
||||||
for (Player player : getRaid().getPlayers())
|
for (Player player : getRaid().getPlayers())
|
||||||
{
|
{
|
||||||
@ -101,6 +89,10 @@ public class ChallengeFour extends RaidChallenge<WitherRaid>
|
|||||||
complete();
|
complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (player.getLocation().getY() <= _damageYRange[1] && player.getLocation().getY() >= _damageYRange[0])
|
||||||
|
{
|
||||||
|
getRaid().getDamageManager().NewDamageEvent(player, null, null, DamageCause.LAVA, 1, false, true, true, "Burning Cavern", "Hot Ground");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
|
@ -26,6 +26,7 @@ public class FakeBlock
|
|||||||
{
|
{
|
||||||
_block.setType(Material.AIR);
|
_block.setType(Material.AIR);
|
||||||
aired = true;
|
aired = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class ChallengeOne extends RaidChallenge<WitherRaid>
|
|||||||
{
|
{
|
||||||
for (Player player : getRaid().getPlayers())
|
for (Player player : getRaid().getPlayers())
|
||||||
{
|
{
|
||||||
if (UtilMath.offset(player.getLocation(), _altar) <= 5)
|
if (UtilMath.offset(player.getLocation(), _altar) <= 10)
|
||||||
{
|
{
|
||||||
_trigger = player;
|
_trigger = player;
|
||||||
complete();
|
complete();
|
||||||
|
@ -84,7 +84,7 @@ public class ChallengeSeven extends RaidChallenge<WitherRaid>
|
|||||||
UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "The evil reign of Charles Witherton is over! You will be returned to spawn in 2 minutes!"));
|
UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "The evil reign of Charles Witherton is over! You will be returned to spawn in 2 minutes!"));
|
||||||
player.teleport(_altar);
|
player.teleport(_altar);
|
||||||
});
|
});
|
||||||
List<Location> anim = UtilShapes.getCircle(_altar.clone().add(0, 2, 0), true, 3);
|
List<Location> anim = UtilShapes.getPointsInCircle(_altar.clone().add(0, 2, 0), 5, 3);
|
||||||
int emeralds = UtilMath.rRange((int)Math.ceil(45 / anim.size()), (int)Math.ceil(80 / anim.size()));
|
int emeralds = UtilMath.rRange((int)Math.ceil(45 / anim.size()), (int)Math.ceil(80 / anim.size()));
|
||||||
for (Location drop : anim)
|
for (Location drop : anim)
|
||||||
{
|
{
|
||||||
|
@ -9,8 +9,10 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -28,6 +30,7 @@ public class ChallengeThree extends RaidChallenge<WitherRaid>
|
|||||||
private List<ChallengeTorch> _torches = new ArrayList<>();
|
private List<ChallengeTorch> _torches = new ArrayList<>();
|
||||||
protected int LitTorches;
|
protected int LitTorches;
|
||||||
private long _lastSpawn;
|
private long _lastSpawn;
|
||||||
|
private int _spawnTotal;
|
||||||
|
|
||||||
public ChallengeThree(WitherRaid raid)
|
public ChallengeThree(WitherRaid raid)
|
||||||
{
|
{
|
||||||
@ -72,6 +75,7 @@ public class ChallengeThree extends RaidChallenge<WitherRaid>
|
|||||||
gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
||||||
gate.setType(Material.SKULL);
|
gate.setType(Material.SKULL);
|
||||||
gate.setData((byte)1);
|
gate.setData((byte)1);
|
||||||
|
_altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), new ItemStack(Material.EMERALD, UtilMath.rRange(10, 15)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -90,12 +94,18 @@ public class ChallengeThree extends RaidChallenge<WitherRaid>
|
|||||||
if (UtilTime.elapsed(_lastSpawn, 7000) && _teleported)
|
if (UtilTime.elapsed(_lastSpawn, 7000) && _teleported)
|
||||||
{
|
{
|
||||||
_lastSpawn = System.currentTimeMillis();
|
_lastSpawn = System.currentTimeMillis();
|
||||||
|
if (_spawnTotal > 100)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
getRaid().getWorldData().getCustomLocs("C_THREE_RC").forEach(loc ->
|
getRaid().getWorldData().getCustomLocs("C_THREE_RC").forEach(loc ->
|
||||||
{
|
{
|
||||||
|
_spawnTotal++;
|
||||||
getRaid().registerCreature(new ReanimatedCorpse(this, loc));
|
getRaid().registerCreature(new ReanimatedCorpse(this, loc));
|
||||||
});
|
});
|
||||||
getRaid().getWorldData().getCustomLocs("C_THREE_DA").forEach(loc ->
|
getRaid().getWorldData().getCustomLocs("C_THREE_DA").forEach(loc ->
|
||||||
{
|
{
|
||||||
|
_spawnTotal++;
|
||||||
getRaid().registerCreature(new DecayingArcher(this, loc));
|
getRaid().registerCreature(new DecayingArcher(this, loc));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class ChallengeTorch
|
|||||||
|
|
||||||
public void handleInteract(Block block)
|
public void handleInteract(Block block)
|
||||||
{
|
{
|
||||||
if (block.equals(_block))
|
if (block.equals(_block) && _extinguish == -1)
|
||||||
{
|
{
|
||||||
_challenge.LitTorches++;
|
_challenge.LitTorches++;
|
||||||
_extinguish = System.currentTimeMillis() + 3000;
|
_extinguish = System.currentTimeMillis() + 3000;
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.archer;
|
|||||||
|
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
@ -28,7 +29,7 @@ public class ArcherShooting extends BossAbility<DecayingArcher, Zombie>
|
|||||||
@Override
|
@Override
|
||||||
public void tick()
|
public void tick()
|
||||||
{
|
{
|
||||||
if (getEntity().getTarget() != null)
|
if (getEntity().getTarget() != null && getEntity().getTarget() instanceof Player)
|
||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_lastRope, 10000))
|
if (UtilTime.elapsed(_lastRope, 10000))
|
||||||
{
|
{
|
||||||
|
@ -2,18 +2,23 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.archer;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class DecayingArcher extends EventCreature<Zombie>
|
public class DecayingArcher extends RaidCreature<Zombie>
|
||||||
{
|
{
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
private ArcherShooting _passive;
|
private ArcherShooting _passive;
|
||||||
@ -62,4 +67,20 @@ public class DecayingArcher extends EventCreature<Zombie>
|
|||||||
|
|
||||||
_passive.tick();
|
_passive.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -2,19 +2,24 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.corpse;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class ReanimatedCorpse extends EventCreature<Zombie>
|
public class ReanimatedCorpse extends RaidCreature<Zombie>
|
||||||
{
|
{
|
||||||
private static final Material[] SWORDS = {Material.WOOD_SWORD, Material.STONE_SWORD, Material.GOLD_SWORD, Material.IRON_SWORD, Material.DIAMOND_SWORD};
|
private static final Material[] SWORDS = {Material.WOOD_SWORD, Material.STONE_SWORD, Material.GOLD_SWORD, Material.IRON_SWORD, Material.DIAMOND_SWORD};
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
@ -64,4 +69,20 @@ public class ReanimatedCorpse extends EventCreature<Zombie>
|
|||||||
|
|
||||||
_passive.tick();
|
_passive.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -2,16 +2,21 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.giant;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Giant;
|
import org.bukkit.entity.Giant;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class Goliath extends EventCreature<Giant>
|
public class Goliath extends RaidCreature<Giant>
|
||||||
{
|
{
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
private GoliathPassive _passive;
|
private GoliathPassive _passive;
|
||||||
@ -56,4 +61,20 @@ public class Goliath extends EventCreature<Giant>
|
|||||||
|
|
||||||
_passive.tick();
|
_passive.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -46,12 +46,12 @@ public class KnightPassive extends BossPassive<UndeadKnight, Skeleton>
|
|||||||
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
||||||
{
|
{
|
||||||
_lastUsed = System.currentTimeMillis();
|
_lastUsed = System.currentTimeMillis();
|
||||||
event.AddMod("Hilt Smash", 1 - event.GetDamage());
|
event.AddMod("Hilt Smash", 4 - event.GetDamage());
|
||||||
getBoss().getEvent().getCondition().Factory().Slow("Hilt Smash", event.GetDamageeEntity(), event.GetDamagerEntity(false), 2, 1, false, true, false, true);
|
getBoss().getEvent().getCondition().Factory().Slow("Hilt Smash", event.GetDamageeEntity(), event.GetDamagerEntity(false), 2, 1, false, true, false, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event.AddMod("Knight Attack", 1 - event.GetDamage());
|
event.AddMod("Knight Attack", 4 - event.GetDamage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class MageBolt extends BossPassive<UndeadMage, Skeleton>
|
|||||||
|
|
||||||
if (canHit)
|
if (canHit)
|
||||||
{
|
{
|
||||||
getBoss().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.CUSTOM, 2.5, true, true, false, getEntity().getName(), "Mystical Energy");
|
getBoss().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.CUSTOM, 5, true, true, false, getEntity().getName(), "Mystical Energy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.mage;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Skeleton;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
|
import mineplex.core.Managers;
|
||||||
|
import mineplex.core.blood.Blood;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
|
public class MageBoneExplode extends BossPassive<UndeadMage, Skeleton>
|
||||||
|
{
|
||||||
|
private long _lastUsed;
|
||||||
|
|
||||||
|
public MageBoneExplode(UndeadMage creature)
|
||||||
|
{
|
||||||
|
super(creature);
|
||||||
|
_lastUsed = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void explode()
|
||||||
|
{
|
||||||
|
Map<Player, Double> nearby = UtilPlayer.getInRadius(getLocation(), 4);
|
||||||
|
for (Player near : nearby.keySet())
|
||||||
|
{
|
||||||
|
getBoss().getEvent().getDamageManager().NewDamageEvent(near, getEntity(), null, DamageCause.CUSTOM, 3, true, true, false, getEntity().getName(), "Bone Explosion");
|
||||||
|
}
|
||||||
|
Managers.get(Blood.class).Effects(null, getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte) 0, 40, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCooldown()
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProgressing()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
||||||
|
{
|
||||||
|
_lastUsed = System.currentTimeMillis();
|
||||||
|
explode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Knockback(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetReason() == null || !event.GetReason().contains("Bone Explosion"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.GetDamagerEntity(false) == null || event.GetDamagerEntity(false).getEntityId() != getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.AddKnockback("Bone Explosion", 5);
|
||||||
|
}
|
||||||
|
}
|
@ -25,7 +25,7 @@ public class MageSummon extends BossPassive<UndeadMage, Skeleton>
|
|||||||
super(creature);
|
super(creature);
|
||||||
|
|
||||||
_lastUsed = System.currentTimeMillis();
|
_lastUsed = System.currentTimeMillis();
|
||||||
MAX_KNIGHTS = spawnLocations.size();
|
MAX_KNIGHTS = spawnLocations == null ? 10 : spawnLocations.size();
|
||||||
_spawnLocations = spawnLocations;
|
_spawnLocations = spawnLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,13 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.mage;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -12,11 +16,12 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class UndeadKnight extends EventCreature<Skeleton>
|
public class UndeadKnight extends RaidCreature<Skeleton>
|
||||||
{
|
{
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
private KnightPassive _passive;
|
private KnightPassive _passive;
|
||||||
@ -68,4 +73,20 @@ public class UndeadKnight extends EventCreature<Skeleton>
|
|||||||
|
|
||||||
_passive.tick();
|
_passive.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -7,15 +7,16 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -34,7 +35,7 @@ public class UndeadMage extends RaidCreature<Skeleton>
|
|||||||
|
|
||||||
public UndeadMage(RaidChallenge<WitherRaid> challenge, Location location, boolean invulnerable, List<Location> spawnLocations, List<Location> blinkLocations)
|
public UndeadMage(RaidChallenge<WitherRaid> challenge, Location location, boolean invulnerable, List<Location> spawnLocations, List<Location> blinkLocations)
|
||||||
{
|
{
|
||||||
super(challenge.getRaid(), location, "Undead Mage", true, 200, 5, true, Skeleton.class);
|
super(challenge.getRaid(), location, "Undead Mage", true, 500, 1500, true, Skeleton.class);
|
||||||
|
|
||||||
_challenge = challenge;
|
_challenge = challenge;
|
||||||
_invuln = invulnerable;
|
_invuln = invulnerable;
|
||||||
@ -43,12 +44,13 @@ public class UndeadMage extends RaidCreature<Skeleton>
|
|||||||
_abilities.add(new MageSummon(this, spawnLocations));
|
_abilities.add(new MageSummon(this, spawnLocations));
|
||||||
_abilities.add(new MageBlink(this, blinkLocations));
|
_abilities.add(new MageBlink(this, blinkLocations));
|
||||||
_abilities.add(new MageBolt(this));
|
_abilities.add(new MageBolt(this));
|
||||||
|
_abilities.add(new MageBoneExplode(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void spawnCustom()
|
protected void spawnCustom()
|
||||||
{
|
{
|
||||||
UtilEnt.vegetate(getEntity());
|
//UtilEnt.vegetate(getEntity());
|
||||||
getEntity().setSkeletonType(SkeletonType.WITHER);
|
getEntity().setSkeletonType(SkeletonType.WITHER);
|
||||||
getEntity().getEquipment().setItemInHand(new ItemStack(Material.RECORD_6)); //Meridian Scepter
|
getEntity().getEquipment().setItemInHand(new ItemStack(Material.RECORD_6)); //Meridian Scepter
|
||||||
getEntity().getEquipment().setItemInHandDropChance(0f);
|
getEntity().getEquipment().setItemInHandDropChance(0f);
|
||||||
@ -161,6 +163,32 @@ public class UndeadMage extends RaidCreature<Skeleton>
|
|||||||
event.SetCancelled("Boss Invulnerability");
|
event.SetCancelled("Boss Invulnerability");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void buffDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamagerEntity(false) == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.GetDamagerEntity(false).getEntityId() == getEntity().getEntityId() && event.GetCause() == DamageCause.ENTITY_ATTACK)
|
||||||
|
{
|
||||||
|
event.AddMod("Mage Attack", 7 - event.GetDamage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void ally(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleDeath(Location location)
|
public void handleDeath(Location location)
|
||||||
|
@ -2,15 +2,20 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Blaze;
|
import org.bukkit.entity.Blaze;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class BlazeMinion extends EventCreature<Blaze>
|
public class BlazeMinion extends RaidCreature<Blaze>
|
||||||
{
|
{
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
|
|
||||||
@ -42,4 +47,20 @@ public class BlazeMinion extends EventCreature<Blaze>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import org.bukkit.event.Listener;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
||||||
@ -21,7 +22,11 @@ public abstract class Cataclysm implements Listener
|
|||||||
Challenge = challenge;
|
Challenge = challenge;
|
||||||
Magmus = magmus;
|
Magmus = magmus;
|
||||||
|
|
||||||
challenge.getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(challenge.getRaid().getName() + " Raid", getAnnouncement())));
|
challenge.getRaid().getPlayers().forEach(player ->
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main(challenge.getRaid().getName() + " Raid", getAnnouncement()));
|
||||||
|
UtilTextMiddle.display("", getAnnouncement(), player);
|
||||||
|
});
|
||||||
onStart();
|
onStart();
|
||||||
UtilServer.RegisterEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ public class HeatingUp extends Cataclysm
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
protected void onStart()
|
||||||
{
|
{
|
||||||
|
((MagmusMeteor)Magmus.Abilities.get(2)).Disabled = true;
|
||||||
_center = Challenge.getRaid().getWorldData().getCustomLocs("C_SIX_C1S").get(0);
|
_center = Challenge.getRaid().getWorldData().getCustomLocs("C_SIX_C1S").get(0);
|
||||||
for (int x = -1; x <= 1; x++)
|
for (int x = -1; x <= 1; x++)
|
||||||
{
|
{
|
||||||
@ -49,6 +50,7 @@ public class HeatingUp extends Cataclysm
|
|||||||
_center.getBlock().getRelative(x, -1, z).setType(Material.STONE);
|
_center.getBlock().getRelative(x, -1, z).setType(Material.STONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
((MagmusMeteor)Magmus.Abilities.get(2)).Disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,8 +22,9 @@ public class InfernalMinions extends Cataclysm
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
protected void onStart()
|
||||||
{
|
{
|
||||||
for (Location loc : Challenge.getRaid().getWorldData().getCustomLocs("C_SIX_C2M"))
|
for (int i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
|
Location loc = UtilMath.randomElement(Magmus.getChallenge().getRaid().getPlayers()).getLocation();
|
||||||
if (UtilMath.r(2) == 1)
|
if (UtilMath.r(2) == 1)
|
||||||
{
|
{
|
||||||
Challenge.getRaid().registerCreature(new UndeadKnight(Challenge, loc));
|
Challenge.getRaid().registerCreature(new UndeadKnight(Challenge, loc));
|
||||||
|
@ -1,20 +1,31 @@
|
|||||||
package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma;
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.MagmaCube;
|
import org.bukkit.entity.MagmaCube;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class Magmus extends EventCreature<MagmaCube>
|
public class Magmus extends RaidCreature<MagmaCube>
|
||||||
{
|
{
|
||||||
private ChallengeSix _challenge;
|
private ChallengeSix _challenge;
|
||||||
private MagmusPassive _passive;
|
protected List<BossPassive<Magmus, MagmaCube>> Abilities = new ArrayList<>();
|
||||||
|
|
||||||
|
protected boolean TeleportBackASAP = true;
|
||||||
|
|
||||||
public Magmus(ChallengeSix challenge, Location location)
|
public Magmus(ChallengeSix challenge, Location location)
|
||||||
{
|
{
|
||||||
@ -22,7 +33,9 @@ public class Magmus extends EventCreature<MagmaCube>
|
|||||||
|
|
||||||
_challenge = challenge;
|
_challenge = challenge;
|
||||||
spawnEntity();
|
spawnEntity();
|
||||||
_passive = new MagmusPassive(this);
|
Abilities.add(new MagmusCataclysm(this));
|
||||||
|
Abilities.add(new MagmusSmash(this));
|
||||||
|
Abilities.add(new MagmusMeteor(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ChallengeSix getChallenge()
|
protected ChallengeSix getChallenge()
|
||||||
@ -45,8 +58,11 @@ public class Magmus extends EventCreature<MagmaCube>
|
|||||||
|
|
||||||
private void endAbility()
|
private void endAbility()
|
||||||
{
|
{
|
||||||
HandlerList.unregisterAll(_passive);
|
Abilities.forEach(ability ->
|
||||||
_passive = null;
|
{
|
||||||
|
HandlerList.unregisterAll(ability);
|
||||||
|
});
|
||||||
|
Abilities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -63,8 +79,40 @@ public class Magmus extends EventCreature<MagmaCube>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntity().teleport(getSpawnLocation());
|
if (TeleportBackASAP)
|
||||||
|
{
|
||||||
|
getEntity().teleport(getSpawnLocation());
|
||||||
|
}
|
||||||
|
|
||||||
_passive.tick();
|
Abilities.forEach(BossPassive::tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMagmusDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamagerEntity(false) == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.GetDamagerEntity(false).getEntityId() == getEntity().getEntityId() && (event.GetCause() != DamageCause.FIRE && event.GetCause() != DamageCause.CUSTOM && event.GetCause() != DamageCause.PROJECTILE))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Wrong Attack Type Magmus");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -11,15 +11,15 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix;
|
||||||
|
|
||||||
public class MagmusPassive extends BossPassive<Magmus, MagmaCube>
|
public class MagmusCataclysm extends BossPassive<Magmus, MagmaCube>
|
||||||
{
|
{
|
||||||
private long _lastUse;
|
private long _lastUse;
|
||||||
private List<Class<? extends Cataclysm>> _cataclysms = new ArrayList<>();
|
private List<Class<? extends Cataclysm>> _cataclysms = new ArrayList<>();
|
||||||
|
|
||||||
public MagmusPassive(Magmus creature)
|
public MagmusCataclysm(Magmus creature)
|
||||||
{
|
{
|
||||||
super(creature);
|
super(creature);
|
||||||
_lastUse = System.currentTimeMillis();
|
_lastUse = System.currentTimeMillis() - (getCooldown() * 1000);
|
||||||
_cataclysms.add(HeatingUp.class);
|
_cataclysms.add(HeatingUp.class);
|
||||||
_cataclysms.add(InfernalMinions.class);
|
_cataclysms.add(InfernalMinions.class);
|
||||||
_cataclysms.add(UndeadAlly.class);
|
_cataclysms.add(UndeadAlly.class);
|
||||||
@ -28,7 +28,7 @@ public class MagmusPassive extends BossPassive<Magmus, MagmaCube>
|
|||||||
@Override
|
@Override
|
||||||
public int getCooldown()
|
public int getCooldown()
|
||||||
{
|
{
|
||||||
return 30;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -0,0 +1,89 @@
|
|||||||
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma;
|
||||||
|
|
||||||
|
import org.bukkit.entity.MagmaCube;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
|
|
||||||
|
public class MagmusEat extends BossPassive<Magmus, MagmaCube>
|
||||||
|
{
|
||||||
|
private long _lastUse;
|
||||||
|
private Player _eating;
|
||||||
|
private int _ticks;
|
||||||
|
|
||||||
|
public MagmusEat(Magmus creature)
|
||||||
|
{
|
||||||
|
super(creature);
|
||||||
|
_lastUse = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spit()
|
||||||
|
{
|
||||||
|
double offset = UtilMath.offset(_eating, getEntity());
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(_eating,
|
||||||
|
UtilAlg.getTrajectory2d(getLocation().toVector(), _eating.getLocation().toVector()),
|
||||||
|
2 + 2 * offset, true, 0, 1.2 + 1.0 * offset, 3, true);
|
||||||
|
|
||||||
|
getBoss().getEvent().getCondition().Factory().Falling("Spit Out", _eating, getEntity(), 10, false, true);
|
||||||
|
|
||||||
|
_lastUse = System.currentTimeMillis();
|
||||||
|
_eating = null;
|
||||||
|
_ticks = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void eat()
|
||||||
|
{
|
||||||
|
if (_ticks < 20 * 10)
|
||||||
|
{
|
||||||
|
_eating.setFireTicks(40);
|
||||||
|
_eating.teleport(getEntity());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialEat(Player target)
|
||||||
|
{
|
||||||
|
_eating = target;
|
||||||
|
_ticks = 0;
|
||||||
|
getBoss().getEvent().getCondition().Factory().Silence("Eat", _eating, getEntity(), 10, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCooldown()
|
||||||
|
{
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProgressing()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
if (_eating != null)
|
||||||
|
{
|
||||||
|
eat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (UtilTime.elapsed(_lastUse, getCooldown() * 1000))
|
||||||
|
{
|
||||||
|
Player target = UtilPlayer.getClosest(getLocation(), 3);
|
||||||
|
if (target != null)
|
||||||
|
{
|
||||||
|
initialEat(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball;
|
||||||
|
import org.bukkit.entity.LargeFireball;
|
||||||
|
import org.bukkit.entity.MagmaCube;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
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.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityLargeFireball;
|
||||||
|
|
||||||
|
public class MagmusMeteor extends BossPassive<Magmus, MagmaCube>
|
||||||
|
{
|
||||||
|
private long _lastUse;
|
||||||
|
private List<LargeFireball> _shot = new ArrayList<>();
|
||||||
|
|
||||||
|
protected boolean Disabled = false;
|
||||||
|
|
||||||
|
public MagmusMeteor(Magmus creature)
|
||||||
|
{
|
||||||
|
super(creature);
|
||||||
|
_lastUse = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void newBall()
|
||||||
|
{
|
||||||
|
if (Disabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player target = UtilMath.randomElement(getBoss().getChallenge().getRaid().getPlayers());
|
||||||
|
LargeFireball ball = target.getWorld().spawn(target.getLocation().add(Math.random() * 24 - 12, 32 + Math.random() * 16, Math.random() * 24 - 12), LargeFireball.class);
|
||||||
|
|
||||||
|
EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle();
|
||||||
|
eFireball.dirX = (Math.random()-0.5)*0.02;
|
||||||
|
eFireball.dirY = -0.2 - 0.05 * Math.random();
|
||||||
|
eFireball.dirZ = (Math.random()-0.5)*0.02;
|
||||||
|
|
||||||
|
ball.setShooter(getEntity());
|
||||||
|
ball.setYield(2.2f);
|
||||||
|
ball.setBounce(false);
|
||||||
|
_shot.add(ball);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCooldown()
|
||||||
|
{
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProgressing()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
if (Disabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (UtilTime.elapsed(_lastUse, getCooldown() * 1000))
|
||||||
|
{
|
||||||
|
_lastUse = System.currentTimeMillis();
|
||||||
|
for (int i = 0; i < 20; i++)
|
||||||
|
{
|
||||||
|
newBall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onExplode(EntityExplodeEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof LargeFireball)
|
||||||
|
{
|
||||||
|
LargeFireball ball = (LargeFireball) event.getEntity();
|
||||||
|
if (ball.getShooter() instanceof MagmaCube && ((MagmaCube)ball.getShooter()).getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
event.blockList().clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBallHit(ProjectileHitEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof LargeFireball)
|
||||||
|
{
|
||||||
|
LargeFireball ball = (LargeFireball) event.getEntity();
|
||||||
|
if (ball.getShooter() instanceof MagmaCube && ((MagmaCube)ball.getShooter()).getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
_shot.remove(ball);
|
||||||
|
UtilParticle.PlayParticle(ParticleType.EXPLODE, ball.getLocation(), null, 0, 2, ViewDist.MAX, UtilServer.getPlayers());
|
||||||
|
ball.getWorld().playSound(ball.getLocation(), Sound.EXPLODE, 10, 0);
|
||||||
|
Player hit = UtilPlayer.getClosest(ball.getLocation(), 0.5);
|
||||||
|
if (hit != null)
|
||||||
|
{
|
||||||
|
getBoss().getEvent().getDamageManager().NewDamageEvent(hit, getEntity(), ball, DamageCause.PROJECTILE, 4, true, true, false, getEntity().getName(), "Meteor Shower");
|
||||||
|
}
|
||||||
|
ball.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.entity.MagmaCube;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
|
|
||||||
|
public class MagmusSmash extends BossPassive<Magmus, MagmaCube>
|
||||||
|
{
|
||||||
|
private long _lastUse;
|
||||||
|
|
||||||
|
public MagmusSmash(Magmus creature)
|
||||||
|
{
|
||||||
|
super(creature);
|
||||||
|
_lastUse = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void slam()
|
||||||
|
{
|
||||||
|
//Action
|
||||||
|
Map<Player, Double> targets = UtilPlayer.getInRadius(getLocation(), 5.5d + 0.5 * 5);
|
||||||
|
getBoss().TeleportBackASAP = false;
|
||||||
|
getEntity().setVelocity(new Vector(0, 5, 0));
|
||||||
|
UtilServer.runSyncLater(() -> getBoss().TeleportBackASAP = false, 3 * 20);
|
||||||
|
for (Player player : targets.keySet())
|
||||||
|
{
|
||||||
|
getBoss().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null,
|
||||||
|
DamageCause.CUSTOM, 6 * targets.get(player) + 0.5, false, true, false,
|
||||||
|
getEntity().getName(), "Smash");
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(player,
|
||||||
|
UtilAlg.getTrajectory2d(getLocation().toVector(), player.getLocation().toVector()),
|
||||||
|
2 + 2 * targets.get(player), true, 0, 1.2 + 1.0 * targets.get(player), 3, true);
|
||||||
|
|
||||||
|
//Condition
|
||||||
|
getBoss().getEvent().getCondition().Factory().Falling("Smash", player, getEntity(), 10, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCooldown()
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProgressing()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
if (UtilTime.elapsed(_lastUse, getCooldown() * 1000))
|
||||||
|
{
|
||||||
|
_lastUse = System.currentTimeMillis();
|
||||||
|
slam();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,59 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.worldevent.raid.wither.creature.silverfish;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Silverfish;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
|
||||||
|
|
||||||
public class PitSwarmer extends EventCreature<Silverfish>
|
|
||||||
{
|
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
|
||||||
private SwarmerPassive _passive;
|
|
||||||
|
|
||||||
public PitSwarmer(RaidChallenge<WitherRaid> challenge, Location location)
|
|
||||||
{
|
|
||||||
super(challenge.getRaid(), location, "Pit Swarmer", true, 1, 100, true, Silverfish.class);
|
|
||||||
|
|
||||||
_challenge = challenge;
|
|
||||||
spawnEntity();
|
|
||||||
_passive = new SwarmerPassive(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void spawnCustom() {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dieCustom()
|
|
||||||
{
|
|
||||||
endAbility();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void endAbility()
|
|
||||||
{
|
|
||||||
HandlerList.unregisterAll(_passive);
|
|
||||||
_passive = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onTick(UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (event.getType() != UpdateType.TICK)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_challenge.isComplete())
|
|
||||||
{
|
|
||||||
remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_passive.tick();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.worldevent.raid.wither.creature.silverfish;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Silverfish;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
|
|
||||||
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
|
|
||||||
public class SwarmerPassive extends BossPassive<PitSwarmer, Silverfish>
|
|
||||||
{
|
|
||||||
public SwarmerPassive(PitSwarmer creature)
|
|
||||||
{
|
|
||||||
super(creature);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCooldown()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isProgressing()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick() {}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDamage(CustomDamageEvent event)
|
|
||||||
{
|
|
||||||
if (event.GetDamagerEntity(false) != null)
|
|
||||||
{
|
|
||||||
if (event.GetDamagerEntity(false).getEntityId() == getEntity().getEntityId())
|
|
||||||
{
|
|
||||||
event.AddMod("Swarm Attack", 1 - event.GetDamage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (event.GetDamageeEntity() != null)
|
|
||||||
{
|
|
||||||
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
|
||||||
{
|
|
||||||
event.SetCancelled("Swarm Invulnerability");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,6 +6,8 @@ import java.util.Map.Entry;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
@ -115,4 +117,13 @@ public class BlackHole extends BossPassive<CharlesWitherton, Wither>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onKick(PlayerKickEvent event)
|
||||||
|
{
|
||||||
|
if (_chargeTicks != -1 && getBoss().getChallenge().getRaid().getPlayers().contains(event.getPlayer()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither;
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -36,6 +37,7 @@ public class CharlesSkulls extends BossAbility<CharlesWitherton, Wither>
|
|||||||
{
|
{
|
||||||
super(creature);
|
super(creature);
|
||||||
|
|
||||||
|
_guidedSkulls = new HashMap<>();
|
||||||
_lastUnguided = System.currentTimeMillis();
|
_lastUnguided = System.currentTimeMillis();
|
||||||
_lastGuided = System.currentTimeMillis();
|
_lastGuided = System.currentTimeMillis();
|
||||||
_lastBombard = -1;
|
_lastBombard = -1;
|
||||||
|
@ -4,25 +4,46 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
|
import org.bukkit.entity.WitherSkull;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
import mineplex.game.clans.clans.worldevent.api.BossPassive;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.ai.PathfinderGoalCustomFloat;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityWither;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalHurtByTarget;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomStroll;
|
||||||
|
|
||||||
public class CharlesWitherton extends EventCreature<Wither>
|
public class CharlesWitherton extends RaidCreature<Wither>
|
||||||
{
|
{
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
private CharlesSkulls _passive;
|
private CharlesSkulls _passive;
|
||||||
private List<BossPassive<CharlesWitherton, Wither>> _abilities = new ArrayList<>();
|
private List<BossPassive<CharlesWitherton, Wither>> _abilities = new ArrayList<>();
|
||||||
|
|
||||||
protected boolean Flying = false;
|
public boolean Flying = false;
|
||||||
|
|
||||||
public CharlesWitherton(RaidChallenge<WitherRaid> challenge, Location location)
|
public CharlesWitherton(RaidChallenge<WitherRaid> challenge, Location location)
|
||||||
{
|
{
|
||||||
@ -55,6 +76,26 @@ public class CharlesWitherton extends EventCreature<Wither>
|
|||||||
protected void spawnCustom()
|
protected void spawnCustom()
|
||||||
{
|
{
|
||||||
UtilEnt.vegetate(getEntity());
|
UtilEnt.vegetate(getEntity());
|
||||||
|
CraftWither cw = (CraftWither)getEntity();
|
||||||
|
EntityWither wither = cw.getHandle();
|
||||||
|
wither.setVegetated(false);
|
||||||
|
wither.goalSelector.a(0, new PathfinderGoalCustomFloat(this, wither));
|
||||||
|
wither.goalSelector.a(5, new PathfinderGoalRandomStroll(wither, 1.0D));
|
||||||
|
wither.goalSelector.a(6, new PathfinderGoalLookAtPlayer(wither, EntityHuman.class, 8.0F));
|
||||||
|
wither.goalSelector.a(7, new PathfinderGoalRandomLookaround(wither));
|
||||||
|
wither.targetSelector.a(1, new PathfinderGoalHurtByTarget(wither, false, new Class[0]));
|
||||||
|
wither.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<EntityInsentient>(wither, EntityInsentient.class, 0, false, false, new Predicate<Entity>()
|
||||||
|
{
|
||||||
|
public boolean a(Entity entity)
|
||||||
|
{
|
||||||
|
return entity instanceof EntityHuman;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean apply(Entity entity)
|
||||||
|
{
|
||||||
|
return this.a(entity);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,5 +132,54 @@ public class CharlesWitherton extends EventCreature<Wither>
|
|||||||
|
|
||||||
_passive.tick();
|
_passive.tick();
|
||||||
_abilities.forEach(BossPassive::tick);
|
_abilities.forEach(BossPassive::tick);
|
||||||
|
|
||||||
|
if (Flying)
|
||||||
|
{
|
||||||
|
getEntity().setHealth(500);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getEntity().setHealth(100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void handleBlockChange(EntityChangeBlockEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onLaunch(ProjectileLaunchEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof WitherSkull && event.getEntity().getShooter() instanceof Wither)
|
||||||
|
{
|
||||||
|
if (((Wither)event.getEntity().getShooter()).getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
if (((WitherSkull)event.getEntity()).isCharged())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -1,30 +1,53 @@
|
|||||||
package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither;
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
|
import org.bukkit.entity.WitherSkull;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.worldevent.api.EventCreature;
|
|
||||||
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
import mineplex.game.clans.clans.worldevent.raid.RaidChallenge;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.RaidCreature;
|
||||||
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid;
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.ai.PathfinderGoalCustomFloat;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityWither;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalHurtByTarget;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomStroll;
|
||||||
|
|
||||||
public class MiniCharles extends EventCreature<Wither>
|
public class MiniCharles extends RaidCreature<Wither>
|
||||||
{
|
{
|
||||||
|
private CharlesWitherton _charles;
|
||||||
private RaidChallenge<WitherRaid> _challenge;
|
private RaidChallenge<WitherRaid> _challenge;
|
||||||
private MiniCharlesSkulls _passive;
|
private MiniCharlesSkulls _passive;
|
||||||
private int _liveTicks;
|
private int _liveTicks;
|
||||||
|
|
||||||
protected boolean Flying = false;
|
protected boolean Flying = false;
|
||||||
|
|
||||||
public MiniCharles(RaidChallenge<WitherRaid> challenge, Location location)
|
public MiniCharles(CharlesWitherton charles, Location location)
|
||||||
{
|
{
|
||||||
super(challenge.getRaid(), location, "Charles' Minion", true, 50, 15000, true, Wither.class);
|
super(charles.getChallenge().getRaid(), location, "Charles' Minion", true, 50, 15000, true, Wither.class);
|
||||||
|
|
||||||
_challenge = challenge;
|
_charles = charles;
|
||||||
|
_challenge = charles.getChallenge();
|
||||||
spawnEntity();
|
spawnEntity();
|
||||||
_passive = new MiniCharlesSkulls(this);
|
_passive = new MiniCharlesSkulls(this);
|
||||||
}
|
}
|
||||||
@ -33,6 +56,25 @@ public class MiniCharles extends EventCreature<Wither>
|
|||||||
protected void spawnCustom()
|
protected void spawnCustom()
|
||||||
{
|
{
|
||||||
UtilEnt.vegetate(getEntity());
|
UtilEnt.vegetate(getEntity());
|
||||||
|
EntityWither wither = ((CraftWither)getEntity()).getHandle();
|
||||||
|
wither.setVegetated(false);
|
||||||
|
wither.goalSelector.a(0, new PathfinderGoalCustomFloat(_charles, wither));
|
||||||
|
wither.goalSelector.a(5, new PathfinderGoalRandomStroll(wither, 1.0D));
|
||||||
|
wither.goalSelector.a(6, new PathfinderGoalLookAtPlayer(wither, EntityHuman.class, 8.0F));
|
||||||
|
wither.goalSelector.a(7, new PathfinderGoalRandomLookaround(wither));
|
||||||
|
wither.targetSelector.a(1, new PathfinderGoalHurtByTarget(wither, false, new Class[0]));
|
||||||
|
wither.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<EntityInsentient>(wither, EntityInsentient.class, 0, false, false, new Predicate<Entity>()
|
||||||
|
{
|
||||||
|
public boolean a(Entity entity)
|
||||||
|
{
|
||||||
|
return entity instanceof EntityHuman;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean apply(Entity entity)
|
||||||
|
{
|
||||||
|
return this.a(entity);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,5 +111,54 @@ public class MiniCharles extends EventCreature<Wither>
|
|||||||
{
|
{
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Flying)
|
||||||
|
{
|
||||||
|
getEntity().setHealth(500);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getEntity().setHealth(100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void handleBlockChange(EntityChangeBlockEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onLaunch(ProjectileLaunchEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof WitherSkull && event.getEntity().getShooter() instanceof Wither)
|
||||||
|
{
|
||||||
|
if (((Wither)event.getEntity().getShooter()).getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
if (((WitherSkull)event.getEntity()).isCharged())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void allyDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId())
|
||||||
|
{
|
||||||
|
LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE);
|
||||||
|
if (damager != null && !(damager instanceof Player))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Allied Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleDeath(Location location) {}
|
||||||
}
|
}
|
@ -41,6 +41,7 @@ public class SummonCorpse extends BossPassive<CharlesWitherton, Wither>
|
|||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
||||||
{
|
{
|
||||||
|
_lastUsed = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
getBoss().getEvent().registerCreature(new ReanimatedCorpse(getBoss().getChallenge(), getLocation()));
|
getBoss().getEvent().registerCreature(new ReanimatedCorpse(getBoss().getChallenge(), getLocation()));
|
||||||
|
@ -40,9 +40,10 @@ public class SummonMinions extends BossPassive<CharlesWitherton, Wither>
|
|||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
||||||
{
|
{
|
||||||
|
_lastUsed = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
getBoss().getEvent().registerCreature(new MiniCharles(getBoss().getChallenge(), getLocation()));
|
getBoss().getEvent().registerCreature(new MiniCharles(getBoss(), getLocation()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ public class SummonUndead extends BossPassive<CharlesWitherton, Wither>
|
|||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000))
|
||||||
{
|
{
|
||||||
|
_lastUsed = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
getBoss().getEvent().registerCreature(new UndeadKnight(getBoss().getChallenge(), getLocation()));
|
getBoss().getEvent().registerCreature(new UndeadKnight(getBoss().getChallenge(), getLocation()));
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.ai;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.CharlesWitherton;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
|
import net.minecraft.server.v1_8_R3.Navigation;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoal;
|
||||||
|
|
||||||
|
public class PathfinderGoalCustomFloat extends PathfinderGoal
|
||||||
|
{
|
||||||
|
private CharlesWitherton _boss;
|
||||||
|
private EntityInsentient a;
|
||||||
|
|
||||||
|
public PathfinderGoalCustomFloat(CharlesWitherton boss, EntityInsentient ent)
|
||||||
|
{
|
||||||
|
_boss = boss;
|
||||||
|
this.a = ent;
|
||||||
|
this.a(4);
|
||||||
|
((Navigation)ent.getNavigation()).d(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean a()
|
||||||
|
{
|
||||||
|
return _boss.Flying;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void e()
|
||||||
|
{
|
||||||
|
if (this.a.bc().nextFloat() < 0.8F)
|
||||||
|
{
|
||||||
|
this.a.getControllerJump().a();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user