public class WauzPlayerMail
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private long |
coinAttachment
The coin attachment of the mail.
|
private org.bukkit.inventory.ItemStack |
itemAttachment
The item attachment of the mail.
|
private static java.lang.String |
MAIL_TOKEN_KEY
The configuration key for the amount of sent mails.
|
static int |
MAX_MAILS_PER_DAY
The maximum amount of mails, a player can send per day.
|
private org.bukkit.OfflinePlayer |
receiver
The receiver of the mail.
|
private java.lang.String |
textContent
The text content of the mail.
|
Constructor and Description |
---|
WauzPlayerMail() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canSendMail(org.bukkit.entity.Player player)
Checks if a player can send more mails today.
|
static int |
getMailsSentToday(org.bukkit.entity.Player player)
Gets the amount of mails sent for the current date.
|
void |
joinAndSetTextContent(java.lang.String[] textParts,
int startingIndex)
Joins the given text parts and sets them as text content of the mail.
|
void |
send(org.bukkit.entity.Player player)
Sends the configured mail to its receiver.
|
boolean |
tryToSetCoins(org.bukkit.entity.Player player,
java.lang.String coinAmount)
Tries to set the coin attachment of the mail.
|
boolean |
tryToSetItemStack(org.bukkit.entity.Player player)
Tries to set the item attachment of the mail.
|
boolean |
tryToSetReceiver(org.bukkit.entity.Player player,
java.lang.String receiverName)
Tries to set the receiver of the mail.
|
public static final int MAX_MAILS_PER_DAY
private static final java.lang.String MAIL_TOKEN_KEY
private org.bukkit.OfflinePlayer receiver
private java.lang.String textContent
private long coinAttachment
private org.bukkit.inventory.ItemStack itemAttachment
public static boolean canSendMail(org.bukkit.entity.Player player)
player
- The player to check for.public static int getMailsSentToday(org.bukkit.entity.Player player)
player
- The player that sent the mails.WauzDateUtils.getDateLong()
,
PlayerCollectionConfigurator.getTokenLimitDate(Player, String)
,
PlayerCollectionConfigurator.getTokenLimitAmount(Player, String)
public boolean tryToSetReceiver(org.bukkit.entity.Player player, java.lang.String receiverName)
player
- The player who is sending the mail.receiverName
- The name of the player, receiving the mail.public boolean tryToSetCoins(org.bukkit.entity.Player player, java.lang.String coinAmount)
player
- The player who is sending the mail.coinAmount
- The amount of coins to attach.public boolean tryToSetItemStack(org.bukkit.entity.Player player)
player
- The player who is sending the mail and holds the item.public void joinAndSetTextContent(java.lang.String[] textParts, int startingIndex)
textParts
- The text part array.startingIndex
- The array index of the first text part to use.public void send(org.bukkit.entity.Player player)
player
- The player who is sending the mail.PlayerMailConfigurator
,
PlayerCollectionConfigurator.setTokenLimitDate(Player, String, long)
,
PlayerCollectionConfigurator.setTokenLimitAmount(Player, String, int)