1.16, overhaul of player data

This commit is contained in:
Seth
2020-06-30 00:25:38 -07:00
parent 4ddcc3b8d7
commit eb58419a3a
95 changed files with 1553 additions and 3263 deletions

View File

@ -1,20 +1,18 @@
package me.totalfreedom.totalfreedommod;
import com.google.common.base.Strings;
import java.time.LocalDate;
import java.time.Period;
import java.util.Date;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.shop.ShopData;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -41,7 +39,7 @@ public class ChatManager extends FreedomService
{
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerChatFormat(AsyncPlayerChatEvent event)
{
try
@ -66,9 +64,9 @@ public class ChatManager extends FreedomService
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean() && !plugin.sh.reactionString.isEmpty() && message.equals(plugin.sh.reactionString))
{
event.setCancelled(true);
ShopData data = plugin.sh.getData(player);
PlayerData data = plugin.pl.getData(player);
data.setCoins(data.getCoins() + plugin.sh.coinsPerReactionWin);
plugin.sh.save(data);
plugin.pl.save(data);
plugin.sh.reactionString = "";
Date currentTime = new Date();
long seconds = (currentTime.getTime() - plugin.sh.reactionStartTime.getTime()) / 1000;
@ -82,7 +80,7 @@ public class ChatManager extends FreedomService
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player))
{
event.setCancelled(true);
playerMsg(player, "Chat is currently disabled.", ChatColor.RED);
playerMsg(player, "Chat is currently disabled.", org.bukkit.ChatColor.RED);
return;
}