|
26 | 26 | import org.bukkit.*;
|
27 | 27 | import org.bukkit.command.Command;
|
28 | 28 | import org.bukkit.command.CommandSender;
|
| 29 | +import org.bukkit.configuration.ConfigurationSection; |
29 | 30 | import org.bukkit.entity.ArmorStand;
|
30 | 31 | import org.bukkit.entity.EntityType;
|
31 | 32 | import org.bukkit.entity.Player;
|
@@ -55,6 +56,7 @@ public class P extends MPlugin {
|
55 | 56 | public CmdAutoHelp cmdAutoHelp;
|
56 | 57 | public boolean mc17 = false;
|
57 | 58 | public boolean mc18 = false;
|
| 59 | + public boolean mc113 = false; |
58 | 60 | public boolean useNonPacketParticles = false;
|
59 | 61 | public boolean factionsFlight = false;
|
60 | 62 | ItemStack item = new ItemStack(Material.CAKE);
|
@@ -159,7 +161,13 @@ public void onEnable() {
|
159 | 161 | } else if (version == 8) {
|
160 | 162 | P.p.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
|
161 | 163 | mc18 = true;
|
162 |
| - } else if (version > 8) { |
| 164 | + } else if (version == 13) { |
| 165 | + P.p.log("Minecraft Version 1.13 found, New Items will be used."); |
| 166 | + mc113 = true; |
| 167 | + changeItemIDSInConfig(); |
| 168 | + } |
| 169 | + |
| 170 | + if (version > 8) { |
163 | 171 | useNonPacketParticles = true;
|
164 | 172 | P.p.log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
165 | 173 | }
|
@@ -218,6 +226,50 @@ private void setupPlaceholderAPI() {
|
218 | 226 | }
|
219 | 227 | }
|
220 | 228 |
|
| 229 | + |
| 230 | + public void changeItemIDSInConfig() { |
| 231 | + |
| 232 | + |
| 233 | + P.p.log("Starting conversion of legacy material in config to 1.13 materials."); |
| 234 | + |
| 235 | + |
| 236 | + replaceStringInConfig("fperm-gui.relation.materials.recruit", "WOOD_SWORD", "WOODEN_SWORD"); |
| 237 | + |
| 238 | + replaceStringInConfig("fperm-gui.relation.materials.normal", "GOLD_SWORD", "GOLDEN_SWORD"); |
| 239 | + |
| 240 | + replaceStringInConfig("fperm-gui.relation.materials.ally", "GOLD_AXE", "GOLDEN_AXE"); |
| 241 | + |
| 242 | + replaceStringInConfig("fperm-gui.relation.materials.neutral", "WOOD_AXE", "WOODEN_AXE"); |
| 243 | + |
| 244 | + ConfigurationSection actionMaterialsConfigSection = getConfig().getConfigurationSection("fperm-gui.action.materials"); |
| 245 | + |
| 246 | + Set<String> actionMaterialKeys = actionMaterialsConfigSection.getKeys(true); |
| 247 | + |
| 248 | + |
| 249 | + for (String key : actionMaterialKeys) { |
| 250 | + replaceStringInConfig("fperm-gui.action.materials." + key, "STAINED_GLASS", "GRAY_STAINED_GLASS"); |
| 251 | + } |
| 252 | + |
| 253 | + replaceStringInConfig("fperm-gui.dummy-items.0.material", "STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE"); |
| 254 | + |
| 255 | + replaceStringInConfig("fwarp-gui.dummy-items.0.material", "STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE"); |
| 256 | + |
| 257 | + replaceStringInConfig("fupgrades.MainMenu.DummyItem.Type", "STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE"); |
| 258 | + |
| 259 | + replaceStringInConfig("fupgrades.MainMenu.EXP.EXPItem.Type", "EXP_BOTTLE", "EXPERIENCE_BOTTLE"); |
| 260 | + |
| 261 | + replaceStringInConfig("fupgrades.MainMenu.Spawners.SpawnerItem.Type", "MOB_SPAWNER", "SPAWNER"); |
| 262 | + |
| 263 | + |
| 264 | + } |
| 265 | + |
| 266 | + public void replaceStringInConfig(String path, String stringToReplace, String replacementString) { |
| 267 | + if (getConfig().getString(path).equals(stringToReplace)) { |
| 268 | + P.p.log("Replacing legacy material '" + stringToReplace + "' with '" + stringToReplace + "' for config node '" + path + "'."); |
| 269 | + getConfig().set(path, replacementString); |
| 270 | + } |
| 271 | + } |
| 272 | + |
221 | 273 | public boolean isClipPlaceholderAPIHooked() {
|
222 | 274 | return this.clipPlaceholderAPIManager != null;
|
223 | 275 | }
|
|
0 commit comments