chore: Exchange debug log levels & component-ify a few messages (#1342)

This commit is contained in:
NotMyFault 2021-10-17 14:50:42 +02:00 committed by GitHub
parent 3a952e1938
commit 27865dc785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 49 additions and 52 deletions

View File

@ -42,7 +42,6 @@ public class BukkitQueueHandler extends QueueHandler {
if (timingsEnabled) { if (timingsEnabled) {
if (alertTimingsChange) { if (alertTimingsChange) {
alertTimingsChange = false; alertTimingsChange = false;
LOGGER.debug("Having `parallel-threads` > 1 interferes with the timings.");
} }
Timings.setTimingsEnabled(false); Timings.setTimingsEnabled(false);
timingsCheck.invoke(null); timingsCheck.invoke(null);

View File

@ -61,8 +61,7 @@ public abstract class ChunkListener implements Listener {
TaskManager.IMP.repeat(() -> { TaskManager.IMP.repeat(() -> {
Location tmpLoc = lastCancelPos; Location tmpLoc = lastCancelPos;
if (tmpLoc != null) { if (tmpLoc != null) {
LOGGER.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at " LOGGER.info("[FAWE Tick Limiter] Detected and cancelled physics lag source at {}", tmpLoc);
+ tmpLoc);
} }
rateLimit--; rateLimit--;
physicsFreeze = false; physicsFreeze = false;

View File

@ -22,7 +22,7 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
public GriefPreventionFeature(final Plugin griefpreventionPlugin) { public GriefPreventionFeature(final Plugin griefpreventionPlugin) {
super(griefpreventionPlugin.getName()); super(griefpreventionPlugin.getName());
LOGGER.debug("Plugin 'GriefPrevention' found. Using it now."); LOGGER.info("Plugin 'GriefPrevention' found. Using it now.");
} }
public boolean isAllowed(Player player, Claim claim, MaskType type) { public boolean isAllowed(Player player, Claim claim, MaskType type) {

View File

@ -39,17 +39,19 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() { public PlotSquaredFeature() {
super("PlotSquared"); super("PlotSquared");
LOGGER.debug("Optimizing PlotSquared"); LOGGER.info("Optimizing PlotSquared");
if (Settings.FAWE_Components.FAWE_HOOK) { if (Settings.FAWE_Components.FAWE_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false; Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) { if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
new FaweTrim(); new FaweTrim();
} }
// TODO: revisit this later on - when?
/*
if (MainCommand.getInstance().getCommand("generatebiome") == null) { if (MainCommand.getInstance().getCommand("generatebiome") == null) {
new PlotSetBiome(); new PlotSetBiome();
} }
*/
} }
// TODO: revisit this later on
/* /*
try { try {
if (Settings.Enabled_Components.WORLDS) { if (Settings.Enabled_Components.WORLDS) {

View File

@ -41,7 +41,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() { public PlotSquaredFeature() {
super("PlotSquared"); super("PlotSquared");
LOGGER.debug("Optimizing PlotSquared"); LOGGER.info("Optimizing PlotSquared");
if (com.fastasyncworldedit.core.configuration.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_v4_HOOK) { if (com.fastasyncworldedit.core.configuration.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_v4_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false; Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try { try {
@ -49,7 +49,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
setupSchematicHandler(); setupSchematicHandler();
setupChunkManager(); setupChunkManager();
} catch (Throwable ignored) { } catch (Throwable ignored) {
LOGGER.debug("Please update PlotSquared: https://www.spigotmc.org/resources/77506/"); LOGGER.info("Please update PlotSquared: https://www.spigotmc.org/resources/77506/");
} }
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) { if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
new FaweTrim(); new FaweTrim();
@ -85,12 +85,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
private void setupChunkManager() throws RuntimeException { private void setupChunkManager() throws RuntimeException {
ChunkManager.manager = new FaweChunkManager(ChunkManager.manager); ChunkManager.manager = new FaweChunkManager(ChunkManager.manager);
LOGGER.debug(" - ChunkManager: " + ChunkManager.manager); LOGGER.info(" - ChunkManager: {}", ChunkManager.manager);
} }
private void setupSchematicHandler() throws RuntimeException { private void setupSchematicHandler() throws RuntimeException {
SchematicHandler.manager = new FaweSchematicHandler(); SchematicHandler.manager = new FaweSchematicHandler();
LOGGER.debug(" - SchematicHandler: " + SchematicHandler.manager); LOGGER.info(" - SchematicHandler: {}", SchematicHandler.manager);
} }
public boolean isAllowed(Player player, Plot plot, MaskType type) { public boolean isAllowed(Player player, Plot plot, MaskType type) {

View File

@ -65,8 +65,7 @@ public class InspectBrush extends BrushTool {
public boolean perform(final Player player, LocalSession session, boolean rightClick) { public boolean perform(final Player player, LocalSession session, boolean rightClick) {
if (!player.hasPermission("worldedit.tool.inspect")) { if (!player.hasPermission("worldedit.tool.inspect")) {
player.print(Caption.of("", "worldedit.tool.inspect")); player.print(Caption.of("fawe.error.no-perm", "worldedit.tool.inspect"));
LOGGER.debug("No tool control");
return false; return false;
} }
if (!Settings.IMP.HISTORY.USE_DATABASE) { if (!Settings.IMP.HISTORY.USE_DATABASE) {
@ -74,7 +73,6 @@ public class InspectBrush extends BrushTool {
"fawe.error.setting.disable", "fawe.error.setting.disable",
"history.use-database (Import with /history import )" "history.use-database (Import with /history import )"
)); ));
LOGGER.debug("No db");
return false; return false;
} }
try { try {

View File

@ -47,7 +47,7 @@ public class Config {
} }
} }
} }
LOGGER.debug("Failed to get config option: " + key); LOGGER.error("Failed to get config option: {}", key);
return null; return null;
} }
@ -78,7 +78,7 @@ public class Config {
} }
} }
} }
LOGGER.debug("Failed to set config option: " + key + ": " + value + " | " + instance + " | " + root.getSimpleName() + ".yml"); LOGGER.error("Failed to set config option: {}: {} | {} | {}.yml", key, value, instance, root.getSimpleName());
} }
public boolean load(File file) { public boolean load(File file) {
@ -343,9 +343,11 @@ public class Config {
setAccessible(field); setAccessible(field);
return field; return field;
} catch (Throwable ignored) { } catch (Throwable ignored) {
LOGGER.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(instance LOGGER.warn(
.getClass() "Invalid config field: {} for {}",
.getSimpleName())); StringMan.join(split, "."),
toNodeName(instance.getClass().getSimpleName())
);
return null; return null;
} }
} }

View File

@ -59,7 +59,7 @@ public class Bindings {
Annotation annotation = annotations[0] == binding ? annotations[1] : annotations[0]; Annotation annotation = annotations[0] == binding ? annotations[1] : annotations[0];
key = Key.of(ret, annotation); key = Key.of(ret, annotation);
} else { } else {
LOGGER.debug("Cannot annotate: " + method + " with " + StringMan.getString(annotations)); LOGGER.error("Cannot annotate: {} with {}", method, StringMan.getString(annotations));
return false; return false;
} }

View File

@ -398,7 +398,7 @@ public class FastSchematicReader extends NBTSchematicReader {
} }
clipboard.createEntity(loc.setPosition(loc.subtract(min.toVector3())), state); clipboard.createEntity(loc.setPosition(loc.subtract(min.toVector3())), state);
} else { } else {
LOGGER.debug("Invalid entity: " + id); LOGGER.error("Invalid entity: {}", id);
} }
} }
} }

View File

@ -57,7 +57,7 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
this.blockSize = (int) size; this.blockSize = (int) size;
this.command = command; this.command = command;
this.closed = true; this.closed = true;
LOGGER.debug("Size: {}", size); LOGGER.info("Size: {}", size);
} }
public long getTime() { public long getTime() {

View File

@ -61,7 +61,7 @@ public class MutableEntityChange implements Change {
most = ((LongTag) map.get("PersistentIDMSB")).getValue(); most = ((LongTag) map.get("PersistentIDMSB")).getValue();
least = ((LongTag) map.get("PersistentIDLSB")).getValue(); least = ((LongTag) map.get("PersistentIDLSB")).getValue();
} else { } else {
LOGGER.debug("Skipping entity without uuid."); LOGGER.info("Skipping entity without uuid.");
return; return;
} }
List<DoubleTag> pos = (List<DoubleTag>) map.get("Pos").getValue(); List<DoubleTag> pos = (List<DoubleTag>) map.get("Pos").getValue();
@ -76,7 +76,7 @@ public class MutableEntityChange implements Change {
Map<String, Tag> map = tag.getValue(); Map<String, Tag> map = tag.getValue();
Tag posTag = map.get("Pos"); Tag posTag = map.get("Pos");
if (posTag == null) { if (posTag == null) {
LOGGER.debug("Missing pos tag: " + tag); LOGGER.warn("Missing pos tag: {}", tag);
return; return;
} }
List<DoubleTag> pos = (List<DoubleTag>) posTag.getValue(); List<DoubleTag> pos = (List<DoubleTag>) posTag.getValue();

View File

@ -287,7 +287,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
} else if (change.getClass() == EntityRemove.class) { } else if (change.getClass() == EntityRemove.class) {
add((EntityRemove) change); add((EntityRemove) change);
} else { } else {
LOGGER.debug("Unknown change: " + change.getClass()); LOGGER.error("Unknown change: {}", change.getClass());
} }
} }

View File

@ -442,7 +442,7 @@ public class MainUtil {
content = scanner.next().trim(); content = scanner.next().trim();
} }
if (!content.startsWith("<")) { if (!content.startsWith("<")) {
LOGGER.debug(content); LOGGER.info(content);
} }
if (responseCode == 200) { if (responseCode == 200) {
return url; return url;
@ -644,7 +644,7 @@ public class MainUtil {
return newFile; return newFile;
} }
} catch (IOException e) { } catch (IOException e) {
LOGGER.debug("Could not save " + resource, e); LOGGER.error("Could not save {}, {}", resource, e);
} }
return null; return null;
} }
@ -886,7 +886,7 @@ public class MainUtil {
pool.submit(file::delete); pool.submit(file::delete);
Component msg = Caption.of("worldedit.schematic.delete.deleted"); Component msg = Caption.of("worldedit.schematic.delete.deleted");
if (printDebug) { if (printDebug) {
LOGGER.debug(msg.toString()); LOGGER.info(msg.toString());
} }
} }
}); });

View File

@ -140,10 +140,6 @@ public class WEManager {
player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey())); player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey()));
} }
} }
LOGGER.debug("Region info for " + player.getName());
LOGGER.debug("There are " + backupRegions.size() + " backupRegions being added to Regions. Regions has " + regions.size() + " before backupRegions are added");
regions.addAll(backupRegions);
LOGGER.debug("Finished adding regions for " + player.getName());
if (!masks.isEmpty()) { if (!masks.isEmpty()) {
player.setMeta("lastMask", masks); player.setMeta("lastMask", masks);
} else { } else {

View File

@ -1281,7 +1281,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
List<TracingExtent> tracingExtents = getActiveTracingExtents(); List<TracingExtent> tracingExtents = getActiveTracingExtents();
assert actor != null; assert actor != null;
if (tracingExtents.isEmpty()) { if (tracingExtents.isEmpty()) {
actor.printError(TextComponent.of("worldedit.trace.no-tracing-extents")); actor.print(TextComponent.of("worldedit.trace.no-tracing-extents"));
return; return;
} }
// find the common stacks // find the common stacks

View File

@ -523,7 +523,7 @@ public class RegionCommands {
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
float[] changed = heightMap.applyFilter(filter, iterations); float[] changed = heightMap.applyFilter(filter, iterations);
int affected = heightMap.applyChanges(changed, snowBlockCount); int affected = heightMap.applyChanges(changed, snowBlockCount);
actor.printInfo(Caption.of("worldedit.snowsmooth.changed", TextComponent.of(affected))); actor.print(Caption.of("worldedit.snowsmooth.changed", TextComponent.of(affected)));
return affected; return affected;
} }

View File

@ -432,7 +432,7 @@ public class SchematicCommands {
) throws WorldEditException { ) throws WorldEditException {
//FAWE end //FAWE end
if (worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getDataVersion() == -1) { if (worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getDataVersion() == -1) {
actor.printError(TranslatableComponent.of("worldedit.schematic.unsupported-minecraft-version")); actor.print(TranslatableComponent.of("worldedit.schematic.unsupported-minecraft-version"));
return; return;
} }

View File

@ -226,7 +226,7 @@ public class ToolCommands {
) )
@CommandPermissions("worldedit.tool.inspect") @CommandPermissions("worldedit.tool.inspect")
public void inspectBrush(Player player, LocalSession session) throws WorldEditException { public void inspectBrush(Player player, LocalSession session) throws WorldEditException {
setTool(player, session, new InspectBrush(), "worldedit.tool.info.equip"); setTool(player, session, new InspectBrush(), "worldedit.tool.inspect.equip");
} }
//FAWE end //FAWE end

View File

@ -197,7 +197,7 @@ public class WorldEditCommands {
if (hookMode != null) { if (hookMode != null) {
newMode = hookMode == HookMode.ACTIVE; newMode = hookMode == HookMode.ACTIVE;
if (newMode == previousMode) { if (newMode == previousMode) {
actor.printError(Caption.of(previousMode actor.print(Caption.of(previousMode
? "worldedit.trace.active.already" ? "worldedit.trace.active.already"
: "worldedit.trace.inactive.already")); : "worldedit.trace.inactive.already"));
return; return;
@ -206,7 +206,7 @@ public class WorldEditCommands {
newMode = !previousMode; newMode = !previousMode;
} }
session.setTracingActions(newMode); session.setTracingActions(newMode);
actor.printInfo(Caption.of(newMode ? "worldedit.trace.active" : "worldedit.trace.inactive")); actor.print(Caption.of(newMode ? "worldedit.trace.active" : "worldedit.trace.inactive"));
} }
@Command( @Command(

View File

@ -442,16 +442,16 @@ public interface Player extends Entity, Actor {
getSession().setClipboard(holder); getSession().setClipboard(holder);
} }
} catch (FaweClipboardVersionMismatchException e) { } catch (FaweClipboardVersionMismatchException e) {
printError(Caption.of("fawe.error.clipboard.on.disk.version.mismatch")); print(Caption.of("fawe.error.clipboard.on.disk.version.mismatch"));
} catch (RuntimeException e) { } catch (RuntimeException e) {
printError(Caption.of("fawe.error.clipboard.invalid")); print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace(); e.printStackTrace();
print(Caption.of("fawe.error.stacktrace")); print(Caption.of("fawe.error.stacktrace"));
print(Caption.of("fawe.error.clipboard.load.failure")); print(Caption.of("fawe.error.clipboard.load.failure"));
print(Caption.of("fawe.error.clipboard.invalid.info", file.getName(), file.length())); print(Caption.of("fawe.error.clipboard.invalid.info", file.getName(), file.length()));
print(Caption.of("fawe.error.stacktrace")); print(Caption.of("fawe.error.stacktrace"));
} catch (Exception e) { } catch (Exception e) {
printError(Caption.of("fawe.error.clipboard.invalid")); print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace(); e.printStackTrace();
print(Caption.of("fawe.error.stacktrace")); print(Caption.of("fawe.error.stacktrace"));
print(Caption.of("fawe.error.no-failure")); print(Caption.of("fawe.error.no-failure"));

View File

@ -755,7 +755,7 @@ public final class PlatformCommandManager {
} }
} catch (ConditionFailedException e) { } catch (ConditionFailedException e) {
if (e.getCondition() instanceof PermissionCondition) { if (e.getCondition() instanceof PermissionCondition) {
actor.printError(Caption.of( actor.print(Caption.of(
"fawe.error.no-perm", "fawe.error.no-perm",
StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions()) StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions())
)); ));
@ -911,7 +911,7 @@ public final class PlatformCommandManager {
suggestions = commandManager.getSuggestions(access, argStrings); suggestions = commandManager.getSuggestions(access, argStrings);
} catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters } catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters
if (!(t instanceof CommandException)) { if (!(t instanceof CommandException)) {
LOGGER.debug("Unexpected error occurred while generating suggestions for input: " + arguments, t); LOGGER.error("Unexpected error occurred while generating suggestions for input: {}", arguments, t);
return; return;
} }
throw t; throw t;

View File

@ -213,7 +213,7 @@ public class AbstractDelegateExtent implements Extent {
Extent next = ((AbstractDelegateExtent) extent).getExtent(); Extent next = ((AbstractDelegateExtent) extent).getExtent();
new ExtentTraverser(this).setNext(next); new ExtentTraverser(this).setNext(next);
} else { } else {
LOGGER.debug("Cannot disable queue"); LOGGER.error("Cannot disable queue");
} }
} }

View File

@ -122,7 +122,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
} else if (dataVersion < liveDataVersion) { } else if (dataVersion < liveDataVersion) {
fixer = platform.getDataFixer(); fixer = platform.getDataFixer();
if (fixer != null) { if (fixer != null) {
LOGGER.debug("Schematic was made in an older Minecraft version ({} < {}), will attempt DFU.", LOGGER.info("Schematic was made in an older Minecraft version ({} < {}), will attempt DFU.",
dataVersion, liveDataVersion dataVersion, liveDataVersion
); );
} else { } else {

View File

@ -39,7 +39,7 @@ public class SchematicsEventListener {
try { try {
Files.createDirectories(config.resolve(event.getConfiguration().saveDir)); Files.createDirectories(config.resolve(event.getConfiguration().saveDir));
} catch (FileAlreadyExistsException e) { } catch (FileAlreadyExistsException e) {
LOGGER.debug("Schematic directory exists as file. Possible symlink.", e); LOGGER.info("Schematic directory exists as file. Possible symlink.", e);
} catch (IOException e) { } catch (IOException e) {
LOGGER.warn("Failed to create schematics directory", e); LOGGER.warn("Failed to create schematics directory", e);
} }

View File

@ -132,7 +132,7 @@ public final class ChunkDeleter {
private boolean runBatch(ChunkDeletionInfo.ChunkBatch chunkBatch) { private boolean runBatch(ChunkDeletionInfo.ChunkBatch chunkBatch) {
int chunkCount = chunkBatch.getChunkCount(); int chunkCount = chunkBatch.getChunkCount();
LOGGER.debug("Processing deletion batch with {} chunks.", chunkCount); LOGGER.info("Processing deletion batch with {} chunks.", chunkCount);
final Map<Path, Stream<BlockVector2>> regionToChunkList = groupChunks(chunkBatch); final Map<Path, Stream<BlockVector2>> regionToChunkList = groupChunks(chunkBatch);
BiPredicate<RegionAccess, BlockVector2> predicate = createPredicates(chunkBatch.deletionPredicates); BiPredicate<RegionAccess, BlockVector2> predicate = createPredicates(chunkBatch.deletionPredicates);
shouldPreload = chunkBatch.chunks == null; shouldPreload = chunkBatch.chunks == null;
@ -269,10 +269,10 @@ public final class ChunkDeleter {
region.deleteChunk(chunk); region.deleteChunk(chunk);
totalChunksDeleted++; totalChunksDeleted++;
if (debugRate != 0 && totalChunksDeleted % debugRate == 0) { if (debugRate != 0 && totalChunksDeleted % debugRate == 0) {
LOGGER.debug("Deleted {} chunks so far.", totalChunksDeleted); LOGGER.info("Deleted {} chunks so far.", totalChunksDeleted);
} }
} else { } else {
LOGGER.debug("Chunk did not match predicates: " + chunk); LOGGER.warn("Chunk did not match predicates: {}", chunk);
} }
} }
return true; return true;

View File

@ -119,7 +119,7 @@ public final class BundledBlockData {
if (url == null) { if (url == null) {
throw new IOException("Could not find blocks.json"); throw new IOException("Could not find blocks.json");
} }
LOGGER.debug("Using {} for bundled block data.", url); LOGGER.info("Using {} for bundled block data.", url);
String data = Resources.toString(url, Charset.defaultCharset()); String data = Resources.toString(url, Charset.defaultCharset());
List<BlockEntry> entries = gson.fromJson(data, new TypeToken<List<BlockEntry>>() { List<BlockEntry> entries = gson.fromJson(data, new TypeToken<List<BlockEntry>>() {
}.getType()); }.getType());

View File

@ -104,7 +104,7 @@ public final class BundledItemData {
if (url == null) { if (url == null) {
throw new IOException("Could not find items.json"); throw new IOException("Could not find items.json");
} }
LOGGER.debug("Using {} for bundled item data.", url); LOGGER.info("Using {} for bundled item data.", url);
String data = Resources.toString(url, Charset.defaultCharset()); String data = Resources.toString(url, Charset.defaultCharset());
List<ItemEntry> entries = gson.fromJson(data, new TypeToken<List<ItemEntry>>() { List<ItemEntry> entries = gson.fromJson(data, new TypeToken<List<ItemEntry>>() {
}.getType()); }.getType());

View File

@ -149,7 +149,8 @@ public final class LegacyMapper {
// if it's still null, both fixer and default failed // if it's still null, both fixer and default failed
if (state == null) { if (state == null) {
LOGGER.debug("Unknown block: " + value); LOGGER.error("Unknown block: {}. Neither the DataFixer nor defaulting worked to recognize this block.",
value);
} else { } else {
// it's not null so one of them succeeded, now use it // it's not null so one of them succeeded, now use it
blockToStringMap.put(state, id); blockToStringMap.put(state, id);
@ -185,7 +186,7 @@ public final class LegacyMapper {
type = ItemTypes.get(value); type = ItemTypes.get(value);
} }
if (type == null) { if (type == null) {
LOGGER.debug("Unknown item: " + value); LOGGER.error("Unknown item: {}. Neither the DataFixer nor defaulting worked to recognize this item.", value);
} else { } else {
try { try {
itemMap.put(getCombinedId(id), type); itemMap.put(getCombinedId(id), type);