Skip to content

Commit

Permalink
Use newer classes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed May 20, 2024
1 parent a0d334c commit 60ac9fc
Show file tree
Hide file tree
Showing 31 changed files with 156 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.concurrent.Callable;

import com.bencodez.advancedcore.api.metrics.BStatsMetrics;
import com.bencodez.simpleapi.metrics.BStatsMetrics;

public class VotingPluginMetrics {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.MiscUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

public class BroadcastHandler {
Expand All @@ -30,8 +31,7 @@ public void check() {
for (int i = 0; i < size; i++) {
votedPlayers.poll();
}
String bc = StringParser.getInstance()
.colorize(plugin.getConfigFile().getFormatAlternateBroadcastBroadcast());
String bc = MessageAPI.colorize(plugin.getConfigFile().getFormatAlternateBroadcastBroadcast());
String playersText = "";
while (!votedPlayers.isEmpty()) {
playersText += votedPlayers.remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
import com.bencodez.advancedcore.api.misc.jsonparser.JsonParser;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueBoolean;
Expand All @@ -51,6 +50,7 @@
import com.bencodez.advancedcore.bungeeapi.sockets.SocketHandler;
import com.bencodez.advancedcore.bungeeapi.sockets.SocketReceiver;
import com.bencodez.advancedcore.bungeeapi.time.BungeeTimeChecker;
import com.bencodez.simpleapi.json.JsonParser;
import com.bencodez.votingplugin.bungee.global.multiproxy.MultiProxyHandler;
import com.bencodez.votingplugin.bungee.global.multiproxy.MultiProxyMethod;
import com.bencodez.votingplugin.bungee.global.multiproxy.MultiProxyServerSocketConfiguration;
Expand Down Expand Up @@ -547,7 +547,7 @@ public void onDisable() {
num++;
}
}

voteCacheFile.save();
nonVotedPlayersCache.save();
if (mysql != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
import com.bencodez.advancedcore.api.misc.jsonparser.JsonParser;
import com.bencodez.advancedcore.api.time.TimeType;
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
import com.bencodez.advancedcore.api.user.usercache.value.DataValueBoolean;
Expand All @@ -62,6 +61,7 @@
import com.bencodez.advancedcore.bungeeapi.sockets.SocketReceiver;
import com.bencodez.advancedcore.bungeeapi.time.BungeeTimeChecker;
import com.bencodez.advancedcore.bungeeapi.velocity.VelocityYMLFile;
import com.bencodez.simpleapi.json.JsonParser;
import com.bencodez.votingplugin.bungee.BungeeMessageData;
import com.bencodez.votingplugin.bungee.BungeeMethod;
import com.bencodez.votingplugin.bungee.BungeeVersion;
Expand Down
129 changes: 65 additions & 64 deletions VotingPlugin/src/com/bencodez/votingplugin/commands/CommandLoader.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.bukkit.command.CommandSender;

import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

// TODO: Auto-generated Javadoc
Expand Down Expand Up @@ -36,7 +36,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}

// invalid command
sender.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
sender.sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.bukkit.command.CommandSender;

import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

// TODO: Auto-generated Javadoc
Expand Down Expand Up @@ -92,10 +92,10 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
// invalid command
if (adminCommand) {
sender.sendMessage(
StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandAdminVote()));
} else {
sender.sendMessage(
StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.bukkit.command.CommandSender;

import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

// TODO: Auto-generated Javadoc
Expand Down Expand Up @@ -61,7 +61,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}

// invalid command
sender.sendMessage(StringParser.getInstance().colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
sender.sendMessage(MessageAPI.colorize(plugin.getConfigFile().getFormatInvalidCommandVote()));
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
import com.bencodez.advancedcore.api.valuerequest.InputMethod;
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
import com.bencodez.advancedcore.api.valuerequest.listeners.StringListener;
import com.bencodez.advancedcore.api.yml.editor.ConfigEditor;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
import com.bencodez.simpleapi.player.PlayerUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.commands.gui.admin.AdminVoteVoteParty;
import com.bencodez.votingplugin.commands.gui.admin.cumulative.AdminVoteCumulative;
Expand Down Expand Up @@ -289,7 +289,7 @@ public void onClick(ClickEvent event) {

@Override
public void onInput(Player player, String value) {
Object ob = PlayerUtils.getInstance().getPlayerMeta(player, "VoteSite");
Object ob = PlayerUtils.getPlayerMeta(plugin, player, "VoteSite");
if (ob != null) {
VoteSite site = (VoteSite) ob;
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, value, site.getServiceSite(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

import net.md_5.bungee.api.chat.TextComponent;
Expand Down Expand Up @@ -43,9 +43,9 @@ public ArrayList<TextComponent> adminHelp(CommandSender sender, int page) {
maxPage++;
}

msg.add(StringParser.getInstance().stringToComp("&6&lVotingPlugin Admin Help " + (page) + "/" + maxPage));
msg.add(StringParser.getInstance().stringToComp("&6&l() = Needed"));
msg.add(StringParser.getInstance().stringToComp("&6&lAliases: adminvote, av"));
msg.add(MessageAPI.stringToComp("&6&lVotingPlugin Admin Help " + (page) + "/" + maxPage));
msg.add(MessageAPI.stringToComp("&6&l() = Needed"));
msg.add(MessageAPI.stringToComp("&6&lAliases: adminvote, av"));

for (int i = pagesize * (page - 1); (i < text.size()) && (i < ((page) * pagesize)); i++) {
msg.add(text.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.valuerequest.InputMethod;
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
import com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

public class AdminVoteCumulative extends GUIHandler {
Expand Down Expand Up @@ -54,7 +54,7 @@ public void onChest(Player player) {
public void onClick(ClickEvent clickEvent) {
ArrayList<Integer> nums = new ArrayList<Integer>();
for (String num : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
if (StringParser.getInstance().isInt(num)) {
if (MessageAPI.isInt(num)) {
nums.add(Integer.parseInt(num));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.valuerequest.InputMethod;
import com.bencodez.advancedcore.api.valuerequest.ValueRequest;
import com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder;
import com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener;
import com.bencodez.advancedcore.command.gui.RewardEditGUI;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

public class AdminVoteMilestones extends GUIHandler {
Expand Down Expand Up @@ -54,7 +54,7 @@ public void onChest(Player player) {
public void onClick(ClickEvent clickEvent) {
ArrayList<Integer> nums = new ArrayList<Integer>();
for (String num : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
if (StringParser.getInstance().isInt(num)) {
if (MessageAPI.isInt(num)) {
nums.add(Integer.parseInt(num));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;

Expand Down Expand Up @@ -43,15 +43,15 @@ private ItemBuilder getItemSlot(String slot, Player player) {

String str = plugin.getConfigFile().getVoteTopDefault();
if (lore.length == 0) {
if (StringParser.getInstance().startsWithIgnoreCase(slot, "url")) {
if (MessageAPI.startsWithIgnoreCase(slot, "url")) {
lore = new String[] { "&aClick me" };
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "next")) {
} else if (MessageAPI.startsWithIgnoreCase(slot, "next")) {
lore = ArrayUtils.getInstance().convert(new VoteNext(plugin, player, user).getChat(player));
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "last")) {
} else if (MessageAPI.startsWithIgnoreCase(slot, "last")) {
lore = ArrayUtils.getInstance().convert(new VoteLast(plugin, player, user).getChat(player));
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "total")) {
} else if (MessageAPI.startsWithIgnoreCase(slot, "total")) {
lore = ArrayUtils.getInstance().convert(new VoteTotal(plugin, player, user).getChat(player));
} else if (StringParser.getInstance().startsWithIgnoreCase(slot, "top")) {
} else if (MessageAPI.startsWithIgnoreCase(slot, "top")) {

if (str.equalsIgnoreCase("monthly")) {
lore = plugin.getTopVoterHandler().topVoterMonthly(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.simpleapi.nms.NMSManager;
import com.bencodez.votingplugin.VotingPluginMain;

Expand Down Expand Up @@ -121,7 +121,7 @@ public ArrayList<TextComponent> voteHelpText(CommandSender sender) {
maxPage++;
}

msg.add(StringParser.getInstance()
msg.add(MessageAPI
.stringToComp(plugin.getConfigFile().getFormatCommandsVoteHelpTitle() + " " + page + "/" + maxPage));

for (int i = pagesize * (page - 1); (i < text.size()) && (i < ((page) * pagesize)); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
import com.bencodez.advancedcore.api.inventory.BInventory;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent;
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.objects.VoteSite;
import com.bencodez.votingplugin.user.VotingPluginUser;
Expand All @@ -40,7 +41,7 @@ public ArrayList<String> getChat(CommandSender sender) {

String playerName = user.getPlayerName();

msg.add(StringParser.getInstance().colorize(StringParser.getInstance()
msg.add(MessageAPI.colorize(StringParser.getInstance()
.replaceIgnoreCase(plugin.getConfigFile().getFormatCommandsVoteNextTitle(), "%player%", playerName)));

for (VoteSite voteSite : plugin.getVoteSitesEnabled()) {
Expand All @@ -52,7 +53,7 @@ public ArrayList<String> getChat(CommandSender sender) {

msgLine = StringParser.getInstance().replaceIgnoreCase(msgLine, "%SiteName%",
voteSite.getDisplayName());
msg.add(StringParser.getInstance().colorize(msgLine));
msg.add(MessageAPI.colorize(msgLine));
}
}
return msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;

Expand Down Expand Up @@ -46,7 +47,7 @@ public void onChat(CommandSender sender) {
@Override
public void onChest(Player player) {
if (!plugin.getGui().isChestVoteShopEnabled()) {
player.sendMessage(StringParser.getInstance().colorize(plugin.getGui().getChestVoteShopDisabled()));
player.sendMessage(MessageAPI.colorize(plugin.getGui().getChestVoteShopDisabled()));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.bencodez.advancedcore.api.inventory.BInventoryButton;
import com.bencodez.advancedcore.api.item.ItemBuilder;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.PlayerUtils;
import com.bencodez.advancedcore.api.rewards.RewardOptions;
import com.bencodez.simpleapi.player.PlayerUtils;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;

Expand Down Expand Up @@ -46,7 +46,7 @@ public void onChat(CommandSender sender) {

@Override
public void onChest(Player player) {
PlayerUtils.getInstance().setPlayerMeta(player, "ident", identifier);
PlayerUtils.setPlayerMeta(plugin, player, "ident", identifier);
BInventory inv = new BInventory(plugin.getGui().getChestShopConfirmPurchaseTitle());
inv.dontClose();
inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopConfirmPurchaseYesItem())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.bukkit.command.TabCompleter;

import com.bencodez.advancedcore.api.command.TabCompleteHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

/**
Expand Down Expand Up @@ -40,7 +40,7 @@ public List<String> onTabComplete(CommandSender sender, Command cmd, String alia
args.length - 1));

for (String str : cmds) {
if (StringParser.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
tab.add(str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import com.bencodez.advancedcore.api.command.CommandHandler;
import com.bencodez.advancedcore.api.command.TabCompleteHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.advancedcore.api.misc.ArrayUtils;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

/**
Expand Down Expand Up @@ -88,7 +88,7 @@ public List<String> onTabComplete(CommandSender sender, Command cmd, String alia
}

for (String str : cmds) {
if (StringParser.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
tab.add(str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.bukkit.command.TabCompleter;

import com.bencodez.advancedcore.api.command.TabCompleteHandler;
import com.bencodez.advancedcore.api.messages.StringParser;
import com.bencodez.simpleapi.messages.MessageAPI;
import com.bencodez.votingplugin.VotingPluginMain;

// TODO: Auto-generated Javadoc
Expand Down Expand Up @@ -41,7 +41,7 @@ public List<String> onTabComplete(CommandSender sender, Command cmd, String alia
args.length - 1));

for (String str : cmds) {
if (StringParser.getInstance().startsWithIgnoreCase(str, args[args.length - 1])) {
if (MessageAPI.startsWithIgnoreCase(str, args[args.length - 1])) {
tab.add(str);
}
}
Expand Down
Loading

0 comments on commit 60ac9fc

Please sign in to comment.