Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Chiss 2014-12-02 09:50:47 +11:00
commit 6319bffd42
13 changed files with 88 additions and 115 deletions

View File

@ -297,8 +297,10 @@ public class AntiHack extends MiniPlugin
synchronized (_antiHackLock)
{
for (Player player : _offense.keySet())
for (Iterator<Player> playerIterator = _offense.keySet().iterator(); playerIterator.hasNext();)
{
Player player = playerIterator.next();
String out = "";
int total = 0;
@ -332,6 +334,9 @@ public class AntiHack extends MiniPlugin
//Send Report
sendReport(player, out, severity);
if (severity.equalsIgnoreCase("Extreme"))
playerIterator.remove();
}
}
}
@ -340,7 +345,7 @@ public class AntiHack extends MiniPlugin
{
if (severity.equals("Extreme"))
{
ResetAll(player);
ResetAll(player, false);
//Staff
boolean handled = false;
@ -416,6 +421,11 @@ public class AntiHack extends MiniPlugin
}
private void ResetAll(Player player)
{
ResetAll(player, true);
}
private void ResetAll(Player player, boolean removeOffenses)
{
synchronized (_antiHackLock)
{
@ -423,7 +433,7 @@ public class AntiHack extends MiniPlugin
_velocityEvent.remove(player);
_lastMoveEvent.remove(player);
if (removeOffenses)
_offense.remove(player);
for (Detector detector : _movementDetectors)

View File

@ -38,12 +38,7 @@ public class CosmeticManager extends MiniPlugin
private boolean _showInterface = true;
private int _interfaceSlot = 4;
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, boolean useBooster)
{
this(plugin, clientManager, donationManager, inventoryManager, gadgetManager, mountManager, petManager, useBooster, null);
}
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, boolean useBooster, TreasureManager treasureManager)
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, TreasureManager treasureManager)
{
super("Cosmetic Manager", plugin);
@ -53,7 +48,7 @@ public class CosmeticManager extends MiniPlugin
_petManager = petManager;
_treasureManager = treasureManager;
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName, useBooster);
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName);
}
public void showInterface(boolean showInterface)

View File

@ -20,13 +20,10 @@ import mineplex.core.updater.event.UpdateEvent;
public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener
{
private boolean _useBooster;
public CosmeticShop(CosmeticManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name, boolean useBooster)
public CosmeticShop(CosmeticManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
{
super(plugin, clientManager, donationManager, name, CurrencyType.Gems, CurrencyType.Coins);
_useBooster = useBooster;
plugin.GetPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.GetPlugin(), "MC|ItemName", this);
}
@ -71,9 +68,4 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
((TreasurePage) shop).update();
}
}
public boolean getBoosterEnabled()
{
return _useBooster;
}
}

View File

@ -2,7 +2,6 @@ package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -13,7 +12,6 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.OpenCostumes;
import mineplex.core.cosmetic.ui.button.OpenGadgets;
@ -28,7 +26,6 @@ import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.inventory.GemBooster;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ConfirmationPage;
@ -109,56 +106,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
}
AddButton(4, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGreen + C.Bold + "Treasure Chest", lore.toArray(new String[0]), 1, false), new TreasureButton(this, treasureChestCount > 0, treasureKeyCount > 0, canPurchaseKey));
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));
if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins)
|| (Shop.getBoosterEnabled() && Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster") > 0))
{
AddButton(6, new ShopItem(
gemBoosterItem.GetDisplayMaterial(),
gemBoosterItem.GetDisplayName(),
gemBoosterItem.GetDescription(),
1,
false),
new IButton()
{
@Override
public void ClickedLeft(Player player)
{
if (Shop.getBoosterEnabled() && Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster") > 0)
{
ActivateGemBoosterEvent boosterEvent = new ActivateGemBoosterEvent(player);
Bukkit.getServer().getPluginManager().callEvent(boosterEvent);
if (!boosterEvent.isCancelled())
Plugin.getInventoryManager().addItemToInventory(null, Player, "Utility", "Gem Booster", -1);
}
else
{
purchaseGemBooster(gemBoosterItem, player);
}
}
@Override
public void ClickedRight(Player player)
{
purchaseGemBooster(gemBoosterItem, player);
}
}
);
}
else
{
AddItem(6, new ShopItem(
gemBoosterItem.GetDisplayMaterial(),
gemBoosterItem.GetDisplayName(),
gemBoosterItem.GetDescription(),
1,
false));
}
AddButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
AddButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
AddButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));

