forked from Slimefun/Slimefun4
-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* e2e testing initial * Setup matrix * Download tester * Jeff's changes * capitalized Chosen * Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.1 * fix breaking sf block with not unlocked item duping contents (Slimefun#3976) * [CI skip] Update actions/setup-java action to v3.13.0 * [CI skip] Update dependency me.clip:placeholderapi to v2.11.4 * [CI skip] Update actions/checkout action to v4 * [CI skip] Update dependency com.github.LoneDev6:itemsadder-api to v3.5.0c-r5 * [CI skip] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.6.0 * [CI skip] Update dependency org.sonarsource.scanner.maven:sonar-maven-plugin to v3.10.0.2594 * [CI skip] Update dependency com.sk89q.worldedit:worldedit-core to v7.2.16 * [CI skip] Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.16 * [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.224 * [CI skip] Update dependency org.mockito:mockito-core to v5.6.0 * updated dough version (Slimefun#3991) * [CI skip] Update dependency com.github.LoneDev6:itemsadder-api to v3.6.1 * [CI skip] Update dependency com.sk89q.worldedit:worldedit-core to v7.2.17 * [CI skip] Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.17 * [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.225 * [CI skip] Update dependency org.jacoco:jacoco-maven-plugin to v0.8.11 * [CI skip] Update actions/checkout action to v4.1.1 * [CI skip] Update thollander/actions-comment-pull-request action to v2.4.3 * [CI skip] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.2.1 * [CI skip] Update dependency me.clip:placeholderapi to v2.11.5 * Update .github/workflows/e2e-testing.yml * Update .github/workflows/e2e-testing.yml * Update .github/workflows/e2e-testing.yml * Update .github/workflows/e2e-testing.yml * Add MultiBlockCraftEvent (Updated version of Slimefun#3439) (Slimefun#3928) * fix taking damage on head collision while wearing elytra cap (Slimefun#3760) * Remove Lore Check from Slimefun Guide (Slimefun#3969) * don't consume bookbinder inputs if the output is worse than the input (Slimefun#3925) Co-authored-by: Jeroen <[email protected]> * Update .github/workflows/e2e-testing.yml * Update .github/workflows/e2e-testing.yml * fix heads showing as steve (Slimefun#4027) * fix: clean up issues after merging * chore(style): apply code style --------- Co-authored-by: Jeffrey <[email protected]> Co-authored-by: Daniel Walsh <[email protected]> Co-authored-by: iTwins <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jeroen <[email protected]> Co-authored-by: TheBusyBiscuit <[email protected]> Co-authored-by: J3fftw <[email protected]> Co-authored-by: JustAHuman-xD <[email protected]> Co-authored-by: Jeroen <[email protected]> Co-authored-by: Alessio Colombo <[email protected]>
- Loading branch information
1 parent
8aa175f
commit 39fe312
Showing
17 changed files
with
365 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: End to End Testing | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
artifact-name: | ||
description: 'Slimefun artifact name' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
e2e-testing: | ||
name: End to End Testing | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- mcVersion: '1.16.5' | ||
javaVersion: '16' | ||
- mcVersion: '1.17.1' | ||
javaVersion: '17' | ||
- mcVersion: '1.18.2' | ||
javaVersion: '18' | ||
- mcVersion: '1.19.4' | ||
javaVersion: '19' | ||
- mcVersion: '1.20.1' | ||
javaVersion: '20' | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/[email protected] | ||
with: | ||
distribution: temurin | ||
java-version: ${{ matrix.javaVersion }} | ||
java-package: jdk | ||
architecture: x64 | ||
|
||
- name: Setup server | ||
run: | | ||
echo 'eula=true' > eula.txt | ||
mkdir plugins | ||
- name: Download ${{ matrix.mcVersion }} Paper | ||
run: | | ||
VERSION="${{ matrix.mcVersion }}" | ||
BUILD_JAR=$(curl -s "https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds" \ | ||
| jq '.builds[-1] | "\(.build) \(.downloads.application.name)"' -r) | ||
BUILD=$(echo "$BUILD_JAR" | awk '{print $1}') | ||
JAR_FILE=$(echo "$BUILD_JAR" | awk '{print $2}') | ||
curl -o paper.jar \ | ||
"https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$BUILD/downloads/$JAR_FILE" | ||
- name: Download Slimefun | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
path: plugins/ | ||
|
||
- name: Download e2e-tester | ||
run: | | ||
curl -o e2e-tester.jar https://preview-builds.walshy.dev/download/e2e-tester/main/latest | ||
mv e2e-tester.jar plugins/e2e-tester.jar | ||
- name: Run server | ||
run: | | ||
java -jar paper.jar --nogui |
118 changes: 118 additions & 0 deletions
118
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockCraftEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.player.PlayerEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
/** | ||
* This {@link Event} is called when a {@link Player} crafts an item using a {@link MultiBlockMachine}. | ||
* Unlike the {@link MultiBlockInteractEvent}, this event only fires if an output to a craft is expected. | ||
* If this event is cancelled, ingredients will not be consumed and no output item results. | ||
* | ||
* @author char321 | ||
* @author JustAHuman | ||
*/ | ||
public class MultiBlockCraftEvent extends PlayerEvent implements Cancellable { | ||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final MultiBlockMachine machine; | ||
private final ItemStack[] input; | ||
private ItemStack output; | ||
private boolean cancelled; | ||
|
||
/** | ||
* Creates a new {@link MultiBlockCraftEvent}. | ||
* | ||
* @param p The player that crafts using a multiblock | ||
* @param machine The multiblock machine used to craft | ||
* @param input The input items of the craft | ||
* @param output The resulting item of the craft | ||
*/ | ||
@ParametersAreNonnullByDefault | ||
public MultiBlockCraftEvent(Player p, MultiBlockMachine machine, ItemStack[] input, ItemStack output) { | ||
super(p); | ||
this.machine = machine; | ||
this.input = input; | ||
this.output = output; | ||
} | ||
|
||
/** | ||
* Creates a new {@link MultiBlockCraftEvent}. | ||
* | ||
* @param p The player that crafts using a multiblock | ||
* @param machine The multiblock machine used to craft | ||
* @param input The input item of the craft | ||
* @param output The resulting item of the craft | ||
*/ | ||
@ParametersAreNonnullByDefault | ||
public MultiBlockCraftEvent(Player p, MultiBlockMachine machine, ItemStack input, ItemStack output) { | ||
this(p, machine, new ItemStack[] {input}, output); | ||
} | ||
|
||
/** | ||
* Gets the machine that was used to craft. | ||
* | ||
* @return The {@link MultiBlockMachine} used to craft. | ||
*/ | ||
public @Nonnull MultiBlockMachine getMachine() { | ||
return machine; | ||
} | ||
|
||
/** | ||
* Gets the input of the craft. | ||
* | ||
* @return The {@link ItemStack ItemStack[]} input that is used in the craft. | ||
*/ | ||
public @Nonnull ItemStack[] getInput() { | ||
return input; | ||
} | ||
|
||
/** | ||
* Gets the output of the craft. | ||
* | ||
* @return The {@link ItemStack} output that results from the craft. | ||
*/ | ||
public @Nonnull ItemStack getOutput() { | ||
return output; | ||
} | ||
|
||
/** | ||
* Sets the output of the craft. Keep in mind that this overwrites any existing output. | ||
* | ||
* @param output | ||
* The new item for the event to produce. | ||
* | ||
* @return The previous {@link ItemStack} output that was replaced. | ||
*/ | ||
public @Nullable ItemStack setOutput(@Nullable ItemStack output) { | ||
ItemStack oldOutput = this.output; | ||
this.output = output; | ||
return oldOutput; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
public static @Nonnull HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Override | ||
public @Nonnull HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.