Merge branch 'develop' into thanos-mineware

This commit is contained in:
Thanos Paravantis 2016-07-06 17:48:31 +03:00
commit 185ba600ca
30 changed files with 483 additions and 102 deletions

View File

@ -57,7 +57,14 @@ public class CoreClientManager extends MiniPlugin
private static AtomicInteger _clientsConnecting = new AtomicInteger(0); private static AtomicInteger _clientsConnecting = new AtomicInteger(0);
private static AtomicInteger _clientsProcessing = new AtomicInteger(0); private static AtomicInteger _clientsProcessing = new AtomicInteger(0);
private final Rank WHITELIST_BYPASS;
public CoreClientManager(JavaPlugin plugin, String webServer) public CoreClientManager(JavaPlugin plugin, String webServer)
{
this(plugin, webServer, Rank.MODERATOR);
}
public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass)
{ {
super("Client Manager", plugin); super("Client Manager", plugin);
@ -65,6 +72,7 @@ public class CoreClientManager extends MiniPlugin
_repository = new AccountRepository(plugin, webServer); _repository = new AccountRepository(plugin, webServer);
_clientList = new NautHashMap<String, CoreClient>(); _clientList = new NautHashMap<String, CoreClient>();
_duplicateLoginGlitchPreventionList = new HashSet<String>(); _duplicateLoginGlitchPreventionList = new HashSet<String>();
WHITELIST_BYPASS = whitelistBypass;
} }
public AccountRepository getRepository() public AccountRepository getRepository()
@ -195,7 +203,7 @@ public class CoreClientManager extends MiniPlugin
_clientsProcessing.decrementAndGet(); _clientsProcessing.decrementAndGet();
} }
if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(Rank.MODERATOR)) if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(WHITELIST_BYPASS))
{ {
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
{ {

View File

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

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -17,6 +18,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; 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.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargedEvent; 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); 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); ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
stand.setVisible(false); stand.setVisible(false);

View File

@ -135,6 +135,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private IncognitoManager _incognito; private IncognitoManager _incognito;
private ValentinesManager _valentinesManager; private ValentinesManager _valentinesManager;
private BonusManager _bonusManager; private BonusManager _bonusManager;
private JumpManager _jumpManager;
// private HalloweenSpookinessManager _halloweenManager; // private HalloweenSpookinessManager _halloweenManager;
// private TrickOrTreatManager _trickOrTreatManager; // private TrickOrTreatManager _trickOrTreatManager;
@ -181,7 +182,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
_parkour = new ParkourManager(this, donationManager, taskManager); _parkour = new ParkourManager(this, donationManager, taskManager);
new WorldManager(this); new WorldManager(this);
new JumpManager(this); _jumpManager = new JumpManager(this);
//new TournamentInviter(this); //new TournamentInviter(this);
@ -1073,4 +1074,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
return _incognito; return _incognito;
} }
public JumpManager getJumpManager()
{
return _jumpManager;
}
} }

View File

@ -1,11 +1,13 @@
package mineplex.hub.modules; package mineplex.hub.modules;
import org.bukkit.Bukkit; import java.util.HashSet;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
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.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -28,6 +30,7 @@ import mineplex.hub.HubManager;
public class JumpManager extends MiniPlugin public class JumpManager extends MiniPlugin
{ {
public HubManager Manager; public HubManager Manager;
private HashSet<String> _preparedDoubleJump = new HashSet<>();
public JumpManager(HubManager manager) public JumpManager(HubManager manager)
{ {
@ -67,8 +70,9 @@ public class JumpManager extends MiniPlugin
vec.setY(Math.abs(vec.getY())); vec.setY(Math.abs(vec.getY()));
//Velocity //Velocity
_preparedDoubleJump.add(player.getName());
UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true); UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true);
//Sound //Sound
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
@ -106,8 +110,20 @@ public class JumpManager extends MiniPlugin
{ {
player.setAllowFlight(true); player.setAllowFlight(true);
player.setFlying(false); 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());
}
} }

