- Added option to change recommended values in insights

This commit is contained in:
KyTDK committed 2023-11-18 01:38:46 +11:00
1 parent 6e7b6b23bd
commit c029c548eb
26 files changed
+232 -176

No files matched your search

@@ -1,11 +1,41 @@
package com.neomechanical.neoperformance.performance.insight;
public abstract class InsightElement {
import com.neomechanical.neoconfig.neoutils.NeoUtils;
public abstract class InsightElement<T> {
public T recommendedValue;
public abstract boolean isInsightApplicableOrAlreadyPresent();
public abstract String recommendedValue();
public InsightElement() {
setDefaultValue();
}
public abstract String currentValue();
public String getRecommendedValue() {
return String.valueOf(recommendedValue);
}
public void setRecommendedValue(String recommendedValue) {
try {
if (this.recommendedValue instanceof String) {
this.recommendedValue = (T) recommendedValue;
} else if (this.recommendedValue instanceof Integer) {
this.recommendedValue = (T) Integer.valueOf(recommendedValue);
} else if (this.recommendedValue instanceof Boolean) {
this.recommendedValue = (T) Boolean.valueOf(recommendedValue);
} else if (this.recommendedValue instanceof Double) {
this.recommendedValue = (T) Double.valueOf(recommendedValue);
} else {
NeoUtils.getNeoUtilities().getFancyLogger().warn("Failed to set value");
}
} catch (Exception e) {
NeoUtils.getNeoUtilities().getFancyLogger().warn("Failed to convert values: " + e.getMessage());
}
}
public abstract void setDefaultValue();
public abstract T currentValue();
public abstract void fix();
}
@@ -1,5 +1,6 @@
package com.neomechanical.neoperformance.performance.insight;
import com.neomechanical.neoconfig.anvilgui.AnvilGUI;
import com.neomechanical.neoconfig.neoutils.inventory.InventoryUtil;
import com.neomechanical.neoconfig.neoutils.inventory.managers.data.InventoryGUI;
import com.neomechanical.neoconfig.neoutils.inventory.managers.data.InventoryItem;
@@ -10,34 +11,59 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.function.Consumer;
public class InsightGUIReport {
private final InventoryGUI inventoryGUI = InventoryUtil.createInventoryGUI(null, 54, "Insights");
public InsightGUIReport buildReport(HashMap<String, HashMap<String, InsightElement>> insights) {
public InsightGUIReport buildReport(HashMap<String, HashMap<String, InsightElement<?>>> insights) {
insights.forEach((category, categoryInsights) -> {
categoryInsights.forEach((insightName, insightElement) -> {
if (!insightElement.isInsightApplicableOrAlreadyPresent()) {
return;
}
ArrayList<String> lore = new ArrayList<>();
lore.add(ChatColor.translateAlternateColorCodes('&', "&7Category: ") + category);
lore.add(ChatColor.translateAlternateColorCodes('&', "&7Current value: &4") + insightElement.currentValue());
lore.add(ChatColor.translateAlternateColorCodes('&', "&7Recommended value: &a") + insightElement.recommendedValue());
lore.add(ChatColor.translateAlternateColorCodes('&', "&7Recommended value: &a") + insightElement.getRecommendedValue());
lore.add(ChatColor.translateAlternateColorCodes('&', "&f&lRight click &r&7to set custom value"));
Consumer<InventoryClickEvent> fixAction = event -> {
insightElement.fix();
new Insights().openInsights(event.getWhoClicked());
MessageUtil.sendMM(event.getWhoClicked(), NeoPerformance.getLanguageManager().getString("insights.fixAutomaticDone", null));
};
Consumer<InventoryClickEvent> changeRecommendedValue = event -> {
new AnvilGUI.Builder().
onClick((slot, snapshot) -> {
insightElement.setRecommendedValue(snapshot.getText());
insightElement.fix();
new Insights().openInsights(event.getWhoClicked());
return Collections.singletonList(AnvilGUI.ResponseAction.close());
})
.onClose(stateSnapshot -> {
new BukkitRunnable() {
@Override
public void run() {
new Insights().openInsights(event.getWhoClicked());
}
}.runTaskLater(NeoPerformance.getInstance(), 1L);
})
.text(insightElement.getRecommendedValue())
.title("Change recommended value")
.plugin(NeoPerformance.getInstance())
.open((Player) event.getWhoClicked());
};
InventoryItem item = new InventoryItem.InventoryItemBuilder(
() -> ItemUtil.createItem(Material.ANVIL, 1, "&7" + insightName + " &f&l(Click to fix)", lore))
.setAction(fixAction)
() -> ItemUtil.createItem(Material.ANVIL, 1, "&7" + insightName + " &f&l(Left click to fix)", lore))
.setAction(fixAction, ClickType.LEFT)
.setAction(changeRecommendedValue, ClickType.RIGHT)
.build();
inventoryGUI.addItem(item);
});
@@ -9,7 +9,7 @@ import com.neomechanical.neoperformance.performance.insight.elements.spigot.yml.
import java.util.HashMap;
public class InsightManager {
private final HashMap<String, HashMap<String, InsightElement>> categories = new HashMap<>();
private final HashMap<String, HashMap<String, InsightElement<?>>> categories = new HashMap<>();
public InsightManager() {
//Server.properties
@@ -40,7 +40,7 @@ public class InsightManager {
addInsight("bukkit.yml", "ticks-per-animal-autosave", new TicksPerAutosave());
}
public void addInsight(String category, String insightName, InsightElement insightElement) {
public void addInsight(String category, String insightName, InsightElement<?> insightElement) {
if (insightElement.isInsightApplicableOrAlreadyPresent()) {
categories.computeIfAbsent(category, k -> new HashMap<>()).put(insightName, insightElement);
}
@@ -50,7 +50,7 @@ public class InsightManager {
return categories.getOrDefault(category, new HashMap<>()).get(insight);
}
public HashMap<String, HashMap<String, InsightElement>> getInsightsMap() {
public HashMap<String, HashMap<String, InsightElement<?>>> getInsightsMap() {
return categories;
}
}
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class ChunkGCPeriodInTicks extends InsightElement {
public class ChunkGCPeriodInTicks extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.chunk-gc.period-in-ticks") > 300;
return yamlOthers.getConfig().getDouble("spawn-limits.chunk-gc.period-in-ticks") > recommendedValue;
}
@Override
public String recommendedValue() {
return "300";
public void setDefaultValue() {
recommendedValue = 300;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.chunk-gc.period-in-ticks");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.chunk-gc.period-in-ticks");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.chunk-gc.period-in-ticks", 300);
yamlConfiguration.set("spawn-limits.chunk-gc.period-in-ticks", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class ChunkGCPeriodLoadThreshold extends InsightElement {
public class ChunkGCPeriodLoadThreshold extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.chunk-gc.load-threshold") > 300;
return yamlOthers.getConfig().getDouble("spawn-limits.chunk-gc.load-threshold") > recommendedValue;
}
@Override
public String recommendedValue() {
return "300";
public void setDefaultValue() {
recommendedValue = 300;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.chunk-gc.load-threshold");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.chunk-gc.load-threshold");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.chunk-gc.load-threshold", 300);
yamlConfiguration.set("spawn-limits.chunk-gc.load-threshold", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,31 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class SpawnLimitsAmbient extends InsightElement {
public class SpawnLimitsAmbient extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.ambient") > 4;
return yamlOthers.getConfig().getDouble("spawn-limits.ambient") > recommendedValue;
}
@Override
public String recommendedValue() {
return "4";
public void setDefaultValue() {
recommendedValue = 4;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.ambient");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.ambient");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.ambient", 4);
yamlConfiguration.set("spawn-limits.ambient", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class SpawnLimitsAnimals extends InsightElement {
public class SpawnLimitsAnimals extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.animals") > 10;
return yamlOthers.getConfig().getDouble("spawn-limits.animals") > recommendedValue;
}
@Override
public String recommendedValue() {
return "10";
public void setDefaultValue() {
recommendedValue = 10;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.animals");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.animals");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.animals", 10);
yamlConfiguration.set("spawn-limits.animals", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class SpawnLimitsMonsters extends InsightElement {
public class SpawnLimitsMonsters extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.monsters") > 50;
return yamlOthers.getConfig().getDouble("spawn-limits.monsters") > recommendedValue;
}
@Override
public String recommendedValue() {
return "50";
public void setDefaultValue() {
recommendedValue = 50;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.monsters");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.monsters");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.monsters", 50);
yamlConfiguration.set("spawn-limits.monsters", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class SpawnLimitsWaterAnimals extends InsightElement {
public class SpawnLimitsWaterAnimals extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.water-animals") > 3;
return yamlOthers.getConfig().getDouble("spawn-limits.water-animals") > recommendedValue;
}
@Override
public String recommendedValue() {
return "3";
public void setDefaultValue() {
recommendedValue = 3;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.water-animals");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.water-animals");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.water-animals", 3);
yamlConfiguration.set("spawn-limits.water-animals", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class TicksPerAnimalSpawns extends InsightElement {
public class TicksPerAnimalSpawns extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.ticks-per.animal-spawns") > 400;
return yamlOthers.getConfig().getDouble("spawn-limits.ticks-per.animal-spawns") > recommendedValue;
}
@Override
public String recommendedValue() {
return "400";
public void setDefaultValue() {
recommendedValue = 400;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.ticks-per.animal-spawns");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.ticks-per.animal-spawns");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.ticks-per.animal-spawns", 400);
yamlConfiguration.set("spawn-limits.ticks-per.animal-spawns", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class TicksPerAutosave extends InsightElement {
public class TicksPerAutosave extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.ticks-per.autosave") > 6000;
return yamlOthers.getConfig().getDouble("spawn-limits.ticks-per.autosave") > recommendedValue;
}
@Override
public String recommendedValue() {
return "6000";
public void setDefaultValue() {
recommendedValue = 6000;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.ticks-per.autosave");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.ticks-per.autosave");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.ticks-per.autosave", 6000);
yamlConfiguration.set("spawn-limits.ticks-per.autosave", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -6,30 +6,30 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class TicksPerMonsterSpawns extends InsightElement {
public class TicksPerMonsterSpawns extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("bukkit.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("spawn-limits.ticks-per.monster-spawns") > 40;
return yamlOthers.getConfig().getDouble("spawn-limits.ticks-per.monster-spawns") > recommendedValue;
}
@Override
public String recommendedValue() {
return "40";
public void setDefaultValue() {
recommendedValue = 40;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("spawn-limits.ticks-per.monster-spawns");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("spawn-limits.ticks-per.monster-spawns");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("spawn-limits.ticks-per.monster-spawns", 40);
yamlConfiguration.set("spawn-limits.ticks-per.monster-spawns", recommendedValue);
try {
yamlConfiguration.save(new File("bukkit.yml"));
} catch (Exception e) {
@@ -3,24 +3,24 @@ package com.neomechanical.neoperformance.performance.insight.elements.server.pro
import com.neomechanical.neoperformance.performance.insight.InsightElement;
import com.neomechanical.neoperformance.performance.insight.utils.ServerConfiguration;
public class NetworkCompressionThreshold extends InsightElement {
public class NetworkCompressionThreshold extends InsightElement<Integer> {
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
return Integer.parseInt(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.PACKET_COMPRESSION_LIMIT)) < 512;
return Integer.parseInt(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.PACKET_COMPRESSION_LIMIT)) < recommendedValue;
}
@Override
public String recommendedValue() {
return "512";
public void setDefaultValue() {
recommendedValue = 512;
}
@Override
public String currentValue() {
return ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.PACKET_COMPRESSION_LIMIT);
public Integer currentValue() {
return Integer.valueOf(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.PACKET_COMPRESSION_LIMIT));
}
@Override
public void fix() {
ServerConfiguration.setServerProperty(ServerConfiguration.ServerProperty.PACKET_COMPRESSION_LIMIT, "512");
ServerConfiguration.setServerProperty(ServerConfiguration.ServerProperty.PACKET_COMPRESSION_LIMIT, String.valueOf(recommendedValue));
}
}
@@ -3,24 +3,24 @@ package com.neomechanical.neoperformance.performance.insight.elements.server.pro
import com.neomechanical.neoperformance.performance.insight.InsightElement;
import com.neomechanical.neoperformance.performance.insight.utils.ServerConfiguration;
public class RenderDistance extends InsightElement {
public class RenderDistance extends InsightElement<Integer> {
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
return Integer.parseInt(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.VIEW_DISTANCE)) > 4;
return Integer.parseInt(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.VIEW_DISTANCE)) > recommendedValue;
}
@Override
public String recommendedValue() {
return "4";
public void setDefaultValue() {
recommendedValue = 4;
}
@Override
public String currentValue() {
return ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.VIEW_DISTANCE);
public Integer currentValue() {
return Integer.valueOf(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.VIEW_DISTANCE));
}
@Override
public void fix() {
ServerConfiguration.setServerProperty(ServerConfiguration.ServerProperty.VIEW_DISTANCE, "4");
ServerConfiguration.setServerProperty(ServerConfiguration.ServerProperty.VIEW_DISTANCE, String.valueOf(recommendedValue));
}
}
@@ -3,24 +3,24 @@ package com.neomechanical.neoperformance.performance.insight.elements.server.pro
import com.neomechanical.neoperformance.performance.insight.InsightElement;
import com.neomechanical.neoperformance.performance.insight.utils.ServerConfiguration;
public class Snooper extends InsightElement {
public class Snooper extends InsightElement<Boolean> {
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
return Boolean.parseBoolean(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.SNOOPER));
}
@Override
public String recommendedValue() {
return "false";
public void setDefaultValue() {
recommendedValue = false;
}
@Override
public String currentValue() {
return ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.SNOOPER);
public Boolean currentValue() {
return Boolean.valueOf(ServerConfiguration.getServerProperty(ServerConfiguration.ServerProperty.SNOOPER));
}
@Override
public void fix() {
ServerConfiguration.setServerProperty(ServerConfiguration.ServerProperty.SNOOPER, "false");
ServerConfiguration.setServerProperty(ServerConfiguration.ServerProperty.SNOOPER, String.valueOf(recommendedValue));
}
}
@@ -6,30 +6,29 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class EntityActivationRangeAnimals extends InsightElement {
public class EntityActivationRangeAnimals extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
public boolean isInsightApplicableOrAlreadyPresent() {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.entity-activation-range.animals") > 8;
return yamlOthers.getConfig().getDouble("world-settings.default.entity-activation-range.animals") > recommendedValue;
}
public void setDefaultValue() {
recommendedValue = 8;
}
@Override
public String recommendedValue() {
return "8";
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.entity-activation-range.animals");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.entity-activation-range.animals");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.entity-activation-range.animals", 8);
yamlConfiguration.set("world-settings.default.entity-activation-range.animals", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class EntityActivationRangeMisc extends InsightElement {
public class EntityActivationRangeMisc extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class EntityActivationRangeMisc extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.entity-activation-range.monsters") > 2;
return yamlOthers.getConfig().getDouble("world-settings.default.entity-activation-range.monsters") > recommendedValue;
}
@Override
public String recommendedValue() {
return "2";
public void setDefaultValue() {
recommendedValue = 2;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.entity-activation-range.monsters");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.entity-activation-range.monsters");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.entity-activation-range.monsters", 2);
yamlConfiguration.set("world-settings.default.entity-activation-range.monsters", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class EntityActivationRangeMonsters extends InsightElement {
public class EntityActivationRangeMonsters extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class EntityActivationRangeMonsters extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.entity-activation-range.monsters") > 10;
return yamlOthers.getConfig().getDouble("world-settings.default.entity-activation-range.monsters") > recommendedValue;
}
@Override
public String recommendedValue() {
return "10";
public void setDefaultValue() {
recommendedValue = 10;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.entity-activation-range.monsters");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.entity-activation-range.monsters");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.entity-activation-range.monsters", 10);
yamlConfiguration.set("world-settings.default.entity-activation-range.monsters", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class ItemDespawnRate extends InsightElement {
public class ItemDespawnRate extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class ItemDespawnRate extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.item-despawn-rate") > 1200;
return yamlOthers.getConfig().getDouble("world-settings.default.item-despawn-rate") > recommendedValue;
}
@Override
public String recommendedValue() {
return "1200";
public void setDefaultValue() {
recommendedValue = 1200;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.item-despawn-rate");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.item-despawn-rate");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.item-despawn-rate", 1200);
yamlConfiguration.set("world-settings.default.item-despawn-rate", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class MaxTickTimeEntity extends InsightElement {
public class MaxTickTimeEntity extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class MaxTickTimeEntity extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.max-tick-time.entity") > 50;
return yamlOthers.getConfig().getDouble("world-settings.default.max-tick-time.entity") > recommendedValue;
}
@Override
public String recommendedValue() {
return "50";
public void setDefaultValue() {
recommendedValue = 50;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.max-tick-time.entity");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.max-tick-time.entity");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.max-tick-time.entity", 50);
yamlConfiguration.set("world-settings.default.max-tick-time.entity", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class MaxTickTimeTile extends InsightElement {
public class MaxTickTimeTile extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class MaxTickTimeTile extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.max-tick-time.tile") > 50;
return yamlOthers.getConfig().getDouble("world-settings.default.max-tick-time.tile") > recommendedValue;
}
@Override
public String recommendedValue() {
return "50";
public void setDefaultValue() {
recommendedValue = 50;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.max-tick-time.tile");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.max-tick-time.tile");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.max-tick-time.tile", 50);
yamlConfiguration.set("world-settings.default.max-tick-time.tile", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class MaxTntPerTick extends InsightElement {
public class MaxTntPerTick extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class MaxTntPerTick extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.max-tnt-per-tick") > 10;
return yamlOthers.getConfig().getDouble("world-settings.default.max-tnt-per-tick") > recommendedValue;
}
@Override
public String recommendedValue() {
return "10";
public void setDefaultValue() {
recommendedValue = 10;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.max-tnt-per-tick");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.max-tnt-per-tick");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.max-tnt-per-tick", 10);
yamlConfiguration.set("world-settings.default.max-tnt-per-tick", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class MergeRadiusExp extends InsightElement {
public class MergeRadiusExp extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class MergeRadiusExp extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.merge-radius.exp") > 6;
return yamlOthers.getConfig().getDouble("world-settings.default.merge-radius.exp") > recommendedValue;
}
@Override
public String recommendedValue() {
return "6";
public void setDefaultValue() {
recommendedValue = 6;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.merge-radius.exp");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.merge-radius.exp");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.merge-radius.exp", 6);
yamlConfiguration.set("world-settings.default.merge-radius.exp", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class MergeRadiusItem extends InsightElement {
public class MergeRadiusItem extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class MergeRadiusItem extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.merge-radius.item") > 4;
return yamlOthers.getConfig().getDouble("world-settings.default.merge-radius.item") > recommendedValue;
}
@Override
public String recommendedValue() {
return "4";
public void setDefaultValue() {
recommendedValue = 4;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.merge-radius.item");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.merge-radius.item");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.merge-radius.item", 4);
yamlConfiguration.set("world-settings.default.merge-radius.item", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class TicksPerHopperCheck extends InsightElement {
public class TicksPerHopperCheck extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class TicksPerHopperCheck extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.ticks-per.hopper-check") > 24;
return yamlOthers.getConfig().getDouble("world-settings.default.ticks-per.hopper-check") > recommendedValue;
}
@Override
public String recommendedValue() {
return "24";
public void setDefaultValue() {
recommendedValue = 24;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.ticks-per.hopper-check");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.ticks-per.hopper-check");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.ticks-per.hopper-check", 24);
yamlConfiguration.set("world-settings.default.ticks-per.hopper-check", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {
@@ -6,7 +6,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class TicksPerHopperTransfer extends InsightElement {
public class TicksPerHopperTransfer extends InsightElement<Integer> {
private final YAMLOthers yamlOthers = new YAMLOthers("spigot.yml");
@Override
@@ -14,23 +14,23 @@ public class TicksPerHopperTransfer extends InsightElement {
if (!yamlOthers.configExists()) {
return false;
}
return yamlOthers.getConfig().getDouble("world-settings.default.ticks-per.hopper-transfer") > 24;
return yamlOthers.getConfig().getDouble("world-settings.default.ticks-per.hopper-transfer") > recommendedValue;
}
@Override
public String recommendedValue() {
return "24";
public void setDefaultValue() {
recommendedValue = 24;
}
@Override
public String currentValue() {
return yamlOthers.getConfig().getString("world-settings.default.ticks-per.hopper-transfer");
public Integer currentValue() {
return yamlOthers.getConfig().getInt("world-settings.default.ticks-per.hopper-transfer");
}
@Override
public void fix() {
YamlConfiguration yamlConfiguration = yamlOthers.getConfig();
yamlConfiguration.set("world-settings.default.ticks-per.hopper-transfer", 24);
yamlConfiguration.set("world-settings.default.ticks-per.hopper-transfer", recommendedValue);
try {
yamlConfiguration.save(new File("spigot.yml"));
} catch (Exception e) {