Skip to content

Commit

Permalink
feat!: delete v1_21_0 sub module
Browse files Browse the repository at this point in the history
Spigot 1.21.0 can no longer be built and points to 1.21.1
1.21.0 should not be used anyways, as 1.21.1 contains a security fix.

This workaround is no longer supported and needed in my eyes.
  • Loading branch information
SpraxDev committed Sep 6, 2024
1 parent 597796b commit 874ecf6
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 370 deletions.
89 changes: 0 additions & 89 deletions NMS/NMS-v1_21_0/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions NMS/NMS-v1_21_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@
</build>

<dependencies>
<dependency>
<version>${project.version}</version>
<artifactId>CraftaroCore-NMS-v1_21_0</artifactId>
<groupId>${project.groupId}</groupId>
<scope>compile</scope>
</dependency>

<!--suppress VulnerableLibrariesLocal -->
<dependency>
<groupId>org.spigotmc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,7 @@ public CustomAnvil createAnvil(Player player) {

@Override
public CustomAnvil createAnvil(Player player, InventoryHolder holder) {
try {
ServerPlayer p = ((CraftPlayer) player).getHandle();
return new AnvilView(p.nextContainerCounter(), p, holder);
} catch (NoClassDefFoundError e) {
//1.21 support
try {
Class<?> clazz = Class.forName("com.craftaro.core.nms.v1_21_0.anvil.AnvilCore");
Object anvilCore = clazz.newInstance();

return (CustomAnvil) anvilCore.getClass().getMethod("createAnvil", Player.class, InventoryHolder.class).invoke(anvilCore, player, holder);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
ServerPlayer p = ((CraftPlayer) player).getHandle();
return new AnvilView(p.nextContainerCounter(), p, holder);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,6 @@ public CraftAbstractInventoryView getBukkitView(Player player, InventoryHolder h
return view;
} catch (Exception ex) {
Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
} catch (NoSuchMethodError err) {
//1.21 support
try {
Class<?> clazz = Class.forName("com.craftaro.core.nms.v1_21_0.anvil.AnvilInventoryCustom");
Object craftInventory = clazz.getConstructor(InventoryHolder.class, Location.class, net.minecraft.world.Container.class, net.minecraft.world.Container.class, AnvilMenu.class)
.newInstance(holder, new Location(this.entity.level().getWorld(), 0, 0, 0), this.inputSlots, this.resultSlots, this);

Class<?> craftInventoryViewClass = Class.forName("org.bukkit.craftbukkit.v1_21_R1.inventory.CraftInventoryView");
//(HumanEntity player, Inventory viewing, AbstractContainerMenu container)
Object view = craftInventoryViewClass.getConstructor(HumanEntity.class, Inventory.class, AbstractContainerMenu.class).newInstance(player.getBukkitEntity(), (Inventory) craftInventory, this);
mc_ContainerAnvil_bukkitEntity.set(this, view);

return (CraftAbstractInventoryView) view;
} catch (Exception ex) {
Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
}
}

return getBukkitView();
Expand Down
Loading

0 comments on commit 874ecf6

Please sign in to comment.