Skip to content

Commit 624c3bb

Browse files
Migrate placeholder to gradle as well
1 parent 8c2ab9f commit 624c3bb

7 files changed

Lines changed: 50 additions & 221 deletions

File tree

PistonQueuePlaceholder/.gitignore

Lines changed: 0 additions & 113 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
plugins {
2+
`java-library`
3+
`maven-publish`
4+
}
5+
6+
repositories {
7+
maven {
8+
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
9+
}
10+
maven {
11+
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
12+
}
13+
maven {
14+
url = uri("https://papermc.io/repo/repository/maven-public/")
15+
}
16+
mavenCentral()
17+
}
18+
19+
dependencies {
20+
compileOnly("org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT")
21+
compileOnly("me.clip:placeholderapi:2.11.3")
22+
23+
compileOnly("org.projectlombok:lombok:1.18.30")
24+
annotationProcessor("org.projectlombok:lombok:1.18.30")
25+
}
26+
27+
group = "net.pistonmaster"
28+
version = "3.0.0-SNAPSHOT"
29+
description = "PistonQueuePlaceholder"
30+
java.sourceCompatibility = JavaVersion.VERSION_1_8
31+
java.targetCompatibility = JavaVersion.VERSION_1_8
32+
33+
tasks.withType<JavaCompile> {
34+
options.encoding = "UTF-8"
35+
}

PistonQueuePlaceholder/pom.xml

Lines changed: 0 additions & 104 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "PistonQueuePlaceholder"

PistonQueuePlaceholder/src/main/java/net/pistonmaster/pistonqueue/placeholder/PAPIExpansion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public boolean canRegister() {
3232
}
3333

3434
@Override
35-
public String onRequest(OfflinePlayer player, String identifier) {
35+
public String onRequest(OfflinePlayer player, @NotNull String identifier) {
3636
for (Map.Entry<String, Integer> entry : plugin.getOnlineQueue().entrySet()) {
3737
if (identifier.equalsIgnoreCase("online_queue_" + entry.getKey())) {
3838
return String.valueOf(entry.getValue());

PistonQueuePlaceholder/src/main/java/net/pistonmaster/pistonqueue/placeholder/PistonQueuePlaceholder.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.google.common.io.ByteArrayDataInput;
44
import com.google.common.io.ByteStreams;
5-
import io.papermc.lib.PaperLib;
65
import lombok.Getter;
76
import org.bukkit.ChatColor;
87
import org.bukkit.entity.Player;
@@ -66,10 +65,19 @@ public void onPluginMessageReceived(String channel, @NotNull Player player, byte
6665
}
6766

6867
private void checkIfBungee() {
69-
if (!PaperLib.isSpigot()) {
70-
getLogger().severe(ChatColor.RED + "You probably run CraftBukkit. Update at least to spigot for this plugin to work!");
68+
if (!isSpigot()) {
69+
getLogger().severe(ChatColor.RED + "You probably run CraftBukkit. Update at least to Spigot for this plugin to work!");
7170
getLogger().severe(ChatColor.RED + "Plugin disabled!");
7271
getServer().getPluginManager().disablePlugin(this);
7372
}
7473
}
74+
75+
private boolean isSpigot() {
76+
try {
77+
Class.forName("org.spigotmc.SpigotConfig");
78+
return true;
79+
} catch (ClassNotFoundException e) {
80+
return false;
81+
}
82+
}
7583
}

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ dependencyResolutionManagement {
3838

3939
rootProject.name = "PistonQueue"
4040

41+
includeBuild("PistonQueuePlaceholder")
42+
4143
setOf(
4244
"build-data",
4345
"shared",

0 commit comments

Comments
 (0)