View File

@ -3,9 +3,9 @@ package mineplex.hub.modules;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Color;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
@ -20,9 +20,10 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; 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.UtilServer;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
@ -50,8 +53,8 @@ import mineplex.hub.HubManager;
public class SoccerManager extends MiniPlugin public class SoccerManager extends MiniPlugin
{ {
public HubManager Manager; private HubManager _hubManager;
private HashSet<Player> _active = new HashSet<Player>(); private HashSet<Player> _active = new HashSet<Player>();
private ArrayList<OutfitTeam> _teamArmor = new ArrayList<OutfitTeam>(); private ArrayList<OutfitTeam> _teamArmor = new ArrayList<OutfitTeam>();
@ -71,10 +74,10 @@ public class SoccerManager extends MiniPlugin
private Location _cornerBlueGoalA; private Location _cornerBlueGoalA;
private Location _cornerBlueGoalB; private Location _cornerBlueGoalB;
int _blueGoals = 0; private int _blueGoals = 0;
int _redGoals = 0; private int _redGoals = 0;
int _insideGoalTicks = 0; private int _insideGoalTicks = 0;
private Slime _ball; private Slime _ball;
private Vector _ballVel; private Vector _ballVel;
@ -89,29 +92,29 @@ public class SoccerManager extends MiniPlugin
protected Location _lastLoc; protected Location _lastLoc;
protected ArrayList<Vector> _velHistory = new ArrayList<Vector>(); 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); _cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), 35.5,70,-24.5);
_cornerFieldPlayerB = new Location(Manager.GetSpawn().getWorld(), 50.5,100,-65.5); _cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 43.5,100,-68.5);
_cornerGoalPlayerA = new Location(Manager.GetSpawn().getWorld(), 35.5,70,-24.5); _cornerFieldA = new Location(hubManager.GetSpawn().getWorld(), 29.75,70,-28.75);
_cornerGoalPlayerB = new Location(Manager.GetSpawn().getWorld(), 43.5,100,-68.5); _cornerFieldB = new Location(hubManager.GetSpawn().getWorld(), 49.25,100,-64.25);
_cornerFieldA = new Location(Manager.GetSpawn().getWorld(), 29.75,70,-28.75); _cornerRedGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-64.25);
_cornerFieldB = new Location(Manager.GetSpawn().getWorld(), 49.25,100,-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); _cornerBlueGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-25.75);
_cornerRedGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-67.25); _cornerBlueGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
_cornerBlueGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-25.75);
_cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
//Store Gadgets //Store Gadgets
for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME)) for (Gadget gadget : gadgetManager.getGadgets(GadgetType.COSTUME))
{ {
if (gadget instanceof OutfitTeam) if (gadget instanceof OutfitTeam)
{ {
@ -352,7 +355,7 @@ public class SoccerManager extends MiniPlugin
return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) || return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) ||
UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB); UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB);
} }
@EventHandler @EventHandler
public void clean(UpdateEvent event) public void clean(UpdateEvent event)
{ {
@ -470,9 +473,9 @@ public class SoccerManager extends MiniPlugin
outfit.add("Team Pants"); outfit.add("Team Pants");
outfit.add("Team Boots"); outfit.add("Team Boots");
Manager.GetGadget().disableAll(player, outfit); _hubManager.GetGadget().disableAll(player, outfit);
Manager.GetMount().DisableAll(player); _hubManager.GetMount().DisableAll(player);
Manager.getPetManager().DisableAll(player); _hubManager.getPetManager().DisableAll(player);
} }
else 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 @EventHandler
public void disableGadgets(GadgetEnableEvent event) public void disableGadgets(GadgetEnableEvent event)
{ {
@ -510,6 +513,35 @@ public class SoccerManager extends MiniPlugin
event.setCancelled(true); 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 @EventHandler
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {

View File

@ -7,6 +7,7 @@ import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.common.Rank;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager; import mineplex.core.elo.EloManager;
@ -48,7 +49,7 @@ public class StaffServer extends JavaPlugin
//Static Modules //Static Modules
CommandCenter.Initialize(this); CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER);
CommandCenter.Instance.setClientManager(clientManager); CommandCenter.Instance.setClientManager(clientManager);
Recharge.Initialize(this); Recharge.Initialize(this);
@ -83,15 +84,15 @@ public class StaffServer extends JavaPlugin
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("57791647-93b1-4980-8835-7fddadd20eb8"), "xTheOnlyOreOx")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD"));
new ProfileCacheManager(this); new ProfileCacheManager(this);
} }

