Kit Changes/Fixes:
- Fixed Kit Mobs not opening guis in Champions games - Fixed Abilities not working in CTF - Added new event when a player attempts to choose a kit - Cancelled changing kit while holding a flag
This commit is contained in:
parent
149d37caad
commit
6fefcbd953
@ -1,12 +1,109 @@
|
|||||||
package nautilus.game.arcade;
|
package nautilus.game.arcade;
|
||||||
|
|
||||||
import java.awt.Event;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.achievement.AchievementManager;
|
||||||
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
|
import mineplex.core.blood.Blood;
|
||||||
|
import mineplex.core.bonuses.BonusManager;
|
||||||
|
import mineplex.core.chat.Chat;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilGear;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
|
import mineplex.core.creature.Creature;
|
||||||
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.elo.EloManager;
|
||||||
|
import mineplex.core.energy.Energy;
|
||||||
|
import mineplex.core.explosion.Explosion;
|
||||||
|
import mineplex.core.hologram.HologramManager;
|
||||||
|
import mineplex.core.inventory.InventoryManager;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.movement.Movement;
|
||||||
|
import mineplex.core.notifier.NotificationManager;
|
||||||
|
import mineplex.core.npc.NpcManager;
|
||||||
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketInfo;
|
||||||
|
import mineplex.core.packethandler.PacketPlayResourcePackStatus;
|
||||||
|
import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus;
|
||||||
|
import mineplex.core.party.PartyManager;
|
||||||
|
import mineplex.core.pet.PetManager;
|
||||||
|
import mineplex.core.poll.PollManager;
|
||||||
|
import mineplex.core.portal.Portal;
|
||||||
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
|
import mineplex.core.resourcepack.ResPackManager;
|
||||||
|
import mineplex.core.resourcepack.ResUnloadCheck;
|
||||||
|
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
||||||
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.rewards.PetReward;
|
||||||
|
import mineplex.core.stats.StatsManager;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.core.task.TaskManager;
|
||||||
|
import mineplex.core.teleport.Teleport;
|
||||||
|
import mineplex.core.timing.TimingManager;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||||
|
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
|
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||||
|
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
|
||||||
|
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||||
|
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||||
|
import mineplex.minecraft.game.core.IRelation;
|
||||||
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||||
|
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||||
|
import mineplex.minecraft.game.core.fire.Fire;
|
||||||
|
import nautilus.game.arcade.addons.SoupAddon;
|
||||||
|
import nautilus.game.arcade.addons.TeamArmorAddon;
|
||||||
|
import nautilus.game.arcade.addons.compass.CompassAddon;
|
||||||
|
import nautilus.game.arcade.command.DisguiseCommand;
|
||||||
|
import nautilus.game.arcade.command.GameCommand;
|
||||||
|
import nautilus.game.arcade.command.KitUnlockCommand;
|
||||||
|
import nautilus.game.arcade.command.WriteCommand;
|
||||||
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
import nautilus.game.arcade.game.GameServerConfig;
|
||||||
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
|
import nautilus.game.arcade.game.games.event.EventModule;
|
||||||
|
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||||
|
import nautilus.game.arcade.managers.GameAchievementManager;
|
||||||
|
import nautilus.game.arcade.managers.GameChatManager;
|
||||||
|
import nautilus.game.arcade.managers.GameCreationManager;
|
||||||
|
import nautilus.game.arcade.managers.GameFlagManager;
|
||||||
|
import nautilus.game.arcade.managers.GameGemManager;
|
||||||
|
import nautilus.game.arcade.managers.GameHostManager;
|
||||||
|
import nautilus.game.arcade.managers.GameLobbyManager;
|
||||||
|
import nautilus.game.arcade.managers.GameLootManager;
|
||||||
|
import nautilus.game.arcade.managers.GameManager;
|
||||||
|
import nautilus.game.arcade.managers.GamePlayerManager;
|
||||||
|
import nautilus.game.arcade.managers.GameSpectatorManager;
|
||||||
|
import nautilus.game.arcade.managers.GameStatManager;
|
||||||
|
import nautilus.game.arcade.managers.GameTournamentManager;
|
||||||
|
import nautilus.game.arcade.managers.GameWorldManager;
|
||||||
|
import nautilus.game.arcade.managers.IdleManager;
|
||||||
|
import nautilus.game.arcade.managers.MiscManager;
|
||||||
|
import nautilus.game.arcade.shop.ArcadeShop;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -36,107 +133,6 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.achievement.AchievementManager;
|
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
|
||||||
import mineplex.core.blood.Blood;
|
|
||||||
import mineplex.core.bonuses.BonusManager;
|
|
||||||
import mineplex.core.chat.Chat;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.core.common.util.UtilGear;
|
|
||||||
import mineplex.core.common.util.UtilInv;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.creature.Creature;
|
|
||||||
import mineplex.core.disguise.DisguiseManager;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.elo.EloManager;
|
|
||||||
import mineplex.core.energy.Energy;
|
|
||||||
import mineplex.core.explosion.Explosion;
|
|
||||||
import mineplex.core.gadget.gadgets.OutfitTeam;
|
|
||||||
import mineplex.core.gadget.types.Gadget;
|
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
|
||||||
import mineplex.core.hologram.HologramManager;
|
|
||||||
import mineplex.core.inventory.InventoryManager;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.movement.Movement;
|
|
||||||
import mineplex.core.notifier.NotificationManager;
|
|
||||||
import mineplex.core.npc.NpcManager;
|
|
||||||
import mineplex.core.packethandler.IPacketHandler;
|
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
|
||||||
import mineplex.core.packethandler.PacketInfo;
|
|
||||||
import mineplex.core.packethandler.PacketPlayResourcePackStatus;
|
|
||||||
import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus;
|
|
||||||
import mineplex.core.party.PartyManager;
|
|
||||||
import mineplex.core.pet.PetManager;
|
|
||||||
import mineplex.core.poll.PollManager;
|
|
||||||
import mineplex.core.portal.Portal;
|
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
|
||||||
import mineplex.core.resourcepack.ResUnloadCheck;
|
|
||||||
import mineplex.core.resourcepack.ResPackManager;
|
|
||||||
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
|
||||||
import mineplex.core.reward.rewards.PetReward;
|
|
||||||
import mineplex.core.stats.StatsManager;
|
|
||||||
import mineplex.core.status.ServerStatusManager;
|
|
||||||
import mineplex.core.task.TaskManager;
|
|
||||||
import mineplex.core.teleport.Teleport;
|
|
||||||
import mineplex.core.timing.TimingManager;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
|
||||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
|
||||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
|
||||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
|
||||||
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
|
|
||||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
|
||||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
|
||||||
import mineplex.minecraft.game.core.IRelation;
|
|
||||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
|
||||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
|
||||||
import mineplex.minecraft.game.core.fire.Fire;
|
|
||||||
import nautilus.game.arcade.addons.SoupAddon;
|
|
||||||
import nautilus.game.arcade.addons.TeamArmorAddon;
|
|
||||||
import nautilus.game.arcade.addons.compass.CompassAddon;
|
|
||||||
import nautilus.game.arcade.command.DisguiseCommand;
|
|
||||||
import nautilus.game.arcade.command.GameCommand;
|
|
||||||
import nautilus.game.arcade.command.WriteCommand;
|
|
||||||
import nautilus.game.arcade.command.KitUnlockCommand;
|
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
|
||||||
import nautilus.game.arcade.game.Game;
|
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
|
||||||
import nautilus.game.arcade.game.GameServerConfig;
|
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
|
||||||
import nautilus.game.arcade.game.games.event.EventModule;
|
|
||||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
|
||||||
import nautilus.game.arcade.managers.GameAchievementManager;
|
|
||||||
import nautilus.game.arcade.managers.GameChatManager;
|
|
||||||
import nautilus.game.arcade.managers.GameCreationManager;
|
|
||||||
import nautilus.game.arcade.managers.GameFlagManager;
|
|
||||||
import nautilus.game.arcade.managers.GameGemManager;
|
|
||||||
import nautilus.game.arcade.managers.GameHostManager;
|
|
||||||
import nautilus.game.arcade.managers.GameLobbyManager;
|
|
||||||
import nautilus.game.arcade.managers.GameLootManager;
|
|
||||||
import nautilus.game.arcade.managers.GameManager;
|
|
||||||
import nautilus.game.arcade.managers.GamePlayerManager;
|
|
||||||
import nautilus.game.arcade.managers.GameSpectatorManager;
|
|
||||||
import nautilus.game.arcade.managers.GameStatManager;
|
|
||||||
import nautilus.game.arcade.managers.GameTournamentManager;
|
|
||||||
import nautilus.game.arcade.managers.GameWorldManager;
|
|
||||||
import nautilus.game.arcade.managers.IdleManager;
|
|
||||||
import nautilus.game.arcade.managers.MiscManager;
|
|
||||||
import nautilus.game.arcade.shop.ArcadeShop;
|
|
||||||
|
|
||||||
public class ArcadeManager extends MiniPlugin implements IRelation
|
public class ArcadeManager extends MiniPlugin implements IRelation
|
||||||
{
|
{
|
||||||
@ -231,7 +227,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
_explosionManager.SetDebris(false);
|
_explosionManager.SetDebris(false);
|
||||||
|
|
||||||
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
||||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM))
|
|| serverConfig.GameList.contains(GameType.ChampionsTDM) || serverConfig.GameList.contains(GameType.ChampionsCTF))
|
||||||
{
|
{
|
||||||
_conditionManager = new SkillConditionManager(plugin);
|
_conditionManager = new SkillConditionManager(plugin);
|
||||||
}
|
}
|
||||||
@ -1292,7 +1288,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
|
|
||||||
public void toggleChampionsModules(GameType gameType)
|
public void toggleChampionsModules(GameType gameType)
|
||||||
{
|
{
|
||||||
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM;
|
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF;
|
||||||
|
|
||||||
if (_enabled == isChamps)
|
if (_enabled == isChamps)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
package nautilus.game.arcade.events;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.kit.Kit;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public class PlayerKitApplyEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private Game _game;
|
||||||
|
private Kit _kit;
|
||||||
|
private Player _player;
|
||||||
|
private boolean _cancelled = false;
|
||||||
|
private String _cancelMessage = "";
|
||||||
|
|
||||||
|
public PlayerKitApplyEvent(Game game, Kit kit, Player player)
|
||||||
|
{
|
||||||
|
_game = game;
|
||||||
|
_kit = kit;
|
||||||
|
_player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Game GetGame()
|
||||||
|
{
|
||||||
|
return _game;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Kit GetKit()
|
||||||
|
{
|
||||||
|
return _kit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player GetPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCancelMessage()
|
||||||
|
{
|
||||||
|
return _cancelMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelMessage(String message)
|
||||||
|
{
|
||||||
|
_cancelMessage = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return _cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancelled)
|
||||||
|
{
|
||||||
|
_cancelled = cancelled;
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ import nautilus.game.arcade.ArcadeManager;
|
|||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||||
|
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.TeamGame;
|
import nautilus.game.arcade.game.TeamGame;
|
||||||
@ -462,4 +463,19 @@ public class CaptureTheFlag extends TeamGame
|
|||||||
if (flag.Pickup(event.getPlayer(), event.getClickedBlock()))
|
if (flag.Pickup(event.getPlayer(), event.getClickedBlock()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void selectKit(PlayerKitApplyEvent event)
|
||||||
|
{
|
||||||
|
if (this instanceof ChampionsCTF)
|
||||||
|
{
|
||||||
|
for (Flag flag : _flags)
|
||||||
|
if (!flag.isAtHome())
|
||||||
|
if (flag.getCarrier().getName().equals(event.GetPlayer().getName()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setCancelMessage("You cannot change kits while holding a flag!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,11 @@ public class Flag
|
|||||||
return !_moved;
|
return !_moved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getCarrier()
|
||||||
|
{
|
||||||
|
return _holding;
|
||||||
|
}
|
||||||
|
|
||||||
private void AnnounceCapture()
|
private void AnnounceCapture()
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display("Your flag has", "been stolen! Retrieve it!", _team.GetPlayers(true).toArray(new Player[0]));
|
UtilTextMiddle.display("Your flag has", "been stolen! Retrieve it!", _team.GetPlayers(true).toArray(new Player[0]));
|
||||||
@ -156,43 +161,49 @@ public class Flag
|
|||||||
{
|
{
|
||||||
if (_holding == null)
|
if (_holding == null)
|
||||||
{
|
{
|
||||||
if (Host.GetTeam(player) != _team)
|
if (!UtilPlayer.isSpectator(player))
|
||||||
{
|
{
|
||||||
if (block != null)
|
if (Host.IsAlive(player))
|
||||||
{
|
{
|
||||||
if (block.getType() == _representation.getType())
|
if (Host.GetTeam(player) != _team)
|
||||||
{
|
{
|
||||||
boolean isFlag = false;
|
if (block != null)
|
||||||
for (Block flagBlock : _flagBlocks)
|
|
||||||
{
|
{
|
||||||
if (block.getLocation().equals(flagBlock.getLocation()))
|
if (block.getType() == _representation.getType())
|
||||||
{
|
{
|
||||||
isFlag = true;
|
boolean isFlag = false;
|
||||||
break;
|
for (Block flagBlock : _flagBlocks)
|
||||||
|
{
|
||||||
|
if (block.getLocation().equals(flagBlock.getLocation()))
|
||||||
|
{
|
||||||
|
isFlag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isFlag)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (Block flagBlock : _flagBlocks)
|
||||||
|
{
|
||||||
|
flagBlock.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
player.getInventory().setItem(i, _representation);
|
||||||
|
}
|
||||||
|
player.updateInventory();
|
||||||
|
|
||||||
|
AnnounceCapture();
|
||||||
|
_holding = player;
|
||||||
|
_dropped = false;
|
||||||
|
_dropTime = 0;
|
||||||
|
_moved = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFlag)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (Block flagBlock : _flagBlocks)
|
|
||||||
{
|
|
||||||
flagBlock.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++)
|
|
||||||
{
|
|
||||||
player.getInventory().setItem(i, _representation);
|
|
||||||
}
|
|
||||||
player.updateInventory();
|
|
||||||
|
|
||||||
AnnounceCapture();
|
|
||||||
_holding = player;
|
|
||||||
_dropped = false;
|
|
||||||
_dropTime = 0;
|
|
||||||
_moved = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
package nautilus.game.arcade.kit;
|
package nautilus.game.arcade.kit;
|
||||||
|
|
||||||
|
import mineplex.core.achievement.Achievement;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import nautilus.game.arcade.ArcadeFormat;
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||||
|
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -11,16 +23,6 @@ import org.bukkit.entity.Skeleton.SkeletonType;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.achievement.Achievement;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilInv;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import nautilus.game.arcade.ArcadeFormat;
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
|
||||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
|
||||||
|
|
||||||
public abstract class Kit implements Listener
|
public abstract class Kit implements Listener
|
||||||
{
|
{
|
||||||
public ArcadeManager Manager;
|
public ArcadeManager Manager;
|
||||||
|
@ -7,6 +7,7 @@ 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.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTabTitle;
|
import mineplex.core.common.util.UtilTabTitle;
|
||||||
import mineplex.core.donation.Donor;
|
import mineplex.core.donation.Donor;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
@ -15,6 +16,7 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
|||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
|
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
@ -316,58 +318,65 @@ public class GamePlayerManager implements Listener
|
|||||||
|
|
||||||
public void KitClick(final Player player, final Kit kit, final Entity entity)
|
public void KitClick(final Player player, final Kit kit, final Entity entity)
|
||||||
{
|
{
|
||||||
kit.DisplayDesc(player);
|
PlayerKitApplyEvent kitEvent = new PlayerKitApplyEvent(Manager.GetGame(), kit, player);
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(kitEvent);
|
||||||
if (Manager.GetGame() == null)
|
if (!kitEvent.isCancelled())
|
||||||
return;
|
|
||||||
|
|
||||||
if (!Manager.GetGame().HasKit(kit))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Donor donor = Manager.GetDonation().Get(player.getName());
|
|
||||||
|
|
||||||
if (kit.GetAvailability() == KitAvailability.Free || //Free
|
|
||||||
|
|
||||||
Manager.hasKitsUnlocked(player) || //YouTube
|
|
||||||
|
|
||||||
(kit.GetAvailability() == KitAvailability.Achievement && //Achievement
|
|
||||||
Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) ||
|
|
||||||
|
|
||||||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green
|
|
||||||
|
|
||||||
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF
|
|
||||||
|
|
||||||
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old)
|
|
||||||
|
|
||||||
Manager.GetServerConfig().Tournament) //Tournament
|
|
||||||
{
|
{
|
||||||
Manager.GetGame().SetKit(player, kit, true);
|
kit.DisplayDesc(player);
|
||||||
}
|
|
||||||
else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost())
|
if (Manager.GetGame() == null)
|
||||||
{
|
return;
|
||||||
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<ArcadeManager, ArcadeShop>(
|
|
||||||
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable()
|
if (!Manager.GetGame().HasKit(kit))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Donor donor = Manager.GetDonation().Get(player.getName());
|
||||||
|
|
||||||
|
if (kit.GetAvailability() == KitAvailability.Free || //Free
|
||||||
|
|
||||||
|
Manager.hasKitsUnlocked(player) || //YouTube
|
||||||
|
|
||||||
|
(kit.GetAvailability() == KitAvailability.Achievement && //Achievement
|
||||||
|
Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) ||
|
||||||
|
|
||||||
|
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green
|
||||||
|
|
||||||
|
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF
|
||||||
|
|
||||||
|
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old)
|
||||||
|
|
||||||
|
Manager.GetServerConfig().Tournament) //Tournament
|
||||||
{
|
{
|
||||||
public void run()
|
Manager.GetGame().SetKit(player, kit, true);
|
||||||
{
|
}
|
||||||
if (player.isOnline())
|
else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost())
|
||||||
|
{
|
||||||
|
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<ArcadeManager, ArcadeShop>(
|
||||||
|
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable()
|
||||||
{
|
{
|
||||||
Manager.GetGame().SetKit(player, kit, true);
|
public void run()
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true));
|
{
|
||||||
}
|
if (player.isOnline())
|
||||||
}
|
{
|
||||||
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player));
|
Manager.GetGame().SetKit(player, kit, true);
|
||||||
}
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true));
|
||||||
else if (kit.GetAvailability() == KitAvailability.Achievement)
|
}
|
||||||
{
|
}
|
||||||
UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + "."));
|
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player));
|
||||||
|
}
|
||||||
|
else if (kit.GetAvailability() == KitAvailability.Achievement)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + "."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
|
||||||
|
|
||||||
|
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
UtilPlayer.message(player, F.main("Game", kitEvent.getCancelMessage()));
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
|
|
||||||
|
|
||||||
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
Loading…
Reference in New Issue
Block a user