Skip to content

Commit

Permalink
Compatible enfin 1.17.1 à 1.20.4 !
Browse files Browse the repository at this point in the history
  • Loading branch information
Euphillya committed Feb 26, 2024
1 parent ac2c865 commit a2484d3
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 12 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ val essentialsRepo = "https://repo.essentialsx.net/releases"


dependencies {
implementation(project(":nms:v1_17_R1", "reobf"))
implementation(project(":nms:v1_18_R1", "reobf"))
implementation(project(":nms:v1_18_R2", "reobf"))
implementation(project(":nms:v1_19_R1", "reobf"))
Expand Down
17 changes: 17 additions & 0 deletions nms/v1_17_R1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id("io.papermc.paperweight.userdev") version "1.5.10" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev
}

dependencies {
paperweight.paperDevBundle("1.17.1-R0.1-SNAPSHOT")
compileOnly(project(":api"))
}

tasks {
assemble {
dependsOn(reobfJar)
}
compileJava {
options.encoding = "UTF-8"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package fr.euphyllia.skyllia.utils.nms.v1_17_R1;

import fr.euphyllia.skyllia.api.SkylliaAPI;
import fr.euphyllia.skyllia.api.utils.scheduler.SchedulerTask;
import fr.euphyllia.skyllia.api.utils.scheduler.model.SchedulerType;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

public class PlayerNMS extends fr.euphyllia.skyllia.api.utils.nms.PlayerNMS {

public void setOwnWorldBorder(JavaPlugin main, Player player, @NotNull Location centerBorder, double borderSize, int warningBlocks, int warningTime) {
SkylliaAPI.getSchedulerTask().getScheduler(SchedulerTask.SchedulerSoft.MINECRAFT)
.execute(SchedulerType.ENTITY, player, schedulerTask -> {
final net.minecraft.world.level.border.WorldBorder worldBorderPlayer = new net.minecraft.world.level.border.WorldBorder();
worldBorderPlayer.world = ((org.bukkit.craftbukkit.v1_17_R1.CraftWorld) centerBorder.getWorld()).getHandle();
worldBorderPlayer.setCenter(centerBorder.getBlockX(), centerBorder.getBlockZ());
worldBorderPlayer.setSize(borderSize);
worldBorderPlayer.setWarningBlocks(warningBlocks);
worldBorderPlayer.setWarningTime(warningTime);
final net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket updateWorldBorderPacket = new net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket(worldBorderPlayer);
org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer craftPlayer = ((org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) player);
craftPlayer.getHandle().connection.send(updateWorldBorderPacket);
});
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package fr.euphyllia.skyllia.utils.nms.v1_17_R1;

import fr.euphyllia.skyllia.api.skyblock.model.Position;
import fr.euphyllia.skyllia.api.world.WorldFeedback;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.GameType;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;


public class WorldNMS extends fr.euphyllia.skyllia.api.utils.nms.WorldNMS {

static GameType getGameType(GameMode gameMode) {
return switch (gameMode) {
case SURVIVAL -> GameType.SURVIVAL;
case CREATIVE -> GameType.CREATIVE;
case ADVENTURE -> GameType.ADVENTURE;
case SPECTATOR -> GameType.SPECTATOR;
};
}

@Override
public WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) {
throw new UnsupportedOperationException();
}

@Override
public void resetChunk(World craftWorld, Position position) {
final ServerLevel serverLevel = ((CraftWorld) craftWorld).getHandle();
io.papermc.paper.util.TickThread.ensureTickThread("Cannot regenerate chunk asynchronously");
final net.minecraft.server.level.ServerChunkCache serverChunkCache = serverLevel.getChunkSource();
final ChunkPos chunkPos = new ChunkPos(position.x(), position.z());
final net.minecraft.world.level.chunk.LevelChunk levelChunk = serverChunkCache.getChunk(chunkPos.x, chunkPos.z, true);
final Iterable<BlockPos> blockPosIterable = BlockPos.betweenClosed(chunkPos.getMinBlockX(), serverLevel.getMinBuildHeight(), chunkPos.getMinBlockZ(), chunkPos.getMaxBlockX(), serverLevel.getMaxBuildHeight() - 1, chunkPos.getMaxBlockZ());
for (final BlockPos blockPos : blockPosIterable) {
levelChunk.removeBlockEntity(blockPos);
serverLevel.setBlock(blockPos, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState(), 16);
}
for (final BlockPos blockPos : blockPosIterable) { // Fix memory issue client
serverChunkCache.blockChanged(blockPos);
}
}
}
1 change: 1 addition & 0 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dependencies {
compileOnly("dev.folia:folia-api:1.20.4-R0.1-SNAPSHOT")
implementation(project(":api"))
implementation(project(":nms:v1_17_R1"))
implementation(project(":nms:v1_18_R1"))
implementation(project(":nms:v1_18_R2"))
implementation(project(":nms:v1_19_R1"))
Expand Down
12 changes: 12 additions & 0 deletions plugin/src/main/java/fr/euphyllia/skyllia/api/InterneAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,18 @@ public CacheManager getCacheManager() {
private void setVersionNMS() throws UnsupportedMinecraftVersionException {
final String[] bukkitVersion = Bukkit.getServer().getBukkitVersion().split("-");
switch (bukkitVersion[0]) {
case "1.17", "1.17.1" -> {
worldNMS = new fr.euphyllia.skyllia.utils.nms.v1_17_R1.WorldNMS();
playerNMS = new fr.euphyllia.skyllia.utils.nms.v1_17_R1.PlayerNMS();
}
case "1.18", "1.18.1" -> {
worldNMS = new fr.euphyllia.skyllia.utils.nms.v1_18_R1.WorldNMS();
playerNMS = new fr.euphyllia.skyllia.utils.nms.v1_18_R1.PlayerNMS();
}
case "1.18.2" -> {
worldNMS = new fr.euphyllia.skyllia.utils.nms.v1_18_R2.WorldNMS();
playerNMS = new fr.euphyllia.skyllia.utils.nms.v1_18_R2.PlayerNMS();
}
case "1.19.4" -> {
worldNMS = new fr.euphyllia.skyllia.utils.nms.v1_19_R3.WorldNMS();
playerNMS = new fr.euphyllia.skyllia.utils.nms.v1_19_R3.PlayerNMS();
Expand Down
19 changes: 7 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Wiki

- FR_FR : https://github.com/Euphillya/Skyllia/wiki
- EN_EN : not yet available
- EN_EN : https://github.com/Euphillya/Skyllia/tree/dev/wiki/en_en/all_files
- ZH_CN : https://github.com/Euphillya/Skyllia/tree/dev/wiki/zh_CN/all_files

## Contact :
Expand Down Expand Up @@ -32,10 +32,6 @@ Gradle Groovy
repositories {
maven {
url = uri("https://maven.pkg.github.com/Euphillya/Skyllia")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
Expand All @@ -59,13 +55,12 @@ UUID islandId = playerIsland.getId();

## Compatible Software

| Software | Version |
|:---------------------------------------------:|:-------------:|
| [PaperMC](https://papermc.io/downloads/paper) | 1.20.1-1.20.4 |
| [Purpur](https://purpurmc.org) | 1.20.1-1.20.4 |
| [Folia](https://papermc.io/software/folia) | 1.19.4-1.20.4 |
| Spigot | Coming soon ! |
| Bukkit | Coming soon ! |
| Software | Version |
|:---------------------------------------------------:|:-------------:|
| [PaperMC](https://papermc.io/downloads/paper) | 1.17-1.20.4 |
| [Purpur](https://purpurmc.org) | 1.17-1.20.4 |
| [Folia](https://papermc.io/software/folia) | 1.19.4-1.20.4 |
| [Spigot](https://www.spigotmc.org)(Not Recommended) | 1.17-1.20.4 |

## Generation Island

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ rootProject.name = "Skyllia"

include("plugin")
include("api")
include("nms:v1_17_R1")
include("nms:v1_18_R1")
include("nms:v1_18_R2")
include("nms:v1_19_R1")
Expand Down

0 comments on commit a2484d3

Please sign in to comment.