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;
|
||||
|
||||
import java.awt.Event;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
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.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -37,107 +134,6 @@ import org.bukkit.util.Vector;
|
||||
|
||||
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
|
||||
{
|
||||
// Modules
|
||||
@ -231,7 +227,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_explosionManager.SetDebris(false);
|
||||
|
||||
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);
|
||||
}
|
||||
@ -1292,7 +1288,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
@ -462,4 +463,19 @@ public class CaptureTheFlag extends TeamGame
|
||||
if (flag.Pickup(event.getPlayer(), event.getClickedBlock()))
|
||||
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;
|
||||
}
|
||||
|
||||
public Player getCarrier()
|
||||
{
|
||||
return _holding;
|
||||
}
|
||||
|
||||
private void AnnounceCapture()
|
||||
{
|
||||
UtilTextMiddle.display("Your flag has", "been stolen! Retrieve it!", _team.GetPlayers(true).toArray(new Player[0]));
|
||||
@ -155,6 +160,10 @@ public class Flag
|
||||
public boolean Pickup(Player player, Block block)
|
||||
{
|
||||
if (_holding == null)
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
if (Host.IsAlive(player))
|
||||
{
|
||||
if (Host.GetTeam(player) != _team)
|
||||
{
|
||||
@ -197,6 +206,8 @@ public class Flag
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,17 @@
|
||||
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.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -11,16 +23,6 @@ import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.event.Listener;
|
||||
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 ArcadeManager Manager;
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTabTitle;
|
||||
import mineplex.core.donation.Donor;
|
||||
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 nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
@ -315,6 +317,10 @@ public class GamePlayerManager implements Listener
|
||||
}
|
||||
|
||||
public void KitClick(final Player player, final Kit kit, final Entity entity)
|
||||
{
|
||||
PlayerKitApplyEvent kitEvent = new PlayerKitApplyEvent(Manager.GetGame(), kit, player);
|
||||
UtilServer.getServer().getPluginManager().callEvent(kitEvent);
|
||||
if (!kitEvent.isCancelled())
|
||||
{
|
||||
kit.DisplayDesc(player);
|
||||
|
||||
@ -369,6 +375,9 @@ public class GamePlayerManager implements Listener
|
||||
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
|
||||
}
|
||||
}
|
||||
else
|
||||
UtilPlayer.message(player, F.main("Game", kitEvent.getCancelMessage()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void TeleportCommand(PlayerCommandPreprocessEvent event)
|
||||
|
Loading…
Reference in New Issue
Block a user