mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Less verbose unsupported material warnings
This commit is contained in:
@ -11,15 +11,15 @@ import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class RepairConfig extends ConfigLoader {
|
||||
private List<Repairable> repairables;
|
||||
private HashSet<String> notSupported;
|
||||
|
||||
public RepairConfig(String fileName) {
|
||||
super(fileName);
|
||||
notSupported = new HashSet<>();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@ -48,7 +48,8 @@ public class RepairConfig extends ConfigLoader {
|
||||
Material itemMaterial = Material.matchMaterial(key);
|
||||
|
||||
if (itemMaterial == null) {
|
||||
mcMMO.p.getLogger().info("No support for repair item "+key+ " in this version of Minecraft, skipping.");
|
||||
//mcMMO.p.getLogger().info("No support for repair item "+key+ " in this version of Minecraft, skipping.");
|
||||
notSupported.add(key); //Collect names of unsupported items
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -95,7 +96,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
||||
|
||||
if (repairMaterial == null) {
|
||||
mcMMO.p.getLogger().info("Could not find a valid repair material for item named "+key+", skipping.");
|
||||
notSupported.add(key); //Collect names of unsupported items
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -152,6 +153,25 @@ public class RepairConfig extends ConfigLoader {
|
||||
repairables.add(repairable);
|
||||
}
|
||||
}
|
||||
//Report unsupported
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if(notSupported.size() > 0) {
|
||||
stringBuilder.append("mcMMO found the following materials in the Repair config that are not supported by the version of Minecraft running on this server: ");
|
||||
|
||||
for (Iterator<String> iterator = notSupported.iterator(); iterator.hasNext(); ) {
|
||||
String unsupportedMaterial = iterator.next();
|
||||
|
||||
if(!iterator.hasNext()) {
|
||||
stringBuilder.append(unsupportedMaterial);
|
||||
} else {
|
||||
stringBuilder.append(unsupportedMaterial).append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info(stringBuilder.toString());
|
||||
mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped.");
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Repairable> getLoadedRepairables() {
|
||||
|
@ -12,16 +12,15 @@ import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class SalvageConfig extends ConfigLoader {
|
||||
private List<Salvageable> salvageables;
|
||||
private HashSet<String> notSupported;
|
||||
|
||||
public SalvageConfig(String fileName) {
|
||||
super(fileName);
|
||||
notSupported = new HashSet<>();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@ -45,7 +44,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
Material itemMaterial = Material.matchMaterial(key);
|
||||
|
||||
if (itemMaterial == null) {
|
||||
mcMMO.p.getLogger().info("No support for salvage item "+key+ " in this version of Minecraft, skipping.");
|
||||
notSupported.add(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -94,7 +93,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||
|
||||
if (salvageMaterial == null) {
|
||||
mcMMO.p.getLogger().info("Could not find a salvage material for item named " + key + ", skipping.");
|
||||
notSupported.add(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -153,6 +152,25 @@ public class SalvageConfig extends ConfigLoader {
|
||||
salvageables.add(salvageable);
|
||||
}
|
||||
}
|
||||
//Report unsupported
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if(notSupported.size() > 0) {
|
||||
stringBuilder.append("mcMMO found the following materials in the Salvage config that are not supported by the version of Minecraft running on this server: ");
|
||||
|
||||
for (Iterator<String> iterator = notSupported.iterator(); iterator.hasNext(); ) {
|
||||
String unsupportedMaterial = iterator.next();
|
||||
|
||||
if(!iterator.hasNext()) {
|
||||
stringBuilder.append(unsupportedMaterial);
|
||||
} else {
|
||||
stringBuilder.append(unsupportedMaterial).append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info(stringBuilder.toString());
|
||||
mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped.");
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Salvageable> getLoadedSalvageables() {
|
||||
|
@ -71,6 +71,7 @@ public class CompatibilityManager {
|
||||
|
||||
}
|
||||
|
||||
//TODO: move to text manager
|
||||
public void reportCompatibilityStatus(CommandSender commandSender) {
|
||||
if(isFullyCompatibleServerSoftware) {
|
||||
commandSender.sendMessage(LocaleLoader.getString("mcMMO.Template.Prefix",
|
||||
|
@ -274,7 +274,7 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
if (archeryManager.canDaze(target)) {
|
||||
finalDamage+=archeryManager.daze((Player) target);
|
||||
finalDamage+=archeryManager.daze((Player) target); //the cast is checked by the if condition
|
||||
}
|
||||
|
||||
if (!arrow.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canRetrieveArrows()) {
|
||||
|
Reference in New Issue
Block a user