Wither Assault (I don't like it at all)
This commit is contained in:
parent
77adc83720
commit
d568842d7c
@ -3886,8 +3886,9 @@ public enum GameKit
|
|||||||
},
|
},
|
||||||
new KitEntityData<>
|
new KitEntityData<>
|
||||||
(
|
(
|
||||||
Wither.class,
|
Skeleton.class,
|
||||||
createColoured(Material.SKULL_ITEM, (byte) 2)
|
createColoured(Material.SKULL_ITEM, (byte) 1),
|
||||||
|
SkeletonType.WITHER.ordinal()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class Micro extends TeamGame
|
|||||||
"Be the " + C.cYellow + "Last Team" + C.Reset + " standing!"
|
"Be the " + C.cYellow + "Last Team" + C.Reset + " standing!"
|
||||||
};
|
};
|
||||||
private static final long BARRIER_TIME = TimeUnit.SECONDS.toMillis(10);
|
private static final long BARRIER_TIME = TimeUnit.SECONDS.toMillis(10);
|
||||||
private static final long CHEAT_TIME = TimeUnit.SECONDS.toMillis(5);
|
private static final long CHEAT_TIME = TimeUnit.SECONDS.toMillis(4);
|
||||||
|
|
||||||
private final Set<Block> _glass = new HashSet<>();
|
private final Set<Block> _glass = new HashSet<>();
|
||||||
private final Map<GameTeam, Location> _teamCenters = new HashMap<>();
|
private final Map<GameTeam, Location> _teamCenters = new HashMap<>();
|
||||||
|
@ -11,34 +11,26 @@ import nautilus.game.arcade.game.Game;
|
|||||||
|
|
||||||
public class PlayerCopyWither
|
public class PlayerCopyWither
|
||||||
{
|
{
|
||||||
private Game Host;
|
|
||||||
|
|
||||||
private Skeleton _ent;
|
private final Skeleton _ent;
|
||||||
private Player _owner;
|
private final Player _owner;
|
||||||
|
|
||||||
public PlayerCopyWither(Game host, Player owner, ChatColor nameColor)
|
PlayerCopyWither(Game host, Player owner, ChatColor nameColor)
|
||||||
{
|
{
|
||||||
Host = host;
|
|
||||||
|
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
|
|
||||||
Host.CreatureAllowOverride = true;
|
host.CreatureAllowOverride = true;
|
||||||
_ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class);
|
_ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class);
|
||||||
Host.CreatureAllowOverride = false;
|
host.CreatureAllowOverride = false;
|
||||||
|
|
||||||
UtilEnt.ghost(_ent, true, false);
|
UtilEnt.ghost(_ent, true, false);
|
||||||
|
UtilEnt.vegetate(_ent, true);
|
||||||
UtilEnt.vegetate(_ent);
|
|
||||||
|
|
||||||
//Armor
|
//Armor
|
||||||
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
|
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
|
||||||
|
|
||||||
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
|
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
|
||||||
_ent.setCustomNameVisible(true);
|
_ent.setCustomNameVisible(true);
|
||||||
|
|
||||||
//Disguise
|
|
||||||
// DisguisePlayer disguise = new DisguisePlayer(_ent, ((CraftPlayer)owner).getProfile());
|
|
||||||
// Host.Manager.GetDisguise().disguise(disguise);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LivingEntity GetEntity()
|
public LivingEntity GetEntity()
|
||||||
|
@ -4,7 +4,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -53,6 +56,7 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
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 nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
@ -75,24 +79,19 @@ import nautilus.game.arcade.stats.TeamKillsStatTracker;
|
|||||||
|
|
||||||
public class WitherGame extends TeamGame implements IBlockRestorer
|
public class WitherGame extends TeamGame implements IBlockRestorer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final double WITHER_FACTOR = 2.5;
|
||||||
|
private static final long GAME_TIMEOUT = TimeUnit.MINUTES.toMillis(5);
|
||||||
|
|
||||||
private GameTeam _runners;
|
private GameTeam _runners;
|
||||||
private GameTeam _withers;
|
private GameTeam _withers;
|
||||||
|
|
||||||
private double _witherFactor = 2.5;
|
|
||||||
|
|
||||||
private int _yLimit = 0;
|
private int _yLimit = 0;
|
||||||
private int _maxY;
|
private int _maxY;
|
||||||
|
|
||||||
private long _gameTime = 300000;
|
private final Map<Player, PlayerCopyWither> _doubles = new HashMap<>();
|
||||||
|
private final Set<BlockData> _blocks = new HashSet<>();
|
||||||
private HashMap<Player, PlayerCopyWither> _doubles = new HashMap<Player, PlayerCopyWither>();
|
private final List<Location> _locationsOfBlocks = new ArrayList<>();
|
||||||
|
|
||||||
// private int _livesPerPlayer = 3;
|
|
||||||
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
|
||||||
|
|
||||||
private HashSet<BlockData> _blocks = new HashSet<BlockData>();
|
|
||||||
|
|
||||||
private ArrayList<Location> _locationsOfBlocks = new ArrayList<Location>();
|
|
||||||
|
|
||||||
public WitherGame(ArcadeManager manager)
|
public WitherGame(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
@ -118,29 +117,28 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes",
|
C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes",
|
||||||
});
|
});
|
||||||
|
|
||||||
this.DeathOut = true;
|
DeathOut = true;
|
||||||
this.DamageTeamSelf = false;
|
DamageTeamSelf = false;
|
||||||
this.DamageSelf = false;
|
DamageSelf = false;
|
||||||
this.DeathSpectateSecs = 4;
|
DeathSpectateSecs = 4;
|
||||||
this.HungerSet = 20;
|
HungerSet = 20;
|
||||||
this.WorldBoundaryKill = false;
|
WorldBoundaryKill = false;
|
||||||
|
|
||||||
//Customizing for the Editor kit
|
//Customizing for the Editor kit
|
||||||
this.BlockBreak = true;
|
BlockBreak = true;
|
||||||
this.BlockPlace = true;
|
BlockPlace = true;
|
||||||
this.ItemPickup = true;
|
ItemPickup = true;
|
||||||
|
|
||||||
this.KitRegisterState = GameState.Prepare;
|
KitRegisterState = GameState.Prepare;
|
||||||
|
|
||||||
this.InventoryClick = false;
|
InventoryClick = false;
|
||||||
this.InventoryOpenBlock = false;
|
InventoryOpenBlock = false;
|
||||||
|
|
||||||
_help = new String[]
|
_help = new String[]
|
||||||
{
|
{
|
||||||
"Blocks placed by an Editor can be passed by other humans by " + C.cDGreen + "Right-clicking the block",
|
"Blocks placed by an Editor can be passed by other humans by " + C.cDGreen + "Right-clicking the block",
|
||||||
"Withers are too powerful to be killed. Hiding is the only option!",
|
"Withers are too powerful to be killed. Hiding is the only option!",
|
||||||
"Medics are a valuable asset. Stick with them and keep them safe!",
|
"Medics are a valuable asset. Stick with them and keep them safe!",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -219,7 +217,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Enough Withers
|
// Enough Withers
|
||||||
if (_withers.GetPlayers(true).size() * _witherFactor >= _runners
|
if (_withers.GetPlayers(true).size() * WITHER_FACTOR >= _runners
|
||||||
.GetPlayers(true).size())
|
.GetPlayers(true).size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -227,28 +225,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
setWither(player, true);
|
setWither(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
|
||||||
// public void assignCompassOnStart(GameStateChangeEvent event)
|
|
||||||
// {
|
|
||||||
// if (event.GetState() != GameState.Live)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// for (Player players : _withers.GetPlayers(true))
|
|
||||||
// {
|
|
||||||
// ItemStack compass = new ItemBuilder(Material.COMPASS, 1).build();
|
|
||||||
//
|
|
||||||
// ItemMeta im = compass.getItemMeta();
|
|
||||||
// im.setLore(new ArrayList<String>(Arrays.asList(
|
|
||||||
// F.item("A compass that trigger"),
|
|
||||||
// F.item("your ability to track humans!"))));
|
|
||||||
// im.setDisplayName(F.name("Scent Trigger"));
|
|
||||||
//
|
|
||||||
// compass.setItemMeta(im);
|
|
||||||
//
|
|
||||||
// players.getInventory().setItem(7, compass);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Cancel wither shooting in waiting lobby
|
// Cancel wither shooting in waiting lobby
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWitherSkullFire(ProjectileLaunchEvent event)
|
public void onWitherSkullFire(ProjectileLaunchEvent event)
|
||||||
@ -381,8 +357,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
public void setWither(Player player, boolean forced)
|
public void setWither(Player player, boolean forced)
|
||||||
{
|
{
|
||||||
// _lives.remove(player);
|
|
||||||
|
|
||||||
SetPlayerTeam(player, _withers, true);
|
SetPlayerTeam(player, _withers, true);
|
||||||
|
|
||||||
// Kit
|
// Kit
|
||||||
@ -408,27 +382,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
|
||||||
// public void playerLoseLife(final PlayerDeathOutEvent event)
|
|
||||||
// {
|
|
||||||
// Player player = event.GetPlayer();
|
|
||||||
//
|
|
||||||
// if (_lives.containsKey(player))
|
|
||||||
// {
|
|
||||||
// int lives = _lives.get(player);
|
|
||||||
//
|
|
||||||
// if (lives <= 1)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// _lives.put(player, lives - 1);
|
|
||||||
//
|
|
||||||
// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen +
|
|
||||||
// C.Bold + lives + " Lives Remaining") + "."));
|
|
||||||
//
|
|
||||||
// event.setCancelled(true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void gameStart(GameStateChangeEvent event)
|
public void gameStart(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
@ -466,26 +419,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
|
||||||
// public void playerLivesDisplay(PlayerKitGiveEvent event)
|
|
||||||
// {
|
|
||||||
// if (!_runners.HasPlayer(event.GetPlayer()))
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// //Player Lives
|
|
||||||
// if (!_lives.containsKey(event.GetPlayer()))
|
|
||||||
// _lives.put(event.GetPlayer(), _livesPerPlayer);
|
|
||||||
//
|
|
||||||
// int lives = _lives.get(event.GetPlayer());
|
|
||||||
//
|
|
||||||
// if (lives <= 0)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// event.GetPlayer().getInventory().setItem(8,
|
|
||||||
// ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives,
|
|
||||||
// C.cGreen + C.Bold + lives + " Lives Remaining"));
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
@ -502,7 +435,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
GameTeam winner = null;
|
GameTeam winner = null;
|
||||||
|
|
||||||
// Wither Win
|
// Wither Win
|
||||||
if (UtilTime.elapsed(this.GetStateTime(), _gameTime))
|
if (UtilTime.elapsed(this.GetStateTime(), GAME_TIMEOUT))
|
||||||
winner = _runners;
|
winner = _runners;
|
||||||
|
|
||||||
// Runner Win
|
// Runner Win
|
||||||
@ -542,36 +475,20 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// int lives = 0;
|
|
||||||
// for (int i : _lives.values())
|
|
||||||
// lives += i;
|
|
||||||
|
|
||||||
// Wipe Last
|
// Wipe Last
|
||||||
Scoreboard.reset();
|
Scoreboard.reset();
|
||||||
|
|
||||||
Scoreboard.writeNewLine();
|
Scoreboard.writeNewLine();
|
||||||
Scoreboard.write(_runners.GetColor() + C.Bold + _runners.GetName());
|
Scoreboard.write(_runners.GetColor() + C.Bold + _runners.GetName());
|
||||||
Scoreboard.write(_runners.GetColor() + ""
|
Scoreboard.write(_runners.GetColor() + "" + _runners.GetPlayers(true).size() + " Players");
|
||||||
+ _runners.GetPlayers(true).size() + " Players");
|
|
||||||
|
|
||||||
Scoreboard.writeNewLine();
|
Scoreboard.writeNewLine();
|
||||||
Scoreboard.write(_withers.GetColor() + C.Bold + _withers.GetName());
|
Scoreboard.write(_withers.GetColor() + C.Bold + _withers.GetName());
|
||||||
Scoreboard.write(_withers.GetColor() + ""
|
Scoreboard.write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players");
|
||||||
+ _withers.GetPlayers(true).size() + " Players");
|
|
||||||
|
|
||||||
// Scoreboard.WriteBlank();
|
|
||||||
// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
|
|
||||||
// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
|
|
||||||
|
|
||||||
Scoreboard.writeNewLine();
|
Scoreboard.writeNewLine();
|
||||||
Scoreboard.write(C.cYellow + C.Bold + "Time Left");
|
Scoreboard.write(C.cYellow + C.Bold + "Time Left");
|
||||||
Scoreboard.write(UtilTime.MakeStr(
|
Scoreboard.write(UtilTime.MakeStr(Math.max(0, GAME_TIMEOUT - (System.currentTimeMillis() - GetStateTime())), 1));
|
||||||
Math.max(
|
|
||||||
0,
|
|
||||||
_gameTime
|
|
||||||
- (System.currentTimeMillis() - this
|
|
||||||
.GetStateTime())), 1));
|
|
||||||
|
|
||||||
Scoreboard.draw();
|
Scoreboard.draw();
|
||||||
}
|
}
|
||||||
@ -598,7 +515,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
public int getRequiredWithers()
|
public int getRequiredWithers()
|
||||||
{
|
{
|
||||||
return (int) (GetPlayers(true).size() / _witherFactor);
|
return (int) (GetPlayers(true).size() / WITHER_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -620,15 +537,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
double distanceToGround = player.getLocation().distance(new Location(_spawn.getWorld(), player.getLocation().getX(), _spawn.getY(), player.getLocation().getZ()));
|
double distanceToGround = player.getLocation().distance(new Location(_spawn.getWorld(), player.getLocation().getX(), _spawn.getY(), player.getLocation().getZ()));
|
||||||
double speed;
|
double speed;
|
||||||
|
|
||||||
if (distanceToGround < 8)
|
|
||||||
{
|
|
||||||
speed = 0.16;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (distanceToGround < 4)
|
if (distanceToGround < 4)
|
||||||
{
|
{
|
||||||
speed = 0.016;
|
speed = 0.016;
|
||||||
@ -662,10 +570,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
|
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
|
||||||
|
|
||||||
// if (player.getLocation().getY() < _yLimit + 6)
|
|
||||||
// UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0,
|
|
||||||
// 0, 10, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,11 +588,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
else if (!isInsideMap(block.getLocation()))
|
else if (!isInsideMap(block.getLocation()))
|
||||||
blockIter.remove();
|
blockIter.remove();
|
||||||
|
|
||||||
// else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA,
|
|
||||||
// _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA,
|
|
||||||
// _spawnB))
|
|
||||||
// blockIter.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Block block : blocks)
|
for (Block block : blocks)
|
||||||
@ -717,32 +616,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
|
||||||
// public void cleanLives(PlayerQuitEvent event)
|
|
||||||
// {
|
|
||||||
// _lives.remove(event.getPlayer());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @EventHandler
|
|
||||||
// public void livesUpdate(UpdateEvent event)
|
|
||||||
// {
|
|
||||||
// if (!IsLive())
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// if (event.getType() != UpdateType.FASTER)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// Iterator<Player> playerIter = _lives.keySet().iterator();
|
|
||||||
//
|
|
||||||
// while (playerIter.hasNext())
|
|
||||||
// {
|
|
||||||
// Player player = playerIter.next();
|
|
||||||
//
|
|
||||||
// if (!player.isOnline() || !_runners.HasPlayer(player))
|
|
||||||
// playerIter.remove();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void arrowDamage(CustomDamageEvent event)
|
public void arrowDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -921,20 +794,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new HumanReviveEvent(thrower, copy.GetPlayer()));
|
Bukkit.getPluginManager().callEvent(new HumanReviveEvent(thrower, copy.GetPlayer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revive a player
|
|
||||||
// for (Player player : GetPlayers(true))
|
|
||||||
// {
|
|
||||||
// GameTeam otherTeam = GetTeam(player);
|
|
||||||
// if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// if (UtilMath.offset(player.getLocation().add(0, 1, 0), event
|
|
||||||
// .getEntity().getLocation()) > 3)
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// playerIn(player, null, thrower);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -29,8 +29,6 @@ public class KitHumanMedic extends Kit
|
|||||||
private static final ItemStack[] PLAYER_ITEMS =
|
private static final ItemStack[] PLAYER_ITEMS =
|
||||||
{
|
{
|
||||||
ItemStackFactory.Instance.CreateStack(Material.STONE_AXE),
|
ItemStackFactory.Instance.CreateStack(Material.STONE_AXE),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE),
|
|
||||||
ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE),
|
|
||||||
new ItemBuilder(Material.POTION).setAmount(2).setData((short) 16429).setTitle(C.Reset + "Revival Potion").build(),
|
new ItemBuilder(Material.POTION).setAmount(2).setData((short) 16429).setTitle(C.Reset + "Revival Potion").build(),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package nautilus.game.arcade.kit.perks;
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -10,16 +11,18 @@ import org.bukkit.event.EventHandler;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
public class PerkWitherArrows extends Perk
|
public class PerkWitherArrows extends Perk
|
||||||
{
|
{
|
||||||
private WeakHashMap<Arrow, Player> _proj = new WeakHashMap<Arrow, Player>();
|
|
||||||
|
private final Map<Arrow, Player> _proj = new WeakHashMap<>();
|
||||||
|
|
||||||
public PerkWitherArrows()
|
public PerkWitherArrows()
|
||||||
{
|
{
|
||||||
@ -32,8 +35,10 @@ public class PerkWitherArrows extends Perk
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void shoot(UpdateEvent event)
|
public void shoot(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK || !Manager.GetGame().IsLive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilEnt;
|
|||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
@ -21,15 +22,19 @@ import mineplex.core.recharge.Recharge;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
|
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.entity.WitherSkull;
|
import org.bukkit.entity.WitherSkull;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -88,7 +93,7 @@ public class PerkWitherAttack extends Perk
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
WitherSkull skull = (WitherSkull)event.getEntity();
|
WitherSkull skull = (WitherSkull) event.getEntity();
|
||||||
|
|
||||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, skull.getLocation(), 0, 0, 0, 0, 1,
|
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, skull.getLocation(), 0, 0, 0, 0, 1,
|
||||||
ViewDist.MAX, UtilServer.getPlayers());
|
ViewDist.MAX, UtilServer.getPlayers());
|
||||||
@ -129,7 +134,7 @@ public class PerkWitherAttack extends Perk
|
|||||||
|
|
||||||
private void explode(WitherSkull skull)
|
private void explode(WitherSkull skull)
|
||||||
{
|
{
|
||||||
double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived()/20d);
|
double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived() / 20d);
|
||||||
|
|
||||||
//Players
|
//Players
|
||||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(skull.getLocation(), 7);
|
HashMap<Player, Double> players = UtilPlayer.getInRadius(skull.getLocation(), 7);
|
||||||
@ -139,32 +144,39 @@ public class PerkWitherAttack extends Perk
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Damage Event
|
//Damage Event
|
||||||
Manager.GetDamage().NewDamageEvent(player, (LivingEntity)skull.getShooter(), null,
|
Manager.GetDamage().NewDamageEvent(player, (LivingEntity) skull.getShooter(), null,
|
||||||
DamageCause.CUSTOM, 2 + 10 * players.get(player) * scale, true, true, false,
|
DamageCause.CUSTOM, 2 + 10 * players.get(player) * scale, true, true, false,
|
||||||
UtilEnt.getName((LivingEntity)skull.getShooter()), GetName());
|
UtilEnt.getName((LivingEntity) skull.getShooter()), GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Blocks
|
//Blocks
|
||||||
Set<Block> blocks = UtilBlock.getInRadius(skull.getLocation(), 4d).keySet();
|
Set<Block> blocks = UtilBlock.getInRadius(skull.getLocation(), 4d).keySet();
|
||||||
|
|
||||||
Iterator<Block> blockIterator = blocks.iterator();
|
blocks.removeIf(block ->
|
||||||
while (blockIterator.hasNext())
|
|
||||||
{
|
{
|
||||||
Block block = blockIterator.next();
|
if (block.isLiquid() || block.getRelative(BlockFace.UP).isLiquid())
|
||||||
|
{
|
||||||
if (block.isLiquid())
|
return true;
|
||||||
blockIterator.remove();
|
|
||||||
|
|
||||||
else if (block.getRelative(BlockFace.UP).isLiquid())
|
|
||||||
blockIterator.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Location location = block.getLocation();
|
||||||
|
|
||||||
|
for (Entity entity : block.getWorld().getEntitiesByClass(Skeleton.class))
|
||||||
|
{
|
||||||
|
if (UtilMath.offsetSquared(location, entity.getLocation()) < 9)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
if (Manager.GetGame() != null && Manager.GetGame() instanceof IBlockRestorer)
|
if (Manager.GetGame() != null && Manager.GetGame() instanceof IBlockRestorer)
|
||||||
{
|
{
|
||||||
((IBlockRestorer)Manager.GetGame()).addBlocks(blocks);
|
((IBlockRestorer) Manager.GetGame()).addBlocks(blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Manager.GetExplosion().BlockExplosion(blocks, skull.getLocation(), false);
|
Manager.GetExplosion().BlockExplosion(blocks, skull.getLocation(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
package nautilus.game.arcade.kit.perks;
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Arrow;
|
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.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
@ -26,20 +24,22 @@ import mineplex.core.common.util.F;
|
|||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
public class PerkWitherMinion extends Perk
|
public class PerkWitherMinion extends Perk
|
||||||
{
|
{
|
||||||
private ArrayList<Skeleton> _ents = new ArrayList<Skeleton>();
|
|
||||||
|
private final Map<Skeleton, Player> _minions = new HashMap<>();
|
||||||
|
|
||||||
public PerkWitherMinion()
|
public PerkWitherMinion()
|
||||||
{
|
{
|
||||||
@ -76,15 +76,15 @@ public class PerkWitherMinion extends Perk
|
|||||||
|
|
||||||
Manager.GetGame().CreatureAllowOverride = true;
|
Manager.GetGame().CreatureAllowOverride = true;
|
||||||
|
|
||||||
for (int i=0 ; i<2 ; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
Skeleton skel = player.getWorld().spawn(player.getEyeLocation(), Skeleton.class);
|
Skeleton skel = player.getWorld().spawn(player.getEyeLocation(), Skeleton.class);
|
||||||
_ents.add(skel);
|
_minions.put(skel, player);
|
||||||
|
|
||||||
skel.getEquipment().setHelmet(ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1));
|
skel.getEquipment().setHelmet(ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 1, 1));
|
||||||
|
|
||||||
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
|
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||||
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
|
LeatherArmorMeta meta = (LeatherArmorMeta) armor.getItemMeta();
|
||||||
meta.setColor(Color.BLACK);
|
meta.setColor(Color.BLACK);
|
||||||
armor.setItemMeta(meta);
|
armor.setItemMeta(meta);
|
||||||
skel.getEquipment().setChestplate(armor);
|
skel.getEquipment().setChestplate(armor);
|
||||||
@ -108,20 +108,25 @@ public class PerkWitherMinion extends Perk
|
|||||||
player.getWorld().playSound(player.getLocation(), Sound.WITHER_HURT, 2f, 0.6f);
|
player.getWorld().playSound(player.getLocation(), Sound.WITHER_HURT, 2f, 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void witherFallCancel(CustomDamageEvent event)
|
public void minionDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.IsCancelled())
|
if (event.IsCancelled())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.GetCause() != DamageCause.FALL)
|
LivingEntity damagee = event.GetDamageeEntity(), damager = event.GetDamagerEntity(true);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!_ents.contains(event.GetDamageeEntity()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
if (event.GetCause() == DamageCause.FALL && _minions.containsKey(damagee))
|
||||||
|
{
|
||||||
event.SetCancelled("Minion Fall Damage");
|
event.SetCancelled("Minion Fall Damage");
|
||||||
}
|
}
|
||||||
|
else if (_minions.containsKey(damager))
|
||||||
|
{
|
||||||
|
event.SetDamager(_minions.get(damager));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void entityTarget(EntityTargetEvent event)
|
public void entityTarget(EntityTargetEvent event)
|
||||||
@ -139,28 +144,24 @@ public class PerkWitherMinion extends Perk
|
|||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Iterator<Skeleton> skelIter = _ents.iterator();
|
_minions.keySet().removeIf(skel ->
|
||||||
|
|
||||||
while (skelIter.hasNext())
|
|
||||||
{
|
{
|
||||||
Skeleton skel = skelIter.next();
|
|
||||||
|
|
||||||
if (!skel.isValid() || skel.getTicksLived() > 300 || skel.getLocation().getY() < 0)
|
if (!skel.isValid() || skel.getTicksLived() > 300 || skel.getLocation().getY() < 0)
|
||||||
{
|
{
|
||||||
skel.remove();
|
skel.remove();
|
||||||
skelIter.remove();
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (skel.getTarget() == null)
|
if (skel.getTarget() == null)
|
||||||
{
|
{
|
||||||
skel.setTarget(UtilPlayer.getClosest(skel.getLocation(), getWitherTeam().GetPlayers(true)));
|
skel.setTarget(UtilPlayer.getClosest(skel.getLocation(), getWitherTeam().GetPlayers(true)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameTeam getWitherTeam()
|
private GameTeam getWitherTeam()
|
||||||
{
|
{
|
||||||
if (Manager.GetGame() == null)
|
if (Manager.GetGame() == null)
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user