Merge remote-tracking branch 'origin/clans/beta' into clans/beta

Conflicts:
	Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java
This commit is contained in:
Conrad S 2016-04-09 13:01:04 -04:00
commit ccf9d4a4c2
17 changed files with 317 additions and 342 deletions

View File

@ -1,8 +1,8 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.function.Predicate;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
@ -10,10 +10,18 @@ import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.Explosion;
import net.minecraft.server.v1_8_R3.PacketPlayOutExplosion;
import net.minecraft.server.v1_8_R3.Vec3D;
public class UtilWorld public class UtilWorld
{ {
public static World getWorld(String world) public static World getWorld(String world)

View File

@ -2,8 +2,6 @@ package mineplex.core.incognito;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -13,8 +11,6 @@ import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.base.Function;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
@ -27,6 +23,7 @@ import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
import mineplex.core.incognito.repository.IncognitoClient; import mineplex.core.incognito.repository.IncognitoClient;
import mineplex.core.incognito.repository.IncognitoRepository; import mineplex.core.incognito.repository.IncognitoRepository;
import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketHandler;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -34,11 +31,12 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private IncognitoRepository _repository; private IncognitoRepository _repository;
private PreferencesManager _preferencesManager;
public IncognitoManager(JavaPlugin plugin, CoreClientManager clientManager, PacketHandler packetHandler) public IncognitoManager(JavaPlugin plugin, CoreClientManager clientManager, PacketHandler packetHandler)
{ {
super("Incognito", plugin, clientManager); super("Incognito", plugin, clientManager);
_repository = new IncognitoRepository(this); _repository = new IncognitoRepository(this);
_clientManager = clientManager; _clientManager = clientManager;
} }
@ -131,6 +129,41 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
} }
} }
} }
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Player player : UtilServer.getPlayers())
{
for (Player other : UtilServer.getPlayers())
{
if (Get(player).Status)
{
IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player));
if (!customEvent.isCancelled() && !_clientManager.hasRank(other, _clientManager.Get(player).GetRank()))
{
other.hidePlayer(player);
}
}
if (Get(other).Status)
{
IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(other));
if (!customEvent.isCancelled() && !_clientManager.hasRank(player, _clientManager.Get(other).GetRank()))
{
player.hidePlayer(other);
}
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void Quit(PlayerQuitEvent event) public void Quit(PlayerQuitEvent event)
@ -182,4 +215,14 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
Get(playerName).Status = resultSet.getInt("status") == 1; Get(playerName).Status = resultSet.getInt("status") == 1;
} }
} }
public PreferencesManager getPreferences()
{
return _preferencesManager;
}
public void setPreferencesManager(PreferencesManager preferencesManager)
{
_preferencesManager = preferencesManager;
}
} }

View File

@ -18,6 +18,12 @@ public class IncognitoToggleCommand extends CommandBase<IncognitoManager>
@Override @Override
public void Execute(Player caller, String[] args) public void Execute(Player caller, String[] args)
{ {
if (Plugin.getPreferences().Get(caller).Invisibility)
{
UtilPlayer.message(caller, F.main("Incognito", "You are not allowed to toggle incognito on while Hub Invisibility is enabled."));
return;
}
if (Plugin.toggle(caller)) if (Plugin.toggle(caller))
{ {
UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem(AliasUsed) + " again.")); UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem(AliasUsed) + " again."));

View File

