2013-08-27 17:14:08 +02:00
|
|
|
package nautilus.game.arcade;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
2014-05-03 03:23:10 +02:00
|
|
|
import java.util.HashSet;
|
2015-03-17 11:59:24 +01:00
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Map.Entry;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
import mineplex.core.MiniPlugin;
|
|
|
|
import mineplex.core.account.CoreClientManager;
|
2014-08-08 05:46:35 +02:00
|
|
|
import mineplex.core.achievement.AchievementManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.blockrestore.BlockRestore;
|
2014-03-09 09:50:13 +01:00
|
|
|
import mineplex.core.blood.Blood;
|
2015-08-12 08:37:54 +02:00
|
|
|
import mineplex.core.bonuses.BonusManager;
|
2013-09-04 20:35:59 +02:00
|
|
|
import mineplex.core.chat.Chat;
|
2013-09-07 02:43:45 +02:00
|
|
|
import mineplex.core.common.Rank;
|
2015-05-02 22:10:25 +02:00
|
|
|
import mineplex.core.common.jsonchat.ClickEvent;
|
|
|
|
import mineplex.core.common.jsonchat.JsonMessage;
|
2014-09-16 05:31:53 +02:00
|
|
|
import mineplex.core.common.util.C;
|
|
|
|
import mineplex.core.common.util.F;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.common.util.NautHashMap;
|
2015-08-02 11:50:26 +02:00
|
|
|
import mineplex.core.common.util.UtilAction;
|
2014-09-16 05:31:53 +02:00
|
|
|
import mineplex.core.common.util.UtilGear;
|
|
|
|
import mineplex.core.common.util.UtilInv;
|
|
|
|
import mineplex.core.common.util.UtilPlayer;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.common.util.UtilServer;
|
|
|
|
import mineplex.core.common.util.UtilTime;
|
2014-08-09 11:55:05 +02:00
|
|
|
import mineplex.core.cosmetic.CosmeticManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.creature.Creature;
|
|
|
|
import mineplex.core.disguise.DisguiseManager;
|
|
|
|
import mineplex.core.donation.DonationManager;
|
2014-05-05 07:40:44 +02:00
|
|
|
import mineplex.core.elo.EloManager;
|
2014-03-05 09:34:20 +01:00
|
|
|
import mineplex.core.energy.Energy;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.explosion.Explosion;
|
2015-10-10 10:27:54 +02:00
|
|
|
import mineplex.core.explosion.ExplosionEvent;
|
2014-11-25 22:28:37 +01:00
|
|
|
import mineplex.core.hologram.HologramManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
import mineplex.core.inventory.InventoryManager;
|
|
|
|
import mineplex.core.itemstack.ItemStackFactory;
|
|
|
|
import mineplex.core.movement.Movement;
|
2015-06-19 05:27:59 +02:00
|
|
|
import mineplex.core.notifier.NotificationManager;
|
2015-08-12 08:37:54 +02:00
|
|
|
import mineplex.core.npc.NpcManager;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.packethandler.IPacketHandler;
|
2014-09-12 22:03:33 +02:00
|
|
|
import mineplex.core.packethandler.PacketHandler;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.packethandler.PacketInfo;
|
|
|
|
import mineplex.core.packethandler.PacketPlayResourcePackStatus;
|
|
|
|
import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus;
|
2015-02-24 01:03:51 +01:00
|
|
|
import mineplex.core.party.PartyManager;
|
2014-09-19 04:03:46 +02:00
|
|
|
import mineplex.core.pet.PetManager;
|
2015-08-12 08:37:54 +02:00
|
|
|
import mineplex.core.poll.PollManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.portal.Portal;
|
2014-06-10 02:27:25 +02:00
|
|
|
import mineplex.core.preferences.PreferencesManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.projectile.ProjectileManager;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.resourcepack.ResPackManager;
|
2015-10-10 21:54:18 +02:00
|
|
|
import mineplex.core.resourcepack.ResUnloadCheck;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
2014-12-15 02:24:40 +01:00
|
|
|
import mineplex.core.reward.RewardRarity;
|
|
|
|
import mineplex.core.reward.rewards.PetReward;
|
2013-12-14 06:00:56 +01:00
|
|
|
import mineplex.core.stats.StatsManager;
|
2014-03-14 01:56:05 +01:00
|
|
|
import mineplex.core.status.ServerStatusManager;
|
2014-08-23 07:04:43 +02:00
|
|
|
import mineplex.core.task.TaskManager;
|
2014-03-09 09:50:13 +01:00
|
|
|
import mineplex.core.teleport.Teleport;
|
2014-06-25 21:06:24 +02:00
|
|
|
import mineplex.core.timing.TimingManager;
|
2015-10-10 04:14:10 +02:00
|
|
|
import mineplex.core.titangiveaway.TitanGiveawayManager;
|
2015-03-17 11:59:24 +01:00
|
|
|
import mineplex.core.updater.event.UpdateEvent;
|
2014-09-16 05:31:53 +02:00
|
|
|
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;
|
2015-07-31 08:50:32 +02:00
|
|
|
import nautilus.game.arcade.addons.compass.CompassAddon;
|
2015-02-10 07:08:54 +01:00
|
|
|
import nautilus.game.arcade.command.DisguiseCommand;
|
2014-09-16 05:31:53 +02:00
|
|
|
import nautilus.game.arcade.command.GameCommand;
|
2015-10-10 21:54:18 +02:00
|
|
|
import nautilus.game.arcade.command.KitUnlockCommand;
|
2015-09-12 06:39:40 +02:00
|
|
|
import nautilus.game.arcade.command.RequiredRankCommand;
|
2014-09-16 05:31:53 +02:00
|
|
|
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;
|
2015-07-23 12:06:40 +02:00
|
|
|
import nautilus.game.arcade.game.games.event.EventModule;
|
2014-09-16 05:31:53 +02:00
|
|
|
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;
|
2014-11-07 01:52:58 +01:00
|
|
|
import nautilus.game.arcade.managers.GameHostManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
import nautilus.game.arcade.managers.GameLobbyManager;
|
2014-09-19 04:03:46 +02:00
|
|
|
import nautilus.game.arcade.managers.GameLootManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
import nautilus.game.arcade.managers.GameManager;
|
|
|
|
import nautilus.game.arcade.managers.GamePlayerManager;
|
2014-11-18 06:43:39 +01:00
|
|
|
import nautilus.game.arcade.managers.GameSpectatorManager;
|
2014-09-21 01:28:12 +02:00
|
|
|
import nautilus.game.arcade.managers.GameStatManager;
|
2014-09-24 07:46:55 +02:00
|
|
|
import nautilus.game.arcade.managers.GameTournamentManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
import nautilus.game.arcade.managers.GameWorldManager;
|
2015-10-10 04:14:10 +02:00
|
|
|
import nautilus.game.arcade.managers.HolidayManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
import nautilus.game.arcade.managers.IdleManager;
|
|
|
|
import nautilus.game.arcade.managers.MiscManager;
|
|
|
|
import nautilus.game.arcade.shop.ArcadeShop;
|
2015-10-10 21:54:18 +02:00
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.GameMode;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
|
|
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
import org.bukkit.event.block.BlockBurnEvent;
|
|
|
|
import org.bukkit.event.block.BlockFadeEvent;
|
|
|
|
import org.bukkit.event.block.BlockSpreadEvent;
|
|
|
|
import org.bukkit.event.block.LeavesDecayEvent;
|
|
|
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
|
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
|
|
import org.bukkit.event.inventory.InventoryType;
|
|
|
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
|
|
|
import org.bukkit.event.player.PlayerLoginEvent;
|
|
|
|
import org.bukkit.event.player.PlayerQuitEvent;
|
|
|
|
import org.bukkit.event.server.ServerListPingEvent;
|
|
|
|
import org.bukkit.potion.PotionEffect;
|
|
|
|
import org.bukkit.util.Vector;
|
|
|
|
|
|
|
|
import com.google.common.base.Objects;
|
2015-01-26 01:23:08 +01:00
|
|
|
|
2013-09-04 20:35:59 +02:00
|
|
|
public class ArcadeManager extends MiniPlugin implements IRelation
|
2015-01-26 01:23:08 +01:00
|
|
|
{
|
2015-04-10 06:09:21 +02:00
|
|
|
// Modules
|
2013-08-27 17:14:08 +02:00
|
|
|
private BlockRestore _blockRestore;
|
2013-08-31 05:15:16 +02:00
|
|
|
private Blood _blood;
|
2014-07-26 19:40:49 +02:00
|
|
|
private Chat _chat;
|
2013-08-27 17:14:08 +02:00
|
|
|
private CoreClientManager _clientManager;
|
|
|
|
private DisguiseManager _disguiseManager;
|
|
|
|
private DonationManager _donationManager;
|
|
|
|
private ConditionManager _conditionManager;
|
2014-12-15 02:24:40 +01:00
|
|
|
private PetManager _petManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
private Creature _creature;
|
|
|
|
private DamageManager _damageManager;
|
|
|
|
private Explosion _explosionManager;
|
2015-07-23 12:06:40 +02:00
|
|
|
private EventModule _eventManager;
|
2014-12-23 01:18:48 +01:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
private Fire _fire;
|
|
|
|
private ProjectileManager _projectileManager;
|
2014-12-23 01:18:48 +01:00
|
|
|
|
2015-04-03 06:28:10 +02:00
|
|
|
private Portal _portal;
|
2014-09-16 05:31:53 +02:00
|
|
|
private ArcadeShop _arcadeShop;
|
2014-12-23 01:18:48 +01:00
|
|
|
|
|
|
|
//Champions Modules
|
|
|
|
private boolean _enabled = true;
|
|
|
|
private ClassManager _classManager;
|
|
|
|
private SkillFactory _skillFactory;
|
|
|
|
private ItemFactory _itemFactory;
|
|
|
|
private Energy _energy;
|
|
|
|
private ClassShopManager _classShopManager;
|
|
|
|
private ClassCombatShop _classShop;
|
|
|
|
private EloManager _eloManager;
|
|
|
|
|
2014-08-15 01:49:00 +02:00
|
|
|
// Managers
|
2013-08-27 17:14:08 +02:00
|
|
|
private GameCreationManager _gameCreationManager;
|
|
|
|
private GameGemManager _gameGemManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
private GameManager _gameManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
private GameLobbyManager _gameLobbyManager;
|
2014-08-23 09:55:28 +02:00
|
|
|
private GamePlayerManager _gamePlayerManager;
|
2014-09-24 07:46:55 +02:00
|
|
|
private GameTournamentManager _gameTournamentManager;
|
2014-09-16 05:31:53 +02:00
|
|
|
private GameWorldManager _gameWorldManager;
|
2014-11-07 01:52:58 +01:00
|
|
|
private GameHostManager _gameHostManager;
|
2014-07-03 01:59:31 +02:00
|
|
|
private ServerStatusManager _serverStatusManager;
|
2014-08-09 05:10:02 +02:00
|
|
|
private InventoryManager _inventoryManager;
|
2014-08-09 11:55:05 +02:00
|
|
|
private CosmeticManager _cosmeticManager;
|
2014-11-08 00:28:06 +01:00
|
|
|
private final IdleManager _idleManager;
|
2014-11-25 22:28:37 +01:00
|
|
|
private HologramManager _hologramManager;
|
2014-08-08 05:46:35 +02:00
|
|
|
private AchievementManager _achievementManager;
|
2013-12-14 06:00:56 +01:00
|
|
|
private StatsManager _statsManager;
|
2015-02-24 01:03:51 +01:00
|
|
|
private PartyManager _partyManager;
|
2015-03-06 09:11:26 +01:00
|
|
|
private PreferencesManager _preferencesManager;
|
2014-12-23 01:18:48 +01:00
|
|
|
|
2014-08-23 07:04:43 +02:00
|
|
|
private TaskManager _taskManager;
|
2014-11-25 11:36:05 +01:00
|
|
|
private PacketHandler _packetHandler;
|
|
|
|
|
2014-12-23 01:18:48 +01:00
|
|
|
|
2015-03-17 11:59:24 +01:00
|
|
|
private IPacketHandler _resourcePacketHandler;
|
|
|
|
private String _resourcePackUrl;
|
|
|
|
private boolean _resourcePackRequired;
|
2015-05-01 17:03:53 +02:00
|
|
|
private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<String, Boolean>();
|
2015-03-17 11:59:24 +01:00
|
|
|
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>();
|
2014-07-26 19:40:49 +02:00
|
|
|
|
|
|
|
// Observers
|
2014-05-03 03:23:10 +02:00
|
|
|
private HashSet<Player> _specList = new HashSet<Player>();
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
// Server Games
|
2013-08-27 17:14:08 +02:00
|
|
|
private GameServerConfig _serverConfig;
|
2014-07-26 19:40:49 +02:00
|
|
|
|
|
|
|
// Games
|
2013-08-27 17:14:08 +02:00
|
|
|
private Game _game;
|
2014-10-24 10:05:57 +02:00
|
|
|
|
|
|
|
//Youtuber Kits
|
|
|
|
private HashSet<Player> _youtube = new HashSet<Player>();
|
2015-09-12 06:39:40 +02:00
|
|
|
|
|
|
|
//Server Property
|
|
|
|
private Rank _requiredRank;
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
|
2014-09-16 05:31:53 +02:00
|
|
|
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
2015-06-20 10:43:38 +02:00
|
|
|
StatsManager statsManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
|
2014-09-16 05:31:53 +02:00
|
|
|
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
|
2015-08-12 08:37:54 +02:00
|
|
|
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, NpcManager npcManager)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
super("Game Manager", plugin);
|
|
|
|
|
|
|
|
_serverConfig = serverConfig;
|
2014-07-26 19:40:49 +02:00
|
|
|
|
|
|
|
// Modules
|
2013-08-27 17:14:08 +02:00
|
|
|
_blockRestore = new BlockRestore(plugin);
|
2014-12-15 02:24:40 +01:00
|
|
|
|
2013-08-31 05:15:16 +02:00
|
|
|
_blood = blood;
|
2015-03-06 09:11:26 +01:00
|
|
|
_preferencesManager = preferences;
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
_explosionManager = new Explosion(plugin, _blockRestore);
|
|
|
|
_explosionManager.SetDebris(false);
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
2015-08-24 15:58:57 +02:00
|
|
|
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|
|
|
|
|| serverConfig.GameList.contains(GameType.BossBattles))
|
2014-04-15 09:53:24 +02:00
|
|
|
{
|
|
|
|
_conditionManager = new SkillConditionManager(plugin);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_conditionManager = new ConditionManager(plugin);
|
|
|
|
}
|
2015-05-12 02:55:26 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
_clientManager = clientManager;
|
2014-07-03 01:59:31 +02:00
|
|
|
_serverStatusManager = serverStatusManager;
|
2015-05-01 06:56:08 +02:00
|
|
|
_chat = chat;
|
2013-08-27 17:14:08 +02:00
|
|
|
_creature = creature;
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
_damageManager = damageManager;
|
2013-09-09 10:06:44 +02:00
|
|
|
_damageManager.UseSimpleWeaponDamage = true;
|
2015-05-12 02:55:26 +02:00
|
|
|
_damageManager.setConditionManager(_conditionManager);
|
|
|
|
|
2013-08-31 05:15:16 +02:00
|
|
|
_disguiseManager = disguiseManager;
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
_donationManager = donationManager;
|
|
|
|
|
2014-04-15 09:53:24 +02:00
|
|
|
_fire = new Fire(plugin, _conditionManager, damageManager);
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-08-22 20:30:41 +02:00
|
|
|
_projectileManager = projectileManager;
|
2014-11-25 11:36:05 +01:00
|
|
|
|
|
|
|
_packetHandler = packetHandler;
|
2015-02-24 01:03:51 +01:00
|
|
|
|
|
|
|
_partyManager = new PartyManager(plugin, portal, _clientManager, preferences);
|
2015-06-20 10:43:38 +02:00
|
|
|
_statsManager = statsManager;
|
2015-05-11 10:21:27 +02:00
|
|
|
_taskManager = new TaskManager(plugin, clientManager, webAddress);
|
2015-06-20 10:43:38 +02:00
|
|
|
_achievementManager = achievementManager;
|
2014-08-09 05:10:02 +02:00
|
|
|
_inventoryManager = inventoryManager;
|
2014-08-09 11:55:05 +02:00
|
|
|
_cosmeticManager = cosmeticManager;
|
2013-11-07 00:18:36 +01:00
|
|
|
_portal = portal;
|
2014-12-15 02:24:40 +01:00
|
|
|
_petManager = petManager;
|
2015-07-23 12:06:40 +02:00
|
|
|
_eventManager = new EventModule(this, getPlugin());
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
// Shop
|
2013-08-27 17:14:08 +02:00
|
|
|
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
|
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
// Managers
|
2013-09-04 20:35:59 +02:00
|
|
|
new GameChatManager(this);
|
2013-08-27 17:14:08 +02:00
|
|
|
_gameCreationManager = new GameCreationManager(this);
|
|
|
|
_gameGemManager = new GameGemManager(this);
|
|
|
|
_gameManager = new GameManager(this);
|
2014-09-12 22:03:33 +02:00
|
|
|
_gameLobbyManager = new GameLobbyManager(this, packetHandler);
|
2014-11-07 01:52:58 +01:00
|
|
|
_gameHostManager = new GameHostManager(this);
|
2013-08-27 17:14:08 +02:00
|
|
|
new GameFlagManager(this);
|
2014-08-23 09:55:28 +02:00
|
|
|
_gamePlayerManager = new GamePlayerManager(this);
|
2014-08-08 09:05:11 +02:00
|
|
|
new GameAchievementManager(this);
|
2014-09-24 07:46:55 +02:00
|
|
|
_gameTournamentManager = new GameTournamentManager(this);
|
2014-09-21 01:28:12 +02:00
|
|
|
new GameStatManager(this);
|
2014-09-19 04:03:46 +02:00
|
|
|
new GameLootManager(this, petManager);
|
2014-11-18 06:43:39 +01:00
|
|
|
new GameSpectatorManager(this);
|
2013-08-27 17:14:08 +02:00
|
|
|
_gameWorldManager = new GameWorldManager(this);
|
2014-08-09 11:55:05 +02:00
|
|
|
new MiscManager(this);
|
2014-11-25 22:28:37 +01:00
|
|
|
_hologramManager = hologramManager;
|
2014-11-08 00:28:06 +01:00
|
|
|
_idleManager = new IdleManager(this);
|
2015-10-10 04:14:10 +02:00
|
|
|
TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
|
|
|
|
new HolidayManager(this, titanGiveaway);
|
2014-10-23 05:05:35 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
// Game Addons
|
2013-08-27 17:14:08 +02:00
|
|
|
new CompassAddon(plugin, this);
|
|
|
|
new SoupAddon(plugin, this);
|
2014-05-03 03:23:10 +02:00
|
|
|
new TeamArmorAddon(plugin, this);
|
2014-11-20 07:47:10 +01:00
|
|
|
|
2015-06-19 05:27:59 +02:00
|
|
|
new NotificationManager(getPlugin(), clientManager);
|
|
|
|
|
2015-10-23 08:08:31 +02:00
|
|
|
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
2015-08-12 08:37:54 +02:00
|
|
|
|
2014-12-23 01:18:48 +01:00
|
|
|
//Champions Modules
|
2014-12-23 01:39:03 +01:00
|
|
|
_energy = new Energy(plugin);
|
|
|
|
|
|
|
|
_itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy,
|
|
|
|
_fire, _projectileManager, webAddress);
|
|
|
|
|
|
|
|
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
|
|
|
|
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
|
|
|
|
_energy, webAddress);
|
|
|
|
|
|
|
|
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, _itemFactory,
|
|
|
|
webAddress);
|
2014-12-23 01:22:41 +01:00
|
|
|
|
2014-12-23 01:39:03 +01:00
|
|
|
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager);
|
|
|
|
|
|
|
|
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, false, "Class Shop");
|
2014-12-23 01:22:41 +01:00
|
|
|
|
2014-12-23 01:39:03 +01:00
|
|
|
_eloManager = new EloManager(_plugin, clientManager);
|
2014-12-23 09:43:56 +01:00
|
|
|
|
|
|
|
if (GetHost() != null && !GetHost().isEmpty())
|
|
|
|
{
|
2014-12-24 20:35:34 +01:00
|
|
|
Bukkit.getScheduler().runTaskLater(plugin, new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName());
|
|
|
|
}
|
|
|
|
}, 80L);
|
2014-12-23 09:43:56 +01:00
|
|
|
}
|
2015-03-17 11:59:24 +01:00
|
|
|
|
|
|
|
_resourcePacketHandler = new IPacketHandler()
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void handle(PacketInfo packetInfo)
|
|
|
|
{
|
|
|
|
if (_resourcePackUrl != null && packetInfo.getPacket() instanceof PacketPlayResourcePackStatus)
|
|
|
|
{
|
|
|
|
|
|
|
|
final Player player = packetInfo.getPlayer();
|
|
|
|
final EnumResourcePackStatus response = ((PacketPlayResourcePackStatus) packetInfo.getPacket())
|
|
|
|
.getResourcePackStatus();
|
|
|
|
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
if (_resourcePackRequired)
|
|
|
|
{
|
|
|
|
if (response == EnumResourcePackStatus.ACCEPTED)
|
|
|
|
{
|
|
|
|
_resourcePackNoResponse.remove(player.getName());
|
|
|
|
}
|
|
|
|
else if (response == EnumResourcePackStatus.DECLINED)
|
|
|
|
{
|
|
|
|
_resourcePackNoResponse.remove(player.getName());
|
|
|
|
|
2015-05-02 22:10:25 +02:00
|
|
|
UtilPlayer.message(player, " ");
|
|
|
|
JsonMessage message = new JsonMessage("")
|
|
|
|
.color("gold")
|
|
|
|
.bold()
|
|
|
|
.extra("You need to accept the resource pack!\n"
|
|
|
|
+ "Click me for instructions on how to fix this!")
|
|
|
|
|
|
|
|
.click(ClickEvent.OPEN_URL,
|
|
|
|
|
|
|
|
"http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help");
|
|
|
|
|
|
|
|
message.sendToPlayer(player);
|
|
|
|
UtilPlayer.message(player, " ");
|
|
|
|
|
|
|
|
returnHubNoResPack(player);
|
2015-03-17 11:59:24 +01:00
|
|
|
}
|
|
|
|
else if (response == EnumResourcePackStatus.FAILED_DOWNLOAD)
|
|
|
|
{
|
2015-04-29 15:33:21 +02:00
|
|
|
_resourcePackNoResponse.remove(player.getName());
|
2015-03-17 11:59:24 +01:00
|
|
|
|
2015-04-29 15:33:21 +02:00
|
|
|
returnHubNoResPack(player, "Failed to download resource pack!");
|
2015-03-17 11:59:24 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response == EnumResourcePackStatus.ACCEPTED || response == EnumResourcePackStatus.LOADED)
|
|
|
|
{
|
2015-05-01 17:03:53 +02:00
|
|
|
_resourcePackUsers.put(player.getName(), true);
|
2015-03-17 11:59:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_resourcePackUsers.remove(player.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
new ResPackManager(new ResUnloadCheck()
|
|
|
|
{
|
|
|
|
public boolean canSendUnload(Player player)
|
|
|
|
{
|
|
|
|
if (_resourcePackUsers.containsKey(player.getName()))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
getPacketHandler().addPacketHandler(_resourcePacketHandler);
|
2015-09-12 06:39:40 +02:00
|
|
|
|
2015-09-12 07:01:18 +02:00
|
|
|
loadRequiredRank();
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-02-26 06:07:07 +01:00
|
|
|
public void addCommands()
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2014-11-13 04:21:12 +01:00
|
|
|
addCommand(new GameCommand(this));
|
|
|
|
addCommand(new WriteCommand(this));
|
2015-07-23 16:29:42 +02:00
|
|
|
addCommand(new KitUnlockCommand(this));
|
2015-02-10 07:08:54 +01:00
|
|
|
addCommand(new DisguiseCommand(this));
|
2015-09-12 06:39:40 +02:00
|
|
|
addCommand(new RequiredRankCommand(this));
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public GameServerConfig GetServerConfig()
|
|
|
|
{
|
|
|
|
return _serverConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ArrayList<GameType> GetGameList()
|
|
|
|
{
|
|
|
|
return GetServerConfig().GameList;
|
|
|
|
}
|
2014-08-10 02:50:31 +02:00
|
|
|
|
2014-08-08 05:46:35 +02:00
|
|
|
public AchievementManager GetAchievement()
|
|
|
|
{
|
|
|
|
return _achievementManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-31 05:15:16 +02:00
|
|
|
public Blood GetBlood()
|
|
|
|
{
|
|
|
|
return _blood;
|
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
public Chat GetChat()
|
|
|
|
{
|
|
|
|
return _chat;
|
|
|
|
}
|
|
|
|
|
|
|
|
public BlockRestore GetBlockRestore()
|
|
|
|
{
|
|
|
|
return _blockRestore;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public CoreClientManager GetClients()
|
|
|
|
{
|
|
|
|
return _clientManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConditionManager GetCondition()
|
|
|
|
{
|
|
|
|
return _conditionManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public Creature GetCreature()
|
|
|
|
{
|
|
|
|
return _creature;
|
|
|
|
}
|
2014-11-25 11:36:05 +01:00
|
|
|
|
|
|
|
public PacketHandler getPacketHandler()
|
|
|
|
{
|
|
|
|
return _packetHandler;
|
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
|
2014-08-09 11:55:05 +02:00
|
|
|
public CosmeticManager getCosmeticManager()
|
|
|
|
{
|
|
|
|
return _cosmeticManager;
|
|
|
|
}
|
2014-08-10 02:50:31 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public DisguiseManager GetDisguise()
|
|
|
|
{
|
|
|
|
return _disguiseManager;
|
2014-05-06 18:06:39 +02:00
|
|
|
}
|
2014-11-25 22:28:37 +01:00
|
|
|
|
|
|
|
public HologramManager getHologramManager()
|
|
|
|
{
|
|
|
|
return _hologramManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public DamageManager GetDamage()
|
|
|
|
{
|
|
|
|
return _damageManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public DonationManager GetDonation()
|
|
|
|
{
|
|
|
|
return _donationManager;
|
|
|
|
}
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2014-05-05 07:40:44 +02:00
|
|
|
public EloManager getEloManager()
|
|
|
|
{
|
|
|
|
return _eloManager;
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2013-09-06 07:58:58 +02:00
|
|
|
public Explosion GetExplosion()
|
|
|
|
{
|
|
|
|
return _explosionManager;
|
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
public Fire GetFire()
|
|
|
|
{
|
|
|
|
return _fire;
|
|
|
|
}
|
2014-10-25 02:03:45 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public ProjectileManager GetProjectile()
|
|
|
|
{
|
|
|
|
return _projectileManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-09-02 10:45:12 +02:00
|
|
|
public Portal GetPortal()
|
|
|
|
{
|
|
|
|
return _portal;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public GameLobbyManager GetLobby()
|
|
|
|
{
|
|
|
|
return _gameLobbyManager;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-23 07:04:43 +02:00
|
|
|
public TaskManager GetTaskManager()
|
|
|
|
{
|
|
|
|
return _taskManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public ArcadeShop GetShop()
|
|
|
|
{
|
|
|
|
return _arcadeShop;
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public GameCreationManager GetGameCreationManager()
|
|
|
|
{
|
2014-07-26 19:40:49 +02:00
|
|
|
return _gameCreationManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-11-07 02:14:33 +01:00
|
|
|
public GameHostManager GetGameHostManager()
|
|
|
|
{
|
|
|
|
return _gameHostManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public GameManager GetGameManager()
|
|
|
|
{
|
|
|
|
return _gameManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public GameGemManager GetGameGemManager()
|
|
|
|
{
|
|
|
|
return _gameGemManager;
|
|
|
|
}
|
2014-09-24 07:46:55 +02:00
|
|
|
|
|
|
|
public GamePlayerManager GetGamePlayerManager()
|
|
|
|
{
|
|
|
|
return _gamePlayerManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public GameTournamentManager GetGameTournamentManager()
|
|
|
|
{
|
|
|
|
return _gameTournamentManager;
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public GameWorldManager GetGameWorldManager()
|
|
|
|
{
|
|
|
|
return _gameWorldManager;
|
|
|
|
}
|
2015-03-06 09:11:26 +01:00
|
|
|
|
2015-07-23 12:06:40 +02:00
|
|
|
public EventModule GetEventModule()
|
|
|
|
{
|
|
|
|
return _eventManager;
|
|
|
|
}
|
|
|
|
|
2015-03-06 09:11:26 +01:00
|
|
|
public PreferencesManager getPreferences()
|
|
|
|
{
|
|
|
|
return _preferencesManager;
|
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
|
2013-12-14 06:00:56 +01:00
|
|
|
public StatsManager GetStatsManager()
|
|
|
|
{
|
|
|
|
return _statsManager;
|
|
|
|
}
|
2014-08-10 02:50:31 +02:00
|
|
|
|
2014-08-01 06:05:53 +02:00
|
|
|
public ServerStatusManager GetServerStatusManager()
|
|
|
|
{
|
|
|
|
return _serverStatusManager;
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public ChatColor GetColor(Player player)
|
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
return ChatColor.GRAY;
|
|
|
|
|
|
|
|
GameTeam team = _game.GetTeam(player);
|
|
|
|
if (team == null)
|
|
|
|
return ChatColor.GRAY;
|
|
|
|
|
|
|
|
return team.GetColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-12-03 22:06:50 +01:00
|
|
|
public boolean canHurt(String a, String b)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2014-12-03 22:06:50 +01:00
|
|
|
return canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
2014-12-03 22:06:50 +01:00
|
|
|
public boolean canHurt(Player pA, Player pB)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
if (pA == null || pB == null)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!_game.Damage)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!_game.DamagePvP)
|
|
|
|
return false;
|
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
// Self Damage
|
2013-08-27 17:14:08 +02:00
|
|
|
if (pA.equals(pB))
|
|
|
|
return _game.DamageSelf;
|
|
|
|
|
|
|
|
GameTeam tA = _game.GetTeam(pA);
|
|
|
|
if (tA == null)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GameTeam tB = _game.GetTeam(pB);
|
|
|
|
if (tB == null)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (tA.equals(tB) && !_game.DamageTeamSelf)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!tA.equals(tB) && !_game.DamageTeamOther)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-12-03 22:06:50 +01:00
|
|
|
public boolean isSafe(Player player)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (_game.IsPlaying(player))
|
|
|
|
return false;
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void MessageMOTD(ServerListPingEvent event)
|
2014-07-26 19:40:49 +02:00
|
|
|
{
|
2014-12-24 00:48:38 +01:00
|
|
|
event.setMaxPlayers(_serverConfig.MaxPlayers);
|
|
|
|
|
2014-12-22 06:31:13 +01:00
|
|
|
//MPS
|
|
|
|
if (_gameHostManager != null && _gameHostManager.isPrivateServer())
|
|
|
|
{
|
|
|
|
if (_gameHostManager.isHostExpired())
|
|
|
|
{
|
|
|
|
event.setMotd(ChatColor.RED + "Finished");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-07-29 13:20:20 +02:00
|
|
|
if (!GetServerConfig().PublicServer || GetServerConfig().PlayerServerWhitelist)
|
2014-12-22 06:31:13 +01:00
|
|
|
{
|
|
|
|
event.setMotd(ChatColor.GRAY + "Private");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2014-12-23 11:15:33 +01:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
|
|
|
|
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-12-23 11:15:33 +01:00
|
|
|
if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.MODERATOR))
|
|
|
|
extrainformation += "|StaffHosted";
|
|
|
|
|
2014-09-12 10:06:51 +02:00
|
|
|
//Always Joinable
|
2014-12-23 10:39:49 +01:00
|
|
|
// if (_game != null && _game.JoinInProgress)
|
|
|
|
// {
|
|
|
|
// event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation);
|
|
|
|
// }
|
2014-09-12 10:06:51 +02:00
|
|
|
//UHC Timed
|
2014-12-23 10:39:49 +01:00
|
|
|
if (_game != null && _game.GetType() == GameType.UHC)
|
2014-09-12 10:06:51 +02:00
|
|
|
{
|
2014-09-16 05:31:53 +02:00
|
|
|
event.setMotd(((UHC) _game).getMotdStatus() + extrainformation);
|
2014-09-12 10:06:51 +02:00
|
|
|
}
|
|
|
|
//Recruiting
|
|
|
|
else if (_game == null || _game.GetState() == GameState.Recruit)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
if (_game != null && _game.GetCountdown() != -1)
|
|
|
|
{
|
2013-09-09 10:28:35 +02:00
|
|
|
event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds" + extrainformation);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-09 10:28:35 +02:00
|
|
|
event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
2014-09-12 10:06:51 +02:00
|
|
|
//In Progress
|
2013-08-27 17:14:08 +02:00
|
|
|
else
|
|
|
|
{
|
2013-09-09 10:28:35 +02:00
|
|
|
event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler
|
|
|
|
public void MessageJoin(PlayerJoinEvent event)
|
|
|
|
{
|
2015-04-01 07:56:13 +02:00
|
|
|
String name = event.getPlayer().getName();
|
|
|
|
|
2015-01-26 01:23:08 +01:00
|
|
|
if (_game != null && _game.AnnounceJoinQuit)
|
2015-04-01 07:56:13 +02:00
|
|
|
event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name));
|
2015-01-26 01:23:08 +01:00
|
|
|
|
2013-09-09 10:06:44 +02:00
|
|
|
else
|
|
|
|
event.setJoinMessage(null);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void MessageQuit(PlayerQuitEvent event)
|
|
|
|
{
|
2015-04-01 07:56:13 +02:00
|
|
|
String name = event.getPlayer().getName();
|
|
|
|
|
2013-09-09 10:06:44 +02:00
|
|
|
if (_game == null || _game.AnnounceJoinQuit)
|
2015-04-01 07:56:13 +02:00
|
|
|
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name));
|
2013-09-09 10:06:44 +02:00
|
|
|
else
|
|
|
|
event.setQuitMessage(null);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
public Game GetGame()
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
return _game;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetGame(Game game)
|
|
|
|
{
|
|
|
|
_game = game;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int GetPlayerMin()
|
|
|
|
{
|
|
|
|
return GetServerConfig().MinPlayers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int GetPlayerFull()
|
|
|
|
{
|
|
|
|
return GetServerConfig().MaxPlayers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void HubClock(Player player)
|
|
|
|
{
|
2014-08-30 08:33:56 +02:00
|
|
|
if (!IsHotbarHubClock())
|
|
|
|
return;
|
2014-09-16 05:31:53 +02:00
|
|
|
|
|
|
|
if (_game != null && !_game.GiveClock)
|
2014-04-20 05:50:15 +02:00
|
|
|
return;
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-09-16 05:31:53 +02:00
|
|
|
if (player.getOpenInventory().getType() != InventoryType.CRAFTING &&
|
2014-08-10 02:50:31 +02:00
|
|
|
player.getOpenInventory().getType() != InventoryType.CREATIVE)
|
|
|
|
return;
|
|
|
|
|
2015-03-06 09:43:17 +01:00
|
|
|
if (!UtilGear.isMat(player.getInventory().getItem(8), Material.WATCH) && !UtilGear.isMat(player.getInventory().getItem(8), Material.SPECKLED_MELON))
|
2014-08-10 02:50:31 +02:00
|
|
|
{
|
|
|
|
player.getInventory().setItem(
|
|
|
|
8,
|
|
|
|
ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0, C.cGreen
|
2014-09-16 05:31:53 +02:00
|
|
|
+ "Return to Hub", new String[]{"", ChatColor.RESET + "Click while holding this",
|
|
|
|
ChatColor.RESET + "to return to the Hub."}));
|
2014-08-10 02:50:31 +02:00
|
|
|
|
|
|
|
UtilInv.Update(player);
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
}
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2014-07-03 01:59:31 +02:00
|
|
|
@EventHandler
|
|
|
|
public void Login(PlayerLoginEvent event)
|
|
|
|
{
|
2014-07-26 08:38:21 +02:00
|
|
|
if (Bukkit.getServer().hasWhitelist())
|
|
|
|
{
|
2015-09-12 06:39:40 +02:00
|
|
|
if(_requiredRank != null)
|
|
|
|
{
|
|
|
|
if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), _requiredRank, false))
|
|
|
|
{
|
|
|
|
event.allow();
|
|
|
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
|
|
|
|
|
|
|
if (_serverConfig.Tournament && _clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false))
|
|
|
|
{
|
|
|
|
event.getPlayer().setOp(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
|
|
|
|
{
|
|
|
|
if (player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
|
|
|
{
|
|
|
|
event.allow();
|
|
|
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Required Rank for this server: " + _requiredRank.getColor() + _requiredRank.Name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-10-18 01:54:34 +02:00
|
|
|
if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false) ||
|
|
|
|
_clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPDEV ||
|
|
|
|
_clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPLEAD)
|
2014-07-26 19:40:49 +02:00
|
|
|
{
|
2014-07-26 08:38:21 +02:00
|
|
|
event.allow();
|
|
|
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-07-26 08:38:21 +02:00
|
|
|
if (_serverConfig.Tournament)
|
|
|
|
{
|
|
|
|
event.getPlayer().setOp(true);
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
|
|
|
|
{
|
|
|
|
if (player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
|
|
|
{
|
|
|
|
event.allow();
|
|
|
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2014-08-10 02:50:31 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server Whitelisted!");
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2014-07-26 08:38:21 +02:00
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-07-03 01:59:31 +02:00
|
|
|
// Reserved Slot Check
|
2014-08-20 04:24:49 +02:00
|
|
|
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
|
2014-07-03 01:59:31 +02:00
|
|
|
{
|
2015-08-28 22:22:04 +02:00
|
|
|
if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.HELPER, false))
|
2014-07-03 01:59:31 +02:00
|
|
|
{
|
2014-10-18 06:29:24 +02:00
|
|
|
event.allow();
|
|
|
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
|
|
|
return;
|
2014-07-03 01:59:31 +02:00
|
|
|
}
|
2015-08-28 22:22:04 +02:00
|
|
|
else if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.ULTRA, false)
|
2014-12-12 11:23:01 +01:00
|
|
|
|| _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA"))
|
2014-07-03 01:59:31 +02:00
|
|
|
{
|
2014-10-11 14:56:47 +02:00
|
|
|
|
2015-05-11 19:21:32 +02:00
|
|
|
if (GetGame() != null && GetGame().DontAllowOverfill)
|
2014-10-11 14:56:47 +02:00
|
|
|
{
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (Bukkit.getServer().getOnlinePlayers().size() / Bukkit.getMaxPlayers() > 1.5)
|
|
|
|
{
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
|
|
|
return;
|
|
|
|
}
|
2015-07-23 12:06:40 +02:00
|
|
|
else if (_gameHostManager.isEventServer() && Bukkit.getServer().getOnlinePlayers().size() >= 128)
|
|
|
|
{
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
|
|
|
return;
|
|
|
|
}
|
2014-10-11 14:56:47 +02:00
|
|
|
|
2014-07-03 01:59:31 +02:00
|
|
|
event.allow();
|
|
|
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-07-03 01:59:31 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server Full > Purchase Ultra at www.mineplex.com/shop");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-27 03:58:35 +02:00
|
|
|
@EventHandler(priority = EventPriority.LOW)
|
|
|
|
public void AdminOP(PlayerJoinEvent event)
|
|
|
|
{
|
|
|
|
// Give developers operator on their servers
|
|
|
|
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
2015-08-11 08:36:39 +02:00
|
|
|
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
|
|
|
|
|
2015-08-28 22:22:04 +02:00
|
|
|
if (_clientManager.Get(event.getPlayer()).GetRank().has(Rank.OWNER)
|
|
|
|
|| (testServer && (_clientManager.Get(event.getPlayer()).GetRank().has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV))
|
|
|
|
|| eventTestServer && _clientManager.Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV))
|
2015-07-27 03:58:35 +02:00
|
|
|
event.getPlayer().setOp(true);
|
|
|
|
else
|
|
|
|
event.getPlayer().setOp(false);
|
|
|
|
}
|
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
public boolean IsAlive(Player player)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2014-07-26 19:40:49 +02:00
|
|
|
if (_game == null)
|
2013-08-27 17:14:08 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return _game.IsAlive(player);
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public void Clear(Player player)
|
|
|
|
{
|
|
|
|
player.setGameMode(GameMode.SURVIVAL);
|
|
|
|
player.setAllowFlight(false);
|
2015-07-23 05:31:07 +02:00
|
|
|
player.setFlySpeed(0.1F);
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
UtilInv.Clear(player);
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2014-03-13 06:32:48 +01:00
|
|
|
player.setSprinting(false);
|
2014-08-27 06:22:35 +02:00
|
|
|
player.setSneaking(false);
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
player.setFoodLevel(20);
|
2014-07-26 19:40:49 +02:00
|
|
|
player.setSaturation(3f);
|
2013-09-13 04:24:33 +02:00
|
|
|
player.setExhaustion(0f);
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2014-04-12 10:22:53 +02:00
|
|
|
player.setMaxHealth(20);
|
2014-07-26 19:40:49 +02:00
|
|
|
player.setHealth(player.getMaxHealth());
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
player.setFireTicks(0);
|
|
|
|
player.setFallDistance(0);
|
2015-04-06 09:17:36 +02:00
|
|
|
|
|
|
|
player.eject();
|
|
|
|
player.leaveVehicle();
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
player.setLevel(0);
|
|
|
|
player.setExp(0f);
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2015-10-12 04:17:34 +02:00
|
|
|
player.setPlayerTime(player.getWorld().getTime(), false);
|
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
((CraftPlayer) player).getHandle().spectating = false;
|
2015-10-10 21:54:18 +02:00
|
|
|
((CraftPlayer) player).getHandle().ghost = false;
|
2014-07-26 19:40:49 +02:00
|
|
|
((CraftPlayer) player).getHandle().k = true;
|
|
|
|
|
2014-04-09 11:03:19 +02:00
|
|
|
// Arrows go bye bye.
|
2014-07-26 19:40:49 +02:00
|
|
|
((CraftPlayer) player).getHandle().p(0);
|
2013-08-27 17:14:08 +02:00
|
|
|
|
2014-09-01 13:37:39 +02:00
|
|
|
//Remove all conditions
|
|
|
|
GetCondition().EndCondition(player, null, null);
|
2015-07-23 05:31:07 +02:00
|
|
|
for (PotionEffect potion : player.getActivePotionEffects())
|
|
|
|
player.removePotionEffect(potion.getType());
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
HubClock(player);
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-09-02 01:38:32 +02:00
|
|
|
GetDisguise().undisguise(player);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
2014-04-11 12:09:21 +02:00
|
|
|
public ArrayList<String> LoadFiles(String gameName)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2014-06-25 21:06:24 +02:00
|
|
|
TimingManager.start("ArcadeManager LoadFiles");
|
2015-06-18 20:54:26 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
File folder = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar
|
|
|
|
+ "maps" + File.separatorChar + gameName);
|
2015-06-18 20:54:26 +02:00
|
|
|
System.out.println(folder.getAbsolutePath()+" -=-=-=-=-=" );
|
2014-07-26 19:40:49 +02:00
|
|
|
if (!folder.exists())
|
|
|
|
folder.mkdirs();
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
ArrayList<String> maps = new ArrayList<String>();
|
|
|
|
|
|
|
|
System.out.println("Searching Maps in: " + folder);
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
for (File file : folder.listFiles())
|
|
|
|
{
|
|
|
|
if (!file.isFile())
|
|
|
|
continue;
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
String name = file.getName();
|
|
|
|
|
|
|
|
if (name.length() < 5)
|
|
|
|
continue;
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
name = name.substring(name.length() - 4, name.length());
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
if (file.getName().equals(".zip"))
|
|
|
|
continue;
|
|
|
|
|
2014-07-26 19:40:49 +02:00
|
|
|
maps.add(file.getName().substring(0, file.getName().length() - 4));
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (String map : maps)
|
|
|
|
System.out.println("Found Map: " + map);
|
|
|
|
|
2014-06-25 21:06:24 +02:00
|
|
|
TimingManager.stop("ArcadeManager LoadFiles");
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
return maps;
|
|
|
|
}
|
2013-10-31 07:35:24 +01:00
|
|
|
|
|
|
|
public ClassManager getClassManager()
|
|
|
|
{
|
|
|
|
return _classManager;
|
|
|
|
}
|
2013-11-22 08:40:38 +01:00
|
|
|
|
2014-03-28 03:17:31 +01:00
|
|
|
public ClassCombatShop getClassShop()
|
2013-10-31 07:35:24 +01:00
|
|
|
{
|
2014-03-28 03:17:31 +01:00
|
|
|
return _classShop;
|
2013-10-31 07:35:24 +01:00
|
|
|
}
|
|
|
|
|
2014-03-11 11:29:11 +01:00
|
|
|
public void openClassShop(Player player)
|
2013-10-31 07:35:24 +01:00
|
|
|
{
|
2014-09-16 05:31:53 +02:00
|
|
|
_classShop.attemptShopOpen(player);
|
2013-10-31 07:35:24 +01:00
|
|
|
}
|
2013-11-22 08:40:38 +01:00
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void BlockBurn(BlockBurnEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void BlockSpread(BlockSpreadEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void BlockFade(BlockFadeEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void BlockDecay(LeavesDecayEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-03-01 00:35:06 +01:00
|
|
|
@EventHandler
|
2013-11-22 08:40:38 +01:00
|
|
|
public void MobSpawn(CreatureSpawnEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-04-15 09:53:24 +02:00
|
|
|
@EventHandler
|
|
|
|
public void SkillTrigger(SkillTriggerEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null || !_game.IsLive())
|
|
|
|
{
|
|
|
|
event.SetCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-04-21 02:48:04 +02:00
|
|
|
@EventHandler
|
|
|
|
public void ItemTrigger(ItemTriggerEvent event)
|
|
|
|
{
|
|
|
|
if (_game == null || !_game.IsLive())
|
|
|
|
{
|
|
|
|
event.SetCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
2014-05-02 06:35:41 +02:00
|
|
|
|
2014-05-03 03:23:10 +02:00
|
|
|
@EventHandler
|
|
|
|
public void Observer(PlayerCommandPreprocessEvent event)
|
|
|
|
{
|
|
|
|
if (event.getMessage().equalsIgnoreCase("/spec"))
|
|
|
|
{
|
2014-05-03 05:06:15 +02:00
|
|
|
event.setCancelled(true);
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-03 05:06:15 +02:00
|
|
|
if (_game != null && _game.InProgress())
|
|
|
|
{
|
|
|
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot toggle Spectator during games."));
|
|
|
|
return;
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-03 03:23:10 +02:00
|
|
|
if (!_specList.remove(event.getPlayer()))
|
|
|
|
{
|
|
|
|
_specList.add(event.getPlayer());
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-03 03:23:10 +02:00
|
|
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You are now a Spectator!"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You are no longer a Spectator!"));
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
|
|
|
// Clean
|
2014-05-03 03:23:10 +02:00
|
|
|
if (_game != null)
|
|
|
|
{
|
2014-07-26 19:40:49 +02:00
|
|
|
// Remove Data
|
2014-05-03 03:23:10 +02:00
|
|
|
_game.RemoveTeamPreference(event.getPlayer());
|
|
|
|
_game.GetPlayerKits().remove(event.getPlayer());
|
|
|
|
_game.GetPlayerGems().remove(event.getPlayer());
|
2014-07-26 19:40:49 +02:00
|
|
|
|
|
|
|
// Leave Team
|
2014-05-03 03:23:10 +02:00
|
|
|
GameTeam team = _game.GetTeam(event.getPlayer());
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-03 03:23:10 +02:00
|
|
|
if (team != null)
|
|
|
|
{
|
|
|
|
team.RemovePlayer(event.getPlayer());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-03 03:23:10 +02:00
|
|
|
@EventHandler
|
|
|
|
public void ObserverQuit(PlayerQuitEvent event)
|
|
|
|
{
|
|
|
|
_specList.remove(event.getPlayer());
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-03 03:23:10 +02:00
|
|
|
public boolean IsObserver(Player player)
|
|
|
|
{
|
|
|
|
return _specList.contains(player);
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-02 06:35:41 +02:00
|
|
|
public boolean IsTournamentServer()
|
|
|
|
{
|
|
|
|
return _serverConfig.Tournament;
|
|
|
|
}
|
2014-09-24 07:46:55 +02:00
|
|
|
|
|
|
|
public boolean IsTournamentPoints()
|
|
|
|
{
|
|
|
|
return _serverConfig.TournamentPoints;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsTeamRejoin()
|
|
|
|
{
|
|
|
|
return _serverConfig.TeamRejoin;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsTeamAutoJoin()
|
|
|
|
{
|
|
|
|
return _serverConfig.TeamAutoJoin;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsGameAutoStart()
|
|
|
|
{
|
|
|
|
return _serverConfig.GameAutoStart;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsGameTimeout()
|
|
|
|
{
|
|
|
|
return _serverConfig.GameTimeout;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsTeamBalance()
|
|
|
|
{
|
|
|
|
return _serverConfig.TeamForceBalance;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsRewardGems()
|
|
|
|
{
|
|
|
|
return _serverConfig.RewardGems;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsRewardItems()
|
|
|
|
{
|
|
|
|
return _serverConfig.RewardItems;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsRewardStats()
|
|
|
|
{
|
|
|
|
return _serverConfig.RewardStats;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsRewardAchievements()
|
|
|
|
{
|
|
|
|
return _serverConfig.RewardAchievements;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsHotbarInventory()
|
|
|
|
{
|
|
|
|
return _serverConfig.HotbarInventory;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsHotbarHubClock()
|
|
|
|
{
|
|
|
|
return _serverConfig.HotbarHubClock;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-30 08:33:56 +02:00
|
|
|
public boolean IsPlayerKickIdle()
|
|
|
|
{
|
|
|
|
return _serverConfig.PlayerKickIdle;
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2014-08-26 06:42:17 +02:00
|
|
|
public int GetDesiredPlayerAmount()
|
|
|
|
{
|
|
|
|
return _serverConfig.MaxPlayers;
|
|
|
|
}
|
2014-11-07 01:52:58 +01:00
|
|
|
|
|
|
|
public String GetHost()
|
|
|
|
{
|
|
|
|
return _serverConfig.HostName;
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-05-06 07:55:14 +02:00
|
|
|
@EventHandler
|
|
|
|
public void ObserverQuit(GameStateChangeEvent event)
|
|
|
|
{
|
|
|
|
if (_skillFactory != null)
|
|
|
|
{
|
|
|
|
_skillFactory.ResetAll();
|
|
|
|
}
|
|
|
|
}
|
2014-07-26 19:40:49 +02:00
|
|
|
|
2014-08-09 05:10:02 +02:00
|
|
|
public InventoryManager getInventoryManager()
|
|
|
|
{
|
|
|
|
return _inventoryManager;
|
|
|
|
}
|
2014-08-10 02:50:31 +02:00
|
|
|
|
2014-08-09 15:25:13 +02:00
|
|
|
@EventHandler(priority = EventPriority.LOWEST)
|
2014-08-09 11:55:05 +02:00
|
|
|
public void cosmeticState(GameStateChangeEvent event)
|
|
|
|
{
|
|
|
|
//Disable
|
|
|
|
if (event.GetState() == GameState.Recruit)
|
|
|
|
{
|
2014-08-11 07:33:45 +02:00
|
|
|
getCosmeticManager().setActive(true);
|
2014-08-09 11:55:05 +02:00
|
|
|
}
|
2014-08-09 16:21:45 +02:00
|
|
|
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
|
2014-08-09 11:55:05 +02:00
|
|
|
{
|
2015-03-06 09:11:26 +01:00
|
|
|
if (event.GetGame().GadgetsDisabled)
|
2014-08-11 03:55:00 +02:00
|
|
|
{
|
2015-03-06 09:11:26 +01:00
|
|
|
if (getCosmeticManager().isShowingInterface())
|
|
|
|
{
|
|
|
|
getCosmeticManager().setActive(false);
|
|
|
|
getCosmeticManager().disableItemsForGame();
|
|
|
|
}
|
2014-08-11 03:55:00 +02:00
|
|
|
}
|
2014-08-09 11:55:05 +02:00
|
|
|
}
|
|
|
|
}
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2015-02-19 00:51:36 +01:00
|
|
|
/*public void saveBasicStats(final Game game)
|
2014-09-05 10:00:51 +02:00
|
|
|
{
|
2014-09-20 08:28:45 +02:00
|
|
|
if (!IsTournamentServer())
|
|
|
|
return;
|
|
|
|
|
2014-09-16 05:31:53 +02:00
|
|
|
final Map<UUID, Boolean> data = new HashMap<>();
|
|
|
|
|
|
|
|
for (Player loser : game.getLosers())
|
|
|
|
data.put(loser.getUniqueId(), false);
|
|
|
|
|
|
|
|
for (Player winner : game.getWinners())
|
|
|
|
data.put(winner.getUniqueId(), true);
|
|
|
|
|
2015-02-26 06:07:07 +01:00
|
|
|
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
2014-09-16 05:31:53 +02:00
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
2014-11-05 23:39:22 +01:00
|
|
|
getArcadeRepository().saveBasicStats(game.GetType(), IsTournamentServer(), (int) (System.currentTimeMillis() - game.getGameLiveTime()), data);
|
2014-09-16 05:31:53 +02:00
|
|
|
}
|
|
|
|
});
|
2015-02-19 00:51:36 +01:00
|
|
|
}*/
|
2014-09-16 05:31:53 +02:00
|
|
|
|
2015-02-19 00:51:36 +01:00
|
|
|
/*public void saveLeaderboardStats(Game game)
|
2014-09-16 05:31:53 +02:00
|
|
|
{
|
|
|
|
final TournamentType type = TournamentType.getTournamentType(game.GetType());
|
|
|
|
|
|
|
|
if (type != null)
|
|
|
|
{
|
|
|
|
final Map<UUID, Boolean> data = new HashMap<>();
|
|
|
|
|
|
|
|
for (Player loser : game.getLosers())
|
|
|
|
data.put(loser.getUniqueId(), false);
|
|
|
|
|
|
|
|
for (Player winner : game.getWinners())
|
|
|
|
data.put(winner.getUniqueId(), true);
|
|
|
|
|
2015-02-26 06:07:07 +01:00
|
|
|
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
2014-09-16 05:31:53 +02:00
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
2014-11-05 23:39:22 +01:00
|
|
|
getArcadeRepository().saveLeaderboardStats(0, type.ordinal(), data);
|
2014-09-16 05:31:53 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2015-02-19 00:51:36 +01:00
|
|
|
}*/
|
2014-10-24 10:05:57 +02:00
|
|
|
|
2015-02-24 23:22:47 +01:00
|
|
|
public boolean isGameInProgress()
|
|
|
|
{
|
|
|
|
return _game != null && _game.InProgress();
|
|
|
|
}
|
|
|
|
|
2015-07-23 16:29:42 +02:00
|
|
|
public boolean hasKitsUnlocked(Player player)
|
2014-10-24 10:05:57 +02:00
|
|
|
{
|
|
|
|
return _youtube.contains(player);
|
|
|
|
}
|
|
|
|
|
2015-07-23 16:29:42 +02:00
|
|
|
public void toggleUnlockKits(Player caller)
|
2014-10-24 10:05:57 +02:00
|
|
|
{
|
|
|
|
if (_youtube.remove(caller))
|
|
|
|
{
|
2015-07-23 16:29:42 +02:00
|
|
|
UtilPlayer.message(caller, C.cRed + C.Bold + "Celebrity Mode Disabled: " + ChatColor.RESET + "Kits Locked");
|
2014-10-24 10:05:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_youtube.add(caller);
|
2015-07-23 16:29:42 +02:00
|
|
|
UtilPlayer.message(caller, C.cGreen + C.Bold + "Celebrity Mode Enabled: " + ChatColor.RESET + "All Kits Unlocked");
|
2014-10-24 10:05:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void quitYoutuber(PlayerQuitEvent event)
|
|
|
|
{
|
|
|
|
_youtube.remove(event.getPlayer());
|
|
|
|
}
|
2014-11-08 00:28:06 +01:00
|
|
|
|
|
|
|
public IdleManager getIdleManager()
|
|
|
|
{
|
|
|
|
return _idleManager;
|
|
|
|
}
|
2014-12-15 02:24:40 +01:00
|
|
|
|
|
|
|
public void rewardPet(Player player, String pet, EntityType type)
|
|
|
|
{
|
2014-12-15 05:49:52 +01:00
|
|
|
if (!player.isOnline())
|
|
|
|
return;
|
|
|
|
|
2014-12-15 02:24:40 +01:00
|
|
|
PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0);
|
|
|
|
|
|
|
|
if (reward.canGiveReward(player))
|
|
|
|
reward.giveReward(null, player);
|
|
|
|
}
|
2014-12-23 01:18:48 +01:00
|
|
|
|
2014-12-23 01:39:03 +01:00
|
|
|
public void toggleChampionsModules(GameType gameType)
|
2014-12-23 01:18:48 +01:00
|
|
|
{
|
2015-08-24 15:58:57 +02:00
|
|
|
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.BossBattles;
|
2014-12-23 01:39:03 +01:00
|
|
|
|
|
|
|
if (_enabled == isChamps)
|
2014-12-23 01:18:48 +01:00
|
|
|
{
|
2014-12-23 01:39:03 +01:00
|
|
|
System.out.println("----------Champions Modules are still " + isChamps);
|
2014-12-23 01:18:48 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-23 01:39:03 +01:00
|
|
|
System.out.println("----------Champions Modules set to " + isChamps);
|
|
|
|
_enabled = isChamps;
|
2014-12-23 01:18:48 +01:00
|
|
|
|
|
|
|
if (_enabled)
|
|
|
|
{
|
2014-12-23 13:44:59 +01:00
|
|
|
_classManager.setEnabled(true);
|
2015-02-26 06:07:07 +01:00
|
|
|
_classShopManager.registerSelf();
|
|
|
|
_skillFactory.registerSelf();
|
|
|
|
_itemFactory.registerSelf();
|
|
|
|
_energy.registerSelf();
|
|
|
|
_eloManager.registerSelf();
|
2014-12-23 01:18:48 +01:00
|
|
|
|
|
|
|
//Class Shop
|
2014-12-23 01:39:03 +01:00
|
|
|
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
|
2014-12-23 01:18:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-23 13:44:59 +01:00
|
|
|
_classManager.setEnabled(false);
|
2015-02-26 06:07:07 +01:00
|
|
|
_classShopManager.deregisterSelf();
|
|
|
|
_skillFactory.deregisterSelf();
|
|
|
|
_itemFactory.deregisterSelf();
|
|
|
|
_energy.deregisterSelf();
|
|
|
|
_eloManager.deregisterSelf();
|
2014-12-23 01:18:48 +01:00
|
|
|
|
|
|
|
//Class Shop
|
2014-12-23 01:39:03 +01:00
|
|
|
HandlerList.unregisterAll(_classShop);
|
2014-12-23 01:18:48 +01:00
|
|
|
}
|
|
|
|
}
|
2015-02-24 01:03:51 +01:00
|
|
|
|
|
|
|
public PartyManager getPartyManager()
|
|
|
|
{
|
|
|
|
return _partyManager;
|
|
|
|
}
|
2015-03-12 05:31:40 +01:00
|
|
|
|
|
|
|
public void addSpectator(Player player, boolean teleport)
|
|
|
|
{
|
|
|
|
if (GetGame() == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Clear(player);
|
|
|
|
|
|
|
|
if (teleport)
|
|
|
|
player.teleport(GetGame().GetSpectatorLocation());
|
|
|
|
|
|
|
|
//Set Spec State
|
2015-08-02 11:50:26 +02:00
|
|
|
UtilAction.velocity(player, new Vector(0,1,0));
|
2015-03-12 05:31:40 +01:00
|
|
|
player.setAllowFlight(true);
|
|
|
|
player.setFlying(true);
|
|
|
|
player.setFlySpeed(0.1f);
|
|
|
|
((CraftPlayer) player).getHandle().spectating = true;
|
2015-10-10 21:54:18 +02:00
|
|
|
((CraftPlayer) player).getHandle().ghost = true;
|
2015-03-12 05:31:40 +01:00
|
|
|
((CraftPlayer) player).getHandle().k = false;
|
|
|
|
|
|
|
|
GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true);
|
|
|
|
|
2015-03-25 07:13:22 +01:00
|
|
|
//Game Team
|
2015-03-12 05:31:40 +01:00
|
|
|
GetGame().GetScoreboard().SetPlayerTeam(player, "SPEC");
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isSpectator(Entity player)
|
|
|
|
{
|
|
|
|
if (player instanceof Player)
|
|
|
|
return UtilPlayer.isSpectator((Player)player);
|
|
|
|
return false;
|
|
|
|
}
|
2015-04-21 17:45:59 +02:00
|
|
|
|
2015-03-17 11:59:24 +01:00
|
|
|
@EventHandler
|
|
|
|
public void onSecond(UpdateEvent event)
|
|
|
|
{
|
|
|
|
Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator();
|
|
|
|
|
|
|
|
while (itel.hasNext())
|
|
|
|
{
|
|
|
|
Entry<String, Long> entry = itel.next();
|
|
|
|
|
2015-05-03 18:13:23 +02:00
|
|
|
if (UtilTime.elapsed(entry.getValue(), 20000))
|
2015-03-17 11:59:24 +01:00
|
|
|
{
|
|
|
|
Player player = Bukkit.getPlayerExact(entry.getKey());
|
|
|
|
|
|
|
|
if (player != null)
|
|
|
|
{
|
|
|
|
// Send it again, enforce it!
|
|
|
|
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
|
|
|
player.setResourcePack(_resourcePackUrl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itel.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void ResourcePackQuit(PlayerQuitEvent event)
|
|
|
|
{
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
2015-05-01 17:03:53 +02:00
|
|
|
if (_resourcePackUsers.containsKey(player.getName()) && _resourcePackUsers.get(player.getName()))
|
2015-03-17 11:59:24 +01:00
|
|
|
{
|
|
|
|
new RedisUnloadResPack(player.getName()).publish();
|
|
|
|
|
|
|
|
_resourcePackUsers.remove(player.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void outdatedVersion(GameStateChangeEvent event)
|
|
|
|
{
|
|
|
|
if (!_resourcePackRequired)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (Player player : UtilServer.getPlayers())
|
|
|
|
{
|
|
|
|
if (!UtilPlayer.is1_8(player))
|
2015-04-29 15:33:21 +02:00
|
|
|
returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!");
|
2015-03-17 11:59:24 +01:00
|
|
|
}
|
|
|
|
}
|
2015-05-02 22:10:25 +02:00
|
|
|
|
|
|
|
private void returnHubNoResPack(Player player)
|
|
|
|
{
|
|
|
|
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
|
|
|
GetPortal().sendPlayerToServer(player, "Lobby");
|
|
|
|
}
|
|
|
|
|
2015-04-29 15:33:21 +02:00
|
|
|
private void returnHubNoResPack(Player player, String message)
|
2015-03-17 11:59:24 +01:00
|
|
|
{
|
|
|
|
UtilPlayer.message(player, " ");
|
2015-04-29 15:33:21 +02:00
|
|
|
UtilPlayer.message(player, C.cGold + C.Bold + message);
|
2015-03-17 11:59:24 +01:00
|
|
|
UtilPlayer.message(player, " ");
|
2015-05-02 22:10:25 +02:00
|
|
|
|
|
|
|
returnHubNoResPack(player);
|
2015-03-17 11:59:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void ResourcePackJoin(PlayerJoinEvent event)
|
|
|
|
{
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
|
|
|
if (!UtilPlayer.is1_8(player) && _resourcePackRequired)
|
|
|
|
{
|
2015-04-29 15:33:21 +02:00
|
|
|
returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!");
|
2015-03-17 11:59:24 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_resourcePackUrl != null)
|
|
|
|
{
|
|
|
|
if (_resourcePackRequired)
|
|
|
|
{
|
|
|
|
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
|
|
|
}
|
|
|
|
|
2015-05-01 17:03:53 +02:00
|
|
|
_resourcePackUsers.put(player.getName(), false);
|
2015-03-17 11:59:24 +01:00
|
|
|
player.setResourcePack(_resourcePackUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setResourcePack(String resourcePack, boolean forceResourcePack)
|
|
|
|
{
|
|
|
|
if (!Objects.equal(resourcePack, _resourcePackUrl) || forceResourcePack != _resourcePackRequired)
|
|
|
|
{
|
|
|
|
_resourcePackNoResponse.clear();
|
|
|
|
_resourcePackUsers.clear();
|
|
|
|
_resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack;
|
|
|
|
_resourcePackRequired = forceResourcePack;
|
|
|
|
|
|
|
|
if (_resourcePackUrl == null || _resourcePackUrl.isEmpty())
|
|
|
|
{
|
|
|
|
_resourcePackRequired = false;
|
|
|
|
|
|
|
|
for (Player player : Bukkit.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (Player player : Bukkit.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
if (_resourcePackRequired)
|
|
|
|
{
|
|
|
|
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
|
|
|
}
|
|
|
|
|
2015-05-01 17:03:53 +02:00
|
|
|
_resourcePackUsers.put(player.getName(), false);
|
2015-03-17 11:59:24 +01:00
|
|
|
player.setResourcePack(_resourcePackUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-09-12 06:39:40 +02:00
|
|
|
|
2015-09-12 07:01:18 +02:00
|
|
|
public void loadRequiredRank()
|
2015-09-12 06:39:40 +02:00
|
|
|
{
|
|
|
|
_requiredRank = null;
|
|
|
|
|
|
|
|
for(File file : new File(".").listFiles())
|
|
|
|
{
|
|
|
|
if(!file.getName().startsWith("RequiredRank"))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
_requiredRank = Rank.valueOf(file.getName().split("=")[1]);
|
|
|
|
System.out.println("set required rank to " + _requiredRank.Name);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException e)
|
|
|
|
{
|
|
|
|
System.out.println("===============================");
|
|
|
|
System.out.println("Wrong required rank definition.");
|
|
|
|
System.out.println("[" + file.getName().split("=")[1] + "] Does not exist!");
|
|
|
|
System.out.println("===============================");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Rank getRequiredRank()
|
|
|
|
{
|
|
|
|
return _requiredRank;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRequiredRank(Rank rank)
|
|
|
|
{
|
|
|
|
_requiredRank = rank;
|
|
|
|
}
|
2015-10-10 10:27:54 +02:00
|
|
|
|
|
|
|
@EventHandler(priority=EventPriority.LOWEST)
|
|
|
|
public void explosionCancel(EntityExplodeEvent event)
|
|
|
|
{
|
|
|
|
if (GetGame() == null || !GetGame().InProgress())
|
|
|
|
{
|
|
|
|
event.blockList().clear();
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.LOWEST)
|
|
|
|
public void explosionCancel(ExplosionEvent event)
|
|
|
|
{
|
|
|
|
if (GetGame() == null || !GetGame().InProgress())
|
|
|
|
{
|
|
|
|
event.GetBlocks().clear();
|
|
|
|
}
|
|
|
|
}
|
2015-10-11 05:48:02 +02:00
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void spawnDebug(PlayerCommandPreprocessEvent event)
|
|
|
|
{
|
|
|
|
if (event.getPlayer().isOp() && event.getMessage().contains("setmax"))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
int i = Integer.parseInt(event.getMessage().split(" ")[1]);
|
|
|
|
|
|
|
|
_serverConfig.MaxPlayers = i;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|