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 (alertTimingsChange) {
alertTimingsChange = false;
LOGGER.debug("Having `parallel-threads` > 1 interferes with the timings.");
}
Timings.setTimingsEnabled(false);
timingsCheck.invoke(null);

View File

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

View File

@ -22,7 +22,7 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
public GriefPreventionFeature(final Plugin griefpreventionPlugin) {
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) {

View File

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

View File

@ -41,7 +41,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
LOGGER.debug("Optimizing PlotSquared");
LOGGER.info("Optimizing PlotSquared");
if (com.fastasyncworldedit.core.configuration.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_v4_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
@ -49,7 +49,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
setupSchematicHandler();
setupChunkManager();
} 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")) {
new FaweTrim();
@ -85,12 +85,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
private void setupChunkManager() throws RuntimeException {
ChunkManager.manager = new FaweChunkManager(ChunkManager.manager);
LOGGER.debug(" - ChunkManager: " + ChunkManager.manager);
LOGGER.info(" - ChunkManager: {}", ChunkManager.manager);
}
private void setupSchematicHandler() throws RuntimeException {
SchematicHandler.manager = new FaweSchematicHandler();
LOGGER.debug(" - SchematicHandler: " + SchematicHandler.manager);
LOGGER.info(" - SchematicHandler: {}", SchematicHandler.manager);
}
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) {
if (!player.hasPermission("worldedit.tool.inspect")) {
player.print(Caption.of("", "worldedit.tool.inspect"));
LOGGER.debug("No tool control");
player.print(Caption.of("fawe.error.no-perm", "worldedit.tool.inspect"));
return false;
}
if (!Settings.IMP.HISTORY.USE_DATABASE) {
@ -74,7 +73,6 @@ public class InspectBrush extends BrushTool {
"fawe.error.setting.disable",
"history.use-database (Import with /history import )"
));
LOGGER.debug("No db");
return false;
}
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;
}
@ -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) {
@ -343,9 +343,11 @@ public class Config {
setAccessible(field);
return field;
} catch (Throwable ignored) {
LOGGER.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(instance
.getClass()
.getSimpleName()));
LOGGER.warn(
"Invalid config field: {} for {}",
StringMan.join(split, "."),
toNodeName(instance.getClass().getSimpleName())
);
return null;
}
}

View File

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

View File

