Skip to content

Commit

Permalink
Merge branch 'refs/heads/chore/update-to-1-20-5' into 1-20-5-support
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/auto-approve.yml
#	.github/workflows/auto-squash.yml
#	.github/workflows/pr-labels.yml
#	.github/workflows/pull-request.yml
#	.github/workflows/release-candidates.yml
#	pom.xml
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/TestCase.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/AutoSavingService.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunProfiler.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/AnimalGrowthAccelerator.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/CropGrowthAccelerator.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/accelerators/TreeGrowthAccelerator.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/VillagerRune.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/ExplosiveBow.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/IcyBow.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/AncientAltarTask.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/storage/backend/legacy/LegacyStorage.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java
#	src/main/resources/config.yml
#	src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java
#	src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java
#	src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java
#	src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java
#	src/test/java/io/github/thebusybiscuit/slimefun4/storage/backend/TestLegacyBackend.java
#	src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java
  • Loading branch information
StarWishsama committed Jun 30, 2024
1 parent b86c047 commit 43433e4
Show file tree
Hide file tree
Showing 57 changed files with 1,065 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
"https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$BUILD/downloads/$JAR_FILE"
- name: Download Slimefun
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: plugins/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/.idea/
/.vscode/
/data-storage/
/javadocs/

.classpath
.factorypath
Expand Down
31 changes: 29 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Table of contents
- [Release Candidate 37 (TBD)](#release-candidate-37-tbd)
- [Release Candidate 38 (TBD)](#release-candidate-38-tbd)
- [Release Candidate 37 (25 Feb 2024)](#release-candidate-37-25-feb-2024)
- [Release Candidate 36 (20 Dec 2023)](#release-candidate-36-20-dec-2023)
- [Release Candidate 35 (07 Jul 2023)](#release-candidate-35-07-jul-2023)
- [Release Candidate 34 (20 Jun 2023)](#release-candidate-34-20-jun-2023)
Expand Down Expand Up @@ -37,7 +38,33 @@
- [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 37 (TBD)
## Release Candidate 38 (TBD)

## Release Candidate 37 (25 Feb 2024)

#### Additions
* (API) Introduce SlimefunItemRegistryFinalizedEvent (#4099)
* Add update warning to /sf versions (#4096)
* Add new analytics service (#4067)

#### Changes
* Allow blocks to be dropped while in creative mode (#3934)
* Storage rewrite - Phase 1 (#4065)
* Temporarily disable senstive blocks check (#4077)
* Update MockBukkit to 1.20.4 along with existing tests (#4086)
* Move PlayerProfile saving off the main thread (#4119)

#### Fixes
* Fix contributor head being pullable (#4072)
* Fix backpack IDs not incrementing (#4081)
* Fix inventory being used when Slimefun block is broken (#4088)
* Fix items not being able to be placed on ancient altar (#4094)
* Update dough to fix item stacking issue (#4100)
* Fix slimefun block turning into a vanilla block if there are viewers (#4101)
* Fixes #4123 - Coal Generator will no longer be locked after researching (#4124)
* Fixes exhaustion when loading large profiles (#4127)
* Fixes guide search when using colored chat (#4125)
* Fix dupe glitch with backpacks (#4134)

## Release Candidate 36 (20 Dec 2023)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<maven.compiler.target>16</maven.compiler.target>

<!-- Spigot properties -->
<spigot.version>1.20</spigot.version>
<spigot.version>1.20.6</spigot.version>
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public enum MinecraftVersion {
*/
MINECRAFT_1_20(20, "1.20.x"),

/**
* This constant represents Minecraft (Java Edition) Version 1.20.5
* ("The Armored Paws Update")
*/
MINECRAFT_1_20_5(20, 5, "1.20.5+"),

/**
* This constant represents an exceptional state in which we were unable
* to identify the Minecraft Version we are using
Expand All @@ -62,6 +68,7 @@ public enum MinecraftVersion {
private final String name;
private final boolean virtual;
private final int majorVersion;
private final int minorVersion;

/**
* This constructs a new {@link MinecraftVersion} with the given name.
Expand All @@ -76,6 +83,26 @@ public enum MinecraftVersion {
MinecraftVersion(int majorVersion, @Nonnull String name) {
this.name = name;
this.majorVersion = majorVersion;
this.minorVersion = -1;
this.virtual = false;
}

/**
* This constructs a new {@link MinecraftVersion} with the given name.
* This constructor forces the {@link MinecraftVersion} to be real.
* It must be a real version of Minecraft.
*
* @param majorVersion
* The major (minor in semver, major in MC land) version of minecraft as an {@link Integer}
* @param minor
* The minor (patch in semver, minor in MC land) version of minecraft as an {@link Integer}
* @param name
* The display name of this {@link MinecraftVersion}
*/
MinecraftVersion(int majorVersion, int minor, @Nonnull String name) {
this.name = name;
this.majorVersion = majorVersion;
this.minorVersion = minor;
this.virtual = false;
}

Expand All @@ -92,6 +119,7 @@ public enum MinecraftVersion {
MinecraftVersion(@Nonnull String name, boolean virtual) {
this.name = name;
this.majorVersion = 0;
this.minorVersion = -1;
this.virtual = virtual;
}

Expand Down Expand Up @@ -132,7 +160,30 @@ public boolean isVirtual() {
* @return Whether this {@link MinecraftVersion} matches the specified version id
*/
public boolean isMinecraftVersion(int minecraftVersion) {
return !isVirtual() && this.majorVersion == minecraftVersion;
return this.isMinecraftVersion(minecraftVersion, -1);
}

/**
* This tests if the given minecraft version matches with this
* {@link MinecraftVersion}.
* <p>
* You can obtain the version number by doing {@link PaperLib#getMinecraftVersion()}.
* It is equivalent to the "major" version<br />
* You can obtain the patch version by doing {@link PaperLib#getMinecraftPatchVersion()}.
* It is equivalent to the "minor" version
* <p>
* Example: {@literal "1.13"} returns {@literal 13}<br />
* Exampe: {@literal "1.13.2"} returns {@literal 13_2}
*
* @param minecraftVersion
* The {@link Integer} version to match
*
* @return Whether this {@link MinecraftVersion} matches the specified version id
*/
public boolean isMinecraftVersion(int minecraftVersion, int patchVersion) {
return !isVirtual()
&& this.majorVersion == minecraftVersion
&& (this.minorVersion == -1 || this.minorVersion >= patchVersion);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType;
import io.papermc.lib.PaperLib;
import java.util.HashSet;
import java.util.Set;
Expand All @@ -25,7 +26,6 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

/**
* The {@link TeleportationManager} handles the process of teleportation for a {@link Player}
Expand Down Expand Up @@ -257,7 +257,7 @@ private void onTeleport(Player p, Location destination, boolean success, boolean
if (success) {
// Apply Resistance Effect, if enabled
if (resistance) {
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20));
p.addPotionEffect(new PotionEffect(VersionedPotionEffectType.RESISTANCE, 600, 20));
Slimefun.getLocalization().sendMessage(p, "machines.TELEPORTER.invulnerability");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -82,7 +83,7 @@ public ItemGroup(NamespacedKey key, ItemStack item, int tier) {
ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
meta.addItemFlags(VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP);
this.item.setItemMeta(meta);
this.tier = tier;
}
Expand Down Expand Up @@ -185,9 +186,7 @@ public void add(@Nonnull SlimefunItem item) {
if (isRegistered()
&& !isCrossAddonItemGroup()
&& !item.getAddon().getName().equals(this.addon.getName())) {
item.warn("This item does not belong into ItemGroup "
+ this
+ " as that group belongs to "
item.warn("This item does not belong into ItemGroup " + this + " as that group belongs to "
+ this.addon.getName());
}

Expand Down Expand Up @@ -230,9 +229,7 @@ public void remove(@Nonnull SlimefunItem item) {

meta.setLore(Arrays.asList(
"",
ChatColor.GRAY
+ "\u21E8 "
+ ChatColor.GREEN
ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN
+ Slimefun.getLocalization().getMessage(p, "guide.tooltips.open-itemgroup")));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.github.thebusybiscuit.slimefun4.api.exceptions.WrongItemStackException;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
Expand All @@ -22,7 +23,6 @@
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
Expand Down Expand Up @@ -165,7 +165,7 @@ public SlimefunItemStack(
potionMeta.addCustomEffect(effect, true);

if (effect.getType().equals(PotionEffectType.SATURATION)) {
im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
im.addItemFlags(VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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;

Expand Down Expand Up @@ -226,7 +227,7 @@ private void discoverNeighbors(@Nonnull Location l) {
*/
public void display() {
if (manager.isVisualizerEnabled()) {
Slimefun.runSync(new NetworkVisualizer(this));
Slimefun.runSync(new NetworkVisualizer(this, Color.BLUE));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package io.github.thebusybiscuit.slimefun4.api.network;

import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle;
import javax.annotation.Nonnull;
import org.apache.commons.lang.Validate;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Particle.DustOptions;

/**
* This class represents the visualizer task of a given {@link Network}.
*
* @author TheBusyBiscuit
*
*/
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.
Expand All @@ -26,10 +28,15 @@ class NetworkVisualizer implements Runnable {
/**
* This creates a new {@link NetworkVisualizer} for the given {@link Network}.
*
* @param network The {@link Network} to visualize
* @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
Expand All @@ -46,11 +53,21 @@ public void run() {
/**
* This method will spawn the actual particles.
*
* @param l The {@link Location} of our node
* @param l
* 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);
VersionedParticle.DUST,
l.getX() + 0.5,
l.getY() + 0.5,
l.getZ() + 0.5,
1,
0,
0,
0,
1,
particleOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.bakedlibs.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.utils.UnbreakingAlgorithm;
import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.bukkit.Sound;
Expand Down Expand Up @@ -49,7 +50,7 @@ public interface DamageableItem extends ItemAttribute {
*/
default void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
if (isDamageable() && item != null && !item.getType().isAir() && item.getAmount() > 0) {
int unbreakingLevel = item.getEnchantmentLevel(Enchantment.DURABILITY);
int unbreakingLevel = item.getEnchantmentLevel(VersionedEnchantment.UNBREAKING);

if (evaluateUnbreakingEnchantment(unbreakingLevel)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.base.Preconditions;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.RadiationUtils;
import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType;
import javax.annotation.Nonnull;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
Expand All @@ -21,11 +22,11 @@
* @see RadiationUtils
*/
public enum RadiationSymptom {
SLOW(10, PotionEffectType.SLOW, 3),
SLOW(10, VersionedPotionEffectType.SLOWNESS, 3),
WITHER_LOW(25, PotionEffectType.WITHER, 0),
BLINDNESS(50, PotionEffectType.BLINDNESS, 4),
WITHER_HIGH(75, PotionEffectType.WITHER, 3),
IMMINENT_DEATH(100, PotionEffectType.HARM, 49);
IMMINENT_DEATH(100, VersionedPotionEffectType.INSTANT_DAMAGE, 49);

private final int minExposure;
private final PotionEffect potionEffect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public enum TestCase {

UTILS,

ENERGYNET;
ENERGYNET,

ANALYTICS;

TestCase() {}

Expand Down
Loading

0 comments on commit 43433e4

Please sign in to comment.