Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
13ccdf8
NBTCustomItemStack - fix performance issue when run too many times
ShaneBeee Dec 23, 2024
9aa4674
nbt-test.sk - modernize and fix up test
ShaneBeee Dec 23, 2024
31e68f7
build.gradle - update VirtualFurance API
ShaneBeee Dec 27, 2024
6986704
ExprVirtualFurnaceMachineFromID - update from API changes
ShaneBeee Dec 27, 2024
427b464
virtualfurnace/Type - add changer
ShaneBeee Dec 27, 2024
8b599a4
virtual-furnace-test.sk - delete furnace after test
ShaneBeee Dec 27, 2024
66ba446
tests - add SkBee prefix
ShaneBeee Dec 27, 2024
4c91031
text-component-test.sk - expand tests
ShaneBeee Dec 27, 2024
54288ef
ExprTextComponent - add fallback option for translate component
ShaneBeee Dec 27, 2024
577d93d
build.gradle - update virtual furnace API
ShaneBeee Dec 27, 2024
b6c1385
text-component-test.sk - disable color test
ShaneBeee Dec 27, 2024
ebc1877
recipe-test.sk - strip out use of `any/every` aliases
ShaneBeee Dec 27, 2024
558e9fe
Config - Force elements to load if test mode is enabled
ShaneBeee Dec 27, 2024
07ca112
AddonLoader - test mode is handled in config now
ShaneBeee Dec 27, 2024
8177883
SecTransferCookieRetrieve - delay event in section to make sure kick …
ShaneBeee Dec 29, 2024
678f845
ExprTransferCookie - only allow in retrieve section
ShaneBeee Dec 29, 2024
9aa40a4
ExprTransferCookie - update docs
ShaneBeee Dec 29, 2024
10e8f52
SecTransferCookieRetrieve - allow section to run even if cookie is mi…
ShaneBeee Dec 29, 2024
26ba3f3
Skript 2.10 prep
ShaneBeee Dec 30, 2024
7d650fa
recipe-test.sk - update for skript 2.10
ShaneBeee Dec 31, 2024
b2dc354
recipe-test.sk - fix item flag
ShaneBeee Jan 1, 2025
94c335d
MinecraftTag - disable (now in Skript)
ShaneBeee Jan 1, 2025
2315985
Skript 2.10 prep
ShaneBeee Jan 2, 2025
bfa74cb
gradle.yml - update to Skript 2.10 for tests
ShaneBeee Jan 2, 2025
8370b6e
gradle.yml - temp disable vanilla tests
ShaneBeee Jan 2, 2025
dd99e4d
AddonLoader - SkBee now requires Skript 2.10+
ShaneBeee Jan 2, 2025
220cb6f
README.md - update regarding Skript version
ShaneBeee Jan 2, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ jobs:
uses: SkriptLang/skript-test-action@v1.1
with:
test_script_directory: src/test/scripts
skript_repo_ref: 2.9.5
skript_repo_ref: 2.10.0-pre1
extra_plugins_directory: extra-plugins/
run_vanilla_tests: 'false' # temporarily disable
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ See the [**Wiki**](https://github.com/ShaneBeee/SkBee/wiki) for more detailed in
Are you running an <ins>**outdated**</ins> version of Minecraft and looking for an <ins>**outdated**</ins> build of SkBee that will work on your <ins>**outdated**</ins> server? Well look no further, here is a list of <ins>**outdated**</ins> builds of SkBee for your <ins>**outdated**</ins> server.
Keep in mind, these <ins>**outdated**</ins> builds for <ins>**outdated**</ins> servers are not supported and you will not get support/bug fixes, because they're <ins>**outdated**</ins>!

### <ins>Skript 2.9.5 (and below)</ins>
Due to changes in Skript 2.10's API, SkBee 3.7.0+ will only work on Skript 2.10+
If you need SkBee to work on an older version of Skript this is the last version that will work:
[**SkBee 3.6.6**](https://github.com/SkriptHub/SkBee/releases/tag/3.6.6)
(Just like any other <ins>**outdated**</ins> build, this one is no longer supported)

### <ins>Skript 2.6.4 (and below)</ins>
Due to changes in Skript 2.7's API, SkBee 3.0.0+ will only work on Skript 2.7+
If you need SkBee to work on an older version of Skript this is the last version that will work:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")

// Skript
compileOnly(group: 'com.github.SkriptLang', name: 'Skript', version: '2.8.7') {
compileOnly(group: 'com.github.SkriptLang', name: 'Skript', version: '2.10.0-pre1') {
transitive = false
}

Expand All @@ -54,7 +54,7 @@ dependencies {
implementation("fr.mrmicky:fastboard:2.1.3")

// Virtual Furnace
implementation("com.github.ShaneBeeStudios:VirtualFurnace:1.0.0") {
implementation("com.github.ShaneBeeStudios:VirtualFurnace:1.1.1") {
transitive = false
}

Expand Down
12 changes: 7 additions & 5 deletions src/main/java/com/shanebeestudios/skbee/AddonLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import ch.njol.skript.SkriptAddon;
import ch.njol.skript.localization.Noun;
import ch.njol.skript.registrations.Classes;
import ch.njol.skript.test.runner.TestMode;
import ch.njol.skript.util.Version;
import com.shanebeestudios.skbee.api.listener.EntityListener;
import com.shanebeestudios.skbee.api.listener.NBTListener;
Expand Down Expand Up @@ -62,9 +61,9 @@ boolean canLoadPlugin() {
return false;
}
Version skriptVersion = Skript.getVersion();
if (skriptVersion.isSmallerThan(new Version(2, 7))) {
if (skriptVersion.isSmallerThan(new Version(2, 9, 999))) {
Util.log("&cDependency Skript outdated, plugin disabling.");
Util.log("&eSkBee requires Skript 2.7+ but found Skript " + skriptVersion);
Util.log("&eSkBee requires Skript 2.10+ but found Skript " + skriptVersion);
return false;
}
if (!Skript.isAcceptRegistrations()) {
Expand Down Expand Up @@ -323,8 +322,7 @@ private void loadStructureElements() {
}

private void loadVirtualFurnaceElements() {
// Force load if running tests as this is defaulted to false in the config
if (!this.config.ELEMENTS_VIRTUAL_FURNACE && !TestMode.ENABLED) {
if (!this.config.ELEMENTS_VIRTUAL_FURNACE) {
Util.logLoading("&5Virtual Furnace Elements &cdisabled via config");
return;
}
Expand Down Expand Up @@ -501,6 +499,10 @@ private void loadParticleElements() {
}

private void loadTagElements() {
if (Util.IS_RUNNING_SKRIPT_2_10) {
Util.logLoading("&5Minecraft Tag elements &cdisabled &r(&7now in Skript&r)");
return;
}
if (!this.config.ELEMENTS_MINECRAFT_TAG) {
Util.logLoading("&5Minecraft Tag elements &cdisabled via config");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ch.njol.skript.lang.Trigger;
import com.shanebeestudios.skbee.api.generator.event.BiomeGenEvent;
import org.bukkit.Location;
import org.bukkit.Registry;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BiomeProvider;
Expand Down Expand Up @@ -30,10 +31,11 @@ public void setTrigger(Trigger trigger) {
return biomeGenEvent.getBiome();
}

@SuppressWarnings({"deprecation", "UnstableApiUsage", "removal"})
@Override
public @NotNull List<Biome> getBiomes(@NotNull WorldInfo worldInfo) {
List<Biome> biomes = new ArrayList<>();
for (Biome biome : Biome.values()) {
for (Biome biome : Registry.BIOME) {
if (biome != Biome.CUSTOM) biomes.add(biome);
}
return biomes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void processCommand(Cancellable event, CommandSender sender, String comm
static {
}

@SuppressWarnings("UnstableApiUsage")
@SuppressWarnings({"UnstableApiUsage", "removal"})
@EventHandler
private void onLoadScript(PreScriptLoadEvent event) {
List<Config> scriptsToRemove = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class NBTCustomBlock extends NBTContainer {
private final NBTCompound chunkData;
private final boolean canSave;

@SuppressWarnings("deprecation")
public NBTCustomBlock(Block block) {
this.block = block;
this.blockTag = String.format("%s_%s_%s", block.getX(), block.getY(), block.getZ());
Expand Down Expand Up @@ -51,6 +52,7 @@ protected void saveCompound() {
blockCompound.mergeCompound(this);
}

@SuppressWarnings("deprecation")
@Override
public String toString() {
NBTContainer tag = new NBTContainer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class NBTCustomItemStack extends NBTContainer {
private final boolean isFull;

public NBTCustomItemStack(ItemStack itemStack, boolean isCustomData, boolean isVanilla, boolean isFull) {
super(getInitialContainer(itemStack, isCustomData, isVanilla, isFull).toString());
super(getInitialContainer(itemStack, isCustomData, isVanilla, isFull).getCompound());
this.originalItemStack = itemStack;
this.isCustomData = isCustomData;
this.isFull = isFull;
Expand All @@ -32,7 +32,10 @@ private static NBTCompound getInitialContainer(ItemStack itemStack, boolean isCu
nbtContainer = NBTItem.convertItemtoNBT(itemStack);
}
if (nbtContainer == null) nbtContainer = new NBTContainer();
return getContainer(nbtContainer, isCustomData, isFull);
// Create a clone (Minecraft seems to freak out without doing this)
NBTCompound clone = new NBTContainer();
clone.mergeCompound(getContainer(nbtContainer, isCustomData, isFull));
return clone;
}

private static NBTCompound getContainer(NBTCompound itemContainer, boolean isCustomData, boolean isFull) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ public class NBTCustomOfflinePlayer extends NBTFile implements NBTCustom {
private static final String PLAYER_FOLDER;

static {
String worldFolder = Bukkit.getWorlds().get(0).getWorldFolder().getPath();
String worldFolder = Bukkit.getWorlds().getFirst().getWorldFolder().getPath();
PLAYER_FOLDER = worldFolder + "/playerdata/";
}

@SuppressWarnings("deprecation")
public NBTCustomOfflinePlayer(OfflinePlayer offlinePlayer) throws IOException {
super(new File(PLAYER_FOLDER + offlinePlayer.getUniqueId() + ".dat"));
}
Expand Down Expand Up @@ -88,6 +89,7 @@ public String toString() {
return getCopy().toString();
}

@SuppressWarnings("deprecation")
@Override
public @NotNull NBTCompound getCopy() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static void logCookingRecipe(CookingRecipe<?> recipe) {
if (HAS_CATEGORY) {
log(" - &7Category: &r\"&6%s&r\"", recipe.getCategory());
}
log(" - &7CookTime: &b%s", Timespan.fromTicks(recipe.getCookingTime()));
log(" - &7CookTime: &b%s", new Timespan(Timespan.TimePeriod.TICK, recipe.getCookingTime()));
log(" - &7Experience: &b%s", recipe.getExperience());
log(" - &7Ingredients: %s", getFancy(recipe.getInputChoice()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class ChatReflection {
* (usually spaces)
* @return Pretty string of NBTCompound
*/
@SuppressWarnings("deprecation")
public static @Nullable String getPrettyNBT(NBTCompound compound, String split) {
Object nmsNBT = new NBTContainer(compound.toString()).getCompound();
String s = split != null ? split : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ public static String getAllNames() {
}

static {
register(Advancement.class, Registry.ADVANCEMENT);
register(Advancement.class, new ObjectConverter<>() {
@Override
public @Nullable Advancement get(NamespacedKey key) {
return Bukkit.getAdvancement(key);
}
});
register(Attribute.class, Registry.ATTRIBUTE);
register(Biome.class, Registry.BIOME);
if (Skript.classExists("org.bukkit.damage.DamageType")) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/shanebeestudios/skbee/api/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class Util {

// Shortcut for finding stuff to remove later
public static final boolean IS_RUNNING_SKRIPT_2_9 = Skript.getVersion().isLargerThan(new Version(2, 8, 999));
public static final boolean IS_RUNNING_SKRIPT_2_10 = Skript.getVersion().isLargerThan(new Version(2, 9, 999));
public static final boolean IS_RUNNING_MC_1_21 = Skript.isRunningMinecraft(1, 21);

@SuppressWarnings("deprecation") // Paper deprecation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.TranslatableComponent;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.TextColor;
Expand Down Expand Up @@ -156,7 +157,7 @@ public static ComponentWrapper fromTranslate(String translate) {
* @param objects Objects to add into translation
* @return Component from translation
*/
public static ComponentWrapper fromTranslate(String translate, Object... objects) {
public static ComponentWrapper fromTranslate(String translate, @Nullable String fallback, Object... objects) {
List<Component> comps = new ArrayList<>();
for (Object object : objects) {
if (object instanceof ComponentWrapper component) {
Expand All @@ -174,7 +175,7 @@ public static ComponentWrapper fromTranslate(String translate, Object... objects
comps.add(Component.text(objectString));
}
}
return new ComponentWrapper(Component.translatable(translate, comps));
return new ComponentWrapper(Component.translatable(translate, fallback, comps));
}

/**
Expand All @@ -196,7 +197,7 @@ private static Component getItem(Object object) {
itemStack = is;
} else if (object instanceof ItemType itemType) {
itemStack = itemType.getRandom();
material = itemStack.getType();
if (itemStack != null) material = itemStack.getType();
} else if (object instanceof Slot slot) {
itemStack = slot.getItem();
}
Expand Down Expand Up @@ -354,7 +355,7 @@ public Color getColor() {
if (skriptColor != null) {
return skriptColor;
}
return new ColorRGB(textColor.red(), textColor.green(), textColor.blue());
return ColorRGB.fromRGB(textColor.red(), textColor.green(), textColor.blue());
}

public void setBold(boolean bold) {
Expand Down Expand Up @@ -411,6 +412,19 @@ public String getFont() {
}
}

public void setFallback(String fallback) {
if (this.component instanceof TranslatableComponent translatable) {
this.component = translatable.fallback(fallback);
}
}

public String getFallback() {
if (this.component instanceof TranslatableComponent translatable) {
return translatable.fallback();
}
return null;
}

public void setInsertion(String insertion) {
this.component = this.component.insertion(insertion);
}
Expand Down Expand Up @@ -542,6 +556,7 @@ public void setEntityName(Entity entity, boolean alwaysVisible) {
*
* @param inventory Inventory to change name
*/
@SuppressWarnings("deprecation")
public void setInventoryName(Inventory inventory) {
List<HumanEntity> viewers = inventory.getViewers();
if (viewers.isEmpty()) return;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/shanebeestudios/skbee/config/Config.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.shanebeestudios.skbee.config;

import ch.njol.skript.test.runner.TestMode;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.shanebeestudios.skbee.SkBee;
Expand Down Expand Up @@ -115,6 +116,7 @@ private boolean getSetting(String setting) {
}

private boolean getElement(String element) {
if (TestMode.ENABLED) return true;
return this.config.getBoolean("elements." + element);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,22 @@
import ch.njol.skript.Skript;
import ch.njol.skript.lang.util.SimpleEvent;
import ch.njol.skript.registrations.EventValues;
import ch.njol.skript.util.Getter;
import org.bukkit.advancement.Advancement;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
import org.jetbrains.annotations.Nullable;

@SuppressWarnings("unused")
public class SimpleEvents extends SimpleEvent {

static {
// Player Advancement Event
Skript.registerEvent("Player Advancement", SimpleEvents.class, PlayerAdvancementDoneEvent.class,
"[player] advancement done")
.description("Called when a player has completed all criteria in an advancement.")
.examples("")
.since("1.17.0");
"[player] advancement done")
.description("Called when a player has completed all criteria in an advancement.")
.examples("")
.since("1.17.0");

EventValues.registerEventValue(PlayerAdvancementDoneEvent.class, String.class, new Getter<>() {
@Override
public @Nullable String get(PlayerAdvancementDoneEvent event) {
return event.getAdvancement().getKey().toString();
}
}, 0);

EventValues.registerEventValue(PlayerAdvancementDoneEvent.class, Advancement.class, new Getter<>() {
@Override
public @Nullable Advancement get(PlayerAdvancementDoneEvent event) {
return event.getAdvancement();
}
}, 0);
EventValues.registerEventValue(PlayerAdvancementDoneEvent.class, String.class, event -> event.getAdvancement().getKey().toString(), EventValues.TIME_NOW);
EventValues.registerEventValue(PlayerAdvancementDoneEvent.class, Advancement.class, PlayerAdvancementDoneEvent::getAdvancement, EventValues.TIME_NOW);
}

}
Loading
Loading