mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2026-02-25 17:41:13 +01:00
Merge branch 'master' into master
This commit is contained in:
12
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
12
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -18,13 +18,13 @@ body:
|
|||||||
label: Confirmation
|
label: Confirmation
|
||||||
description: Please make sure to have followed the following checks.
|
description: Please make sure to have followed the following checks.
|
||||||
options:
|
options:
|
||||||
- label: My issue isn't already found on the Issue tracker.
|
- label: "My issue isn't already found on the Issue tracker."
|
||||||
required: true
|
required: true
|
||||||
- label: My issue is about **PlaceholderAPI** and not any expansion or external plugin
|
- label: "My issue is about **PlaceholderAPI** and not any expansion or external plugin."
|
||||||
required: true
|
required: true
|
||||||
- label: The issue isn't already fixed in a Spigot Release or Development Build.
|
- label: "The issue isn't already fixed in a Spigot Release or Development Build."
|
||||||
required: true
|
required: true
|
||||||
- label: The [Common Issues](https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Common-Issues) page doesn't mention this issue.
|
- label: "The [Common Issues](https://wiki.placeholderapi.com/common-issues/) page doesn't mention this issue."
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
@@ -85,6 +85,8 @@ body:
|
|||||||
description: |-
|
description: |-
|
||||||
Get the latest content of your `latest.log` file an upload it to https://paste.helpch.at
|
Get the latest content of your `latest.log` file an upload it to https://paste.helpch.at
|
||||||
Take the generated URL and paste it into this field.
|
Take the generated URL and paste it into this field.
|
||||||
|
|
||||||
|
**Always provide the full `latest.log` and not just parts of it or just the error (if any)!**
|
||||||
placeholder: "https://paste.helpch.at/latest.log"
|
placeholder: "https://paste.helpch.at/latest.log"
|
||||||
- type: input
|
- type: input
|
||||||
id: "error"
|
id: "error"
|
||||||
@@ -99,5 +101,5 @@ body:
|
|||||||
description: |-
|
description: |-
|
||||||
Add any extra info you think is nessesary for this Bug report.
|
Add any extra info you think is nessesary for this Bug report.
|
||||||
- If you selected `API Bug` will you need to include code-examples here to reproduce the issue.
|
- If you selected `API Bug` will you need to include code-examples here to reproduce the issue.
|
||||||
- If you selected `Plugin/Server Incompatability` should you include extra Server info such as a Timings or Spark-Report or info about the plugin in question.
|
- If you selected `Plugin/Server Incompatability` should you include extra Server info such as Spark-Report or info about the plugin in question.
|
||||||
placeholder: "Put any extra info you like into this field..."
|
placeholder: "Put any extra info you like into this field..."
|
||||||
|
|||||||
55
.github/workflows/pr_wiki_validation.yml
vendored
Normal file
55
.github/workflows/pr_wiki_validation.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# Validates Pull requests targeting the wiki branch
|
||||||
|
# to ensure that the site can be build successfully
|
||||||
|
# without broken links, navigation, etc.
|
||||||
|
#
|
||||||
|
name: "Validate Wiki Build"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
paths-ignore:
|
||||||
|
- "README.md"
|
||||||
|
branches:
|
||||||
|
- wiki
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildWiki:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout Repository"
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: "${{ github.event.pull_request.head.sha }}"
|
||||||
|
- name: "Setup Python 3.x"
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- name: "Install dependencies"
|
||||||
|
run: "python -m pip install mkdocs-material"
|
||||||
|
- name: "Build Site"
|
||||||
|
run: "mkdocs build --strict"
|
||||||
|
- name: "Create Comment"
|
||||||
|
uses: peter-evans/create-or-update-comment@v5
|
||||||
|
if: ${{ failure() }}
|
||||||
|
with:
|
||||||
|
body: |-
|
||||||
|
## Wiki Build failure
|
||||||
|
|
||||||
|
Something went wrong while creating a test-build of the Wiki for this Pull request.
|
||||||
|
Please check the [Workflow Logs](${{ env.RUN_URL }}) for any errors.
|
||||||
|
issue-number: "${{ github.event.pull_request.number }}"
|
||||||
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
edit-mode: replace
|
||||||
@@ -9,7 +9,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "me.clip"
|
group = "me.clip"
|
||||||
version = "2.12.2-DEV-${System.getProperty("BUILD_NUMBER")}"
|
version = "2.12.3-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||||
|
|
||||||
description = "An awesome placeholder provider!"
|
description = "An awesome placeholder provider!"
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package me.clip.placeholderapi.replacer;
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ import java.net.URL;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.scheduler.scheduling.schedulers.TaskScheduler;
|
import me.clip.placeholderapi.scheduler.scheduling.schedulers.TaskScheduler;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
@@ -66,7 +66,7 @@ public class UpdateChecker implements Listener {
|
|||||||
try {
|
try {
|
||||||
HttpsURLConnection con = (HttpsURLConnection) new URL(MODRINTH_URL).openConnection();
|
HttpsURLConnection con = (HttpsURLConnection) new URL(MODRINTH_URL).openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
final JsonElement json = JsonParser.parseReader(new BufferedReader(new InputStreamReader(con.getInputStream())));
|
final JsonElement json = new Gson().fromJson(new BufferedReader(new InputStreamReader(con.getInputStream())), JsonElement.class);
|
||||||
modrinthVersion = json.getAsJsonArray().get(0).getAsJsonObject().get("version_number").getAsString();
|
modrinthVersion = json.getAsJsonArray().get(0).getAsJsonObject().get("version_number").getAsString();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
plugin.getLogger().info("Failed to check for updates on modrinth.");
|
plugin.getLogger().info("Failed to check for updates on modrinth.");
|
||||||
|
|||||||
@@ -55,9 +55,18 @@ public final class ExpansionSafetyCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> maliciousPaths = new HashSet<>();
|
final Set<String> maliciousPaths = new HashSet<>();
|
||||||
|
final File[] files = expansionsFolder.listFiles();
|
||||||
|
|
||||||
for (File file : expansionsFolder.listFiles()) {
|
if (files == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (File file : files) {
|
||||||
try {
|
try {
|
||||||
|
if (!file.isFile()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final String hash = Hashing.sha256().hashBytes(Files.asByteSource(file).read()).toString();
|
final String hash = Hashing.sha256().hashBytes(Files.asByteSource(file).read()).toString();
|
||||||
|
|
||||||
if (knownMaliciousExpansions.contains(hash)) {
|
if (knownMaliciousExpansions.contains(hash)) {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
public interface Values {
|
public interface Values {
|
||||||
|
|
||||||
|
String NO_ARGUMENTS_PLACEHOLDER = "%player%";
|
||||||
|
String EMPTY_ARGUMENT_PLACEHOLDER = "%player_%";
|
||||||
String SMALL_TEXT = "My name is %player_name%";
|
String SMALL_TEXT = "My name is %player_name%";
|
||||||
String LARGE_TEXT = "My name is %player_name% and my location is (%player_x%, %player_y%, %player_z%), this placeholder is invalid %server_name%";
|
String LARGE_TEXT = "My name is %player_name% and my location is (%player_x%, %player_y%, %player_z%), this placeholder is invalid %server_name%";
|
||||||
|
|
||||||
@@ -43,6 +45,7 @@ public interface Values {
|
|||||||
|
|
||||||
final class MockPlayerPlaceholderExpansion extends PlaceholderExpansion {
|
final class MockPlayerPlaceholderExpansion extends PlaceholderExpansion {
|
||||||
|
|
||||||
|
public static final String EMPTY_ARGUMENT = "Empty Argument";
|
||||||
public static final String PLAYER_X = "10";
|
public static final String PLAYER_X = "10";
|
||||||
public static final String PLAYER_Y = "20";
|
public static final String PLAYER_Y = "20";
|
||||||
public static final String PLAYER_Z = "30";
|
public static final String PLAYER_Z = "30";
|
||||||
@@ -83,6 +86,8 @@ public interface Values {
|
|||||||
return PLAYER_Y;
|
return PLAYER_Y;
|
||||||
case "z":
|
case "z":
|
||||||
return PLAYER_Z;
|
return PLAYER_Z;
|
||||||
|
case "":
|
||||||
|
return EMPTY_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYE
|
|||||||
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYER_X;
|
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYER_X;
|
||||||
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYER_Y;
|
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYER_Y;
|
||||||
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYER_Z;
|
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.PLAYER_Z;
|
||||||
|
import static me.clip.placeholderapi.Values.MockPlayerPlaceholderExpansion.EMPTY_ARGUMENT;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import me.clip.placeholderapi.Values;
|
import me.clip.placeholderapi.Values;
|
||||||
@@ -37,6 +38,18 @@ public final class ReplacerUnitTester {
|
|||||||
Values.CHARS_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
|
Values.CHARS_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void charsReplacersDoesNotParsePlaceholdersWithNoArguments() {
|
||||||
|
assertEquals(Values.NO_ARGUMENTS_PLACEHOLDER,
|
||||||
|
Values.CHARS_REPLACER.apply(Values.NO_ARGUMENTS_PLACEHOLDER, null, Values.PLACEHOLDERS::get));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void charsReplacersParsesPlaceholdersWithOneArgumentThatIsEmpty() {
|
||||||
|
assertEquals(EMPTY_ARGUMENT,
|
||||||
|
Values.CHARS_REPLACER.apply(Values.EMPTY_ARGUMENT_PLACEHOLDER, null, Values.PLACEHOLDERS::get));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCharsReplacerProducesExpectedSentence() {
|
void testCharsReplacerProducesExpectedSentence() {
|
||||||
assertEquals(String.format(
|
assertEquals(String.format(
|
||||||
|
|||||||
Reference in New Issue
Block a user