2013-08-27 17:14:08 +02:00
|
|
|
package mineplex.hub;
|
|
|
|
|
2014-11-05 01:26:39 +01:00
|
|
|
import java.util.ArrayList;
|
2013-09-07 06:09:12 +02:00
|
|
|
import java.util.HashMap;
|
2013-08-31 10:19:23 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.ChatColor;
|
2014-12-16 06:18:09 +01:00
|
|
|
import org.bukkit.Color;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.GameMode;
|
|
|
|
import org.bukkit.Location;
|
2014-07-09 03:01:03 +02:00
|
|
|
import org.bukkit.Material;
|
2014-12-16 06:18:09 +01:00
|
|
|
import org.bukkit.Sound;
|
2014-08-14 01:57:37 +02:00
|
|
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
2013-09-04 20:35:59 +02:00
|
|
|
import org.bukkit.entity.Egg;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.entity.Entity;
|
2013-08-31 10:19:23 +02:00
|
|
|
import org.bukkit.entity.LivingEntity;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.entity.Player;
|
2014-08-07 09:33:24 +02:00
|
|
|
import org.bukkit.entity.Projectile;
|
|
|
|
import org.bukkit.entity.Snowball;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
2014-08-07 09:33:24 +02:00
|
|
|
import org.bukkit.event.block.BlockDamageEvent;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.event.entity.EntityDamageEvent;
|
|
|
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
2014-08-18 00:30:35 +02:00
|
|
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
2014-08-22 23:50:07 +02:00
|
|
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
2013-10-25 10:20:14 +02:00
|
|
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
2013-09-07 02:43:45 +02:00
|
|
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
2014-02-28 10:18:32 +01:00
|
|
|
import org.bukkit.event.player.PlayerLoginEvent;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.event.player.PlayerQuitEvent;
|
|
|
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
2014-09-30 00:17:02 +02:00
|
|
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
2013-09-07 02:43:45 +02:00
|
|
|
import org.bukkit.event.server.ServerListPingEvent;
|
2013-08-31 11:01:41 +02:00
|
|
|
import org.bukkit.event.world.ChunkLoadEvent;
|
2014-07-09 03:01:03 +02:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.bukkit.inventory.meta.BookMeta;
|
2013-08-27 17:14:08 +02:00
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
import org.bukkit.scoreboard.DisplaySlot;
|
|
|
|
import org.bukkit.scoreboard.Objective;
|
|
|
|
import org.bukkit.scoreboard.Scoreboard;
|
|
|
|
|
|
|
|
import mineplex.core.MiniClientPlugin;
|
2014-02-28 10:18:32 +01:00
|
|
|
import mineplex.core.account.CoreClient;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.account.CoreClientManager;
|
2014-08-24 23:08:19 +02:00
|
|
|
import mineplex.core.achievement.AchievementManager;
|
2014-11-25 22:25:13 +01:00
|
|
|
import mineplex.core.benefit.BenefitManager;
|
2013-10-22 06:46:31 +02:00
|
|
|
import mineplex.core.blockrestore.BlockRestore;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.common.Rank;
|
|
|
|
import mineplex.core.common.util.C;
|
2013-09-07 06:09:12 +02:00
|
|
|
import mineplex.core.common.util.F;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.common.util.UtilAction;
|
|
|
|
import mineplex.core.common.util.UtilAlg;
|
2014-12-16 06:18:09 +01:00
|
|
|
import mineplex.core.common.util.UtilFirework;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.common.util.UtilInv;
|
2014-08-08 09:05:11 +02:00
|
|
|
import mineplex.core.common.util.UtilMath;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.common.util.UtilPlayer;
|
|
|
|
import mineplex.core.common.util.UtilServer;
|
2014-10-09 01:35:54 +02:00
|
|
|
import mineplex.core.common.util.UtilTabTitle;
|
2013-10-26 10:01:26 +02:00
|
|
|
import mineplex.core.common.util.UtilTime;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.common.util.UtilWorld;
|
2014-08-09 10:57:56 +02:00
|
|
|
import mineplex.core.cosmetic.CosmeticManager;
|
2013-08-31 11:01:41 +02:00
|
|
|
import mineplex.core.disguise.DisguiseManager;
|
2013-11-16 11:59:28 +01:00
|
|
|
import mineplex.core.disguise.disguises.DisguiseSlime;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.donation.DonationManager;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.gadget.GadgetManager;
|
2014-10-15 06:44:26 +02:00
|
|
|
import mineplex.core.gadget.event.GadgetActivateEvent;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
2014-11-25 22:28:37 +01:00
|
|
|
import mineplex.core.hologram.HologramManager;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.inventory.InventoryManager;
|
2014-07-09 03:01:03 +02:00
|
|
|
import mineplex.core.itemstack.ItemStackFactory;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.mount.MountManager;
|
2014-10-15 06:44:26 +02:00
|
|
|
import mineplex.core.mount.event.MountActivateEvent;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.pet.PetManager;
|
2013-09-07 02:43:45 +02:00
|
|
|
import mineplex.core.portal.Portal;
|
2014-05-30 22:34:55 +02:00
|
|
|
import mineplex.core.preferences.PreferencesManager;
|
2014-08-22 20:30:41 +02:00
|
|
|
import mineplex.core.projectile.ProjectileManager;
|
2013-12-14 06:38:16 +01:00
|
|
|
import mineplex.core.stats.StatsManager;
|
2013-09-03 20:34:28 +02:00
|
|
|
import mineplex.core.task.TaskManager;
|
2014-09-19 00:33:05 +02:00
|
|
|
import mineplex.core.treasure.TreasureManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.updater.UpdateType;
|
|
|
|
import mineplex.core.updater.event.UpdateEvent;
|
2014-07-01 01:12:42 +02:00
|
|
|
import mineplex.hub.commands.ForcefieldRadius;
|
2014-10-15 06:44:26 +02:00
|
|
|
import mineplex.hub.commands.GadgetToggle;
|
2014-08-29 10:21:08 +02:00
|
|
|
import mineplex.hub.commands.GameModeCommand;
|
2014-07-09 04:55:51 +02:00
|
|
|
import mineplex.hub.commands.NewsCommand;
|
2014-11-20 21:41:25 +01:00
|
|
|
import mineplex.hub.mail.MailManager;
|
2014-08-18 00:30:35 +02:00
|
|
|
import mineplex.hub.modules.ForcefieldManager;
|
|
|
|
import mineplex.hub.modules.JumpManager;
|
|
|
|
import mineplex.hub.modules.MapManager;
|
|
|
|
import mineplex.hub.modules.NewsManager;
|
|
|
|
import mineplex.hub.modules.ParkourManager;
|
|
|
|
import mineplex.hub.modules.TextManager;
|
2014-10-10 04:07:59 +02:00
|
|
|
import mineplex.hub.modules.UHCManager;
|
2014-08-18 00:30:35 +02:00
|
|
|
import mineplex.hub.modules.VisibilityManager;
|
|
|
|
import mineplex.hub.modules.WorldManager;
|
2014-12-05 05:48:54 +01:00
|
|
|
import mineplex.hub.notification.NotificationManager;
|
2013-09-07 06:09:12 +02:00
|
|
|
import mineplex.hub.party.Party;
|
|
|
|
import mineplex.hub.party.PartyManager;
|
2014-08-18 00:30:35 +02:00
|
|
|
import mineplex.hub.poll.PollManager;
|
2013-09-07 06:09:12 +02:00
|
|
|
import mineplex.hub.tutorial.TutorialManager;
|
2014-04-28 01:41:00 +02:00
|
|
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
|
|
|
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
|
2014-09-19 00:33:05 +02:00
|
|
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
public class HubManager extends MiniClientPlugin<HubClient>
|
|
|
|
{
|
2014-10-17 12:20:04 +02:00
|
|
|
// ☃❅ Snowman!
|
2014-12-12 09:44:04 +01:00
|
|
|
public HubType Type = HubType.Christmas;
|
2014-08-26 06:42:17 +02:00
|
|
|
|
2013-10-22 06:46:31 +02:00
|
|
|
private BlockRestore _blockRestore;
|
2014-05-26 01:11:58 +02:00
|
|
|
private CoreClientManager _clientManager;
|
2013-10-19 07:52:15 +02:00
|
|
|
private ConditionManager _conditionManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
private DonationManager _donationManager;
|
2013-08-31 11:01:41 +02:00
|
|
|
private DisguiseManager _disguiseManager;
|
2014-08-25 04:59:29 +02:00
|
|
|
private PartyManager _partyManager;
|
2014-10-15 06:44:26 +02:00
|
|
|
private ForcefieldManager _forcefieldManager;
|
2014-08-25 04:59:29 +02:00
|
|
|
private Portal _portal;
|
|
|
|
private StatsManager _statsManager;
|
2013-12-21 10:05:42 +01:00
|
|
|
private GadgetManager _gadgetManager;
|
|
|
|
private MountManager _mountManager;
|
2014-08-25 04:59:29 +02:00
|
|
|
private VisibilityManager _visibilityManager;
|
|
|
|
private TutorialManager _tutorialManager;
|
2013-09-18 11:46:45 +02:00
|
|
|
private TextManager _textCreator;
|
2014-08-25 04:59:29 +02:00
|
|
|
private ParkourManager _parkour;
|
2014-08-08 09:16:20 +02:00
|
|
|
private PreferencesManager _preferences;
|
2014-11-04 01:46:49 +01:00
|
|
|
private InventoryManager _inventoryManager;
|
2014-07-09 04:55:51 +02:00
|
|
|
private NewsManager _news;
|
2014-08-24 23:08:19 +02:00
|
|
|
private AchievementManager _achievementManager;
|
2014-09-19 00:33:05 +02:00
|
|
|
private TreasureManager _treasureManager;
|
2014-12-17 06:31:51 +01:00
|
|
|
private PetManager _petManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
private Location _spawn;
|
|
|
|
private int _scoreboardTick = 0;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
private HashMap<Player, Scoreboard> _scoreboards = new HashMap<Player, Scoreboard>();
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-08-25 04:59:29 +02:00
|
|
|
private String _pigStacker = "0 - Nobody";
|
|
|
|
|
2014-07-09 03:01:03 +02:00
|
|
|
private ItemStack _ruleBook = null;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
private boolean _shuttingDown;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-10-26 10:01:26 +02:00
|
|
|
private HashMap<String, Long> _portalTime = new HashMap<String, Long>();
|
2014-11-05 01:26:39 +01:00
|
|
|
|
|
|
|
private HashMap<String, ArrayList<String>> _creativeAdmin = new HashMap<String, ArrayList<String>>();
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-13 04:08:56 +02:00
|
|
|
//Admin
|
|
|
|
private boolean _gadgetsEnabled = true;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-11-25 22:28:37 +01:00
|
|
|
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager)
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
super("Hub Manager", plugin);
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-10-22 06:46:31 +02:00
|
|
|
_blockRestore = blockRestore;
|
2013-08-27 17:14:08 +02:00
|
|
|
_clientManager = clientManager;
|
2013-10-19 07:52:15 +02:00
|
|
|
_conditionManager = conditionManager;
|
2014-05-26 01:11:58 +02:00
|
|
|
_donationManager = donationManager;
|
2013-08-31 11:01:41 +02:00
|
|
|
_disguiseManager = disguiseManager;
|
2014-06-01 09:39:10 +02:00
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
_portal = portal;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-08-23 00:52:50 +02:00
|
|
|
_spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5);
|
2014-11-24 02:51:23 +01:00
|
|
|
// Disable item merging
|
|
|
|
((CraftWorld) _spawn.getWorld()).getHandle().spigotConfig.itemMerge = 0;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
_textCreator = new TextManager(this);
|
|
|
|
_parkour = new ParkourManager(this, donationManager, taskManager);
|
2013-10-25 10:20:14 +02:00
|
|
|
|
2013-09-08 02:16:39 +02:00
|
|
|
new MapManager(this);
|
2013-09-18 11:46:45 +02:00
|
|
|
new WorldManager(this);
|
|
|
|
new JumpManager(this);
|
2014-10-11 11:53:39 +02:00
|
|
|
new UHCManager(this);
|
2014-10-03 02:49:26 +02:00
|
|
|
//new TournamentInviter(this);
|
2014-10-15 06:44:26 +02:00
|
|
|
|
2014-07-09 04:55:51 +02:00
|
|
|
_news = new NewsManager(this);
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 20:30:41 +02:00
|
|
|
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
|
2014-11-25 22:25:13 +01:00
|
|
|
_inventoryManager = new InventoryManager(plugin, clientManager);
|
|
|
|
new BenefitManager(plugin, clientManager, _inventoryManager);
|
2014-08-22 20:30:41 +02:00
|
|
|
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
|
2014-11-25 22:28:37 +01:00
|
|
|
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager);
|
2014-12-01 11:27:39 +01:00
|
|
|
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-12-17 06:31:51 +01:00
|
|
|
_petManager = petManager;
|
2013-09-09 10:28:35 +02:00
|
|
|
_partyManager = partyManager;
|
2014-05-30 22:34:55 +02:00
|
|
|
_preferences = preferences;
|
2013-09-07 06:09:12 +02:00
|
|
|
_tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator);
|
2013-10-25 10:20:14 +02:00
|
|
|
_visibilityManager = new VisibilityManager(this);
|
2014-07-01 01:12:42 +02:00
|
|
|
|
|
|
|
_forcefieldManager = new ForcefieldManager(this);
|
2014-11-13 04:21:12 +01:00
|
|
|
addCommand(new ForcefieldRadius(_forcefieldManager));
|
2014-07-01 01:12:42 +02:00
|
|
|
|
2014-11-20 07:47:10 +01:00
|
|
|
_statsManager = statsManager;
|
|
|
|
_achievementManager = achievementManager;
|
2014-08-24 23:08:19 +02:00
|
|
|
_achievementManager.setGiveInterfaceItem(true);
|
2013-12-18 11:56:59 +01:00
|
|
|
|
|
|
|
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
2014-11-20 21:41:25 +01:00
|
|
|
|
2014-12-06 08:00:02 +01:00
|
|
|
// NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager);
|
|
|
|
// new MailManager(_plugin, notificationManager);
|
2014-07-09 03:01:03 +02:00
|
|
|
|
2014-07-09 20:14:57 +02:00
|
|
|
_ruleBook = ItemStackFactory.Instance.CreateStack(Material.WRITTEN_BOOK, (byte)0, 1, ChatColor.GREEN + "Rule Book", new String[] { });
|
2014-07-09 03:01:03 +02:00
|
|
|
BookMeta meta = (BookMeta)_ruleBook.getItemMeta();
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------§r\n"
|
|
|
|
+ "Welcome to §6§lMineplex§r\n"
|
|
|
|
+ "§r§0§l§r§m§0§m-------------------§r§0\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§2Please §0take a moment to read through this book!\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "Part 1 - Rules\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "Part 2 - FAQ\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§l1.§§§r §4No§r spamming.\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§0This is sending too many messages and/or repeating the same message in a short period of time.\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§l2.§m§r §4No§0 use of excessive caps.\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "This is sending messages with an excessive amount of capital letters.\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§l3.§r §4No§0 hacking or use of any unapproved mods.\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "This means we do not tolerate any sort of hacked client or any unapproved mods, such as fly hacks.\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§l4.§r §4No§0 advertising non-Mineplex related links.\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "This is when a link is sent in chat which directs others to non-Mineplex related content.\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§l5.§r §4No§0 trolling or use of any exploits.\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "This means that abuse of bugs/glitches is not tolerated. You also may not do things such as teamkilling and/or blocking spawns.\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§l6.§r §2Be§0 respectful to others, yourself, and the environment around you.\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lRules§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§rPlease report any bugs, exploits, and/or rule breakers on our forums with evidence.\n"
|
|
|
|
+ "§omineplex.com/forums\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lFAQ§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§lWhat is stacker and how do you play it?\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§rStacker is a hub game where you can stack & throw players/mobs.\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§9Right-Click: pick up\n"
|
|
|
|
+ "Left-Click: throw\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lFAQ§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§lHow do I get §b§lUltra§0 §lor §5§lHero§0§l?\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§r§0You are able to purchase these ranks through our shop on our website at:\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§owww.mineplex.com/shop\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lFAQ§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§lWhy hasn't my rank been applied yet?\n"
|
|
|
|
+ "\n"
|
2014-12-12 00:03:25 +01:00
|
|
|
+ "§m§rYour rank may take a while to be applied. If it has been over 24 hours please contact:\n"
|
2014-07-09 03:01:03 +02:00
|
|
|
+ "\n"
|
2014-12-12 00:03:25 +01:00
|
|
|
+ "§omineplex.com/support\n");
|
2014-07-09 03:01:03 +02:00
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lFAQ§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§lWhat do I do if I was wrongfully punished?\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§0If you believe you were wrongfully punished, please submit an appeal at:\n"
|
|
|
|
+ "\n"
|
2014-07-09 20:14:57 +02:00
|
|
|
+ "§omineplex.com/appeals\n");
|
2014-07-09 03:01:03 +02:00
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §2§lFAQ§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "§lHow do I apply for Helper?\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "§rYou may only apply for Helper if you have §bUltra §0or §5Hero§0.\n"
|
|
|
|
+ "Apply at:\n"
|
|
|
|
+ "§omineplex.com/application\n");
|
|
|
|
|
|
|
|
meta.addPage("§m-------------------\n"
|
|
|
|
+ "§r §6§lThank you for \n"
|
|
|
|
+ " reading!§r§0\n"
|
|
|
|
+ "§m-------------------\n"
|
|
|
|
+ "§r\n"
|
|
|
|
+ "Remember to visit our website §2mineplex.com§0 for important news & updates!\n"
|
|
|
|
+ "\n"
|
|
|
|
+ "\n"
|
|
|
|
+ " §c§lH§6§lA§a§lV§9§lE §c§lF§6§lU§a§lN§9§l!\n");
|
2014-11-04 01:46:49 +01:00
|
|
|
|
|
|
|
// These are needed or 1.8 clients will not show book correctly
|
|
|
|
meta.setTitle("Rule Book");
|
|
|
|
meta.setAuthor("Mineplex");
|
|
|
|
|
2014-07-09 03:01:03 +02:00
|
|
|
_ruleBook.setItemMeta(meta);
|
2013-09-01 00:34:53 +02:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-13 04:08:56 +02:00
|
|
|
@Override
|
2014-05-26 01:11:58 +02:00
|
|
|
public void AddCommands()
|
2014-05-13 04:08:56 +02:00
|
|
|
{
|
2014-11-13 04:21:12 +01:00
|
|
|
addCommand(new GadgetToggle(this));
|
|
|
|
addCommand(new NewsCommand(this));
|
|
|
|
addCommand(new GameModeCommand(this));
|
2014-05-13 04:08:56 +02:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
@EventHandler(priority = EventPriority.HIGHEST)
|
|
|
|
public void reflectMotd(ServerListPingEvent event)
|
|
|
|
{
|
|
|
|
if (_shuttingDown)
|
|
|
|
{
|
|
|
|
event.setMotd("Restarting soon");
|
2014-10-16 07:27:09 +02:00
|
|
|
}
|
2013-09-07 02:43:45 +02:00
|
|
|
}
|
2014-05-30 22:34:55 +02:00
|
|
|
|
2013-12-16 04:32:51 +01:00
|
|
|
public boolean BumpDisabled(Entity ent)
|
|
|
|
{
|
|
|
|
if (ent == null)
|
|
|
|
return false;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-30 22:34:55 +02:00
|
|
|
if (ent instanceof Player)
|
2013-12-16 04:32:51 +01:00
|
|
|
{
|
2014-05-30 22:34:55 +02:00
|
|
|
return !_preferences.Get((Player)ent).HubGames;
|
2013-12-16 04:32:51 +01:00
|
|
|
}
|
2014-05-30 22:34:55 +02:00
|
|
|
|
|
|
|
return true;
|
2013-12-16 04:32:51 +01:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-07 09:33:24 +02:00
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void SnowballPickup(BlockDamageEvent event)
|
|
|
|
{
|
2014-10-15 06:44:26 +02:00
|
|
|
if (Type != HubType.Christmas)
|
2014-08-07 09:33:24 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (event.getBlock().getType() != Material.SNOW)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
|
|
|
_gadgetManager.RemoveItem(player);
|
|
|
|
|
|
|
|
player.getInventory().setItem(3, new ItemStack(Material.SNOW_BALL, 16));
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void SnowballHit(CustomDamageEvent event)
|
|
|
|
{
|
2014-10-15 06:44:26 +02:00
|
|
|
if (Type != HubType.Christmas)
|
2014-08-07 09:33:24 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
Projectile proj = event.GetProjectile();
|
|
|
|
if (proj == null) return;
|
|
|
|
|
|
|
|
if (!(proj instanceof Snowball))
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.SetCancelled("Snowball Cancel");
|
|
|
|
|
|
|
|
if (BumpDisabled(event.GetDamageeEntity()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (BumpDisabled(event.GetDamagerEntity(true)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
UtilAction.velocity(event.GetDamageeEntity(), UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity()),
|
|
|
|
0.4, false, 0, 0.2, 1, false);
|
|
|
|
|
|
|
|
//No Portal
|
|
|
|
SetPortalDelay(event.GetDamageeEntity());
|
|
|
|
}
|
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
@EventHandler
|
|
|
|
public void redirectStopCommand(PlayerCommandPreprocessEvent event)
|
|
|
|
{
|
|
|
|
if (event.getPlayer().isOp() && event.getMessage().equalsIgnoreCase("/stop"))
|
|
|
|
{
|
|
|
|
_shuttingDown = true;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
_portal.SendAllPlayers("Lobby");
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
Bukkit.shutdown();
|
|
|
|
}
|
|
|
|
}, 40L);
|
|
|
|
}
|
|
|
|
}, 60L);
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 02:43:45 +02:00
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-04 20:35:59 +02:00
|
|
|
@EventHandler
|
|
|
|
public void preventEggSpawn(ItemSpawnEvent event)
|
|
|
|
{
|
|
|
|
if (event.getEntity() instanceof Egg)
|
|
|
|
{
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-09-04 23:44:53 +02:00
|
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
|
|
public void OnChunkLoad(ChunkLoadEvent event)
|
|
|
|
{
|
|
|
|
for (Entity entity : event.getChunk().getEntities())
|
|
|
|
{
|
|
|
|
if (entity instanceof LivingEntity)
|
|
|
|
{
|
|
|
|
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
|
|
|
{
|
2014-08-23 07:40:07 +02:00
|
|
|
if (ChatColor.stripColor(((LivingEntity)entity).getCustomName()).equalsIgnoreCase("Block Hunt"))
|
2013-11-16 11:59:28 +01:00
|
|
|
{
|
|
|
|
DisguiseSlime disguise = new DisguiseSlime(entity);
|
2014-12-16 03:46:14 +01:00
|
|
|
disguise.setCustomNameVisible(true);
|
|
|
|
disguise.setName(((LivingEntity)entity).getCustomName(), null);
|
2013-11-16 11:59:28 +01:00
|
|
|
disguise.SetSize(2);
|
|
|
|
_disguiseManager.disguise(disguise);
|
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-02-28 10:18:32 +01:00
|
|
|
@EventHandler(priority = EventPriority.LOW)
|
|
|
|
public void login(final PlayerLoginEvent event)
|
|
|
|
{
|
|
|
|
CoreClient client = _clientManager.Get(event.getPlayer().getName());
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-02-28 10:18:32 +01:00
|
|
|
// Reserved Slot Check
|
2014-08-20 04:24:49 +02:00
|
|
|
if (Bukkit.getOnlinePlayers().size() - Bukkit.getServer().getMaxPlayers() >= 20)
|
2014-02-28 10:18:32 +01:00
|
|
|
{
|
2014-07-03 01:59:31 +02:00
|
|
|
if (!client.GetRank().Has(Rank.ULTRA))
|
2014-02-28 10:18:32 +01:00
|
|
|
{
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
_portal.SendPlayerToServer(event.getPlayer(), "Lobby");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
event.allow();
|
|
|
|
}
|
|
|
|
}
|
2014-07-30 06:11:07 +02:00
|
|
|
else
|
|
|
|
event.allow();
|
2014-02-28 10:18:32 +01:00
|
|
|
}
|
2013-09-04 23:44:53 +02:00
|
|
|
|
2014-08-20 02:39:41 +02:00
|
|
|
@EventHandler(priority = EventPriority.LOW)
|
|
|
|
public void AdminOP(PlayerJoinEvent event)
|
|
|
|
{
|
2014-08-29 10:21:08 +02:00
|
|
|
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
|
2014-08-20 02:39:41 +02:00
|
|
|
event.getPlayer().setOp(true);
|
|
|
|
else
|
|
|
|
event.getPlayer().setOp(false);
|
|
|
|
}
|
2014-08-22 23:50:07 +02:00
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void PlayerRespawn(PlayerRespawnEvent event)
|
|
|
|
{
|
2014-08-23 00:52:50 +02:00
|
|
|
event.setRespawnLocation(GetSpawn().add(0, 10, 0));
|
2014-08-22 23:50:07 +02:00
|
|
|
}
|
2014-08-20 02:39:41 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler(priority = EventPriority.LOW)
|
|
|
|
public void PlayerJoin(PlayerJoinEvent event)
|
|
|
|
{
|
2014-08-22 23:50:07 +02:00
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
2014-10-09 01:35:54 +02:00
|
|
|
//Player List
|
|
|
|
UtilTabTitle.setHeaderAndFooter(player, " ", "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop");
|
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
//Public Message
|
2014-12-16 06:18:09 +01:00
|
|
|
if (_clientManager.Get(player).GetRank() != Rank.OWNER)
|
|
|
|
event.setJoinMessage(null);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!");
|
|
|
|
UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true);
|
|
|
|
player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f);
|
|
|
|
}
|
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
|
|
|
|
//Teleport
|
2014-08-23 00:52:50 +02:00
|
|
|
player.teleport(GetSpawn().add(0, 10, 0));
|
2014-08-22 23:50:07 +02:00
|
|
|
|
|
|
|
//Survival
|
|
|
|
player.setGameMode(GameMode.SURVIVAL);
|
|
|
|
|
|
|
|
//Clear Inv
|
|
|
|
UtilInv.Clear(player);
|
|
|
|
|
|
|
|
//Allow Double Jump
|
|
|
|
player.setAllowFlight(true);
|
|
|
|
|
|
|
|
//Health
|
|
|
|
player.setHealth(20);
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
//Rules
|
|
|
|
player.getInventory().setItem(6, _ruleBook);
|
|
|
|
|
|
|
|
//Scoreboard
|
|
|
|
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
|
|
|
|
player.setScoreboard(board);
|
|
|
|
_scoreboards.put(player, board);
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
//Objective
|
|
|
|
Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy");
|
|
|
|
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
for (Rank rank : Rank.values())
|
|
|
|
{
|
|
|
|
if (rank != Rank.ALL)
|
|
|
|
board.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " ");
|
|
|
|
else
|
|
|
|
board.registerNewTeam(rank.Name).setPrefix("");
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
for (Player otherPlayer : Bukkit.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
if (_clientManager.Get(otherPlayer) == null)
|
|
|
|
continue;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
String rankName = _clientManager.Get(player).GetRank().Name;
|
|
|
|
String otherRankName = _clientManager.Get(otherPlayer).GetRank().Name;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
if (!_clientManager.Get(player).GetRank().Has(Rank.ULTRA) && _donationManager.Get(player.getName()).OwnsUltraPackage())
|
2013-09-10 02:17:55 +02:00
|
|
|
{
|
2014-08-22 23:50:07 +02:00
|
|
|
rankName = Rank.ULTRA.Name;
|
2013-09-10 02:17:55 +02:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
if (!_clientManager.Get(otherPlayer).GetRank().Has(Rank.ULTRA) && _donationManager.Get(otherPlayer.getName()).OwnsUltraPackage())
|
2013-09-10 02:17:55 +02:00
|
|
|
{
|
2014-08-22 23:50:07 +02:00
|
|
|
otherRankName = Rank.ULTRA.Name;
|
2013-09-10 02:17:55 +02:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-08-22 23:50:07 +02:00
|
|
|
//Add Other to Self
|
|
|
|
board.getTeam(otherRankName).addPlayer(otherPlayer);
|
|
|
|
|
|
|
|
//Add Self to Other
|
|
|
|
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
|
2013-09-23 22:30:40 +02:00
|
|
|
}
|
2014-08-22 23:50:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void PlayerDeath(PlayerDeathEvent event)
|
|
|
|
{
|
|
|
|
//XXX make this work > event.setKeepInventory(true);
|
|
|
|
event.getDrops().clear();
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler
|
|
|
|
public void PlayerQuit(PlayerQuitEvent event)
|
|
|
|
{
|
|
|
|
event.setQuitMessage(null);
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
event.getPlayer().leaveVehicle();
|
|
|
|
event.getPlayer().eject();
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
for (Player player : UtilServer.getPlayers())
|
2014-04-25 09:44:14 +02:00
|
|
|
player.getScoreboard().resetScores(event.getPlayer().getName());
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
_scoreboards.remove(event.getPlayer());
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-10-26 10:01:26 +02:00
|
|
|
_portalTime.remove(event.getPlayer().getName());
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler
|
|
|
|
public void PlayerChat(AsyncPlayerChatEvent event)
|
|
|
|
{
|
|
|
|
if (event.isCancelled())
|
|
|
|
return;
|
2014-08-08 09:05:11 +02:00
|
|
|
|
|
|
|
//Dont Let Chat Near Spawn!
|
2014-10-14 03:42:53 +02:00
|
|
|
if (UtilMath.offset2d(GetSpawn(), event.getPlayer().getLocation()) == 0 && !_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.HELPER))
|
2014-08-08 09:05:11 +02:00
|
|
|
{
|
|
|
|
UtilPlayer.message(event.getPlayer(), F.main("Chat", "You must leave spawn before you can chat!"));
|
|
|
|
event.setCancelled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
Player player = event.getPlayer();
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
Rank rank = GetClients().Get(player).GetRank();
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-10-17 09:37:57 +02:00
|
|
|
boolean ownsUltra = _donationManager.Get(player.getName()).OwnsUltraPackage();
|
|
|
|
|
2014-11-07 09:20:15 +01:00
|
|
|
//Level Prefix
|
2014-11-07 23:15:27 +01:00
|
|
|
String levelStr = _achievementManager.getMineplexLevel(player, rank);
|
2014-11-07 09:20:15 +01:00
|
|
|
|
2013-10-17 09:37:57 +02:00
|
|
|
//Rank Prefix
|
2013-08-27 17:14:08 +02:00
|
|
|
String rankStr = "";
|
|
|
|
if (rank != Rank.ALL)
|
2013-11-07 00:18:36 +01:00
|
|
|
rankStr = rank.GetTag(true, true) + " ";
|
2013-10-17 09:37:57 +02:00
|
|
|
|
|
|
|
if (ownsUltra && !rank.Has(Rank.ULTRA))
|
2013-11-07 00:18:36 +01:00
|
|
|
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
//Party Chat
|
|
|
|
if (event.getMessage().charAt(0) == '@')
|
|
|
|
{
|
|
|
|
Party party = _partyManager.GetParty(player);
|
|
|
|
if (party != null)
|
|
|
|
{
|
2014-04-29 21:53:22 +02:00
|
|
|
event.getRecipients().clear();
|
|
|
|
|
|
|
|
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
2014-11-07 09:20:15 +01:00
|
|
|
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
for (String name : party.GetPlayers())
|
|
|
|
{
|
|
|
|
Player other = UtilPlayer.searchExact(name);
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
if (other != null)
|
2014-05-26 01:11:58 +02:00
|
|
|
event.getRecipients().add(other);
|
2013-09-07 06:09:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UtilPlayer.message(player, F.main("Party", "You are not in a Party."));
|
2014-04-29 21:53:22 +02:00
|
|
|
event.setCancelled(true);
|
2013-09-07 06:09:12 +02:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
return;
|
|
|
|
}
|
2014-04-29 21:53:22 +02:00
|
|
|
else
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2014-04-29 21:53:22 +02:00
|
|
|
for (Player other : UtilServer.getPlayers())
|
|
|
|
{
|
|
|
|
if (_tutorialManager.InTutorial(other))
|
|
|
|
{
|
|
|
|
event.getRecipients().remove(other);
|
|
|
|
continue;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-04-29 21:53:22 +02:00
|
|
|
event.setMessage(event.getMessage());
|
2014-11-07 09:20:15 +01:00
|
|
|
event.setFormat(levelStr + rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
2014-04-29 21:53:22 +02:00
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler
|
|
|
|
public void Damage(EntityDamageEvent event)
|
|
|
|
{
|
2013-09-02 00:24:37 +02:00
|
|
|
if (event.getCause() == DamageCause.VOID)
|
|
|
|
if (event.getEntity() instanceof Player)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
|
|
|
event.getEntity().eject();
|
|
|
|
event.getEntity().leaveVehicle();
|
2013-09-02 00:24:37 +02:00
|
|
|
event.getEntity().teleport(GetSpawn());
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-02 00:24:37 +02:00
|
|
|
else
|
|
|
|
event.getEntity().remove();
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler
|
|
|
|
public void FoodHealthUpdate(UpdateEvent event)
|
|
|
|
{
|
2014-08-22 23:50:07 +02:00
|
|
|
if (event.getType() != UpdateType.SEC)
|
2013-08-27 17:14:08 +02:00
|
|
|
return;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
for (Player player : UtilServer.getPlayers())
|
|
|
|
{
|
|
|
|
player.setFoodLevel(20);
|
2014-08-22 23:50:07 +02:00
|
|
|
player.setExhaustion(0f);
|
|
|
|
player.setSaturation(3f);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-05 07:52:23 +02:00
|
|
|
|
2013-10-25 10:20:14 +02:00
|
|
|
@EventHandler
|
|
|
|
public void InventoryCancel(InventoryClickEvent event)
|
|
|
|
{
|
2013-11-22 23:17:00 +01:00
|
|
|
if (event.getWhoClicked() instanceof Player && ((Player)event.getWhoClicked()).getGameMode() != GameMode.CREATIVE)
|
|
|
|
event.setCancelled(true);
|
2013-10-25 10:20:14 +02:00
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@EventHandler
|
|
|
|
public void UpdateScoreboard(UpdateEvent event)
|
|
|
|
{
|
|
|
|
if (event.getType() != UpdateType.TICK)
|
|
|
|
return;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
_scoreboardTick = (_scoreboardTick + 1)%3;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
if (_scoreboardTick != 0)
|
|
|
|
return;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
int bestPig = 0;
|
|
|
|
for (Player player : UtilServer.getPlayers())
|
|
|
|
{
|
|
|
|
if (player.getVehicle() != null)
|
|
|
|
continue;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
int count = 0;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
Entity ent = player;
|
|
|
|
while (ent.getPassenger() != null)
|
|
|
|
{
|
|
|
|
ent = ent.getPassenger();
|
|
|
|
count++;
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
if (count > bestPig)
|
|
|
|
{
|
|
|
|
_pigStacker = player.getName();
|
|
|
|
bestPig = count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bestPig == 0)
|
|
|
|
{
|
|
|
|
_pigStacker = "0 - Nobody";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_pigStacker = bestPig + " - " + _pigStacker;
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
if (_pigStacker.length() > 16)
|
|
|
|
_pigStacker = _pigStacker.substring(0, 16);
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
for (Player player : UtilServer.getPlayers())
|
|
|
|
{
|
2013-09-07 06:09:12 +02:00
|
|
|
//Dont Waste Time
|
|
|
|
if (_partyManager.GetParty(player) != null)
|
|
|
|
continue;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-07 06:09:12 +02:00
|
|
|
//Return to Main Scoreboard
|
|
|
|
if (!player.getScoreboard().equals(_scoreboards.get(player)))
|
|
|
|
player.setScoreboard(_scoreboards.get(player));
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Objective
|
|
|
|
Objective obj = player.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Title
|
|
|
|
obj.setDisplayName(C.cWhite + C.Bold + Get(player).GetScoreboardText());
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
int line = 15;
|
2014-08-09 04:16:37 +02:00
|
|
|
|
|
|
|
//Stacker
|
|
|
|
obj.getScore(C.cAqua + C.Bold + "Stacker").setScore(line--);
|
|
|
|
player.getScoreboard().resetScores(Get(player).BestPig);
|
|
|
|
Get(player).BestPig = _pigStacker;
|
|
|
|
obj.getScore(Get(player).BestPig).setScore(line--);
|
|
|
|
|
|
|
|
//Space
|
|
|
|
obj.getScore(" ").setScore(line--);
|
|
|
|
|
|
|
|
//Gems
|
2014-04-25 09:44:14 +02:00
|
|
|
obj.getScore(C.cGreen + C.Bold + "Gems").setScore(line--);
|
2014-08-09 04:16:37 +02:00
|
|
|
// Remove Old/Add New
|
2014-04-25 09:44:14 +02:00
|
|
|
player.getScoreboard().resetScores(Get(player.getName()).GetLastGemCount() + "");
|
|
|
|
obj.getScore(GetDonation().Get(player.getName()).GetGems() + "").setScore(line--);
|
2013-08-27 17:14:08 +02:00
|
|
|
Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).GetGems());
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Space
|
2014-08-09 04:16:37 +02:00
|
|
|
obj.getScore(" ").setScore(line--);
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-08-09 04:16:37 +02:00
|
|
|
//Coins
|
2014-08-08 09:05:58 +02:00
|
|
|
obj.getScore(C.cYellow + C.Bold + "Coins").setScore(line--);
|
|
|
|
|
|
|
|
// Remove Old
|
|
|
|
player.getScoreboard().resetScores(Get(player.getName()).GetLastCoinCount() + "");
|
|
|
|
// Add New
|
|
|
|
obj.getScore(GetDonation().Get(player.getName()).getCoins() + "").setScore(line--);
|
|
|
|
|
|
|
|
Get(player.getName()).SetLastCoinCount(GetDonation().Get(player.getName()).getCoins());
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
//Space
|
2014-08-09 04:16:37 +02:00
|
|
|
obj.getScore(" ").setScore(line--);
|
|
|
|
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Display Rank
|
2014-08-09 04:16:37 +02:00
|
|
|
obj.getScore(C.cGold + C.Bold + "Rank").setScore(line--);
|
|
|
|
if (GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
|
|
|
obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--);
|
2014-08-09 16:09:39 +02:00
|
|
|
else if (GetDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") ||
|
|
|
|
GetDonation().Get(player.getName()).OwnsUnknownPackage("Survival Games ULTRA") ||
|
|
|
|
GetDonation().Get(player.getName()).OwnsUnknownPackage("Minigames ULTRA") ||
|
|
|
|
GetDonation().Get(player.getName()).OwnsUnknownPackage("CastleSiege ULTRA") ||
|
|
|
|
GetDonation().Get(player.getName()).OwnsUnknownPackage("Champions ULTRA"))
|
|
|
|
obj.getScore("Single Ultra").setScore(line--);
|
2013-08-27 17:14:08 +02:00
|
|
|
else
|
2014-08-09 04:16:37 +02:00
|
|
|
obj.getScore("No Rank").setScore(line--);
|
2014-08-09 16:09:39 +02:00
|
|
|
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Space
|
2014-08-09 04:16:37 +02:00
|
|
|
obj.getScore(" ").setScore(line--);
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Website
|
2014-08-09 04:16:37 +02:00
|
|
|
obj.getScore(C.cRed + C.Bold + "Website").setScore(line--);
|
2014-04-25 09:44:14 +02:00
|
|
|
obj.getScore("www.mineplex.com").setScore(line--);
|
|
|
|
obj.getScore("----------------").setScore(line--);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
@Override
|
2014-05-26 01:11:58 +02:00
|
|
|
protected HubClient AddPlayer(String player)
|
|
|
|
{
|
2013-08-27 17:14:08 +02:00
|
|
|
return new HubClient(player);
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-10-22 06:46:31 +02:00
|
|
|
public BlockRestore GetBlockRestore()
|
|
|
|
{
|
|
|
|
return _blockRestore;
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public CoreClientManager GetClients()
|
|
|
|
{
|
|
|
|
return _clientManager;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-10-19 07:52:15 +02:00
|
|
|
public ConditionManager GetCondition()
|
|
|
|
{
|
|
|
|
return _conditionManager;
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
public DonationManager GetDonation()
|
|
|
|
{
|
|
|
|
return _donationManager;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-10-25 10:20:14 +02:00
|
|
|
public DisguiseManager GetDisguise()
|
|
|
|
{
|
|
|
|
return _disguiseManager;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-12-21 10:05:42 +01:00
|
|
|
public GadgetManager GetGadget()
|
|
|
|
{
|
|
|
|
return _gadgetManager;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-12-21 10:05:42 +01:00
|
|
|
public MountManager GetMount()
|
|
|
|
{
|
|
|
|
return _mountManager;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
public ParkourManager GetParkour()
|
|
|
|
{
|
|
|
|
return _parkour;
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-05-30 22:34:55 +02:00
|
|
|
public PreferencesManager getPreferences()
|
|
|
|
{
|
|
|
|
return _preferences;
|
|
|
|
}
|
|
|
|
|
2013-08-31 10:19:23 +02:00
|
|
|
public Location GetSpawn()
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2013-08-31 10:19:23 +02:00
|
|
|
return _spawn.clone();
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
2014-12-17 06:31:51 +01:00
|
|
|
|
|
|
|
public PetManager getPetManager()
|
|
|
|
{
|
|
|
|
return _petManager;
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-05-26 01:11:58 +02:00
|
|
|
public TutorialManager GetTutorial()
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
2013-10-25 10:20:14 +02:00
|
|
|
return _tutorialManager;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2013-12-14 06:38:16 +01:00
|
|
|
public StatsManager GetStats()
|
|
|
|
{
|
|
|
|
return _statsManager;
|
|
|
|
}
|
2013-09-01 00:34:53 +02:00
|
|
|
|
2014-05-26 01:11:58 +02:00
|
|
|
public VisibilityManager GetVisibility()
|
2013-10-25 10:20:14 +02:00
|
|
|
{
|
|
|
|
return _visibilityManager;
|
2013-08-31 10:19:23 +02:00
|
|
|
}
|
2014-08-07 09:33:24 +02:00
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
|
|
public void gadgetCollide(GadgetCollideEntityEvent event)
|
|
|
|
{
|
|
|
|
if (!event.isCancelled())
|
|
|
|
SetPortalDelay(event.getOther());
|
|
|
|
}
|
2013-10-29 00:41:53 +01:00
|
|
|
|
|
|
|
public void SetPortalDelay(Entity ent)
|
|
|
|
{
|
|
|
|
if (ent instanceof Player)
|
|
|
|
_portalTime.put(((Player)ent).getName(), System.currentTimeMillis());
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean CanPortal(Player player)
|
|
|
|
{
|
|
|
|
//Riding
|
2013-12-23 10:16:53 +01:00
|
|
|
if (player.getVehicle() != null || player.getPassenger() != null)
|
2013-10-29 00:41:53 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
//Portal Delay
|
|
|
|
if (!_portalTime.containsKey(player.getName()))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return UtilTime.elapsed(_portalTime.get(player.getName()), 5000);
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-13 04:08:56 +02:00
|
|
|
public boolean CanBump(LivingEntity ent)
|
|
|
|
{
|
|
|
|
if (!(ent instanceof Player))
|
|
|
|
return true;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-13 04:08:56 +02:00
|
|
|
if (BumpDisabled(ent))
|
|
|
|
return false;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-30 22:34:55 +02:00
|
|
|
if (!getPreferences().Get((Player)ent).ShowPlayers)
|
2014-05-13 04:08:56 +02:00
|
|
|
return false;
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-13 04:08:56 +02:00
|
|
|
return true;
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-04-28 01:41:00 +02:00
|
|
|
@EventHandler
|
|
|
|
public void SkillTrigger(SkillTriggerEvent event)
|
|
|
|
{
|
|
|
|
event.SetCancelled(true);
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-04-28 01:41:00 +02:00
|
|
|
@EventHandler
|
|
|
|
public void ItemTrigger(ItemTriggerEvent event)
|
|
|
|
{
|
|
|
|
event.SetCancelled(true);
|
|
|
|
}
|
2014-05-26 01:11:58 +02:00
|
|
|
|
2014-05-13 04:08:56 +02:00
|
|
|
public boolean IsGadgetEnabled()
|
|
|
|
{
|
|
|
|
return _gadgetsEnabled;
|
|
|
|
}
|
|
|
|
|
2014-07-09 04:55:51 +02:00
|
|
|
|
|
|
|
public NewsManager GetNewsManager()
|
|
|
|
{
|
|
|
|
return _news;
|
|
|
|
}
|
2014-05-13 04:08:56 +02:00
|
|
|
|
2014-09-30 00:17:02 +02:00
|
|
|
@EventHandler
|
|
|
|
public void ignoreVelocity(PlayerVelocityEvent event)
|
|
|
|
{
|
|
|
|
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR) && _preferences.Get(event.getPlayer()).IgnoreVelocity)
|
|
|
|
{
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
}
|
2014-10-15 06:44:26 +02:00
|
|
|
|
|
|
|
public void ToggleGadget(Player caller)
|
|
|
|
{
|
|
|
|
_gadgetsEnabled = !_gadgetsEnabled;
|
|
|
|
|
|
|
|
if (!_gadgetsEnabled)
|
|
|
|
{
|
|
|
|
GetMount().DisableAll();
|
|
|
|
GetGadget().DisableAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Player player : UtilServer.getPlayers())
|
|
|
|
player.sendMessage(C.cWhite + C.Bold + "Gadgets/Mounts are now " + F.elem(_gadgetsEnabled ? C.cGreen + C.Bold + "Enabled" : C.cRed + C.Bold + "Disabled"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void GadgetActivate(GadgetActivateEvent event)
|
|
|
|
{
|
|
|
|
if (!_gadgetsEnabled)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void MountActivate(MountActivateEvent event)
|
|
|
|
{
|
|
|
|
if (!_gadgetsEnabled)
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
2014-11-05 01:26:39 +01:00
|
|
|
|
|
|
|
public void addGameMode(Player caller, Player target)
|
|
|
|
{
|
|
|
|
if (!_creativeAdmin.containsKey(caller.getName()))
|
|
|
|
_creativeAdmin.put(caller.getName(), new ArrayList<String>());
|
|
|
|
|
|
|
|
if (target.getGameMode() == GameMode.CREATIVE)
|
|
|
|
{
|
|
|
|
_creativeAdmin.get(caller.getName()).add(target.getName());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_creativeAdmin.get(caller.getName()).remove(target.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void clearGameMode(PlayerQuitEvent event)
|
|
|
|
{
|
|
|
|
ArrayList<String> creative = _creativeAdmin.remove(event.getPlayer().getName());
|
|
|
|
|
|
|
|
if (creative == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (String name : creative)
|
|
|
|
{
|
|
|
|
Player player = UtilPlayer.searchExact(name);
|
|
|
|
if (player == null)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
player.setGameMode(GameMode.SURVIVAL);
|
|
|
|
|
|
|
|
UtilPlayer.message(player, F.main("Game Mode", event.getPlayer().getName() + " left the game. Creative Mode: " + F.tf(false)));
|
|
|
|
}
|
|
|
|
}
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|