forked from Songoda-Plugins/EpicHoppers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.java
More file actions
151 lines (116 loc) · 9.39 KB
/
Copy pathSettings.java
File metadata and controls
151 lines (116 loc) · 9.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.songoda.epichoppers.settings;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.configuration.Config;
import com.songoda.core.configuration.ConfigSetting;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.epichoppers.EpicHoppers;
import java.util.Arrays;
import java.util.stream.Collectors;
public class Settings {
private static final Config CONFIG = EpicHoppers.getPlugin(EpicHoppers.class).getCoreConfig();
public static final ConfigSetting HOPPER_UPGRADING = new ConfigSetting(CONFIG, "Main.Allow hopper Upgrading", true,
"Should hoppers be upgradable?");
public static final ConfigSetting UPGRADE_WITH_ECONOMY = new ConfigSetting(CONFIG, "Main.Upgrade With Economy", true,
"Should you be able to upgrade hoppers with economy?");
public static final ConfigSetting UPGRADE_WITH_XP = new ConfigSetting(CONFIG, "Main.Upgrade With XP", true,
"Should you be able to upgrade hoppers with experience?");
public static final ConfigSetting ALLOW_NORMAL_HOPPERS = new ConfigSetting(CONFIG, "Main.Allow Normal Hoppers", false,
"Should natural hoppers not be epic hoppers?");
public static final ConfigSetting DISABLED_WORLDS = new ConfigSetting(CONFIG, "Main.Disabled Worlds",
Arrays.asList("example1", "example2"),
"Worlds where epic hoppers cannot be placed.",
"Any placed Epic HopperImpl will just be converted to a normal one.");
public static final ConfigSetting TELEPORT = new ConfigSetting(CONFIG, "Main.Allow Players To Teleport Through Hoppers", true,
"Should players be able to teleport through hoppers?");
public static final ConfigSetting ENDERCHESTS = new ConfigSetting(CONFIG, "Main.Support Enderchests", true,
"Should hoppers dump items into a player enderchests?");
public static final ConfigSetting UPGRADE_PARTICLE_TYPE = new ConfigSetting(CONFIG, "Main.Upgrade Particle Type", "SPELL_WITCH",
"The type of particle shown when a hopper is upgraded.");
public static final ConfigSetting HOP_TICKS = new ConfigSetting(CONFIG, "Main.Amount of Ticks Between Hops", 8L,
"The amount of ticks between hopper transfers.");
public static final ConfigSetting AUTOSAVE = new ConfigSetting(CONFIG, "Main.Auto Save Interval In Seconds", 15,
"The amount of time in between saving to file.",
"This is purely a safety function to prevent against unplanned crashes or",
"restarts. With that said it is advised to keep this enabled.",
"If however you enjoy living on the edge, feel free to turn it off.");
public static final ConfigSetting TELEPORT_TICKS = new ConfigSetting(CONFIG, "Main.Amount of Ticks Between Teleport", 10L,
"The cooldown between teleports. It prevents players",
"from getting stuck in a teleport loop.");
public static final ConfigSetting LINK_TIMEOUT = new ConfigSetting(CONFIG, "Main.Timeout When Syncing Hoppers", 300L,
"The amount of time in ticks a player has between hitting the hopper",
"Link button and performing the link. When the time is up the link event is canceled.");
public static final ConfigSetting MAX_CHUNK = new ConfigSetting(CONFIG, "Main.Max Hoppers Per Chunk", -1,
"The maximum amount of hoppers per chunk.");
public static final ConfigSetting USE_PROTECTION_PLUGINS = new ConfigSetting(CONFIG, "Main.Use Protection Plugins", true,
"Should we use protection plugins?");
public static final ConfigSetting BLOCKBREAK_PARTICLE = new ConfigSetting(CONFIG, "Main.BlockBreak Particle Type", "LAVA",
"The particle shown when the block break module performs a block break.");
public static final ConfigSetting BLOCKBREAK_BLACKLIST = new ConfigSetting(CONFIG, "Main.BlockBreak Blacklisted Blocks",
Arrays.asList("BEDROCK", "END_PORTAL", "ENDER_PORTAL", "END_PORTAL_FRAME", "ENDER_PORTAL_FRAME", "PISTON_HEAD", "PISTON_EXTENSION", "RAIL", "RAILS", "ACTIVATOR_RAIL", "DETECTOR_RAIL", "POWERED_RAIL"),
"Anything listed here will not be broken by the block break module.");
public static final ConfigSetting ALLOW_BLOCKBREAK_CONTAINERS = new ConfigSetting(CONFIG, "Main.Allow BlockBreak Containers", false,
"Allow BlockBreak to break containers.");
public static final ConfigSetting AUTOCRAFT_JAM_EJECT = new ConfigSetting(CONFIG, "Main.AutoCraft Jam Eject", false,
"AutoCraft module needs a free slot to craft items with.",
"Normally, crafting hoppers won't grab items that would fill that slot.",
"This option ejects items if that last slot is forcibly filled");
public static final ConfigSetting AUTOCRAFT_BLACKLIST = new ConfigSetting(CONFIG, "Main.AutoCraft Blacklist", Arrays.asList("BEDROCK", "EGG"),
"Anything listed here will not be able to be auto crafted.");
public static final ConfigSetting AUTOSELL_PRICES = new ConfigSetting(CONFIG, "Main.AutoSell Prices",
Arrays.asList("STONE,0.50", "COBBLESTONE,0.20", "IRON_ORE,0.35", "COAL_ORE,0.20"),
"These are the prices used by the auto sell module.");
public static final ConfigSetting AUTOSELL_SHOPGUIPLUS = new ConfigSetting(CONFIG, "Main.Use ShopGuiPlus for Prices", false,
"Should prices be grabbed from ShopGuiPlus?",
"If ShopGuiPlus is not enabled or the player is offline the default price list will be used (or EconomyShopGUI if enabled).",
"If this is something that you do not want then you should empty the default list.");
public static final ConfigSetting AUTOSELL_ECONOMY_SHOP_GUI = new ConfigSetting(CONFIG, "Main.Use EconomyShopGUI for Prices", false,
"Should prices be grabbed from EconomyShopGUI?",
"If 'Use ShopGuiPlus for Prices' is enabled and the player is online, this will be ignored.");
public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(CONFIG, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
"Which economy plugin should be used?",
"Supported plugins you have installed: \"" + EconomyManager.getManager().getRegisteredPlugins().stream().collect(Collectors.joining("\", \"")) + "\".");
public static final ConfigSetting EMIT_INVENTORYPICKUPITEMEVENT = new ConfigSetting(CONFIG, "Main.Emit InventoryPickupItemEvent", false,
"This event is used by other plugin to modify or monitor the behavior when a hopper picks up items on the ground.",
"However it is a high frequency event and may have an impact on your server performance which is why it is disabled by default.",
"If you absolutely need this enable it but be aware of the potential performance impact.");
public static final ConfigSetting DATABASE_TABLE_PREFIX = new ConfigSetting(CONFIG, "Database.Table Prefix", "",
"Prefix for database tables. Useful when running multiple servers sharing the same database.",
"Example: 'survival_' would create tables like 'survival_placed_hoppers' instead of 'placed_hoppers'.",
"Leave empty for no prefix.");
public static final ConfigSetting ECO_ICON = new ConfigSetting(CONFIG, "Interfaces.Economy Icon", "SUNFLOWER");
public static final ConfigSetting XP_ICON = new ConfigSetting(CONFIG, "Interfaces.XP Icon", "EXPERIENCE_BOTTLE");
public static final ConfigSetting GLASS_TYPE_1 = new ConfigSetting(CONFIG, "Interfaces.Glass Type 1", "GRAY_STAINED_GLASS_PANE");
public static final ConfigSetting GLASS_TYPE_2 = new ConfigSetting(CONFIG, "Interfaces.Glass Type 2", "BLUE_STAINED_GLASS_PANE");
public static final ConfigSetting GLASS_TYPE_3 = new ConfigSetting(CONFIG, "Interfaces.Glass Type 3", "LIGHT_BLUE_STAINED_GLASS_PANE");
public static final ConfigSetting LANGUGE_MODE = new ConfigSetting(CONFIG, "System.Language Mode", "en_US",
"The enabled language file.",
"More language files (if available) can be found in the plugins data folder.");
/**
* In order to set dynamic economy comment correctly, this needs to be
* called after EconomyManager load
*/
public static void setupConfig() {
CONFIG.load();
CONFIG.setAutoremove(true).setAutosave(true);
// convert glass pane settings
int color;
if ((color = GLASS_TYPE_1.getInt(-1)) != -1) {
CONFIG.set(GLASS_TYPE_1.getKey(), CompatibleMaterial.getGlassPaneForColor(color).name());
}
if ((color = GLASS_TYPE_2.getInt(-1)) != -1) {
CONFIG.set(GLASS_TYPE_2.getKey(), CompatibleMaterial.getGlassPaneForColor(color).name());
}
if ((color = GLASS_TYPE_3.getInt(-1)) != -1) {
CONFIG.set(GLASS_TYPE_3.getKey(), CompatibleMaterial.getGlassPaneForColor(color).name());
}
// convert economy settings
if (CONFIG.getBoolean("Economy.Use Vault Economy") && EconomyManager.getManager().isEnabled("Vault")) {
CONFIG.set("Main.Economy", "Vault");
} else if (CONFIG.getBoolean("Economy.Use Reserve Economy") && EconomyManager.getManager().isEnabled("Reserve")) {
CONFIG.set("Main.Economy", "Reserve");
} else if (CONFIG.getBoolean("Economy.Use Player Points Economy") && EconomyManager.getManager().isEnabled("PlayerPoints")) {
CONFIG.set("Main.Economy", "PlayerPoints");
}
CONFIG.saveChanges();
}
}