View File

@ -57,9 +57,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
@EventHandler @EventHandler
public void Join(PlayerJoinEvent event) public void Join(PlayerJoinEvent event)
{ {
if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.SUPPORT))
{ {
event.getPlayer().kickPlayer("Only for staff."); event.getPlayer().kickPlayer("Only for support staff.");
return; return;
} }
@ -119,7 +119,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cDGreen + C.Strike + "============================================="); caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName); caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName);
caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name))); caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
caller.sendMessage(C.cBlue + "Coins: " + C.cYellow + donor.getCoins()); caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getCoins());
caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems()); caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems());
int enjinCoinsReceived = 0; int enjinCoinsReceived = 0;
@ -234,7 +234,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
} }
// Strutt20 asked me to remove some stuff from the menu // Strutt20 asked me to remove some stuff from the menu
caller.sendMessage(C.cBlue + "Enjin Coin Total Received: " + C.cYellow + enjinCoinsReceived); caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived);
caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived); caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived);
caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived);

View File

@ -94,7 +94,7 @@ public class SalesPackageManager extends MiniPlugin
public void displaySalesPackages(Player caller, String playerName) public void displaySalesPackages(Player caller, String playerName)
{ {
JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue"); JsonMessage coinBuilder = new JsonMessage("Shards : ").color("blue");
JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue"); JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue");
JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue"); JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue");
@ -104,7 +104,7 @@ public class SalesPackageManager extends MiniPlugin
{ {
coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
} }
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest) else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest)
{ {
chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
} }

View File

@ -17,7 +17,7 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
{ {
public CoinCommand(SalesPackageManager plugin) public CoinCommand(SalesPackageManager plugin)
{ {
super(plugin, Rank.MODERATOR, "coin"); super(plugin, Rank.MODERATOR, "coin", "shard", "shards");
} }
@Override @Override
@ -43,11 +43,11 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
{ {
if (completed) if (completed)
{ {
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!")); caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " shards to " + playerName + "'s account!"));
} }
else else
{ {
UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Coins") + " to " + F.name(playerName) + ".")); UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Shards") + " to " + F.name(playerName) + "."));
} }
} }
}, caller.getName(), playerName, client.getAccountId(), amount); }, caller.getName(), playerName, client.getAccountId(), amount);

View File

@ -10,13 +10,13 @@ public class Coins extends SalesPackageBase
public Coins(SalesPackageManager manager, int amount) public Coins(SalesPackageManager manager, int amount)
{ {
super(manager, amount + " Coins"); super(manager, amount + " Shards");
_amount = amount; _amount = amount;
} }
public void displayToAgent(Player agent, String playerName) public void displayToAgent(Player agent, String playerName)
{ {
addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Coins."); addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Shards.");
agent.sendMessage(" "); agent.sendMessage(" ");
addBackButton(agent, playerName); addBackButton(agent, playerName);
} }

View File

