diff --git a/Maps/Updating/Gravity_ShatteredSatellite.zip b/Maps/Updating/Gravity_ShatteredSatellite.zip deleted file mode 100644 index 87dc32ef1..000000000 Binary files a/Maps/Updating/Gravity_ShatteredSatellite.zip and /dev/null differ diff --git a/Plugins/.idea/misc.xml b/Plugins/.idea/misc.xml index 1e4b9a260..76fba6e9f 100644 --- a/Plugins/.idea/misc.xml +++ b/Plugins/.idea/misc.xml @@ -10,5 +10,4 @@ - - + \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/ClickEvent.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/ClickEvent.java new file mode 100644 index 000000000..a321b45cf --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/ClickEvent.java @@ -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; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/Color.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/Color.java new file mode 100644 index 000000000..12953e4f5 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/Color.java @@ -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; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/HoverEvent.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/HoverEvent.java new file mode 100644 index 000000000..e6360462c --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/HoverEvent.java @@ -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; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java index a42d080fb..0d8f6fb01 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java @@ -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() { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RunnableStatus.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RunnableStatus.java new file mode 100644 index 000000000..409cfc0fc --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RunnableStatus.java @@ -0,0 +1,6 @@ +package mineplex.core.common.util; + +public interface RunnableStatus +{ + public boolean run(); +} diff --git a/Plugins/Mineplex.Core/Mineplex.Core.iml b/Plugins/Mineplex.Core/Mineplex.Core.iml index 3d4ad9bd9..d331f2503 100644 --- a/Plugins/Mineplex.Core/Mineplex.Core.iml +++ b/Plugins/Mineplex.Core/Mineplex.Core.iml @@ -18,6 +18,6 @@ + - - + \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java index ec018f133..0e54d22e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java @@ -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); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java index 2771098a7..9953e8690 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java @@ -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)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java index 5fbe092bc..4059a0a69 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java @@ -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)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java index b2b8e43b9..7b852fe68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java @@ -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)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java b/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java index 973c7da2d..dd157d0af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java @@ -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 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)); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 70049fe90..b17cb0aa7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -30,6 +30,7 @@ public class DonationManager extends MiniPlugin private NautHashMap> _gemQueue = new NautHashMap>(); private NautHashMap> _coinQueue = new NautHashMap>(); + private NautHashMap> _goldQueue = new NautHashMap>(); public DonationManager(JavaPlugin plugin, String webAddress) { @@ -301,6 +302,88 @@ public class DonationManager extends MiniPlugin //Clean _coinQueue.clear(); } + + public void RewardGold(Callback callback, String caller, String name, UUID uuid, int amount) + { + RewardGold(callback, caller, name, uuid, amount, true); + } + + public void RewardGold(final Callback callback, final String caller, final String name, final UUID uuid, final int amount, final boolean updateTotal) + { + _repository.rewardGold(new Callback() + { + 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()); + + 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) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java index a1f2ef1dd..af5dcd692 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java @@ -12,6 +12,7 @@ public class Donor { private int _gems; private int _coins; + private int _gold; private boolean _donated; private List _salesPackagesOwned; private List _unknownSalesPackagesOwned; @@ -159,9 +160,19 @@ public class Donor { _coins += amount; } + + public void addGold(int amount) + { + _gold += amount; + } public List getCoinTransactions() { return _coinTransactions; } + + public int getGold() + { + return _gold; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java index 8166c808e..755c35f28 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -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 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() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java index e202f8836..9858dfc0f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java @@ -123,6 +123,7 @@ public class ConfirmationPageAccount @@ -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); } diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Keys.java b/Plugins/Mineplex.Database/src/mineplex/database/Keys.java index 21745142a..afcbd3525 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Keys.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Keys.java @@ -30,11 +30,13 @@ public class Keys { public static final org.jooq.Identity IDENTITY_games = Identities0.IDENTITY_games; public static final org.jooq.Identity IDENTITY_itemCategories = Identities0.IDENTITY_itemCategories; public static final org.jooq.Identity IDENTITY_items = Identities0.IDENTITY_items; + public static final org.jooq.Identity IDENTITY_mail = Identities0.IDENTITY_mail; public static final org.jooq.Identity IDENTITY_npcs = Identities0.IDENTITY_npcs; public static final org.jooq.Identity IDENTITY_playerMap = Identities0.IDENTITY_playerMap; public static final org.jooq.Identity IDENTITY_polls = Identities0.IDENTITY_polls; public static final org.jooq.Identity IDENTITY_rankBenefits = Identities0.IDENTITY_rankBenefits; public static final org.jooq.Identity IDENTITY_rewardLog = Identities0.IDENTITY_rewardLog; + public static final org.jooq.Identity IDENTITY_serverPassword = Identities0.IDENTITY_serverPassword; public static final org.jooq.Identity IDENTITY_stats = Identities0.IDENTITY_stats; public static final org.jooq.Identity IDENTITY_tournamentLeaderboard = Identities0.IDENTITY_tournamentLeaderboard; @@ -62,12 +64,14 @@ public class Keys { public static final org.jooq.UniqueKey KEY_itemCategories_nameIndex = UniqueKeys0.KEY_itemCategories_nameIndex; public static final org.jooq.UniqueKey KEY_items_PRIMARY = UniqueKeys0.KEY_items_PRIMARY; public static final org.jooq.UniqueKey KEY_items_uniqueNameCategoryIndex = UniqueKeys0.KEY_items_uniqueNameCategoryIndex; + public static final org.jooq.UniqueKey KEY_mail_PRIMARY = UniqueKeys0.KEY_mail_PRIMARY; public static final org.jooq.UniqueKey KEY_npcs_PRIMARY = UniqueKeys0.KEY_npcs_PRIMARY; public static final org.jooq.UniqueKey KEY_playerMap_PRIMARY = UniqueKeys0.KEY_playerMap_PRIMARY; public static final org.jooq.UniqueKey KEY_playerMap_playerIndex = UniqueKeys0.KEY_playerMap_playerIndex; public static final org.jooq.UniqueKey KEY_polls_PRIMARY = UniqueKeys0.KEY_polls_PRIMARY; public static final org.jooq.UniqueKey KEY_rankBenefits_PRIMARY = UniqueKeys0.KEY_rankBenefits_PRIMARY; public static final org.jooq.UniqueKey KEY_rewardLog_PRIMARY = UniqueKeys0.KEY_rewardLog_PRIMARY; + public static final org.jooq.UniqueKey KEY_serverPassword_PRIMARY = UniqueKeys0.KEY_serverPassword_PRIMARY; public static final org.jooq.UniqueKey KEY_stats_PRIMARY = UniqueKeys0.KEY_stats_PRIMARY; public static final org.jooq.UniqueKey KEY_stats_nameIndex = UniqueKeys0.KEY_stats_nameIndex; public static final org.jooq.UniqueKey KEY_tournamentLeaderboard_PRIMARY = UniqueKeys0.KEY_tournamentLeaderboard_PRIMARY; @@ -88,6 +92,7 @@ public class Keys { public static final org.jooq.ForeignKey FK_gamePlayers_games = ForeignKeys0.FK_gamePlayers_games; public static final org.jooq.ForeignKey FK_gamePlayers_accounts = ForeignKeys0.FK_gamePlayers_accounts; public static final org.jooq.ForeignKey items_ibfk_1 = ForeignKeys0.items_ibfk_1; + public static final org.jooq.ForeignKey mail_ibfk_1 = ForeignKeys0.mail_ibfk_1; public static final org.jooq.ForeignKey rewardLog_ibfk_1 = ForeignKeys0.rewardLog_ibfk_1; public static final org.jooq.ForeignKey FK_tournamentLeaderboard_accounts = ForeignKeys0.FK_tournamentLeaderboard_accounts; @@ -108,11 +113,13 @@ public class Keys { public static org.jooq.Identity IDENTITY_games = createIdentity(mineplex.database.tables.Games.games, mineplex.database.tables.Games.games.id); public static org.jooq.Identity IDENTITY_itemCategories = createIdentity(mineplex.database.tables.ItemCategories.itemCategories, mineplex.database.tables.ItemCategories.itemCategories.id); public static org.jooq.Identity IDENTITY_items = createIdentity(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.id); + public static org.jooq.Identity IDENTITY_mail = createIdentity(mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.id); public static org.jooq.Identity IDENTITY_npcs = createIdentity(mineplex.database.tables.Npcs.npcs, mineplex.database.tables.Npcs.npcs.id); public static org.jooq.Identity IDENTITY_playerMap = createIdentity(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.id); public static org.jooq.Identity IDENTITY_polls = createIdentity(mineplex.database.tables.Polls.polls, mineplex.database.tables.Polls.polls.id); public static org.jooq.Identity IDENTITY_rankBenefits = createIdentity(mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.id); public static org.jooq.Identity IDENTITY_rewardLog = createIdentity(mineplex.database.tables.RewardLog.rewardLog, mineplex.database.tables.RewardLog.rewardLog.id); + public static org.jooq.Identity IDENTITY_serverPassword = createIdentity(mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.ServerPassword.serverPassword.id); public static org.jooq.Identity IDENTITY_stats = createIdentity(mineplex.database.tables.Stats.stats, mineplex.database.tables.Stats.stats.id); public static org.jooq.Identity 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 KEY_itemCategories_nameIndex = createUniqueKey(mineplex.database.tables.ItemCategories.itemCategories, mineplex.database.tables.ItemCategories.itemCategories.name); public static final org.jooq.UniqueKey KEY_items_PRIMARY = createUniqueKey(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.id); public static final org.jooq.UniqueKey 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 KEY_mail_PRIMARY = createUniqueKey(mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.id); public static final org.jooq.UniqueKey KEY_npcs_PRIMARY = createUniqueKey(mineplex.database.tables.Npcs.npcs, mineplex.database.tables.Npcs.npcs.id); public static final org.jooq.UniqueKey KEY_playerMap_PRIMARY = createUniqueKey(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.id); public static final org.jooq.UniqueKey KEY_playerMap_playerIndex = createUniqueKey(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.playerName); public static final org.jooq.UniqueKey KEY_polls_PRIMARY = createUniqueKey(mineplex.database.tables.Polls.polls, mineplex.database.tables.Polls.polls.id); public static final org.jooq.UniqueKey KEY_rankBenefits_PRIMARY = createUniqueKey(mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.id); public static final org.jooq.UniqueKey KEY_rewardLog_PRIMARY = createUniqueKey(mineplex.database.tables.RewardLog.rewardLog, mineplex.database.tables.RewardLog.rewardLog.id); + public static final org.jooq.UniqueKey KEY_serverPassword_PRIMARY = createUniqueKey(mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.ServerPassword.serverPassword.id); public static final org.jooq.UniqueKey KEY_stats_PRIMARY = createUniqueKey(mineplex.database.tables.Stats.stats, mineplex.database.tables.Stats.stats.id); public static final org.jooq.UniqueKey KEY_stats_nameIndex = createUniqueKey(mineplex.database.tables.Stats.stats, mineplex.database.tables.Stats.stats.name); public static final org.jooq.UniqueKey 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 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 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 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 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 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 FK_tournamentLeaderboard_accounts = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard, mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.accountId); } diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Tables.java b/Plugins/Mineplex.Database/src/mineplex/database/Tables.java index 2e682c253..9ab9306c5 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Tables.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Tables.java @@ -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 */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Mail.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Mail.java new file mode 100644 index 000000000..e2137cc03 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Mail.java @@ -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 implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 1684976566; + + /** + * The singleton instance of Account.mail + */ + 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 getRecordType() { + return mineplex.database.tables.records.MailRecord.class; + } + + /** + * The column Account.mail.id. + */ + public final org.jooq.TableField id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.mail.accountId. + */ + public final org.jooq.TableField accountId = createField("accountId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.mail.sender. + */ + public final org.jooq.TableField sender = createField("sender", org.jooq.impl.SQLDataType.VARCHAR.length(64).nullable(false), this, ""); + + /** + * The column Account.mail.message. + */ + public final org.jooq.TableField message = createField("message", org.jooq.impl.SQLDataType.VARCHAR.length(1024).nullable(false), this, ""); + + /** + * The column Account.mail.archived. + */ + public final org.jooq.TableField archived = createField("archived", org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.mail.deleted. + */ + public final org.jooq.TableField deleted = createField("deleted", org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.mail.timeSent. + */ + public final org.jooq.TableField timeSent = createField("timeSent", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaulted(true), this, ""); + + /** + * Create a Account.mail table reference + */ + public Mail() { + this("mail", null); + } + + /** + * Create an aliased Account.mail table reference + */ + public Mail(java.lang.String alias) { + this(alias, mineplex.database.tables.Mail.mail); + } + + private Mail(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private Mail(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, mineplex.database.Account.Account, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Identity getIdentity() { + return mineplex.database.Keys.IDENTITY_mail; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return mineplex.database.Keys.KEY_mail_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>asList(mineplex.database.Keys.KEY_mail_PRIMARY); + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getReferences() { + return java.util.Arrays.>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); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/ServerPassword.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/ServerPassword.java new file mode 100644 index 000000000..17a65b91b --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/ServerPassword.java @@ -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 implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 2057289854; + + /** + * The singleton instance of Account.serverPassword + */ + 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 getRecordType() { + return mineplex.database.tables.records.ServerPasswordRecord.class; + } + + /** + * The column Account.serverPassword.id. + */ + public final org.jooq.TableField id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.serverPassword.server. + */ + public final org.jooq.TableField server = createField("server", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, ""); + + /** + * The column Account.serverPassword.password. + */ + public final org.jooq.TableField password = createField("password", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, ""); + + /** + * Create a Account.serverPassword table reference + */ + public ServerPassword() { + this("serverPassword", null); + } + + /** + * Create an aliased Account.serverPassword table reference + */ + public ServerPassword(java.lang.String alias) { + this(alias, mineplex.database.tables.ServerPassword.serverPassword); + } + + private ServerPassword(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private ServerPassword(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, mineplex.database.Account.Account, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Identity getIdentity() { + return mineplex.database.Keys.IDENTITY_serverPassword; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return mineplex.database.Keys.KEY_serverPassword_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>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); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/MailRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/MailRecord.java new file mode 100644 index 000000000..dfaf43d8c --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/MailRecord.java @@ -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 implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7 { + + private static final long serialVersionUID = -1355242451; + + /** + * Setter for Account.mail.id. + */ + public void setId(java.lang.Integer value) { + setValue(0, value); + } + + /** + * Getter for Account.mail.id. + */ + public java.lang.Integer getId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for Account.mail.accountId. + */ + public void setAccountId(java.lang.Integer value) { + setValue(1, value); + } + + /** + * Getter for Account.mail.accountId. + */ + public java.lang.Integer getAccountId() { + return (java.lang.Integer) getValue(1); + } + + /** + * Setter for Account.mail.sender. + */ + public void setSender(java.lang.String value) { + setValue(2, value); + } + + /** + * Getter for Account.mail.sender. + */ + public java.lang.String getSender() { + return (java.lang.String) getValue(2); + } + + /** + * Setter for Account.mail.message. + */ + public void setMessage(java.lang.String value) { + setValue(3, value); + } + + /** + * Getter for Account.mail.message. + */ + public java.lang.String getMessage() { + return (java.lang.String) getValue(3); + } + + /** + * Setter for Account.mail.archived. + */ + public void setArchived(java.lang.Byte value) { + setValue(4, value); + } + + /** + * Getter for Account.mail.archived. + */ + public java.lang.Byte getArchived() { + return (java.lang.Byte) getValue(4); + } + + /** + * Setter for Account.mail.deleted. + */ + public void setDeleted(java.lang.Byte value) { + setValue(5, value); + } + + /** + * Getter for Account.mail.deleted. + */ + public java.lang.Byte getDeleted() { + return (java.lang.Byte) getValue(5); + } + + /** + * Setter for Account.mail.timeSent. + */ + public void setTimeSent(java.sql.Timestamp value) { + setValue(6, value); + } + + /** + * Getter for Account.mail.timeSent. + */ + public java.sql.Timestamp getTimeSent() { + return (java.sql.Timestamp) getValue(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record1 key() { + return (org.jooq.Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record7 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row7 fieldsRow() { + return (org.jooq.Row7) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row7 valuesRow() { + return (org.jooq.Row7) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return mineplex.database.tables.Mail.mail.id; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return mineplex.database.tables.Mail.mail.accountId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field3() { + return mineplex.database.tables.Mail.mail.sender; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field4() { + return mineplex.database.tables.Mail.mail.message; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field5() { + return mineplex.database.tables.Mail.mail.archived; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field6() { + return mineplex.database.tables.Mail.mail.deleted; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field 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); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/ServerPasswordRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/ServerPasswordRecord.java new file mode 100644 index 000000000..d611495df --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/ServerPasswordRecord.java @@ -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 implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { + + private static final long serialVersionUID = 1338036491; + + /** + * Setter for Account.serverPassword.id. + */ + public void setId(java.lang.Integer value) { + setValue(0, value); + } + + /** + * Getter for Account.serverPassword.id. + */ + public java.lang.Integer getId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for Account.serverPassword.server. + */ + public void setServer(java.lang.String value) { + setValue(1, value); + } + + /** + * Getter for Account.serverPassword.server. + */ + public java.lang.String getServer() { + return (java.lang.String) getValue(1); + } + + /** + * Setter for Account.serverPassword.password. + */ + public void setPassword(java.lang.String value) { + setValue(2, value); + } + + /** + * Getter for Account.serverPassword.password. + */ + public java.lang.String getPassword() { + return (java.lang.String) getValue(2); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record1 key() { + return (org.jooq.Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record3 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row3 fieldsRow() { + return (org.jooq.Row3) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row3 valuesRow() { + return (org.jooq.Row3) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return mineplex.database.tables.ServerPassword.serverPassword.id; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return mineplex.database.tables.ServerPassword.serverPassword.server; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field 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); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java index 607cbca6e..69bf2b835 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java @@ -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 @Override protected void BuildPage() { - + PvpItem item = new PvpItem(Material.STONE, (byte)0, 1, "Stone", 25, 64); + AddButton(1, item, new PvpShopButton(this, item)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java new file mode 100644 index 000000000..5d6aca0f7 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java @@ -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); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java new file mode 100644 index 000000000..1117664e5 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java @@ -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> 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) + { + } +} diff --git a/Plugins/Mineplex.Hub/Mineplex.Hub.iml b/Plugins/Mineplex.Hub/Mineplex.Hub.iml index fa16dfadc..d609cb37f 100644 --- a/Plugins/Mineplex.Hub/Mineplex.Hub.iml +++ b/Plugins/Mineplex.Hub/Mineplex.Hub.iml @@ -17,6 +17,7 @@ + + - - + \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 11ab1e70e..4ab1a5726 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -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)); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 6f4c4c1b6..16dc5b4b5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -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 _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(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java new file mode 100644 index 000000000..a5fd6ebb4 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java @@ -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 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 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 getNotifications(Player player) + { + return Get(player).getUnreadMessages(); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java new file mode 100644 index 000000000..f33baf42a --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailMessage.java @@ -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 lines = new ArrayList(); + + ArrayList 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() + { + @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 formatMessage() + { + String mailMessage = ChatColor.translateAlternateColorCodes('&', _message); // Color the message + + ArrayList parts = new ArrayList(); + 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; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java new file mode 100644 index 000000000..5754a9a41 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java @@ -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 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; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/PlayerMailData.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/PlayerMailData.java new file mode 100644 index 000000000..6a2501d11 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/PlayerMailData.java @@ -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 _messages; + + public PlayerMailData() + { + _messages = new ArrayList(); + } + + public List getMessages() + { + return _messages; + } + + public List getUnreadMessages() + { + ArrayList unreadMessages = new ArrayList(); + + for (MailMessage message : _messages) + { + if (!(message.isArchived() || message.isDeleted())) + unreadMessages.add(message); + } + + return unreadMessages; + } + } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/NotificationManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/NotificationManager.java new file mode 100644 index 000000000..49d5cd4b3 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/NotificationManager.java @@ -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 _notifiers; + + public NotificationManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super("Notification", plugin); + + _notifiers = new ArrayList(); + _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 getNotifications(Player player) + { + List notifications = new ArrayList(); + + 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 + { + @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(); + } + } + + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notification.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notification.java new file mode 100644 index 000000000..5e2997dc3 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notification.java @@ -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(); +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/NotificationPriority.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/NotificationPriority.java new file mode 100644 index 000000000..79ac9723b --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/NotificationPriority.java @@ -0,0 +1,6 @@ +package mineplex.hub.notification.api; + +public enum NotificationPriority +{ + HIGH, NORMAL, LOW; +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notifier.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notifier.java new file mode 100644 index 000000000..51c61b235 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/api/Notifier.java @@ -0,0 +1,10 @@ +package mineplex.hub.notification.api; + +import java.util.List; + +import org.bukkit.entity.Player; + +public interface Notifier +{ + public List getNotifications(Player player); +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/command/NotificationCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/command/NotificationCommand.java new file mode 100644 index 000000000..789a9896c --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/command/NotificationCommand.java @@ -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 +{ + public NotificationCommand(NotificationManager plugin) + { + super(plugin, Rank.ALL, "notifications"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.openShop(caller); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/NotificationShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/NotificationShop.java new file mode 100644 index 000000000..20a7a1745 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/NotificationShop.java @@ -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 +{ + public NotificationShop(NotificationManager plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super(plugin, clientManager, donationManager, "Notifications"); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new NotificationPage(Plugin, this, ClientManager, DonationManager, player); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/button/NotificationButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/button/NotificationButton.java new file mode 100644 index 000000000..e5a9e5afa --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/button/NotificationButton.java @@ -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); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/page/NotificationPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/page/NotificationPage.java new file mode 100644 index 000000000..02d9e918e --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/notification/gui/page/NotificationPage.java @@ -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 +{ + 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 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); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java index 0d7b68656..64ea760de 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java @@ -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 +public class PollManager extends MiniDbClientPlugin { private PollRepository _repository; private DonationManager _donationManager; private List _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 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 { 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 + "';"; + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollRepository.java index fa2a25e80..c6cb8cd4a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollRepository.java @@ -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())); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java index 6bfc82b46..fea830b95 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java @@ -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 diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java index 6caed67e4..3f9e7bd3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java @@ -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() diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 3db6bb26f..738ecd2f8 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