Skip to content

Commit

Permalink
Merge Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Jul 5, 2024
2 parents 66520f5 + fe1a0c7 commit a8e7b72
Show file tree
Hide file tree
Showing 56 changed files with 986 additions and 332 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
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 @@ -316,6 +316,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 @@ -58,20 +62,36 @@ public enum MinecraftVersion {
@Getter
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, 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, String name) {
this.name = name;
this.majorVersion = majorVersion;
this.minorVersion = minor;
this.virtual = false;
}

Expand All @@ -80,14 +100,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(String name, boolean virtual) {
this.name = name;
this.majorVersion = 0;
this.minorVersion = -1;
this.virtual = virtual;
}

Expand All @@ -100,13 +119,40 @@ public enum MinecraftVersion {
* <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 @@ -115,9 +161,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(MinecraftVersion version) {
Expand All @@ -135,9 +179,7 @@ public boolean isAtLeast(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(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 @@ -24,7 +25,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 @@ -256,7 +256,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 @@ -86,7 +87,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 @@ -179,9 +180,7 @@ public void add(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 @@ -224,9 +223,7 @@ public ItemStack getItem(Player p) {

meta.setLore(Arrays.asList(
"",
ChatColor.GRAY
+ "\u21E8 "
+ ChatColor.GREEN
ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN
+ Slimefun.getLocalization().getMessage(p, "guide.tooltips.open-itemgroup")));
});
}
Expand Down
Loading

0 comments on commit a8e7b72

Please sign in to comment.