Merge pull request #57 from Mineplex-LLC/clans/beta
Latest clans/beta changes
This commit is contained in:
commit
39c3833b47
@ -46,7 +46,6 @@ import mineplex.core.updater.FileUpdater;
|
|||||||
import mineplex.core.updater.Updater;
|
import mineplex.core.updater.Updater;
|
||||||
import mineplex.core.visibility.VisibilityManager;
|
import mineplex.core.visibility.VisibilityManager;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
|
||||||
import mineplex.game.clans.items.GearManager;
|
import mineplex.game.clans.items.GearManager;
|
||||||
import mineplex.game.clans.shop.building.BuildingShop;
|
import mineplex.game.clans.shop.building.BuildingShop;
|
||||||
import mineplex.game.clans.shop.farming.FarmingShop;
|
import mineplex.game.clans.shop.farming.FarmingShop;
|
||||||
@ -118,8 +117,8 @@ public class Clans extends JavaPlugin
|
|||||||
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
||||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
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);
|
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||||
AntiHack.Instance.setKick(false);
|
AntiHack.Instance.setKick(false);
|
||||||
@ -154,7 +153,7 @@ public class Clans extends JavaPlugin
|
|||||||
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
||||||
|
|
||||||
HologramManager hologram = new HologramManager(this, packetHandler);
|
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 Recipes(this);
|
||||||
new Farming(this);
|
new Farming(this);
|
||||||
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
@ -80,7 +81,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import mineplex.game.clans.Clans;
|
import mineplex.game.clans.Clans;
|
||||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
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.ClanManagementCommand;
|
||||||
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
||||||
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
||||||
@ -225,20 +225,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
|
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;
|
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;
|
public ClanTips ClanTips;
|
||||||
|
|
||||||
// Spawn area
|
// 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);
|
super("Clans Manager", plugin);
|
||||||
|
|
||||||
_instance = this;
|
_instance = this;
|
||||||
|
|
||||||
_clansBans = clansBans;
|
|
||||||
_punish = punish;
|
_punish = punish;
|
||||||
|
|
||||||
_incognitoManager = incognitoManager;
|
_incognitoManager = incognitoManager;
|
||||||
@ -605,33 +602,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
{
|
{
|
||||||
event.setJoinMessage(null);
|
event.setJoinMessage(null);
|
||||||
|
|
||||||
if (_clansBans.willBeKicked(event.getPlayer()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_incognitoManager.Get(event.getPlayer()).Status)
|
if (_incognitoManager.Get(event.getPlayer()).Status)
|
||||||
{
|
{
|
||||||
return;
|
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)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@ -644,11 +618,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_clansBans.Get(event.getPlayer().getName()) != null && _clansBans.Get(event.getPlayer().getName()).isBanned())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
if (_tutorial.inTutorial(other))
|
if (_tutorial.inTutorial(other))
|
||||||
@ -670,11 +639,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_clansBans.willBeKicked(event.getPlayer()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.getReason().contains("banned from Clans"))
|
if (event.getReason().contains("banned from Clans"))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -891,7 +855,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
|
|
||||||
recipients.clear();
|
recipients.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void disableObsidian(BlockBreakEvent event)
|
||||||
|
{
|
||||||
|
if(event.getBlock().getType().equals(Material.OBSIDIAN))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getBlock().setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onSignChange(SignChangeEvent event)
|
public void onSignChange(SignChangeEvent event)
|
||||||
{
|
{
|
||||||
|
@ -2,11 +2,9 @@ package mineplex.game.clans.clans.ban;
|
|||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -38,15 +36,13 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
|||||||
{
|
{
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
private ClansBanRepository _repository;
|
private ClansBanRepository _repository;
|
||||||
private Map<String, ClansBanClient> _clients;
|
private final Map<String, ClansBanClient> _clients = new ConcurrentHashMap<>();
|
||||||
private Map<String, ClansBanCache> _cache;
|
private Map<String, ClansBanCache> _cache;
|
||||||
private DefaultHashMap<String, List<Runnable>> _runAfterLoad;
|
private DefaultHashMap<String, List<Runnable>> _runAfterLoad;
|
||||||
private ClansBanShop _shop;
|
private ClansBanShop _shop;
|
||||||
|
|
||||||
private Map<String, String> _toKick = new HashMap<>();
|
private Map<String, String> _toKick = new HashMap<>();
|
||||||
|
|
||||||
private Object _lock = new Object();
|
|
||||||
|
|
||||||
public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||||
{
|
{
|
||||||
super("Blacklist", plugin);
|
super("Blacklist", plugin);
|
||||||
@ -55,7 +51,6 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
|||||||
|
|
||||||
_repository = new ClansBanRepository(plugin);
|
_repository = new ClansBanRepository(plugin);
|
||||||
|
|
||||||
_clients = new HashMap<>();
|
|
||||||
_cache = new HashMap<>();
|
_cache = new HashMap<>();
|
||||||
_runAfterLoad = new DefaultHashMap<>(name -> new ArrayList<>());
|
_runAfterLoad = new DefaultHashMap<>(name -> new ArrayList<>());
|
||||||
_shop = new ClansBanShop(this, clientManager, donationManager);
|
_shop = new ClansBanShop(this, clientManager, donationManager);
|
||||||
@ -92,10 +87,7 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
|||||||
|
|
||||||
if (event.getType().equals(UpdateType.MIN_01))
|
if (event.getType().equals(UpdateType.MIN_01))
|
||||||
{
|
{
|
||||||
synchronized (_lock)
|
_clients.keySet().stream().filter(UtilServer::IsOnline).forEach(this::UnloadClient);
|
||||||
{
|
|
||||||
UtilStreams.ToList(_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)
|
public void UnloadClient(String name)
|
||||||
{
|
{
|
||||||
synchronized (_lock)
|
_clients.remove(name);
|
||||||
{
|
|
||||||
_clients.remove(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadClient(String name, Callback<ClansBanClient> callback)
|
public void LoadClient(String name, Callback<ClansBanClient> callback)
|
||||||
@ -173,25 +162,19 @@ public class ClansBanManager extends MiniPlugin implements ILoginProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetRepository().loadClient(name, client -> {
|
GetRepository().loadClient(name, client -> {
|
||||||
synchronized (_lock)
|
_clients.put(name.toLowerCase(), client);
|
||||||
{
|
System.out.println("> CLIENTS: " + _clients);
|
||||||
_clients.put(name.toLowerCase(), client);
|
|
||||||
System.out.println("> CLIENTS: " + _clients);
|
if (callback != null)
|
||||||
|
{
|
||||||
if (callback != null)
|
callback.run(client);
|
||||||
{
|
}
|
||||||
callback.run(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansBanClient Get(String name)
|
public ClansBanClient Get(String name)
|
||||||
{
|
{
|
||||||
synchronized (_lock)
|
return _clients.get(name.toLowerCase());
|
||||||
{
|
|
||||||
return _clients.get(name.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansBanShop getShop()
|
public ClansBanShop getShop()
|
||||||
|
@ -17,7 +17,7 @@ public class ClansBanCommand extends CommandBase<ClansBanManager>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Execute(final Player caller, String[] args)
|
public void Execute(final Player caller, String[] args)
|
||||||
{
|
{
|
||||||
if (args == null || args.length < 1)
|
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.");
|
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