Added rank benefit giver 9000
Added MineStrike to beta timer. Updated official craftbukkit.jar
This commit is contained in:
parent
c8e755fe5f
commit
d0edde9dbd
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));
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -185,7 +185,7 @@ 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);
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user