View File

@ -6,7 +6,6 @@ import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.database.DatabaseRunnable;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt;
@ -23,9 +22,7 @@ public class DonationRepository extends RepositoryBase
private static String CREATE_COIN_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountCoinTransactions (id INT NOT NULL AUTO_INCREMENT, accounts_uuid VARCHAR(100), reason VARCHAR(100), coins INT, PRIMARY KEY (id), FOREIGN KEY (accounts_uuid) REFERENCES accounts(uuid), INDEX coinUuidIndex (accounts_uuid));";
private static String CREATE_GEM_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountGemTransactions (id INT NOT NULL AUTO_INCREMENT, accounts_uuid VARCHAR(100), reason VARCHAR(100), gems INT, PRIMARY KEY (id), FOREIGN KEY (accounts_uuid) REFERENCES accounts(uuid), INDEX gemUuidIndex (accounts_uuid));";
private static String INSERT_COIN_TRANSACTION = "INSERT INTO accountCoinTransactions(accounts_uuid, reason, coins) VALUES(?, ?, ?);";
private static String INSERT_GEM_TRANSACTION = "INSERT INTO accountGemTransactions(accounts_uuid, reason, gems) VALUES(?, ?, ?);";
private static String UPDATE_ACCOUNT_COINS = "UPDATE accounts SET coins = coins + ? WHERE uuid = ?;";
private static String UPDATE_ACCOUNT_GEMS = "UPDATE accounts SET gems = gems + ? WHERE uuid = ?;";
private static String UPDATE_NULL_ACCOUNT_GEMS_AND_COINS_ = "UPDATE accounts SET gems = ?, coins = ? WHERE uuid = ? AND gems IS NULL AND coins IS NULL;";
private String _webAddress;
@ -48,9 +45,6 @@ public class DonationRepository extends RepositoryBase
{
public void run(final TransactionResponse response)
{
if (response == TransactionResponse.Success)
executeUpdate(UPDATE_ACCOUNT_GEMS, new ColumnInt("gems", cost), new ColumnVarChar("uuid", 100, uuid));
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable()
{
@Override
@ -91,11 +85,6 @@ public class DonationRepository extends RepositoryBase
executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", -cost), new ColumnVarChar("uuid", 100, uuid));
executeUpdate(INSERT_COIN_TRANSACTION, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("reason", 100, "Purchased " + packageName), new ColumnInt("coins", -cost));
}
else
{
executeUpdate(UPDATE_ACCOUNT_GEMS, new ColumnInt("gems", -cost), new ColumnVarChar("uuid", 100, uuid));
executeUpdate(INSERT_GEM_TRANSACTION, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("reason", 100, "Purchased " + packageName), new ColumnInt("gems", -cost));
}
}
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable()
@ -129,12 +118,6 @@ public class DonationRepository extends RepositoryBase
{
public void run(final Boolean response)
{
if (response)
{
executeUpdate(UPDATE_ACCOUNT_GEMS, new ColumnInt("gems", greenGems), new ColumnVarChar("uuid", 100, uuid));
executeUpdate(INSERT_GEM_TRANSACTION, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("reason", 100, "Given by " + giver), new ColumnInt("gems", greenGems));
}
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable()
{
@Override

View File

@ -23,8 +23,10 @@ import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.punish.Category;
import mineplex.core.punish.Punish;
import mineplex.core.server.util.TransactionResponse;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -32,6 +34,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor
{
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private InventoryManager _inventoryManager;
private Punish _punish;
private TempRepository _repository;
@ -44,12 +47,13 @@ public class Enjin extends MiniPlugin implements CommandExecutor
private SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Punish punish)
public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, Punish punish)
{
super("Enjin", plugin);
_clientManager = clientManager;
_donationManager = donationManager;
_inventoryManager = inventoryManager;
_punish = punish;
_repository = new TempRepository(plugin);
@ -140,25 +144,27 @@ public class Enjin extends MiniPlugin implements CommandExecutor
if (label.equalsIgnoreCase("enjin_mineplex"))
{
final String name = args[1];
UUID playerUUID = null;
UUID uuid = null;
if (_cachedUUIDs.containsKey(name))
playerUUID = _cachedUUIDs.get(name).getKey();
uuid = _cachedUUIDs.get(name).getKey();
else
{
// Fails if not in DB and if duplicate.
playerUUID = _clientManager.loadUUIDFromDB(name);
uuid = _clientManager.loadUUIDFromDB(name);
if (playerUUID == null)
playerUUID = UUIDFetcher.getUUIDOf(name);
if (uuid == null)
uuid = UUIDFetcher.getUUIDOf(name);
}
if (playerUUID == null)
if (uuid == null)
{
System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + ", no UUID.");
return true;
}
final UUID playerUUID = uuid;
_cachedUUIDs.put(name, new AbstractMap.SimpleEntry<UUID, Long>(playerUUID, System.currentTimeMillis() + 240000));
if (args.length == 3 && args[0].equalsIgnoreCase("gem"))
@ -209,6 +215,54 @@ public class Enjin extends MiniPlugin implements CommandExecutor
_repository.addGemBooster(name, amount);
System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Gem Boosters" + ".");
}
else if (args.length == 3 && args[0].equalsIgnoreCase("key"))
{
final int amount = Integer.parseInt(args[2]);
_donationManager.PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse data)
{
_inventoryManager.addItemToInventoryForOffline(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Treasure Keys" + ".");
else
{
_commandQueue.add(new QueuedCommand(sender, command, label, args));
System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Keys. Queuing for run later.");
}
}
}, playerUUID.toString(), "Treasure", "Treasure Key", amount);
}
}, name, playerUUID, "Treasure Key" + amount, false, 0, false);
}
else if (args.length == 3 && args[0].equalsIgnoreCase("chest"))
{
final int amount = Integer.parseInt(args[2]);
_donationManager.PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse data)
{
_inventoryManager.addItemToInventoryForOffline(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Treasure Chests" + ".");
else
{
_commandQueue.add(new QueuedCommand(sender, command, label, args));
System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Chests. Queuing for run later.");
}
}
}, playerUUID.toString(), "Utility", "Treasure Chest", amount);
}
}, name, playerUUID, "Treasure Chest" + amount, false, 0, false);
}
else if (args.length == 4 && args[0].equalsIgnoreCase("rank"))
{
final String rank = args[2];

View File

@ -3,6 +3,7 @@ package mineplex.enjinTranslator;
import mineplex.core.account.CoreClientManager;
import mineplex.core.command.CommandCenter;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.punish.Punish;
import mineplex.core.updater.Updater;
@ -31,7 +32,7 @@ public class EnjinTranslator extends JavaPlugin
Punish punish = new Punish(this, GetWebServerAddress(), clientManager);
//Main Modules
new Enjin(this, clientManager, donationManager, punish);
new Enjin(this, clientManager, donationManager, new InventoryManager(this, clientManager), punish);
new Updater(this);
}

