Move world settings dump to a better location (where all of the fields will actually have been set)

This commit is contained in:
dordsor21 2020-05-01 20:29:35 +01:00
parent e06429f3b0
commit 36948ed351
2 changed files with 26 additions and 23 deletions

View File

@ -114,28 +114,5 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
this.WALL_FILLING = new BlockBucket(config.getString("wall.filling")); this.WALL_FILLING = new BlockBucket(config.getString("wall.filling"));
this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height")); this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height"));
this.CLAIMED_WALL_BLOCK = new BlockBucket(config.getString("wall.block_claimed")); 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));
}
}
} }
} }

View File

@ -28,6 +28,7 @@ package com.plotsquared.core.generator;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
@ -52,7 +53,9 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
public class HybridPlotWorld extends ClassicPlotWorld { public class HybridPlotWorld extends ClassicPlotWorld {
@ -157,6 +160,29 @@ public class HybridPlotWorld extends ClassicPlotWorld {
event.printStackTrace(); event.printStackTrace();
PlotSquared.debug("&c - road schematics are disabled for this world."); 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) { @Override public boolean isCompatible(PlotArea plotArea) {