Skip to content

Commit

Permalink
Add debug error logging to SchematicConverter class
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauriichan committed Aug 31, 2021
1 parent 3439bab commit d54021c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion legacy-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.sourcewriters.spigot.rwg</groupId>
<artifactId>legacy-api</artifactId>
<version>2.1.1</version>
<version>2.1.3</version>

<distributionManagement>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public abstract class CompatibilitySchematicConverter extends SchematicConverter
protected final CompatibilityAddon addon;

public CompatibilitySchematicConverter(@NonNull RealisticWorldGenerator api, @NonNull CompatibilityAddon addon, String... extensions) {
super(Objects.requireNonNull(addon, "CompatibilityAddon can't be null!").getOwner(), extensions);
Objects.requireNonNull(api, "RealisticWorldGenerator api can't be null!");
super(Objects.requireNonNull(api, "RealisticWorldGenerator api can't be null!").getLogger(), Objects.requireNonNull(addon, "CompatibilityAddon can't be null!").getOwner(), extensions);
this.addon = addon;
Preconditions.checkArgument(api.getCompatibilityManager().register(this), "Failed to register CompatibilitySchematicConverter");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public IProperties set(IProperty<?>... properties) {

@Override
public IProperties set(IProperty<?> property) {
if(property == null) {
return this;
}
remove(property.getKey());
if (property.isPresent()) {
properties.add(property);
Expand All @@ -35,6 +38,9 @@ public IProperties add(IProperty<?>... properties) {

@Override
public IProperties add(IProperty<?> property) {
if(property == null) {
return this;
}
if (has(property.getKey())) {
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@

import org.bukkit.plugin.Plugin;

import com.syntaxphoenix.syntaxapi.logging.ILogger;
import com.syntaxphoenix.syntaxapi.logging.LogTypeId;

public abstract class SchematicConverter {

private final long id;

private final ILogger logger;

private final Plugin plugin;
private final ArrayList<String> extensions = new ArrayList<>();

public SchematicConverter(Plugin plugin, String... extensions) {
public SchematicConverter(ILogger logger, Plugin plugin, String... extensions) {
this.logger = logger;
this.plugin = plugin;
Collections.addAll(this.extensions, extensions);
this.id = plugin.getName().hashCode() + (extensions.hashCode() * 32);
Expand Down Expand Up @@ -44,6 +50,9 @@ public final File convert(File file, String extension) {
try {
return internalConvert(file);
} catch (Exception exp) {
if(logger != null && logger.getState().extendedInfo()) {
logger.log(LogTypeId.DEBUG, exp);
}
return null;
}
}
Expand Down

0 comments on commit d54021c

Please sign in to comment.