Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4

- uses: actions/setup-java@v2.3.0
- uses: actions/setup-java@v4
with:
distribution: adopt
java-version: '8'
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- run: mvn package --file pom.xml
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
if: github.repository_owner == 'Mooy1'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v2.3.0
- uses: actions/setup-java@v4
with:
distribution: adopt
java-version: '8'
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- run: mvn package --file pom.xml
Expand All @@ -29,7 +29,7 @@ jobs:
run: |
newVersion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo New Version: $newVersion
echo ::set-output name=new-version::$newVersion
echo "new-version=$newVersion" >> $GITHUB_OUTPUT

# Modified From: https://github.com/Bullrich/generate-release-changelog
tag=$(git tag | sort -r --version-sort | head -n1)
Expand All @@ -42,25 +42,24 @@ jobs:
fi

echo Old Version: $tag
echo ::set-output name=old-version::$tag
echo "old-version=$tag" >> $GITHUB_OUTPUT

changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A' - }"
changelog=" - ${changelog//$'\r'/'%0D'}"
echo "$changelog"
echo ::set-output name=changelog::$changelog
echo "changelog=$changelog" >> $GITHUB_OUTPUT

- uses: madhead/semver-utils@1.4.3
- uses: madhead/semver-utils@latest
id: comparison
with:
version: ${{ steps.run.outputs.new-version }}
compare-to: ${{ steps.run.outputs.old-version }}

- uses: actions/create-release@v1.1.4
- uses: softprops/action-gh-release@v1
if: steps.comparison.outputs.comparison-result == '>'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.run.outputs.new-version }}
release_name: Release v${{ steps.run.outputs.new-version }}
name: Release v${{ steps.run.outputs.new-version }}
body: ${{ steps.run.outputs.changelog }}
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
if: github.repository_owner == 'Mooy1'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- id: run
run: |
newVersion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo New Version: $newVersion
echo ::set-output name=new-version::$newVersion
echo "new-version=$newVersion" >> $GITHUB_OUTPUT

tag=$(git tag | sort -r --version-sort | head -n1)

Expand All @@ -30,9 +30,9 @@ jobs:
fi

echo Old Version: $tag
echo ::set-output name=old-version::$tag
echo "old-version=$tag" >> $GITHUB_OUTPUT

- uses: madhead/semver-utils@1.4.3
- uses: madhead/semver-utils@latest
id: comparison
with:
version: ${{ steps.run.outputs.new-version }}
Expand Down
99 changes: 79 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.mooy1</groupId>
<artifactId>InfinityLib</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand All @@ -24,27 +24,25 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>

<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-28</version>
<version>experimental-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>

Expand All @@ -58,21 +56,63 @@
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.2</version>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.16</artifactId>
<version>1.5.0</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.github.MockBukkit</groupId>
<artifactId>MockBukkit</artifactId>
<version>v1.21-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -129,10 +169,21 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.5.1</version>

<configuration>
<relocations>
Expand Down Expand Up @@ -161,4 +212,12 @@
</plugin>
</plugins>
</build>
</project>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/alexsvorada/InfinityLib</url>
</repository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import javax.annotation.ParametersAreNonnullByDefault;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

import io.github.thebusybiscuit.slimefun4.libraries.dough.common.ChatColors;
Expand All @@ -25,7 +24,7 @@ public void execute(CommandSender sender, String[] args) {
sender.sendMessage(ChatColors.color("&7----------&b /" + command.fullName() + " Help &7----------"));
sender.sendMessage("");
for (SubCommand sub : command.available(sender)) {
sender.sendMessage("/" + sub.fullName() + ChatColor.YELLOW + " - " + sub.description());
sender.sendMessage("/" + sub.fullName() + ChatColors.color("&7") + " - " + sub.description());
}
sender.sendMessage("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class PersistentType<T, Z> implements PersistentDataType<T, Z> {
}
catch (Exception e) {
e.printStackTrace();
return new CustomItemStack(Material.STONE, "&cERROR");
return CustomItemStack.create(Material.STONE, "&cERROR");
}
}
);
Expand Down Expand Up @@ -157,10 +157,10 @@ public final class PersistentType<T, Z> implements PersistentDataType<T, Z> {
}
catch (InvalidConfigurationException e) {
e.printStackTrace();
return new CustomItemStack(Material.STONE, "&cERROR");
return CustomItemStack.create(Material.STONE, "&cERROR");
}
ItemStack item = config.getItemStack("item");
return item != null ? item : new CustomItemStack(Material.STONE, "&cERROR");
return item != null ? item : CustomItemStack.create(Material.STONE, "&cERROR");
}
);