@ -2138,7 +2138,13 @@ public class MineStrike extends TeamGame
team.SpawnTeleport(false); team.SpawnTeleport(false);
//Revive Dead Players //Revive Dead Players
for (Player player : GetPlayers(false)) for (Player player : GetPlayers(false))
{
if (Manager.isVanished(player))
{
continue;
}
if (!IsAlive(player)) if (!IsAlive(player))
{ {
SetPlayerState(player, PlayerState.IN); SetPlayerState(player, PlayerState.IN);
@ -2156,6 +2162,7 @@ public class MineStrike extends TeamGame
if (GetKit(player) != null) if (GetKit(player) != null)
GetKit(player).ApplyKit(player); GetKit(player).ApplyKit(player);
} }
}
//Remove Scope //Remove Scope
for (Player player : GetPlayers(false)) for (Player player : GetPlayers(false))
@ -2319,6 +2326,11 @@ public class MineStrike extends TeamGame
if (GetState() == GameState.Recruit || GetState() == GameState.Loading) if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
return; return;
if (Manager.isVanished(event.getPlayer()))
{
return;
}
//Target Team //Target Team
GameTeam targetTeam = null; GameTeam targetTeam = null;
if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size()) if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size())

View File

@ -52,7 +52,13 @@ public class HighExplosive extends Grenade
continue; continue;
// Damage Event // 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), DamageCause.CUSTOM, 1 + (players.get(player) * 18),
true, true, false, _thrower.getName(), getName()); true, true, false, _thrower.getName(), getName());

View File

@ -48,6 +48,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
public class MonsterMaze extends SoloGame public class MonsterMaze extends SoloGame
@ -60,6 +62,9 @@ public class MonsterMaze extends SoloGame
private Location _center; private Location _center;
private HashMap<Player, Long> _launched = new HashMap<Player, Long>(); private HashMap<Player, Long> _launched = new HashMap<Player, Long>();
private static final int JUMP_POTION_AMPLIFIER = -10;
private int _potionMult = JUMP_POTION_AMPLIFIER;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public MonsterMaze(ArcadeManager manager) public MonsterMaze(ArcadeManager manager)
@ -260,6 +265,36 @@ public class MonsterMaze extends SoloGame
} }
} }
@EventHandler
public void onDebug(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (event.getMessage().toLowerCase().contains("/setmult "))
{
event.setCancelled(true);
Integer mult = Integer.parseInt(event.getMessage().toLowerCase().replace("/setmult ", ""));
_potionMult = mult;
for (Player pl : GetPlayers(true))
{
Manager.GetCondition().Clean(pl);
}
}
}
@EventHandler
public void onBreakJumper(InventoryClickEvent event)
{
if (!InProgress())
return;
if (!IsAlive(event.getWhoClicked()))
return;
event.setCancelled(true);
}
@EventHandler @EventHandler
public void PotionEffects(UpdateEvent event) public void PotionEffects(UpdateEvent event)
{ {
@ -276,7 +311,7 @@ public class MonsterMaze extends SoloGame
else else
{ {
if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null)) if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null))
Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false); Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, _potionMult, true, false, false);
} }
// if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null)) // if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null))

View File

@ -42,7 +42,7 @@ public class KitJumper extends ProgressingKit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().setItem(4, PLAYER_ITEMS[4]); player.getInventory().setItem(4, PLAYER_ITEMS[0]);
player.getInventory().setItem(8, PLAYER_ITEMS[8]); player.getInventory().setItem(8, PLAYER_ITEMS[1]);
} }
} }

View File

@ -55,7 +55,6 @@ 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.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.ArmorStand; 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!")); 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 @EventHandler
@ -1694,6 +1700,39 @@ public class SpeedBuilders extends SoloGame
UtilAction.velocity(event.getPlayer(), new Vector(0, 1, 0)); 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 @Override
public void EndCheck() public void EndCheck()

View File

@ -324,6 +324,12 @@ public class RecreationData
score++; 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 //Fix for corner stair shape
if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs)
{ {

View File

@ -633,7 +633,12 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{ {
speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006; 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)); player.setFlySpeed((float) Math.min(1, speed));
// Bump // Bump

View File

@ -44,7 +44,12 @@ public abstract class PlayerPage extends BasePage
players = new ArrayList<>(); players = new ArrayList<>();
for (String s : _players) for (String s : _players)
{ {
players.add(Bukkit.getPlayer(s)); Player player = Bukkit.getPlayer(s);
if (!_plugin.isVanished(player))
{
players.add(player);
}
} }
} }
else else
@ -56,7 +61,7 @@ public abstract class PlayerPage extends BasePage
int slot = 9; int slot = 9;
for (Player player : players) 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) }); 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)); addButton(slot, head, new Button(slot, player));