@ -398,7 +398,7 @@ public class FastSchematicReader extends NBTSchematicReader {
}
clipboard.createEntity(loc.setPosition(loc.subtract(min.toVector3())), state);
} 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.command = command;
this.closed = true;
LOGGER.debug("Size: {}", size);
LOGGER.info("Size: {}", size);
}
public long getTime() {

View File

@ -61,7 +61,7 @@ public class MutableEntityChange implements Change {
most = ((LongTag) map.get("PersistentIDMSB")).getValue();
least = ((LongTag) map.get("PersistentIDLSB")).getValue();
} else {
LOGGER.debug("Skipping entity without uuid.");
LOGGER.info("Skipping entity without uuid.");
return;
}
List<DoubleTag> pos = (List<DoubleTag>) map.get("Pos").getValue();
@ -76,7 +76,7 @@ public class MutableEntityChange implements Change {
Map<String, Tag> map = tag.getValue();
Tag posTag = map.get("Pos");
if (posTag == null) {
LOGGER.debug("Missing pos tag: " + tag);
LOGGER.warn("Missing pos tag: {}", tag);
return;
}
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) {
add((EntityRemove) change);
} 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();
}
if (!content.startsWith("<")) {
LOGGER.debug(content);
LOGGER.info(content);
}
if (responseCode == 200) {
return url;
@ -644,7 +644,7 @@ public class MainUtil {
return newFile;
}
} catch (IOException e) {
LOGGER.debug("Could not save " + resource, e);
LOGGER.error("Could not save {}, {}", resource, e);
}
return null;
}
@ -886,7 +886,7 @@ public class MainUtil {
pool.submit(file::delete);
Component msg = Caption.of("worldedit.schematic.delete.deleted");
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()));
}
}
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()) {
player.setMeta("lastMask", masks);
} else {

View File

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

View File

@ -523,7 +523,7 @@ public class RegionCommands {
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
float[] changed = heightMap.applyFilter(filter, iterations);
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;
}

View File

@ -432,7 +432,7 @@ public class SchematicCommands {
) throws WorldEditException {
//FAWE end
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;
}

View File

@ -226,7 +226,7 @@ public class ToolCommands {
)
@CommandPermissions("worldedit.tool.inspect")
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

View File

@ -197,7 +197,7 @@ public class WorldEditCommands {
if (hookMode != null) {
newMode = hookMode == HookMode.ACTIVE;
if (newMode == previousMode) {
actor.printError(Caption.of(previousMode
actor.print(Caption.of(previousMode
? "worldedit.trace.active.already"
: "worldedit.trace.inactive.already"));
return;
@ -206,7 +206,7 @@ public class WorldEditCommands {
newMode = !previousMode;
}
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(

View File

@ -442,16 +442,16 @@ public interface Player extends Entity, Actor {
getSession().setClipboard(holder);
}
} 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) {
printError(Caption.of("fawe.error.clipboard.invalid"));
print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace();
print(Caption.of("fawe.error.stacktrace"));
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.stacktrace"));
} catch (Exception e) {
printError(Caption.of("fawe.error.clipboard.invalid"));
print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace();
print(Caption.of("fawe.error.stacktrace"));
print(Caption.of("fawe.error.no-failure"));

View File

@ -755,7 +755,7 @@ public final class PlatformCommandManager {
}
} catch (ConditionFailedException e) {
if (e.getCondition() instanceof PermissionCondition) {
actor.printError(Caption.of(
actor.print(Caption.of(
"fawe.error.no-perm",
StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions())
));
@ -911,7 +911,7 @@ public final class PlatformCommandManager {
suggestions = commandManager.getSuggestions(access, argStrings);
} catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters
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;
}
throw t;

View File

@ -213,7 +213,7 @@ public class AbstractDelegateExtent implements Extent {
Extent next = ((AbstractDelegateExtent) extent).getExtent();
new ExtentTraverser(this).setNext(next);
} 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) {
fixer = platform.getDataFixer();
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
);
} else {

View File

@ -39,7 +39,7 @@ public class SchematicsEventListener {
try {
Files.createDirectories(config.resolve(event.getConfiguration().saveDir));
} 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) {
LOGGER.warn("Failed to create schematics directory", e);
}

View File

@ -132,7 +132,7 @@ public final class ChunkDeleter {
private boolean runBatch(ChunkDeletionInfo.ChunkBatch chunkBatch) {
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);
BiPredicate<RegionAccess, BlockVector2> predicate = createPredicates(chunkBatch.deletionPredicates);
shouldPreload = chunkBatch.chunks == null;
@ -269,10 +269,10 @@ public final class ChunkDeleter {
region.deleteChunk(chunk);
totalChunksDeleted++;
if (debugRate != 0 && totalChunksDeleted % debugRate == 0) {
LOGGER.debug("Deleted {} chunks so far.", totalChunksDeleted);
LOGGER.info("Deleted {} chunks so far.", totalChunksDeleted);
}
} else {
LOGGER.debug("Chunk did not match predicates: " + chunk);
LOGGER.warn("Chunk did not match predicates: {}", chunk);
}
}
return true;

View File

@ -119,7 +119,7 @@ public final class BundledBlockData {
if (url == null) {
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());
List<BlockEntry> entries = gson.fromJson(data, new TypeToken<List<BlockEntry>>() {
}.getType());

View File

@ -104,7 +104,7 @@ public final class BundledItemData {
if (url == null) {
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());
List<ItemEntry> entries = gson.fromJson(data, new TypeToken<List<ItemEntry>>() {
}.getType());

View File

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