Temporarily disable clans ban functionality
This can be reverted when clans bans are properly audited/fixed/tested.
This commit is contained in:
parent
38f22b1577
commit
b47c49d93b
@ -41,7 +41,6 @@ import mineplex.core.updater.FileUpdater;
|
||||
import mineplex.core.updater.Updater;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
import mineplex.game.clans.items.GearManager;
|
||||
import mineplex.game.clans.shop.building.BuildingShop;
|
||||
import mineplex.game.clans.shop.farming.FarmingShop;
|
||||
@ -113,7 +112,7 @@ public class Clans extends JavaPlugin
|
||||
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||
|
||||
ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);
|
||||
//ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
@ -145,7 +144,7 @@ public class Clans extends JavaPlugin
|
||||
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
||||
|
||||
HologramManager hologram = new HologramManager(this, packetHandler);
|
||||
_clansManager = new ClansManager(this, clansBans, serverStatusManager.getCurrentServerName(), incognito, packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, webServerAddress);
|
||||
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), incognito, packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, webServerAddress);
|
||||
new Recipes(this);
|
||||
new Farming(this);
|
||||
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
||||
|
@ -81,7 +81,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
import mineplex.game.clans.clans.commands.ClanManagementCommand;
|
||||
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
||||
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
||||
@ -226,20 +225,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
|
||||
|
||||
public String UserDataDir = UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "CLANS_USER_DATA" + File.separator;
|
||||
|
||||
private ClansBanManager _clansBans;
|
||||
|
||||
|
||||
public ClanTips ClanTips;
|
||||
|
||||
// Spawn area
|
||||
|
||||
public ClansManager(JavaPlugin plugin, ClansBanManager clansBans, String serverName, IncognitoManager incognitoManager, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
|
||||
public ClansManager(JavaPlugin plugin, String serverName, IncognitoManager incognitoManager, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
|
||||
{
|
||||
super("Clans Manager", plugin);
|
||||
|
||||
_instance = this;
|
||||
|
||||
_clansBans = clansBans;
|
||||
_punish = punish;
|
||||
|
||||
_incognitoManager = incognitoManager;
|
||||
@ -606,33 +602,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
|
||||
if (_clansBans.willBeKicked(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_incognitoManager.Get(event.getPlayer()).Status)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_clansBans.runAfterLoad(event.getPlayer().getName(), () -> {
|
||||
if (_clansBans.Get(event.getPlayer().getName()).isBanned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorial.inTutorial(other))
|
||||
{
|
||||
// Don't display join message if player in tutorial.
|
||||
continue;
|
||||
}
|
||||
|
||||
other.sendMessage(F.sys("Join", event.getPlayer().getName()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -645,11 +618,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clansBans.Get(event.getPlayer().getName()) != null && _clansBans.Get(event.getPlayer().getName()).isBanned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorial.inTutorial(other))
|
||||
@ -671,11 +639,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clansBans.willBeKicked(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getReason().contains("banned from Clans"))
|
||||
{
|
||||
return;
|
||||
|
@ -2,11 +2,9 @@ package mineplex.game.clans.clans.ban;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -38,15 +36,13 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private ClansBanRepository _repository;
|
||||
private Map<String, ClansBanClient> _clients;
|
||||
private final Map<String, ClansBanClient> _clients = new ConcurrentHashMap<>();
|
||||
private Map<String, ClansBanCache> _cache;
|
||||
private DefaultHashMap<String, List<Runnable>> _runAfterLoad;
|
||||
private ClansBanShop _shop;
|
||||
|
||||
private Map<String, String> _toKick = new HashMap<>();
|
||||
|
||||
private Object _lock = new Object();
|
||||
|
||||
public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("Blacklist", plugin);
|
||||
@ -55,7 +51,6 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
||||
|
||||
_repository = new ClansBanRepository(plugin);
|
||||
|
||||
_clients = new HashMap<>();
|
||||
_cache = new HashMap<>();
|
||||
_runAfterLoad = new DefaultHashMap<>(name -> new ArrayList<>());
|
||||
_shop = new ClansBanShop(this, clientManager, donationManager);
|
||||
@ -92,10 +87,7 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
||||
|
||||
if (event.getType().equals(UpdateType.MIN_01))
|
||||
{
|
||||
synchronized (_lock)
|
||||
{
|
||||
UtilStreams.ToList(_clients.keySet().stream().filter(UtilServer::IsOnline)).forEach(this::UnloadClient);
|
||||
}
|
||||
_clients.keySet().stream().filter(UtilServer::IsOnline).forEach(this::UnloadClient);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,10 +150,7 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
||||
|
||||
public void UnloadClient(String name)
|
||||
{
|
||||
synchronized (_lock)
|
||||
{
|
||||
_clients.remove(name);
|
||||
}
|
||||
_clients.remove(name);
|
||||
}
|
||||
|
||||
public void LoadClient(String name, Callback<ClansBanClient> callback)
|
||||
@ -173,25 +162,19 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
||||
}
|
||||
|
||||
GetRepository().loadClient(name, client -> {
|
||||
synchronized (_lock)
|
||||
{
|
||||
_clients.put(name.toLowerCase(), client);
|
||||
System.out.println("> CLIENTS: " + _clients);
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
callback.run(client);
|
||||
}
|
||||
}
|
||||
_clients.put(name.toLowerCase(), client);
|
||||
System.out.println("> CLIENTS: " + _clients);
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
callback.run(client);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ClansBanClient Get(String name)
|
||||
{
|
||||
synchronized (_lock)
|
||||
{
|
||||
return _clients.get(name.toLowerCase());
|
||||
}
|
||||
return _clients.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public ClansBanShop getShop()
|
||||
|
@ -17,7 +17,7 @@ public class ClansBanCommand extends CommandBase<ClansBanManager>
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
{
|
||||
if (args == null || args.length < 1)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cBlue + "/cb <username> <reason>" + C.cGray + " - " + C.cYellow + "Displays the \"Clans Punish\" GUI, allowing you to ban the player, and view thier past bans.");
|
||||
|
Loading…
Reference in New Issue
Block a user