View File

@ -104,7 +104,7 @@ public class Clans extends JavaPlugin
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, true);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null);
cosmeticManager.setInterfaceSlot(7);
new MemoryFix(this);

View File

@ -176,7 +176,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
new BenefitManager(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, _blockRestore, hologramManager);
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, false, _treasureManager);
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
_partyManager = partyManager;
_preferences = preferences;

View File

@ -98,7 +98,7 @@ public class ServerMonitor
for (MinecraftServer minecraftServer : serverStatuses)
{
if (minecraftServer.getMotd().contains("Finished"))
if (minecraftServer.getMotd().contains("Finished") || (minecraftServer.getGroup().equalsIgnoreCase("UltraHardcore") && minecraftServer.getMotd().contains("Restarting") && minecraftServer.getPlayerCount() == 0))
{
killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true);
continue;

View File

@ -115,7 +115,7 @@ public class Arcade extends JavaPlugin
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, true);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null);
cosmeticManager.setInterfaceSlot(7);
//Arcade Manager

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -10,12 +9,9 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
@ -42,11 +38,9 @@ import mineplex.core.chat.Chat;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
@ -68,8 +62,6 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
@ -108,7 +100,6 @@ import nautilus.game.arcade.managers.GameSpectatorManager;
import nautilus.game.arcade.managers.GameStatManager;
import nautilus.game.arcade.managers.GameTournamentManager;
import nautilus.game.arcade.managers.GameWorldManager;
import nautilus.game.arcade.managers.HalloweenManager;
import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop;

View File

@ -58,14 +58,14 @@ public class GameLootManager implements Listener
false);
//Chest
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
new ItemStack(Material.CHEST), RewardRarity.COMMON, 4));
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2,
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2,
new ItemStack(Material.CHEST), RewardRarity.COMMON, 1));
//Key
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 1000));
}