View File

@ -30,6 +30,7 @@ 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.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkBoneRush extends SmashPerk implements IThrown public class PerkBoneRush extends SmashPerk implements IThrown
@ -151,6 +152,18 @@ public class PerkBoneRush extends SmashPerk implements IThrown
double damage = 0.7; double damage = 0.7;
String reason = GetName(); 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)) if (isSuperActive(damager))
{ {
damage = 3; damage = 3;

View File

@ -39,10 +39,7 @@ public class PerkCreeperElectricity extends Perk
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
if (event.GetCause() == DamageCause.ENTITY_ATTACK) if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION)
return;
if (event.GetCause() == DamageCause.FIRE_TICK)
return; return;
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();

View File

@ -21,8 +21,10 @@ 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.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -165,6 +167,15 @@ public class PerkCreeperExplode extends SmashPerk
if (UtilMath.offset(player.getLocation(), spawn) < 14) if (UtilMath.offset(player.getLocation(), spawn) < 14)
spawnIterator.remove(); 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 //Damage

View File

@ -3,11 +3,8 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Color;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.FireworkEffect;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; 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.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.UtilFirework;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -30,7 +26,6 @@ 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.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.kit.perks.data.FireflyData; import nautilus.game.arcade.kit.perks.data.FireflyData;
@ -93,7 +88,7 @@ public class PerkFirefly extends SmashPerk
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
_tick = (_tick + 1)%1000; _tick++;
Iterator<FireflyData> dataIterator = _data.iterator(); Iterator<FireflyData> dataIterator = _data.iterator();
@ -147,8 +142,8 @@ public class PerkFirefly extends SmashPerk
continue; continue;
other.playEffect(EntityEffect.HURT); 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)) 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(); dataIterator.remove();
} }
} }
} }
@EventHandler @EventHandler

View File

@ -20,7 +20,8 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
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 mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkInferno extends 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");
}
}
}
} }

View File

@ -14,6 +14,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
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.UtilItem;
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.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -74,7 +75,7 @@ public class PerkLeap extends Perk
if (event.getPlayer().getItemInHand() == null) if (event.getPlayer().getItemInHand() == null)
return; return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) if (!UtilItem.isAxe(event.getPlayer().getItemInHand()))
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -96,7 +97,7 @@ public class PerkLeap extends Perk
} }
//Energy //Energy
if (!Recharge.Instance.use(player, _name, _recharge, true, true)) if (!Recharge.Instance.use(player, _name, _recharge, false, true))
return; return;
//Use Use //Use Use

View File

