Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
Conflicts: Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java
This commit is contained in:
commit
9bbac7578e
Binary file not shown.
@ -0,0 +1,82 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000 extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private RankBenefitsGiver9000Repository _repository;
|
||||
|
||||
private HashSet<String> _playersNeedingBenefit = new HashSet<String>();
|
||||
|
||||
public RankBenefitsGiver9000(JavaPlugin plugin, CoreClientManager clientManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("RankBenefitsGiver9000", plugin);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
_repository = new RankBenefitsGiver9000Repository(plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void loadPlayer(RetrieveClientInformationEvent event)
|
||||
{
|
||||
boolean treasureUpdate = false;
|
||||
|
||||
for (String benefit : _repository.retrievePlayerBenefits(event.getUniqueId().toString()))
|
||||
{
|
||||
if (benefit.equalsIgnoreCase("TreasureUpdate"))
|
||||
treasureUpdate = true;
|
||||
}
|
||||
|
||||
if (!treasureUpdate)
|
||||
{
|
||||
_playersNeedingBenefit.add(event.getPlayerName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void giveBenefit(final PlayerJoinEvent event)
|
||||
{
|
||||
if (!_playersNeedingBenefit.contains(event.getPlayer().getName()))
|
||||
return;
|
||||
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ALL)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 1);
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 1);
|
||||
}
|
||||
else if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ULTRA)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 20);
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 40);
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 10);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.addBenefit(event.getPlayer().getUniqueId().toString(), "TreasureUpdate");
|
||||
}
|
||||
});
|
||||
|
||||
_playersNeedingBenefit.remove(event.getPlayer().getName());
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000Repository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), benefit VARCHAR(100), PRIMARY KEY (id), INDEX rankUuid (uuid));";
|
||||
|
||||
private static String INSERT_BENEFIT = "INSERT INTO rankBenefits (uuid, benefit) VALUES (?, ?);";
|
||||
private static String RETRIEVE_BENEFITS = "SELECT benefit FROM rankBenefits WHERE uuid = ?;";
|
||||
|
||||
public RankBenefitsGiver9000Repository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
executeUpdate(CREATE_BENEFIT_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
|
||||
public List<String> retrievePlayerBenefits(String uuid)
|
||||
{
|
||||
final List<String> benefits = new ArrayList<String>();
|
||||
|
||||
executeQuery(RETRIEVE_BENEFITS, new ResultSetCallable()
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
benefits.add(resultSet.getString(1));
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid));
|
||||
|
||||
return benefits;
|
||||
}
|
||||
|
||||
public void addBenefit(String uuid, String benefit)
|
||||
{
|
||||
executeUpdate(INSERT_BENEFIT, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("benefit", 100, benefit));
|
||||
}
|
||||
}
|
@ -168,9 +168,38 @@ public class CoreClientManager extends MiniPlugin
|
||||
client.SetAccountId(token.AccountId);
|
||||
client.SetRank(Rank.valueOf(token.Rank));
|
||||
|
||||
final RetrieveClientInformationEvent clientInformationEvent = new RetrieveClientInformationEvent(client.GetPlayerName(), uuid);
|
||||
clientInformationEvent.incrementProcessingCount();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_mysqlRepository.login(uuid.toString(), client.GetPlayerName());
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(clientInformationEvent);
|
||||
clientInformationEvent.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
|
||||
// JSON sql response
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response));
|
||||
|
||||
// Load client in miniplugins
|
||||
Bukkit.getServer().getPluginManager().callEvent(new AsyncClientLoadEvent(token, client));
|
||||
|
||||
while (clientInformationEvent.processing())
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(1);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
|
@ -10,13 +10,11 @@ public class CloseButton implements IButton
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 13");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 19");
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
System.out.println("Added treasure key");
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Treasure", "Treasure Key", 1);
|
||||
Refresh();
|
||||
}
|
||||
|
@ -426,7 +426,6 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
{
|
||||
_plugin.AddPunishment(_target, category, _reason, _player, severity, ban, punishTime);
|
||||
_player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 429");
|
||||
ClosePunish();
|
||||
}
|
||||
|
||||
@ -452,7 +451,6 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
{
|
||||
punishment.Remove(_player.getName(), _reason);
|
||||
_player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 455");
|
||||
ClosePunish();
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,6 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
|
||||
|
||||
event.getPlayer().closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 184");
|
||||
CloseShopForPlayer(event.getPlayer());
|
||||
|
||||
PlayerPageMap.remove(event.getPlayer().getName());
|
||||
|
@ -106,7 +106,6 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
||||
else
|
||||
{
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 109");
|
||||
}
|
||||
|
||||
}
|
||||
@ -292,7 +291,6 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
||||
else if (Player != null)
|
||||
{
|
||||
Player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 291");
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -2,7 +2,6 @@ package mineplex.core.status;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -21,8 +20,8 @@ import mineplex.serverdata.ServerRepository;
|
||||
|
||||
public class ServerStatusManager extends MiniPlugin
|
||||
{
|
||||
// The default timeout (in milliseconds) before the ServerStatus expires.
|
||||
public final int DEFAULT_SERVER_TIMEOUT = 15000;
|
||||
// The default timeout (in seconds) before the ServerStatus expires.
|
||||
public final int DEFAULT_SERVER_TIMEOUT = 15;
|
||||
|
||||
private ServerRepository _repository;
|
||||
private LagMeter _lagMeter;
|
||||
@ -30,35 +29,25 @@ public class ServerStatusManager extends MiniPlugin
|
||||
private String _name;
|
||||
private boolean _us;
|
||||
|
||||
private boolean _alternateSeconds;
|
||||
private boolean _enabled = true;
|
||||
|
||||
private long _startUpDate;
|
||||
|
||||
|
||||
public ServerStatusManager(JavaPlugin plugin, LagMeter lagMeter)
|
||||
{
|
||||
super("Server Status Manager", plugin);
|
||||
|
||||
this._startUpDate = System.currentTimeMillis();
|
||||
|
||||
_lagMeter = lagMeter;
|
||||
|
||||
if (new File("IgnoreUpdates.dat").exists())
|
||||
_enabled = false;
|
||||
|
||||
ServerListPingEvent event = new ServerListPingEvent(null, plugin.getServer().getMotd(), plugin.getServer().getOnlinePlayers().size(), plugin.getServer().getMaxPlayers());
|
||||
|
||||
GetPluginManager().callEvent(event);
|
||||
|
||||
setupConfigValues();
|
||||
|
||||
String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp();
|
||||
|
||||
_name = plugin.getConfig().getString("serverstatus.name");
|
||||
_us = plugin.getConfig().getBoolean("serverstatus.us");
|
||||
|
||||
Region region = _us ? Region.US : Region.EU;
|
||||
_repository = ServerManager.getServerRepository(region);
|
||||
saveServerStatus();
|
||||
}
|
||||
|
||||
private void setupConfigValues()
|
||||
@ -116,11 +105,6 @@ public class ServerStatusManager extends MiniPlugin
|
||||
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
_alternateSeconds = !_alternateSeconds;
|
||||
|
||||
if (!_alternateSeconds)
|
||||
return;
|
||||
|
||||
saveServerStatus();
|
||||
}
|
||||
@ -136,7 +120,7 @@ public class ServerStatusManager extends MiniPlugin
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.updataServerStatus(serverSnapshot, 15000);
|
||||
_repository.updataServerStatus(serverSnapshot, DEFAULT_SERVER_TIMEOUT);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -161,7 +145,7 @@ public class ServerStatusManager extends MiniPlugin
|
||||
int maxRam = (int) (Runtime.getRuntime().maxMemory() / 1048576);
|
||||
|
||||
return new MinecraftServer(_name, group, motd, address, port, playerCount,
|
||||
maxPlayerCount, tps, ram, maxRam, _startUpDate);
|
||||
maxPlayerCount, tps, ram, maxRam, 0L);
|
||||
}
|
||||
|
||||
public String getCurrentServerName()
|
||||
|
@ -39,4 +39,10 @@ public class BlockInfo
|
||||
{
|
||||
return _block.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return _block.equals(obj);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.RankBenefitsGiver9000;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
@ -159,6 +160,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
|
||||
_inventoryManager = new InventoryManager(plugin);
|
||||
new RankBenefitsGiver9000(plugin, clientManager, _inventoryManager);
|
||||
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
|
||||
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager, petManager);
|
||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, false, _treasureManager);
|
||||
|
@ -85,7 +85,7 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
if (_polls.size() == 0)
|
||||
if (_polls == null || _polls.size() == 0)
|
||||
return;
|
||||
|
||||
for (Player player : _plugin.getServer().getOnlinePlayers())
|
||||
|
@ -185,9 +185,9 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
int greenStartSlot = 18 + ((9 - serversToShow) / 2);
|
||||
boolean showGreen = true;
|
||||
|
||||
boolean beta = serverList.size() > 0 && serverList.get(0).Name.contains("BETA");
|
||||
boolean beta = serverList.size() > 0 && (serverList.get(0).Name.contains("BETA") || serverList.get(0).Name.contains("MS-"));
|
||||
boolean tournament = serverList.size() > 0 && serverList.get(0).Name.contains("T_");
|
||||
boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverList.get(0).ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA);
|
||||
boolean ownsUltraPackage = Client.GetRank().Has(Rank.ULTRA) || (serverList.size() > 0 && DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverList.get(0).ServerType + " ULTRA"));
|
||||
|
||||
long portalTime = Plugin.getMillisecondsUntilPortal(Player, beta);
|
||||
if (portalTime > 0)
|
||||
|
@ -51,13 +51,13 @@ public class ServerGroup
|
||||
public boolean getArcadeGroup() { return _arcadeGroup; }
|
||||
|
||||
private String _worldZip;
|
||||
public String getWorldZip() { return _serverType; }
|
||||
public String getWorldZip() { return _worldZip; }
|
||||
|
||||
private String _plugin;
|
||||
public String getPlugin() { return _serverType; }
|
||||
public String getPlugin() { return _plugin; }
|
||||
|
||||
private String _configPath;
|
||||
public String getConfigPath() { return _serverType; }
|
||||
public String getConfigPath() { return _configPath; }
|
||||
|
||||
private int _minPlayers;
|
||||
public int getMinPlayers() { return _minPlayers; }
|
||||
@ -71,6 +71,42 @@ public class ServerGroup
|
||||
private boolean _tournament;
|
||||
public boolean getTournament() { return _tournament; }
|
||||
|
||||
private boolean _teamRejoin;
|
||||
public boolean getTeamRejoin() { return _teamRejoin; }
|
||||
|
||||
private boolean _teamAutoJoin;
|
||||
public boolean getTeamAutoJoin() { return _teamAutoJoin; }
|
||||
|
||||
private boolean _teamForceBalance;
|
||||
public boolean getTeamForceBalance() { return _teamForceBalance; }
|
||||
|
||||
private boolean _gameAutoStart;
|
||||
public boolean getGameAutoStart() { return _gameAutoStart; }
|
||||
|
||||
private boolean _gameTimeout;
|
||||
public boolean getGameTimeout() { return _gameTimeout; }
|
||||
|
||||
private boolean _rewardGems;
|
||||
public boolean getRewardGems() { return _rewardGems; }
|
||||
|
||||
private boolean _rewardItems;
|
||||
public boolean getRewardItems() { return _rewardItems; }
|
||||
|
||||
private boolean _rewardStats;
|
||||
public boolean getRewardStats() { return _rewardStats; }
|
||||
|
||||
private boolean _rewardAchievements;
|
||||
public boolean getRewardAchievements() { return _rewardAchievements; }
|
||||
|
||||
private boolean _hotbarInventory;
|
||||
public boolean getHotbarInventory() { return _hotbarInventory; }
|
||||
|
||||
private boolean _hotbarHubClock;
|
||||
public boolean getHotbarHubClock() { return _hotbarHubClock; }
|
||||
|
||||
private boolean _playerKickIdle;
|
||||
public boolean getPlayerKickIdle() { return _playerKickIdle; }
|
||||
|
||||
private boolean _generateFreeVersions;
|
||||
public boolean getGenerateFreeVersions() { return _generateFreeVersions; }
|
||||
|
||||
@ -84,7 +120,8 @@ public class ServerGroup
|
||||
public boolean getAddNoCheat() { return _addNoCheat; }
|
||||
|
||||
// The set of active MinecraftServers that belong to this server group
|
||||
private Set<MinecraftServer> servers;
|
||||
private Set<MinecraftServer> _servers;
|
||||
public Set<MinecraftServer> getServers() { return _servers; }
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
@ -94,26 +131,38 @@ public class ServerGroup
|
||||
*/
|
||||
public ServerGroup(Map<String, String> data, Region region)
|
||||
{
|
||||
this._name = data.get("name");
|
||||
this._prefix = data.get("prefix");
|
||||
this._scriptName = data.get("scriptName");
|
||||
this._requiredRam = Integer.valueOf(data.get("ram"));
|
||||
this._requiredCpu = Integer.valueOf(data.get("cpu"));
|
||||
this._requiredTotalServers = Integer.valueOf(data.get("totalServers"));
|
||||
this._requiredJoinableServers = Integer.valueOf(data.get("joinableServers"));
|
||||
this._portSection = Integer.valueOf(data.get("portSection"));
|
||||
this._arcadeGroup = Boolean.valueOf(data.get("arcadeGroup"));
|
||||
this._worldZip = data.get("worldZip");
|
||||
this._plugin = data.get("plugin");
|
||||
this._configPath = data.get("configPath");
|
||||
this._minPlayers = Integer.valueOf(data.get("minPlayers"));
|
||||
this._maxPlayers = Integer.valueOf(data.get("maxPlayers"));
|
||||
this._pvp = Boolean.valueOf(data.get("pvp"));
|
||||
this._tournament = Boolean.valueOf(data.get("tournament"));
|
||||
this._generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions"));
|
||||
this._games = data.get("games");
|
||||
this._serverType = data.get("serverType");
|
||||
this._addNoCheat = Boolean.valueOf(data.get("addNoCheat"));
|
||||
_name = data.get("name");
|
||||
_prefix = data.get("prefix");
|
||||
_scriptName = data.get("scriptName");
|
||||
_requiredRam = Integer.valueOf(data.get("ram"));
|
||||
_requiredCpu = Integer.valueOf(data.get("cpu"));
|
||||
_requiredTotalServers = Integer.valueOf(data.get("totalServers"));
|
||||
_requiredJoinableServers = Integer.valueOf(data.get("joinableServers"));
|
||||
_portSection = Integer.valueOf(data.get("portSection"));
|
||||
_arcadeGroup = Boolean.valueOf(data.get("arcadeGroup"));
|
||||
_worldZip = data.get("worldZip");
|
||||
_plugin = data.get("plugin");
|
||||
_configPath = data.get("configPath");
|
||||
_minPlayers = Integer.valueOf(data.get("minPlayers"));
|
||||
_maxPlayers = Integer.valueOf(data.get("maxPlayers"));
|
||||
_pvp = Boolean.valueOf(data.get("pvp"));
|
||||
_tournament = Boolean.valueOf(data.get("tournament"));
|
||||
_generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions"));
|
||||
_games = data.get("games");
|
||||
_serverType = data.get("serverType");
|
||||
_addNoCheat = Boolean.valueOf(data.get("addNoCheat"));
|
||||
_teamRejoin = Boolean.valueOf(data.get("teamRejoin"));
|
||||
_teamAutoJoin = Boolean.valueOf(data.get("teamAutoJoin"));
|
||||
_teamForceBalance = Boolean.valueOf(data.get("teamForceBalance"));
|
||||
_gameAutoStart = Boolean.valueOf(data.get("gameAutoStart"));
|
||||
_gameTimeout = Boolean.valueOf(data.get("gameTimeout"));
|
||||
_rewardGems = Boolean.valueOf(data.get("rewardGems"));
|
||||
_rewardItems = Boolean.valueOf(data.get("rewardItems"));
|
||||
_rewardStats = Boolean.valueOf(data.get("rewardStats"));
|
||||
_rewardAchievements = Boolean.valueOf(data.get("rewardAchievements"));
|
||||
_hotbarInventory = Boolean.valueOf(data.get("hotbarInventory"));
|
||||
_hotbarHubClock = Boolean.valueOf(data.get("hotbarHubClock"));
|
||||
_playerKickIdle = Boolean.valueOf(data.get("playerKickIdle"));
|
||||
|
||||
fetchServers(region);
|
||||
}
|
||||
@ -124,7 +173,7 @@ public class ServerGroup
|
||||
*/
|
||||
public int getServerCount()
|
||||
{
|
||||
return servers.size();
|
||||
return _servers.size();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +184,7 @@ public class ServerGroup
|
||||
{
|
||||
int joinable = 0;
|
||||
|
||||
for (MinecraftServer server : servers)
|
||||
for (MinecraftServer server : _servers)
|
||||
{
|
||||
if (server.isJoinable())
|
||||
{
|
||||
@ -154,7 +203,7 @@ public class ServerGroup
|
||||
{
|
||||
int playerCount = 0;
|
||||
|
||||
for (MinecraftServer server : servers)
|
||||
for (MinecraftServer server : _servers)
|
||||
{
|
||||
playerCount += server.getPlayerCount();
|
||||
}
|
||||
@ -170,7 +219,7 @@ public class ServerGroup
|
||||
{
|
||||
int maxPlayerCount = 0;
|
||||
|
||||
for (MinecraftServer server : servers)
|
||||
for (MinecraftServer server : _servers)
|
||||
{
|
||||
maxPlayerCount += server.getMaxPlayerCount();
|
||||
}
|
||||
@ -186,7 +235,7 @@ public class ServerGroup
|
||||
{
|
||||
Collection<MinecraftServer> emptyServers = new HashSet<MinecraftServer>();
|
||||
|
||||
for (MinecraftServer server : servers)
|
||||
for (MinecraftServer server : _servers)
|
||||
{
|
||||
if (server.isEmpty() && server.getUptime() <= 150) // Only return empty servers that have been online for >150 seconds
|
||||
{
|
||||
@ -203,14 +252,14 @@ public class ServerGroup
|
||||
*/
|
||||
private void fetchServers(Region region)
|
||||
{
|
||||
this.servers = new HashSet<MinecraftServer>();
|
||||
this._servers = new HashSet<MinecraftServer>();
|
||||
ServerRepository repository = ServerManager.getServerRepository(region);
|
||||
|
||||
for (MinecraftServer server : repository.getServerStatuses())
|
||||
{
|
||||
if (_name.equals(server.getGroup()))
|
||||
if (_name.equalsIgnoreCase(server.getGroup()))
|
||||
{
|
||||
servers.add(server);
|
||||
_servers.add(server);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,15 +267,15 @@ public class ServerGroup
|
||||
/**
|
||||
* @return a unique server name suffix id, unique to any servers in this ServerGroup.
|
||||
*/
|
||||
public int generateUniqueId()
|
||||
public int generateUniqueId(int startId)
|
||||
{
|
||||
int id = 0;
|
||||
int id = startId;
|
||||
|
||||
while (true)
|
||||
{
|
||||
boolean uniqueId = true;
|
||||
|
||||
for (MinecraftServer server : servers)
|
||||
for (MinecraftServer server : _servers)
|
||||
{
|
||||
String serverName = server.getName();
|
||||
try
|
||||
@ -255,5 +304,4 @@ public class ServerGroup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.join.JoinQuit;
|
||||
import mineplex.core.memory.MemoryFix;
|
||||
import mineplex.core.monitor.LagMeter;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
|
@ -19,6 +19,7 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -99,21 +100,49 @@ public class CustomerSupport extends MiniPlugin
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
|
||||
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name));
|
||||
caller.sendMessage(C.cBlue + "Transactions : ");
|
||||
caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins());
|
||||
caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems());
|
||||
|
||||
int coinTransactionTotal = 0;
|
||||
int enjinCoinsReceived = 0;
|
||||
int coinSpentTotal = 0;
|
||||
|
||||
int enjinBoostersReceived = 0;
|
||||
|
||||
for (CoinTransactionToken transaction : donor.getCoinTransactions())
|
||||
{
|
||||
if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward"))
|
||||
continue;
|
||||
|
||||
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins - Applied via " + transaction.Source);
|
||||
if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase"))
|
||||
{
|
||||
coinTransactionTotal += transaction.Amount;
|
||||
|
||||
if (transaction.Source.contains("purchase"))
|
||||
enjinCoinsReceived += transaction.Amount;
|
||||
}
|
||||
}
|
||||
|
||||
for (TransactionToken transaction : donor.getTransactions())
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0 && transaction.SalesPackageName.contains("Gem Booster"))
|
||||
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.SalesPackageName);
|
||||
coinSpentTotal += transaction.Coins;
|
||||
|
||||
if (transaction.SalesPackageName.contains("Gem Booster"))
|
||||
{
|
||||
if (transaction.SalesPackageName.startsWith("Gem Booster") && transaction.Coins == 0 && transaction.Gems == 0 && transaction.SalesPackageName.split(" ").length == 3)
|
||||
enjinBoostersReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Enjin Booster Total Received : " + C.cYellow + enjinBoostersReceived);
|
||||
|
||||
int coinsMissing = coinTransactionTotal - (donor.getCoins() + coinSpentTotal);
|
||||
|
||||
if (coinsMissing > 0)
|
||||
{
|
||||
caller.sendMessage(C.cRed + "Coins missing!");
|
||||
new JsonMessage("[").color("blue").extra(C.cGreen + "Apply Missing Coins").color("green").click("run_command", "/sales coin " + playerName + " " + coinsMissing)
|
||||
.add("] ").color("blue").add("Missing Coins.").color("yellow").sendToPlayer(caller);
|
||||
}
|
||||
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
_salesPackageManager.displaySalesPackages(caller, playerName);
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
|
@ -95,6 +95,5 @@ public class TeamArmorAddon extends MiniPlugin
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 103");
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ public class ChampionsDominate extends Domination
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 64");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,6 @@ public class ChampionsTDM extends TeamDeathmatch
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 61");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,6 @@ public class TeamDeathmatch extends TeamGame
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 167");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1175,8 +1175,6 @@ public class MineStrike extends TeamGame
|
||||
|
||||
public int getArrowHitArea(Player damagee, Location origin, Vector trajectory)
|
||||
{
|
||||
System.out.println("Getting Area");
|
||||
|
||||
//Move to near-player
|
||||
Location start = origin.clone().add(trajectory.clone().multiply(UtilMath.offset(origin, damagee.getEyeLocation()) - 2));
|
||||
|
||||
@ -1189,19 +1187,15 @@ public class MineStrike extends TeamGame
|
||||
|
||||
if (hitHead(damagee, loc))
|
||||
{
|
||||
System.out.println("Head");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (hitBody(damagee, loc))
|
||||
{
|
||||
System.out.println("Body");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
System.out.println("Miss");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -473,14 +473,12 @@ public class Paintball extends TeamGame
|
||||
|
||||
for (ItemStack stack : player.getEquipment().getArmorContents())
|
||||
{
|
||||
System.out.println("Type:" + stack.getType() + " Meta:" + stack.getItemMeta());
|
||||
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
|
||||
continue;
|
||||
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
|
||||
meta.setColor(color);
|
||||
stack.setItemMeta(meta);
|
||||
System.out.println("Changed leather meta for " + player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,5 @@ public class KitRifle extends Kit
|
||||
metaBoots.setColor(Color.WHITE);
|
||||
boots.setItemMeta(metaBoots);
|
||||
player.getInventory().setBoots(boots);
|
||||
|
||||
System.out.println("Game kit items to " + player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,6 @@ public class GameFlagManager implements Listener
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 267");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1194,7 +1194,6 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 1150");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,14 @@
|
||||
const string PREFIX = "CommitChanges() failed because: ";
|
||||
try
|
||||
{
|
||||
Context.SaveChanges();
|
||||
if (Context.SaveChanges() == 0)
|
||||
Log("WARNING", "No entities to save: " + Environment.StackTrace);
|
||||
/*
|
||||
* List<Object> modifiedOrAddedEntities = context.ChangeTracker.Entries()
|
||||
.Where(x => x.State == System.Data.EntityState.Modified
|
||||
|| x.State == System.Data.EntityState.Added)
|
||||
.Select(x=>x.Entity).ToList();
|
||||
* */
|
||||
}
|
||||
catch (DbEntityValidationException ex)
|
||||
{
|
||||
|
@ -559,17 +559,12 @@
|
||||
if (rank == null)
|
||||
return account.Rank.ToString();
|
||||
|
||||
repository.Attach(account);
|
||||
repository.Edit(account);
|
||||
|
||||
var expire = DateTime.Now.AddMonths(1).AddMilliseconds(-DateTime.Now.Millisecond);
|
||||
|
||||
account.Rank = rank;
|
||||
account.RankExpire = expire;
|
||||
account.RankPerm = token.Perm;
|
||||
|
||||
repository.CommitChanges();
|
||||
|
||||
repository.Edit(account);
|
||||
|
||||
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm)
|
||||
|
@ -21,12 +21,15 @@
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateRepository())
|
||||
{
|
||||
bool added = false;
|
||||
foreach (var item in petTokens.Where(item => !repository.Any<Pet>(x => x.PetType == item.PetType)))
|
||||
{
|
||||
repository.Add(item);
|
||||
added = true;
|
||||
}
|
||||
|
||||
repository.CommitChanges();
|
||||
if (added)
|
||||
repository.CommitChanges();
|
||||
|
||||
return repository.GetAll<Pet>().Include(x => x.SalesPackage).ToList();
|
||||
}
|
||||
@ -36,12 +39,15 @@
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateRepository())
|
||||
{
|
||||
bool added = false;
|
||||
foreach (var item in petExtraTokens.Where(item => !repository.Any<PetExtra>(x => x.Name == item.Name && x.Material == item.Material)))
|
||||
{
|
||||
repository.Add(item);
|
||||
added = true;
|
||||
}
|
||||
|
||||
repository.CommitChanges();
|
||||
if (added)
|
||||
repository.CommitChanges();
|
||||
|
||||
return repository.GetAll<PetExtra>().Include(x => x.SalesPackage).ToList();
|
||||
}
|
||||
@ -72,10 +78,12 @@
|
||||
return;
|
||||
|
||||
var pet = account.Pets.FirstOrDefault(x => x.PetType.Equals(token.PetType));
|
||||
|
||||
|
||||
if (pet == null)
|
||||
return;
|
||||
|
||||
account.Pets.RemoveAll(x => x.PetType.Equals(token.PetType) && x.OwnedPetId != pet.OwnedPetId);
|
||||
|
||||
pet.PetName = token.PetName;
|
||||
|
||||
repository.Edit(pet);
|
||||
|
@ -35,12 +35,15 @@
|
||||
{
|
||||
using (var repository = RepositoryFactory.CreateRepository())
|
||||
{
|
||||
bool added = false;
|
||||
foreach (var skill in skills.Where(skill => !repository.Any<Skill>(x => x.Name == skill.Name && x.Level == skill.Level)))
|
||||
{
|
||||
repository.Add(skill);
|
||||
added = true;
|
||||
}
|
||||
|
||||
repository.CommitChanges();
|
||||
if (added)
|
||||
repository.CommitChanges();
|
||||
|
||||
return repository.GetAll<Skill>().Include(x => x.SalesPackage).ToList();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user