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 _clientsProcessing = new AtomicInteger(0);
private final Rank WHITELIST_BYPASS;
public CoreClientManager(JavaPlugin plugin, String webServer)
{
this(plugin, webServer, Rank.MODERATOR);
}
public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass)
{
super("Client Manager", plugin);
@ -65,6 +72,7 @@ public class CoreClientManager extends MiniPlugin
_repository = new AccountRepository(plugin, webServer);
_clientList = new NautHashMap<String, CoreClient>();
_duplicateLoginGlitchPreventionList = new HashSet<String>();
WHITELIST_BYPASS = whitelistBypass;
}
public AccountRepository getRepository()
@ -195,7 +203,7 @@ public class CoreClientManager extends MiniPlugin
_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())
{

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.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);

View File

@ -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);
@ -1073,4 +1074,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
{
return _incognito;
}
public JumpManager getJumpManager()
{
return _jumpManager;
}
}

View File

@ -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)
{
@ -67,6 +70,7 @@ 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
@ -106,8 +110,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());
}
}

View File

@ -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,6 +20,7 @@ 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;
@ -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,7 +53,7 @@ import mineplex.hub.HubManager;
public class SoccerManager extends MiniPlugin
{
public HubManager Manager;
private HubManager _hubManager;
private HashSet<Player> _active = new HashSet<Player>();
@ -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(Manager.GetSpawn().getWorld(), 28.5,70,-27.5);
_cornerFieldPlayerB = new Location(Manager.GetSpawn().getWorld(), 50.5,100,-65.5);
_cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), 28.5,70,-27.5);
_cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 50.5,100,-65.5);
_cornerGoalPlayerA = new Location(Manager.GetSpawn().getWorld(), 35.5,70,-24.5);
_cornerGoalPlayerB = new Location(Manager.GetSpawn().getWorld(), 43.5,100,-68.5);
_cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), 35.5,70,-24.5);
_cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 43.5,100,-68.5);
_cornerFieldA = new Location(Manager.GetSpawn().getWorld(), 29.75,70,-28.75);
_cornerFieldB = new Location(Manager.GetSpawn().getWorld(), 49.25,100,-64.25);
_cornerFieldA = new Location(hubManager.GetSpawn().getWorld(), 29.75,70,-28.75);
_cornerFieldB = new Location(hubManager.GetSpawn().getWorld(), 49.25,100,-64.25);
_cornerRedGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-64.25);
_cornerRedGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-67.25);
_cornerRedGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-64.25);
_cornerRedGoalB = new Location(hubManager.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)
{
@ -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,9 +484,9 @@ public class SoccerManager extends MiniPlugin
}
}
public boolean isSoccerMode(Player player)
public boolean isSoccerMode(Entity entity)
{
return _active.contains(player);
return _active.contains(entity);
}
@EventHandler
@ -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)
{

View File

@ -7,6 +7,7 @@ import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.Rank;
import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
@ -48,7 +49,7 @@ public class StaffServer extends JavaPlugin
//Static Modules
CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER);
CommandCenter.Instance.setClientManager(clientManager);
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("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("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("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("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);
}

View File

@ -57,9 +57,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
@EventHandler
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;
}
@ -119,7 +119,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
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 + "Coins: " + C.cYellow + donor.getCoins());
caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getCoins());
caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems());
int enjinCoinsReceived = 0;
@ -234,7 +234,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
}
// 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 + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
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)
{
JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue");
JsonMessage coinBuilder = new JsonMessage("Shards : ").color("blue");
JsonMessage packageBuilder = new JsonMessage("Rank 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");
}
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");
}

View File

@ -17,7 +17,7 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
{
public CoinCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "coin");
super(plugin, Rank.MODERATOR, "coin", "shard", "shards");
}
@Override
@ -43,11 +43,11 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
{
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
{
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);

View File

@ -10,13 +10,13 @@ public class Coins extends SalesPackageBase
public Coins(SalesPackageManager manager, int amount)
{
super(manager, amount + " Coins");
super(manager, amount + " Shards");
_amount = amount;
}
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(" ");
addBackButton(agent, playerName);
}

View File

@ -2139,6 +2139,12 @@ public class MineStrike extends TeamGame
//Revive Dead Players
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())

View File

@ -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());

View File

@ -48,6 +48,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scoreboard.Team;
public class MonsterMaze extends SoloGame
@ -61,6 +63,9 @@ public class MonsterMaze extends SoloGame
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")
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
public void PotionEffects(UpdateEvent event)
{
@ -276,7 +311,7 @@ public class MonsterMaze extends SoloGame
else
{
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))

View File

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

View File

@ -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
@ -1695,6 +1701,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()
{

View File

@ -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)
{

View File

@ -634,6 +634,11 @@ 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

View File

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

View File

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

View File

@ -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();

View File

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

View File

@ -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();
@ -148,7 +143,7 @@ public class PerkFirefly extends SmashPerk
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))
{

View File

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

View File

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

View File

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

View File

@ -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
@ -109,6 +110,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,
DamageCause.CUSTOM, 4, true, true, false,

View File

@ -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()))
{

View File

@ -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,10 +128,24 @@ public class PerkWitherImage extends SmashPerk
@EventHandler
public void entityTarget(EntityTargetEvent event)
{
if (_images.containsKey(event.getTarget()))
if (_images.get(event.getTarget()).equals(event.getEntity()))
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
public void damage(CustomDamageEvent event)
@ -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)
{

View File

@ -69,7 +69,7 @@ public class GamePlayerManager implements Listener
}
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())
{