From 36948ed351a4be7b67aeebc9a0fed0bf3d4b7964 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 1 May 2020 20:29:35 +0100 Subject: [PATCH] Move world settings dump to a better location (where all of the fields will actually have been set) --- .../core/generator/ClassicPlotWorld.java | 23 ---------------- .../core/generator/HybridPlotWorld.java | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java index c8c9e7add..9c5547b41 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java @@ -114,28 +114,5 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld { this.WALL_FILLING = new BlockBucket(config.getString("wall.filling")); this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height")); this.CLAIMED_WALL_BLOCK = new BlockBucket(config.getString("wall.block_claimed")); - - // Dump world settings - if (Settings.DEBUG) { - PlotSquared.debug(String.format("- Dumping settings for ClassicPlotWorld with name %s", - this.getWorldName())); - final Field[] fields = this.getClass().getFields(); - for (final Field field : fields) { - final String name = field.getName().toLowerCase(Locale.ENGLISH); - if (name.contains("g_sch")) { - continue; - } - Object value; - try { - final boolean accessible = field.isAccessible(); - field.setAccessible(true); - value = field.get(this); - field.setAccessible(accessible); - } catch (final IllegalAccessException e) { - value = String.format("Failed to parse: %s", e.getMessage()); - } - PlotSquared.debug(String.format("-- %s = %s", name, value)); - } - } } } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index 74e70e721..da7f46a47 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -28,6 +28,7 @@ package com.plotsquared.core.generator; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationSection; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; @@ -52,7 +53,9 @@ import com.sk89q.worldedit.world.block.BaseBlock; import org.jetbrains.annotations.NotNull; import java.io.File; +import java.lang.reflect.Field; import java.util.HashMap; +import java.util.Locale; public class HybridPlotWorld extends ClassicPlotWorld { @@ -157,6 +160,29 @@ public class HybridPlotWorld extends ClassicPlotWorld { event.printStackTrace(); PlotSquared.debug("&c - road schematics are disabled for this world."); } + + // Dump world settings + if (Settings.DEBUG) { + PlotSquared.debug(String.format("- Dumping settings for ClassicPlotWorld with name %s", + this.getWorldName())); + final Field[] fields = this.getClass().getFields(); + for (final Field field : fields) { + final String name = field.getName().toLowerCase(Locale.ENGLISH); + if (name.contains("g_sch")) { + continue; + } + Object value; + try { + final boolean accessible = field.isAccessible(); + field.setAccessible(true); + value = field.get(this); + field.setAccessible(accessible); + } catch (final IllegalAccessException e) { + value = String.format("Failed to parse: %s", e.getMessage()); + } + PlotSquared.debug(String.format("-- %s = %s", name, value)); + } + } } @Override public boolean isCompatible(PlotArea plotArea) {