From 5620528c1d2526205e7beb9938b32679cc647c81 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 10 May 2021 23:18:36 +0200 Subject: [PATCH] [CI skip] Updated changelog and workflows --- .github/workflows/auto-approve.yml | 6 ++++-- .github/workflows/auto-squash.yml | 3 +++ .github/workflows/discord-webhook.yml | 2 ++ CHANGELOG.md | 1 + .../thebusybiscuit/slimefun4/api/network/Network.java | 4 +++- .../slimefun4/api/network/NetworkVisualizer.java | 11 ++++++++--- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 94ee3dbcf..d15cf8f2f 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,7 +1,6 @@ name: Auto approve -on: - pull_request +on: pull_request jobs: auto-approve: @@ -9,6 +8,9 @@ jobs: name: Auto approve Pull Request runs-on: ubuntu-latest + ## Only run this on the main repo + if: github.repository == 'Slimefun/Slimefun4' + steps: - name: Approve via actions uses: hmarr/auto-approve-action@v2.1.0 diff --git a/.github/workflows/auto-squash.yml b/.github/workflows/auto-squash.yml index b341d5728..4a1ad0f6e 100644 --- a/.github/workflows/auto-squash.yml +++ b/.github/workflows/auto-squash.yml @@ -17,6 +17,9 @@ jobs: name: Auto squash runs-on: ubuntu-latest + ## Only run this on the main repo + if: github.repository == 'Slimefun/Slimefun4' + steps: - name: Auto squash uses: pascalgn/automerge-action@v0.13.1 diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index ad787e29b..e1495d104 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -12,6 +12,8 @@ jobs: name: Discord Webhook runs-on: ubuntu-latest + + ## Only run this on the main repo if: github.repository == 'Slimefun/Slimefun4' steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d94d1449..69b6aaea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ * Fixed #3027 * Fixed #2978 * Fixed #3041 +* Fixed #3036 * Possibly fixed #2927 ## Release Candidate 22 (18 Apr 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java index fa53e78ca..cd9c81bec 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java @@ -10,6 +10,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang.Validate; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.World; @@ -248,7 +249,8 @@ public abstract class Network { */ public void display() { if (manager.isVisualizerEnabled()) { - SlimefunPlugin.runSync(new NetworkVisualizer(this)); + // TODO: Make Color configurable / network-dependent + SlimefunPlugin.runSync(new NetworkVisualizer(this, Color.BLUE)); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java index 7933c51ab..14ab69c85 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java @@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.api.network; import javax.annotation.Nonnull; +import org.apache.commons.lang.Validate; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Particle; @@ -18,7 +19,7 @@ class NetworkVisualizer implements Runnable { /** * The {@link DustOptions} define the {@link Color} and size of our particles. */ - private final DustOptions options = new DustOptions(Color.BLUE, 3.5F); + private final DustOptions particleOptions; /** * This is our {@link Network} instance. @@ -31,8 +32,12 @@ class NetworkVisualizer implements Runnable { * @param network * The {@link Network} to visualize */ - NetworkVisualizer(@Nonnull Network network) { + NetworkVisualizer(@Nonnull Network network, @Nonnull Color color) { + Validate.notNull(network, "The network should not be null."); + Validate.notNull(color, "The color cannot be null."); + this.network = network; + this.particleOptions = new DustOptions(color, 3F); } @Override @@ -53,7 +58,7 @@ class NetworkVisualizer implements Runnable { * The {@link Location} of our node */ private void spawnParticles(@Nonnull Location l) { - l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, options); + l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, particleOptions); } }