@ -4,20 +4,6 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.preferences.command.PreferencesCommand;
import mineplex.core.preferences.ui.ExclusivePreferencesShop;
import mineplex.core.preferences.ui.PreferencesShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -29,17 +15,35 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.donation.DonationManager;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.preferences.command.PreferencesCommand;
import mineplex.core.preferences.ui.ExclusivePreferencesShop;
import mineplex.core.preferences.ui.PreferencesShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class PreferencesManager extends MiniDbClientPlugin<UserPreferences> public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
{ {
private PreferencesRepository _repository; private PreferencesRepository _repository;
private PreferencesShop _shop; private PreferencesShop _shop;
private ExclusivePreferencesShop _exclusiveShop; private ExclusivePreferencesShop _exclusiveShop;
private IncognitoManager _incognitoManager;
private NautHashMap<String, UserPreferences> _saveBuffer = new NautHashMap<String, UserPreferences>(); private NautHashMap<String, UserPreferences> _saveBuffer = new NautHashMap<String, UserPreferences>();
public boolean GiveItem; public boolean GiveItem;
public PreferencesManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) public PreferencesManager(JavaPlugin plugin, IncognitoManager incognito, CoreClientManager clientManager, DonationManager donationManager)
{ {
super("Preferences", plugin, clientManager); super("Preferences", plugin, clientManager);
@ -47,6 +51,8 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
_exclusiveShop = new ExclusivePreferencesShop(this, clientManager, donationManager); _exclusiveShop = new ExclusivePreferencesShop(this, clientManager, donationManager);
_shop = new PreferencesShop(this, clientManager, donationManager, _exclusiveShop); _shop = new PreferencesShop(this, clientManager, donationManager, _exclusiveShop);
_incognitoManager = incognito;
_exclusiveShop.setPreferencesShop(_shop); _exclusiveShop.setPreferencesShop(_shop);
addCommand(new PreferencesCommand(this)); addCommand(new PreferencesCommand(this));
@ -138,4 +144,9 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
{ {
return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic, disableAds FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic, disableAds FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;";
} }
public IncognitoManager getIncognitoManager()
{
return _incognitoManager;
}
} }

View File

@ -8,6 +8,8 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilUI; import mineplex.core.common.util.UtilUI;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
@ -149,6 +151,12 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
private void toggleHubInvisibility(org.bukkit.entity.Player player) private void toggleHubInvisibility(org.bukkit.entity.Player player)
{ {
if (getPlugin().getIncognitoManager() != null && getPlugin().getIncognitoManager().Get(player).Status)
{
UtilPlayer.message(player, F.main("Incognito", "You are not allowed to use Hub Visibility whilst in incognito mode."));
return;
}
getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility; getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility;
// Dont save for Mod/SnrMod - prevents them just being invis 24/7 // Dont save for Mod/SnrMod - prevents them just being invis 24/7

View File

@ -97,8 +97,12 @@ public class Clans extends JavaPlugin
new ServerConfiguration(this, _clientManager); new ServerConfiguration(this, _clientManager);
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); PacketHandler packetHandler = new PacketHandler(this);
IncognitoManager incognito = new IncognitoManager(this, _clientManager, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, incognito, _clientManager, _donationManager);
incognito.setPreferencesManager(preferenceManager);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
// TODO: Add spawn locations to a configuration file of some sort? // TODO: Add spawn locations to a configuration file of some sort?
@ -111,7 +115,6 @@ public class Clans extends JavaPlugin
// ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager); // ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);
PacketHandler packetHandler = new PacketHandler(this);
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);
@ -120,8 +123,6 @@ public class Clans extends JavaPlugin
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
IncognitoManager incognito = new IncognitoManager(this, _clientManager, packetHandler);
StatsManager statsManager = new StatsManager(this, _clientManager); StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
@ -143,7 +144,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(), packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, webServerAddress); _clansManager = new ClansManager(this, /*clansBans,*/ 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);

View File

