mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-29 19:46:42 +00:00
Attempts to resolve FS-311 and mitigates FS-396
This commit is contained in:
@ -21,6 +21,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@ -411,6 +412,25 @@ public class Shop extends FreedomService
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
String message = event.getMessage();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (ConfigEntry.SHOP_ENABLED.getBoolean() && ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean()
|
||||
&& !plugin.sh.reactionString.isEmpty() && message.equals(plugin.sh.reactionString))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
PlayerData data = plugin.pl.getData(player);
|
||||
data.setCoins(data.getCoins() + plugin.sh.coinsPerReactionWin);
|
||||
plugin.pl.save(data);
|
||||
plugin.sh.endReaction(player.getName());
|
||||
player.sendMessage(ChatColor.GREEN + "You have been given " + ChatColor.GOLD
|
||||
+ plugin.sh.coinsPerReactionWin + ChatColor.GREEN + " coins!");
|
||||
}
|
||||
}
|
||||
|
||||
public ShopItem getShopItem(int slot)
|
||||
{
|
||||
for (ShopItem shopItem : ShopItem.values())
|
||||
|
Reference in New Issue
Block a user