Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Jul 13, 2024
2 parents af4cb3b + 31e87ee commit ebd90ae
Show file tree
Hide file tree
Showing 63 changed files with 1,131 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
java-version: ${{ vars.JAVA_CI_VERSION }}
java-package: jdk
architecture: x64
cache: maven
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-version: ${{ vars.JAVA_CI_VERSION }}
java-package: jdk
architecture: x64
cache: maven
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- mcVersion: '1.19.4'
javaVersion: '19'
- mcVersion: 'latest'
javaVersion: '20'
javaVersion: '21'

steps:
- name: Checkout repository
Expand Down 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
4 changes: 2 additions & 2 deletions .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-version: ${{ vars.JAVA_CI_VERSION }}
java-package: jdk
architecture: x64

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
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

Looking for English (or Original) Version? [**Click here**](https://github.com/Slimefun/Slimefun4/)

想要直接下载吗? [**单击此处
**](https://github.com/StarWishsama/Slimefun4/blob/master/README.md#floppy_disk-下载-slimefun4)
想要直接下载吗? [**单击此处**](https://github.com/StarWishsama/Slimefun4/blob/master/README.md#floppy_disk-下载-slimefun4)

欢迎加入 QQ 交流群:807302496

本插件的额外保护检查现已移至 [SlimeGlue(粘液胶)](https://github.com/Xzavier0722/SlimeGlue/) 处理,请下载此插件以获得对其他插件的额外保护检查。

MCBBS 链接: https://www.mcbbs.net/thread-827594-1-1.html
下载 [SlimeGlue(粘液胶)](https://github.com/Xzavier0722/SlimeGlue/) 以保证 Slimefun 与领地保护插件的兼容性

### 订阅计划

Expand All @@ -31,12 +28,12 @@ MCBBS 链接: https://www.mcbbs.net/thread-827594-1-1.html

Slimefun 是一个致力于提供模组般体验的插件。它提供了你能想到的一切,不管是喷气背包还是魔法祭坛!

Slimefun 让每个玩家可以自己决定在魔法或科技方面发展
Slimefun 让每个玩家可以自行决定在魔法或科技方面发展
从魔杖到核反应堆,我们应有尽有。
除此之外,我们还有魔法祭坛、能源网络甚至物品运输系统。

该项目始于 2013 年,至今仍在发展。
现在已从独自开发插件到发展成一个拥有数千名参与者和百名贡献者的社区
现在已从独立小型插件到发展成一个拥有数千名参与者和百名贡献者的社区
目前 Slimefun 添加了超过 **500 种新物品/合成配方**
([查看关于 Slimefun 的历史](https://slimefun-wiki.guizhanss.cn/Slimefun-in-a-nutshell))。

Expand All @@ -63,7 +60,7 @@ Slimefun 4 可以在[鬼斩构建站](https://builds.guizhanss.com)页面中**
| | 测试版 (最新更新) | "稳定版" |
|----------------------|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| **支持的 Minecraft 版本** | :video_game: 1.16.X - 1.20.X | :video_game: 1.16.X - 1.20.X |
| **Java 版本** | :computer: **Java 16 (或更高)** | :computer: **Java 16 (或更高)** |
| **Java 版本** | :computer: **Java 21 (或更高)** | :computer: **Java 21 (或更高)** |
| **自动更新系统** | :heavy_check_mark: | :x: |
| **频繁更新** | :heavy_check_mark: | :x: |
| **享有最新内容** | :heavy_check_mark: | :x: |
Expand Down
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<!-- Our default version will be UNOFFICIAL, this will prevent auto updates -->
<!-- from overriding our local test file -->
<version>5.0-SNAPSHOT</version>
<version>UNOFFICIAL</version>
<inceptionYear>2013</inceptionYear>
<packaging>jar</packaging>

Expand All @@ -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 Expand Up @@ -105,21 +105,21 @@
<!-- Compiler plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.13.0</version>

<configuration>
<excludes>
<!-- package info files are only important for Javadocs -->
<!-- We can safely exclude them from the final jar -->
<exclude>**/package-info.java</exclude>
</excludes>
<source>16</source>
<target>16</target>
<source>21</source>
<target>21</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.34</version>
</path>
</annotationProcessorPaths>
</configuration>
Expand Down Expand Up @@ -269,15 +269,15 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>

<!-- Shaded packages -->
<dependency>
<groupId>com.github.starwishsama.dough</groupId>
<artifactId>dough-api</artifactId>
<version>f266e39d48</version>
<version>d783252831</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,17 @@ public void getPlayerUuidAsync(String pName, IAsyncReadCallback<UUID> callback)
scheduleReadTask(() -> invokeCallback(callback, getPlayerUuid(pName)));
}

public void updateUsername(String uuid, String newName) {
var key = new RecordKey(DataScope.PLAYER_PROFILE);
key.addField(FieldKey.PLAYER_NAME);
key.addCondition(FieldKey.PLAYER_UUID, uuid);

var data = new RecordSet();
data.put(FieldKey.PLAYER_NAME, newName);

scheduleWriteTask(new UUIDKey(DataScope.NONE, uuid), key, data, false);
}

private static RecordSet getRecordSet(PlayerBackpack bp) {
var re = new RecordSet();
re.put(FieldKey.PLAYER_UUID, bp.getOwner().getUniqueId().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
*
* @author TheBusyBiscuit
* @author Walshy
*
* @see Slimefun
*
*/
public enum MinecraftVersion {

Expand Down Expand Up @@ -47,6 +45,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,20 +66,36 @@ 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.
* This constructor forces the {@link MinecraftVersion} to be real.
* It must be a real version of Minecraft.
*
* @param majorVersion
* The major version of minecraft as an {@link Integer}
* @param name
* The display name of this {@link MinecraftVersion}
* @param majorVersion The major version of minecraft as an {@link Integer}
* @param name The display name of this {@link 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 @@ -84,14 +104,13 @@ public enum MinecraftVersion {
* A virtual {@link MinecraftVersion} (unknown or unit test) is not an actual
* version of Minecraft but rather a state of the {@link Server} software.
*
* @param name
* The display name of this {@link MinecraftVersion}
* @param virtual
* Whether this {@link MinecraftVersion} is virtual
* @param name The display name of this {@link MinecraftVersion}
* @param virtual Whether this {@link MinecraftVersion} is virtual
*/
MinecraftVersion(@Nonnull String name, boolean virtual) {
this.name = name;
this.majorVersion = 0;
this.minorVersion = -1;
this.virtual = virtual;
}

Expand Down Expand Up @@ -126,13 +145,40 @@ public boolean isVirtual() {
* <p>
* Example: {@literal "1.13"} returns {@literal 13}
*
* @param minecraftVersion
* The {@link Integer} version to match
*
* @param minecraftVersion The {@link Integer} version to match
* @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) {
if (isVirtual()) {
return false;
}

if (this.majorVersion != 20) {
return this.majorVersion == minecraftVersion && this.minorVersion >= patchVersion;
} else {
return this.majorVersion == minecraftVersion && this.minorVersion == -1
? patchVersion < 5
: patchVersion >= minorVersion;
}
}

/**
Expand All @@ -141,9 +187,7 @@ public boolean isMinecraftVersion(int minecraftVersion) {
*
* An unknown version will default to {@literal false}.
*
* @param version
* The {@link MinecraftVersion} to compare
*
* @param version The {@link MinecraftVersion} to compare
* @return Whether this {@link MinecraftVersion} is newer or equal to the given {@link MinecraftVersion}
*/
public boolean isAtLeast(@Nonnull MinecraftVersion version) {
Expand Down Expand Up @@ -176,9 +220,7 @@ public boolean isAtLeast(@Nonnull MinecraftVersion version) {
*
* An unknown version will default to {@literal true}.
*
* @param version
* The {@link MinecraftVersion} to compare
*
* @param version The {@link MinecraftVersion} to compare
* @return Whether this {@link MinecraftVersion} is older than the given one
*/
public boolean isBefore(@Nonnull MinecraftVersion version) {
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
Loading

0 comments on commit ebd90ae

Please sign in to comment.