From 805c2eafcc3419ec0f47e8f75f6daac9a226ecc1 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 18 Jun 2021 15:08:24 +0200 Subject: [PATCH] Added a new feature to the debug fish SlimefunTag support --- CHANGELOG.md | 7 +++--- .../listeners/DebugFishListener.java | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b086ced7e..3dd0b35e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Table of contents -- [Release Candidate 25 (TBD)](#release-candidate-25-tbd) +- [Release Candidate 25 (20 Jun 2021)](#release-candidate-25-20-jun-2021) - [Release Candidate 24 (03 Jun 2021)](#release-candidate-24-03-jun-2021) - [Release Candidate 23 (19 May 2021)](#release-candidate-23-19-may-2021) - [Release Candidate 22 (18 Apr 2021)](#release-candidate-22-18-apr-2021) @@ -25,7 +25,7 @@ - [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019) - [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019) -## Release Candidate 25 (TBD) +## Release Candidate 25 (20 Jun 2021) #### Additions * Added "4 Charcoal -> 1 Coal" recipe to the Compressor @@ -40,6 +40,7 @@ * Added "Raw Iron -> Iron Dust" recipe to the Ore Crusher * Added "Raw Gold -> Gold Dust" recipe to the Ore Crusher * Added "Raw Copper -> Copper Dust" recipe to the Ore Crusher +* Debug Fish can now read Slimefun Tags for vanilla blocks #### Changes * (API) Removed `SlimefunItem#getID()` (renamed to `SlimefunItem#getId()`) @@ -48,7 +49,7 @@ * (API) Removed AsyncReactorProcessCompleteEvent #### Fixes -* Fixed 3105 +* Fixed #3105 ## Release Candidate 24 (03 Jun 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#24 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/DebugFishListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/DebugFishListener.java index bc0548cdb..badde25c4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/DebugFishListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/DebugFishListener.java @@ -1,5 +1,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; +import java.util.HashSet; +import java.util.Set; import java.util.logging.Level; import javax.annotation.Nonnull; @@ -27,6 +29,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; + import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -100,6 +104,26 @@ public class DebugFishListener implements Listener { } catch (Exception x) { SlimefunPlugin.logger().log(Level.SEVERE, "An Exception occurred while using a Debug-Fish", x); } + } else { + // Read applicable Slimefun tags + Set tags = new HashSet<>(); + + for (SlimefunTag tag : SlimefunTag.values()) { + if (tag.isTagged(b.getType())) { + tags.add(tag); + } + } + + if (!tags.isEmpty()) { + p.sendMessage(" "); + p.sendMessage(ChatColors.color("&dSlimefun tags for: &e") + b.getType().name()); + + for (SlimefunTag tag : tags) { + p.sendMessage(ChatColors.color("&d* &e") + tag.name()); + } + + p.sendMessage(" "); + } } }