Fixed Merge Conflicts

This commit is contained in:
AlexTheCoder 2017-09-23 03:40:21 -04:00
parent a419af7224
commit eecf960613
49 changed files with 403 additions and 472 deletions

View File

@ -134,38 +134,6 @@ public class UtilPlayer
return entry.trackedPlayers.contains(ep);
}
public static void hideFrom(Player player, Collection<Player> players) {
players.stream().forEach(p->p.hidePlayer(player));
}
public static void showFor(Player player, Collection<Player> players) {
players.stream().forEach(p->p.hidePlayer(player));
}
public static void hideFromAll(Player player, Collection<Player> except) {
UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.hidePlayer(player));
}
public static void showForAll(Player player, Collection<Player> 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)
{
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() > 47;

View File

@ -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<Block, BlockRestoreData> _blocks = new HashMap<Block, BlockRestoreData>();
private Map<Block, BlockRestoreData> _blocks = new HashMap<>();
private LinkedList<BlockRestoreMap> _restoreMaps;
private BlockRestore()
@ -266,7 +267,7 @@ public class BlockRestore extends MiniPlugin
return null;
}
public HashMap<Block, BlockRestoreData> getBlocks()
public Map<Block, BlockRestoreData> getBlocks()
{
return _blocks;
}

View File

@ -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<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>();
private Map<Projectile, Player> _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

View File

@ -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<JackOBomb> _bombs = Lists.newArrayList();
private List<JackOBomb> _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

View File

@ -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;
@ -73,7 +77,8 @@ public class WinEffectBabyChicken extends WinEffectGadget
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;
}
@ -146,20 +151,26 @@ public class WinEffectBabyChicken extends WinEffectGadget
{
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);
}
}
}

View File

@ -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<Location> 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();
}
}

View File

@ -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);

View File

@ -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<IncognitoClient>
{
@ -74,6 +76,8 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{
boolean enabled = !Get(caller).Status;
VisibilityManager vm = Managers.require(VisibilityManager.class);
IncognitoStatusChangeEvent event = UtilServer.CallEvent(new IncognitoStatusChangeEvent(caller, enabled));
if (event.isCancelled())
@ -89,7 +93,7 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{
for (Player other : UtilServer.getPlayers())
{
other.showPlayer(caller);
vm.showPlayer(other, caller, "Incognito Mode");
}
}
}
@ -104,6 +108,8 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{
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<IncognitoClient>
{
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<IncognitoClient>
if (!customEvent2.isCancelled() && !canSeeThroughIncognito(player, other))
{
player.hidePlayer(other);
vm.hidePlayer(player, other, "Incognito Mode");
}
}
}
@ -151,6 +157,8 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
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<IncognitoClient>
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<IncognitoClient>
if (!customEvent.isCancelled() && !canSeeThroughIncognito(player, other))
{
player.hidePlayer(other);
vm.hidePlayer(player, other, "Incognito Mode");
}
Get(other).Hidden = !customEvent.isCancelled();

View File

@ -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;
@ -90,6 +93,8 @@ public class TextTutorialManager extends MiniPlugin
if (event.getType() != UpdateType.TICK)
return;
VisibilityManager vm = Managers.require(VisibilityManager.class);
for (final Tutorial tut : _tutorials)
{
Iterator<TutorialData> 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,23 +175,29 @@ 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)
{
for (Tutorial tutorial : _tutorials)
{
if (tutorial.isInTutorial(player))
{
return true;
}
}
return false;
}

View File

@ -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<Player, Boolean> _shouldHide = new NautHashMap<Player, Boolean>();
private NautHashMap<Player, Boolean> _lastState = new NautHashMap<Player, Boolean>();
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<Player> 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<Player> targetIter = _lastState.keySet().iterator(); targetIter.hasNext();)
{
Player target = targetIter.next();
if (!target.isOnline() || !target.isValid())
{
targetIter.remove();
}
}
}
TimingManager.stopTotal("VisData attemptToProcessUpdate lastState");
}
}

View File

@ -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 final Map<Player, Map<Player, Set<String>>> _visibility = new HashMap<>();
private NautHashMap<Player, VisibilityData> _data = new NautHashMap<Player, VisibilityData>();
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);
if (canSee(viewer, target))
{
viewer.showPlayer(target);
}
else
{
viewer.hidePlayer(target);
}
}
public void setVisibility(Player target, boolean isVisible, Player... viewers)
public void hidePlayer(Player viewer, Player target, String reason)
{
TimingManager.startTotal("VisMan SetVis");
for (Player player : viewers)
Set<String> reasons = _visibility.get(viewer).computeIfAbsent(target, (p) -> new HashSet<>());
if (reasons.contains(reason))
{
if (player.equals(target))
continue;
getDataFor(player).updatePlayer(player, target, !isVisible);
}
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<Player> playerIter = _data.keySet().iterator();
while (playerIter.hasNext())
{
Player player = playerIter.next();
if (!player.isOnline() || !player.isValid())
{
playerIter.remove();
continue;
}
reasons.add(reason);
refreshVisibility(viewer, target);
}
_data.get(player).attemptToProcessUpdate(player);
}
TimingManager.stopTotal("VisMan Update");
}
@EventHandler
public void quit(PlayerQuitEvent event)
public void showPlayer(Player viewer, Player target, String reason)
{
_data.remove(event.getPlayer());
}
//@EventHandler DISABLED
public void updateDebug(UpdateEvent event)
Set<String> reasons = _visibility.get(viewer).get(target);
if (reasons == null)
{
if (event.getType() != UpdateType.MIN_01)
return;
}
boolean modified = reasons.remove(reason);
if (reasons.isEmpty())
{
_visibility.get(viewer).remove(target);
}
if (modified)
{
refreshVisibility(viewer, target);
}
}
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);
@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()));
}
}

