Skip to content

Commit

Permalink
Add back option to disable tab expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Dec 22, 2023
1 parent 8e27cba commit 6f49808
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,9 @@ public void convert332to400(@NotNull ConfigurationFile config) throws IOExceptio
}

public void convert403to404(@NotNull ConfigurationFile config) {
if (config.removeOption("placeholders.register-tab-expansion")) {
if (config.removeOption("global-playerlist.update-latency")) {
TAB.getInstance().getPlatform().logInfo(IChatBaseComponent.fromColoredText("&ePerforming configuration conversion from 4.0.3 to 4.0.4"));
}
config.removeOption("global-playerlist.update-latency");
}

public void convert409to410(@NotNull ConfigurationFile config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import me.neznamy.tab.shared.TabConstants;
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.placeholders.PlaceholderRefreshTask;
import me.neznamy.tab.shared.placeholders.expansion.EmptyTabExpansion;
import me.neznamy.tab.shared.platform.TabPlayer;
import me.neznamy.tab.shared.event.impl.TabPlaceholderRegisterEvent;
import me.neznamy.tab.shared.features.types.*;
Expand All @@ -37,6 +38,7 @@ public class PlaceholderManagerImpl extends TabFeature implements PlaceholderMan
@Getter private final String featureName = "Refreshing placeholders";
@Getter private final String refreshDisplayName = "Other";

private final boolean registerExpansion = TAB.getInstance().getConfig().getBoolean("placeholders.register-tab-expansion", true);
private final Map<String, Integer> refreshIntervals = TAB.getInstance().getConfig().getConfigurationSection("placeholderapi-refresh-intervals");
private final int defaultRefresh;

Expand All @@ -48,7 +50,8 @@ public class PlaceholderManagerImpl extends TabFeature implements PlaceholderMan

@Getter private int loopTime;

@NonNull @Getter private final TabExpansion tabExpansion = TAB.getInstance().getPlatform().createTabExpansion();
@NotNull @Getter private final TabExpansion tabExpansion = registerExpansion ?
TAB.getInstance().getPlatform().createTabExpansion() : new EmptyTabExpansion();

public PlaceholderManagerImpl() {
TAB.getInstance().getMisconfigurationHelper().fixRefreshIntervals(refreshIntervals);
Expand Down
1 change: 1 addition & 0 deletions shared/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ placeholders:
date-format: "dd.MM.yyyy"
time-format: "[HH:mm:ss / h:mm a]"
time-offset: 0
register-tab-expansion: true

# https://github.com/NEZNAMY/TAB/wiki/Feature-guide:-Placeholder-output-replacements
placeholder-output-replacements:
Expand Down

0 comments on commit 6f49808

Please sign in to comment.