Remove malfunctioning visibility refreshers and block direct connection to Clans servers for non-staff

This commit is contained in:
AlexTheCoder 2016-11-26 04:37:20 -05:00 committed by cnr
parent 3a7ff872d6
commit 72669c7640
3 changed files with 28 additions and 80 deletions

View File

@ -70,6 +70,13 @@ public class ServerCommand extends CommandBase<Portal>
else
deniedAccess = true;
}
else if (servUp.startsWith("CLANS-"))
{
if (playerRank.has(Rank.HELPER))
Plugin.sendPlayerToServer(player, args[0]);
else
UtilPlayer.message(player, F.main(Plugin.getName(), "Clans servers can only be joined via the Clans Hub!"));
}
else
{
Plugin.sendPlayerToServer(player, args[0]);

View File

@ -51,11 +51,9 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.creature.Creature;
import mineplex.core.creature.event.CreatureSpawnCustomEvent;
import mineplex.core.disguise.DisguiseManager;
@ -147,7 +145,6 @@ import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
@ -158,9 +155,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
public static final int CLAIMABLE_RADIUS = 800;
public static final int WORLD_RADIUS = 1200;
private static final long PLAYER_VISIBILITY_REFRESH_RATE = 30000;
private static final int VIEW_DISTANCE_BLOCK_VALUE = 8;
private long _lastVisibilityRefresh = 0;
private static final TimeZone TIME_ZONE = TimeZone.getDefault();
private static ClansManager _instance;
@ -1407,27 +1401,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
}
}
}
@EventHandler
public void refreshVisibility(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
if (UtilTime.elapsed(_lastVisibilityRefresh, PLAYER_VISIBILITY_REFRESH_RATE))
{
_lastVisibilityRefresh = System.currentTimeMillis();
Bukkit.getOnlinePlayers().stream().filter(player -> !Managers.get(ConditionManager.class).HasCondition(player, ConditionType.INVISIBILITY) && !Managers.get(ConditionManager.class).HasCondition(player, ConditionType.CLOAK) && !UtilPlayer.isSpectator(player) && !Managers.get(IncognitoManager.class).Get(player).Hidden && !Managers.get(ObserverManager.class).isObserver(player)).forEach(player ->
{
Bukkit.getOnlinePlayers().stream().filter(viewer -> UtilMath.offset2d(viewer, player) <= (Bukkit.getViewDistance() * VIEW_DISTANCE_BLOCK_VALUE)).forEach(viewer ->
{
viewer.hidePlayer(player);
viewer.showPlayer(player);
});
});
}
}
public Pair<ClanInfo, Long> leftRecently(UUID uniqueId, long time)
{

View File

@ -1,30 +1,7 @@
package nautilus.game.arcade.managers;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.party.PartyManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.ProgressingKit;
import org.bukkit.Bukkit;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
@ -41,7 +18,25 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.party.PartyManager;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.ProgressingKit;
public class GamePlayerManager implements Listener
{
@ -49,39 +44,12 @@ public class GamePlayerManager implements Listener
private static final int TEAMMATE_MESSAGE_DELAY = 40;
private static final long PLAYER_VISIBILITY_REFRESH_RATE = 30000;
private static final int VIEW_DISTANCE_BLOCK_VALUE = 8;
private long _lastVisibilityRefresh = 0;
public GamePlayerManager(ArcadeManager manager)
{
Manager = manager;
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
}
@EventHandler
public void onRefreshVisibility(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
if (UtilTime.elapsed(_lastVisibilityRefresh, PLAYER_VISIBILITY_REFRESH_RATE))
{
_lastVisibilityRefresh = System.currentTimeMillis();
if (Manager.GetGame() == null)
{
return;
}
Manager.GetGame().GetPlayers(true).stream().filter(player -> !Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && !Manager.GetCondition().HasCondition(player, ConditionType.CLOAK) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player)).forEach(player ->
{
Bukkit.getOnlinePlayers().stream().filter(viewer -> UtilMath.offset2d(viewer, player) <= (Bukkit.getViewDistance() * VIEW_DISTANCE_BLOCK_VALUE)).forEach(viewer ->
{
viewer.hidePlayer(player);
viewer.showPlayer(player);
});
});
}
}
@EventHandler(priority = EventPriority.HIGH)
public void PlayerDeath(CombatDeathEvent event)