mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
remove use of useInFuture
This commit is contained in:
parent
cf768d67bd
commit
e61baba175
8 changed files with 49 additions and 38 deletions
|
|
@ -160,13 +160,6 @@ restriction_sweeping_edge:
|
|||
enchantments: [ minecraft:sweeping, minecraft:sweeping_edge ]
|
||||
notAffectedGroups: [ enchanted_book, swords ]
|
||||
|
||||
# Do not exist in 1.18, that mean useInFuture will be set to true
|
||||
# useInFuture set to true also mean it will not warn if there is an issue
|
||||
restriction_swift_sneak:
|
||||
useInFuture: true
|
||||
enchantments: [ minecraft:swift_sneak ]
|
||||
notAffectedGroups: [ enchanted_book, leggings ]
|
||||
|
||||
restriction_thorns:
|
||||
enchantments: [ minecraft:thorns ]
|
||||
notAffectedGroups: [ enchanted_book, armors ]
|
||||
|
|
|
|||
|
|
@ -275,10 +275,7 @@ restriction_sweeping_edge:
|
|||
- enchanted_book
|
||||
- swords
|
||||
|
||||
# Do not exist in 1.18, that mean useInFuture will be set to true
|
||||
# useInFuture set to true also mean it will not warn if there is an issue
|
||||
restriction_swift_sneak:
|
||||
useInFuture: true
|
||||
enchantments:
|
||||
- minecraft:swift_sneak
|
||||
notAffectedGroups:
|
||||
|
|
|
|||
|
|
@ -272,10 +272,7 @@ restriction_sweeping_edge:
|
|||
- enchanted_book
|
||||
- swords
|
||||
|
||||
# Do not exist in 1.18, that mean useInFuture will be set to true
|
||||
# useInFuture set to true also mean it will not warn if there is an issue
|
||||
restriction_swift_sneak:
|
||||
useInFuture: true
|
||||
enchantments:
|
||||
- minecraft:swift_sneak
|
||||
notAffectedGroups:
|
||||
|
|
|
|||
|
|
@ -30,10 +30,11 @@ public class UpdateHandler {
|
|||
new Version(1, 11, 0), PUpdate_1_11_0::handleUpdate,
|
||||
new Version(1, 15, 5), PUpdate_1_15_5::handleUpdate,
|
||||
new Version(1, 15, 6), PUpdate_1_15_6::handleUpdate,
|
||||
new Version(1, 17, 7), PUpdate_1_17_7::handleUpdate
|
||||
new Version(1, 18, 0), PUpdate_1_18::handleUpdate
|
||||
);
|
||||
|
||||
private static final List<MCUpdate> mcUpdateMap = List.of(
|
||||
new Update_1_19(),
|
||||
new Update_1_20_5(),
|
||||
new Update_1_21(),
|
||||
new Update_1_21_9(),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package xyz.alexcrea.cuanvil.update.minecraft;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||
import xyz.alexcrea.cuanvil.update.Version;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static xyz.alexcrea.cuanvil.update.UpdateUtils.addAbsentToList;
|
||||
|
||||
public class Update_1_19 extends MCUpdate {
|
||||
|
||||
public Update_1_19() {
|
||||
super(new Version(1, 19));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
var tosave = new HashSet<ConfigHolder>();
|
||||
updateName(tosave);
|
||||
|
||||
for (ConfigHolder holder : tosave) {
|
||||
holder.saveToDisk(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateName(@NotNull Set<ConfigHolder> tosave) {
|
||||
var conflict = ConfigHolder.CONFLICT_HOLDER.getConfig();
|
||||
|
||||
addAbsentToList(conflict, "restriction_swift_sneak.enchantments", "minecraft:swift_sneak");
|
||||
addAbsentToList(conflict, "restriction_swift_sneak.notAffectedGroups", "leggings", "enchanted_book");
|
||||
|
||||
ConfigHolder.ITEM_GROUP_HOLDER.reload();
|
||||
|
||||
tosave.add(ConfigHolder.DEFAULT_CONFIG);
|
||||
tosave.add(ConfigHolder.CONFLICT_HOLDER);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,19 +3,20 @@ package xyz.alexcrea.cuanvil.update.plugin;
|
|||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||
import xyz.alexcrea.cuanvil.update.UpdateUtils;
|
||||
import xyz.alexcrea.cuanvil.update.Version;
|
||||
import xyz.alexcrea.cuanvil.update.minecraft.Update_1_19;
|
||||
import xyz.alexcrea.cuanvil.update.minecraft.Update_1_20_5;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Set;
|
||||
|
||||
public class PUpdate_1_17_7 {
|
||||
public class PUpdate_1_18 {
|
||||
|
||||
public static void handleUpdate(@Nonnull Set<ConfigHolder> toSave) {
|
||||
// fix only needed for 1.20.5 and above
|
||||
Version current = UpdateUtils.currentMinecraftVersion();
|
||||
if (new Version(1, 20, 5).greaterThan(current)) return;
|
||||
if (new Version(1, 19, 0).greaterThan(current)) return;
|
||||
Update_1_19.updateName(toSave);
|
||||
|
||||
if (new Version(1, 20, 5).greaterThan(current)) return;
|
||||
Update_1_20_5.updateName(toSave);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@ package xyz.alexcrea.cuanvil.group
|
|||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.configuration.ConfigurationSection
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import xyz.alexcrea.cuanvil.api.EnchantmentApi
|
||||
import xyz.alexcrea.cuanvil.enchant.AdditionalTestEnchantment
|
||||
|
|
@ -33,10 +32,6 @@ class EnchantConflictManager {
|
|||
// Path for the maximum number of enchantment before validating the conflict
|
||||
const val ENCH_MAX_PATH = "maxEnchantmentBeforeConflict"
|
||||
|
||||
// Path for a flag: if the enchantment will be used in the last supported version
|
||||
// TODO maybe replace this system by a list of "future" enchantment.
|
||||
private const val FUTURE_USE_PATH = "useInFuture"
|
||||
|
||||
// Default name for a joining group
|
||||
const val DEFAULT_GROUP_NAME = "joinedGroup"
|
||||
}
|
||||
|
|
@ -101,8 +96,6 @@ class EnchantConflictManager {
|
|||
itemManager: ItemGroupManager,
|
||||
conflictName: String
|
||||
): EnchantConflictGroup {
|
||||
// Is it planed for the future
|
||||
val futureUse = section.getBoolean(FUTURE_USE_PATH, false)
|
||||
// Create conflict
|
||||
val conflict = createConflictObject(section, itemManager, conflictName)
|
||||
// Read and add enchantment to conflict
|
||||
|
|
@ -110,18 +103,14 @@ class EnchantConflictManager {
|
|||
for (enchantName in enchantList) {
|
||||
val enchants = getEnchantByIdentifier(enchantName)
|
||||
if (enchants.isEmpty()) {
|
||||
if (!futureUse) { //TODO future use will be deprecated once the new update system is finished
|
||||
CustomAnvil.instance.logger.warning("Enchantment $enchantName do not exist but was asked for conflict $conflictName")
|
||||
}
|
||||
continue
|
||||
}
|
||||
conflict.addEnchantments(enchants)
|
||||
}
|
||||
if (conflict.getEnchants().isEmpty()) {
|
||||
if (!futureUse) { //TODO future use will be deprecated once the new update system is finished
|
||||
CustomAnvil.instance.logger.warning("Conflict $conflictName do not have valid enchantment, it will not do anything")
|
||||
}
|
||||
}
|
||||
|
||||
val conflictsAfterLevel = section.getConfigurationSection(CONFLICT_AFTER_LEVEL_LIST_PATH)
|
||||
val conflictsAfterMap = conflict.getConflictAfters()
|
||||
|
|
|
|||
|
|
@ -160,13 +160,6 @@ restriction_sweeping_edge:
|
|||
enchantments: [ minecraft:sweeping, minecraft:sweeping_edge ]
|
||||
notAffectedGroups: [ enchanted_book, swords ]
|
||||
|
||||
# Do not exist in 1.18, that mean useInFuture will be set to true
|
||||
# useInFuture set to true also mean it will not warn if there is an issue
|
||||
restriction_swift_sneak:
|
||||
useInFuture: true
|
||||
enchantments: [ minecraft:swift_sneak ]
|
||||
notAffectedGroups: [ enchanted_book, leggings ]
|
||||
|
||||
restriction_thorns:
|
||||
enchantments: [ minecraft:thorns ]
|
||||
notAffectedGroups: [ enchanted_book, armors ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue