diff --git a/.github/label-commenter-config.yml b/.github/label-commenter-config.yml index 0af07f2..b047b6f 100644 --- a/.github/label-commenter-config.yml +++ b/.github/label-commenter-config.yml @@ -16,6 +16,7 @@ labels: This issue-tracker is reserved for Bug reports and feature requests towards PlaceholderAPI. Please report this issue to the Expansion's main issue-tracker. + A list of known Expansion repositories and their issue trackers can be found [here](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/510#discussion-63812). action: close - name: 'Type: Duplicate' labeled: @@ -63,6 +64,18 @@ labels: It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive faster response compared to the issue tracker here. Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions). action: close + pull_request: + body: |- + Your Pull Request has been marked as invalid. + This means that it doesn't follow our [Contributing Guidelines](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md). + + Here is a small summary of what you should know: + + - Pull requests for PlaceholderAPI should target the `develop` branch. + - Pull requests for the Wiki should target the `docs/wiki` branch. + + Don't hesitate to ask us any questions. + action: close - name: 'Target: Wiki' labeled: issue: @@ -74,7 +87,7 @@ labels: When doing so, make sure you follow these steps: - The Pull request targets the [`docs/wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki) branch of the Repository. - - You only made changes to the files inside the `wiki` folder. + - You only made changes to the files inside the [`wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki/wiki) folder. - You followed the general Styling Guidelines mentioned in the wiki's [README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md) file. If you have any questions about submitting a PR for the wiki or have any other questions don't hesitate to ask us about it. @@ -96,10 +109,11 @@ labels: labeled: issue: body: |- - The issue was marked as "inactive" which means it didn't recieve any responses from the Author ({{ issue.user.login }}) for a long period of time. - To keep the issue-tracker clean and up to date are we closing issues, that didn't receive any responses for a long time. + The issue has been marked as **inactive** which means it didn't recieve any responses from the Author ({{ issue.user.login }}) for a long period of time. + To keep the issue-tracker clean and up to date do we close issues that haven't received any responses for a long time. - If you're the Author and this issue is still present, make sure to respond with extra info and **do not create a new issue for the same problem!** + If you're the Author of this issue and the reported problem is still present, make sure to respond with additional info to this issue. + **Do not create a new issue for the same problem!** action: close unlabeled: issue: @@ -117,5 +131,5 @@ labels: Remember to first read the [READ ME](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/507) post to not face any issues. - For questions do we recommend to use the [Q&A Category](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions?discussions_q=category%3AQ%26A). + For questions do we recommend to use the [(2) Support](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/categories/-2-support) category. You can also use the Discussion to submit Feature requests (Feature requests through issues are still accepted tho). diff --git a/build.gradle b/build.gradle index fcd2d75..41ba3ca 100644 --- a/build.gradle +++ b/build.gradle @@ -128,4 +128,4 @@ publishing { } } -publish.dependsOn clean, test, jar \ No newline at end of file +publish.dependsOn clean, test, jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a0edc83..c78a2b9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Tue Jul 14 23:27:02 AWST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java b/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java index 5231ebf..3bd8bc2 100644 --- a/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java +++ b/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java @@ -211,13 +211,16 @@ public final class CommandParse extends PlaceholderCommand { @Nullable private OfflinePlayer resolvePlayer(@NotNull final String name) { - OfflinePlayer target = Bukkit.getPlayer(name); - + OfflinePlayer target = Bukkit.getPlayerExact(name); + if (target == null) { - target = Bukkit.getOfflinePlayer(name); // this is probably not a great idea. + // Not the best option, but Spigot doesn't offer a good replacement (as usual) + target = Bukkit.getOfflinePlayer(name); + + return target.hasPlayedBefore() ? target : null; } - return target.hasPlayedBefore() ? target : null; + return target; } diff --git a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java index 6ec3153..2557ae2 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java +++ b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java @@ -22,27 +22,11 @@ package me.clip.placeholderapi.expansion.manager; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; -import java.io.File; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.ReentrantLock; -import java.util.logging.Level; import me.clip.placeholderapi.PlaceholderAPIPlugin; import me.clip.placeholderapi.events.ExpansionRegisterEvent; import me.clip.placeholderapi.events.ExpansionUnregisterEvent; import me.clip.placeholderapi.events.ExpansionsLoadedEvent; -import me.clip.placeholderapi.expansion.Cacheable; -import me.clip.placeholderapi.expansion.Cleanable; -import me.clip.placeholderapi.expansion.Configurable; -import me.clip.placeholderapi.expansion.PlaceholderExpansion; -import me.clip.placeholderapi.expansion.Taskable; -import me.clip.placeholderapi.expansion.VersionSpecific; +import me.clip.placeholderapi.expansion.*; import me.clip.placeholderapi.expansion.cloud.CloudExpansion; import me.clip.placeholderapi.util.FileUtil; import me.clip.placeholderapi.util.Futures; @@ -61,6 +45,14 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; +import java.io.File; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; +import java.util.logging.Level; + public final class LocalExpansionManager implements Listener { @NotNull @@ -167,9 +159,9 @@ public final class LocalExpansionManager implements Listener { return Optional.of(expansion); } catch (final LinkageError ex) { - plugin.getLogger().severe("expansion class " + clazz.getSimpleName() + " is outdated: \n" + - "Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use " + ex - .getMessage()); + plugin.getLogger().severe("Failed to load Expansion class " + clazz.getSimpleName() + + " (Is a dependency missing?)"); + plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage()); } return Optional.empty(); @@ -218,9 +210,8 @@ public final class LocalExpansionManager implements Listener { if (expansion instanceof VersionSpecific) { VersionSpecific nms = (VersionSpecific) expansion; if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) { - plugin.getLogger().info( - "Your server version is not compatible with expansion: " + expansion.getIdentifier() - + " version: " + expansion.getVersion()); + plugin.getLogger().warning("Your server version is not compatible with expansion " + + expansion.getIdentifier() + " " + expansion.getVersion()); return false; } } @@ -309,7 +300,10 @@ public final class LocalExpansionManager implements Listener { return; } - final long registered = classes.stream().map(this::register).filter(Optional::isPresent) + final long registered = classes.stream() + .filter(Objects::nonNull) + .map(this::register) + .filter(Optional::isPresent) .count(); Msg.msg(sender, @@ -330,9 +324,8 @@ public final class LocalExpansionManager implements Listener { } } - @NotNull - public CompletableFuture<@NotNull List<@NotNull Class>> findExpansionsOnDisk() { + public CompletableFuture<@NotNull List<@Nullable Class>> findExpansionsOnDisk() { return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar"))) .map(this::findExpansionInFile) .collect(Futures.collector()); @@ -343,11 +336,18 @@ public final class LocalExpansionManager implements Listener { @NotNull final File file) { return CompletableFuture.supplyAsync(() -> { try { - return FileUtil.findClass(file, PlaceholderExpansion.class); + final Class expansionClass = FileUtil.findClass(file, PlaceholderExpansion.class); + + if (expansionClass == null) { + plugin.getLogger().severe("Failed to load Expansion: " + file.getName() + ", as it does not have" + + " a class which extends PlaceholderExpansion."); + } + + return expansionClass; } catch (final VerifyError ex) { - plugin.getLogger().severe("expansion file " + file.getName() + " is outdated: \n" + - "Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use" + ex - .getMessage().substring(ex.getMessage().lastIndexOf(' '))); + plugin.getLogger().severe("Failed to load Expansion class " + file.getName() + + " (Is a dependency missing?)"); + plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage()); return null; } catch (final Exception ex) { throw new CompletionException(ex); @@ -365,10 +365,9 @@ public final class LocalExpansionManager implements Listener { if (ex.getCause() instanceof LinkageError) { throw ((LinkageError) ex.getCause()); } - - plugin.getLogger() - .log(Level.SEVERE, "Failed to load placeholder expansion from class: " + clazz.getName(), - ex); + + plugin.getLogger().warning("There was an issue with loading an expansion"); + return null; } } diff --git a/src/main/java/me/clip/placeholderapi/util/FileUtil.java b/src/main/java/me/clip/placeholderapi/util/FileUtil.java index 9741a0d..7e20de1 100644 --- a/src/main/java/me/clip/placeholderapi/util/FileUtil.java +++ b/src/main/java/me/clip/placeholderapi/util/FileUtil.java @@ -20,6 +20,9 @@ package me.clip.placeholderapi.util; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.io.File; import java.io.IOException; import java.net.URL; @@ -28,8 +31,6 @@ import java.util.ArrayList; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class FileUtil { @@ -51,7 +52,7 @@ public class FileUtil { JarEntry entry; while ((entry = stream.getNextJarEntry()) != null) { final String name = entry.getName(); - if (name == null || name.isEmpty() || !name.endsWith(".class")) { + if (name.isEmpty() || !name.endsWith(".class")) { continue; } diff --git a/wiki/Placeholders.md b/wiki/Placeholders.md index b28a80c..fd1659e 100644 --- a/wiki/Placeholders.md +++ b/wiki/Placeholders.md @@ -3107,8 +3107,12 @@ Check [Plan Wiki](https://github.com/plan-player-analytics/Plan/wiki/Placeholder %premiumvanish_isvanished% %premiumvanish_vanishedplayers% %premiumvanish_playercount% +%premiumvanish_playercountwithoutshowintab% %premiumvanish_bungeeplayercount% %premiumvanish_bungeeplayercount@% +%premiumvanish_target% +%premiumvanish_uselevel% +%premiumvanish_seelevel% ``` `` is the name of the server it should show the playercount of.