Skip to content

Commit

Permalink
1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed Jun 9, 2024
1 parent 088ff28 commit 6b8029c
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 25 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxSellwands</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<packaging>jar</packaging>

<name>AxSellwands</name>
Expand Down Expand Up @@ -156,7 +156,7 @@
<dependency>
<groupId>com.artillexstudios.axapi</groupId>
<artifactId>axapi</artifactId>
<version>1.4.236</version>
<version>1.4.238</version>
<scope>compile</scope>
<classifier>all</classifier>
</dependency>
Expand Down
46 changes: 23 additions & 23 deletions src/main/java/com/artillexstudios/axsellwands/utils/NBTUtils.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.artillexstudios.axsellwands.utils;

import com.artillexstudios.axapi.items.WrappedItemStack;
import com.artillexstudios.axapi.items.component.DataComponent;
import com.artillexstudios.axapi.items.component.DataComponents;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -12,115 +12,115 @@ public class NBTUtils {

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, @NotNull String content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putString(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, int content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putInt(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, boolean content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putBoolean(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, double content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putDouble(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, long content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putLong(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, float content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putFloat(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static void writeToNBT(@NotNull ItemStack item, @NotNull String namespace, UUID content) {
WrappedItemStack.edit(item, wrappedItemStack -> {
var customData = wrappedItemStack.get(DataComponent.CUSTOM_DATA);
var customData = wrappedItemStack.get(DataComponents.customData());
customData.putUUID(namespace, content);
wrappedItemStack.set(DataComponent.CUSTOM_DATA, customData);
wrappedItemStack.set(DataComponents.customData(), customData);
return wrappedItemStack;
});
}

public static boolean containsNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).contains(namespace);
return wrappedItemStack.get(DataComponents.customData()).contains(namespace);
});
}

@Nullable
public static String readStringFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
final String str = wrappedItemStack.get(DataComponent.CUSTOM_DATA).getString(namespace);
final String str = wrappedItemStack.get(DataComponents.customData()).getString(namespace);
return str.isEmpty() ? null : str;
});
}

public static int readIntegerFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).getInt(namespace);
return wrappedItemStack.get(DataComponents.customData()).getInt(namespace);
});
}

public static float readFloatFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).getFloat(namespace);
return wrappedItemStack.get(DataComponents.customData()).getFloat(namespace);
});
}

public static long readLongFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).getLong(namespace);
return wrappedItemStack.get(DataComponents.customData()).getLong(namespace);
});
}

public static double readDoubleFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).getDouble(namespace);
return wrappedItemStack.get(DataComponents.customData()).getDouble(namespace);
});
}

@Nullable
public static UUID readUUIDFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).getUUID(namespace);
return wrappedItemStack.get(DataComponents.customData()).getUUID(namespace);
});
}

public static boolean readBooleanFromNBT(@NotNull ItemStack item, @NotNull String namespace) {
return WrappedItemStack.edit(item, wrappedItemStack -> {
return wrappedItemStack.get(DataComponent.CUSTOM_DATA).getBoolean(namespace);
return wrappedItemStack.get(DataComponents.customData()).getBoolean(namespace);
});
}
}
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html

prefix: "<gradient:#FF5500:#FF7700><bold>AxSellwands</gradient> &7» "

# modes:
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/hooks.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html

# what plugin to use for these things?
# if you need another plugin supported, please contact us on discord
# Note: custom should only be used if you have a plugin that uses the API to add a custom hook
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/lang.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html

help:
- " "
- "&#FF5500&lAxSellwands &7»"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/prices.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html
# NOTE: this file is only useful if you use the builtin price system

# format: MATERIAL: price
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/sellwands/container-sellwand.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html
# ITEM BUILDER: https://docs.artillex-studios.com/item-builder.html

name: "&#8855FFEnderChest Sellwand"

item:
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/sellwands/normal-sellwand.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html
# ITEM BUILDER: https://docs.artillex-studios.com/item-builder.html

name: "&#FF5500Normal Sellwand"

item:
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/sellwands/unlimited-sellwand.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axsellwands.html
# ITEM BUILDER: https://docs.artillex-studios.com/item-builder.html

name: "&#EE0000Unlimited Sellwand"

item:
Expand Down

0 comments on commit 6b8029c

Please sign in to comment.