Merge branch 'project-cosmetics' into develop
This commit is contained in:
commit
17f89f6937
@ -0,0 +1,84 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
/**
|
||||
* This event is called when a gadget selects a location for a specific effect to be shown.
|
||||
*/
|
||||
public class GadgetSelectLocationEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private Gadget _gadget;
|
||||
private Location _location;
|
||||
private boolean _showMessage = true;
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public GadgetSelectLocationEvent(Player player, Gadget gadget, Location location)
|
||||
{
|
||||
_player = player;
|
||||
_gadget = gadget;
|
||||
_location = location;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Gadget getGadget()
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not a cancellation message should be displayed.
|
||||
*
|
||||
* @param showMessage True for the message to be shown and false for the message to be hidden/ignored.
|
||||
*/
|
||||
public void setShowMessage(boolean showMessage)
|
||||
{
|
||||
_showMessage = showMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not a cancellation message can be shown.
|
||||
*
|
||||
* @return True if the message can be shown and false if the message should be hidden/ignored.
|
||||
*/
|
||||
public boolean canShowMessage()
|
||||
{
|
||||
return _showMessage;
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -17,6 +18,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -32,6 +34,7 @@ import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
@ -105,6 +108,19 @@ public class MorphTitan extends MorphGadget
|
||||
|
||||
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
||||
|
||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
||||
|
||||
if (gadgetSelectLocationEvent.isCancelled())
|
||||
{
|
||||
if (gadgetSelectLocationEvent.canShowMessage())
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!"));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
|
||||
|
||||
stand.setVisible(false);
|
||||
|
@ -135,6 +135,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
private IncognitoManager _incognito;
|
||||
private ValentinesManager _valentinesManager;
|
||||
private BonusManager _bonusManager;
|
||||
private JumpManager _jumpManager;
|
||||
// private HalloweenSpookinessManager _halloweenManager;
|
||||
// private TrickOrTreatManager _trickOrTreatManager;
|
||||
|
||||
@ -181,7 +182,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_parkour = new ParkourManager(this, donationManager, taskManager);
|
||||
|
||||
new WorldManager(this);
|
||||
new JumpManager(this);
|
||||
_jumpManager = new JumpManager(this);
|
||||
//new TournamentInviter(this);
|
||||
|
||||
|
||||
@ -1072,4 +1073,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
{
|
||||
return _incognito;
|
||||
}
|
||||
|
||||
public JumpManager getJumpManager()
|
||||
{
|
||||
return _jumpManager;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -28,6 +30,7 @@ import mineplex.hub.HubManager;
|
||||
public class JumpManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
private HashSet<String> _preparedDoubleJump = new HashSet<>();
|
||||
|
||||
public JumpManager(HubManager manager)
|
||||
{
|
||||
@ -66,8 +69,9 @@ public class JumpManager extends MiniPlugin
|
||||
vec.setY(Math.abs(vec.getY()));
|
||||
|
||||
//Velocity
|
||||
_preparedDoubleJump.add(player.getName());
|
||||
UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true);
|
||||
|
||||
|
||||
//Sound
|
||||
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
|
||||
@ -105,8 +109,20 @@ public class JumpManager extends MiniPlugin
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(false);
|
||||
_preparedDoubleJump.remove(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_preparedDoubleJump.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
public boolean hasDoubleJumped(Player player)
|
||||
{
|
||||
return _preparedDoubleJump.contains(player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package mineplex.hub.modules;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Bat;
|
||||
@ -20,9 +20,10 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -37,8 +38,10 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
@ -50,8 +53,8 @@ import mineplex.hub.HubManager;
|
||||
|
||||
public class SoccerManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private HubManager _hubManager;
|
||||
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
private ArrayList<OutfitTeam> _teamArmor = new ArrayList<OutfitTeam>();
|
||||
@ -71,10 +74,10 @@ public class SoccerManager extends MiniPlugin
|
||||
private Location _cornerBlueGoalA;
|
||||
private Location _cornerBlueGoalB;
|
||||
|
||||
int _blueGoals = 0;
|
||||
int _redGoals = 0;
|
||||
private int _blueGoals = 0;
|
||||
private int _redGoals = 0;
|
||||
|
||||
int _insideGoalTicks = 0;
|
||||
private int _insideGoalTicks = 0;
|
||||
|
||||
private Slime _ball;
|
||||
private Vector _ballVel;
|
||||
@ -89,29 +92,29 @@ public class SoccerManager extends MiniPlugin
|
||||
protected Location _lastLoc;
|
||||
protected ArrayList<Vector> _velHistory = new ArrayList<Vector>();
|
||||
|
||||
public SoccerManager(HubManager manager, GadgetManager gadgets)
|
||||
public SoccerManager(HubManager hubManager, GadgetManager gadgetManager)
|
||||
{
|
||||
super("Football Manager", manager.getPlugin());
|
||||
super("Football Manager", hubManager.getPlugin());
|
||||
|
||||
Manager = manager;
|
||||
_hubManager = hubManager;
|
||||
|
||||
_cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), 28.5,70,-27.5);
|
||||
_cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 50.5,100,-65.5);
|
||||
|
||||
_cornerFieldPlayerA = new Location(Manager.GetSpawn().getWorld(), 28.5,70,-27.5);
|
||||
_cornerFieldPlayerB = new Location(Manager.GetSpawn().getWorld(), 50.5,100,-65.5);
|
||||
_cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), 35.5,70,-24.5);
|
||||
_cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 43.5,100,-68.5);
|
||||
|
||||
_cornerGoalPlayerA = new Location(Manager.GetSpawn().getWorld(), 35.5,70,-24.5);
|
||||
_cornerGoalPlayerB = new Location(Manager.GetSpawn().getWorld(), 43.5,100,-68.5);
|
||||
_cornerFieldA = new Location(hubManager.GetSpawn().getWorld(), 29.75,70,-28.75);
|
||||
_cornerFieldB = new Location(hubManager.GetSpawn().getWorld(), 49.25,100,-64.25);
|
||||
|
||||
_cornerFieldA = new Location(Manager.GetSpawn().getWorld(), 29.75,70,-28.75);
|
||||
_cornerFieldB = new Location(Manager.GetSpawn().getWorld(), 49.25,100,-64.25);
|
||||
_cornerRedGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-64.25);
|
||||
_cornerRedGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-67.25);
|
||||
|
||||
_cornerRedGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-64.25);
|
||||
_cornerRedGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-67.25);
|
||||
|
||||
_cornerBlueGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-25.75);
|
||||
_cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
|
||||
_cornerBlueGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-25.75);
|
||||
_cornerBlueGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
|
||||
|
||||
//Store Gadgets
|
||||
for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME))
|
||||
for (Gadget gadget : gadgetManager.getGadgets(GadgetType.COSTUME))
|
||||
{
|
||||
if (gadget instanceof OutfitTeam)
|
||||
{
|
||||
@ -352,7 +355,7 @@ public class SoccerManager extends MiniPlugin
|
||||
return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) ||
|
||||
UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void clean(UpdateEvent event)
|
||||
{
|
||||
@ -470,9 +473,9 @@ public class SoccerManager extends MiniPlugin
|
||||
outfit.add("Team Pants");
|
||||
outfit.add("Team Boots");
|
||||
|
||||
Manager.GetGadget().disableAll(player, outfit);
|
||||
Manager.GetMount().DisableAll(player);
|
||||
Manager.getPetManager().disableAll(player);
|
||||
_hubManager.GetGadget().disableAll(player, outfit);
|
||||
_hubManager.GetMount().DisableAll(player);
|
||||
_hubManager.getPetManager().disableAll(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -481,11 +484,11 @@ public class SoccerManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSoccerMode(Player player)
|
||||
public boolean isSoccerMode(Entity entity)
|
||||
{
|
||||
return _active.contains(player);
|
||||
return _active.contains(entity);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void disableGadgets(GadgetEnableEvent event)
|
||||
{
|
||||
@ -510,6 +513,35 @@ public class SoccerManager extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableStacker(StackerEvent event)
|
||||
{
|
||||
if (isSoccerMode(event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableGuardianLazer(GadgetSelectLocationEvent event)
|
||||
{
|
||||
if (UtilAlg.inBoundingBox(event.getLocation(), _cornerFieldA, _cornerFieldB))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
// Disable velocity but allow double jumping.
|
||||
|
||||
if (isSoccerMode(event.getPlayer()) && !_hubManager.getJumpManager().hasDoubleJumped(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
|
@ -2138,7 +2138,13 @@ public class MineStrike extends TeamGame
|
||||
team.SpawnTeleport(false);
|
||||
|
||||
//Revive Dead Players
|
||||
for (Player player : GetPlayers(false))
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (Manager.isVanished(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
SetPlayerState(player, PlayerState.IN);
|
||||
@ -2156,6 +2162,7 @@ public class MineStrike extends TeamGame
|
||||
if (GetKit(player) != null)
|
||||
GetKit(player).ApplyKit(player);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Scope
|
||||
for (Player player : GetPlayers(false))
|
||||
@ -2319,6 +2326,11 @@ public class MineStrike extends TeamGame
|
||||
if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
|
||||
return;
|
||||
|
||||
if (Manager.isVanished(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Target Team
|
||||
GameTeam targetTeam = null;
|
||||
if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size())
|
||||
|
@ -52,7 +52,13 @@ public class HighExplosive extends Grenade
|
||||
continue;
|
||||
|
||||
// Damage Event
|
||||
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(),
|
||||
Player damager = null;
|
||||
if (game.IsAlive(_thrower))
|
||||
{
|
||||
damager = _thrower;
|
||||
}
|
||||
|
||||
game.Manager.GetDamage().NewDamageEvent(player, damager, null, ent.getLocation(),
|
||||
DamageCause.CUSTOM, 1 + (players.get(player) * 18),
|
||||
true, true, false, _thrower.getName(), getName());
|
||||
|
||||
|
@ -55,7 +55,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
@ -1541,6 +1540,13 @@ public class SpeedBuilders extends SoloGame
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (liquid.getType() == Material.STATIONARY_WATER || liquid.getType() == Material.WATER)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1694,6 +1700,39 @@ public class SpeedBuilders extends SoloGame
|
||||
|
||||
UtilAction.velocity(event.getPlayer(), new Vector(0, 1, 0));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void fixDoorToggling(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (_state != SpeedBuildersState.BUILDING)
|
||||
return;
|
||||
|
||||
if (!_buildRecreations.containsKey(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (_perfectBuild.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
|
||||
if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
|
@ -324,6 +324,12 @@ public class RecreationData
|
||||
score++;
|
||||
}
|
||||
|
||||
//Fix for glowing redstone ore
|
||||
if ((expectedState.getType() == Material.REDSTONE_ORE && currentBlock.getType() == Material.GLOWING_REDSTONE_ORE) || (expectedState.getType() == Material.GLOWING_REDSTONE_ORE && currentBlock.getType() == Material.REDSTONE_ORE))
|
||||
{
|
||||
score++;
|
||||
}
|
||||
|
||||
//Fix for corner stair shape
|
||||
if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs)
|
||||
{
|
||||
|
@ -633,7 +633,12 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
{
|
||||
speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
|
||||
}
|
||||
|
||||
|
||||
if (speed < 0.01) //This is to stop players having negative speed when they go under the map
|
||||
{
|
||||
speed = 0.01;
|
||||
}
|
||||
|
||||
player.setFlySpeed((float) Math.min(1, speed));
|
||||
|
||||
// Bump
|
||||
|
@ -44,7 +44,12 @@ public abstract class PlayerPage extends BasePage
|
||||
players = new ArrayList<>();
|
||||
for (String s : _players)
|
||||
{
|
||||
players.add(Bukkit.getPlayer(s));
|
||||
Player player = Bukkit.getPlayer(s);
|
||||
|
||||
if (!_plugin.isVanished(player))
|
||||
{
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -56,7 +61,7 @@ public abstract class PlayerPage extends BasePage
|
||||
int slot = 9;
|
||||
for (Player player : players)
|
||||
{
|
||||
if (showPlayer(player))
|
||||
if (showPlayer(player) && !_plugin.isVanished(player))
|
||||
{
|
||||
ItemStack head = getPlayerHead(player.getName(), C.cGreen + C.Bold + player.getName(), new String[]{ ChatColor.RESET + C.cGray + getDisplayString(player) });
|
||||
addButton(slot, head, new Button(slot, player));
|
||||
|
@ -30,6 +30,7 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
public class PerkBoneRush extends SmashPerk implements IThrown
|
||||
@ -151,6 +152,18 @@ public class PerkBoneRush extends SmashPerk implements IThrown
|
||||
double damage = 0.7;
|
||||
String reason = GetName();
|
||||
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
Player targetPlayer = (Player) target;
|
||||
Player throwerPlayer = (Player) data.getThrower();
|
||||
|
||||
if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSuperActive(damager))
|
||||
{
|
||||
damage = 3;
|
||||
|
@ -39,10 +39,7 @@ public class PerkCreeperElectricity extends Perk
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FIRE_TICK)
|
||||
if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION)
|
||||
return;
|
||||
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
|
@ -21,8 +21,10 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -165,6 +167,15 @@ public class PerkCreeperExplode extends SmashPerk
|
||||
if (UtilMath.offset(player.getLocation(), spawn) < 14)
|
||||
spawnIterator.remove();
|
||||
}
|
||||
|
||||
//If all spawns have been destroyed revert to using the spectator spawn
|
||||
for (GameTeam team : Manager.GetGame().GetTeamList())
|
||||
{
|
||||
if (team.GetSpawns().isEmpty())
|
||||
{
|
||||
team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Damage
|
||||
|
@ -3,11 +3,8 @@ package nautilus.game.arcade.kit.perks;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -19,7 +16,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -30,7 +26,6 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
import nautilus.game.arcade.kit.perks.data.FireflyData;
|
||||
|
||||
@ -93,7 +88,7 @@ public class PerkFirefly extends SmashPerk
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
_tick = (_tick + 1)%1000;
|
||||
_tick++;
|
||||
|
||||
Iterator<FireflyData> dataIterator = _data.iterator();
|
||||
|
||||
@ -147,8 +142,8 @@ public class PerkFirefly extends SmashPerk
|
||||
continue;
|
||||
|
||||
other.playEffect(EntityEffect.HURT);
|
||||
|
||||
if (_tick == 0)
|
||||
|
||||
if (_tick % 12 == 0)
|
||||
{
|
||||
if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false))
|
||||
{
|
||||
@ -166,7 +161,7 @@ public class PerkFirefly extends SmashPerk
|
||||
{
|
||||
dataIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -20,7 +20,8 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
public class PerkInferno extends SmashPerk
|
||||
@ -119,4 +120,23 @@ public class PerkInferno extends SmashPerk
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
|
||||
if (event.GetDamagerPlayer(true) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (smash.GetTeam(event.GetDamagerPlayer(true)).equals(smash.GetTeam(event.GetDamageePlayer())))
|
||||
{
|
||||
event.GetDamageeEntity().setFireTicks(0);
|
||||
event.SetCancelled("Team Damage");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -74,7 +75,7 @@ public class PerkLeap extends Perk
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
|
||||
if (!UtilItem.isAxe(event.getPlayer().getItemInHand()))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@ -96,7 +97,7 @@ public class PerkLeap extends Perk
|
||||
}
|
||||
|
||||
//Energy
|
||||
if (!Recharge.Instance.use(player, _name, _recharge, true, true))
|
||||
if (!Recharge.Instance.use(player, _name, _recharge, false, true))
|
||||
return;
|
||||
|
||||
//Use Use
|
||||
|
@ -13,8 +13,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -22,6 +20,7 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
import nautilus.game.arcade.kit.perks.data.NightLivingDeadData;
|
||||
|
||||
@ -126,6 +125,16 @@ public class PerkNightLivingDead extends SmashPerk
|
||||
{
|
||||
if (data.Zombies.contains(event.getEntity()))
|
||||
{
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
Player targetPlayer = (Player) event.getTarget();
|
||||
|
||||
if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
if (data.Player.equals(event.getTarget()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
@ -33,6 +33,7 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
public class PerkPigBaconBounce extends SmashPerk implements IThrown
|
||||
@ -108,6 +109,18 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
Player targetPlayer = (Player) target;
|
||||
Player throwerPlayer = (Player) data.getThrower();
|
||||
|
||||
if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
|
||||
|
@ -33,6 +33,7 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
public class PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
@ -208,6 +209,17 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
if (!_owner.containsKey(event.getEntity()))
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
Player targetPlayer = (Player) event.getTarget();
|
||||
|
||||
if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_owner.get(event.getEntity()).equals(event.getTarget()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -225,6 +237,18 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
|
||||
Slime slime = (Slime)data.getThrown();
|
||||
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
Player targetPlayer = (Player) target;
|
||||
Player throwerPlayer = (Player) data.getThrower();
|
||||
|
||||
if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
|
||||
DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false,
|
||||
@ -275,6 +299,16 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
//if (owner != null)
|
||||
// event.SetDamager(owner); This gives knockback from wrong direction :(
|
||||
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
|
||||
if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer())))
|
||||
{
|
||||
event.SetCancelled("Team Damage");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (owner != null && owner.equals(event.GetDamageeEntity()))
|
||||
{
|
||||
|
@ -2,6 +2,17 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -17,20 +28,10 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
|
||||
public class PerkWitherImage extends SmashPerk
|
||||
{
|
||||
private HashMap<Player, Skeleton> _images = new HashMap<Player, Skeleton>();
|
||||
private HashMap<Player, Skeleton> _ownerToSkeleton = new HashMap<Player, Skeleton>();
|
||||
private HashMap<Skeleton, Player> _skeletonToOwner = new HashMap<Skeleton, Player>();
|
||||
|
||||
public PerkWitherImage()
|
||||
{
|
||||
@ -67,7 +68,7 @@ public class PerkWitherImage extends SmashPerk
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!_images.containsKey(player))
|
||||
if (!_ownerToSkeleton.containsKey(player))
|
||||
{
|
||||
if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
|
||||
return;
|
||||
@ -94,7 +95,8 @@ public class PerkWitherImage extends SmashPerk
|
||||
|
||||
UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true);
|
||||
|
||||
_images.put(player, skel);
|
||||
_ownerToSkeleton.put(player, skel);
|
||||
_skeletonToOwner.put(skel, player);
|
||||
|
||||
Recharge.Instance.use(player, "Wither Swap", 500, false, false);
|
||||
|
||||
@ -109,7 +111,7 @@ public class PerkWitherImage extends SmashPerk
|
||||
if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false))
|
||||
return;
|
||||
|
||||
Skeleton skel = _images.get(player);
|
||||
Skeleton skel = _ownerToSkeleton.get(player);
|
||||
|
||||
Location loc = skel.getLocation();
|
||||
skel.teleport(player.getLocation());
|
||||
@ -126,9 +128,23 @@ public class PerkWitherImage extends SmashPerk
|
||||
@EventHandler
|
||||
public void entityTarget(EntityTargetEvent event)
|
||||
{
|
||||
if (_images.containsKey(event.getTarget()))
|
||||
if (_images.get(event.getTarget()).equals(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
if (_skeletonToOwner.containsKey(event.getEntity()))
|
||||
{
|
||||
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
|
||||
{
|
||||
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
|
||||
Player targetPlayer = (Player) event.getTarget();
|
||||
|
||||
if(smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
if (_ownerToSkeleton.get(event.getTarget()).equals(event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -137,13 +153,13 @@ public class PerkWitherImage extends SmashPerk
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null) return;
|
||||
|
||||
if (!_images.containsKey(damagee))
|
||||
if (!_ownerToSkeleton.containsKey(damagee.getUniqueId()))
|
||||
return;
|
||||
|
||||
LivingEntity damager = event.GetDamagerEntity(false);
|
||||
if (damager == null) return;
|
||||
|
||||
if (_images.get(damagee).equals(damager))
|
||||
if (_ownerToSkeleton.get(damagee.getUniqueId()).equals(damager))
|
||||
event.SetCancelled("Wither Image");
|
||||
}
|
||||
|
||||
@ -153,12 +169,12 @@ public class PerkWitherImage extends SmashPerk
|
||||
LivingEntity damager = event.GetDamagerEntity(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!_images.containsValue(damager))
|
||||
if (!_ownerToSkeleton.containsValue(damager))
|
||||
return;
|
||||
|
||||
for (Player player : _images.keySet())
|
||||
for (Player player : _ownerToSkeleton.keySet())
|
||||
{
|
||||
if (_images.get(player).equals(damager))
|
||||
if (_ownerToSkeleton.get(player).equals(damager))
|
||||
{
|
||||
event.SetDamager(player);
|
||||
event.setKnockbackOrigin(damager.getLocation());
|
||||
@ -173,12 +189,12 @@ public class PerkWitherImage extends SmashPerk
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Player> playerIterator = _images.keySet().iterator();
|
||||
Iterator<Player> playerIterator = _ownerToSkeleton.keySet().iterator();
|
||||
|
||||
while (playerIterator.hasNext())
|
||||
{
|
||||
Player player = playerIterator.next();
|
||||
Skeleton skel = _images.get(player);
|
||||
Skeleton skel = _ownerToSkeleton.get(player);
|
||||
|
||||
if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160)
|
||||
{
|
||||
@ -195,7 +211,8 @@ public class PerkWitherImage extends SmashPerk
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void clean(PlayerDeathEvent event)
|
||||
{
|
||||
Skeleton skel = _images.remove(event.getEntity());
|
||||
Skeleton skel = _ownerToSkeleton.remove(event.getEntity());
|
||||
_skeletonToOwner.remove(skel);
|
||||
|
||||
if (skel != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user