mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 06:40:55 +00:00
update logging
This commit is contained in:
+13
-8
@@ -7,19 +7,21 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.structure.structures.loot.functions;
|
package com.dfsek.terra.addons.structure.structures.loot.functions;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.Platform;
|
||||||
|
import com.dfsek.terra.api.inventory.ItemStack;
|
||||||
|
import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||||
|
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.dfsek.terra.api.Platform;
|
|
||||||
import com.dfsek.terra.api.inventory.ItemStack;
|
|
||||||
import com.dfsek.terra.api.inventory.item.Enchantment;
|
|
||||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
|
||||||
|
|
||||||
|
|
||||||
public class EnchantFunction implements LootFunction {
|
public class EnchantFunction implements LootFunction {
|
||||||
private final int min;
|
private final int min;
|
||||||
@@ -27,6 +29,8 @@ public class EnchantFunction implements LootFunction {
|
|||||||
private final JSONArray disabled;
|
private final JSONArray disabled;
|
||||||
private final Platform platform;
|
private final Platform platform;
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(EnchantFunction.class);
|
||||||
|
|
||||||
|
|
||||||
public EnchantFunction(int min, int max, JSONArray disabled, Platform platform) {
|
public EnchantFunction(int min, int max, JSONArray disabled, Platform platform) {
|
||||||
this.max = max;
|
this.max = max;
|
||||||
@@ -67,9 +71,10 @@ public class EnchantFunction implements LootFunction {
|
|||||||
try {
|
try {
|
||||||
meta.addEnchantment(chosen, FastMath.max(lvl, 1));
|
meta.addEnchantment(chosen, FastMath.max(lvl, 1));
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
platform.logger().warning(
|
LOGGER.warn(
|
||||||
"Attempted to enchant " + original.getType() + " with " + chosen + " at level " + FastMath.max(lvl, 1) +
|
"Attempted to enchant {} with {} at level {}, but an unexpected exception occurred! Usually this is caused by a " +
|
||||||
", but an unexpected exception occurred! Usually this is caused by a misbehaving enchantment plugin.");
|
"misbehaving enchantment plugin.",
|
||||||
|
original.getType(), chosen, FastMath.max(lvl, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
original.setItemMeta(meta);
|
original.setItemMeta(meta);
|
||||||
|
|||||||
Reference in New Issue
Block a user