Merge branch 'Auxilor:master' into master

This commit is contained in:
Sedri05 2022-06-11 23:43:45 +02:00 committed by GitHub
commit 6d535696f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 88 additions and 4 deletions

View File

@ -3,7 +3,7 @@ version rootProject.version
subprojects {
dependencies {
implementation 'com.willfp:libreforge:3.57.2'
implementation 'com.willfp:libreforge:3.59.0'
implementation 'org.joml:joml:1.10.4'
}
}

View File

@ -0,0 +1,6 @@
group 'com.willfp'
version rootProject.version
dependencies {
compileOnly 'org.spigotmc:spigot:1.19-R0.1-SNAPSHOT'
}

View File

@ -0,0 +1,25 @@
package com.willfp.ecoenchants.proxy.v1_19_R1;
import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata;
import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments;
import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy;
import com.willfp.ecoenchants.proxy.v1_19_R1.enchants.EcoCraftEnchantment;
import net.minecraft.core.IRegistry;
import net.minecraft.world.item.enchantment.Enchantment;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_19_R1.util.CraftNamespacedKey;
import java.util.Map;
public final class EcoCraftEnchantmentManager implements EcoCraftEnchantmentManagerProxy {
@Override
public void registerNewCraftEnchantments() {
Map<org.bukkit.enchantments.Enchantment, VanillaEnchantmentMetadata> metadataMap = VanillaEnchantments.getMetadataMap();
for (Enchantment enchantment : IRegistry.W) {
NamespacedKey key = CraftNamespacedKey.fromMinecraft(IRegistry.W.b(enchantment));
VanillaEnchantmentMetadata metadata = metadataMap.get(org.bukkit.enchantments.Enchantment.getByKey(key));
new EcoCraftEnchantment(enchantment, metadata).register();
}
}
}

View File

@ -0,0 +1,13 @@
package com.willfp.ecoenchants.proxy.v1_19_R1;
import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public final class OpenInventory implements OpenInventoryProxy {
@Override
public Object getOpenInventory(@NotNull final Player player) {
return ((CraftPlayer) player).getHandle().bU;
}
}

View File

@ -0,0 +1,36 @@
package com.willfp.ecoenchants.proxy.v1_19_R1.enchants;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import net.minecraft.world.item.enchantment.Enchantment;
import org.bukkit.craftbukkit.v1_19_R1.enchantments.CraftEnchantment;
import org.jetbrains.annotations.NotNull;
public class EcoCraftEnchantment extends CraftEnchantment {
private final VanillaEnchantmentMetadata metadata;
public EcoCraftEnchantment(@NotNull final Enchantment target,
@NotNull final VanillaEnchantmentMetadata metadata) {
super(target);
this.metadata = metadata;
}
@Override
public int getMaxLevel() {
return metadata.maxLevel() == null ? this.getHandle().a() : metadata.maxLevel();
}
@Override
public boolean conflictsWith(@NotNull final org.bukkit.enchantments.Enchantment other) {
if (other instanceof EcoEnchant) {
return other.conflictsWith(this);
}
return metadata.conflicts() == null ? super.conflictsWith(other) : metadata.conflicts().contains(other.getKey());
}
public void register() {
EnchantmentUtils.register(this);
}
}

View File

@ -196,7 +196,10 @@ public class EnchantDisplay extends DisplayModule {
}
lore.addAll(requirementLore);
fastItemStack.setLore(lore);
if (!lore.isEmpty()) {
fastItemStack.setLore(lore);
}
if (itemStack.getType() == Material.ENCHANTED_BOOK) {
fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);
} else {

View File

@ -1,4 +1,4 @@
#libreforge-updater
#Mon Jun 06 13:29:23 BST 2022
version=8.79.3
#Wed Jun 08 21:06:00 BST 2022
version=8.81.0
plugin-name=EcoEnchants

View File

@ -6,6 +6,7 @@ include ':eco-core:core-nms'
include ':eco-core:core-nms:v1_17_R1'
include ':eco-core:core-nms:v1_18_R1'
include ':eco-core:core-nms:v1_18_R2'
include ':eco-core:core-nms:v1_19_R1'
include ':eco-core:core-proxy'
include ':eco-core:core-plugin'
include ':eco-core:core-stub'