@ -227,7 +227,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
// Spawn area // Spawn area
public ClansManager(JavaPlugin plugin/*, ClansBanManager clansBans*/, String serverName, 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/*, 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)
{ {
super("Clans Manager", plugin); super("Clans Manager", plugin);
@ -236,7 +236,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
/*_clansBans = clansBans;*/ /*_clansBans = clansBans;*/
_punish = punish; _punish = punish;
_incognitoManager = new IncognitoManager(plugin, clientManager, packetHandler); _incognitoManager = incognitoManager;
_serverName = serverName; _serverName = serverName;
_clientManager = clientManager; _clientManager = clientManager;
_combatManager = new CombatManager(plugin); _combatManager = new CombatManager(plugin);

View File

@ -112,6 +112,7 @@ public class SiegeManager extends MiniPlugin
if (!part) if (!part)
{ {
System.out.println("Removing slime...");
slime.remove(); slime.remove();
} }
else else
@ -162,11 +163,13 @@ public class SiegeManager extends MiniPlugin
{ {
if (((ArmorStand) entity).getHelmet() != null && ((ArmorStand) entity).getHelmet().getType().equals(Material.SPONGE)) if (((ArmorStand) entity).getHelmet() != null && ((ArmorStand) entity).getHelmet().getType().equals(Material.SPONGE))
{ {
System.out.println("Removing armor stand");
entity.remove(); entity.remove();
} }
if (entity.getPassenger() != null && entity.getPassenger() instanceof Slime && entity.getPassenger().getPassenger() instanceof Slime) if (entity.getPassenger() != null && entity.getPassenger() instanceof Slime && entity.getPassenger().getPassenger() instanceof Slime)
{ {
System.out.println("Removing armostand + children");
entity.getPassenger().getPassenger().remove(); entity.getPassenger().getPassenger().remove();
entity.getPassenger().remove(); entity.getPassenger().remove();
entity.remove(); entity.remove();

View File

@ -24,183 +24,151 @@ import mineplex.serverdata.database.column.ColumnVarChar;
public class SiegeWeaponRepository extends MinecraftRepository public class SiegeWeaponRepository extends MinecraftRepository
{ {
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansSiegeWeapons (uniqueId INT NOT NULL," private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansSiegeWeapons (uniqueId INT NOT NULL,"
+ "serverId INT NOT NULL," + "serverId INT NOT NULL,"
+ "location VARCHAR(30)," + "location VARCHAR(30),"
+ "ownerClan INT NOT NULL," + "ownerClan INT NOT NULL,"
+ "weaponType TINYINT NOT NULL," + "weaponType TINYINT NOT NULL,"
+ "health INT NOT NULL," + "health INT NOT NULL,"
+ "yaw INT NOT NULL," + "yaw INT NOT NULL,"
+ "lastFired LONG," + "lastFired LONG,"
+ "entities VARCHAR(200)," + "entities VARCHAR(200),"
+ "PRIMARY KEY (uniqueId));"; + "PRIMARY KEY (uniqueId));";
private static final String GET_WEAPON_BY_ID = "SELECT * FROM clansSiegeWeapons WHERE uniqueId=?;"; private static final String GET_WEAPON_BY_ID = "SELECT * FROM clansSiegeWeapons WHERE uniqueId=?;";
private static final String GET_WEAPONS_BY_CLAN = "SELECT * FROM clansSiegeWeapons WHERE ownerClan=?;"; private static final String GET_WEAPONS_BY_CLAN = "SELECT * FROM clansSiegeWeapons WHERE ownerClan=?;";
private static final String GET_WEAPONS_BY_SERVER = "SELECT * FROM clansSiegeWeapons WHERE serverId=?;"; private static final String GET_WEAPONS_BY_SERVER = "SELECT * FROM clansSiegeWeapons WHERE serverId=?;";
private static final String UPDATE_WEAPON = "UPDATE clansSiegeWeapons SET health=?,yaw=?,lastFired=? WHERE uniqueId=?;"; private static final String UPDATE_WEAPON = "UPDATE clansSiegeWeapons SET health=?,yaw=?,lastFired=? WHERE uniqueId=?;";
private static final String INSERT_WEAPON = "INSERT INTO clansSiegeWeapons VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"; private static final String INSERT_WEAPON = "INSERT INTO clansSiegeWeapons VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
private static final String DELETE_WEAPON = "DELETE FROM clansSiegeWeapons WHERE uniqueId=?;"; private static final String DELETE_WEAPON = "DELETE FROM clansSiegeWeapons WHERE uniqueId=?;";
private SiegeManager _siegeManager; private SiegeManager _siegeManager;
public SiegeWeaponRepository(JavaPlugin plugin, SiegeManager siegeManager) public SiegeWeaponRepository(JavaPlugin plugin, SiegeManager siegeManager)
{ {
super(plugin, DBPool.getAccount()); super(plugin, DBPool.getAccount());
_siegeManager = siegeManager; _siegeManager = siegeManager;
} }
public void deleteWeapon(final int uniqueId) public void deleteWeapon(final int uniqueId)
{ {
System.out.println("Siege Repo> Deleting weapon " + uniqueId); System.out.println("Siege Repo> Deleting weapon " + uniqueId);
_siegeManager.runAsync(() -> _siegeManager.runAsync(() ->
executeUpdate(DELETE_WEAPON, new ColumnInt("uniqueId", uniqueId)) executeUpdate(DELETE_WEAPON, new ColumnInt("uniqueId", uniqueId))
); );
} }
public void getWeaponById(final int uniqueId, final Callback<SiegeWeaponToken> callback) public void getWeaponById(final int uniqueId, final Callback<SiegeWeaponToken> callback)
{ {
_siegeManager.runAsync(() -> _siegeManager.runAsync(() ->
executeQuery(GET_WEAPON_BY_ID, resultSet -> { executeQuery(GET_WEAPON_BY_ID, resultSet -> {
SiegeWeaponToken token = new SiegeWeaponToken(); SiegeWeaponToken token = new SiegeWeaponToken();
resultSet.next(); resultSet.next();
load(token, resultSet); load(token, resultSet);
callback.run(token); callback.run(token);
}, new ColumnInt("uniqueId", uniqueId)) }, new ColumnInt("uniqueId", uniqueId))
); );
} }
public void getWeaponsByServer(final int serverId, final Callback<List<SiegeWeaponToken>> callback) public void getWeaponsByServer(final int serverId, final Callback<List<SiegeWeaponToken>> callback)
{ {
_siegeManager.runAsync(() -> _siegeManager.runAsync(() ->
executeQuery(GET_WEAPONS_BY_SERVER, resultSet -> { executeQuery(GET_WEAPONS_BY_SERVER, resultSet -> {
List<SiegeWeaponToken> tokens = Lists.newArrayList(); List<SiegeWeaponToken> tokens = Lists.newArrayList();
while (resultSet.next()) while (resultSet.next())
{ {
SiegeWeaponToken token = new SiegeWeaponToken(); SiegeWeaponToken token = new SiegeWeaponToken();
load(token, resultSet); load(token, resultSet);
tokens.add(token); tokens.add(token);
} }
callback.run(tokens); callback.run(tokens);
}, new ColumnInt("serverId", serverId)) }, new ColumnInt("serverId", serverId))
); );
} }
public void getWeaponsByClan(final ClanInfo clan, final Callback<List<SiegeWeaponToken>> callback) public void getWeaponsByClan(final ClanInfo clan, final Callback<List<SiegeWeaponToken>> callback)
{ {
_siegeManager.runAsync(() -> _siegeManager.runAsync(() ->
executeQuery(GET_WEAPONS_BY_CLAN, resultSet -> { executeQuery(GET_WEAPONS_BY_CLAN, resultSet -> {
List<SiegeWeaponToken> tokens = Lists.newArrayList(); List<SiegeWeaponToken> tokens = Lists.newArrayList();
while (resultSet.next()) while (resultSet.next())
{ {
SiegeWeaponToken token = new SiegeWeaponToken(); SiegeWeaponToken token = new SiegeWeaponToken();
load(token, resultSet); load(token, resultSet);
tokens.add(token); tokens.add(token);
} }
callback.run(tokens); callback.run(tokens);
}, new ColumnInt("ownerClan", clan.getId())) }, new ColumnInt("ownerClan", clan.getId()))
); );
} }
private void load(SiegeWeaponToken token, ResultSet columns) throws SQLException private void load(SiegeWeaponToken token, ResultSet columns) throws SQLException
{ {
token.UniqueId = columns.getInt("uniqueId"); token.UniqueId = columns.getInt("uniqueId");
token.Location = UtilWorld.strToLoc(columns.getString("location")); token.Location = UtilWorld.strToLoc(columns.getString("location"));
token.OwnerClan = _siegeManager.getClansManager().getClanUtility().getClanById(columns.getInt("ownerClan")); token.OwnerClan = _siegeManager.getClansManager().getClanUtility().getClanById(columns.getInt("ownerClan"));
token.WeaponType = columns.getByte("weaponType"); token.WeaponType = columns.getByte("weaponType");
token.Health = columns.getShort("health"); token.Health = columns.getShort("health");
token.Yaw = columns.getShort("yaw"); token.Yaw = columns.getShort("yaw");
token.LastFired = columns.getTimestamp("lastFired").getTime(); token.LastFired = columns.getTimestamp("lastFired").getTime();
token.Entities = decodeEntities(columns.getString("entities"));
System.out.println("Siege Repo> Loaded weapon " + token.UniqueId); System.out.println("Siege Repo> Loaded weapon " + token.UniqueId);
} }
public void updateWeapon(SiegeWeaponToken token) public void updateWeapon(SiegeWeaponToken token)
{ {
System.out.println("Siege Repo> Updating weapon " + token.UniqueId); System.out.println("Siege Repo> Updating weapon " + token.UniqueId);
_siegeManager.runAsync(() -> _siegeManager.runAsync(() ->
executeUpdate(UPDATE_WEAPON, executeUpdate(UPDATE_WEAPON,
new ColumnInt("health", token.Health), new ColumnInt("health", token.Health),
new ColumnInt("yaw", token.Yaw), new ColumnInt("yaw", token.Yaw),
new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)), new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)),
new ColumnInt("uniqueId", token.UniqueId)) new ColumnInt("uniqueId", token.UniqueId))
); );
} }
public void insertWeapon(SiegeWeaponToken token) public void insertWeapon(SiegeWeaponToken token)
{ {
System.out.println("Siege Repo> Inserting new weapon " + token.UniqueId); System.out.println("Siege Repo> Inserting new weapon " + token.UniqueId);
_siegeManager.runAsync(() -> _siegeManager.runAsync(() ->
executeUpdate(INSERT_WEAPON, executeUpdate(INSERT_WEAPON,
new ColumnInt("uniqueId", token.UniqueId), new ColumnInt("uniqueId", token.UniqueId),
new ColumnInt("serverId", _siegeManager.getClansManager().getServerId()), new ColumnInt("serverId", _siegeManager.getClansManager().getServerId()),
new ColumnVarChar("location", 30, UtilWorld.locToStr(token.Location)), new ColumnVarChar("location", 30, UtilWorld.locToStr(token.Location)),
new ColumnInt("ownerClan", token.OwnerClan.getId()), new ColumnInt("ownerClan", token.OwnerClan.getId()),
new ColumnInt("weaponType", token.WeaponType), new ColumnInt("weaponType", token.WeaponType),
new ColumnInt("health", token.Health), new ColumnInt("health", token.Health),
new ColumnInt("yaw", token.Yaw), new ColumnInt("yaw", token.Yaw),
new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)), new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)),
new ColumnVarChar("entities", 100, encodeEntities(token.Entities))) new ColumnVarChar("entities", 100, ""))
); );
} }
private String encodeEntities(Map<String, String> entities) @Override
{ protected void initialize()
StringBuilder builder = new StringBuilder(); {
int l = 0;
for (String name : entities.keySet())
{
if (l != 0)
{
builder.append(",");
}
builder.append(name + ":" + entities.get(name));
l++;
}
return builder.toString();
}
private Map<String, String> decodeEntities(String data)
{
Map<String, String> map = new HashMap<>();
for (String entries : data.split(","))
{
map.put(entries.split(":")[0], entries.split(":")[1]);
}
return map;
}
@Override
protected void initialize()
{
executeUpdate(CREATE); executeUpdate(CREATE);
} }
@Override @Override
protected void update() protected void update()
{ {
} }
} }

View File

@ -16,6 +16,5 @@ public class SiegeWeaponToken
public int Health; public int Health;
public int Yaw; public int Yaw;
public long LastFired; public long LastFired;
public Map<String, String> Entities;
} }

View File

@ -55,6 +55,13 @@ public class Cannon extends SiegeWeapon
{ {
super(300, "Cannon", token, siegeManager.getClansManager(), siegeManager); super(300, "Cannon", token, siegeManager.getClansManager(), siegeManager);
if (_ownerClan == null)
{
System.out.println("[cannon] owner clan null, killing");
kill();
return;
}
System.out.println("Siege> Loading Cannon from token " + token.UniqueId); System.out.println("Siege> Loading Cannon from token " + token.UniqueId);
setBoundingBox(1); setBoundingBox(1);
@ -107,11 +114,11 @@ public class Cannon extends SiegeWeapon
enableInventory(UtilServer.getServer().createInventory(null, InventoryType.DISPENSER, C.cDAquaB + _name), new AccessRule(AccessType.RCLICK_BB, player -> player.equals(getRider()))); enableInventory(UtilServer.getServer().createInventory(null, InventoryType.DISPENSER, C.cDAquaB + _name), new AccessRule(AccessType.RCLICK_BB, player -> player.equals(getRider())));
setRideable(new AccessRule(AccessType.RCLICK_BB, player -> { setRideable(new AccessRule(AccessType.RCLICK_BB, player -> {
// if (!_ownerClan.isMember(player)) if (!_ownerClan.isMember(player))
// { {
// UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan.")); UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan."));
// return false; return false;
// } }
if (getRider() != null && !getRider().equals(player)) if (getRider() != null && !getRider().equals(player))
{ {
@ -140,7 +147,7 @@ public class Cannon extends SiegeWeapon
setStateInfo("Unloaded", new WeaponStateInfo(Material.SPONGE, (byte) 1)); setStateInfo("Unloaded", new WeaponStateInfo(Material.SPONGE, (byte) 1));
setStateInfo("Loaded", new WeaponStateInfo(Material.SPONGE, (byte) 0)); setStateInfo("Loaded", new WeaponStateInfo(Material.SPONGE, (byte) 0));
loadEntities(); loadEntities(true);
setFirepowerType(Material.SULPHUR); setFirepowerType(Material.SULPHUR);
setAmmunitionType(Material.TNT); setAmmunitionType(Material.TNT);
@ -179,9 +186,9 @@ public class Cannon extends SiegeWeapon
return false; return false;
} }
if (System.currentTimeMillis() - _lastFired < 20000) if (System.currentTimeMillis() - _lastFired < 30000)
{ {
UtilPlayer.message(player, F.main("Clans", "Cannon is cooling down (" + F.time(UtilTime.MakeStr(20000 - (System.currentTimeMillis() - _lastFired))) + ")")); UtilPlayer.message(player, F.main("Clans", "Cannon is cooling down (" + F.time(UtilTime.MakeStr(30000 - (System.currentTimeMillis() - _lastFired))) + ")"));
return false; return false;
} }
@ -191,11 +198,11 @@ public class Cannon extends SiegeWeapon
enableInventory(UtilServer.getServer().createInventory(null, InventoryType.DISPENSER, C.cDAquaB + _name), new AccessRule(AccessType.RCLICK_BB, player -> player.equals(getRider()))); enableInventory(UtilServer.getServer().createInventory(null, InventoryType.DISPENSER, C.cDAquaB + _name), new AccessRule(AccessType.RCLICK_BB, player -> player.equals(getRider())));
setRideable(new AccessRule(AccessType.RCLICK_BB, player -> { setRideable(new AccessRule(AccessType.RCLICK_BB, player -> {
// if (!_ownerClan.isMember(player)) if (!_ownerClan.isMember(player))
// { {
// UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan.")); UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan."));
// return false; return false;
// } }
if (getRider() != null && !getRider().equals(player)) if (getRider() != null && !getRider().equals(player))
{ {
@ -298,7 +305,7 @@ public class Cannon extends SiegeWeapon
return true; // all slots are now filled; slot == 0 || slot == 1 || slot == 2; return true; // all slots are now filled; slot == 0 || slot == 1 || slot == 2;
} }
private void loadEntities() private void loadEntities(boolean insert)
{ {
Slime filler = _location.getWorld().spawn(_location.clone(), Slime.class); Slime filler = _location.getWorld().spawn(_location.clone(), Slime.class);
@ -332,8 +339,10 @@ public class Cannon extends SiegeWeapon
addEntity(weapon, "WEAPON"); addEntity(weapon, "WEAPON");
if (insert)
insert(); {
insert();
}
} }
@Override @Override
@ -341,20 +350,13 @@ public class Cannon extends SiegeWeapon
{ {
Lists.newArrayList(_location.getWorld().getEntities()) Lists.newArrayList(_location.getWorld().getEntities())
.forEach(entity -> { .forEach(entity -> {
for (Entry<String, String> entry : _loadedToken.Entities.entrySet()) if (Integer.toString(_uniqueId).equals(entity.getCustomName()))
{ {
if (entity.getUniqueId().toString().equals(entry.getValue())) entity.remove();
{
addEntity(entity, entry.getKey());
}
} }
}); });
if (getEntity("WEAPON") == null || getEntity("Filler_1") == null || getEntity("PLAYERMOUNT") == null) loadEntities(false);
{
System.out.println("[Cannon] Could not find all entities, killing.");
kill();
}
} }
@Override @Override
@ -428,12 +430,12 @@ public class Cannon extends SiegeWeapon
@EventHandler @EventHandler
public void explosionEffects(SiegeWeaponExplodeEvent event) public void explosionEffects(SiegeWeaponExplodeEvent event)
{ {
for (int i = 0; i < 8; i++) // for (int i = 0; i < 8; i++)
{ // {
// Explosion particle effects. // // Explosion particle effects.
Location point = UtilAlg.getRandomLocation(event.getProjectile().getLocation(), 5); // Location point = UtilAlg.getRandomLocation(event.getProjectile().getLocation(), 5);
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, point, 0, 0, 0, 1, 2, ViewDist.MAX); // UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, point, 0, 0, 0, 1, 2, ViewDist.MAX);
} // }
// Block explosion. // Block explosion.
ArrayList<Block> blocks = new ArrayList<>(); ArrayList<Block> blocks = new ArrayList<>();
@ -449,7 +451,7 @@ public class Cannon extends SiegeWeapon
attempts++; attempts++;
} }
_siegeManager.getClansManager().getExplosion().BlockExplosion( _clans.getExplosion().BlockExplosion(
blocks, blocks,
event.getProjectile().getLocation(), event.getProjectile().getLocation(),
false false

View File

@ -536,6 +536,9 @@ public abstract class SiegeWeapon implements Listener
protected final void addEntity(Entity entity, String uniqueName) protected final void addEntity(Entity entity, String uniqueName)
{ {
entity.setCustomName(Integer.toString(_uniqueId));
entity.setCustomNameVisible(false);
_comprisedOf.add(entity); _comprisedOf.add(entity);
_entityMapping.put(uniqueName, entity); _entityMapping.put(uniqueName, entity);
@ -942,29 +945,19 @@ public abstract class SiegeWeapon implements Listener
token.Location = _location; token.Location = _location;
token.Health = _health; token.Health = _health;
token.Yaw = (int) _yaw; token.Yaw = (int) _yaw;
token.Entities = new HashMap<>();
_entityMapping.entrySet().forEach(entry ->
token.Entities.put(entry.getKey(), entry.getValue().getUniqueId().toString())
);
return token; return token;
} }
public boolean isPartOf(UUID uniqueId) public boolean isPartOf(UUID uniqueId)
{ {
if (_loadedToken == null) for (Entity entity : _comprisedOf)
{ {
for (Entity entity : _comprisedOf) if (entity.getUniqueId().equals(uniqueId))
{ return true;
if (entity.getUniqueId().equals(uniqueId))
return true;
}
return false;
} }
return _loadedToken.Entities.values().contains(uniqueId.toString()); return false;
} }
public void setInvincible(boolean invincible) public void setInvincible(boolean invincible)

View File

@ -26,9 +26,9 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; import mineplex.game.clans.clans.siege.weapon.SiegeWeapon;
import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.ClanTerritory;
import net.minecraft.server.v1_8_R3.Explosion;
public class Crater implements Listener public class Crater implements Listener
{ {
@ -108,124 +108,52 @@ public class Crater implements Listener
return; return;
} }
_blocks.add(new CraterBlock(_origin, 0, Material.AIR)); boolean explosion = _origin.getWorld().createExplosion(_origin, 2.6f);
HashMap<Block, Double> blockList = new HashMap<Block, Double>(); boolean floating = _origin.distance(UtilBlock.nearestFloor(_origin)) > 0.6;
int iR = (int) _size + 1;
for (int x = -iR; x <= iR; x++) if (explosion)
{ {
for (int z = -iR; z <= iR; z++) for (Block block : UtilBlock.getInRadius(_origin.getBlock(), 2.6f).keySet())
{ {
for (int y = -iR; y <= iR; y++) boolean charred = false;
double dist = block.getLocation().distance(_origin);
if (floating)
{ {
Block curBlock = _origin.getBlock().getRelative(x, y, z); if (!block.getRelative(BlockFace.DOWN).getType().equals(CHARRED_TYPE)
&& !block.getRelative(BlockFace.DOWN).getType().equals(Material.AIR)
double offset = UtilMath.offset(_origin, curBlock.getLocation()); && Math.random() > 0.79)
if (offset <= _size)
{ {
blockList.put(curBlock, Double.valueOf(offset)); charred = true;
} }
} }
else
{
if (block.getRelative(BlockFace.UP).getType().equals(Material.AIR)
&& !block.getRelative(BlockFace.DOWN).getType().equals(CHARRED_TYPE)
&& !block.getRelative(BlockFace.DOWN).getType().equals(Material.AIR)
&& Math.random() > 0.79)
{
charred = true;
}
}
if (block.getType().equals(Material.SMOOTH_BRICK))
{
charred = false;
}
if (charred)
{
CraterBlock charredBlock = new CraterBlock(block.getLocation(), dist, CHARRED_TYPE, (byte) 0);
charredBlock.set();
_blocks.add(charredBlock);
}
} }
} }
for (Entry<Block, Double> entry : blockList.entrySet())
{
Block block = entry.getKey();
ClanTerritory territory = _weapon.getClans().getClanUtility().getClaim(block.getLocation());
if (territory != null && !ClansManager.getInstance().getBlacklist().allowed(territory.Owner))
{
continue;
}
double distance = entry.getValue().doubleValue();
boolean air = distance <= _airChance || (Math.random() > (distance) / 3.65d);
if (block.getState() instanceof Chest) continue;
if (block.getType() == Material.AIR) continue;
if (air)
{
_blocks.add(new CraterBlock(block.getLocation(), distance, Material.AIR));
Block above = block;
while (!UtilItem.isBoundless((above = above.getRelative(BlockFace.UP)).getType()))
{
_blocks.add(new CraterBlock(above.getLocation(), distance, Material.AIR));
}
if (!UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType()))
{
if (_fire && Math.random() >= .5)
{
_blocks.add(new CraterBlock(block.getLocation(), distance, Material.FIRE));
}
}
}
}
_blocks.forEach(CraterBlock::set);
for (Entry<Block, Double> entry : blockList.entrySet())
{
Block block = entry.getKey();
ClanTerritory territory = _weapon.getClans().getClanUtility().getClaim(block.getLocation());
if (territory != null && !ClansManager.getInstance().getBlacklist().allowed(territory.Owner))
{
continue;
}
double distance = entry.getValue().doubleValue();
if (block.getType() == Material.AIR) continue;
if (block.getState() instanceof Chest)
{
Chest chest = (Chest) block.getState();
for (ItemStack item : chest.getBlockInventory().getContents())
{
if (item == null)
{
continue;
}
if (item.getType() == Material.AIR)
{
continue;
}
_origin.getWorld().dropItemNaturally(_origin, item);
}
}
if (
distance > _airChance &&
Math.random() > .75 &&
UtilItem.isBoundless(block.getRelative(BlockFace.UP).getType()) &&
!UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType()) &&
!block.getRelative(BlockFace.UP).getType().equals(CHARRED_TYPE) &&
!block.getRelative(BlockFace.DOWN).getType().equals(CHARRED_TYPE))
{
_blocks.add(new CraterBlock(block.getLocation(), distance, CHARRED_TYPE));
if (_fire)
{
_blocks.add(new CraterBlock(block.getRelative(BlockFace.UP).getLocation(), distance, Material.FIRE));
}
}
}
_blocks.forEach(CraterBlock::set);
} }
} }

View File

@ -41,7 +41,7 @@ import mineplex.game.clans.shop.bank.BankShop;
public class GoldManager extends MiniPlugin public class GoldManager extends MiniPlugin
{ {
public static final double GEM_CONVERSION_RATE = 32; // The number of gold coins when converted from a single gem public static final double GEM_CONVERSION_RATE = 16; // The number of gold coins when converted from a single gem
public static final double DEATH_TAX = 0.04d; // Percentage of gold lost on death public static final double DEATH_TAX = 0.04d; // Percentage of gold lost on death
public static final String META_STRING = "clans.goldAmount"; public static final String META_STRING = "clans.goldAmount";

View File

@ -106,7 +106,11 @@ public class Hub extends JavaPlugin implements IRelation
//Other Modules //Other Modules
PacketHandler packetHandler = new PacketHandler(this); PacketHandler packetHandler = new PacketHandler(this);
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, incognito, clientManager, donationManager);
incognito.setPreferencesManager(preferenceManager);
preferenceManager.GiveItem = true; preferenceManager.GiveItem = true;
Creature creature = new Creature(this); Creature creature = new Creature(this);
NpcManager npcManager = new NpcManager(this, creature); NpcManager npcManager = new NpcManager(this, creature);
@ -140,7 +144,6 @@ public class Hub extends JavaPlugin implements IRelation
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler);
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager); new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());

View File

@ -57,7 +57,7 @@ public class StaffServer extends JavaPlugin
Punish punish = new Punish(this, webServerAddress, clientManager); Punish punish = new Punish(this, webServerAddress, clientManager);
new NpcManager(this, new Creature(this)); new NpcManager(this, new Creature(this));
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); PreferencesManager preferenceManager = new PreferencesManager(this, null, clientManager, donationManager);
preferenceManager.GiveItem = false; preferenceManager.GiveItem = false;
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());

View File

@ -109,15 +109,19 @@ public class Arcade extends JavaPlugin
_serverConfiguration = new ServerConfiguration(this, _clientManager); _serverConfiguration = new ServerConfiguration(this, _clientManager);
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); PacketHandler packetHandler = new PacketHandler(this);
IncognitoManager incognito = new IncognitoManager(this, _clientManager, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, incognito, _clientManager, _donationManager);
incognito.setPreferencesManager(preferenceManager);
Creature creature = new Creature(this); Creature creature = new Creature(this);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager); LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager);
Teleport teleport = new Teleport(this, _clientManager); Teleport teleport = new Teleport(this, _clientManager);
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());
PacketHandler packetHandler = new PacketHandler(this);
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
@ -128,8 +132,6 @@ public class Arcade extends JavaPlugin
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager); AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
AntiHack.Instance.setKick(false); AntiHack.Instance.setKick(false);
IncognitoManager incognito = new IncognitoManager(this, _clientManager, packetHandler);
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, _clientManager); StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);