View File

@ -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);

View File

@ -301,7 +301,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> 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<ClientClan> 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;
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<ClientClan> 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

View File

@ -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();

View File

@ -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<T extends EventCreature<?>> extends WorldEv
{
((Recall)skill).Reset(player);
}
if (skill instanceof Blink)
{
((Blink)skill).Reset(player);
}
}
sendMessage(player, "You have teleported inside the arena!");
}

View File

@ -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<WitherRaid>
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);

View File

@ -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);

View File

@ -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<WitherRaid>
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);

View File

@ -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);
}
}

View File

@ -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<WitherRaid>
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<WitherRaid>
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);
}
}

View File

@ -105,6 +105,7 @@ public class ChallengeSeven extends RaidChallenge<WitherRaid>
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));
}

View File

@ -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<WitherRaid>
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);

View File

@ -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<WitherRaid>
{
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<WitherRaid>
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);

View File

@ -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);
}
}

View File

@ -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<WitherRaid>
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<WitherRaid>
{
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);

View File

@ -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);

View File

@ -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;
@ -75,6 +76,8 @@ 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");
}
}
}

View File

@ -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);

View File

@ -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;
@ -98,7 +99,16 @@ 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<Player> 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);

View File

@ -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,7 +392,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");
}
}
}

View File

@ -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;
}
}

View File

@ -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;
@ -74,6 +75,8 @@ public class ConditionEffect implements Listener
if (event.getType() != UpdateType.FAST)
return;
VisibilityManager vm = Managers.require(VisibilityManager.class);
for (LivingEntity ent : Manager.GetActiveConditions().keySet())
{
if (!(ent instanceof Player))
@ -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");
}
}
}

View File

@ -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);
});
}
}

View File

@ -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

View File

@ -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
{
@ -183,7 +186,8 @@ public class GameTeam
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()

View File

@ -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);
}

View File

@ -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()
{

View File

@ -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;
@ -144,13 +144,14 @@ public class Halloween2016 extends Halloween
if (_lockAllPlayers == null) return;
_lockAllPlayers = null;
VisibilityManager vm = Managers.require(VisibilityManager.class);
for (Entry<Player, Pair<Location, GameMode>> e : _playerPreLockData.entrySet())
{
e.getKey().teleport(e.getValue().getLeft());
e.getKey().setGameMode(e.getValue().getRight());
if (IsAlive(e.getKey()))
{
UtilPlayer.showForAll(e.getKey());
Bukkit.getOnlinePlayers().forEach(p -> vm.showPlayer(p, e.getKey(), "Halloween 2016 Lock"));
}
}
_playerPreLockData.clear();
@ -174,6 +175,7 @@ public class Halloween2016 extends Halloween
if (_lockAllPlayers != null)
{
VisibilityManager vm = Managers.require(VisibilityManager.class);
for (Player p : Bukkit.getOnlinePlayers())
{
if (!_playerPreLockData.containsKey(p))
@ -184,7 +186,7 @@ public class Halloween2016 extends Halloween
p.teleport(_lockAllPlayers);
if (IsAlive(p))
{
UtilPlayer.hideFromAll(p);
Bukkit.getOnlinePlayers().forEach(pl -> vm.hidePlayer(pl, p, "Halloween 2016 Lock"));
}
}
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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)

View File

@ -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;
@ -1212,8 +1213,11 @@ 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--;

View File

@ -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);
}

View File

@ -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;
@ -148,6 +150,7 @@ public abstract class GameTutorial
private void endTutorial()
{
VisibilityManager vm = Managers.require(VisibilityManager.class);
for (final Player player : _players.keySet())
{
Manager.runSyncLater(new Runnable()
@ -161,7 +164,7 @@ public abstract class GameTutorial
if (player == other)
continue;
other.showPlayer(player);
vm.showPlayer(other, player, "Game Tutorial");
}
player.setAllowFlight(false);
player.setFlying(false);
@ -283,14 +286,14 @@ public abstract class GameTutorial
public int tick()
{
// Fix for Visibility Manager not really working
if (!_hasEnded && hasStarted())
{
VisibilityManager vm = Managers.require(VisibilityManager.class);
for (Player player : UtilServer.getPlayers())
{
for (Player other : _players.keySet())
{
player.hidePlayer(other);
vm.hidePlayer(player, other, "Game Tutorial");
}
}
}
@ -334,5 +337,4 @@ public abstract class GameTutorial
public void onPhaseChange(TutorialPhase phase){}
public void onEnd(){}
}

View File

@ -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

View File

@ -139,7 +139,7 @@ public class GemHunters extends JavaPlugin
Recharge.Initialize(this);
// Visibility
VisibilityManager.Initialize(this);
require(VisibilityManager.class);
// Give
Give.Initialize(this);

View File

@ -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);
@ -163,9 +166,10 @@ public class DeathModule extends MiniPlugin
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);