diff --git a/Plugins/Mineplex.ClansQueue.Common/pom.xml b/Plugins/Mineplex.ClansQueue.Common/pom.xml
index d468c56ca..10f7c455c 100644
--- a/Plugins/Mineplex.ClansQueue.Common/pom.xml
+++ b/Plugins/Mineplex.ClansQueue.Common/pom.xml
@@ -7,7 +7,7 @@
com.mineplex
mineplex-parent
dev-SNAPSHOT
- ../plugin.xml
+ ../pom.xml
ClansQueue-Common
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java
index 1cffc506a..63d4d1579 100644
--- a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java
@@ -1,5 +1,6 @@
package com.mineplex.clansqueue.common;
+import java.util.Comparator;
import java.util.LinkedList;
public class SortableLinkedList> extends LinkedList
@@ -8,6 +9,6 @@ public class SortableLinkedList> extends LinkedList
public void sort()
{
- sort((t1, t2) -> t1.compareTo(t2));
+ sort(Comparator.naturalOrder());
}
}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
index 434f771dd..418f78c59 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
@@ -30,7 +30,7 @@ public class UtilAlg
public static TreeSet sortSet(Collection toSort, Comparator comparator)
{
- TreeSet sortedSet = new TreeSet(comparator);
+ TreeSet sortedSet = new TreeSet<>(comparator);
sortedSet.addAll(toSort);
return sortedSet;
@@ -362,7 +362,7 @@ public class UtilAlg
return bestLoc;
}
- public static Location findClosest(Location mid, ArrayList locs)
+ public static Location findClosest(Location mid, List locs)
{
Location bestLoc = null;
double bestDist = 0;
@@ -381,7 +381,7 @@ public class UtilAlg
return bestLoc;
}
- public static Location findFurthest(Location mid, ArrayList locs)
+ public static Location findFurthest(Location mid, List locs)
{
Location bestLoc = null;
double bestDist = 0;
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
index 3dabf341d..154917256 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
@@ -43,8 +43,6 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
@@ -54,8 +52,8 @@ public class UtilEnt
public static final String FLAG_ENTITY_COMPONENT = "component";
//Custom Entity Names
- private static HashMap _nameMap = new HashMap();
- private static HashMap creatureMap = new HashMap();
+ private static HashMap _nameMap = new HashMap<>();
+ private static HashMap creatureMap = new HashMap<>();
private static Field _goalSelector;
private static Field _targetSelector;
@@ -293,19 +291,7 @@ public class UtilEnt
creature.setVegetated(true);
}
}
- catch (IllegalArgumentException e)
- {
- e.printStackTrace();
- }
- catch (IllegalAccessException e)
- {
- e.printStackTrace();
- }
- catch (NoSuchFieldException e)
- {
- e.printStackTrace();
- }
- catch (SecurityException e)
+ catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
e.printStackTrace();
}
@@ -574,7 +560,7 @@ public class UtilEnt
public static HashMap getInRadius(Location loc, double dR)
{
- HashMap ents = new HashMap();
+ HashMap ents = new HashMap<>();
for (Entity cur : loc.getWorld().getEntities())
{
@@ -588,7 +574,7 @@ public class UtilEnt
if (offset < dR)
{
- ents.put(ent, Double.valueOf(1 - (offset/dR)));
+ ents.put(ent, 1 - (offset / dR));
continue;
}
@@ -597,8 +583,7 @@ public class UtilEnt
if (offset < dR)
{
- ents.put(ent, Double.valueOf(1 - (offset/dR)));
- continue;
+ ents.put(ent, 1 - (offset / dR));
}
}
@@ -619,8 +604,7 @@ public class UtilEnt
if (offset < dR)
{
- ents.put(cur, Double.valueOf(1 - (offset/dR)));
- continue;
+ ents.put(cur, 1 - (offset / dR));
}
}
@@ -633,10 +617,7 @@ public class UtilEnt
{
if (disguise == EntityType.SQUID)
{
- if (UtilMath.offset(loc, ent.getLocation().add(0, 0.4, 0)) < 0.6 * mult)
- return true;
-
- return false;
+ return UtilMath.offset(loc, ent.getLocation().add(0, 0.4, 0)) < 0.6 * mult;
}
}
@@ -852,7 +833,7 @@ public class UtilEnt
ec.fakePitch = pitch;
ec.fakeYaw = yaw;
- EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.getWorld()).tracker.trackedEntities.get(ec.getId());
+ EntityTrackerEntry entry = ((WorldServer) ec.getWorld()).tracker.trackedEntities.get(ec.getId());
if (entry != null)
{
@@ -1042,12 +1023,6 @@ public class UtilEnt
entity.removeMetadata(key, UtilServer.getPlugin());
}
- public static void SetItemInHand(LivingEntity entity, ItemStack item)
- {
- EntityEquipment equipment = entity.getEquipment();
- equipment.setItemInHand(item);
- }
-
public static byte getEntityEggData(EntityType type)
{
switch (type)
@@ -1084,4 +1059,9 @@ public class UtilEnt
}
}
+ public static boolean isInWater(Entity entity)
+ {
+ return ((CraftEntity) entity).getHandle().inWater;
+ }
+
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
index 2a51b6a56..e09144aeb 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
@@ -7,7 +7,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -168,7 +167,6 @@ import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.morph.MorphWitch;
import mineplex.core.gadget.gadgets.morph.MorphWither;
import mineplex.core.gadget.gadgets.morph.managers.SoulManager;
-import mineplex.core.gadget.gadgets.morph.managers.SwimManager;
import mineplex.core.gadget.gadgets.morph.moba.MorphAnath;
import mineplex.core.gadget.gadgets.morph.moba.MorphBardolf;
import mineplex.core.gadget.gadgets.morph.moba.MorphBiff;
@@ -365,7 +363,7 @@ public class GadgetManager extends MiniPlugin
private final Map _lastMove = new HashMap<>();
private final Map> _playerActiveGadgetMap = new HashMap<>();
- private final HashSet _sets = new HashSet<>();
+ private final Set _sets = new HashSet<>();
private UserGadgetPersistence _userGadgetPersistence;
@@ -373,7 +371,8 @@ public class GadgetManager extends MiniPlugin
private int _activeItemSlot = 3;
private boolean _gadgetsEnabled = true;
- private Set _gadgetCollideWhitelist = new HashSet<>();
+ private final Set _gadgetCollideWhitelist = new HashSet<>();
+ private final Set _swimmingPlayers = new HashSet<>();
private GadgetManager()
{
@@ -1514,33 +1513,12 @@ public class GadgetManager extends MiniPlugin
@EventHandler
public void checkPlayerSwim(PlayerMoveEvent event)
{
- Material material = event.getPlayer().getLocation().getBlock().getType();
- UUID uuid = event.getPlayer().getUniqueId();
- if (material == Material.WATER || material == Material.STATIONARY_WATER)
+ Player player = event.getPlayer();
+ boolean inWater = UtilEnt.isInWater(player);
+
+ if (inWater && _swimmingPlayers.add(player) || !inWater && _swimmingPlayers.remove(player))
{
- if (!SwimManager.isSwimming(uuid))
- {
- SwimManager.addPlayer(uuid);
- SwimManager.removePlayerLava(uuid);
- Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true, false));
- }
- }
- else if (material == Material.LAVA || material == Material.STATIONARY_LAVA)
- {
- if (!SwimManager.isInLava(uuid))
- {
- SwimManager.addPlayerLava(uuid);
- SwimManager.removePlayer(uuid);
- Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true, false));
- }
- }
- else
- {
- if (SwimManager.isSwimming(uuid) || SwimManager.isInLava(uuid))
- {
- SwimManager.removeLavaAndWater(uuid);
- Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), false, false));
- }
+ UtilServer.CallEvent(new PlayerToggleSwimEvent(player, inWater));
}
}
@@ -1549,11 +1527,6 @@ public class GadgetManager extends MiniPlugin
return _soulManager;
}
- /**
- * Handles taunt commands
- *
- * @param event
- */
@EventHandler
public void onTauntCommand(TauntCommandEvent event)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java
index 49803ac80..2d5c5f00b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java
@@ -10,9 +10,9 @@ public class PlayerToggleSwimEvent extends Event
private static final HandlerList handlers = new HandlerList();
private Player _player;
- private boolean _swimming, _lava;
+ private boolean _swimming;
- public PlayerToggleSwimEvent(Player player, boolean swimming, boolean lava)
+ public PlayerToggleSwimEvent(Player player, boolean swimming)
{
_player = player;
_swimming = swimming;
@@ -28,11 +28,6 @@ public class PlayerToggleSwimEvent extends Event
return _swimming;
}
- public boolean isInLava()
- {
- return _lava;
- }
-
public HandlerList getHandlers()
{
return handlers;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java
index 1cb807f6e..b164fdfa1 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java
@@ -24,7 +24,6 @@ import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
-import mineplex.core.gadget.gadgets.morph.managers.SwimManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.OutfitGadget;
@@ -57,7 +56,6 @@ public class MorphSquid extends MorphGadget implements IThrown
applyArmor(player, message);
DisguiseSquid disguiseSquid = new DisguiseSquid(player);
UtilMorph.disguise(player, disguiseSquid, Manager);
- onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()), SwimManager.isInLava(player.getUniqueId())));
}
@Override
@@ -92,7 +90,9 @@ public class MorphSquid extends MorphGadget implements IThrown
public void onToggleSwim(PlayerToggleSwimEvent event)
{
if (!isActive(event.getPlayer()))
+ {
return;
+ }
if (event.isSwimming())
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java
deleted file mode 100644
index ab526bad0..000000000
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package mineplex.core.gadget.gadgets.morph.managers;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-public class SwimManager
-{
-
- private static List _swimming = new ArrayList<>();
- private static List _lava = new ArrayList<>();
-
- public static void addPlayer(UUID uuid)
- {
- _swimming.add(uuid);
- }
-
- public static void removePlayer(UUID uuid)
- {
- if (_swimming.contains(uuid))
- {
- _swimming.remove(uuid);
- }
- }
-
- public static void addPlayerLava(UUID uuid)
- {
- _lava.add(uuid);
- }
-
- public static void removePlayerLava(UUID uuid)
- {
- if (_lava.contains(uuid))
- {
- _lava.remove(uuid);
- }
- }
-
- public static void removeLavaAndWater(UUID uuid)
- {
- removePlayerLava(uuid);
- removePlayer(uuid);
- }
-
- public static boolean isSwimming(UUID uuid)
- {
- return _swimming.contains(uuid);
- }
-
- public static boolean isInLava(UUID uuid)
- {
- return _lava.contains(uuid);
- }
-
-}
diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java
index d1a8d0495..79eeb1d44 100644
--- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java
+++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java
@@ -51,7 +51,7 @@ public class ClansTransferManager extends MiniDbClientPlugin
ALLOW_HARDCORE,
}
- private static final int[] PERMITTED_VERSIONS = {ProtocolVersion.v1_8, ProtocolVersion.v1_12, ProtocolVersion.v1_12_1, ProtocolVersion.v1_12_2};
+ private static final int[] PERMITTED_VERSIONS = {ProtocolVersion.v1_8, ProtocolVersion.v1_12, ProtocolVersion.v1_12_1};
private static final Map VERSION_NAMES = new HashMap<>();
static
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
index bce02a9ed..50a72aba4 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
@@ -33,7 +33,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.achievement.AchievementManager;
-import mineplex.core.profile.ProfileManager;
import mineplex.core.antispam.AntiSpamManager;
import mineplex.core.benefit.BenefitManager;
import mineplex.core.blockrestore.BlockRestore;
@@ -76,6 +75,7 @@ import mineplex.core.portal.Intent;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.Preference;
import mineplex.core.preferences.PreferencesManager;
+import mineplex.core.profile.ProfileManager;
import mineplex.core.punish.Punish;
import mineplex.core.quests.QuestManager;
import mineplex.core.scoreboard.ScoreboardManager;
@@ -90,13 +90,11 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.youtube.YoutubeManager;
import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.doublejump.JumpManager;
-import mineplex.hub.plugin.HalloweenHubPlugin;
-import mineplex.hub.plugin.HubPlugin;
import mineplex.hub.gamemode.GameModeManager;
+import mineplex.hub.gimmicks.AdminPunch;
import mineplex.hub.hubgame.HubGameManager;
import mineplex.hub.modules.ForcefieldManager;
import mineplex.hub.modules.HubVisibilityManager;
-import mineplex.hub.modules.KothManager;
import mineplex.hub.modules.MavericksManager;
import mineplex.hub.modules.SoccerManager;
import mineplex.hub.modules.TemporaryGemHuntersServerSender;
@@ -104,7 +102,9 @@ import mineplex.hub.modules.salesannouncements.SalesAnnouncementManager;
import mineplex.hub.news.NewsManager;
import mineplex.hub.parkour.ParkourManager;
import mineplex.hub.player.HubPlayerManager;
+import mineplex.hub.plugin.HubPlugin;
import mineplex.hub.scoreboard.HubScoreboard;
+import mineplex.hub.world.HubPortalManager;
import mineplex.hub.world.HubWorldManager;
import mineplex.hub.world.WorldDataModule;
import mineplex.minecraft.game.core.combat.DeathMessageType;
@@ -187,7 +187,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess
new MavericksManager(_plugin, cosmeticManager, hologramManager, this);
new SoccerManager(this, _gadgetManager);
- //new KothManager(this, _gadgetManager);
new MenuManager(_plugin);
new NewInteractionsManager();
@@ -222,7 +221,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess
new TemporaryGemHuntersServerSender(_portal);
-
require(TabListSorter.class);
Managers.put(new HubScoreboard(_plugin, this), ScoreboardManager.class);
@@ -231,6 +229,8 @@ public class HubManager extends MiniClientPlugin implements IChatMess
require(HubGameManager.class);
require(ProfileManager.class);
require(HubPlayerManager.class);
+ require(AdminPunch.class);
+ require(HubPortalManager.class);
//_hubPlugin = new HalloweenHubPlugin();
_hubPlugin = new HubPlugin();
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gimmicks/AdminPunch.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gimmicks/AdminPunch.java
new file mode 100644
index 000000000..0f708fd00
--- /dev/null
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gimmicks/AdminPunch.java
@@ -0,0 +1,128 @@
+package mineplex.hub.gimmicks;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import net.minecraft.server.v1_8_R3.Entity;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Sound;
+import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.util.Vector;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.ReflectivelyCreateMiniPlugin;
+import mineplex.core.account.permissions.Permission;
+import mineplex.core.account.permissions.PermissionGroup;
+import mineplex.core.command.CommandBase;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilAction;
+import mineplex.core.common.util.UtilEvent;
+import mineplex.core.common.util.UtilEvent.ActionType;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilParticle.ParticleType;
+import mineplex.core.common.util.UtilParticle.ViewDist;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.recharge.Recharge;
+
+@ReflectivelyCreateMiniPlugin
+public class AdminPunch extends MiniPlugin
+{
+
+ public enum Perm implements Permission
+ {
+ PUNCH_COMMAND
+ }
+
+ private static final Vector UP = new Vector(0, 8, 0);
+
+ private final Set _active;
+
+ private AdminPunch()
+ {
+ super("Rocket Punch");
+
+ _active = new HashSet<>();
+
+ generatePermissions();
+
+ addCommand(new CommandBase(this, Perm.PUNCH_COMMAND, "mystery")
+ {
+ @Override
+ public void Execute(Player caller, String[] args)
+ {
+ toggleState(caller);
+ }
+ });
+ }
+
+ private void generatePermissions()
+ {
+ PermissionGroup.ADMIN.setPermission(Perm.PUNCH_COMMAND, true, true);
+ }
+
+ private void toggleState(Player player)
+ {
+ if (_active.remove(player))
+ {
+ player.sendMessage(F.main(_moduleName, "Disabled " + F.name(_moduleName) + "!"));
+ }
+ else
+ {
+ _active.add(player);
+ player.sendMessage(F.main(_moduleName, "Enabled " + F.name(_moduleName) + "!"));
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void entityDamage(PlayerInteractEvent event)
+ {
+ if (!UtilEvent.isAction(event, ActionType.L))
+ {
+ return;
+ }
+
+ Player player = event.getPlayer();
+
+ for (Player other : UtilPlayer.getNearby(player.getLocation(), 4))
+ {
+ if (player.equals(other))
+ {
+ continue;
+ }
+
+ punch(player, other);
+ }
+ }
+
+ private void punch(Player damager, Player damagee)
+ {
+ if (!_active.contains(damager) ||
+ !Recharge.Instance.use(damager, _moduleName, 100, false, false) ||
+ !Recharge.Instance.use(damager, _moduleName + damagee.getName(), 1000, false, false))
+ {
+ return;
+ }
+
+ Location location = damagee.getLocation().add(0, 1, 0);
+
+ UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
+ UtilParticle.PlayParticleToAll(ParticleType.LAVA, location, 5, 0.5F, 5, 0.1F, 20, ViewDist.LONG);
+ location.getWorld().playSound(location, Sound.EXPLODE, 3, 0.5F);
+
+ UtilAction.velocity(damagee, UP);
+ Bukkit.broadcastMessage(F.main(_moduleName, F.name(damager.getName()) + " punched " + F.name(damagee.getName()) + " into the air!"));
+ }
+
+ @EventHandler
+ public void playerQuit(PlayerQuitEvent event)
+ {
+ _active.remove(event.getPlayer());
+ }
+}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java
deleted file mode 100644
index fc29c38e8..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package mineplex.hub.mail;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import mineplex.core.MiniClientPlugin;
-import mineplex.core.common.util.Callback;
-import mineplex.hub.notification.NotificationManager;
-import mineplex.hub.notification.api.Notification;
-import mineplex.hub.notification.api.Notifier;
-
-public class MailManager extends MiniClientPlugin implements Notifier
-{
- private MailRepository _repository;
-
- public MailManager(JavaPlugin plugin, NotificationManager notificationManager)
- {
- super("Mail", plugin);
-
- _repository = new MailRepository(plugin, this);
-
- notificationManager.addNotifier(this);
- }
-
- @Override
- protected PlayerMailData addPlayer(UUID uuid)
- {
- return new PlayerMailData();
- }
-
- @EventHandler
- protected void loadPlayerData(final PlayerJoinEvent event)
- {
- runAsync(new Runnable()
- {
- @Override
- public void run()
- {
- Set(event.getPlayer(), _repository.loadMailData(event.getPlayer().getUniqueId()));
- }
- });
- }
-
- public void archive(final MailMessage message, final Callback callback)
- {
- if (message.isArchived())
- return;
-
- runAsync(new Runnable()
- {
- @Override
- public void run()
- {
- final boolean completed = _repository.archive(message);
- runSync(new Runnable()
- {
- @Override
- public void run()
- {
- callback.run(completed);
- }
- });
- }
- });
- }
-
- @Override
- public List extends Notification> getNotifications(Player player)
- {
- return Get(player).getUnreadMessages();
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java
deleted file mode 100644
index 46f3851b9..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package mineplex.hub.mail;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.event.inventory.InventoryClickEvent;
-
-import mineplex.core.common.util.C;
-import mineplex.core.common.util.Callback;
-import mineplex.core.common.util.UtilTime;
-import mineplex.hub.notification.api.Notification;
-import mineplex.hub.notification.api.NotificationPriority;
-
-public class MailMessage implements Notification
-{
- private MailManager _manager;
-
- private int _messageId;
- private String _sender;
- private String _message;
- private boolean _archived;
- private boolean _deleted;
- private Timestamp _timeSent;
-
- public MailMessage(MailManager manager, int messageId, String sender, String message, boolean archived, boolean deleted, Timestamp timeSent)
- {
- _manager = manager;
-
- _messageId = messageId;
- _sender = sender;
- _message = message;
- _archived = archived;
- _deleted = deleted;
- _timeSent = timeSent;
- }
-
- public int getMessageId()
- {
- return _messageId;
- }
-
- public void setMessageId(int messageId)
- {
- _messageId = messageId;
- }
-
- public String getSender()
- {
- return _sender;
- }
-
- public void setSender(String sender)
- {
- _sender = sender;
- }
-
- public String getMessage()
- {
- return _message;
- }
-
- public void setMessage(String message)
- {
- _message = message;
- }
-
- public boolean isArchived()
- {
- return _archived;
- }
-
- public void setArchived(boolean archived)
- {
- _archived = archived;
- }
-
- public boolean isDeleted()
- {
- return _deleted;
- }
-
- public void setDeleted(boolean deleted)
- {
- _deleted = deleted;
- }
-
- public Timestamp getTimeSent()
- {
- return _timeSent;
- }
-
- public void setTimeSent(Timestamp timeSent)
- {
- _timeSent = timeSent;
- }
-
- @Override
- public String getTitle()
- {
- return "Mail Message";
- }
-
- @Override
- public String[] getText()
- {
- ArrayList lines = new ArrayList();
-
- ArrayList message = formatMessage();
-
- long timeDifference = System.currentTimeMillis() - getTime();
-
-
- lines.add(ChatColor.RESET + C.cYellow + "From: " + C.cWhite + _sender);
- lines.add(ChatColor.RESET + C.cYellow + "Sent: " + C.cWhite + UtilTime.convertString(timeDifference, 0, UtilTime.TimeUnit.FIT) + " Ago");
- lines.add(" ");
- lines.addAll(message);
-
- return lines.toArray(new String[lines.size()]);
- }
-
- @Override
- public long getTime()
- {
- return _timeSent.getTime();
- }
-
- @Override
- public Material getMaterial()
- {
- return Material.PAPER;
- }
-
- @Override
- public byte getData()
- {
- return 0;
- }
-
- @Override
- public void clicked(final Player player, ClickType clickType)
- {
- if (clickType == ClickType.SHIFT_RIGHT)
- {
- _manager.archive(this, new Callback()
- {
- @Override
- public void run(Boolean data)
- {
- if (data)
- {
- player.playSound(player.getLocation(), Sound.SPLASH, 1, 0);
- }
- }
- });
- }
- }
-
- @Override
- public NotificationPriority getPriority()
- {
- return NotificationPriority.NORMAL;
- }
-
- private ArrayList formatMessage()
- {
- String mailMessage = ChatColor.translateAlternateColorCodes('&', _message); // Color the message
-
- ArrayList parts = new ArrayList();
- int breakIndex = 0;
- int charCount = 0;
-
- for (String s : mailMessage.split("\\\\n"))
- {
- for (int currIndex = 0; currIndex < s.length(); currIndex++)
- {
- charCount++;
- char c = s.charAt(currIndex);
-
- if ((charCount >= 36 && c == ' ') || c == '\n')
- {
- // New Line
- parts.add(ChatColor.RESET + s.substring(breakIndex, currIndex).trim());
- breakIndex = currIndex;
- charCount = 0;
- }
- }
- // Add final part
- parts.add(ChatColor.RESET + s.substring(breakIndex).trim());
- charCount = 0;
- breakIndex = 0;
- }
-
- return parts;
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java
deleted file mode 100644
index e4440d29c..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package mineplex.hub.mail;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.UUID;
-
-import mineplex.core.database.MinecraftRepository;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import mineplex.serverdata.database.DBPool;
-import mineplex.database.Tables;
-import mineplex.database.tables.records.MailRecord;
-import mineplex.serverdata.database.RepositoryBase;
-
-import org.jooq.DSLContext;
-import org.jooq.Result;
-import org.jooq.impl.DSL;
-
-public class MailRepository extends RepositoryBase
-{
- private MailManager _manager;
-
- public MailRepository(JavaPlugin plugin, MailManager manager)
- {
- super(DBPool.getAccount());
-
- _manager = manager;
- }
-
- public PlayerMailData loadMailData(ResultSet resultSet) throws SQLException
- {
- PlayerMailData data = new PlayerMailData();
-
-
- return data;
- }
-
- public PlayerMailData loadMailData(UUID uuid)
- {
- PlayerMailData data = new PlayerMailData();
-
- DSLContext context = DSL.using(getConnection());
-
- Result resultSet = context.selectFrom(Tables.mail).where(Tables.mail.accountId.eq(DSL.select(Tables.accounts.id)
- .from(Tables.accounts)
- .where(Tables.accounts.uuid.eq(uuid.toString())))
- ).and(Tables.mail.deleted.isFalse()).fetch();
-
- for (MailRecord record : resultSet)
- {
- data.getMessages().add(createMessage(record));
- }
-
- return data;
- }
-
- private MailMessage createMessage(MailRecord record)
- {
- return new MailMessage(_manager, record.getId(), record.getSender(), record.getMessage(), (record.getArchived() & 0x01) != 0, (record.getDeleted() & 0x01) != 0, record.getTimeSent());
- }
-
- public boolean archive(MailMessage mailMessage)
- {
- DSLContext context = DSL.using(getConnection());
-
- int recordsUpdated = context.update(Tables.mail).set(Tables.mail.archived, (byte) 1).where(Tables.mail.id.eq(mailMessage.getMessageId())).execute();
-
- return recordsUpdated == 1;
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/PlayerMailData.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/PlayerMailData.java
deleted file mode 100644
index 6a2501d11..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/PlayerMailData.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package mineplex.hub.mail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import mineplex.database.tables.records.MailRecord;
-
-public class PlayerMailData
-{
- private List _messages;
-
- public PlayerMailData()
- {
- _messages = new ArrayList();
- }
-
- public List getMessages()
- {
- return _messages;
- }
-
- public List getUnreadMessages()
- {
- ArrayList unreadMessages = new ArrayList();
-
- for (MailMessage message : _messages)
- {
- if (!(message.isArchived() || message.isDeleted()))
- unreadMessages.add(message);
- }
-
- return unreadMessages;
- }
- }
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java
deleted file mode 100644
index 59d45f63a..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package mineplex.hub.modules;
-
-import mineplex.core.MiniPlugin;
-import mineplex.core.common.util.C;
-import mineplex.core.common.util.F;
-import mineplex.core.common.util.UtilAction;
-import mineplex.core.common.util.UtilAlg;
-import mineplex.core.common.util.UtilPlayer;
-import mineplex.core.common.util.UtilServer;
-import mineplex.core.gadget.GadgetManager;
-import mineplex.core.gadget.event.GadgetEnableEvent;
-import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
-import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
-import mineplex.core.gadget.types.Gadget;
-import mineplex.core.gadget.types.GadgetType;
-import mineplex.core.recharge.Recharge;
-import mineplex.core.updater.UpdateType;
-import mineplex.core.updater.event.UpdateEvent;
-import mineplex.hub.HubManager;
-import mineplex.hub.modules.koth.CapturePoint;
-import org.bukkit.Color;
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.player.PlayerInteractEntityEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-
-public class KothManager extends MiniPlugin
-{
- public HubManager Manager;
-
- private HashSet _active = new HashSet();
-
- private ArrayList _teamArmor = new ArrayList();
- private ItemDuelingSword _kothSword;
-
- private Location _cornerPlayerA;
- private Location _cornerPlayerB;
-
- private Location _cornerHillA;
- private Location _cornerHillB;
-
- private CapturePoint _cp;
-
- Color _hillOwner = null;
- long _hillOwnTime = 0;
-
- public KothManager(HubManager manager, GadgetManager gadgets)
- {
- super("KOTH Manager", manager.getPlugin());
-
- Manager = manager;
-
- _cornerPlayerA = new Location(Manager.GetSpawn().getWorld(), -52.5, 0, -21.5);
- _cornerPlayerB = new Location(Manager.GetSpawn().getWorld(), -133.5, 197, 82.5);
-
- _cornerHillA = new Location(Manager.GetSpawn().getWorld(), -88.5, 57, 49.5);
- _cornerHillB = new Location(Manager.GetSpawn().getWorld(), -102.5, 77, 63.5);
-
- _cp = new CapturePoint(this, "Desert Pyramid", new Location(Manager.GetSpawn().getWorld(), -95.5, 69, 56.5));
-
- //Store Gadgets
- for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME))
- {
- if (gadget instanceof OutfitTeam)
- {
- _teamArmor.add((OutfitTeam)gadget);
- }
- }
-
- for (Gadget gadget : gadgets.getGadgets(GadgetType.ITEM))
- {
- if (gadget instanceof ItemDuelingSword)
- {
- _kothSword = (ItemDuelingSword)gadget;
- }
- }
- }
-
- @EventHandler
- public void cpUpdate(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- _cp.captureUpdate();
- }
-
- public Color getTeamColor(Player player)
- {
- //All peices are always same color!
- for (OutfitTeam outfit : _teamArmor)
- {
- if (outfit.isActive(player))
- return outfit.getTeamColor(player);
- }
-
- return null;
- }
-
- public boolean inPlayerArena(Entity entity)
- {
- if (!entity.getWorld().equals(_cornerPlayerA.getWorld()))
- {
- return false;
- }
-
- return UtilAlg.inBoundingBox(entity.getLocation(), _cornerPlayerA, _cornerPlayerB);
- }
-
- @EventHandler
- public void joinLeaveGame(UpdateEvent event)
- {
- if (event.getType() != UpdateType.TICK)
- return;
-
- for (Player player : UtilServer.getPlayers())
- {
- if (_active.contains(player))
- {
- if (!inPlayerArena(player))
- {
- setKOTHMode(player, false, null);
- continue;
- }
-
- //Took armor off
- Color color = getTeamColor(player);
- if (color == null)
- {
- setKOTHMode(player, false, null);
- }
- }
- else
- {
- if (inPlayerArena(player))
- {
- Color color = getTeamColor(player);
-
- //Join
- if (color != null)
- {
- setKOTHMode(player, true, color);
- continue;
- }
- //Eject
- else if (UtilAlg.inBoundingBox(player.getLocation(), _cornerHillA, _cornerHillB))
- {
- Location bounce = UtilAlg.getMidpoint(_cornerHillA, _cornerHillB);
- bounce.setY(Math.min(_cornerHillA.getY(), _cornerHillB.getY()));
-
- Entity bottom = player;
- if (bottom.getVehicle() != null)
- bottom = bottom.getVehicle();
-
- UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(bounce, player.getLocation()), 1.2, false, 0, 0.6, 1, true);
-
- if (Recharge.Instance.use(player, "KOTH Eject", 5000, false, false))
- {
- UtilPlayer.message(player, F.main("KOTH", "You must be wearing a Team Outfit."));
- UtilPlayer.message(player, F.main("KOTH", "Type " + F.elem("/team red|yellow|green|blue") + "!"));
- }
- }
- }
- }
- }
- }
-
- public void setKOTHMode(Player player, boolean enabled, Color color)
- {
- if (enabled)
- {
- _kothSword.enable(player);
-
- _active.add(player);
-
- if (color == null)
- UtilPlayer.message(player, F.main("KOTH", "You have entered " + F.elem("KOTH Mode") + "."));
- else if (color == Color.RED)
- UtilPlayer.message(player, F.main("KOTH", "You have joined " + F.elem(C.cRed + "Red KOTH Team") + "."));
- else if (color == Color.AQUA)
- UtilPlayer.message(player, F.main("KOTH", "You have joined " + F.elem(C.cAqua + "Blue KOTH Team") + "."));
- else if (color == Color.LIME)
- UtilPlayer.message(player, F.main("KOTH", "You have joined " + F.elem(C.cGreen + "Green KOTH Team") + "."));
- else if (color == Color.YELLOW)
- UtilPlayer.message(player, F.main("KOTH", "You have joined " + F.elem(C.cYellow + "Yellow KOTH Team") + "."));
-
- ArrayList outfit = new ArrayList();
- outfit.add("Team Helmet");
- outfit.add("Team Shirt");
- outfit.add("Team Pants");
- outfit.add("Team Boots");
- outfit.add("PvP Sword");
-
- Manager.GetGadget().disableAll(player, outfit);
- Manager.getPetManager().disableAll(player);
- }
- else
- {
- _kothSword.disable(player);
- _active.remove(player);
- UtilPlayer.message(player, F.main("KOTH", "You have exited " + F.elem("KOTH Mode") + "."));
- }
- }
-
- public boolean isKothMode(Player player)
- {
- return _active.contains(player);
- }
-
- @EventHandler
- public void disableGadgets(GadgetEnableEvent event)
- {
- if (isKothMode(event.getPlayer()))
- event.setCancelled(true);
- }
-
- @EventHandler(priority = EventPriority.LOWEST)
- public void disableStacker(PlayerInteractEntityEvent event)
- {
- if (_active.contains(event.getPlayer()))
- event.setCancelled(true);
- }
-
- @EventHandler
- public void playerQuit(PlayerQuitEvent event)
- {
- _active.remove(event.getPlayer());
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void allowDamage(EntityDamageByEntityEvent event)
- {
- if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player))
- return;
-
- Player damager = (Player)event.getDamager();
- Player damagee = (Player)event.getEntity();
-
- if (!_active.contains(damager) || !_active.contains(damagee))
- return;
-
- if (getTeamColor(damager) == null || getTeamColor(damagee) == null)
- return;
-
- if (getTeamColor(damager) == getTeamColor(damagee))
- return;
-
- event.setCancelled(false);
-
- event.setDamage(3.5);
- }
-
- public HashSet getActive()
- {
- return _active;
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/koth/CapturePoint.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/koth/CapturePoint.java
deleted file mode 100644
index 1a2177ce1..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/koth/CapturePoint.java
+++ /dev/null
@@ -1,389 +0,0 @@
-package mineplex.hub.modules.koth;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import mineplex.core.common.util.C;
-import mineplex.core.common.util.UtilFirework;
-import mineplex.core.common.util.UtilMath;
-import mineplex.core.common.util.UtilTime;
-import mineplex.core.common.util.UtilTextMiddle;
-import mineplex.hub.modules.KothManager;
-
-import org.bukkit.Color;
-import org.bukkit.Effect;
-import org.bukkit.FireworkEffect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.FireworkEffect.Type;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Player;
-
-public class CapturePoint
-{
- private KothManager Host;
-
- private String _name;
-
- //Locations
- private ArrayList _floor = new ArrayList();
- private ArrayList _indicators = new ArrayList();
- private Location _loc;
-
- //Capture
- private double _captureMax = 24;
- private double _captureRate = 1;
- private double _captureAmount = 0;
-
- private Color _owner = null;
- private boolean _captured = false;
-
- private ArrayList _captureFloor = new ArrayList();
- private long _decayDelay = 0;
-
- private int _indicatorTick = 0;
-
- public CapturePoint(KothManager host, String name, Location loc)
- {
- Host = host;
-
- _name = name;
-
- for (int x=-3 ; x<= 3 ; x++)
- {
- for (int z=-3 ; z<= 3 ; z++)
- {
- //Indicators
- if (Math.abs(x) == 3 && Math.abs(z) == 3)
- {
- Block ind = loc.getBlock().getRelative(x, 3, z);
- ind.setType(Material.WOOL);
- ind.setData((byte) 0);
- _indicators.add(ind);
- }
-
- //Floors
- if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
- {
- if (x != 0 || z != 0)
- {
- Block floor = loc.getBlock().getRelative(x, -2, z);
- floor.setType(Material.WOOL);
- floor.setData((byte) 0);
- _floor.add(floor);
- }
- else
- {
- Block block = loc.getBlock().getRelative(x, -2, z);
- block.setType(Material.BEACON);
- }
- }
-
- //Glass
- if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
- {
- Block block = loc.getBlock().getRelative(x, -1, z);
- block.setType(Material.STAINED_GLASS);
- block.setData((byte) 0);
- }
-
- //Iron
- if (Math.abs(x) <= 1 && Math.abs(z) <= 1)
- {
- Block block = loc.getBlock().getRelative(x, -3, z);
- block.setType(Material.IRON_BLOCK);
- }
- }
- }
-
- //Firework
- _loc = loc;
- }
-
- public void captureUpdate()
- {
- //Who's on the CP?
- ArrayList red = new ArrayList();
- ArrayList yellow = new ArrayList();
- ArrayList green = new ArrayList();
- ArrayList blue = new ArrayList();
-
- ArrayList players = new ArrayList();
-
- for (Player player : Host.getActive())
- {
- Color team = Host.getTeamColor(player);
-
- if (team == null)
- continue;
-
- if (Math.abs(_loc.getX() - player.getLocation().getX()) > 2.5)
- continue;
-
- if (Math.abs(_loc.getY() - player.getLocation().getY()) > 2.5)
- continue;
-
- if (Math.abs(_loc.getZ() - player.getLocation().getZ()) > 2.5)
- continue;
-
- if (team == Color.RED)
- {
- red.add(player);
- }
- else if (team == Color.YELLOW)
- {
- yellow.add(player);
- }
- else if (team == Color.LIME)
- {
- green.add(player);
- }
- else if (team == Color.AQUA)
- {
- blue.add(player);
- }
-
- players.add(player);
- }
-
- //No one around (DEGENERATE CAPTURE)
- if (players.isEmpty())
- {
- if (_captureAmount > 0)
- regenDegen();
-
- return;
- }
-
- //Capture
- if (red.size() > players.size() - red.size())
- capture(Color.RED, red.size() - (players.size() - red.size()), red);
-
- else if (yellow.size() > players.size() - yellow.size())
- capture(Color.YELLOW, yellow.size() - (players.size() - yellow.size()), yellow);
-
- else if (green.size() > players.size() - green.size())
- capture(Color.LIME, green.size() - (players.size() - green.size()), green);
-
- else if (blue.size() > players.size() - blue.size())
- capture(Color.AQUA, blue.size() - (players.size() - blue.size()), blue);
- }
-
- private void regenDegen()
- {
- if (!UtilTime.elapsed(_decayDelay, 1000))
- return;
-
- //Degen
- if (!_captured || Host.getActive().isEmpty())
- {
- _captureAmount = Math.max(0, (_captureAmount - (_captureRate*1)));
-
- //Floor Color
- while ((double)_captureFloor.size()/((double)_captureFloor.size() + (double)_floor.size()) > _captureAmount/_captureMax)
- {
- Block block = _captureFloor.remove(UtilMath.r(_captureFloor.size()));
-
- _floor.add(block);
-
- setWoolColor(block, null, false);
- }
-
- //Set Uncaptured
- if (_captureAmount == 0)
- {
- _owner = null;
-
- _loc.getBlock().getRelative(BlockFace.DOWN).setData((byte)0);
-
- //Indicators
- for (Block block : _indicators)
- {
- block.setData((byte)0);
- }
- }
-
- //Effect
- for (Block block : _indicators)
- block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 35);
- }
- //Regen
- else if (_captureAmount < _captureMax)
- {
- _captureAmount = Math.min(_captureMax, (_captureAmount + (_captureRate*1)));
-
- //Floor Color
- while ((double)_captureFloor.size()/((double)_captureFloor.size() + (double)_floor.size()) < _captureAmount/_captureMax)
- {
- Block block = _floor.remove(UtilMath.r(_floor.size()));
-
- _captureFloor.add(block);
-
- setWoolColor(block, _owner, false);
- }
-
- //Effect
- indicate(_owner);
- }
- }
-
- private void capture(Color team, int count, Collection capturers)
- {
- //Decay Delay
- _decayDelay = System.currentTimeMillis();
-
- //Count Up
- if (_owner != null && _owner.equals(team))
- {
- //Given if the other team hadnt actually captured it fully
- int bonus = 0;
- if (_captured)
- bonus = 1;
-
- _captureAmount = Math.min(_captureMax, (_captureAmount + ((_captureRate*count)+bonus)));
-
- //Floor Color
- while ((double)_captureFloor.size()/((double)_captureFloor.size() + (double)_floor.size()) < _captureAmount/_captureMax)
- {
- Block block = _floor.remove(UtilMath.r(_floor.size()));
-
- _captureFloor.add(block);
-
- setWoolColor(block, team, false);
- }
-
- //Set Fully Captured
- if (_captureAmount == _captureMax && !_captured)
- {
- _captured = true;
-
- //Firework
- UtilFirework.playFirework(_loc, FireworkEffect.builder().flicker(true).withColor(team).with(Type.BALL_LARGE).trail(true).build());
-
- //Indicators
- indicate(team);
-
- for (Block block : _indicators)
- {
- if (team == Color.RED)
- block.setData((byte) 14);
- else if (team == Color.YELLOW)
- block.setData((byte) 4);
- else if (team == Color.LIME)
- block.setData((byte) 5);
- else if (team == Color.AQUA)
- block.setData((byte) 3);
- }
-
- //Center
- setWoolColor(_loc.getBlock().getRelative(0, -2, 0), _owner, true);
-
- String teamName = C.cRed + "Red";
- if (team == Color.YELLOW) teamName = C.cYellow + "Yellow";
- if (team == Color.LIME) teamName = C.cGreen + "Green";
- if (team == Color.AQUA) teamName = C.cAqua + "Blue";
-
- for (Player player : Host.getActive())
- UtilTextMiddle.display("KOTH", teamName + " Team captured the Hill!", 0, 60, 10, player);
- }
- }
- //Count Down
- else
- {
- //Given if the other team hadnt actually captured it fully
- int bonus = 0;
- if (!_captured)
- bonus = 1;
-
- _captureAmount = Math.max(0, (_captureAmount - ((_captureRate*count)+bonus)));
-
- //Floor Color
- while ((double)_captureFloor.size()/((double)_captureFloor.size() + (double)_floor.size()) > _captureAmount/_captureMax)
- {
- Block block = _captureFloor.remove(UtilMath.r(_captureFloor.size()));
-
- _floor.add(block);
-
- setWoolColor(block, null, false);
- }
-
- //Set Uncaptured
- if (_captureAmount == 0)
- {
- _captured = false;
- _owner = team;
-
- //Center
- setWoolColor(_loc.getBlock().getRelative(0, -2, 0), null, true);
-
- //Indicators
- for (Block block : _indicators)
- {
- block.setData((byte)0);
- }
- }
- }
-
- if (_captureAmount != _captureMax)
- {
- indicate(team);
- }
-
- }
-
- private void setWoolColor(Block block, Color color, boolean glassOnly)
- {
- if (color == null)
- {
- if (!glassOnly)
- block.setData((byte)0);
-
- block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)0, true);
- }
- else if (color == Color.RED)
- {
- if (!glassOnly)
- block.setData((byte)14);
-
- block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)14, true);
- }
- else if (color == Color.YELLOW)
- {
- if (!glassOnly)
- block.setData((byte)4);
-
- block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)4, true);
- }
- else if (color == Color.LIME)
- {
- if (!glassOnly)
- block.setData((byte)5);
-
- block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)5, true);
- }
- else if (color == Color.AQUA)
- {
- if (!glassOnly)
- block.setData((byte)3);
-
- block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)3, true);
- }
- }
-
- private void indicate(Color color)
- {
- //Effect
- for (Block block : _indicators)
- {
- if (color == Color.RED)
- block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK);
- else if (color == Color.YELLOW)
- block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.GOLD_BLOCK);
- else if (color == Color.LIME)
- block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.EMERALD_BLOCK);
- else if (color == Color.AQUA)
- block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.DIAMOND_BLOCK);
- }
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/NotificationManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/NotificationManager.java
deleted file mode 100644
index 370a89ae9..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/NotificationManager.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package mineplex.hub.notification;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import mineplex.core.MiniPlugin;
-import mineplex.core.account.CoreClientManager;
-import mineplex.core.account.permissions.Permission;
-import mineplex.core.account.permissions.PermissionGroup;
-import mineplex.core.common.jsonchat.ClickEvent;
-import mineplex.core.common.jsonchat.Color;
-import mineplex.core.common.jsonchat.JsonMessage;
-import mineplex.core.donation.DonationManager;
-import mineplex.hub.notification.api.Notification;
-import mineplex.hub.notification.api.Notifier;
-import mineplex.hub.notification.command.NotificationCommand;
-import mineplex.hub.notification.gui.NotificationShop;
-
-public class NotificationManager extends MiniPlugin
-{
- public enum Perm implements Permission
- {
- NOTIFICATION_COMMAND,
- }
-
- private static NotificationComparator COMPARATOR = new NotificationComparator();
-
- private NotificationShop _shop;
- private CoreClientManager _clientManager;
- private List _notifiers;
-
- public NotificationManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
- {
- super("Notification", plugin);
-
- _notifiers = new ArrayList<>();
- _clientManager = clientManager;
- _shop = new NotificationShop(this, clientManager, donationManager);
-
- generatePermissions();
- }
-
- private void generatePermissions()
- {
-
- PermissionGroup.PLAYER.setPermission(Perm.NOTIFICATION_COMMAND, true, true);
- }
-
- @EventHandler
- public void onJoin(PlayerJoinEvent event)
- {
- final Player player = event.getPlayer();
-
- runSyncLater(new Runnable()
- {
- @Override
- public void run()
- {
- if (player.isOnline())
- {
- if (getNotifications(player).size() > 0)
- {
- JsonMessage message = new JsonMessage("You have unread notifications. Click here to read them!");
- message.color(Color.RED).click(ClickEvent.RUN_COMMAND, "/notifications");
- message.send(JsonMessage.MessageType.SYSTEM_MESSAGE, player);
- }
- }
- }
- }, 20 * 8);
- }
-
- public List getNotifications(Player player)
- {
- List notifications = new ArrayList();
-
- for (Notifier notifier : _notifiers)
- {
- notifications.addAll(notifier.getNotifications(player));
- }
-
- Collections.sort(notifications, COMPARATOR);
-
- return notifications;
- }
-
- public void addNotifier(Notifier notifier)
- {
- _notifiers.add(notifier);
- }
-
- public void clearNotifiers()
- {
- _notifiers.clear();
- }
-
- public void openShop(Player caller)
- {
- _shop.attemptShopOpen(caller);
- }
-
- @Override
- public void addCommands()
- {
- addCommand(new NotificationCommand(this));
- }
-
- private static class NotificationComparator implements Comparator
- {
- @Override
- public int compare(Notification n1, Notification n2)
- {
- if (n1.getPriority() == n2.getPriority())
- {
- return (int) (n1.getTime() - n2.getTime());
- }
- else
- {
- return n1.getPriority().ordinal() - n2.getPriority().ordinal();
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notification.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notification.java
deleted file mode 100644
index 5d12539b6..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notification.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package mineplex.hub.notification.api;
-
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.event.inventory.InventoryClickEvent;
-
-public interface Notification
-{
- public String getTitle();
-
- public String[] getText();
-
- public long getTime();
-
- public Material getMaterial();
-
- public byte getData();
-
- public void clicked(Player player, ClickType clickType);
-
- public NotificationPriority getPriority();
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/NotificationPriority.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/NotificationPriority.java
deleted file mode 100644
index 79ac9723b..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/NotificationPriority.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package mineplex.hub.notification.api;
-
-public enum NotificationPriority
-{
- HIGH, NORMAL, LOW;
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notifier.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notifier.java
deleted file mode 100644
index 51c61b235..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notifier.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package mineplex.hub.notification.api;
-
-import java.util.List;
-
-import org.bukkit.entity.Player;
-
-public interface Notifier
-{
- public List extends Notification> getNotifications(Player player);
-}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/command/NotificationCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/command/NotificationCommand.java
deleted file mode 100644
index faa7011ed..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/command/NotificationCommand.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package mineplex.hub.notification.command;
-
-import org.bukkit.entity.Player;
-
-import mineplex.core.command.CommandBase;
-import mineplex.hub.notification.NotificationManager;
-
-public class NotificationCommand extends CommandBase
-{
- public NotificationCommand(NotificationManager plugin)
- {
- super(plugin, NotificationManager.Perm.NOTIFICATION_COMMAND, "notifications");
- }
-
- @Override
- public void Execute(Player caller, String[] args)
- {
- Plugin.openShop(caller);
- }
-}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/NotificationShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/NotificationShop.java
deleted file mode 100644
index 018b26bdc..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/NotificationShop.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package mineplex.hub.notification.gui;
-
-import org.bukkit.entity.Player;
-
-import mineplex.core.account.CoreClientManager;
-import mineplex.core.donation.DonationManager;
-import mineplex.core.shop.ShopBase;
-import mineplex.core.shop.page.ShopPageBase;
-import mineplex.hub.notification.NotificationManager;
-import mineplex.hub.notification.gui.page.NotificationPage;
-
-public class NotificationShop extends ShopBase
-{
- public NotificationShop(NotificationManager plugin, CoreClientManager clientManager, DonationManager donationManager)
- {
- super(plugin, clientManager, donationManager, "Notifications");
- }
-
- @Override
- protected ShopPageBase> buildPagesFor(Player player)
- {
- return new NotificationPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/button/NotificationButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/button/NotificationButton.java
deleted file mode 100644
index 02a818d93..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/button/NotificationButton.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package mineplex.hub.notification.gui.button;
-
-import org.bukkit.Sound;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.event.inventory.InventoryClickEvent;
-
-import mineplex.core.common.util.Callback;
-import mineplex.core.shop.item.IButton;
-import mineplex.hub.mail.MailManager;
-import mineplex.hub.mail.MailMessage;
-import mineplex.hub.notification.NotificationManager;
-import mineplex.hub.notification.api.Notification;
-import mineplex.hub.notification.gui.page.NotificationPage;
-
-public class NotificationButton implements IButton
-{
- private NotificationManager _manager;
- private NotificationPage _page;
- private Notification _notification;
-
- private Player _player;
-
- public NotificationButton(NotificationManager manager, Player player, NotificationPage page, Notification notification)
- {
- _manager = manager;
- _page = page;
- _notification = notification;
- _player = player;
- }
-
- @Override
- public void onClick(Player player, ClickType clickType)
- {
- _notification.clicked(player, clickType);
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/page/NotificationPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/page/NotificationPage.java
deleted file mode 100644
index 9c2b12347..000000000
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/page/NotificationPage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package mineplex.hub.notification.gui.page;
-
-import java.util.List;
-
-import org.bukkit.entity.Player;
-
-import mineplex.core.account.CoreClientManager;
-import mineplex.core.donation.DonationManager;
-import mineplex.core.shop.item.ShopItem;
-import mineplex.core.shop.page.ShopPageBase;
-import mineplex.hub.notification.NotificationManager;
-import mineplex.hub.notification.api.Notification;
-import mineplex.hub.notification.gui.NotificationShop;
-import mineplex.hub.notification.gui.button.NotificationButton;
-
-public class NotificationPage extends ShopPageBase
-{
- public NotificationPage(NotificationManager plugin, NotificationShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
- {
- super(plugin, shop, clientManager, donationManager, "Notifications", player);
-
- refresh();
- }
-
- @Override
- protected void buildPage()
- {
- List notifications = getPlugin().getNotifications(getPlayer());
-
- for (int i = 0; i < notifications.size(); i++)
- {
- Notification message = notifications.get(i);
-
- ShopItem item = getItem(message);
-
- addButton(i, item, new NotificationButton(getPlugin(), getPlayer(), this, message));
- }
- }
-
- private ShopItem getItem(Notification notification)
- {
- return new ShopItem(notification.getMaterial(), notification.getData(), notification.getTitle(), notification.getTitle(), notification.getText(), 1, false, false);
- }
-}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubPortalManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubPortalManager.java
new file mode 100644
index 000000000..f0586334b
--- /dev/null
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubPortalManager.java
@@ -0,0 +1,98 @@
+package mineplex.hub.world;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.ReflectivelyCreateMiniPlugin;
+import mineplex.core.common.util.UtilAlg;
+import mineplex.core.common.util.UtilEnt;
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.newnpc.NPC;
+import mineplex.core.newnpc.NewNPCManager;
+import mineplex.core.newnpc.event.NPCInteractEvent;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.hub.HubManager;
+
+@ReflectivelyCreateMiniPlugin
+public class HubPortalManager extends MiniPlugin
+{
+
+ private static final int PORTAL_RANGE_SQUARED = 36;
+ private static final String GO_BACK_METADATA = "GO_BACK";
+
+ private final HubManager _manager;
+ private final WorldDataModule _worldData;
+ private final Map _portals;
+
+ private HubPortalManager()
+ {
+ super("Hub Portal");
+
+ _manager = require(HubManager.class);
+ _worldData = require(WorldDataModule.class);
+
+ _portals = new HashMap<>();
+
+ List lookAt = _worldData.getCustomLocation("LOOK AT");
+ _worldData.getAllCustomLocations().forEach((key, locations) ->
+ {
+ if (key.startsWith("PORTAL") && !key.endsWith("DESTINATION"))
+ {
+ Location portal = locations.get(0);
+ Location destination = _worldData.getCustomLocation(key + " DESTINATION").get(0);
+ destination.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(destination, UtilAlg.findClosest(destination, lookAt))));
+
+ _portals.put(portal, destination);
+ }
+ });
+
+ _worldData.getCustomLocation(String.valueOf(Material.LAPIS_ORE.getId())).forEach(location -> location.getBlock().setType(Material.WATER));
+
+ require(NewNPCManager.class).spawnNPCs("GO_BACK", NPC::getNameTag);
+ }
+
+ @EventHandler
+ public void updatePortals(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ {
+ return;
+ }
+
+ for (Player player : UtilServer.getPlayersCollection())
+ {
+ if (!UtilEnt.isInWater(player))
+ {
+ continue;
+ }
+
+ Location location = player.getLocation();
+
+ _portals.forEach((portal, destination) ->
+ {
+ if (UtilMath.offset2dSquared(portal, location) < PORTAL_RANGE_SQUARED)
+ {
+ player.teleport(destination);
+ }
+ });
+ }
+ }
+
+ @EventHandler
+ public void npcInteract(NPCInteractEvent event)
+ {
+ if (event.getNpc().getMetadata().equals(GO_BACK_METADATA))
+ {
+ event.getPlayer().teleport(_manager.GetSpawn());
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java
index 9a653c7a1..07f6270c6 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java
@@ -67,7 +67,7 @@ public class HubWorldManager extends MiniPlugin
_manager.GetSpawn().getWorld().setGameRuleValue("doDayNightCycle", "false");
- new HubChunkManager(_worldData, require(PacketHandler.class));
+ //new HubChunkManager(_worldData, require(PacketHandler.class));
}
/**