Integrate the new ThankManager into Amplifiers
This commit is contained in:
parent
f41cd8c104
commit
1ae7f6cb25
@ -1,6 +1,5 @@
|
||||
package mineplex.core.boosters;
|
||||
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.command.BoosterCommand;
|
||||
@ -10,7 +9,7 @@ import mineplex.core.boosters.event.BoosterItemGiveEvent;
|
||||
import mineplex.core.boosters.event.BoosterUpdateEvent;
|
||||
import mineplex.core.boosters.gui.BoosterShop;
|
||||
import mineplex.core.boosters.redis.BoosterUpdateRepository;
|
||||
import mineplex.core.boosters.tips.BoosterTipManager;
|
||||
import mineplex.core.boosters.tips.BoosterThankManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
@ -19,12 +18,12 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.thank.ThankManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -64,8 +63,8 @@ public class BoosterManager extends MiniPlugin
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private BoosterThankManager _boosterThankManager;
|
||||
|
||||
private BoosterTipManager _tipManager;
|
||||
private BoosterShop _shop;
|
||||
private String _boosterGroup;
|
||||
|
||||
@ -74,7 +73,7 @@ public class BoosterManager extends MiniPlugin
|
||||
private long _cacheLastUpdated;
|
||||
private Map<String, List<Booster>> _boosterCache = new HashMap<>();
|
||||
|
||||
public BoosterManager(JavaPlugin plugin, String boosterGroup, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager)
|
||||
public BoosterManager(JavaPlugin plugin, String boosterGroup, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ThankManager thankManager)
|
||||
{
|
||||
super("Booster Manager", plugin);
|
||||
|
||||
@ -84,7 +83,7 @@ public class BoosterManager extends MiniPlugin
|
||||
_donationManager = donationManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
_tipManager = new BoosterTipManager(plugin, clientManager, donationManager);
|
||||
_boosterThankManager = new BoosterThankManager(plugin, clientManager, thankManager);
|
||||
_shop = new BoosterShop(this, clientManager, donationManager);
|
||||
|
||||
try
|
||||
@ -335,9 +334,9 @@ public class BoosterManager extends MiniPlugin
|
||||
handleBoosterUpdate(event.getBoosterMap());
|
||||
}
|
||||
|
||||
public BoosterTipManager getTipManager()
|
||||
public BoosterThankManager getBoosterThankManager()
|
||||
{
|
||||
return _tipManager;
|
||||
return _boosterThankManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@ package mineplex.core.boosters.command;
|
||||
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.boosters.tips.BoosterTipManager;
|
||||
import mineplex.core.boosters.tips.BoosterThankManager;
|
||||
import mineplex.core.boosters.tips.TipAddResult;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
@ -56,12 +56,12 @@ public class ThankCommand extends CommandBase<BoosterManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.getTipManager().addTip(caller, booster, result ->
|
||||
Plugin.getBoosterThankManager().addTip(caller, booster, result ->
|
||||
{
|
||||
if (result == TipAddResult.SUCCESS)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Tip", "You thanked " + F.name(booster.getPlayerName()) + ". They earned " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got "
|
||||
+ F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!");
|
||||
UtilPlayer.message(caller, F.main("Tip", "You thanked " + F.name(booster.getPlayerName()) + ". They earned " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterThankManager.TIP_FOR_SPONSOR) + " and you got "
|
||||
+ F.currency(GlobalCurrency.TREASURE_SHARD, BoosterThankManager.TIP_FOR_TIPPER)) + " in return!");
|
||||
caller.playSound(caller.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
}
|
||||
else if (result.getFriendlyMessage() != null)
|
||||
|
@ -0,0 +1,93 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.thank.ThankManager;
|
||||
import mineplex.core.thank.ThankResult;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
* This class handles "thanking" Amplifiers. This is a way of rewarding players for activating Amplifiers.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterThankManager extends MiniPlugin
|
||||
{
|
||||
public static final int TIP_FOR_SPONSOR = 5;
|
||||
public static final int TIP_FOR_TIPPER = 5;
|
||||
|
||||
private BoosterThankRepository _repository;
|
||||
private CoreClientManager _clientManager;
|
||||
private ThankManager _thankManager;
|
||||
|
||||
public BoosterThankManager(JavaPlugin plugin, CoreClientManager clientManager, ThankManager thankManager)
|
||||
{
|
||||
super("Amplifier Thanks", plugin);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_repository = new BoosterThankRepository(plugin);
|
||||
_thankManager = thankManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to "Thank" an Amplifier. This checks with {@link BoosterThankRepository} if a player hasn't already
|
||||
* thanked that Amplifier. If they havent, we proceed to use {@link ThankManager} to send a thank you to the player
|
||||
* who activated that Amplifier.
|
||||
*
|
||||
* @param player The player sending the thanks
|
||||
* @param booster The Amplifier to be thanked
|
||||
* @param callback Callback with the result of sending the thanks
|
||||
*/
|
||||
public void addTip(Player player, Booster booster, Callback<TipAddResult> callback)
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 5, false, false))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Amplifier", "Please wait before trying that again"));
|
||||
callback.run(TipAddResult.ON_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
int accountId = _clientManager.getAccountId(player);
|
||||
|
||||
// Break out if client manager has a bad account id
|
||||
if (accountId == -1)
|
||||
{
|
||||
callback.run(TipAddResult.INVALID_ACCOUNT_ID);
|
||||
return;
|
||||
}
|
||||
|
||||
// You can't tip yourself, silly!
|
||||
if (accountId == booster.getAccountId())
|
||||
{
|
||||
callback.run(TipAddResult.CANNOT_TIP_SELF);
|
||||
return;
|
||||
}
|
||||
|
||||
runAsync(() ->
|
||||
{
|
||||
if (_repository.checkAmplifierThank(accountId, booster.getId()))
|
||||
{
|
||||
// We can thank that amplifier!
|
||||
_thankManager.thankPlayer(booster.getPlayerName(), booster.getAccountId(), player.getName(), accountId,
|
||||
TIP_FOR_SPONSOR, TIP_FOR_TIPPER, "Amplifier", true, thankResult ->
|
||||
runSync(() -> callback.run(fromThankResult(thankResult))));
|
||||
}
|
||||
else
|
||||
{
|
||||
runSync(() -> callback.run(TipAddResult.ALREADY_TIPPED_BOOSTER));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private TipAddResult fromThankResult(ThankResult result)
|
||||
{
|
||||
return result == ThankResult.SUCCESS ? TipAddResult.SUCCESS : TipAddResult.UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.database.routines.AddTip;
|
||||
import mineplex.database.routines.CheckAmplifierThank;
|
||||
import mineplex.database.routines.ClaimTips;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterThankRepository extends MinecraftRepository
|
||||
{
|
||||
public BoosterThankRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the database if an accountId is allowed to thank a specific Amplifier.
|
||||
* This will return true and update the database if the thank is okay, or false
|
||||
* if that account ID has already thanked that Amplifier ID.
|
||||
*
|
||||
* @param accountId Account ID of the player trying to thank the Amplifier
|
||||
* @param amplifierId The ID of the Amplifier the player is trying to thank
|
||||
* @return True if the account id can thank the amplifier id, false otherwise
|
||||
*/
|
||||
public boolean checkAmplifierThank(int accountId, int amplifierId)
|
||||
{
|
||||
CheckAmplifierThank checkAmplifierThank = new CheckAmplifierThank();
|
||||
checkAmplifierThank.setInAccountId(accountId);
|
||||
checkAmplifierThank.setInAmplifierId(amplifierId);
|
||||
checkAmplifierThank.execute(jooq().configuration());
|
||||
return checkAmplifierThank.getCanThank() == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
|
||||
{
|
||||
public static final int TIP_FOR_SPONSOR = 5;
|
||||
public static final int TIP_FOR_TIPPER = 5;
|
||||
|
||||
private BoosterTipRepository _repository;
|
||||
private DonationManager _donationManager;
|
||||
|
||||
public BoosterTipManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("Amplifier Thanks", plugin, clientManager);
|
||||
|
||||
_donationManager = donationManager;
|
||||
_repository = new BoosterTipRepository(plugin);
|
||||
}
|
||||
|
||||
public void addTip(Player player, Booster booster, Callback<TipAddResult> callback)
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 5, false, false))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Amplifier", "Please wait before trying that again"));
|
||||
callback.run(TipAddResult.ON_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
int accountId = ClientManager.getAccountId(player);
|
||||
|
||||
// Break out if client manager has a bad account id
|
||||
if (accountId == -1)
|
||||
{
|
||||
callback.run(TipAddResult.INVALID_ACCOUNT_ID);
|
||||
return;
|
||||
}
|
||||
|
||||
// You can't tip yourself, silly!
|
||||
if (accountId == booster.getAccountId())
|
||||
{
|
||||
callback.run(TipAddResult.CANNOT_TIP_SELF);
|
||||
return;
|
||||
}
|
||||
|
||||
runAsync(() -> {
|
||||
TipAddResult result;
|
||||
if (_repository.addTip(accountId, booster.getAccountId(), booster.getId(), TIP_FOR_SPONSOR))
|
||||
{
|
||||
_donationManager.rewardCoinsUntilSuccess(null, "Tips", player.getName(), accountId, TIP_FOR_TIPPER);
|
||||
result = TipAddResult.SUCCESS;
|
||||
}
|
||||
else
|
||||
result = TipAddResult.ALREADY_TIPPED_BOOSTER;
|
||||
|
||||
runSync(() -> callback.run(result));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Claim all tips for a player and add those tips to their account (Treasure Shards)
|
||||
* This will call a database routine that handles the tip process.
|
||||
*
|
||||
* The callback will return -1 on a failed attempt or 0 if there was no tips to claim
|
||||
* @param player The player with tips to claim
|
||||
* @param callback Callback returning the amount of tips claimed
|
||||
*/
|
||||
public void claimTips(Player player, Callback<Integer> callback)
|
||||
{
|
||||
String playerName = player.getName();
|
||||
int accountId = ClientManager.getAccountId(player);
|
||||
|
||||
if (accountId == -1)
|
||||
{
|
||||
// uh oh, invalid account id!
|
||||
if (callback != null) callback.run(-1);
|
||||
}
|
||||
|
||||
runAsync(() -> {
|
||||
int tips = _repository.claimTips(accountId);
|
||||
runSync(() -> {
|
||||
if (tips > 0)
|
||||
{
|
||||
_donationManager.rewardCoinsUntilSuccess(null, "Tips", playerName, accountId, tips);
|
||||
}
|
||||
|
||||
// Reset tips back to 0
|
||||
if (Get(player) != null) Get(player).setTips(0);
|
||||
if (callback != null) callback.run(tips);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
{
|
||||
return "SELECT tips FROM Account.accountTip WHERE accountTip.accountId = " + accountId + ";";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerTipData addPlayer(String player)
|
||||
{
|
||||
return new PlayerTipData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
PlayerTipData data = new PlayerTipData();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
data.setTips(resultSet.getInt(1));
|
||||
}
|
||||
|
||||
Set(playerName, data);
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.database.routines.AddTip;
|
||||
import mineplex.database.routines.ClaimTips;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterTipRepository extends MinecraftRepository
|
||||
{
|
||||
public static String LOG_TIP = "INSERT INTO Account.accountTipLogs (accountId, boosterId) VALUES (?, ?)";
|
||||
public static String ADD_TIP = "INSERT INTO Account.accountTip (accountId, tips) VALUES (?, ?) ON DUPLICATE KEY UPDATE tips = tips + ?";
|
||||
|
||||
public BoosterTipRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
public boolean addTip(int tipperId, int receiverId, int boosterId, int tipAmount)
|
||||
{
|
||||
AddTip addTip = new AddTip();
|
||||
addTip.setTipperAccountId(tipperId);
|
||||
addTip.setBoosterAccountId(receiverId);
|
||||
addTip.setBoosterId(boosterId);
|
||||
addTip.setTipAmount(tipAmount);
|
||||
addTip.execute(jooq().configuration());
|
||||
return addTip.getSuccess() == 1;
|
||||
}
|
||||
|
||||
public int claimTips(int accountId)
|
||||
{
|
||||
ClaimTips claimTips = new ClaimTips();
|
||||
claimTips.setAccountId_in(accountId);
|
||||
claimTips.execute(jooq().configuration());
|
||||
return claimTips.getTipsClaimed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ public enum TipAddResult
|
||||
{
|
||||
ALREADY_TIPPED_BOOSTER("You have already thanked this Amplifier!"),
|
||||
INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"),
|
||||
UNKNOWN_ERROR("An error occurred. Try again later"),
|
||||
CANNOT_TIP_SELF("You can't thank yourself, silly!"),
|
||||
ON_COOLDOWN(null),
|
||||
SUCCESS(null);
|
||||
|
@ -16,7 +16,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 = 1432193236;
|
||||
private static final long serialVersionUID = 1890093529;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>Account</code>
|
||||
@ -39,6 +39,7 @@ public class Account extends org.jooq.impl.SchemaImpl implements java.io.Seriali
|
||||
|
||||
private final java.util.List<org.jooq.Table<?>> getTables0() {
|
||||
return java.util.Arrays.<org.jooq.Table<?>>asList(
|
||||
mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank,
|
||||
mineplex.database.tables.AccountAuth.accountAuth,
|
||||
mineplex.database.tables.AccountClan.accountClan,
|
||||
mineplex.database.tables.AccountCoinTransactions.accountCoinTransactions,
|
||||
|
@ -85,6 +85,7 @@ public class Keys {
|
||||
// UNIQUE and PRIMARY KEY definitions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountAmplifierThankRecord> KEY_accountAmplifierThank_PRIMARY = UniqueKeys0.KEY_accountAmplifierThank_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountAuthRecord> KEY_accountAuth_PRIMARY = UniqueKeys0.KEY_accountAuth_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountClanRecord> KEY_accountClan_PRIMARY = UniqueKeys0.KEY_accountClan_PRIMARY;
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountCoinTransactionsRecord> KEY_accountCoinTransactions_PRIMARY = UniqueKeys0.KEY_accountCoinTransactions_PRIMARY;
|
||||
@ -201,6 +202,7 @@ public class Keys {
|
||||
// FOREIGN KEY definitions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountAmplifierThankRecord, mineplex.database.tables.records.AccountsRecord> accountAmplifierThank_accounts_id_fk = ForeignKeys0.accountAmplifierThank_accounts_id_fk;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountAuthRecord, mineplex.database.tables.records.AccountsRecord> accountAuth_accounts_id_fk = ForeignKeys0.accountAuth_accounts_id_fk;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountCoinTransactionsRecord, mineplex.database.tables.records.AccountsRecord> FK_ACT_ACCOUNTS_ID = ForeignKeys0.FK_ACT_ACCOUNTS_ID;
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountCustomDataRecord, mineplex.database.tables.records.AccountsRecord> CUSTOMDATA_ACCOUNT = ForeignKeys0.CUSTOMDATA_ACCOUNT;
|
||||
@ -316,6 +318,7 @@ public class Keys {
|
||||
}
|
||||
|
||||
private static class UniqueKeys0 extends org.jooq.impl.AbstractKeys {
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountAmplifierThankRecord> KEY_accountAmplifierThank_PRIMARY = createUniqueKey(mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank, mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank.accountId, mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank.amplifierId);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountAuthRecord> KEY_accountAuth_PRIMARY = createUniqueKey(mineplex.database.tables.AccountAuth.accountAuth, mineplex.database.tables.AccountAuth.accountAuth.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountClanRecord> KEY_accountClan_PRIMARY = createUniqueKey(mineplex.database.tables.AccountClan.accountClan, mineplex.database.tables.AccountClan.accountClan.id);
|
||||
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountCoinTransactionsRecord> KEY_accountCoinTransactions_PRIMARY = createUniqueKey(mineplex.database.tables.AccountCoinTransactions.accountCoinTransactions, mineplex.database.tables.AccountCoinTransactions.accountCoinTransactions.id);
|
||||
@ -430,6 +433,7 @@ public class Keys {
|
||||
}
|
||||
|
||||
private static class ForeignKeys0 extends org.jooq.impl.AbstractKeys {
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountAmplifierThankRecord, mineplex.database.tables.records.AccountsRecord> accountAmplifierThank_accounts_id_fk = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank, mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank.accountId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountAuthRecord, mineplex.database.tables.records.AccountsRecord> accountAuth_accounts_id_fk = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountAuth.accountAuth, mineplex.database.tables.AccountAuth.accountAuth.accountId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountCoinTransactionsRecord, mineplex.database.tables.records.AccountsRecord> FK_ACT_ACCOUNTS_ID = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountCoinTransactions.accountCoinTransactions, mineplex.database.tables.AccountCoinTransactions.accountCoinTransactions.accountId);
|
||||
public static final org.jooq.ForeignKey<mineplex.database.tables.records.AccountCustomDataRecord, mineplex.database.tables.records.AccountsRecord> CUSTOMDATA_ACCOUNT = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountCustomData.accountCustomData, mineplex.database.tables.AccountCustomData.accountCustomData.accountId);
|
||||
|
@ -57,6 +57,18 @@ public class Routines {
|
||||
return p.getSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call <code>Account.checkAmplifierThank</code>
|
||||
*/
|
||||
public static java.lang.Byte callCheckamplifierthank(org.jooq.Configuration configuration, java.lang.Integer inAccountId, java.lang.Integer inAmplifierId) {
|
||||
mineplex.database.routines.CheckAmplifierThank p = new mineplex.database.routines.CheckAmplifierThank();
|
||||
p.setInAccountId(inAccountId);
|
||||
p.setInAmplifierId(inAmplifierId);
|
||||
|
||||
p.execute(configuration);
|
||||
return p.getCanThank();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call <code>Account.check_daily</code>
|
||||
*/
|
||||
|
@ -16,6 +16,11 @@ package mineplex.database;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Tables {
|
||||
|
||||
/**
|
||||
* The table Account.accountAmplifierThank
|
||||
*/
|
||||
public static final mineplex.database.tables.AccountAmplifierThank accountAmplifierThank = mineplex.database.tables.AccountAmplifierThank.accountAmplifierThank;
|
||||
|
||||
/**
|
||||
* The table Account.accountAuth
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.event.BoosterActivateEvent;
|
||||
import mineplex.core.boosters.event.BoosterExpireEvent;
|
||||
import mineplex.core.boosters.tips.BoosterTipManager;
|
||||
import mineplex.core.boosters.tips.BoosterThankManager;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
@ -177,7 +177,7 @@ public class BoosterPodium extends MiniPlugin
|
||||
return new String[] {
|
||||
C.cGreen + "Amplified by " + C.cWhite + booster.getPlayerName(),
|
||||
C.cWhite + booster.getTimeRemainingString() + " Remaining",
|
||||
C.cAqua + "Click to Thank. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards"
|
||||
C.cAqua + "Click to Thank. You get " + BoosterThankManager.TIP_FOR_TIPPER + " Treasure Shards"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.boosters.event.BoosterActivateEvent;
|
||||
import mineplex.core.boosters.tips.BoosterTipManager;
|
||||
import mineplex.core.boosters.tips.BoosterThankManager;
|
||||
import mineplex.core.boosters.tips.TipAddResult;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
@ -62,8 +62,8 @@ public class GameBoosterManager extends MiniPlugin
|
||||
_boosterManager.getTipManager().addTip(player, active, result -> {
|
||||
if (result == TipAddResult.SUCCESS)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tip", "You thanked " + F.name(active.getPlayerName()) + ". They earned " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got "
|
||||
+ F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!");
|
||||
UtilPlayer.message(player, F.main("Tip", "You thanked " + F.name(active.getPlayerName()) + ". They earned " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterThankManager.TIP_FOR_SPONSOR) + " and you got "
|
||||
+ F.currency(GlobalCurrency.TREASURE_SHARD, BoosterThankManager.TIP_FOR_TIPPER)) + " in return!");
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
} else
|
||||
{
|
||||
@ -87,7 +87,7 @@ public class GameBoosterManager extends MiniPlugin
|
||||
Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated a Game Amplifier on " + F.elem(event.getBoosterGroup().replaceAll("_", " ")) + "!"));
|
||||
}
|
||||
|
||||
JsonMessage message = new JsonMessage(F.main("Amplifier", F.elem("Click here") + " to thank them and receive " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER) + "!"));
|
||||
JsonMessage message = new JsonMessage(F.main("Amplifier", F.elem("Click here") + " to thank them and receive " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterThankManager.TIP_FOR_TIPPER) + "!"));
|
||||
message.click(ClickEvent.RUN_COMMAND, "/amplifier thank " + event.getBoosterGroup());
|
||||
message.hover(HoverEvent.SHOW_TEXT, C.cGreen + "Click to Thank");
|
||||
message.send(JsonMessage.MessageType.CHAT_BOX, UtilServer.getPlayers());
|
||||
|
Loading…
Reference in New Issue
Block a user