mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-21 20:56:45 +01:00
Add tridents/crossbows to salvage
This commit is contained in:
parent
04eefaef79
commit
b4871fe49f
@ -1,8 +1,14 @@
|
||||
Version 2.2.027
|
||||
Added Tridents / Crossbows to salvage.vanilla.yml config (see notes)
|
||||
Fixed Ricocheted arrows losing some data after a ricochet
|
||||
Fixed an issue where Folia could have all of its threads lock up effectively killing the server
|
||||
Fixed concurrency issue with Folia regarding locale strings
|
||||
Fixed concurrency issue with Folia regarding COTW summons
|
||||
|
||||
NOTES:
|
||||
Tridents and Crossbows are now in the salvage.vanilla.yml config, you will need to either delete this config file to regenerate it or add the entries manually.
|
||||
You can check the default config file after running this mcMMO update at least once in the defaults folder at plugins\mcMMO\defaults to see what you would need to add if you want to take the manual approach
|
||||
|
||||
Version 2.2.026
|
||||
Fixed NullPointerException on ChunkUnloadEvent
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -17,8 +18,6 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static com.gmail.nossr50.util.skills.SkillUtils.getRepairAndSalvageQuantities;
|
||||
|
||||
public class SalvageConfig extends BukkitConfig {
|
||||
private final HashSet<String> notSupported;
|
||||
private Set<Salvageable> salvageables;
|
||||
@ -42,7 +41,6 @@ public class SalvageConfig extends BukkitConfig {
|
||||
Set<String> keys = section.getKeys(false);
|
||||
|
||||
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
|
||||
|
||||
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
||||
mcMMO.p.getLogger().log(Level.INFO, "Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
||||
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
||||
@ -59,7 +57,6 @@ public class SalvageConfig extends BukkitConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (String key : keys) {
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<>();
|
||||
@ -85,6 +82,8 @@ public class SalvageConfig extends BukkitConfig {
|
||||
salvageMaterialType = MaterialType.STONE;
|
||||
} else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STRING;
|
||||
} else if (ItemUtils.isPrismarineTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.PRISMARINE;
|
||||
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.LEATHER;
|
||||
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
@ -145,7 +144,7 @@ public class SalvageConfig extends BukkitConfig {
|
||||
|
||||
// Maximum Quantity
|
||||
int maximumQuantity = itemMaterial != null
|
||||
? getRepairAndSalvageQuantities(itemMaterial, salvageMaterial)
|
||||
? SkillUtils.getRepairAndSalvageQuantities(itemMaterial, salvageMaterial)
|
||||
: config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
||||
|
||||
if (maximumQuantity <= 0 && itemMaterial != null) {
|
||||
|
@ -11,6 +11,7 @@ public enum MaterialType {
|
||||
GOLD,
|
||||
DIAMOND,
|
||||
NETHERITE,
|
||||
PRISMARINE,
|
||||
OTHER;
|
||||
|
||||
public Material getDefaultMaterial() {
|
||||
@ -41,6 +42,8 @@ public enum MaterialType {
|
||||
return Material.getMaterial("NETHERITE_SCRAP");
|
||||
else
|
||||
return Material.DIAMOND;
|
||||
case PRISMARINE:
|
||||
return Material.PRISMARINE_CRYSTALS;
|
||||
|
||||
case OTHER:
|
||||
default:
|
||||
|
@ -35,7 +35,7 @@ import java.util.Map.Entry;
|
||||
|
||||
public class SalvageManager extends SkillManager {
|
||||
private boolean placedAnvil;
|
||||
private int lastClick;
|
||||
private int lastClick;
|
||||
|
||||
public SalvageManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, PrimarySkillType.SALVAGE);
|
||||
|
@ -13,7 +13,8 @@ public class TrackedTamingEntity extends CancellableRunnable {
|
||||
private final @NotNull CallOfTheWildType callOfTheWildType;
|
||||
private final @NotNull Player player;
|
||||
|
||||
protected TrackedTamingEntity(@NotNull LivingEntity livingEntity, @NotNull CallOfTheWildType callOfTheWildType, @NotNull Player player) {
|
||||
public TrackedTamingEntity(@NotNull LivingEntity livingEntity, @NotNull CallOfTheWildType callOfTheWildType,
|
||||
@NotNull Player player) {
|
||||
this.player = player;
|
||||
this.callOfTheWildType = callOfTheWildType;
|
||||
this.livingEntity = livingEntity;
|
||||
|
@ -436,6 +436,10 @@ public final class ItemUtils {
|
||||
return mcMMO.getMaterialMapStore().isStringTool(item.getType().getKey().getKey());
|
||||
}
|
||||
|
||||
public static boolean isPrismarineTool(ItemStack item) {
|
||||
return mcMMO.getMaterialMapStore().isPrismarineTool(item.getType().getKey().getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a gold tool.
|
||||
*
|
||||
|
@ -33,6 +33,7 @@ public class MaterialMapStore {
|
||||
private final @NotNull HashSet<String> ironArmor;
|
||||
private final @NotNull HashSet<String> ironTools;
|
||||
private final @NotNull HashSet<String> stringTools;
|
||||
private final @NotNull HashSet<String> prismarineTools;
|
||||
private final @NotNull HashSet<String> goldArmor;
|
||||
private final @NotNull HashSet<String> goldTools;
|
||||
private final @NotNull HashSet<String> chainmailArmor;
|
||||
@ -89,6 +90,7 @@ public class MaterialMapStore {
|
||||
bows = new HashSet<>();
|
||||
crossbows = new HashSet<>();
|
||||
stringTools = new HashSet<>();
|
||||
prismarineTools = new HashSet<>();
|
||||
tools = new HashSet<>();
|
||||
|
||||
swords = new HashSet<>();
|
||||
@ -462,7 +464,7 @@ public class MaterialMapStore {
|
||||
fillIronToolsWhiteList();
|
||||
fillGoldToolsWhiteList();
|
||||
fillDiamondToolsWhiteList();
|
||||
fillnetheriteToolsWhiteList();
|
||||
fillNetheriteToolsWhiteList();
|
||||
|
||||
fillSwords();
|
||||
fillAxes();
|
||||
@ -472,6 +474,7 @@ public class MaterialMapStore {
|
||||
fillTridents();
|
||||
fillMaces();
|
||||
fillStringTools();
|
||||
fillPrismarineTools();
|
||||
fillBows();
|
||||
fillCrossbows();
|
||||
|
||||
@ -501,6 +504,11 @@ public class MaterialMapStore {
|
||||
stringTools.add("bow");
|
||||
stringTools.add("fishing_rod");
|
||||
stringTools.add("carrot_on_a_stick");
|
||||
stringTools.add("crossbow");
|
||||
}
|
||||
|
||||
private void fillPrismarineTools() {
|
||||
prismarineTools.add("trident");
|
||||
}
|
||||
|
||||
private void fillMaces() {
|
||||
@ -674,7 +682,7 @@ public class MaterialMapStore {
|
||||
diamondTools.add("diamond_shovel");
|
||||
}
|
||||
|
||||
private void fillnetheriteToolsWhiteList() {
|
||||
private void fillNetheriteToolsWhiteList() {
|
||||
netheriteTools.add("netherite_sword");
|
||||
netheriteTools.add("netherite_axe");
|
||||
netheriteTools.add("netherite_hoe");
|
||||
@ -976,6 +984,14 @@ public class MaterialMapStore {
|
||||
return stringTools.contains(id);
|
||||
}
|
||||
|
||||
public boolean isPrismarineTool(@NotNull Material material) {
|
||||
return isPrismarineTool(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isPrismarineTool(@NotNull String id) {
|
||||
return prismarineTools.contains(id);
|
||||
}
|
||||
|
||||
public boolean isGlass(@NotNull Material material) {
|
||||
return glassBlocks.contains(material.getKey().getKey());
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import static com.gmail.nossr50.util.MetadataService.*;
|
||||
|
||||
//TODO: Use SpawnReason where appropriate instead of MobMetaFlagType
|
||||
public final class MobMetadataUtils {
|
||||
private static final @NotNull ConcurrentMap<Entity, HashSet<MobMetaFlagType>> mobRegistry; //transient data
|
||||
private static final @NotNull EnumMap<MobMetaFlagType, NamespacedKey> mobFlagKeyMap; //used for persistent data
|
||||
|
@ -280,7 +280,11 @@ public final class SkillUtils {
|
||||
|
||||
@Nullable
|
||||
public static Material getRepairAndSalvageItem(@NotNull ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
if (ItemUtils.isPrismarineTool(inHand)) {
|
||||
return Material.PRISMARINE_CRYSTALS;
|
||||
} else if (ItemUtils.isNetheriteTool(inHand) || ItemUtils.isNetheriteArmor(inHand)) {
|
||||
return Material.NETHERITE_SCRAP;
|
||||
} else if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
} else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
@ -306,7 +310,12 @@ public final class SkillUtils {
|
||||
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
|
||||
int quantity = 0;
|
||||
|
||||
if (mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
|
||||
if (mcMMO.getMaterialMapStore().isPrismarineTool(itemMaterial)) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial)
|
||||
|| mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
|
||||
//One netherite bar requires 4 netherite scraps
|
||||
return 4;
|
||||
}
|
||||
|
@ -290,3 +290,10 @@ Salvageables:
|
||||
CARROT_ON_A_STICK:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
CROSSBOW:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
# Other
|
||||
TRIDENT:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
|
Loading…
Reference in New Issue
Block a user