Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
64c8edc292
Binary file not shown.
@ -10,5 +10,4 @@
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
package mineplex.core.common.jsonchat;
|
||||
|
||||
public enum ClickEvent
|
||||
{
|
||||
RUN_COMMAND("run_command"),
|
||||
SUGGEST_COMMAND("suggest_command"),
|
||||
OPEN_URL("open_url"),
|
||||
CHANGE_PAGE("change_page"); // Change Page only applies to books, which we haven't been able to use yet
|
||||
|
||||
private String _minecraftString;
|
||||
|
||||
ClickEvent(String minecraftString)
|
||||
{
|
||||
_minecraftString = minecraftString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _minecraftString;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package mineplex.core.common.jsonchat;
|
||||
|
||||
public enum Color
|
||||
{
|
||||
BLACK("black"),
|
||||
DARK_BLUE("dark_blue"),
|
||||
DARK_GREEN("dark_green"),
|
||||
DARK_AQUA("dark_aqua"),
|
||||
DARK_RED("dark_red"),
|
||||
DARK_PURPLE("dark_purple"),
|
||||
GOLD("gold"),
|
||||
GRAY("gray"),
|
||||
DARK_GRAY("dark_gray"),
|
||||
BLUE("blue"),
|
||||
GREEN("green"),
|
||||
AQUA("aqua"),
|
||||
RED("red"),
|
||||
LIGHT_PURPLE("light_purple"),
|
||||
YELLOW("yellow"),
|
||||
WHITE("white");
|
||||
|
||||
private String _minecraftString;
|
||||
|
||||
Color(String minecraftString)
|
||||
{
|
||||
_minecraftString = minecraftString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _minecraftString;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package mineplex.core.common.jsonchat;
|
||||
|
||||
public enum HoverEvent
|
||||
{
|
||||
SHOW_TEXT("show_text"),
|
||||
SHOW_ITEM("show_item"),
|
||||
SHOW_ACHIEVEMENT("show_achievement");
|
||||
|
||||
private String _minecraftString;
|
||||
|
||||
HoverEvent(String minecraftString)
|
||||
{
|
||||
_minecraftString = minecraftString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _minecraftString;
|
||||
}
|
||||
}
|
@ -35,6 +35,34 @@ public class JsonMessage
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonMessage italic()
|
||||
{
|
||||
Builder.append(", italic:true");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonMessage underlined()
|
||||
{
|
||||
Builder.append(", underlined:true");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonMessage strikethrough()
|
||||
{
|
||||
Builder.append(", strikethrough:true");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonMessage obfuscated()
|
||||
{
|
||||
Builder.append(", obfuscated:true");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChildJsonMessage extra(String text)
|
||||
{
|
||||
@ -48,13 +76,28 @@ public class JsonMessage
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public JsonMessage hover(String action, String value)
|
||||
{
|
||||
Builder.append(", \"hoverEvent\":{\"action\":\"" + action + "\",\"value\":\"" + value + "\"}");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonMessage click(ClickEvent event, String value)
|
||||
{
|
||||
return click(event.toString(), value);
|
||||
}
|
||||
|
||||
public JsonMessage hover(HoverEvent event, String value)
|
||||
{
|
||||
return hover(event.toString(), value);
|
||||
}
|
||||
|
||||
public JsonMessage color(Color color)
|
||||
{
|
||||
return color(color.toString());
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
|
@ -0,0 +1,6 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
public interface RunnableStatus
|
||||
{
|
||||
public boolean run();
|
||||
}
|
@ -18,6 +18,6 @@
|
||||
<orderEntry type="module" module-name="Mineplex.Database" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
||||
<orderEntry type="module" module-name="Classpath.Dummy" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
</module>
|
@ -98,4 +98,14 @@ public abstract class MiniPlugin implements Listener
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable);
|
||||
}
|
||||
|
||||
protected void runSync(Runnable runnable)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTask(_plugin, runnable);
|
||||
}
|
||||
|
||||
protected void runSyncLater(Runnable runnable, long delay)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskLater(_plugin, runnable, delay);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MorphPage;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,6 +18,6 @@ public class OpenMounts extends SingleButton
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
|
||||
_page.getShop().OpenPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MorphPage;
|
||||
import mineplex.core.cosmetic.ui.page.ParticlePage;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,6 +18,6 @@ public class OpenParticles extends SingleButton
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
|
||||
_page.getShop().OpenPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MorphPage;
|
||||
import mineplex.core.cosmetic.ui.page.PetPage;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,6 +17,6 @@ public class OpenPets extends SingleButton
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
|
||||
_page.getShop().OpenPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@ import java.util.Iterator;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.column.Column;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -229,14 +228,7 @@ public abstract class RepositoryBase implements Listener
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Logger.Instance.log(errorMessage + exception.getMessage());
|
||||
|
||||
databaseRunnable.incrementFailCount();
|
||||
|
||||
synchronized (_queueLock)
|
||||
{
|
||||
_failedQueue.put(databaseRunnable, errorMessage);
|
||||
}
|
||||
processFailedDatabaseCall(databaseRunnable, exception.getMessage(), errorMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -244,6 +236,25 @@ public abstract class RepositoryBase implements Listener
|
||||
asyncThread.start();
|
||||
}
|
||||
|
||||
protected void processFailedDatabaseCall(DatabaseRunnable databaseRunnable, String errorPreMessage, String runnableMessage)
|
||||
{
|
||||
if (databaseRunnable.getFailedCounts() < 4)
|
||||
{
|
||||
databaseRunnable.incrementFailCount();
|
||||
|
||||
synchronized (_queueLock)
|
||||
{
|
||||
_failedQueue.put(databaseRunnable, runnableMessage);
|
||||
}
|
||||
|
||||
Logger.Instance.log(errorPreMessage + runnableMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Instance.log("Abandoning database call : " + runnableMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void processDatabaseQueue(UpdateEvent event)
|
||||
{
|
||||
@ -259,37 +270,8 @@ public abstract class RepositoryBase implements Listener
|
||||
{
|
||||
for (Iterator<DatabaseRunnable> runnablesIterator = _failedQueue.keySet().iterator(); runnablesIterator.hasNext();)
|
||||
{
|
||||
final DatabaseRunnable databaseRunnable = runnablesIterator.next();
|
||||
|
||||
Thread asyncThread = new Thread(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
databaseRunnable.run();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Logger.Instance.log(_failedQueue.get(databaseRunnable) + exception.getMessage());
|
||||
|
||||
if (databaseRunnable.getFailedCounts() < 4)
|
||||
{
|
||||
synchronized (_queueLock)
|
||||
{
|
||||
_failedQueue.put(databaseRunnable, _failedQueue.get(databaseRunnable));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Instance.log("Abandoning database call : " + _failedQueue.get(databaseRunnable));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
runnablesIterator.remove();
|
||||
asyncThread.start();
|
||||
DatabaseRunnable databaseRunnable = runnablesIterator.next();
|
||||
handleDatabaseCall(databaseRunnable, _failedQueue.get(databaseRunnable));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class DonationManager extends MiniPlugin
|
||||
|
||||
private NautHashMap<Player, NautHashMap<String, Integer>> _gemQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
|
||||
private NautHashMap<Player, NautHashMap<String, Integer>> _coinQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
|
||||
private NautHashMap<Player, NautHashMap<String, Integer>> _goldQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
|
||||
|
||||
public DonationManager(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
@ -301,6 +302,88 @@ public class DonationManager extends MiniPlugin
|
||||
//Clean
|
||||
_coinQueue.clear();
|
||||
}
|
||||
|
||||
public void RewardGold(Callback<Boolean> callback, String caller, String name, UUID uuid, int amount)
|
||||
{
|
||||
RewardGold(callback, caller, name, uuid, amount, true);
|
||||
}
|
||||
|
||||
public void RewardGold(final Callback<Boolean> callback, final String caller, final String name, final UUID uuid, final int amount, final boolean updateTotal)
|
||||
{
|
||||
_repository.rewardGold(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
if (updateTotal)
|
||||
{
|
||||
Donor donor = Get(name);
|
||||
|
||||
if (donor != null)
|
||||
{
|
||||
donor.addGold(amount);
|
||||
}
|
||||
}
|
||||
|
||||
if (callback != null)
|
||||
callback.run(true);
|
||||
}
|
||||
}
|
||||
}, caller, name, uuid.toString(), amount);
|
||||
}
|
||||
|
||||
public void RewardGoldLater(final String caller, final Player player, final int amount)
|
||||
{
|
||||
if (!_goldQueue.containsKey(player))
|
||||
_goldQueue.put(player, new NautHashMap<String, Integer>());
|
||||
|
||||
int totalAmount = amount;
|
||||
|
||||
if (_goldQueue.get(player).containsKey(caller))
|
||||
totalAmount += _goldQueue.get(player).get(caller);
|
||||
|
||||
_goldQueue.get(player).put(caller, totalAmount);
|
||||
|
||||
//Do Temp Change
|
||||
Donor donor = Get(player.getName());
|
||||
|
||||
if (donor != null)
|
||||
donor.addGold(amount);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateGoldQueue(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOWER)
|
||||
return;
|
||||
|
||||
for (Player player : _goldQueue.keySet())
|
||||
{
|
||||
String caller = null;
|
||||
int total = 0;
|
||||
|
||||
for (String curCaller : _goldQueue.get(player).keySet())
|
||||
{
|
||||
caller = curCaller;
|
||||
total += _goldQueue.get(player).get(curCaller);
|
||||
}
|
||||
|
||||
if (caller == null)
|
||||
continue;
|
||||
|
||||
//Actually Add Gold
|
||||
RewardGold(null, caller, player.getName(), player.getUniqueId(), total, false);
|
||||
|
||||
System.out.println("Queue Added [" + player + "] with Gold [" + total + "] for [" + caller + "]");
|
||||
|
||||
//Clean
|
||||
_goldQueue.get(player).clear();
|
||||
}
|
||||
|
||||
//Clean
|
||||
_goldQueue.clear();
|
||||
}
|
||||
|
||||
public void applyKits(String playerName)
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ public class Donor
|
||||
{
|
||||
private int _gems;
|
||||
private int _coins;
|
||||
private int _gold;
|
||||
private boolean _donated;
|
||||
private List<Integer> _salesPackagesOwned;
|
||||
private List<String> _unknownSalesPackagesOwned;
|
||||
@ -159,9 +160,19 @@ public class Donor
|
||||
{
|
||||
_coins += amount;
|
||||
}
|
||||
|
||||
public void addGold(int amount)
|
||||
{
|
||||
_gold += amount;
|
||||
}
|
||||
|
||||
public List<CoinTransactionToken> getCoinTransactions()
|
||||
{
|
||||
return _coinTransactions;
|
||||
}
|
||||
|
||||
public int getGold()
|
||||
{
|
||||
return _gold;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.core.donation.repository.token.GemRewardToken;
|
||||
import mineplex.core.donation.repository.token.PurchaseToken;
|
||||
import mineplex.core.donation.repository.token.UnknownPurchaseToken;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
@ -23,6 +24,7 @@ public class DonationRepository extends RepositoryBase
|
||||
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 UPDATE_ACCOUNT_COINS = "UPDATE accounts SET coins = coins + ? WHERE uuid = ?;";
|
||||
private static String UPDATE_ACCOUNT_GOLD = "UPDATE accounts SET gold = gold + ? 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;
|
||||
@ -174,6 +176,25 @@ public class DonationRepository extends RepositoryBase
|
||||
}
|
||||
}), "Error updating player coin amount in DonationRepository : ");
|
||||
}
|
||||
|
||||
public void rewardGold(final Callback<Boolean> callback, final String giver, final String name, final String uuid, final int gold)
|
||||
{
|
||||
final GemRewardToken token = new GemRewardToken();
|
||||
token.Source = giver;
|
||||
token.Name = name;
|
||||
token.Amount = gold;
|
||||
|
||||
handleDatabaseCall(new DatabaseRunnable(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnVarChar("uuid", 100, uuid)) < 1)
|
||||
{
|
||||
Logger.Instance.log("Account gold wasn't updated for " + name);
|
||||
}
|
||||
}
|
||||
}), "Error updating player gold amount in DonationRepository : ");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
|
@ -123,6 +123,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
||||
{
|
||||
for (int i=_okSquareSlotStart; i < 54; i++)
|
||||
{
|
||||
ButtonMap.remove(i);
|
||||
clear(i);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ChestOpenAnimation extends Animation
|
||||
}
|
||||
else if (getTicks() == 15)
|
||||
{
|
||||
_hologram = new Hologram(_hologramManager, _chestData.getBlock().getLocation().add(0.5, 1.1, 0.5),
|
||||
_hologram = new Hologram(_hologramManager, _chestData.getBlock().getLocation().add(0.5, 1.4, 0.5),
|
||||
_rewardData.getFriendlyName());
|
||||
_hologram.start();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ package mineplex.database;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Account extends org.jooq.impl.SchemaImpl implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 1357303848;
|
||||
private static final long serialVersionUID = 477510632;
|
||||
|
||||
/**
|
||||
* The singleton instance of <code>Account</code>
|
||||
@ -46,11 +46,13 @@ public class Account extends org.jooq.impl.SchemaImpl implements java.io.Seriali
|
||||
mineplex.database.tables.Games.games,
|
||||
mineplex.database.tables.ItemCategories.itemCategories,
|
||||
mineplex.database.tables.Items.items,
|
||||
mineplex.database.tables.Mail.mail,
|
||||
mineplex.database.tables.Npcs.npcs,
|
||||
mineplex.database.tables.PlayerMap.playerMap,
|
||||
mineplex.database.tables.Polls.polls,
|
||||
mineplex.database.tables.RankBenefits.rankBenefits,
|
||||
mineplex.database.tables.RewardLog.rewardLog,
|
||||
mineplex.database.tables.ServerPassword.serverPassword,
|
||||
mineplex.database.tables.Stats.stats,
|
||||
mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard);
|
||||
}
|
||||
|
@ -30,11 +30,13 @@ public class Keys {
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.GamesRecord, java.lang.Integer> IDENTITY_games = Identities0.IDENTITY_games;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.ItemCategoriesRecord, java.lang.Integer> IDENTITY_itemCategories = Identities0.IDENTITY_itemCategories;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.ItemsRecord, java.lang.Integer> IDENTITY_items = Identities0.IDENTITY_items;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.MailRecord, java.lang.Integer> IDENTITY_mail = Identities0.IDENTITY_mail;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.NpcsRecord, java.lang.Integer> IDENTITY_npcs = Identities0.IDENTITY_npcs;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.PlayerMapRecord, java.lang.Integer> IDENTITY_playerMap = Identities0.IDENTITY_playerMap;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.PollsRecord, java.lang.Integer> IDENTITY_polls = Identities0.IDENTITY_polls;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.RankBenefitsRecord, java.lang.Integer> IDENTITY_rankBenefits = Identities0.IDENTITY_rankBenefits;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.RewardLogRecord, java.lang.Integer> IDENTITY_rewardLog = Identities0.IDENTITY_rewardLog;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.ServerPasswordRecord, java.lang.Integer> IDENTITY_serverPassword = Identities0.IDENTITY_serverPassword;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.StatsRecord, java.lang.Integer> IDENTITY_stats = Identities0.IDENTITY_stats;
|
||||
public static final org.jooq.Identity<mineplex.database.tables.records.TournamentLeaderboardRecord, java.lang.Integer> IDENTITY_tournamentLeaderboard = Identities0.IDENTITY_tournamentLeaderboard;
|
||||
|
||||
@ -62,12 +64,14 @@ public class Keys {
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ItemCategoriesRecord> KEY_itemCategories_nameIndex = UniqueKeys0.KEY_itemCategories_nameIndex;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ItemsRecord> KEY_items_PRIMARY = UniqueKeys0.KEY_items_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ItemsRecord> KEY_items_uniqueNameCategoryIndex = UniqueKeys0.KEY_items_uniqueNameCategoryIndex;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.MailRecord> KEY_mail_PRIMARY = UniqueKeys0.KEY_mail_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.NpcsRecord> KEY_npcs_PRIMARY = UniqueKeys0.KEY_npcs_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.PlayerMapRecord> KEY_playerMap_PRIMARY = UniqueKeys0.KEY_playerMap_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.PlayerMapRecord> KEY_playerMap_playerIndex = UniqueKeys0.KEY_playerMap_playerIndex;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.PollsRecord> KEY_polls_PRIMARY = UniqueKeys0.KEY_polls_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.RankBenefitsRecord> KEY_rankBenefits_PRIMARY = UniqueKeys0.KEY_rankBenefits_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.RewardLogRecord> KEY_rewardLog_PRIMARY = UniqueKeys0.KEY_rewardLog_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ServerPasswordRecord> KEY_serverPassword_PRIMARY = UniqueKeys0.KEY_serverPassword_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.StatsRecord> KEY_stats_PRIMARY = UniqueKeys0.KEY_stats_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.StatsRecord> KEY_stats_nameIndex = UniqueKeys0.KEY_stats_nameIndex;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.TournamentLeaderboardRecord> KEY_tournamentLeaderboard_PRIMARY = UniqueKeys0.KEY_tournamentLeaderboard_PRIMARY;
|
||||
@ -88,6 +92,7 @@ public class Keys {
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.GamePlayersRecord, mineplex.database.tables.records.GamesRecord> FK_gamePlayers_games = ForeignKeys0.FK_gamePlayers_games;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.GamePlayersRecord, mineplex.database.tables.records.AccountsRecord> FK_gamePlayers_accounts = ForeignKeys0.FK_gamePlayers_accounts;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.ItemsRecord, mineplex.database.tables.records.ItemCategoriesRecord> items_ibfk_1 = ForeignKeys0.items_ibfk_1;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.MailRecord, mineplex.database.tables.records.AccountsRecord> mail_ibfk_1 = ForeignKeys0.mail_ibfk_1;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.RewardLogRecord, mineplex.database.tables.records.AccountsRecord> rewardLog_ibfk_1 = ForeignKeys0.rewardLog_ibfk_1;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.TournamentLeaderboardRecord, mineplex.database.tables.records.AccountsRecord> FK_tournamentLeaderboard_accounts = ForeignKeys0.FK_tournamentLeaderboard_accounts;
|
||||
|
||||
@ -108,11 +113,13 @@ public class Keys {
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.GamesRecord, java.lang.Integer> IDENTITY_games = createIdentity(mineplex.database.tables.Games.games, mineplex.database.tables.Games.games.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.ItemCategoriesRecord, java.lang.Integer> IDENTITY_itemCategories = createIdentity(mineplex.database.tables.ItemCategories.itemCategories, mineplex.database.tables.ItemCategories.itemCategories.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.ItemsRecord, java.lang.Integer> IDENTITY_items = createIdentity(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.MailRecord, java.lang.Integer> IDENTITY_mail = createIdentity(mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.NpcsRecord, java.lang.Integer> IDENTITY_npcs = createIdentity(mineplex.database.tables.Npcs.npcs, mineplex.database.tables.Npcs.npcs.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.PlayerMapRecord, java.lang.Integer> IDENTITY_playerMap = createIdentity(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.PollsRecord, java.lang.Integer> IDENTITY_polls = createIdentity(mineplex.database.tables.Polls.polls, mineplex.database.tables.Polls.polls.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.RankBenefitsRecord, java.lang.Integer> IDENTITY_rankBenefits = createIdentity(mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.RewardLogRecord, java.lang.Integer> IDENTITY_rewardLog = createIdentity(mineplex.database.tables.RewardLog.rewardLog, mineplex.database.tables.RewardLog.rewardLog.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.ServerPasswordRecord, java.lang.Integer> IDENTITY_serverPassword = createIdentity(mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.ServerPassword.serverPassword.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.StatsRecord, java.lang.Integer> IDENTITY_stats = createIdentity(mineplex.database.tables.Stats.stats, mineplex.database.tables.Stats.stats.id);
|
||||
public static org.jooq.Identity<mineplex.database.tables.records.TournamentLeaderboardRecord, java.lang.Integer> IDENTITY_tournamentLeaderboard = createIdentity(mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard, mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.id);
|
||||
}
|
||||
@ -138,12 +145,14 @@ public class Keys {
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ItemCategoriesRecord> KEY_itemCategories_nameIndex = createUniqueKey(mineplex.database.tables.ItemCategories.itemCategories, mineplex.database.tables.ItemCategories.itemCategories.name);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ItemsRecord> KEY_items_PRIMARY = createUniqueKey(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ItemsRecord> KEY_items_uniqueNameCategoryIndex = createUniqueKey(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.name, mineplex.database.tables.Items.items.categoryId);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.MailRecord> KEY_mail_PRIMARY = createUniqueKey(mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.NpcsRecord> KEY_npcs_PRIMARY = createUniqueKey(mineplex.database.tables.Npcs.npcs, mineplex.database.tables.Npcs.npcs.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.PlayerMapRecord> KEY_playerMap_PRIMARY = createUniqueKey(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.PlayerMapRecord> KEY_playerMap_playerIndex = createUniqueKey(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.playerName);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.PollsRecord> KEY_polls_PRIMARY = createUniqueKey(mineplex.database.tables.Polls.polls, mineplex.database.tables.Polls.polls.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.RankBenefitsRecord> KEY_rankBenefits_PRIMARY = createUniqueKey(mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.RewardLogRecord> KEY_rewardLog_PRIMARY = createUniqueKey(mineplex.database.tables.RewardLog.rewardLog, mineplex.database.tables.RewardLog.rewardLog.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ServerPasswordRecord> KEY_serverPassword_PRIMARY = createUniqueKey(mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.ServerPassword.serverPassword.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.StatsRecord> KEY_stats_PRIMARY = createUniqueKey(mineplex.database.tables.Stats.stats, mineplex.database.tables.Stats.stats.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.StatsRecord> KEY_stats_nameIndex = createUniqueKey(mineplex.database.tables.Stats.stats, mineplex.database.tables.Stats.stats.name);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.TournamentLeaderboardRecord> KEY_tournamentLeaderboard_PRIMARY = createUniqueKey(mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard, mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.id);
|
||||
@ -162,6 +171,7 @@ public class Keys {
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.GamePlayersRecord, mineplex.database.tables.records.GamesRecord> FK_gamePlayers_games = createForeignKey(mineplex.database.Keys.KEY_games_PRIMARY, mineplex.database.tables.GamePlayers.gamePlayers, mineplex.database.tables.GamePlayers.gamePlayers.gameId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.GamePlayersRecord, mineplex.database.tables.records.AccountsRecord> FK_gamePlayers_accounts = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.GamePlayers.gamePlayers, mineplex.database.tables.GamePlayers.gamePlayers.accountId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.ItemsRecord, mineplex.database.tables.records.ItemCategoriesRecord> items_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_itemCategories_PRIMARY, mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.categoryId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.MailRecord, mineplex.database.tables.records.AccountsRecord> mail_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.accountId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.RewardLogRecord, mineplex.database.tables.records.AccountsRecord> rewardLog_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.RewardLog.rewardLog, mineplex.database.tables.RewardLog.rewardLog.accountId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.TournamentLeaderboardRecord, mineplex.database.tables.records.AccountsRecord> FK_tournamentLeaderboard_accounts = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard, mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.accountId);
|
||||
}
|
||||
|
@ -73,6 +73,11 @@ public class Tables {
|
||||
*/
|
||||
public static final mineplex.database.tables.Items items = mineplex.database.tables.Items.items;
|
||||
|
||||
/**
|
||||
* The table Account.mail
|
||||
*/
|
||||
public static final mineplex.database.tables.Mail mail = mineplex.database.tables.Mail.mail;
|
||||
|
||||
/**
|
||||
* The table Account.npcs
|
||||
*/
|
||||
@ -98,6 +103,11 @@ public class Tables {
|
||||
*/
|
||||
public static final mineplex.database.tables.RewardLog rewardLog = mineplex.database.tables.RewardLog.rewardLog;
|
||||
|
||||
/**
|
||||
* The table Account.serverPassword
|
||||
*/
|
||||
public static final mineplex.database.tables.ServerPassword serverPassword = mineplex.database.tables.ServerPassword.serverPassword;
|
||||
|
||||
/**
|
||||
* The table Account.stats
|
||||
*/
|
||||
|
132
Plugins/Mineplex.Database/src/mineplex/database/tables/Mail.java
Normal file
132
Plugins/Mineplex.Database/src/mineplex/database/tables/Mail.java
Normal file
@ -0,0 +1,132 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package mineplex.database.tables;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = { "http://www.jooq.org", "3.4.2" },
|
||||
comments = "This class is generated by jOOQ")
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Mail extends org.jooq.impl.TableImpl<mineplex.database.tables.records.MailRecord> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 1684976566;
|
||||
|
||||
/**
|
||||
* The singleton instance of <code>Account.mail</code>
|
||||
*/
|
||||
public static final mineplex.database.tables.Mail mail = new mineplex.database.tables.Mail();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Class<mineplex.database.tables.records.MailRecord> getRecordType() {
|
||||
return mineplex.database.tables.records.MailRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.id</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.lang.Integer> id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.accountId</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.lang.Integer> accountId = createField("accountId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.sender</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.lang.String> sender = createField("sender", org.jooq.impl.SQLDataType.VARCHAR.length(64).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.message</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.lang.String> message = createField("message", org.jooq.impl.SQLDataType.VARCHAR.length(1024).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.archived</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.lang.Byte> archived = createField("archived", org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaulted(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.deleted</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.lang.Byte> deleted = createField("deleted", org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaulted(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.mail.timeSent</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.MailRecord, java.sql.Timestamp> timeSent = createField("timeSent", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaulted(true), this, "");
|
||||
|
||||
/**
|
||||
* Create a <code>Account.mail</code> table reference
|
||||
*/
|
||||
public Mail() {
|
||||
this("mail", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>Account.mail</code> table reference
|
||||
*/
|
||||
public Mail(java.lang.String alias) {
|
||||
this(alias, mineplex.database.tables.Mail.mail);
|
||||
}
|
||||
|
||||
private Mail(java.lang.String alias, org.jooq.Table<mineplex.database.tables.records.MailRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private Mail(java.lang.String alias, org.jooq.Table<mineplex.database.tables.records.MailRecord> aliased, org.jooq.Field<?>[] parameters) {
|
||||
super(alias, mineplex.database.Account.Account, aliased, parameters, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Identity<mineplex.database.tables.records.MailRecord, java.lang.Integer> getIdentity() {
|
||||
return mineplex.database.Keys.IDENTITY_mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.UniqueKey<mineplex.database.tables.records.MailRecord> getPrimaryKey() {
|
||||
return mineplex.database.Keys.KEY_mail_PRIMARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.util.List<org.jooq.UniqueKey<mineplex.database.tables.records.MailRecord>> getKeys() {
|
||||
return java.util.Arrays.<org.jooq.UniqueKey<mineplex.database.tables.records.MailRecord>>asList(mineplex.database.Keys.KEY_mail_PRIMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.util.List<org.jooq.ForeignKey<mineplex.database.tables.records.MailRecord, ?>> getReferences() {
|
||||
return java.util.Arrays.<org.jooq.ForeignKey<mineplex.database.tables.records.MailRecord, ?>>asList(mineplex.database.Keys.mail_ibfk_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public mineplex.database.tables.Mail as(java.lang.String alias) {
|
||||
return new mineplex.database.tables.Mail(alias, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
public mineplex.database.tables.Mail rename(java.lang.String name) {
|
||||
return new mineplex.database.tables.Mail(name, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package mineplex.database.tables;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = { "http://www.jooq.org", "3.4.2" },
|
||||
comments = "This class is generated by jOOQ")
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class ServerPassword extends org.jooq.impl.TableImpl<mineplex.database.tables.records.ServerPasswordRecord> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 2057289854;
|
||||
|
||||
/**
|
||||
* The singleton instance of <code>Account.serverPassword</code>
|
||||
*/
|
||||
public static final mineplex.database.tables.ServerPassword serverPassword = new mineplex.database.tables.ServerPassword();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Class<mineplex.database.tables.records.ServerPasswordRecord> getRecordType() {
|
||||
return mineplex.database.tables.records.ServerPasswordRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>Account.serverPassword.id</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.ServerPasswordRecord, java.lang.Integer> id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.serverPassword.server</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.ServerPasswordRecord, java.lang.String> server = createField("server", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.serverPassword.password</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.ServerPasswordRecord, java.lang.String> password = createField("password", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, "");
|
||||
|
||||
/**
|
||||
* Create a <code>Account.serverPassword</code> table reference
|
||||
*/
|
||||
public ServerPassword() {
|
||||
this("serverPassword", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>Account.serverPassword</code> table reference
|
||||
*/
|
||||
public ServerPassword(java.lang.String alias) {
|
||||
this(alias, mineplex.database.tables.ServerPassword.serverPassword);
|
||||
}
|
||||
|
||||
private ServerPassword(java.lang.String alias, org.jooq.Table<mineplex.database.tables.records.ServerPasswordRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private ServerPassword(java.lang.String alias, org.jooq.Table<mineplex.database.tables.records.ServerPasswordRecord> aliased, org.jooq.Field<?>[] parameters) {
|
||||
super(alias, mineplex.database.Account.Account, aliased, parameters, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Identity<mineplex.database.tables.records.ServerPasswordRecord, java.lang.Integer> getIdentity() {
|
||||
return mineplex.database.Keys.IDENTITY_serverPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.UniqueKey<mineplex.database.tables.records.ServerPasswordRecord> getPrimaryKey() {
|
||||
return mineplex.database.Keys.KEY_serverPassword_PRIMARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.util.List<org.jooq.UniqueKey<mineplex.database.tables.records.ServerPasswordRecord>> getKeys() {
|
||||
return java.util.Arrays.<org.jooq.UniqueKey<mineplex.database.tables.records.ServerPasswordRecord>>asList(mineplex.database.Keys.KEY_serverPassword_PRIMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public mineplex.database.tables.ServerPassword as(java.lang.String alias) {
|
||||
return new mineplex.database.tables.ServerPassword(alias, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
public mineplex.database.tables.ServerPassword rename(java.lang.String name) {
|
||||
return new mineplex.database.tables.ServerPassword(name, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,354 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package mineplex.database.tables.records;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = { "http://www.jooq.org", "3.4.2" },
|
||||
comments = "This class is generated by jOOQ")
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class MailRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.MailRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7<java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Byte, java.lang.Byte, java.sql.Timestamp> {
|
||||
|
||||
private static final long serialVersionUID = -1355242451;
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.id</code>.
|
||||
*/
|
||||
public void setId(java.lang.Integer value) {
|
||||
setValue(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.id</code>.
|
||||
*/
|
||||
public java.lang.Integer getId() {
|
||||
return (java.lang.Integer) getValue(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.accountId</code>.
|
||||
*/
|
||||
public void setAccountId(java.lang.Integer value) {
|
||||
setValue(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.accountId</code>.
|
||||
*/
|
||||
public java.lang.Integer getAccountId() {
|
||||
return (java.lang.Integer) getValue(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.sender</code>.
|
||||
*/
|
||||
public void setSender(java.lang.String value) {
|
||||
setValue(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.sender</code>.
|
||||
*/
|
||||
public java.lang.String getSender() {
|
||||
return (java.lang.String) getValue(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.message</code>.
|
||||
*/
|
||||
public void setMessage(java.lang.String value) {
|
||||
setValue(3, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.message</code>.
|
||||
*/
|
||||
public java.lang.String getMessage() {
|
||||
return (java.lang.String) getValue(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.archived</code>.
|
||||
*/
|
||||
public void setArchived(java.lang.Byte value) {
|
||||
setValue(4, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.archived</code>.
|
||||
*/
|
||||
public java.lang.Byte getArchived() {
|
||||
return (java.lang.Byte) getValue(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.deleted</code>.
|
||||
*/
|
||||
public void setDeleted(java.lang.Byte value) {
|
||||
setValue(5, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.deleted</code>.
|
||||
*/
|
||||
public java.lang.Byte getDeleted() {
|
||||
return (java.lang.Byte) getValue(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.mail.timeSent</code>.
|
||||
*/
|
||||
public void setTimeSent(java.sql.Timestamp value) {
|
||||
setValue(6, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.mail.timeSent</code>.
|
||||
*/
|
||||
public java.sql.Timestamp getTimeSent() {
|
||||
return (java.sql.Timestamp) getValue(6);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Primary key information
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Record1<java.lang.Integer> key() {
|
||||
return (org.jooq.Record1) super.key();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Record7 type implementation
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Row7<java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Byte, java.lang.Byte, java.sql.Timestamp> fieldsRow() {
|
||||
return (org.jooq.Row7) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Row7<java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Byte, java.lang.Byte, java.sql.Timestamp> valuesRow() {
|
||||
return (org.jooq.Row7) super.valuesRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field1() {
|
||||
return mineplex.database.tables.Mail.mail.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field2() {
|
||||
return mineplex.database.tables.Mail.mail.accountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.String> field3() {
|
||||
return mineplex.database.tables.Mail.mail.sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.String> field4() {
|
||||
return mineplex.database.tables.Mail.mail.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Byte> field5() {
|
||||
return mineplex.database.tables.Mail.mail.archived;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Byte> field6() {
|
||||
return mineplex.database.tables.Mail.mail.deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.sql.Timestamp> field7() {
|
||||
return mineplex.database.tables.Mail.mail.timeSent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value1() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value2() {
|
||||
return getAccountId();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.String value3() {
|
||||
return getSender();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.String value4() {
|
||||
return getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Byte value5() {
|
||||
return getArchived();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Byte value6() {
|
||||
return getDeleted();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.sql.Timestamp value7() {
|
||||
return getTimeSent();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value1(java.lang.Integer value) {
|
||||
setId(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value2(java.lang.Integer value) {
|
||||
setAccountId(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value3(java.lang.String value) {
|
||||
setSender(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value4(java.lang.String value) {
|
||||
setMessage(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value5(java.lang.Byte value) {
|
||||
setArchived(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value6(java.lang.Byte value) {
|
||||
setDeleted(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord value7(java.sql.Timestamp value) {
|
||||
setTimeSent(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MailRecord values(java.lang.Integer value1, java.lang.Integer value2, java.lang.String value3, java.lang.String value4, java.lang.Byte value5, java.lang.Byte value6, java.sql.Timestamp value7) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a detached MailRecord
|
||||
*/
|
||||
public MailRecord() {
|
||||
super(mineplex.database.tables.Mail.mail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a detached, initialised MailRecord
|
||||
*/
|
||||
public MailRecord(java.lang.Integer id, java.lang.Integer accountId, java.lang.String sender, java.lang.String message, java.lang.Byte archived, java.lang.Byte deleted, java.sql.Timestamp timeSent) {
|
||||
super(mineplex.database.tables.Mail.mail);
|
||||
|
||||
setValue(0, id);
|
||||
setValue(1, accountId);
|
||||
setValue(2, sender);
|
||||
setValue(3, message);
|
||||
setValue(4, archived);
|
||||
setValue(5, deleted);
|
||||
setValue(6, timeSent);
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package mineplex.database.tables.records;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = { "http://www.jooq.org", "3.4.2" },
|
||||
comments = "This class is generated by jOOQ")
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class ServerPasswordRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.ServerPasswordRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3<java.lang.Integer, java.lang.String, java.lang.String> {
|
||||
|
||||
private static final long serialVersionUID = 1338036491;
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.serverPassword.id</code>.
|
||||
*/
|
||||
public void setId(java.lang.Integer value) {
|
||||
setValue(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.serverPassword.id</code>.
|
||||
*/
|
||||
public java.lang.Integer getId() {
|
||||
return (java.lang.Integer) getValue(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.serverPassword.server</code>.
|
||||
*/
|
||||
public void setServer(java.lang.String value) {
|
||||
setValue(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.serverPassword.server</code>.
|
||||
*/
|
||||
public java.lang.String getServer() {
|
||||
return (java.lang.String) getValue(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.serverPassword.password</code>.
|
||||
*/
|
||||
public void setPassword(java.lang.String value) {
|
||||
setValue(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.serverPassword.password</code>.
|
||||
*/
|
||||
public java.lang.String getPassword() {
|
||||
return (java.lang.String) getValue(2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Primary key information
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Record1<java.lang.Integer> key() {
|
||||
return (org.jooq.Record1) super.key();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Record3 type implementation
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Row3<java.lang.Integer, java.lang.String, java.lang.String> fieldsRow() {
|
||||
return (org.jooq.Row3) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Row3<java.lang.Integer, java.lang.String, java.lang.String> valuesRow() {
|
||||
return (org.jooq.Row3) super.valuesRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Integer> field1() {
|
||||
return mineplex.database.tables.ServerPassword.serverPassword.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.String> field2() {
|
||||
return mineplex.database.tables.ServerPassword.serverPassword.server;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.String> field3() {
|
||||
return mineplex.database.tables.ServerPassword.serverPassword.password;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Integer value1() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.String value2() {
|
||||
return getServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public java.lang.String value3() {
|
||||
return getPassword();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ServerPasswordRecord value1(java.lang.Integer value) {
|
||||
setId(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ServerPasswordRecord value2(java.lang.String value) {
|
||||
setServer(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ServerPasswordRecord value3(java.lang.String value) {
|
||||
setPassword(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ServerPasswordRecord values(java.lang.Integer value1, java.lang.String value2, java.lang.String value3) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a detached ServerPasswordRecord
|
||||
*/
|
||||
public ServerPasswordRecord() {
|
||||
super(mineplex.database.tables.ServerPassword.serverPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a detached, initialised ServerPasswordRecord
|
||||
*/
|
||||
public ServerPasswordRecord(java.lang.Integer id, java.lang.String server, java.lang.String password) {
|
||||
super(mineplex.database.tables.ServerPassword.serverPassword);
|
||||
|
||||
setValue(0, id);
|
||||
setValue(1, server);
|
||||
setValue(2, password);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package mineplex.game.clans.shop;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
@ -15,6 +17,7 @@ public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
|
||||
PvpItem item = new PvpItem(Material.STONE, (byte)0, 1, "Stone", 25, 64);
|
||||
AddButton(1, item, new PvpShopButton<BuildingPage>(this, item));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package mineplex.game.clans.shop;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class PvpItem extends ShopItem
|
||||
{
|
||||
private static String LEFT_CLICK_BUY = C.cWhite + "Left-Click to Buy 1";
|
||||
|
||||
public PvpItem(Material type, byte data, int displayAmount, String name, int price, int bulkCount)
|
||||
{
|
||||
super(type, data, name, new String[]
|
||||
{
|
||||
C.cYellow + C.Bold + name,
|
||||
C.cWhite + " ",
|
||||
LEFT_CLICK_BUY,
|
||||
C.cWhite + "Costs " + C.cGreen + "$" + price,
|
||||
C.cWhite + " ",
|
||||
C.cWhite + "Shift Left-Click to Buy " + bulkCount,
|
||||
C.cWhite + "Costs " + C.cGreen + "$" + (price * bulkCount),
|
||||
}, 0, false, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package mineplex.game.clans.shop;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.ComplexButton;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public class PvpShopButton<PageType extends ShopPageBase<ClansManager, BuildingShop>> extends ComplexButton
|
||||
{
|
||||
protected PageType Page;
|
||||
protected PvpItem Item;
|
||||
|
||||
public PvpShopButton(PageType page, PvpItem item)
|
||||
{
|
||||
Page = page;
|
||||
Item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
int balance = Page.getDonationManager().Get(player.getName()).getGold();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedShiftLeft(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedShiftRight(Player player)
|
||||
{
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
<orderEntry type="module" module-name="Mineplex.ServerData" />
|
||||
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
||||
<orderEntry type="library" name="commons-pool2" level="project" />
|
||||
<orderEntry type="module" module-name="Mineplex.Database" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
</module>
|
@ -91,7 +91,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
Creature creature = new Creature(this);
|
||||
NpcManager npcManager = new NpcManager(this, creature);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, creature, webServerAddress);
|
||||
PollManager pollManager = new PollManager(this, donationManager);
|
||||
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
||||
|
||||
//Main Modules
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
|
||||
|
@ -82,6 +82,7 @@ import mineplex.hub.commands.ForcefieldRadius;
|
||||
import mineplex.hub.commands.GadgetToggle;
|
||||
import mineplex.hub.commands.GameModeCommand;
|
||||
import mineplex.hub.commands.NewsCommand;
|
||||
import mineplex.hub.mail.MailManager;
|
||||
import mineplex.hub.modules.ForcefieldManager;
|
||||
import mineplex.hub.modules.JumpManager;
|
||||
import mineplex.hub.modules.MapManager;
|
||||
@ -91,6 +92,7 @@ import mineplex.hub.modules.TextManager;
|
||||
import mineplex.hub.modules.UHCManager;
|
||||
import mineplex.hub.modules.VisibilityManager;
|
||||
import mineplex.hub.modules.WorldManager;
|
||||
import mineplex.hub.notification.NotificationManager;
|
||||
import mineplex.hub.party.Party;
|
||||
import mineplex.hub.party.PartyManager;
|
||||
import mineplex.hub.poll.PollManager;
|
||||
@ -191,6 +193,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_achievementManager.setGiveInterfaceItem(true);
|
||||
|
||||
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
||||
|
||||
// NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager);
|
||||
// new MailManager(_plugin, notificationManager);
|
||||
|
||||
_ruleBook = ItemStackFactory.Instance.CreateStack(Material.WRITTEN_BOOK, (byte)0, 1, ChatColor.GREEN + "Rule Book", new String[] { });
|
||||
BookMeta meta = (BookMeta)_ruleBook.getItemMeta();
|
||||
|
76
Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java
Normal file
76
Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java
Normal file
@ -0,0 +1,76 @@
|
||||
package mineplex.hub.mail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.hub.notification.NotificationManager;
|
||||
import mineplex.hub.notification.api.Notification;
|
||||
import mineplex.hub.notification.api.Notifier;
|
||||
|
||||
public class MailManager extends MiniClientPlugin<PlayerMailData> implements Notifier
|
||||
{
|
||||
private MailRepository _repository;
|
||||
|
||||
public MailManager(JavaPlugin plugin, NotificationManager notificationManager)
|
||||
{
|
||||
super("Mail", plugin);
|
||||
|
||||
_repository = new MailRepository(plugin, this);
|
||||
|
||||
notificationManager.addNotifier(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerMailData AddPlayer(String player)
|
||||
{
|
||||
return new PlayerMailData();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
protected void loadPlayerData(final PlayerJoinEvent event)
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayer().getName(), _repository.loadMailData(event.getPlayer().getUniqueId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void archive(final MailMessage message, final Callback<Boolean> callback)
|
||||
{
|
||||
if (message.isArchived())
|
||||
return;
|
||||
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final boolean completed = _repository.archive(message);
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
callback.run(completed);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Notification> getNotifications(Player player)
|
||||
{
|
||||
return Get(player).getUnreadMessages();
|
||||
}
|
||||
}
|
201
Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java
Normal file
201
Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java
Normal file
@ -0,0 +1,201 @@
|
||||
package mineplex.hub.mail;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.hub.notification.api.Notification;
|
||||
import mineplex.hub.notification.api.NotificationPriority;
|
||||
|
||||
public class MailMessage implements Notification
|
||||
{
|
||||
private MailManager _manager;
|
||||
|
||||
private int _messageId;
|
||||
private String _sender;
|
||||
private String _message;
|
||||
private boolean _archived;
|
||||
private boolean _deleted;
|
||||
private Timestamp _timeSent;
|
||||
|
||||
public MailMessage(MailManager manager, int messageId, String sender, String message, boolean archived, boolean deleted, Timestamp timeSent)
|
||||
{
|
||||
_manager = manager;
|
||||
|
||||
_messageId = messageId;
|
||||
_sender = sender;
|
||||
_message = message;
|
||||
_archived = archived;
|
||||
_deleted = deleted;
|
||||
_timeSent = timeSent;
|
||||
}
|
||||
|
||||
public int getMessageId()
|
||||
{
|
||||
return _messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(int messageId)
|
||||
{
|
||||
_messageId = messageId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender)
|
||||
{
|
||||
_sender = sender;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public boolean isArchived()
|
||||
{
|
||||
return _archived;
|
||||
}
|
||||
|
||||
public void setArchived(boolean archived)
|
||||
{
|
||||
_archived = archived;
|
||||
}
|
||||
|
||||
public boolean isDeleted()
|
||||
{
|
||||
return _deleted;
|
||||
}
|
||||
|
||||
public void setDeleted(boolean deleted)
|
||||
{
|
||||
_deleted = deleted;
|
||||
}
|
||||
|
||||
public Timestamp getTimeSent()
|
||||
{
|
||||
return _timeSent;
|
||||
}
|
||||
|
||||
public void setTimeSent(Timestamp timeSent)
|
||||
{
|
||||
_timeSent = timeSent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return "Mail Message";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getText()
|
||||
{
|
||||
ArrayList<String> lines = new ArrayList<String>();
|
||||
|
||||
ArrayList<String> message = formatMessage();
|
||||
|
||||
long timeDifference = System.currentTimeMillis() - getTime();
|
||||
|
||||
|
||||
lines.add(ChatColor.RESET + C.cYellow + "From: " + C.cWhite + _sender);
|
||||
lines.add(ChatColor.RESET + C.cYellow + "Sent: " + C.cWhite + UtilTime.convertString(timeDifference, 0, UtilTime.TimeUnit.FIT) + " Ago");
|
||||
lines.add(" ");
|
||||
lines.addAll(message);
|
||||
|
||||
return lines.toArray(new String[lines.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime()
|
||||
{
|
||||
return _timeSent.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial()
|
||||
{
|
||||
return Material.PAPER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getData()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clicked(final InventoryClickEvent event)
|
||||
{
|
||||
if (event.getClick() == ClickType.SHIFT_RIGHT)
|
||||
{
|
||||
_manager.archive(this, new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
player.playSound(player.getLocation(), Sound.SPLASH, 1, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NotificationPriority getPriority()
|
||||
{
|
||||
return NotificationPriority.NORMAL;
|
||||
}
|
||||
|
||||
private ArrayList<String> formatMessage()
|
||||
{
|
||||
String mailMessage = ChatColor.translateAlternateColorCodes('&', _message); // Color the message
|
||||
|
||||
ArrayList<String> parts = new ArrayList<String>();
|
||||
int breakIndex = 0;
|
||||
int charCount = 0;
|
||||
|
||||
for (String s : mailMessage.split("\\\\n"))
|
||||
{
|
||||
for (int currIndex = 0; currIndex < s.length(); currIndex++)
|
||||
{
|
||||
charCount++;
|
||||
char c = s.charAt(currIndex);
|
||||
|
||||
if ((charCount >= 36 && c == ' ') || c == '\n')
|
||||
{
|
||||
// New Line
|
||||
parts.add(ChatColor.RESET + s.substring(breakIndex, currIndex).trim());
|
||||
breakIndex = currIndex;
|
||||
charCount = 0;
|
||||
}
|
||||
}
|
||||
// Add final part
|
||||
parts.add(ChatColor.RESET + s.substring(breakIndex).trim());
|
||||
charCount = 0;
|
||||
breakIndex = 0;
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package mineplex.hub.mail;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.MailRecord;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
public class MailRepository extends RepositoryBase
|
||||
{
|
||||
private MailManager _manager;
|
||||
|
||||
public MailRepository(JavaPlugin plugin, MailManager manager)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PlayerMailData loadMailData(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
PlayerMailData data = new PlayerMailData();
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public PlayerMailData loadMailData(UUID uuid)
|
||||
{
|
||||
PlayerMailData data = new PlayerMailData();
|
||||
|
||||
DSLContext context = DSL.using(getConnection());
|
||||
|
||||
Result<MailRecord> resultSet = context.selectFrom(Tables.mail).where(Tables.mail.accountId.eq(DSL.select(Tables.accounts.id)
|
||||
.from(Tables.accounts)
|
||||
.where(Tables.accounts.uuid.eq(uuid.toString())))
|
||||
).and(Tables.mail.deleted.isFalse()).fetch();
|
||||
|
||||
for (MailRecord record : resultSet)
|
||||
{
|
||||
data.getMessages().add(createMessage(record));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private MailMessage createMessage(MailRecord record)
|
||||
{
|
||||
return new MailMessage(_manager, record.getId(), record.getSender(), record.getMessage(), (record.getArchived() & 0x01) != 0, (record.getDeleted() & 0x01) != 0, record.getTimeSent());
|
||||
}
|
||||
|
||||
public boolean archive(MailMessage mailMessage)
|
||||
{
|
||||
DSLContext context = DSL.using(getConnection());
|
||||
|
||||
int recordsUpdated = context.update(Tables.mail).set(Tables.mail.archived, (byte) 1).where(Tables.mail.id.eq(mailMessage.getMessageId())).execute();
|
||||
|
||||
return recordsUpdated == 1;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package mineplex.hub.mail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.database.tables.records.MailRecord;
|
||||
|
||||
public class PlayerMailData
|
||||
{
|
||||
private List<MailMessage> _messages;
|
||||
|
||||
public PlayerMailData()
|
||||
{
|
||||
_messages = new ArrayList<MailMessage>();
|
||||
}
|
||||
|
||||
public List<MailMessage> getMessages()
|
||||
{
|
||||
return _messages;
|
||||
}
|
||||
|
||||
public List<MailMessage> getUnreadMessages()
|
||||
{
|
||||
ArrayList<MailMessage> unreadMessages = new ArrayList<MailMessage>();
|
||||
|
||||
for (MailMessage message : _messages)
|
||||
{
|
||||
if (!(message.isArchived() || message.isDeleted()))
|
||||
unreadMessages.add(message);
|
||||
}
|
||||
|
||||
return unreadMessages;
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package mineplex.hub.notification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.Color;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.hub.notification.api.Notification;
|
||||
import mineplex.hub.notification.api.Notifier;
|
||||
import mineplex.hub.notification.command.NotificationCommand;
|
||||
import mineplex.hub.notification.gui.NotificationShop;
|
||||
|
||||
public class NotificationManager extends MiniPlugin
|
||||
{
|
||||
private static NotificationComparator COMPARATOR = new NotificationComparator();
|
||||
|
||||
private NotificationShop _shop;
|
||||
private List<Notifier> _notifiers;
|
||||
|
||||
public NotificationManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("Notification", plugin);
|
||||
|
||||
_notifiers = new ArrayList<Notifier>();
|
||||
_shop = new NotificationShop(this, clientManager, donationManager);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (player.isOnline())
|
||||
{
|
||||
if (getNotifications(player).size() > 0)
|
||||
{
|
||||
JsonMessage message = new JsonMessage("You have unread notifications. Click here to read them!");
|
||||
message.color(Color.RED).click(ClickEvent.RUN_COMMAND, "/notifications");
|
||||
message.send(JsonMessage.MessageType.SYSTEM_MESSAGE, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 20 * 8);
|
||||
}
|
||||
|
||||
public List<Notification> getNotifications(Player player)
|
||||
{
|
||||
List<Notification> notifications = new ArrayList<Notification>();
|
||||
|
||||
for (Notifier notifier : _notifiers)
|
||||
{
|
||||
notifications.addAll(notifier.getNotifications(player));
|
||||
}
|
||||
|
||||
notifications.sort(COMPARATOR);
|
||||
|
||||
return notifications;
|
||||
}
|
||||
|
||||
public void addNotifier(Notifier notifier)
|
||||
{
|
||||
_notifiers.add(notifier);
|
||||
}
|
||||
|
||||
public void clearNotifiers()
|
||||
{
|
||||
_notifiers.clear();
|
||||
}
|
||||
|
||||
public void openShop(Player caller)
|
||||
{
|
||||
_shop.attemptShopOpen(caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
addCommand(new NotificationCommand(this));
|
||||
}
|
||||
|
||||
private static class NotificationComparator implements Comparator<Notification>
|
||||
{
|
||||
@Override
|
||||
public int compare(Notification n1, Notification n2)
|
||||
{
|
||||
if (n1.getPriority() == n2.getPriority())
|
||||
{
|
||||
return (int) (n1.getTime() - n2.getTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
return n1.getPriority().ordinal() - n2.getPriority().ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package mineplex.hub.notification.api;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
public interface Notification
|
||||
{
|
||||
public String getTitle();
|
||||
|
||||
public String[] getText();
|
||||
|
||||
public long getTime();
|
||||
|
||||
public Material getMaterial();
|
||||
|
||||
public byte getData();
|
||||
|
||||
public void clicked(InventoryClickEvent event);
|
||||
|
||||
public NotificationPriority getPriority();
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package mineplex.hub.notification.api;
|
||||
|
||||
public enum NotificationPriority
|
||||
{
|
||||
HIGH, NORMAL, LOW;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package mineplex.hub.notification.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface Notifier
|
||||
{
|
||||
public List<? extends Notification> getNotifications(Player player);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package mineplex.hub.notification.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.hub.mail.MailManager;
|
||||
import mineplex.hub.mail.MailMessage;
|
||||
import mineplex.hub.mail.PlayerMailData;
|
||||
import mineplex.hub.notification.NotificationManager;
|
||||
|
||||
public class NotificationCommand extends CommandBase<NotificationManager>
|
||||
{
|
||||
public NotificationCommand(NotificationManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "notifications");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.openShop(caller);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package mineplex.hub.notification.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.hub.mail.MailManager;
|
||||
import mineplex.hub.notification.NotificationManager;
|
||||
import mineplex.hub.notification.gui.page.NotificationPage;
|
||||
|
||||
public class NotificationShop extends ShopBase<NotificationManager>
|
||||
{
|
||||
public NotificationShop(NotificationManager plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Notifications");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<NotificationManager, ? extends ShopBase<NotificationManager>> BuildPagesFor(Player player)
|
||||
{
|
||||
return new NotificationPage(Plugin, this, ClientManager, DonationManager, player);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package mineplex.hub.notification.gui.button;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.mail.MailManager;
|
||||
import mineplex.hub.mail.MailMessage;
|
||||
import mineplex.hub.notification.NotificationManager;
|
||||
import mineplex.hub.notification.api.Notification;
|
||||
import mineplex.hub.notification.gui.page.NotificationPage;
|
||||
|
||||
public class NotificationButton implements IButton
|
||||
{
|
||||
private NotificationManager _manager;
|
||||
private NotificationPage _page;
|
||||
private Notification _notification;
|
||||
|
||||
private Player _player;
|
||||
|
||||
public NotificationButton(NotificationManager manager, Player player, NotificationPage page, Notification notification)
|
||||
{
|
||||
_manager = manager;
|
||||
_page = page;
|
||||
_notification = notification;
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(InventoryClickEvent event)
|
||||
{
|
||||
_notification.clicked(event);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package mineplex.hub.notification.gui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.hub.mail.MailManager;
|
||||
import mineplex.hub.mail.MailMessage;
|
||||
import mineplex.hub.notification.NotificationManager;
|
||||
import mineplex.hub.notification.api.Notification;
|
||||
import mineplex.hub.notification.gui.NotificationShop;
|
||||
import mineplex.hub.notification.gui.button.NotificationButton;
|
||||
|
||||
public class NotificationPage extends ShopPageBase<NotificationManager, NotificationShop>
|
||||
{
|
||||
public NotificationPage(NotificationManager plugin, NotificationShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Notifications", player);
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
List<Notification> notifications = Plugin.getNotifications(Player);
|
||||
|
||||
for (int i = 0; i < notifications.size(); i++)
|
||||
{
|
||||
Notification message = notifications.get(i);
|
||||
|
||||
ShopItem item = getItem(message);
|
||||
|
||||
AddButton(i, item, new NotificationButton(Plugin, Player, this, message));
|
||||
}
|
||||
}
|
||||
|
||||
private ShopItem getItem(Notification notification)
|
||||
{
|
||||
return new ShopItem(notification.getMaterial(), notification.getData(), notification.getTitle(), notification.getTitle(), notification.getText(), 1, false, false);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package mineplex.hub.poll;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -13,7 +15,8 @@ import net.minecraft.server.v1_7_R4.ChatSerializer;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutChat;
|
||||
import net.minecraft.util.com.google.gson.JsonObject;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -23,15 +26,15 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.poll.command.PollCommand;
|
||||
|
||||
public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
public class PollManager extends MiniDbClientPlugin<PlayerPollData>
|
||||
{
|
||||
private PollRepository _repository;
|
||||
private DonationManager _donationManager;
|
||||
private List<Poll> _polls;
|
||||
|
||||
public PollManager(JavaPlugin plugin, DonationManager donationManager)
|
||||
public PollManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("PollManager", plugin);
|
||||
super("PollManager", plugin, clientManager);
|
||||
|
||||
_repository = new PollRepository(plugin);
|
||||
|
||||
@ -53,18 +56,6 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
return new PlayerPollData();
|
||||
}
|
||||
|
||||
public void loadClientInformation(final PlayerJoinEvent event)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayer().getName(), _repository.loadPollData(event.getPlayer().getUniqueId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void join(PlayerJoinEvent event)
|
||||
{
|
||||
@ -215,4 +206,16 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
{
|
||||
addCommand(new PollCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Set(playerName, _repository.loadPollData(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT pollId, value FROM accountPolls INNER JOIN accounts ON accountPolls.accountId = accounts.id WHERE accounts.uuid = '" + uuid + "';";
|
||||
}
|
||||
}
|
||||
|
@ -74,26 +74,40 @@ public class PollRepository extends RepositoryBase
|
||||
return polls;
|
||||
}
|
||||
|
||||
public PlayerPollData loadPollData(UUID uuid)
|
||||
public PlayerPollData loadPollData(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final PlayerPollData pollData = new PlayerPollData();
|
||||
PlayerPollData pollData = new PlayerPollData();
|
||||
|
||||
executeQuery(RETRIEVE_PLAYER_DATA, new ResultSetCallable()
|
||||
while (resultSet.next())
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
pollData.addAnswer(resultSet.getInt(1), resultSet.getInt(2));
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
pollData.addAnswer(resultSet.getInt(1), resultSet.getInt(2));
|
||||
}
|
||||
|
||||
pollData.Loaded = true;
|
||||
|
||||
|
||||
return pollData;
|
||||
}
|
||||
|
||||
// public PlayerPollData loadPollData(UUID uuid)
|
||||
// {
|
||||
// final PlayerPollData pollData = new PlayerPollData();
|
||||
//
|
||||
// executeQuery(RETRIEVE_PLAYER_DATA, new ResultSetCallable()
|
||||
// {
|
||||
// public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
// {
|
||||
// while (resultSet.next())
|
||||
// {
|
||||
// pollData.addAnswer(resultSet.getInt(1), resultSet.getInt(2));
|
||||
// }
|
||||
// }
|
||||
// }, new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
//
|
||||
// pollData.Loaded = true;
|
||||
//
|
||||
// return pollData;
|
||||
// }
|
||||
|
||||
public boolean addPollAnswer(UUID uuid, int pollId, int answer)
|
||||
{
|
||||
int update = executeUpdate(INSERT_POLL_ANSWER, new ColumnInt("pollId", pollId), new ColumnInt("answer", answer), new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
|
@ -224,7 +224,7 @@ public class PvpClass implements IPvpClass
|
||||
{
|
||||
_classes.Get(player).SetGameClass(null);
|
||||
|
||||
UtilPlayer.message(player, F.main("Class", "Armor Class: " + F.oo("None", false)));
|
||||
// UtilPlayer.message(player, F.main("Class", "Armor Class: " + F.oo("None", false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,13 +50,15 @@ public class BlockForm extends Form
|
||||
private Location _loc;
|
||||
private int _selfEntityId1;
|
||||
private int _selfEntityId2;
|
||||
private Location _lastSaw;
|
||||
private Vector _lastSaw;
|
||||
private Vector _sawDiff = new Vector();
|
||||
private boolean _is18;
|
||||
|
||||
public BlockForm(HideSeek host, Player player, Material mat)
|
||||
{
|
||||
super(host, player);
|
||||
|
||||
_is18 = UtilPlayer.is1_8(player);
|
||||
_mat = mat;
|
||||
_loc = player.getLocation();
|
||||
_selfEntityId1 = UtilEnt.getNewEntityId();
|
||||
@ -88,27 +90,42 @@ public class BlockForm extends Form
|
||||
// Apply Falling Block
|
||||
FallingBlockCheck();
|
||||
|
||||
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
|
||||
packet1.a = _selfEntityId1;
|
||||
packet1.b = EntityType.SILVERFISH.getTypeId();
|
||||
packet1.c = (int) Math.floor(_lastSaw.getX() * 32);
|
||||
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
|
||||
packet1.e = (int) Math.floor(_lastSaw.getZ() * 32);
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(1, 0);
|
||||
packet1.l = watcher;
|
||||
player.playerConnection.sendPacket(packet1);
|
||||
// Spawn the falling block that's visible to the disguised player only.
|
||||
|
||||
Packet[] packets = new Packet[3];
|
||||
|
||||
if (_is18)
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
|
||||
packet1.a = _selfEntityId1;
|
||||
packet1.b = EntityType.SILVERFISH.getTypeId();
|
||||
packet1.c = (int) Math.floor(_lastSaw.getX() * 32);
|
||||
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
|
||||
packet1.e = (int) Math.floor(_lastSaw.getZ() * 32);
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(1, 0);
|
||||
packet1.l = watcher;
|
||||
packets[0] = packet1;
|
||||
|
||||
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
|
||||
|
||||
packet3.b = _selfEntityId2;
|
||||
packet3.c = _selfEntityId1;
|
||||
packets[2] = packet3;
|
||||
}
|
||||
|
||||
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, 70, _mat.getId());
|
||||
packet2.a = _selfEntityId2;
|
||||
player.playerConnection.sendPacket(packet2);
|
||||
packet2.a = _is18 ? _selfEntityId2 : _selfEntityId1;
|
||||
packets[1] = packet2;
|
||||
|
||||
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
|
||||
|
||||
packet3.b = _selfEntityId2;
|
||||
packet3.c = _selfEntityId1;
|
||||
player.playerConnection.sendPacket(packet3);
|
||||
for (Packet packet : packets)
|
||||
{
|
||||
if (packet != null)
|
||||
{
|
||||
player.playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
// Inform
|
||||
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
|
||||
@ -209,6 +226,26 @@ public class BlockForm extends Form
|
||||
|
||||
// Sound
|
||||
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
|
||||
// Teleport falling block to the position.
|
||||
Vector blockLoc = _block.getLocation().add(0.5, _is18 ? -.21875 : 0, 0.5).toVector();
|
||||
|
||||
_sawDiff.add(blockLoc.clone().subtract(_lastSaw));
|
||||
|
||||
Packet packet = this.getPacket(_sawDiff, blockLoc);
|
||||
|
||||
_lastSaw = Player.getLocation().toVector().subtract(new Vector(0, _is18 ? 0.15625 : 0, 0));
|
||||
_sawDiff = _lastSaw.clone().subtract(blockLoc);
|
||||
|
||||
if (packet != null)
|
||||
{
|
||||
if (packet instanceof PacketPlayOutEntityTeleport)
|
||||
{
|
||||
_sawDiff = new Vector();
|
||||
}
|
||||
|
||||
((CraftPlayer) Player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,7 +306,6 @@ public class BlockForm extends Form
|
||||
// Self
|
||||
Player.sendBlockChange(Player.getLocation(), 36, (byte) 0);
|
||||
|
||||
FallingBlockCheck();
|
||||
}
|
||||
|
||||
public void FallingBlockCheck()
|
||||
@ -295,50 +331,73 @@ public class BlockForm extends Form
|
||||
Player.setPassenger(block);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure Falling doesnt Despawn
|
||||
else
|
||||
{
|
||||
// Ensure Falling doesnt Despawn
|
||||
((CraftFallingSand) Player.getPassenger()).getHandle().ticksLived = 1;
|
||||
Player.getPassenger().setTicksLived(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (_lastSaw == null || _lastSaw.getWorld() != Player.getWorld())
|
||||
{
|
||||
_lastSaw = Player.getLocation();
|
||||
}
|
||||
this._sawDiff.add(Player.getLocation().subtract(_lastSaw).toVector());
|
||||
_lastSaw = Player.getLocation();
|
||||
// Tell falling block to move around
|
||||
|
||||
if (_lastSaw != null)
|
||||
{
|
||||
this._sawDiff.add(Player.getLocation().subtract(0, _is18 ? 0.15625 : 0, 0).toVector().subtract(_lastSaw));
|
||||
}
|
||||
|
||||
_lastSaw = Player.getLocation().subtract(0, _is18 ? 0.15625 : 0, 0).toVector();
|
||||
|
||||
Packet packet = this.getPacket(_sawDiff, _lastSaw);
|
||||
|
||||
if (packet != null)
|
||||
{
|
||||
if (packet instanceof PacketPlayOutRelEntityMove)
|
||||
{
|
||||
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet;
|
||||
_sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D));
|
||||
}
|
||||
else
|
||||
{
|
||||
_sawDiff = new Vector();
|
||||
}
|
||||
|
||||
player.playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Packet getPacket(Vector blocksFromNewPosition, Vector newPosition)
|
||||
{
|
||||
int x = (int) Math.floor(blocksFromNewPosition.getX() * 32);
|
||||
int y = (int) Math.floor(blocksFromNewPosition.getY() * 32);
|
||||
int z = (int) Math.floor(blocksFromNewPosition.getZ() * 32);
|
||||
|
||||
int x = (int) Math.floor(_sawDiff.getX() * 32);
|
||||
int y = (int) Math.floor(_sawDiff.getY() * 32);
|
||||
int z = (int) Math.floor(_sawDiff.getZ() * 32);
|
||||
if (x != 0 || y != 0 || z != 0)
|
||||
{
|
||||
Packet packet;
|
||||
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
|
||||
{
|
||||
_sawDiff.subtract(new Vector(x / 32D, y / 32D, z / 32D));
|
||||
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
|
||||
relMove.a = this._selfEntityId1;
|
||||
relMove.b = (byte) x;
|
||||
relMove.c = (byte) y;
|
||||
relMove.d = (byte) z;
|
||||
packet = relMove;
|
||||
|
||||
return relMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sawDiff = new Vector();
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
||||
teleportPacket.a = _selfEntityId1;
|
||||
teleportPacket.b = (int) Math.floor(32 * _lastSaw.getX());
|
||||
teleportPacket.c = (int) Math.floor(32 * _lastSaw.getY());
|
||||
teleportPacket.d = (int) Math.floor(32 * _lastSaw.getZ());
|
||||
packet = teleportPacket;
|
||||
teleportPacket.b = (int) Math.floor(32 * newPosition.getX());
|
||||
teleportPacket.c = (int) Math.floor(32 * newPosition.getY());
|
||||
teleportPacket.d = (int) Math.floor(32 * newPosition.getZ());
|
||||
|
||||
return teleportPacket;
|
||||
}
|
||||
player.playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Block GetBlock()
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user