@ -13,8 +13,6 @@ 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.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg; 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.common.util.UtilTime;
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.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData;
@ -126,6 +125,16 @@ public class PerkNightLivingDead extends SmashPerk
{ {
if (data.Zombies.contains(event.getEntity())) 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())) if (data.Player.equals(event.getTarget()))
{ {
event.setCancelled(true); event.setCancelled(true);

View File

@ -33,6 +33,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkPigBaconBounce extends SmashPerk implements IThrown public class PerkPigBaconBounce extends SmashPerk implements IThrown
@ -108,6 +109,18 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown
if (target == null) if (target == null)
return; 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 //Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,

View File

@ -33,6 +33,7 @@ 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.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkSlimeRocket extends SmashPerk implements IThrown public class PerkSlimeRocket extends SmashPerk implements IThrown
@ -208,6 +209,17 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
if (!_owner.containsKey(event.getEntity())) if (!_owner.containsKey(event.getEntity()))
return; 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())) if (_owner.get(event.getEntity()).equals(event.getTarget()))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -225,6 +237,18 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
Slime slime = (Slime)data.getThrown(); 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 //Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false,
@ -275,6 +299,16 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
//if (owner != null) //if (owner != null)
// event.SetDamager(owner); This gives knockback from wrong direction :( // 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())) if (owner != null && owner.equals(event.GetDamageeEntity()))
{ {

View File

@ -2,6 +2,17 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; 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.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -17,20 +28,10 @@ import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent; 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 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() public PerkWitherImage()
{ {
@ -67,7 +68,7 @@ public class PerkWitherImage extends SmashPerk
if (!Kit.HasKit(player)) if (!Kit.HasKit(player))
return; return;
if (!_images.containsKey(player)) if (!_ownerToSkeleton.containsKey(player))
{ {
if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
return; return;
@ -94,7 +95,8 @@ public class PerkWitherImage extends SmashPerk
UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); 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); 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)) if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false))
return; return;
Skeleton skel = _images.get(player); Skeleton skel = _ownerToSkeleton.get(player);
Location loc = skel.getLocation(); Location loc = skel.getLocation();
skel.teleport(player.getLocation()); skel.teleport(player.getLocation());
@ -126,9 +128,23 @@ public class PerkWitherImage extends SmashPerk
@EventHandler @EventHandler
public void entityTarget(EntityTargetEvent event) public void entityTarget(EntityTargetEvent event)
{ {
if (_images.containsKey(event.getTarget())) if (_skeletonToOwner.containsKey(event.getEntity()))
if (_images.get(event.getTarget()).equals(event.getEntity())) {
event.setCancelled(true); 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 @EventHandler
@ -137,13 +153,13 @@ public class PerkWitherImage extends SmashPerk
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) return; if (damagee == null) return;
if (!_images.containsKey(damagee)) if (!_ownerToSkeleton.containsKey(damagee.getUniqueId()))
return; return;
LivingEntity damager = event.GetDamagerEntity(false); LivingEntity damager = event.GetDamagerEntity(false);
if (damager == null) return; if (damager == null) return;
if (_images.get(damagee).equals(damager)) if (_ownerToSkeleton.get(damagee.getUniqueId()).equals(damager))
event.SetCancelled("Wither Image"); event.SetCancelled("Wither Image");
} }
@ -153,12 +169,12 @@ public class PerkWitherImage extends SmashPerk
LivingEntity damager = event.GetDamagerEntity(true); LivingEntity damager = event.GetDamagerEntity(true);
if (damager == null) return; if (damager == null) return;
if (!_images.containsValue(damager)) if (!_ownerToSkeleton.containsValue(damager))
return; 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.SetDamager(player);
event.setKnockbackOrigin(damager.getLocation()); event.setKnockbackOrigin(damager.getLocation());
@ -173,12 +189,12 @@ public class PerkWitherImage extends SmashPerk
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
Iterator<Player> playerIterator = _images.keySet().iterator(); Iterator<Player> playerIterator = _ownerToSkeleton.keySet().iterator();
while (playerIterator.hasNext()) while (playerIterator.hasNext())
{ {
Player player = playerIterator.next(); Player player = playerIterator.next();
Skeleton skel = _images.get(player); Skeleton skel = _ownerToSkeleton.get(player);
if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160) if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160)
{ {
@ -195,7 +211,8 @@ public class PerkWitherImage extends SmashPerk
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void clean(PlayerDeathEvent event) public void clean(PlayerDeathEvent event)
{ {
Skeleton skel = _images.remove(event.getEntity()); Skeleton skel = _ownerToSkeleton.remove(event.getEntity());
_skeletonToOwner.remove(skel);
if (skel != null) if (skel != null)
{ {

View File

@ -69,7 +69,7 @@ public class GamePlayerManager implements Listener
} }
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))
{ {
if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY)) if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player))
{ {
for (Player viewer : Bukkit.getOnlinePlayers()) for (Player viewer : Bukkit.getOnlinePlayers())
{ {