From eecf960613b85925bed90ab7123dd2105023736e Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 23 Sep 2017 03:40:21 -0400 Subject: [PATCH] Fixed Merge Conflicts --- .../mineplex/core/common/util/UtilPlayer.java | 32 ---- .../core/blockrestore/BlockRestore.java | 5 +- .../gadgets/morph/MorphChristmasKing.java | 7 +- .../gadgets/morph/MorphPumpkinKing.java | 13 +- .../wineffect/WinEffectBabyChicken.java | 34 +++-- .../gadgets/wineffect/WinEffectHalloween.java | 22 ++- .../core/gadget/types/WinEffectGadget.java | 23 ++- .../core/incognito/IncognitoManager.java | 18 ++- .../{Commands => commands}/SendCommand.java | 0 .../{Commands => commands}/ServerCommand.java | 0 .../texttutorial/TextTutorialManager.java | 22 ++- .../core/visibility/VisibilityData.java | 110 -------------- .../core/visibility/VisibilityManager.java | 141 ++++++++---------- .../src/mineplex/game/clans/Clans.java | 2 +- .../game/clans/clans/ClansManager.java | 26 +++- .../clans/worldevent/WorldEventManager.java | 26 +--- .../clans/worldevent/boss/BossWorldEvent.java | 5 + .../wither/challenge/five/ChallengeFive.java | 4 + .../raid/wither/challenge/five/IronGate.java | 2 + .../wither/challenge/four/ChallengeFour.java | 4 + .../raid/wither/challenge/four/FakeBlock.java | 4 + .../wither/challenge/one/ChallengeOne.java | 4 + .../challenge/seven/ChallengeSeven.java | 1 + .../wither/challenge/six/ChallengeSix.java | 4 + .../challenge/three/ChallengeThree.java | 5 + .../challenge/three/ChallengeTorch.java | 4 + .../wither/challenge/two/ChallengeTwo.java | 5 + .../src/mineplex/clanshub/ClansHub.java | 7 +- .../clanshub/HubVisibilityManager.java | 9 +- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 15 +- .../hub/modules/HubVisibilityManager.java | 17 ++- .../classcombat/Skill/Brute/DwarfToss.java | 36 +++-- .../game/classcombat/Skill/Skill.java | 6 +- .../game/core/condition/ConditionEffect.java | 11 +- .../game/core/condition/conditions/Cloak.java | 20 ++- .../src/nautilus/game/arcade/Arcade.java | 11 +- .../nautilus/game/arcade/game/GameTeam.java | 32 ++-- .../arcade/game/games/deathtag/DeathTag.java | 9 +- .../arcade/game/games/event/EventGame.java | 45 +----- .../games/halloween2016/Halloween2016.java | 26 ++-- .../arcade/game/games/hideseek/HideSeek.java | 4 +- .../arcade/game/games/milkcow/MilkCow.java | 4 +- .../games/survivalgames/SurvivalGames.java | 4 +- .../survivalgames/SurvivalGamesTeams.java | 8 +- .../games/zombiesurvival/ZombieSurvival.java | 8 +- .../arcade/gametutorial/GameTutorial.java | 64 ++++---- .../src/mineplex/mavericks/review/Hub.java | 2 +- .../src/mineplex/gemhunters/GemHunters.java | 2 +- .../gemhunters/death/DeathModule.java | 12 +- 49 files changed, 403 insertions(+), 472 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/portal/{Commands => commands}/SendCommand.java (100%) rename Plugins/Mineplex.Core/src/mineplex/core/portal/{Commands => commands}/ServerCommand.java (100%) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 87a38929b..a3f11841f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -133,38 +133,6 @@ public class UtilPlayer return entry.trackedPlayers.contains(ep); } - - public static void hideFrom(Player player, Collection players) { - players.stream().forEach(p->p.hidePlayer(player)); - } - - public static void showFor(Player player, Collection players) { - players.stream().forEach(p->p.hidePlayer(player)); - } - - public static void hideFromAll(Player player, Collection except) { - UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.hidePlayer(player)); - } - - public static void showForAll(Player player, Collection except) { - UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.showPlayer(player)); - } - - public static void hideFrom(Player player, Player...players) { - hideFrom(player, Arrays.asList(players)); - } - - public static void showFor(Player player, Player...players) { - showFor(player, Arrays.asList(players)); - } - - public static void hideFromAll(Player player, Player...players) { - hideFromAll(player, Arrays.asList(players)); - } - - public static void showForAll(Player player, Player...players) { - showForAll(player, Arrays.asList(players)); - } public static boolean is1_9(Player player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java index c2859d691..489aa0fcb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; +import java.util.Map; import java.util.Map.Entry; import org.bukkit.Effect; @@ -29,7 +30,7 @@ import mineplex.core.updater.event.UpdateEvent; @ReflectivelyCreateMiniPlugin public class BlockRestore extends MiniPlugin { - private HashMap _blocks = new HashMap(); + private Map _blocks = new HashMap<>(); private LinkedList _restoreMaps; private BlockRestore() @@ -266,7 +267,7 @@ public class BlockRestore extends MiniPlugin return null; } - public HashMap getBlocks() + public Map getBlocks() { return _blocks; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java index 24803972f..934ef1238 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java @@ -25,7 +25,6 @@ import mineplex.core.common.util.UtilMath; 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.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.gadget.GadgetManager; @@ -35,11 +34,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargeData; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.visibility.VisibilityManager; public class MorphChristmasKing extends MorphGadget { - private Map _snowball = new WeakHashMap(); + private Map _snowball = new WeakHashMap<>(); public MorphChristmasKing(GadgetManager manager) { @@ -69,9 +67,6 @@ public class MorphChristmasKing extends MorphGadget UtilMorph.disguise(player, disguise, Manager); player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); - - VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); - VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index c309fb7a4..c161f84ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -1,11 +1,10 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Random; -import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Item; @@ -15,8 +14,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.inventory.ItemStack; -import com.google.common.collect.Lists; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; @@ -26,7 +23,6 @@ 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.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseSkeleton; @@ -39,13 +35,13 @@ import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.visibility.VisibilityManager; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; public class MorphPumpkinKing extends MorphGadget implements IPacketHandler { private static final int CROWN_POINTS = 12; - private List _bombs = Lists.newArrayList(); + private List _bombs = new ArrayList<>(); public MorphPumpkinKing(GadgetManager manager) { @@ -75,9 +71,6 @@ public class MorphPumpkinKing extends MorphGadget implements IPacketHandler UtilMorph.disguise(player, disguise, Manager); player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); - - VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); - VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java index d7d20aa75..ddab0433d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java @@ -3,6 +3,7 @@ package mineplex.core.gadget.gadgets.wineffect; import java.util.*; import java.util.Map.Entry; +import mineplex.core.Managers; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -12,9 +13,12 @@ import mineplex.core.gadget.types.WinEffectGadget; import mineplex.core.hologram.Hologram; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_8_R3.PathfinderGoal; + +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -52,7 +56,7 @@ public class WinEffectBabyChicken extends WinEffectGadget _tick = 0; List circle = UtilShapes.getPointsInCircle(getBaseLocation(), _team.size(), 3); - for(int i = 0; i < _team.size(); i++) + for (int i = 0; i < _team.size(); i++) { Player p = _team.get(i); Location l = circle.get(i); @@ -72,8 +76,9 @@ public class WinEffectBabyChicken extends WinEffectGadget chicken.setCustomNameVisible(true); UtilEnt.removeGoalSelectors(chicken); - - UtilPlayer.hideFromAll(player); + + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.hidePlayer(pl, player, "Baby Chicken Win Effect")); return chicken; } @@ -87,11 +92,11 @@ public class WinEffectBabyChicken extends WinEffectGadget _tick++; - if(_tick < 20*2) + if (_tick < 20*2) { return; } - else if(_tick == 20*2) + else if (_tick == 20*2) { Location loc = _npc.getEntity().getBukkitEntity().getLocation(); @@ -100,7 +105,7 @@ public class WinEffectBabyChicken extends WinEffectGadget UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, loc.clone().add(0, 1, 0), 0.3f, 0.6f, 0.3f, 0.07f, 200, ViewDist.NORMAL); UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, loc.clone().add(0, 0.3, 0), 0.7f, 0.1f, 0.7f, 0.07f, 200, ViewDist.NORMAL); - for(int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) { Vector v = Vector.getRandom().subtract(Vector.getRandom()).multiply(0.25).setY(0.5); UtilItem.dropItem(new ItemStack(Material.EGG), loc, false, false, 8*20, false).setVelocity(v); @@ -142,24 +147,30 @@ public class WinEffectBabyChicken extends WinEffectGadget e.getKey().setLocation(e.getKey().getLocation().add(e.getValue())); } - for(Chicken c : _teamChickens) + for (Chicken c : _teamChickens) { UtilEnt.CreatureLook(c, _chicken); } - } @Override public void finish() { - UtilPlayer.showForAll(_player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> + { + vm.showPlayer(pl, _player, "Baby Chicken Win Effect"); + _team.forEach(p -> + { + vm.showPlayer(pl, p, "Baby Chicken Win Effect"); + }); + }); _text.keySet().forEach(h -> h.stop()); _text.clear(); _chicken.remove(); UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, _chicken.getLocation().add(0, 0.15, 0), 0.3f, 0.3f, 0.3f, 0.1f, 50, ViewDist.NORMAL); _chicken = null; _teamChickens.forEach(c -> c.remove()); - _team.forEach(p -> UtilPlayer.showForAll(p)); } @Override @@ -205,5 +216,4 @@ public class WinEffectBabyChicken extends WinEffectGadget _ent.getNavigation().a(loc.getX(), loc.getY(), loc.getZ(), _speed); } } - -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java index d40136327..ee4b91efa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java @@ -4,6 +4,7 @@ import java.awt.Color; import java.util.ArrayList; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -12,6 +13,7 @@ import org.bukkit.entity.Skeleton; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import mineplex.core.Managers; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; @@ -31,6 +33,7 @@ import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilVariant; +import mineplex.core.visibility.VisibilityManager; public class WinEffectHalloween extends WinEffectGadget { @@ -72,9 +75,13 @@ public class WinEffectHalloween extends WinEffectGadget @Override public void finish() { - UtilPlayer.showForAll(_player); - _team.forEach(p -> UtilPlayer.showForAll(p)); - _nonTeam.forEach(p -> UtilPlayer.showForAll(p)); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> + { + vm.showPlayer(pl, _player, "Halloween Win Effect"); + _team.forEach(p -> vm.showPlayer(pl, p, "Halloween Win Effect")); + _nonTeam.forEach(p -> vm.showPlayer(pl, p, "Halloween Win Effect")); + }); _disguisePlayers.forEach(d -> d.getEntity().getBukkitEntity().remove()); _disguisePlayers.clear(); } @@ -123,7 +130,8 @@ public class WinEffectHalloween extends WinEffectGadget _npc.getEntity().getBukkitEntity().remove(); spawnSkeleton(); spawnGhosts(); - UtilPlayer.hideFromAll(_player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.hidePlayer(pl, _player, "Halloween Win Effect")); _player.getWorld().playSound(getBaseLocation(), Sound.CAT_MEOW, .5f, .5f); } @@ -145,6 +153,7 @@ public class WinEffectHalloween extends WinEffectGadget { int i = 0; List circle = UtilShapes.getPointsInCircle(getBaseLocation(), _nonTeam.size(), 7); + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player player : _nonTeam) { ItemStack playerHead = UtilSkull.getPlayerHead(player.getName(), player.getName() + " skull", null); @@ -157,7 +166,7 @@ public class WinEffectHalloween extends WinEffectGadget DisguisePlayer disguisePlayer = getNPC(player, ghostLoc, SkinData.GHOST); disguisePlayer.setHelmet(playerHead); UtilEnt.CreatureLook(disguisePlayer.getEntity().getBukkitEntity(), getBaseLocation()); - UtilPlayer.hideFromAll(player); + Bukkit.getOnlinePlayers().forEach(pl -> vm.hidePlayer(pl, player, "Halloween Win Effect")); for (int j = 0; j < 5; j++) { playFirework(ghostLoc.clone().add(0, 1, 0), j, false); @@ -183,5 +192,4 @@ public class WinEffectHalloween extends WinEffectGadget babyFireworkEffect.setCount(6); babyFireworkEffect.start(); } - -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 046f74787..00bfdf3e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.GameMode; @@ -25,18 +26,19 @@ import org.bukkit.util.Vector; import com.mojang.authlib.GameProfile; import mineplex.core.account.permissions.PermissionGroup; +import mineplex.core.Managers; import mineplex.core.common.block.schematic.Schematic; import mineplex.core.common.block.schematic.UtilSchematic; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; /** * A wrapper for different win effects @@ -111,7 +113,12 @@ public abstract class WinEffectGadget extends Gadget } finally { - UtilServer.getPlayersCollection().forEach(UtilPlayer::showForAll); + VisibilityManager vm = Managers.require(VisibilityManager.class); + + Bukkit.getOnlinePlayers().forEach(p -> + { + Bukkit.getOnlinePlayers().forEach(pl -> vm.showPlayer(p, pl, "Inside Win Effect")); + }); _player = null; _baseLocation = null; _team.clear(); @@ -229,11 +236,15 @@ public abstract class WinEffectGadget extends Gadget { createBarriers(loc); - BukkitRunnable bRunnable = new BukkitRunnable() { + BukkitRunnable bRunnable = new BukkitRunnable() + { @Override - public void run() { - for(Player p : UtilServer.getPlayers()) { - UtilPlayer.hideFromAll(p); + public void run() + { + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (Player p : UtilServer.getPlayers()) + { + Bukkit.getOnlinePlayers().forEach(pl -> vm.hidePlayer(pl, p, "Inside Win Effect")); p.eject(); p.teleport(loc); p.setGameMode(GameMode.ADVENTURE); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java index 0654c5361..e023cc0ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java @@ -12,6 +12,7 @@ import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.Managers; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.permissions.Permission; @@ -28,6 +29,7 @@ import mineplex.core.packethandler.PacketHandler; import mineplex.core.preferences.PreferencesManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; public class IncognitoManager extends MiniDbClientPlugin { @@ -73,6 +75,8 @@ public class IncognitoManager extends MiniDbClientPlugin public boolean toggle(Player caller) { boolean enabled = !Get(caller).Status; + + VisibilityManager vm = Managers.require(VisibilityManager.class); IncognitoStatusChangeEvent event = UtilServer.CallEvent(new IncognitoStatusChangeEvent(caller, enabled)); @@ -89,7 +93,7 @@ public class IncognitoManager extends MiniDbClientPlugin { for (Player other : UtilServer.getPlayers()) { - other.showPlayer(caller); + vm.showPlayer(other, caller, "Incognito Mode"); } } } @@ -104,6 +108,8 @@ public class IncognitoManager extends MiniDbClientPlugin { Player player = event.getPlayer(); + VisibilityManager vm = Managers.require(VisibilityManager.class); + if (Get(event.getPlayer()).Status && !_clientManager.Get(event.getPlayer()).hasPermission(Perm.USE_INCOGNITO)) { Get(event.getPlayer()).Status = false; @@ -128,7 +134,7 @@ public class IncognitoManager extends MiniDbClientPlugin { if (customEvent != null && !customEvent.isCancelled() && !canSeeThroughIncognito(other, player)) { - other.hidePlayer(player); + vm.hidePlayer(other, player, "Incognito Mode"); } if (Get(other).Status) @@ -137,7 +143,7 @@ public class IncognitoManager extends MiniDbClientPlugin if (!customEvent2.isCancelled() && !canSeeThroughIncognito(player, other)) { - player.hidePlayer(other); + vm.hidePlayer(player, other, "Incognito Mode"); } } } @@ -151,6 +157,8 @@ public class IncognitoManager extends MiniDbClientPlugin return; } + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (Player player : UtilServer.getPlayers()) { for (Player other : UtilServer.getPlayers()) @@ -161,7 +169,7 @@ public class IncognitoManager extends MiniDbClientPlugin if (!customEvent.isCancelled() && !canSeeThroughIncognito(other, player)) { - other.hidePlayer(player); + vm.hidePlayer(other, player, "Incognito Mode"); } Get(player).Hidden = !customEvent.isCancelled(); @@ -177,7 +185,7 @@ public class IncognitoManager extends MiniDbClientPlugin if (!customEvent.isCancelled() && !canSeeThroughIncognito(player, other)) { - player.hidePlayer(other); + vm.hidePlayer(player, other, "Incognito Mode"); } Get(other).Hidden = !customEvent.isCancelled(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/SendCommand.java similarity index 100% rename from Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java rename to Plugins/Mineplex.Core/src/mineplex/core/portal/commands/SendCommand.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/commands/ServerCommand.java similarity index 100% rename from Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java rename to Plugins/Mineplex.Core/src/mineplex/core/portal/commands/ServerCommand.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java index 5a76c4021..bd5f230b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java @@ -15,6 +15,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; @@ -27,6 +28,7 @@ import mineplex.core.texttutorial.tutorial.Tutorial; import mineplex.core.texttutorial.tutorial.TutorialData; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; public class TextTutorialManager extends MiniPlugin { @@ -59,6 +61,7 @@ public class TextTutorialManager extends MiniPlugin if (!(event.getRightClicked() instanceof LivingEntity)) return; + VisibilityManager vm = Managers.require(VisibilityManager.class); LivingEntity ent = (LivingEntity)event.getRightClicked(); String name = ent.getCustomName(); @@ -74,7 +77,7 @@ public class TextTutorialManager extends MiniPlugin for (Player other : Bukkit.getOnlinePlayers()) { - other.hidePlayer(event.getPlayer()); + vm.hidePlayer(other, event.getPlayer(), "Core Text Tutorial"); } ((CraftPlayer) event.getPlayer()).getHandle().spectating = true; @@ -89,7 +92,9 @@ public class TextTutorialManager extends MiniPlugin { if (event.getType() != UpdateType.TICK) return; - + + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (final Tutorial tut : _tutorials) { Iterator iterator = tut.getTutorialDatas().iterator(); @@ -117,7 +122,7 @@ public class TextTutorialManager extends MiniPlugin for (Player other : Bukkit.getOnlinePlayers()) { - other.showPlayer(player); + vm.showPlayer(other, player, "Core Text Tutorial"); } ((CraftPlayer) player).getHandle().spectating = false; @@ -155,12 +160,13 @@ public class TextTutorialManager extends MiniPlugin public void hidePlayer(PlayerJoinEvent event) { Player player = event.getPlayer(); + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player other : Bukkit.getOnlinePlayers()) { if (isInTutorial(other)) { - player.hidePlayer(other); + vm.hidePlayer(player, other, "Core Text Tutorial"); } } } @@ -169,14 +175,18 @@ public class TextTutorialManager extends MiniPlugin public void playerQuit(PlayerQuitEvent event) { for (Tutorial tut : _tutorials) + { tut.stopTutorial(event.getPlayer()); + } } @EventHandler public void cancelInteract(PlayerInteractEvent event) { if (isInTutorial(event.getPlayer())) + { event.setCancelled(true); + } } public boolean isInTutorial(Player player) @@ -184,9 +194,11 @@ public class TextTutorialManager extends MiniPlugin for (Tutorial tutorial : _tutorials) { if (tutorial.isInTutorial(player)) + { return true; + } } return false; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java deleted file mode 100644 index 851a0b73c..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java +++ /dev/null @@ -1,110 +0,0 @@ -package mineplex.core.visibility; - -import java.util.Iterator; - -import mineplex.core.common.util.NautHashMap; -import mineplex.core.recharge.Recharge; -import mineplex.core.common.timing.TimingManager; - -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public class VisibilityData -{ - private NautHashMap _shouldHide = new NautHashMap(); - private NautHashMap _lastState = new NautHashMap(); - - public void updatePlayer(Player player, Player target, boolean hide) - { - TimingManager.stopTotal("VisData updatePlayer"); - - if (_lastState.containsKey(target) && _lastState.get(target) == hide) - { - //Already this state, do nothing - TimingManager.stopTotal("VisData updatePlayer"); - return; - } - - if (attemptToProcess(player, target, hide)) - { - //Clear old - _shouldHide.remove(target); - } - else - { - //Store - _shouldHide.put(target, hide); - } - - TimingManager.stopTotal("VisData updatePlayer"); - } - - //Process New - private boolean attemptToProcess(Player player, Player target, boolean hide) - { - TimingManager.startTotal("VisData attemptToProcess"); - - if (Recharge.Instance.use(player, "VIS " + target.getName(), 250, false, false)) - { - //Use craftplayer because i recall jon added something where - //it would still send the packet, even if the client thought it was already the state. - - if (hide) - { - TimingManager.startTotal("Hide Player"); - ((CraftPlayer)player).hidePlayer(target, true, true); - TimingManager.stopTotal("Hide Player"); - } - else - { - TimingManager.startTotal("Show Player"); - player.showPlayer(target); - TimingManager.stopTotal("Show Player"); - } - - _lastState.put(target, hide); - - TimingManager.stopTotal("VisData attemptToProcess"); - return true; - } - - TimingManager.stopTotal("VisData attemptToProcess"); - return false; - } - - //Process Update - public void attemptToProcessUpdate(Player player) - { - TimingManager.startTotal("VisData attemptToProcessUpdate shouldHide"); - if (!_shouldHide.isEmpty()) - { - for (Iterator targetIter = _shouldHide.keySet().iterator(); targetIter.hasNext();) - { - Player target = targetIter.next(); - boolean hide = _shouldHide.get(target); - - if (!target.isOnline() || !target.isValid() || attemptToProcess(player, target, hide)) - { - targetIter.remove(); - } - } - } - TimingManager.stopTotal("VisData attemptToProcessUpdate shouldHide"); - - - TimingManager.startTotal("VisData attemptToProcessUpdate lastState"); - if (!_lastState.isEmpty()) - { - for (Iterator targetIter = _lastState.keySet().iterator(); targetIter.hasNext();) - { - Player target = targetIter.next(); - - if (!target.isOnline() || !target.isValid()) - { - targetIter.remove(); - } - } - } - TimingManager.stopTotal("VisData attemptToProcessUpdate lastState"); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java index dfd21d10c..97850802e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java @@ -1,109 +1,86 @@ package mineplex.core.visibility; -import java.util.Iterator; - -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.timing.TimingManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; + +@ReflectivelyCreateMiniPlugin public class VisibilityManager extends MiniPlugin { - public static VisibilityManager Instance; - - private NautHashMap _data = new NautHashMap(); + private final Map>> _visibility = new HashMap<>(); - protected VisibilityManager(JavaPlugin plugin) + private VisibilityManager(JavaPlugin plugin) { super("Visibility Manager", plugin); } - - public static void Initialize(JavaPlugin plugin) + + public boolean canSee(Player viewer, Player target) { - Instance = new VisibilityManager(plugin); + return _visibility.get(viewer).getOrDefault(target, new HashSet<>()).isEmpty(); } - public VisibilityData getDataFor(Player player) + public void refreshVisibility(Player viewer, Player target) { - if (!_data.containsKey(player)) - _data.put(player, new VisibilityData()); - - return _data.get(player); - } - - public void setVisibility(Player target, boolean isVisible, Player... viewers) - { - TimingManager.startTotal("VisMan SetVis"); - - for (Player player : viewers) + if (canSee(viewer, target)) { - if (player.equals(target)) - continue; - - getDataFor(player).updatePlayer(player, target, !isVisible); + viewer.showPlayer(target); } - - TimingManager.stopTotal("VisMan SetVis"); - } - - public void refreshPlayerToAll(Player player) - { - setVisibility(player, false, UtilServer.getPlayers()); - setVisibility(player, true, UtilServer.getPlayers()); - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - TimingManager.startTotal("VisMan Update"); - - Iterator playerIter = _data.keySet().iterator(); - - while (playerIter.hasNext()) + else { - Player player = playerIter.next(); - - if (!player.isOnline() || !player.isValid()) - { - playerIter.remove(); - continue; - } - - _data.get(player).attemptToProcessUpdate(player); + viewer.hidePlayer(target); } - - TimingManager.stopTotal("VisMan Update"); } - @EventHandler - public void quit(PlayerQuitEvent event) + public void hidePlayer(Player viewer, Player target, String reason) { - _data.remove(event.getPlayer()); - } - - //@EventHandler DISABLED - public void updateDebug(UpdateEvent event) - { - if (event.getType() != UpdateType.MIN_01) + Set reasons = _visibility.get(viewer).computeIfAbsent(target, (p) -> new HashSet<>()); + if (reasons.contains(reason)) + { return; - - TimingManager.endTotal("VisMan update", true); - TimingManager.endTotal("VisMan setVis", true); - TimingManager.endTotal("VisData attemptToProcess", true); - TimingManager.endTotal("VisData updatePlayer", true); - TimingManager.endTotal("VisData attemptToProcessUpdate shouldHide", true); - TimingManager.endTotal("VisData attemptToProcessUpdate lastState", true); - TimingManager.endTotal("Hide Player", true); - TimingManager.endTotal("Show Player", true); + } + reasons.add(reason); + refreshVisibility(viewer, target); } -} + + public void showPlayer(Player viewer, Player target, String reason) + { + Set reasons = _visibility.get(viewer).get(target); + if (reasons == null) + { + return; + } + boolean modified = reasons.remove(reason); + if (reasons.isEmpty()) + { + _visibility.get(viewer).remove(target); + } + if (modified) + { + refreshVisibility(viewer, target); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onJoin(PlayerJoinEvent event) + { + _visibility.put(event.getPlayer(), new HashMap<>()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onQuit(PlayerQuitEvent event) + { + _visibility.remove(event.getPlayer()); + _visibility.values().forEach(v -> v.remove(event.getPlayer())); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index b67c40b58..735dbb62b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -116,7 +116,7 @@ public class Clans extends JavaPlugin DelayedTask.Initialize(this); Recharge.Initialize(this); - VisibilityManager.Initialize(this); + require(VisibilityManager.class); // new ProfileCacheManager(this); _donationManager = require(DonationManager.class); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 24963f615..4f6b92576 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -301,7 +301,7 @@ public class ClansManager extends MiniClientPlugin implements IRelat _damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition); _condition.setDamageManager(_damageManager); - _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null); + _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions); _taskManager = new TaskManager(plugin, _clientManager); @@ -361,15 +361,26 @@ public class ClansManager extends MiniClientPlugin implements IRelat skillManager.RemoveSkill("Dwarf Toss", "Block Toss"); skillManager.removeSkill("Whirlwind Axe"); skillManager.removeSkill("Shield Smash"); - skillManager.removeSkill("Illusion"); - skillManager.removeSkill("Smoke Bomb"); - // Check if any Ice Prison blocks will be placed inside a safe zone + // Check if any Ice Prison blocks will be placed inside a safe zone or world event // fixme Is there any way of checking the destination beforehand? // Although if the user is trying to launch an Ice Prison into a safezone they should know better skillManager.GetSkill("Ice Prison").setLocationFilter(location -> { - ClanTerritory territory = _clanUtility.getClaim(location); - return territory == null || !territory.Safe; + { + ClanTerritory territory = _clanUtility.getClaim(location); + if (territory != null && territory.Safe) + { + return false; + } + } + { + if (_worldEvent.isInEvent(location)) + { + return false; + } + } + + return true; }); registerEvents(new Listener() { @@ -389,12 +400,13 @@ public class ClansManager extends MiniClientPlugin implements IRelat { Condition poisonShock = _condition.GetActiveCondition(event.GetDamageePlayer(), Condition.ConditionType.POISON_SHOCK); if (poisonShock != null) + { event.SetIgnoreArmor(true); + } } } }); - _worldEvent.setFactory(skillManager); _classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory); // Register redis based server commands diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java index 3a2c44f2e..d2cb35f2d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java @@ -33,8 +33,6 @@ import mineplex.game.clans.clans.worldevent.api.WorldEvent; import mineplex.game.clans.clans.worldevent.boss.BossArenaLocationFinder; import mineplex.game.clans.clans.worldevent.command.WorldEventCommand; import mineplex.game.clans.clans.worldevent.raid.RaidManager; -import mineplex.minecraft.game.classcombat.Skill.SkillFactory; -import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.core.damage.DamageManager; public class WorldEventManager extends MiniPlugin implements ScoreboardElement @@ -56,13 +54,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement private LootManager _lootManager; private BlockRestore _blockRestore; - private SkillFactory _skillFactory; - private long _nextEventStart; private RaidManager _raidManager; - public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions, SkillFactory skillFactory) + public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions) { super("World Event", plugin); @@ -75,8 +71,6 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement _blockRestore = blockRestore; _runningEvents = new LinkedList<>(); - _skillFactory = skillFactory; - new Blood(plugin); _raidManager = new RaidManager(plugin); @@ -119,18 +113,6 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement return false; } - @EventHandler - public void onIcePrison(SkillTriggerEvent event) - { - if (event.GetSkillName().equalsIgnoreCase("Ice Prison")) - { - if (isInEvent(event.GetPlayer().getLocation())) - { - event.SetCancelled(true); - } - } - } - @EventHandler public void update(UpdateEvent event) { @@ -332,12 +314,6 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement return _runningEvents; } - /** I know this is a bad work around... sorry */ - public void setFactory(SkillFactory skillManager) - { - _skillFactory = skillManager; - } - public DisguiseManager getDisguiseManager() { return getClans().getDisguiseManager(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/boss/BossWorldEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/boss/BossWorldEvent.java index 817850ac7..c401d86b2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/boss/BossWorldEvent.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/boss/BossWorldEvent.java @@ -26,6 +26,7 @@ import mineplex.game.clans.clans.worldevent.api.EventCreatureDeathEvent; import mineplex.game.clans.clans.worldevent.api.EventState; import mineplex.game.clans.clans.worldevent.api.WorldEvent; import mineplex.minecraft.game.classcombat.Skill.ISkill; +import mineplex.minecraft.game.classcombat.Skill.Assassin.Blink; import mineplex.minecraft.game.classcombat.Skill.Assassin.Recall; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; @@ -85,6 +86,10 @@ public abstract class BossWorldEvent> extends WorldEv { ((Recall)skill).Reset(player); } + if (skill instanceof Blink) + { + ((Blink)skill).Reset(player); + } } sendMessage(player, "You have teleported inside the arena!"); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java index b77f231be..e5ee9975b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java @@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.api.EventCreatureDeathEvent; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; @@ -98,8 +99,11 @@ public class ChallengeFive extends RaidChallenge UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "You made it!")); player.teleport(_altar); }); + ClansManager.getInstance().getBlockRestore().restore(getRaid().getWorldData().getCustomLocs("GATE_THREE").get(0).getBlock().getRelative(BlockFace.DOWN)); getRaid().getWorldData().getCustomLocs("GATE_THREE").get(0).getBlock().getRelative(BlockFace.DOWN).setType(Material.OBSIDIAN); Block gate = getRaid().getWorldData().getCustomLocs("GATE_FOUR").get(0).getBlock(); + ClansManager.getInstance().getBlockRestore().restore(gate); + ClansManager.getInstance().getBlockRestore().restore(gate.getRelative(BlockFace.DOWN)); gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java index b0a0964d5..5b42168bf 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java @@ -6,6 +6,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.api.EventCreature; public class IronGate @@ -39,6 +40,7 @@ public class IronGate for (int z = minZ; z <= maxZ; z++) { Block block = _challenge.getRaid().getWorldData().World.getBlockAt(x, y, z); + ClansManager.getInstance().getBlockRestore().restore(block); if (block.getType() == Material.IRON_FENCE) { block.setType(Material.AIR); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java index bfb9cb879..8a0459faa 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java @@ -18,6 +18,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; @@ -69,8 +70,11 @@ public class ChallengeFour extends RaidChallenge UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Excellent jumping!")); player.teleport(_altar); }); + ClansManager.getInstance().getBlockRestore().restore(getRaid().getWorldData().getCustomLocs("GATE_TWO").get(0).getBlock().getRelative(BlockFace.DOWN)); getRaid().getWorldData().getCustomLocs("GATE_TWO").get(0).getBlock().getRelative(BlockFace.DOWN).setType(Material.OBSIDIAN); Block gate = getRaid().getWorldData().getCustomLocs("GATE_THREE").get(0).getBlock(); + ClansManager.getInstance().getBlockRestore().restore(gate); + ClansManager.getInstance().getBlockRestore().restore(gate.getRelative(BlockFace.DOWN)); gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java index 55793d72d..a14a2abce 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java @@ -5,6 +5,8 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; +import mineplex.game.clans.clans.ClansManager; + public class FakeBlock { private ChallengeFour _challenge; @@ -24,6 +26,7 @@ public class FakeBlock { if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).equals(_block)) { + ClansManager.getInstance().getBlockRestore().restore(_block); _block.setType(Material.AIR); aired = true; break; @@ -32,6 +35,7 @@ public class FakeBlock if (!aired) { + ClansManager.getInstance().getBlockRestore().restore(_block); _block.setType(Material.NETHER_BRICK); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java index 57c1fa0af..0447604d9 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; @@ -45,6 +46,7 @@ public class ChallengeOne extends RaidChallenge for (int z = minZ; z <= maxZ; z++) { Block block = getRaid().getWorldData().World.getBlockAt(x, y, z); + ClansManager.getInstance().getBlockRestore().restore(block); block.setType(Material.NETHER_BRICK); } } @@ -56,7 +58,9 @@ public class ChallengeOne extends RaidChallenge for (Location loc : getRaid().getWorldData().getCustomLocs("C_ONE_SBT")) { Block b = loc.getBlock(); + ClansManager.getInstance().getBlockRestore().restore(b); b.setType(Material.SMOOTH_BRICK); + ClansManager.getInstance().getBlockRestore().restore(b.getRelative(BlockFace.UP)); b.getRelative(BlockFace.UP).setType(Material.SMOOTH_BRICK); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java index 193a2fb37..40bc48f44 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java @@ -105,6 +105,7 @@ public class ChallengeSeven extends RaidChallenge mainFactory.setSuffix(ConqueringAttribute.class); } _altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), mainFactory.fabricate()); + ClansManager.getInstance().getBlockRestore().restore(getRaid().getWorldData().getCustomLocs("GATE_FIVE").get(0).getBlock().getRelative(BlockFace.DOWN)); getRaid().getWorldData().getCustomLocs("GATE_FIVE").get(0).getBlock().getRelative(BlockFace.DOWN).setType(Material.OBSIDIAN); getRaid().setForceEnd(System.currentTimeMillis() + UtilTime.convert(2, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/six/ChallengeSix.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/six/ChallengeSix.java index 46d3526b3..2face28db 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/six/ChallengeSix.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/six/ChallengeSix.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.api.EventCreatureDeathEvent; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; @@ -53,8 +54,11 @@ public class ChallengeSix extends RaidChallenge UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Your final battle awaits!")); player.teleport(_altar); }); + ClansManager.getInstance().getBlockRestore().restore(getRaid().getWorldData().getCustomLocs("GATE_FOUR").get(0).getBlock().getRelative(BlockFace.DOWN)); getRaid().getWorldData().getCustomLocs("GATE_FOUR").get(0).getBlock().getRelative(BlockFace.DOWN).setType(Material.OBSIDIAN); Block gate = getRaid().getWorldData().getCustomLocs("GATE_FIVE").get(0).getBlock(); + ClansManager.getInstance().getBlockRestore().restore(gate); + ClansManager.getInstance().getBlockRestore().restore(gate.getRelative(BlockFace.DOWN)); gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java index 260e59321..a0f6d289c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java @@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; import mineplex.game.clans.clans.worldevent.raid.wither.creature.archer.DecayingArcher; @@ -55,6 +56,7 @@ public class ChallengeThree extends RaidChallenge { for (Location loc : getRaid().getWorldData().getCustomLocs("C_THREE_TORCH")) { + ClansManager.getInstance().getBlockRestore().restore(loc.getBlock()); loc.getBlock().setType(Material.NETHERRACK); _torches.add(new ChallengeTorch(this, loc.getBlock())); } @@ -70,8 +72,11 @@ public class ChallengeThree extends RaidChallenge UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "The Torches are lit!")); player.teleport(_altar); }); + ClansManager.getInstance().getBlockRestore().restore(getRaid().getWorldData().getCustomLocs("GATE_ONE").get(0).getBlock().getRelative(BlockFace.DOWN)); getRaid().getWorldData().getCustomLocs("GATE_ONE").get(0).getBlock().getRelative(BlockFace.DOWN).setType(Material.OBSIDIAN); Block gate = getRaid().getWorldData().getCustomLocs("GATE_TWO").get(0).getBlock(); + ClansManager.getInstance().getBlockRestore().restore(gate); + ClansManager.getInstance().getBlockRestore().restore(gate.getRelative(BlockFace.DOWN)); gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java index 90b6e0a4e..5426cf44b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java @@ -4,6 +4,8 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import mineplex.game.clans.clans.ClansManager; + public class ChallengeTorch { private ChallengeThree _challenge; @@ -23,6 +25,7 @@ public class ChallengeTorch { _challenge.LitTorches++; _extinguish = System.currentTimeMillis() + 3000; + ClansManager.getInstance().getBlockRestore().restore(_block.getRelative(BlockFace.UP)); _block.getRelative(BlockFace.UP).setType(Material.FIRE); } } @@ -35,6 +38,7 @@ public class ChallengeTorch { _extinguish = -1; _challenge.LitTorches--; + ClansManager.getInstance().getBlockRestore().restore(_block.getRelative(BlockFace.UP)); _block.getRelative(BlockFace.UP).setType(Material.AIR); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/two/ChallengeTwo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/two/ChallengeTwo.java index a18665263..3c205ff53 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/two/ChallengeTwo.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/two/ChallengeTwo.java @@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.worldevent.api.EventCreatureDeathEvent; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; @@ -31,7 +32,9 @@ public class ChallengeTwo extends RaidChallenge for (Location loc : getRaid().getWorldData().getCustomLocs("C_ONE_SBT")) { Block b = loc.getBlock(); + ClansManager.getInstance().getBlockRestore().restore(b); b.setType(Material.AIR); + ClansManager.getInstance().getBlockRestore().restore(b.getRelative(BlockFace.UP)); b.getRelative(BlockFace.UP).setType(Material.AIR); getRaid().registerCreature(new UndeadKnight(this, loc)); } @@ -53,6 +56,8 @@ public class ChallengeTwo extends RaidChallenge { getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "The Undead Mage has fallen!"))); Block gate = getRaid().getWorldData().getCustomLocs("GATE_ONE").get(0).getBlock(); + ClansManager.getInstance().getBlockRestore().restore(gate); + ClansManager.getInstance().getBlockRestore().restore(gate.getRelative(BlockFace.DOWN)); gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java index df7dd09c4..e44595555 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java @@ -1,5 +1,7 @@ package mineplex.clanshub; +import static mineplex.core.Managers.require; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.plugin.java.JavaPlugin; @@ -66,8 +68,6 @@ import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; -import static mineplex.core.Managers.require; - /** * Main class for clans hub */ @@ -99,7 +99,8 @@ public class ClansHub extends JavaPlugin // new ProfileCacheManager(this); ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); - VisibilityManager.Initialize(this); Give.Initialize(this); + require(VisibilityManager.class); + Give.Initialize(this); Punish punish = new Punish(this, clientManager); BlockRestore blockRestore = require(BlockRestore.class); DonationManager donationManager = require(DonationManager.class); diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubVisibilityManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubVisibilityManager.java index 33e33f7bb..3946b8367 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubVisibilityManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubVisibilityManager.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.PermissionGroup; @@ -74,7 +75,9 @@ public class HubVisibilityManager extends MiniPlugin { if (event.getType() != UpdateType.SEC) return; - + + VisibilityManager vm = Managers.get(VisibilityManager.class); + for (Player player : UtilServer.getPlayers()) { boolean hideMe = UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || @@ -92,11 +95,11 @@ public class HubVisibilityManager extends MiniPlugin if (localHideMe || !Manager.getPreferences().get(other).isActive(Preference.SHOW_PLAYERS)) { - VisibilityManager.Instance.setVisibility(player, false, other); + vm.hidePlayer(other, player, "Hub Visibility Manager"); } else { - VisibilityManager.Instance.setVisibility(player, true, other); + vm.showPlayer(other, player, "Hub Visibility Manager"); } } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 6f3a344b2..c4c9d6238 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -1,5 +1,12 @@ package mineplex.hub; +import static mineplex.core.Managers.require; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + import mineplex.core.CustomTagFix; import mineplex.core.PacketsInteractionFix; import mineplex.core.TwitchIntegrationFix; @@ -84,12 +91,6 @@ import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import static mineplex.core.Managers.require; public class Hub extends JavaPlugin implements IRelation { @@ -117,7 +118,7 @@ public class Hub extends JavaPlugin implements IRelation // new ProfileCacheManager(this); ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); - VisibilityManager.Initialize(this); + require(VisibilityManager.class); Give.Initialize(this); Punish punish = new Punish(this, clientManager); BlockRestore blockRestore = require(BlockRestore.class); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java index b96bef681..7df9da325 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java @@ -12,6 +12,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; @@ -97,8 +98,17 @@ public class HubVisibilityManager extends MiniPlugin // Has preference AND is not close to the spawn AND has not just spawned boolean showOthers = Manager.getPreferences().get(perspective).isActive(Preference.SHOW_PLAYERS) && (!closeToSpawn || !justSpawned); - - VisibilityManager.Instance.setVisibility(subject, !hideMe && showOthers, perspective); + + VisibilityManager vm = Managers.get(VisibilityManager.class); + + if (!hideMe && showOthers) + { + vm.showPlayer(perspective, subject, "Hub Visibility Manager"); + } + else + { + vm.hidePlayer(perspective, subject, "Hub Visibility Manager"); + } } } } @@ -113,6 +123,7 @@ public class HubVisibilityManager extends MiniPlugin Player[] online = UtilServer.getPlayers(); Iterator iterator = _nextShownPlayer.keySet().iterator(); + VisibilityManager vm = Managers.get(VisibilityManager.class); while (iterator.hasNext()) { @@ -129,7 +140,7 @@ public class HubVisibilityManager extends MiniPlugin if (!perspective.equals(subject) && !shouldHide(subject)) { - VisibilityManager.Instance.setVisibility(subject, true, perspective); + vm.showPlayer(perspective, subject, "Hub Visibility Manager"); } _nextShownPlayer.put(perspective, ++index); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java index 1ce818b5f..0c32d0503 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java @@ -4,35 +4,32 @@ import java.util.HashSet; import org.bukkit.Bukkit; import org.bukkit.EntityEffect; -import org.bukkit.GameMode; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; import org.spigotmc.event.entity.EntityDismountEvent; -import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.Managers; import mineplex.core.common.util.F; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.core.visibility.VisibilityManager; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class DwarfToss extends SkillActive { @@ -225,7 +222,9 @@ public class DwarfToss extends SkillActive //Hide! if (target instanceof Player) - VisibilityManager.Instance.setVisibility((Player)target, false, player); + { + Managers.require(VisibilityManager.class).hidePlayer(player, (Player) target, "Dwarf Toss Pickup"); + } //Event UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target)); @@ -310,6 +309,8 @@ public class DwarfToss extends SkillActive } } + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (Player cur : voidSet) { LivingEntity target = _holding.remove(cur); @@ -319,7 +320,9 @@ public class DwarfToss extends SkillActive //Show! if (target instanceof Player) - VisibilityManager.Instance.setVisibility((Player)target, true, cur); + { + vm.showPlayer(cur, (Player) target, "Dwarf Toss Pickup"); + } } for (final Player cur : throwSet) @@ -336,7 +339,9 @@ public class DwarfToss extends SkillActive //Show! if (target instanceof Player) - VisibilityManager.Instance.setVisibility((Player)target, true, cur); + { + vm.showPlayer(cur, (Player) target, "Dwarf Toss Pickup"); + } //Throw cur.eject(); @@ -374,6 +379,7 @@ public class DwarfToss extends SkillActive player.eject(); player.leaveVehicle(); + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player cur : _holding.keySet()) { @@ -386,11 +392,13 @@ public class DwarfToss extends SkillActive //Show! if (target instanceof Player) - VisibilityManager.Instance.setVisibility((Player)target, true, cur); + { + vm.showPlayer(cur, (Player) target, "Dwarf Toss Pickup"); + } } } _holding.remove(player); _time.remove(player); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java index 8288495b2..b43e1c6b1 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java @@ -362,12 +362,12 @@ public abstract class Skill implements ISkill, Listener @Override public void setLocationFilter(LocationFilter filter) { - this._locationFilter = filter; + _locationFilter = filter; } @Override public LocationFilter getLocationFilter() { - return this._locationFilter; + return _locationFilter; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java index 427680a56..31e2f9466 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java @@ -2,6 +2,7 @@ package mineplex.minecraft.game.core.condition; import java.util.Iterator; +import mineplex.core.Managers; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; @@ -73,6 +74,8 @@ public class ConditionEffect implements Listener { if (event.getType() != UpdateType.FAST) return; + + VisibilityManager vm = Managers.require(VisibilityManager.class); for (LivingEntity ent : Manager.GetActiveConditions().keySet()) { @@ -84,17 +87,17 @@ public class ConditionEffect implements Listener //Hide if (Manager.IsCloaked(ent)) { - for (Player other : Bukkit.getServer().getOnlinePlayers()) + for (Player other : Bukkit.getOnlinePlayers()) { - VisibilityManager.Instance.setVisibility(player, false, other); + vm.hidePlayer(other, player, "Cloaking"); } } //Show else { - for (Player other : Bukkit.getServer().getOnlinePlayers()) + for (Player other : Bukkit.getOnlinePlayers()) { - VisibilityManager.Instance.setVisibility(player, true, other); + vm.showPlayer(other, player, "Cloaking"); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java index b0d233bb2..1fcb252f0 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/conditions/Cloak.java @@ -1,19 +1,19 @@ package mineplex.minecraft.game.core.condition.conditions; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import mineplex.core.common.util.UtilServer; +import mineplex.core.Managers; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.ConditionManager; public class Cloak extends Condition { - public Cloak(ConditionManager manager, String reason, LivingEntity ent, LivingEntity source, ConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, @@ -32,7 +32,12 @@ public class Cloak extends Condition if (!(_ent instanceof Player)) return; - VisibilityManager.Instance.setVisibility((Player)_ent, false, UtilServer.getPlayers()); + VisibilityManager vm = Managers.require(VisibilityManager.class); + + Bukkit.getOnlinePlayers().forEach(player -> + { + vm.hidePlayer(player, (Player)_ent, "Cloaking " + _reason); + }); for (Entity ent : _ent.getWorld().getEntities()) { @@ -53,6 +58,11 @@ public class Cloak extends Condition { super.Remove(); - VisibilityManager.Instance.setVisibility((Player)_ent, true, UtilServer.getPlayers()); + VisibilityManager vm = Managers.require(VisibilityManager.class); + + Bukkit.getOnlinePlayers().forEach(player -> + { + vm.showPlayer(player, (Player)_ent, "Cloaking " + _reason); + }); } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 1fa7bc592..d5080a829 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -1,11 +1,10 @@ package nautilus.game.arcade; +import static mineplex.core.Managers.require; + import java.io.File; import java.util.HashMap; -import mineplex.core.imagemap.CustomItemFrames; -import net.minecraft.server.v1_8_R3.MinecraftServer; - import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -49,6 +48,7 @@ import mineplex.core.give.Give; import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; +import mineplex.core.imagemap.CustomItemFrames; import mineplex.core.incognito.IncognitoManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; @@ -81,11 +81,10 @@ import mineplex.core.visibility.VisibilityManager; import mineplex.core.website.WebsiteLinkManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; - import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameServerConfig; -import static mineplex.core.Managers.require; +import net.minecraft.server.v1_8_R3.MinecraftServer; public class Arcade extends JavaPlugin { @@ -141,7 +140,7 @@ public class Arcade extends JavaPlugin ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); - VisibilityManager.Initialize(this); + require(VisibilityManager.class); Give.Initialize(this); // Publish our server status now, to give us more time to start up diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 3849c5354..b9a593248 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -1,5 +1,19 @@ package nautilus.game.arcade.game; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.concurrent.atomic.AtomicLong; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.entity.Creature; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -9,17 +23,6 @@ import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.gametutorial.GameTutorial; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.entity.Creature; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.concurrent.atomic.AtomicLong; public class GameTeam { @@ -182,8 +185,9 @@ public class GameTeam _players.put(player, in ? PlayerState.IN : PlayerState.OUT); UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + getDisplayName() + " Team.")); - - VisibilityManager.Instance.refreshPlayerToAll(player); + + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); } public void DisbandTeam() @@ -476,4 +480,4 @@ public class GameTeam { return this._teamId; } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index f2d1cc1d3..486b62291 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.deathtag; +import mineplex.core.Managers; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; @@ -24,6 +25,8 @@ import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.stats.ComeAtMeBroStatTracker; + +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -277,7 +280,8 @@ public class DeathTag extends SoloGame newKit.ApplyKit(player); //Refresh - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); if (forced) { @@ -316,7 +320,8 @@ public class DeathTag extends SoloGame GetKit(player).ApplyKit(player); //Refresh on Spawn - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); } }, 0); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 1e1151c1a..09d6ff6bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.event; +import mineplex.core.Managers; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; import mineplex.core.disguise.disguises.*; @@ -216,7 +217,8 @@ public class EventGame extends Game GetKits()[0].ApplyKit(player); //Refresh - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); //Spawn GetTeamList().get(0).SpawnTeleport(player); @@ -330,47 +332,6 @@ public class EventGame extends Game event.blockList().clear(); } - // @EventHandler - // public void updateVisibility(UpdateEvent event) - // { - // if (!InProgress()) - // return; - // - // if (event.getType() != UpdateType.FAST) - // return; - // - // for (Player player : UtilServer.getPlayers()) - // { - // if (!Manager.getPreferences().Get(player).ShowPlayers) - // { - // for (Player other : UtilServer.getPlayers()) - // { - // if (player.equals(other)) - // continue; - // - // ((CraftPlayer)player).hidePlayer(other, true, false); - // } - // } - // else - // { - // for (Player other : UtilServer.getPlayers()) - // { - // if (player.equals(other)) - // continue; - // - // if ((Manager.getPreferences().Get(player).Invisibility && _mps.isAdmin(player, false)) || ) - // { - // ((CraftPlayer)other).hidePlayer(player, true, false); - // } - // else - // { - // other.showPlayer(player); - // } - // } - // } - // } - // } - @Override public void EndCheck() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java index 4e08b24aa..fc9a99f85 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java @@ -22,6 +22,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import mineplex.core.Managers; import mineplex.core.common.Pair; import mineplex.core.common.animation.AnimationPoint; import mineplex.core.common.animation.Animator; @@ -31,14 +32,13 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.pet.PetType; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.rewards.PetReward; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; - +import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -141,16 +141,17 @@ public class Halloween2016 extends Halloween public void unlockAllPlayers() { - if(_lockAllPlayers == null) return; + if (_lockAllPlayers == null) return; _lockAllPlayers = null; - for(Entry> e : _playerPreLockData.entrySet()) + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (Entry> e : _playerPreLockData.entrySet()) { e.getKey().teleport(e.getValue().getLeft()); e.getKey().setGameMode(e.getValue().getRight()); - if(IsAlive(e.getKey())) + if (IsAlive(e.getKey())) { - UtilPlayer.showForAll(e.getKey()); + Bukkit.getOnlinePlayers().forEach(p -> vm.showPlayer(p, e.getKey(), "Halloween 2016 Lock")); } } _playerPreLockData.clear(); @@ -170,21 +171,22 @@ public class Halloween2016 extends Halloween @EventHandler public void lockPlayerTask(UpdateEvent event) { - if(event.getType() != UpdateType.TICK) return; + if (event.getType() != UpdateType.TICK) return; - if(_lockAllPlayers != null) + if (_lockAllPlayers != null) { - for(Player p : Bukkit.getOnlinePlayers()) + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (Player p : Bukkit.getOnlinePlayers()) { - if(!_playerPreLockData.containsKey(p)) + if (!_playerPreLockData.containsKey(p)) { _playerPreLockData.put(p, Pair.create(p.getLocation(), p.getGameMode())); p.setGameMode(GameMode.SPECTATOR); } p.teleport(_lockAllPlayers); - if(IsAlive(p)) + if (IsAlive(p)) { - UtilPlayer.hideFromAll(p); + Bukkit.getOnlinePlayers().forEach(pl -> vm.hidePlayer(pl, p, "Halloween 2016 Lock")); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 76fc4da6c..6f1dc4fe7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -58,6 +58,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.util.Vector; +import mineplex.core.Managers; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -1158,7 +1159,8 @@ public class HideSeek extends TeamGame GetKits()[5].ApplyKit(player); // Refresh - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); if (forced) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index b14fb3a9d..3b8731167 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import mineplex.core.Managers; import mineplex.core.common.Pair; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -305,7 +306,8 @@ public class MilkCow extends SoloGame newKit.ApplyKit(player); //Refresh - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); //Turn off flight player.setAllowFlight(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index d9477949f..bad3221c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -79,6 +79,7 @@ import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; +import mineplex.core.Managers; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -640,9 +641,10 @@ public abstract class SurvivalGames extends Game { if (_deathMatchTime == 5) { + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player player : GetPlayers(true)) { - VisibilityManager.Instance.refreshPlayerToAll(player); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); } } else if (_deathMatchTime == 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index b0cae8a9b..0b496e13b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; +import mineplex.core.Managers; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; @@ -1211,9 +1212,12 @@ public class SurvivalGamesTeams extends TeamGame if (_deathmatchTime <= 0) return; - + + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player player : GetPlayers(true)) - VisibilityManager.Instance.refreshPlayerToAll(player); + { + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); + } Announce(C.cRed + C.Bold + "Deathmatch in " + _deathmatchTime + "..."); _deathmatchTime--; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index b21be55bc..2360a40d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; @@ -15,6 +16,7 @@ import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import mineplex.core.Managers; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -166,7 +168,8 @@ public class ZombieSurvival extends SoloGame newKit.ApplyKit(player); //Refresh - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); if (forced) { @@ -203,7 +206,8 @@ public class ZombieSurvival extends SoloGame GetKit(player).ApplyKit(player); //Refresh on Spawn - VisibilityManager.Instance.refreshPlayerToAll(player); + VisibilityManager vm = Managers.require(VisibilityManager.class); + Bukkit.getOnlinePlayers().forEach(pl -> vm.refreshVisibility(pl, player)); } }, 0); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 3204c2dbb..374e0003f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -2,7 +2,9 @@ package nautilus.game.arcade.gametutorial; import java.util.HashMap; +import mineplex.core.Managers; import mineplex.core.common.util.UtilServer; +import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent; @@ -56,21 +58,21 @@ public abstract class GameTutorial { _hasStarted = true; _tick = 0; - for(TutorialPhase phase : _phases) + for (TutorialPhase phase : _phases) phase.setTutorial(this); - if(TutorialNotification) + if (TutorialNotification) { TutorialPhase phase = getPhase(1); - for(TutorialText text : phase.getText()) + for (TutorialText text : phase.getText()) { int index = text.ID(); text.setID(index + 1); } TutorialText[] newText = new TutorialText[phase.getText().length + 1]; - for(int i = 0; i < newText.length; i++) + for (int i = 0; i < newText.length; i++) { - if(i == 0) + if (i == 0) { newText[i] = new TutorialText("Please notice that this is a Tutorial", 20, 1); continue; @@ -106,13 +108,13 @@ public abstract class GameTutorial protected void nextPhase(boolean phaseOne) { TutorialPhase from = _currentPhase; - if(!phaseOne) + if (!phaseOne) _currentPhase = getNextPhase(); - if(_currentPhase == null) + if (_currentPhase == null) { // has ended - if(!CustomEnding) + if (!CustomEnding) { onEnd(); _hasEnded = true; @@ -131,7 +133,7 @@ public abstract class GameTutorial else { // setting another Phase, if Tutorial hasn't stopped yet - if(!_hasEnded) + if (!_hasEnded) { Manager.GetChat().Silence(70000, false); onPhaseChange(_currentPhase); @@ -148,7 +150,8 @@ public abstract class GameTutorial private void endTutorial() { - for(final Player player : _players.keySet()) + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (final Player player : _players.keySet()) { Manager.runSyncLater(new Runnable() { @@ -156,18 +159,18 @@ public abstract class GameTutorial public void run() { // Player visibility/fly mode - for(Player other : Manager.GetGame().GetPlayers(false)) + for (Player other : Manager.GetGame().GetPlayers(false)) { - if(player == other) + if (player == other) continue; - other.showPlayer(player); + vm.showPlayer(other, player, "Game Tutorial"); } player.setAllowFlight(false); player.setFlying(false); } }, 5); - if(TeleportOnEnd) + if (TeleportOnEnd) { Manager.runSyncLater(new Runnable() { @@ -188,13 +191,13 @@ public abstract class GameTutorial protected TutorialPhase getNextPhase() { // getting next TutorialPhase - for(TutorialPhase phase : _phases) + for (TutorialPhase phase : _phases) { - if(_currentPhase == null && phase.ID() == 1) + if (_currentPhase == null && phase.ID() == 1) { return phase; } - else if(_currentPhase != null && _currentPhase.ID() + 1 == phase.ID()) + else if (_currentPhase != null && _currentPhase.ID() + 1 == phase.ID()) { return phase; } @@ -204,11 +207,11 @@ public abstract class GameTutorial private void preparePlayers() { - for(Player player : UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { // setting Players into fly mode and save their Locations int i = 0; - if(Manager.GetGame().GetTeam(player) == _team) + if (Manager.GetGame().GetTeam(player) == _team) { _players.put(player, Manager.GetGame().GetTeam(player).GetSpawns().get(i)); player.setAllowFlight(true); @@ -220,9 +223,9 @@ public abstract class GameTutorial public TutorialPhase getPhase(int index) { - for(TutorialPhase phase : _phases) + for (TutorialPhase phase : _phases) { - if(phase.ID() == index) + if (phase.ID() == index) return phase; } return null; @@ -255,13 +258,13 @@ public abstract class GameTutorial */ public void end() { - if(CustomEnding) + if (CustomEnding) { // Ending onEnd(); _hasEnded = true; Thread thread = _currentPhase.getThread(); - if(thread.isAlive()) + if (thread.isAlive()) thread.destroy(); endTutorial(); @@ -283,14 +286,14 @@ public abstract class GameTutorial public int tick() { - // Fix for Visibility Manager not really working - if(!_hasEnded && hasStarted()) + if (!_hasEnded && hasStarted()) { - for(Player player : UtilServer.getPlayers()) + VisibilityManager vm = Managers.require(VisibilityManager.class); + for (Player player : UtilServer.getPlayers()) { - for(Player other : _players.keySet()) + for (Player other : _players.keySet()) { - player.hidePlayer(other); + vm.hidePlayer(player, other, "Game Tutorial"); } } } @@ -333,6 +336,5 @@ public abstract class GameTutorial public void onPhaseChange(TutorialPhase phase){} - public void onEnd(){} - -} + public void onEnd(){} +} \ No newline at end of file diff --git a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java index 7d7864977..8edbd4e6a 100644 --- a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java +++ b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java @@ -85,7 +85,7 @@ public class Hub extends JavaPlugin ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); - VisibilityManager.Initialize(this); + require(VisibilityManager.class); Give.Initialize(this); // Velocity Fix diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java index 654e26f0d..315e2b6ee 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java @@ -139,7 +139,7 @@ public class GemHunters extends JavaPlugin Recharge.Initialize(this); // Visibility - VisibilityManager.Initialize(this); + require(VisibilityManager.class); // Give Give.Initialize(this); diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java index cf5a05dcc..ed5f9e55d 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java @@ -26,6 +26,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import com.google.common.collect.Sets; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.common.util.C; @@ -36,6 +37,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.stats.StatsManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; import mineplex.gemhunters.playerstatus.PlayerStatusModule; import mineplex.gemhunters.playerstatus.PlayerStatusType; @@ -146,9 +148,10 @@ public class DeathModule extends MiniPlugin player.setFlying(true); player.setGameMode(GameMode.CREATIVE); + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player other : Bukkit.getOnlinePlayers()) { - other.hidePlayer(player); + vm.hidePlayer(other, player, "GH Respawning"); } _playerStatus.setStatus(player, PlayerStatusType.DANGER, true); @@ -162,10 +165,11 @@ public class DeathModule extends MiniPlugin player.setAllowFlight(false); player.setGameMode(GameMode.SURVIVAL); _spawn.teleportToSpawn(player); - + + VisibilityManager vm = Managers.require(VisibilityManager.class); for (Player other : Bukkit.getOnlinePlayers()) { - other.showPlayer(player); + vm.showPlayer(other, player, "GH Respawning"); } PlayerCustomRespawnEvent event = new PlayerCustomRespawnEvent(player); @@ -245,4 +249,4 @@ public class DeathModule extends MiniPlugin { return _toRemove.containsKey(player.getUniqueId()); } -} +} \ No newline at end of file