Expand Down
11 changes: 6 additions & 5 deletions src/main/java/io/github/mooy1/infinitylib/common/StackUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.bukkit.persistence.PersistentDataType;

import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

@UtilityClass
Expand All @@ -24,8 +23,9 @@ public final class StackUtils {

@Nullable
public static String getId(ItemStack item) {
if (item instanceof SlimefunItemStack) {
return ((SlimefunItemStack) item).getItemId();
SlimefunItem sfItem = SlimefunItem.getByItem(item);
if (sfItem != null) {
return sfItem.getId();
} else if (item.hasItemMeta()) {
return getId(item.getItemMeta());
} else {
Expand All @@ -40,8 +40,9 @@ public static String getId(ItemMeta meta) {

@Nonnull
public static String getIdOrType(ItemStack item) {
if (item instanceof SlimefunItemStack) {
return ((SlimefunItemStack) item).getItemId();
SlimefunItem sfItem = SlimefunItem.getByItem(item);
if (sfItem != null) {
return sfItem.getId();
} else if (item.hasItemMeta()) {
String id = getId(item.getItemMeta());
return id == null ? item.getType().name() : id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected String buildHeader() {
@Nonnull
@Override
public String saveToString() {
options().copyDefaults(true).copyHeader(false).indent(2);
options().copyDefaults(true).parseComments(true).indent(2);
String defaultSave = super.saveToString();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@ParametersAreNonnullByDefault
public class CraftingBlock extends MenuBlock {

public static final ItemStack CLICK_TO_CRAFT = new CustomItemStack(Material.LIME_STAINED_GLASS_PANE, "&aClick To Craft!");
public static final ItemStack CLICK_TO_CRAFT = CustomItemStack.create(Material.LIME_STAINED_GLASS_PANE, "&aClick To Craft!");

@Setter
protected MachineLayout layout = MachineLayout.CRAFTING_DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
@ParametersAreNonnullByDefault
public abstract class MenuBlock extends SlimefunItem {

public static final ItemStack PROCESSING_ITEM = new CustomItemStack(Material.LIME_STAINED_GLASS_PANE, "&aProcessing...");
public static final ItemStack NO_ENERGY_ITEM = new CustomItemStack(Material.RED_STAINED_GLASS_PANE, "&cNot enough energy!");
public static final ItemStack IDLE_ITEM = new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, "&8Idle");
public static final ItemStack NO_ROOM_ITEM = new CustomItemStack(Material.ORANGE_STAINED_GLASS_PANE, "&6Not enough room!");
public static final ItemStack OUTPUT_BORDER = new CustomItemStack(ChestMenuUtils.getOutputSlotTexture(), "&6Output");
public static final ItemStack INPUT_BORDER = new CustomItemStack(ChestMenuUtils.getInputSlotTexture(), "&9Input");
public static final ItemStack PROCESSING_ITEM = CustomItemStack.create(Material.LIME_STAINED_GLASS_PANE, "&aProcessing...");
public static final ItemStack NO_ENERGY_ITEM = CustomItemStack.create(Material.RED_STAINED_GLASS_PANE, "&cNot enough energy!");
public static final ItemStack IDLE_ITEM = CustomItemStack.create(Material.BLACK_STAINED_GLASS_PANE, "&8Idle");
public static final ItemStack NO_ROOM_ITEM = CustomItemStack.create(Material.ORANGE_STAINED_GLASS_PANE, "&6Not enough room!");
public static final ItemStack OUTPUT_BORDER = CustomItemStack.create(ChestMenuUtils.getOutputSlotTexture(), "&6Output");
public static final ItemStack INPUT_BORDER = CustomItemStack.create(ChestMenuUtils.getInputSlotTexture(), "&9Input");
public static final ItemStack BACKGROUND_ITEM = ChestMenuUtils.getBackground();

public MenuBlock(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
Expand Down
Loading
Loading