Skip to content

Commit

Permalink
Remove all unused skull options
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Nov 3, 2024
1 parent 4cc5234 commit 65e180c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 34 deletions.
11 changes: 1 addition & 10 deletions VotingPlugin/Resources/Config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,16 +598,7 @@ DefaultRewardBlackListedWorlds: []
# Preload skulls to improve performance for vote top
# when using skulls as the item to display players
# If false, skulls will be cached as they are used
# assuming loadskulls is enabled
PreloadSkulls: false

# Setting to false disables saving skulls in a cache to improve speeds
# Will reduce ram usage (very little) if disabled, but slow GUI speeds when using skulls
LoadSkulls: true

# If true, skulls will be loaded on GUI even if not cached
# May result in GUI taking longer to open until skulls are cached
ForceLoadSkulls: false
PreloadSkulls: true

###########################################
# Extra checks on vote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public void onChest(Player player) {
msg = PlaceholderUtils.replacePlaceHolder(msg, placeholders);
ItemBuilder item = null;
if (plugin.getGui().isChestVoteTodayUseSkull() && !NMSManager.getInstance().isVersion("1.12")) {
item = new ItemBuilder(user.getPlayerHead(plugin.getConfigFile().isForceLoadSkulls()));
item = new ItemBuilder(user.getPlayerHead());
} else {
item = new ItemBuilder(plugin.getGui().getChestVoteTodayPlayerItem());
}
item.setName(PlaceholderUtils.replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(),
"player", user.getPlayerName()));
item.setName(PlaceholderUtils.replacePlaceHolder(plugin.getGui().getChestVoteTodayIconTitle(), "player",
user.getPlayerName()));
item.setLore(msg);
final UUID uuid = user.getUuid();
inv.addButton(inv.getNextSlot(), new BInventoryButton(item) {
Expand All @@ -116,23 +116,29 @@ public void onClick(ClickEvent clickEvent) {
});
}
}

String guiPath = "VoteToday";
for (final String str : plugin.getGui().getChestGUIExtraItems(guiPath)) {
inv.addButton(
new BInventoryButton(new ItemBuilder(plugin.getGui().getChestGUIExtraItemsItem(guiPath, str))) {

@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "." + clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());
@Override
public void onClick(ClickEvent clickEvent) {
new RewardBuilder(plugin.getGui().getData(),
"CHEST." + guiPath + ".ExtraItems." + str + "."
+ clickEvent.getButton().getLastRewardsPath(player))
.setGiveOffline(false).send(clickEvent.getPlayer());

}
}

});}
});
}

if(plugin.getGui().isChestVoteTodayBackButton()){inv.addButton(plugin.getCommandLoader().getBackButton(user));}inv.openInventory(player);}
if (plugin.getGui().isChestVoteTodayBackButton()) {
inv.addButton(plugin.getCommandLoader().getBackButton(user));
}
inv.openInventory(player);
}

@Override
public void open() {
Expand All @@ -150,8 +156,8 @@ public String[] voteToday() {
placeholders.put("player", user.getPlayerName());
placeholders.put("votesite", voteSite.getKey());
placeholders.put("time", timeString);
msg.add(PlaceholderUtils
.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(), placeholders));
msg.add(PlaceholderUtils.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(),
placeholders));
// msg.add("&6" + user.getPlayerName() + " : " + voteSite.getKey() + " : " +
// timeString);
}
Expand Down Expand Up @@ -179,8 +185,8 @@ public String[] voteTodayGUI() {
placeholders.put("player", user.getPlayerName());
placeholders.put("votesite", mostRecentSite.getKey());
placeholders.put("time", timeString);
msg.add(PlaceholderUtils
.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(), placeholders));
msg.add(PlaceholderUtils.replacePlaceHolder(plugin.getConfigFile().getFormatCommandsVoteTodayLine(),
placeholders));
}
}
msg = ArrayUtils.colorize(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ public void onChest(Player player) {
ItemBuilder playerItem = new ItemBuilder(Material.PAPER);

if (plugin.getGui().isChestVoteTopUseSkull()) {
playerItem = new ItemBuilder(
entry.getKey().getPlayerHead(plugin.getConfigFile().isForceLoadSkulls()));
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
} else {
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void onChest(Player player) {
ItemBuilder playerItem;

if (plugin.getGui().isChestVoteTopUseSkull()) {
playerItem = new ItemBuilder(entry.getKey().getPlayerHead(plugin.getConfigFile().isForceLoadSkulls()));
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
} else {
playerItem = new ItemBuilder(Material.valueOf(plugin.getGui().getChestVoteTopPlayerItemMaterial()));
}
Expand Down
4 changes: 0 additions & 4 deletions VotingPlugin/src/com/bencodez/votingplugin/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public class Config extends YMLFile {
@Getter
private boolean perSiteCoolDownEvents = false;

@ConfigDataBoolean(path = "ForceLoadSkulls")
@Getter
private boolean forceLoadSkulls = false;

@ConfigDataInt(path = "LimitVotePoints")
@Getter
private int limitVotePoints = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public TopVoterPlayer(UUID uuid, String playerName, Long lastVoteTime) {
this.lastVoteTime = lastVoteTime;
}

public ItemStack getPlayerHead(boolean force) {
public ItemStack getPlayerHead() {
return VotingPluginMain.plugin.getSkullCacheHandler().getSkull(uuid, playerName);
}

Expand Down

0 comments on commit 65e180c

Please sign in to comment.