Skip to content

Commit

Permalink
Add support for 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Jun 13, 2023
1 parent 40b99bf commit b574798
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Fancy Npcs
Simple, lightweight and fast NPC plugin using [packets](https://wiki.vg/Protocol)

**Only for minecraft server version 1.20**<br>
**Only for minecraft server version 1.20 & 1.20.1**<br>
_Using [paper](https://papermc.io/downloads) is highly recommended_

## Get the plugin
Expand Down
23 changes: 17 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ plugins {
}

group = "de.oliver"
version = "1.2.0"
description = "Simple, lightweight and fast NPC plugin using packets"
version = "1.2.0"
val mcVersion = "1.20.1"

repositories{
mavenLocal()
maven("https://repo.fancyplugins.de/releases")
}

dependencies {
paperweight.paperDevBundle("1.20-R0.1-SNAPSHOT")
paperweight.paperDevBundle("$mcVersion-R0.1-SNAPSHOT")
implementation("de.oliver:FancyLib:1.0.2")
}

tasks {
runServer{
minecraftVersion(mcVersion)
}

publishing {
repositories {
maven {
Expand Down Expand Up @@ -53,10 +58,6 @@ tasks {
}
}

runServer{
minecraftVersion("1.20")
}

// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
Expand All @@ -69,11 +70,21 @@ tasks {
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
}

javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}

processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"version" to project.version,
"description" to project.description,
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
}

Expand Down
16 changes: 12 additions & 4 deletions src/main/java/de/oliver/fancynpcs/FancyNpcs.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public class FancyNpcs extends JavaPlugin {

public static final String SUPPORTED_VERSION = "1.20";
public static final String[] SUPPORTED_VERSIONS = new String[]{"1.20", "1.20.1"};

private static FancyNpcs instance;
private final FancyScheduler scheduler;
Expand Down Expand Up @@ -67,12 +67,20 @@ public void onEnable() {

PluginManager pluginManager = Bukkit.getPluginManager();
DedicatedServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();

String serverVersion = nmsServer.getServerVersion();
if (!serverVersion.equals(SUPPORTED_VERSION)) {

boolean isSupportedVersion = false;
for (String supportedVersion : SUPPORTED_VERSIONS) {
if(serverVersion.equals(supportedVersion)){
isSupportedVersion = true;
break;
}
}

if (!isSupportedVersion) {
getLogger().warning("--------------------------------------------------");
getLogger().warning("Unsupported minecraft server version.");
getLogger().warning("Please update the server to " + SUPPORTED_VERSION + ".");
getLogger().warning("Please update the server to " + String.join(" / ", SUPPORTED_VERSIONS) + ".");
getLogger().warning("Disabling the FancyNpcs plugin.");
getLogger().warning("--------------------------------------------------");
pluginManager.disablePlugin(this);
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: FancyNpcs
main: de.oliver.fancynpcs.FancyNpcs
description: $description
author: OliverHD
version: 1.2.0
api-version: 1.19
load: POSTWORLD
version: $version
main: de.oliver.fancynpcs.FancyNpcs
api-version: "1.20"
folia-supported: true
load: POSTWORLD
commands:
FancyNpcs:
permission: FancyNpcs.admin
Expand Down

0 comments on commit b574798

Please sign in to comment.