mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 05:17:05 +02:00
Compare commits
26 Commits
2.11.2
...
feature/fo
Author | SHA1 | Date | |
---|---|---|---|
|
95786e32d2 | ||
|
e862abe0b4 | ||
|
2d946646f0 | ||
|
5ab61e0cd3 | ||
|
81ef464dad | ||
|
0ae0ddc9cb | ||
|
3d00d48106 | ||
|
7e902cae66 | ||
|
f4e4433b16 | ||
|
d5c371004c | ||
|
e246473782 | ||
|
4afad7f7b0 | ||
|
a0b177bdd8 | ||
|
40b1fe8d68 | ||
|
9ee4afa1e9 | ||
|
1cf66b130c | ||
|
c3cfc82eb3 | ||
|
3afb634e58 | ||
|
d888d9754b | ||
|
4c228ca4fb | ||
|
6cf987586e | ||
|
46d9a69534 | ||
|
af8cc09fca | ||
|
452c8ccd42 | ||
|
054c780fd1 | ||
|
83261eee49 |
18
.github/label-commenter-config.yml
vendored
18
.github/label-commenter-config.yml
vendored
@@ -36,9 +36,9 @@ labels:
|
|||||||
Your issue unfortunately lacks certain information that we require in order to help you with your issue.
|
Your issue unfortunately lacks certain information that we require in order to help you with your issue.
|
||||||
Please make sure you provide the following information:
|
Please make sure you provide the following information:
|
||||||
|
|
||||||
- Currently used Versions of your server and PlaceholderAPI
|
- Currently used Versions of your server (`/version`) and PlaceholderAPI (`/version PlaceholderAPI`)
|
||||||
- Currently installed Expansions
|
- Currently installed Expansions (`/papi list`)
|
||||||
- Currently installed Plugins
|
- Currently installed Plugins (`/pl`)
|
||||||
- Any additional information requested by users in this issue.
|
- Any additional information requested by users in this issue.
|
||||||
|
|
||||||
The easiest way to provide those information is through the `/papi dump` command which posts the required information to https://paste.helpch.at and gives a URL to share.
|
The easiest way to provide those information is through the `/papi dump` command which posts the required information to https://paste.helpch.at and gives a URL to share.
|
||||||
@@ -52,18 +52,18 @@ labels:
|
|||||||
issue:
|
issue:
|
||||||
body: |-
|
body: |-
|
||||||
Your issue has beeen marked as invalid.
|
Your issue has beeen marked as invalid.
|
||||||
This means that it either doesn't follow any provided template, or isn't related to PlaceholderAPI in any way.
|
This means that it either doesn't follow any provided template, or isn't related to PlaceholderAPI.
|
||||||
|
|
||||||
Please make sure to use one of the issue templates and provide the requested information.
|
Please make sure to use one of the issue templates and provide the requested information.
|
||||||
Currently available Templates are:
|
Currently available Templates are:
|
||||||
|
|
||||||
- [Bug Report](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=bug_report.md)
|
- [Bug Report](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?labels=Type%3A+Issue+%28Unconfirmed%29&template=bug_report.yml)
|
||||||
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=feature_request.md)
|
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?labels=Type%3A+Enhancement&template=feature_request.yml)
|
||||||
|
|
||||||
If you want changes to be made towards the Wiki, would we encourage you to [Make a Pull request](https://github.com/PlaceholderAPI/PlaceholderAPI/pulls).
|
If you want changes to be made towards the Wiki, would we encourage you to [Make a Pull request](https://github.com/PlaceholderAPI/PlaceholderAPI/pulls).
|
||||||
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/wiki/README.md).
|
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md).
|
||||||
|
|
||||||
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive faster response compared to the issue tracker here.
|
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive a faster response compared to the issue tracker here.
|
||||||
Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
|
Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
|
||||||
action: close
|
action: close
|
||||||
pr:
|
pr:
|
||||||
@@ -74,7 +74,7 @@ labels:
|
|||||||
Here is a small summary of what you should know:
|
Here is a small summary of what you should know:
|
||||||
|
|
||||||
- Pull requests for PlaceholderAPI should target the `master` branch.
|
- Pull requests for PlaceholderAPI should target the `master` branch.
|
||||||
- Pull requests for the Wiki should target the `docs/wiki` branch.
|
- Pull requests for the Wiki should target the `wiki` branch.
|
||||||
|
|
||||||
Don't hesitate to ask us any questions.
|
Don't hesitate to ask us any questions.
|
||||||
action: close
|
action: close
|
||||||
|
131
build.gradle
131
build.gradle
@@ -1,131 +0,0 @@
|
|||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id "java"
|
|
||||||
id "maven-publish"
|
|
||||||
id "org.cadixdev.licenser" version "0.6.1"
|
|
||||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
group "me.clip"
|
|
||||||
version "2.11.2"
|
|
||||||
|
|
||||||
description "An awesome placeholder provider!"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven({ url = "https://oss.sonatype.org/content/repositories/snapshots/" })
|
|
||||||
|
|
||||||
mavenCentral()
|
|
||||||
mavenLocal()
|
|
||||||
|
|
||||||
maven({ url = "https://repo.codemc.org/repository/maven-public/" })
|
|
||||||
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "org.bstats:bstats-bukkit:3.0.0"
|
|
||||||
implementation "net.kyori:adventure-platform-bukkit:4.0.1"
|
|
||||||
|
|
||||||
compileOnly "org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT"
|
|
||||||
compileOnly "org.jetbrains:annotations:23.0.0"
|
|
||||||
|
|
||||||
testImplementation "org.openjdk.jmh:jmh-core:1.32"
|
|
||||||
testImplementation "org.openjdk.jmh:jmh-generator-annprocess:1.32"
|
|
||||||
|
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.8.2"
|
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
filter ReplaceTokens, tokens: [name: rootProject.name, version: project.version.toString(), description: project.description]
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
|
|
||||||
withJavadocJar()
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
failOnError false
|
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
|
||||||
options.addStringOption('encoding', 'UTF-8')
|
|
||||||
options.addStringOption('charSet', 'UTF-8')
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
archiveClassifier.set("")
|
|
||||||
|
|
||||||
relocate "org.bstats", "me.clip.placeholderapi.metrics"
|
|
||||||
relocate "net.kyori", "me.clip.placeholderapi.libs.kyori"
|
|
||||||
}
|
|
||||||
|
|
||||||
license {
|
|
||||||
include '**/*.java'
|
|
||||||
|
|
||||||
matching('**/*.java') {
|
|
||||||
header = file('config/headers/main.txt')
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
|
||||||
year = 2021
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
testImplementation {
|
|
||||||
extendsFrom(compileOnly)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
if (version.contains("-DEV")) {
|
|
||||||
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
|
|
||||||
} else {
|
|
||||||
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
|
||||||
}
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = System.getenv("JENKINS_USER")
|
|
||||||
password = System.getenv("JENKINS_PASS")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
artifactId = "placeholderapi"
|
|
||||||
|
|
||||||
from components.java
|
|
||||||
|
|
||||||
pom.withXml {
|
|
||||||
|
|
||||||
// some are having issues with bstats so we might need to add that to the pom as well
|
|
||||||
|
|
||||||
asNode().appendNode("packaging", "jar")
|
|
||||||
asNode().remove(asNode().get("dependencies"))
|
|
||||||
|
|
||||||
def dependenciesNode = asNode().appendNode("dependencies")
|
|
||||||
// jetbrains annotations
|
|
||||||
def jetbrainsAnnotations = dependenciesNode.appendNode("dependency")
|
|
||||||
jetbrainsAnnotations.appendNode("groupId", "org.jetbrains")
|
|
||||||
jetbrainsAnnotations.appendNode("artifactId", "annotations")
|
|
||||||
jetbrainsAnnotations.appendNode("version", "19.0.0")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publish.dependsOn clean, test, jar
|
|
128
build.gradle.kts
Normal file
128
build.gradle.kts
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
|
id("com.github.hierynomus.license") version "0.16.1"
|
||||||
|
id("com.github.johnrengelman.shadow") version "8.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "me.clip"
|
||||||
|
version = "2.11.4-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||||
|
|
||||||
|
description = "An awesome placeholder provider!"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
|
||||||
|
maven("https://repo.codemc.org/repository/maven-public/")
|
||||||
|
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.bstats:bstats-bukkit:3.0.1")
|
||||||
|
implementation("net.kyori:adventure-platform-bukkit:4.3.0")
|
||||||
|
|
||||||
|
compileOnlyApi("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT") // this is temp
|
||||||
|
compileOnlyApi("org.jetbrains:annotations:23.0.0")
|
||||||
|
|
||||||
|
testImplementation("org.openjdk.jmh:jmh-core:1.32")
|
||||||
|
testImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.32")
|
||||||
|
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
||||||
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17 // this is temp
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17 // this is temp
|
||||||
|
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
license {
|
||||||
|
header = rootProject.file("config/headers/main.txt")
|
||||||
|
|
||||||
|
include("**/*.java")
|
||||||
|
mapping("java", "JAVADOC_STYLE")
|
||||||
|
|
||||||
|
encoding = "UTF-8"
|
||||||
|
|
||||||
|
ext {
|
||||||
|
set("year", 2021)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val javaComponent: SoftwareComponent = components["java"]
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
processResources {
|
||||||
|
eachFile { expand("version" to project.version) }
|
||||||
|
}
|
||||||
|
|
||||||
|
build {
|
||||||
|
dependsOn(named("shadowJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<Javadoc> {
|
||||||
|
isFailOnError = false
|
||||||
|
|
||||||
|
with(options as StandardJavadocDocletOptions) {
|
||||||
|
addStringOption("Xdoclint:none", "-quiet")
|
||||||
|
addStringOption("encoding", "UTF-8")
|
||||||
|
addStringOption("charSet", "UTF-8")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<ShadowJar> {
|
||||||
|
archiveClassifier.set("")
|
||||||
|
|
||||||
|
relocate("org.bstats", "me.clip.placeholderapi.metrics")
|
||||||
|
relocate("net.kyori", "me.clip.placeholderapi.libs.kyori")
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
artifactId = "placeholderapi"
|
||||||
|
from(javaComponent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
if ("-DEV" in version.toString()) {
|
||||||
|
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
|
||||||
|
} else {
|
||||||
|
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||||
|
}
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("JENKINS_USER")
|
||||||
|
password = System.getenv("JENKINS_PASS")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publish.get().setDependsOn(listOf(build.get()))
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testImplementation {
|
||||||
|
extendsFrom(compileOnly.get())
|
||||||
|
}
|
||||||
|
}
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
rootProject.name = 'PlaceholderAPI'
|
|
1
settings.gradle.kts
Normal file
1
settings.gradle.kts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "PlaceholderAPI"
|
@@ -162,7 +162,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getAsyncScheduler().cancelTasks(this); // this is hopefully temp
|
||||||
|
|
||||||
adventure.close();
|
adventure.close();
|
||||||
adventure = null;
|
adventure = null;
|
||||||
|
@@ -22,11 +22,6 @@ package me.clip.placeholderapi.commands.impl.cloud;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
@@ -34,12 +29,17 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public final class CommandECloud extends PlaceholderCommand {
|
public final class CommandECloud extends PlaceholderCommand {
|
||||||
|
|
||||||
@Unmodifiable
|
@Unmodifiable
|
||||||
private static final List<PlaceholderCommand> COMMANDS = ImmutableList
|
private static final List<PlaceholderCommand> COMMANDS = ImmutableList
|
||||||
.of(new CommandECloudClear(),
|
.of(new CommandECloudClear(),
|
||||||
new CommandECloudToggle(),
|
|
||||||
new CommandECloudStatus(),
|
new CommandECloudStatus(),
|
||||||
new CommandECloudUpdate(),
|
new CommandECloudUpdate(),
|
||||||
new CommandECloudRefresh(),
|
new CommandECloudRefresh(),
|
||||||
@@ -79,8 +79,6 @@ public final class CommandECloud extends PlaceholderCommand {
|
|||||||
Msg.msg(sender,
|
Msg.msg(sender,
|
||||||
"&b&lPlaceholderAPI &8- &7eCloud Help Menu &8- ",
|
"&b&lPlaceholderAPI &8- &7eCloud Help Menu &8- ",
|
||||||
" ",
|
" ",
|
||||||
"&b/papi &fenable/disable/toggle",
|
|
||||||
" &7&oEnable or disable the eCloud",
|
|
||||||
"&b/papi &fecloud status",
|
"&b/papi &fecloud status",
|
||||||
" &7&oView status of the eCloud",
|
" &7&oView status of the eCloud",
|
||||||
"&b/papi &fecloud list <all/{author}/installed> {page}",
|
"&b/papi &fecloud list <all/{author}/installed> {page}",
|
||||||
@@ -115,10 +113,8 @@ public final class CommandECloud extends PlaceholderCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(target instanceof CommandECloudToggle) && !plugin.getPlaceholderAPIConfig()
|
if (!plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
|
||||||
.isCloudEnabled()) {
|
Msg.msg(sender, "&cThe eCloud Manager is not enabled! To enable it, set 'cloud_enabled' to true and reload the plugin.");
|
||||||
Msg.msg(sender,
|
|
||||||
"&cThe eCloud Manager is not enabled!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of PlaceholderAPI
|
|
||||||
*
|
|
||||||
* PlaceholderAPI
|
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
|
||||||
*
|
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* PlaceholderAPI is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package me.clip.placeholderapi.commands.impl.cloud;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
|
||||||
import me.clip.placeholderapi.util.Msg;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
|
||||||
|
|
||||||
public final class CommandECloudToggle extends PlaceholderCommand {
|
|
||||||
|
|
||||||
public CommandECloudToggle() {
|
|
||||||
super("toggle", "enable", "disable");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
|
||||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
|
||||||
@NotNull @Unmodifiable final List<String> params) {
|
|
||||||
final boolean desiredState;
|
|
||||||
final boolean currentState = plugin.getPlaceholderAPIConfig().isCloudEnabled();
|
|
||||||
|
|
||||||
switch (alias.toLowerCase(Locale.ROOT)) {
|
|
||||||
case "enable":
|
|
||||||
desiredState = true;
|
|
||||||
break;
|
|
||||||
case "disable":
|
|
||||||
desiredState = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
desiredState = !currentState;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desiredState == currentState) {
|
|
||||||
Msg.msg(sender, "&7The eCloud Manager is already " + (desiredState ? "enabled" : "disabled"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.getPlaceholderAPIConfig().setCloudEnabled(desiredState);
|
|
||||||
|
|
||||||
if (desiredState) {
|
|
||||||
plugin.getCloudExpansionManager().load();
|
|
||||||
} else {
|
|
||||||
plugin.getCloudExpansionManager().kill();
|
|
||||||
}
|
|
||||||
|
|
||||||
Msg.msg(sender, "&aThe eCloud Manager has been " + (desiredState ? "enabled" : "disabled"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -30,7 +30,6 @@ import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
|||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -123,13 +122,9 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (broadcast) {
|
if (broadcast) {
|
||||||
Msg.broadcast(message);
|
Bukkit.broadcastMessage(message);
|
||||||
} else {
|
} else {
|
||||||
if (!(sender instanceof Player)) {
|
sender.sendMessage(message);
|
||||||
Msg.msg(sender, message);
|
|
||||||
} else {
|
|
||||||
((Player) sender).spigot().sendMessage(TextComponent.fromLegacyText(message));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +151,8 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
final String message = PlaceholderAPI
|
final String message = PlaceholderAPI
|
||||||
.setRelationalPlaceholders(((Player) targetOne), ((Player) targetTwo),
|
.setRelationalPlaceholders(((Player) targetOne), ((Player) targetTwo),
|
||||||
String.join(" ", params.subList(2, params.size())));
|
String.join(" ", params.subList(2, params.size())));
|
||||||
Msg.msg(sender, message);
|
|
||||||
|
sender.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,7 +44,9 @@ public enum NMSVersion {
|
|||||||
SPIGOT_1_16_R3("v1_16_R3"),
|
SPIGOT_1_16_R3("v1_16_R3"),
|
||||||
SPIGOT_1_17_R1("v1_17_R1"),
|
SPIGOT_1_17_R1("v1_17_R1"),
|
||||||
SPIGOT_1_18_R1("v1_18_R1"),
|
SPIGOT_1_18_R1("v1_18_R1"),
|
||||||
SPIGOT_1_19("v1_19_R1");
|
SPIGOT_1_19_R1("v1_19_R1"),
|
||||||
|
SPIGOT_1_19_R2("v1_19_R2"),
|
||||||
|
SPIGOT_1_19_R3("v1_19_R3");
|
||||||
|
|
||||||
private final String version;
|
private final String version;
|
||||||
|
|
||||||
|
@@ -53,6 +53,7 @@ import java.util.stream.Collectors;
|
|||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
@@ -202,13 +203,7 @@ public final class CloudExpansionManager {
|
|||||||
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop thru what's left on the main thread
|
//todo: Figure out why this was being scheduled back on the main thread
|
||||||
plugin
|
|
||||||
.getServer()
|
|
||||||
.getScheduler()
|
|
||||||
.runTask(
|
|
||||||
plugin,
|
|
||||||
() -> {
|
|
||||||
try {
|
try {
|
||||||
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
@@ -236,7 +231,6 @@ public final class CloudExpansionManager {
|
|||||||
.log(Level.WARNING, "Failed to download expansion information", e);
|
.log(Level.WARNING, "Failed to download expansion information", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDownloading(@NotNull final CloudExpansion expansion) {
|
public boolean isDownloading(@NotNull final CloudExpansion expansion) {
|
||||||
@@ -268,8 +262,7 @@ public final class CloudExpansionManager {
|
|||||||
await.remove(toIndexName(expansion));
|
await.remove(toIndexName(expansion));
|
||||||
|
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
plugin.getLogger().log(Level.SEVERE,
|
Msg.severe("Failed to download %s:%s", exception, expansion.getName(), expansion.getVersion());
|
||||||
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
|
|
||||||
}
|
}
|
||||||
}, ASYNC_EXECUTOR);
|
}, ASYNC_EXECUTOR);
|
||||||
|
|
||||||
|
@@ -217,6 +217,12 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (expansions.containsKey(identifier)) {
|
||||||
|
Msg.warn("Failed to load expansion %s. Identifier is already in use.",
|
||||||
|
expansion.getIdentifier());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (expansion instanceof Configurable) {
|
if (expansion instanceof Configurable) {
|
||||||
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
||||||
String pre = "expansions." + identifier + ".";
|
String pre = "expansions." + identifier + ".";
|
||||||
@@ -263,12 +269,13 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ExpansionRegisterEvent event = new ExpansionRegisterEvent(expansion);
|
// this is temp
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
// final ExpansionRegisterEvent event = new ExpansionRegisterEvent(expansion);
|
||||||
|
// Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
//
|
||||||
return false;
|
// if (event.isCancelled()) {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
expansionsLock.lock();
|
expansionsLock.lock();
|
||||||
try {
|
try {
|
||||||
@@ -420,12 +427,11 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return expansionClass;
|
return expansionClass;
|
||||||
} catch (final VerifyError ex) {
|
} catch (VerifyError | NoClassDefFoundError e) {
|
||||||
Msg.severe("Failed to load expansion class %s (is a dependency missing?", file.getName() + ')');
|
Msg.severe("Failed to load expansion %s (is a dependency missing?)", e, file.getName());
|
||||||
Msg.severe("Cause: %s %s", ex.getClass().getSimpleName(), ex.getMessage());
|
|
||||||
return null;
|
return null;
|
||||||
} catch (final Exception ex) {
|
} catch (Exception e) {
|
||||||
throw new CompletionException(ex);
|
throw new CompletionException(e.getMessage() + " (expansion file: " + file.getAbsolutePath() + ")", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import java.io.BufferedReader;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
@@ -54,8 +55,10 @@ public class UpdateChecker implements Listener {
|
|||||||
return spigotVersion;
|
return spigotVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo: Figure out a better approach for this?
|
||||||
public void fetch() {
|
public void fetch() {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
CompletableFuture<Boolean> update = new CompletableFuture<>();
|
||||||
|
CompletableFuture.supplyAsync(() -> {
|
||||||
try {
|
try {
|
||||||
HttpsURLConnection con = (HttpsURLConnection) new URL(
|
HttpsURLConnection con = (HttpsURLConnection) new URL(
|
||||||
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
|
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
|
||||||
@@ -63,26 +66,32 @@ public class UpdateChecker implements Listener {
|
|||||||
spigotVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
spigotVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
plugin.getLogger().info("Failed to check for updates on spigot.");
|
plugin.getLogger().info("Failed to check for updates on spigot.");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spigotVersion == null || spigotVersion.isEmpty()) {
|
if (spigotVersion == null || spigotVersion.isEmpty()) {
|
||||||
return;
|
plugin.getLogger().info("Failed to check for updates on spigot.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAvailable = spigotIsNewer();
|
updateAvailable = spigotIsNewer();
|
||||||
|
|
||||||
if (!updateAvailable) {
|
if (!updateAvailable) {
|
||||||
return;
|
plugin.getLogger().info("PlaceholderAPI is up to date.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
update.whenComplete((result, error) -> {
|
||||||
|
if (result) {
|
||||||
plugin.getLogger()
|
plugin.getLogger()
|
||||||
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
|
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
|
||||||
plugin.getLogger()
|
plugin.getLogger()
|
||||||
.info("https://www.spigotmc.org/resources/placeholderapi." + RESOURCE_ID + "/");
|
.info("https://www.spigotmc.org/resources/placeholderapi." + RESOURCE_ID + "/");
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
Bukkit.getPluginManager().registerEvents(UpdateChecker.this, plugin);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,11 +40,7 @@ public final class Futures {
|
|||||||
@NotNull final CompletableFuture<T> future,
|
@NotNull final CompletableFuture<T> future,
|
||||||
@NotNull final BiConsumer<T, Throwable> consumer) {
|
@NotNull final BiConsumer<T, Throwable> consumer) {
|
||||||
future.whenComplete((value, exception) -> {
|
future.whenComplete((value, exception) -> {
|
||||||
if (Bukkit.isPrimaryThread()) {
|
|
||||||
consumer.accept(value, exception);
|
consumer.accept(value, exception);
|
||||||
} else {
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
name: "@name@"
|
name: PlaceholderAPI
|
||||||
main: "me.clip.placeholderapi.PlaceholderAPIPlugin"
|
main: "me.clip.placeholderapi.PlaceholderAPIPlugin"
|
||||||
|
|
||||||
version: "@version@"
|
version: ${version}
|
||||||
author: HelpChat
|
author: HelpChat
|
||||||
|
|
||||||
|
folia-supported: true
|
||||||
|
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
description: "@description@"
|
description: "An awesome placeholder provider!"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
placeholderapi:
|
placeholderapi:
|
||||||
|
Reference in New Issue
Block a user