Merge pull request #539 from LeonMangler/patch-1

Update PremiumVanish placeholders
This commit is contained in:
Andre_601 2021-01-18 22:25:42 +01:00 committed by GitHub
commit 5ab2c05821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 48 deletions

View File

@ -16,6 +16,7 @@ labels:
This issue-tracker is reserved for Bug reports and feature requests towards PlaceholderAPI. This issue-tracker is reserved for Bug reports and feature requests towards PlaceholderAPI.
Please report this issue to the Expansion's main issue-tracker. 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 action: close
- name: 'Type: Duplicate' - name: 'Type: Duplicate'
labeled: 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. 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). Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
action: close 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' - name: 'Target: Wiki'
labeled: labeled:
issue: issue:
@ -74,7 +87,7 @@ labels:
When doing so, make sure you follow these steps: 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. - 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. - 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. 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: labeled:
issue: issue:
body: |- 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. 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 are we closing issues, that didn't receive any responses for a long 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 action: close
unlabeled: unlabeled:
issue: 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. 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). You can also use the Discussion to submit Feature requests (Feature requests through issues are still accepted tho).

View File

@ -1,5 +1,5 @@
#Tue Jul 14 23:27:02 AWST 2020 #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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -211,13 +211,16 @@ public final class CommandParse extends PlaceholderCommand {
@Nullable @Nullable
private OfflinePlayer resolvePlayer(@NotNull final String name) { private OfflinePlayer resolvePlayer(@NotNull final String name) {
OfflinePlayer target = Bukkit.getPlayer(name); OfflinePlayer target = Bukkit.getPlayerExact(name);
if (target == null) { 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;
} }

View File

@ -22,27 +22,11 @@ package me.clip.placeholderapi.expansion.manager;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; 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.PlaceholderAPIPlugin;
import me.clip.placeholderapi.events.ExpansionRegisterEvent; import me.clip.placeholderapi.events.ExpansionRegisterEvent;
import me.clip.placeholderapi.events.ExpansionUnregisterEvent; import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
import me.clip.placeholderapi.events.ExpansionsLoadedEvent; import me.clip.placeholderapi.events.ExpansionsLoadedEvent;
import me.clip.placeholderapi.expansion.Cacheable; import me.clip.placeholderapi.expansion.*;
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.cloud.CloudExpansion; import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
import me.clip.placeholderapi.util.FileUtil; import me.clip.placeholderapi.util.FileUtil;
import me.clip.placeholderapi.util.Futures; import me.clip.placeholderapi.util.Futures;
@ -61,6 +45,14 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable; 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 { public final class LocalExpansionManager implements Listener {
@NotNull @NotNull
@ -167,9 +159,9 @@ public final class LocalExpansionManager implements Listener {
return Optional.of(expansion); return Optional.of(expansion);
} catch (final LinkageError ex) { } catch (final LinkageError ex) {
plugin.getLogger().severe("expansion class " + clazz.getSimpleName() + " is outdated: \n" + plugin.getLogger().severe("Failed to load Expansion class " + clazz.getSimpleName() +
"Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use " + ex " (Is a dependency missing?)");
.getMessage()); plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage());
} }
return Optional.empty(); return Optional.empty();
@ -218,9 +210,8 @@ public final class LocalExpansionManager implements Listener {
if (expansion instanceof VersionSpecific) { if (expansion instanceof VersionSpecific) {
VersionSpecific nms = (VersionSpecific) expansion; VersionSpecific nms = (VersionSpecific) expansion;
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) { if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
plugin.getLogger().info( plugin.getLogger().warning("Your server version is not compatible with expansion " +
"Your server version is not compatible with expansion: " + expansion.getIdentifier() expansion.getIdentifier() + " " + expansion.getVersion());
+ " version: " + expansion.getVersion());
return false; return false;
} }
} }
@ -309,7 +300,10 @@ public final class LocalExpansionManager implements Listener {
return; 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(); .count();
Msg.msg(sender, Msg.msg(sender,
@ -330,9 +324,8 @@ public final class LocalExpansionManager implements Listener {
} }
} }
@NotNull @NotNull
public CompletableFuture<@NotNull List<@NotNull Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() { public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar"))) return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
.map(this::findExpansionInFile) .map(this::findExpansionInFile)
.collect(Futures.collector()); .collect(Futures.collector());
@ -343,11 +336,18 @@ public final class LocalExpansionManager implements Listener {
@NotNull final File file) { @NotNull final File file) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
try { try {
return FileUtil.findClass(file, PlaceholderExpansion.class); final Class<? extends PlaceholderExpansion> 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) { } catch (final VerifyError ex) {
plugin.getLogger().severe("expansion file " + file.getName() + " is outdated: \n" + plugin.getLogger().severe("Failed to load Expansion class " + file.getName() +
"Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use" + ex " (Is a dependency missing?)");
.getMessage().substring(ex.getMessage().lastIndexOf(' '))); plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage());
return null; return null;
} catch (final Exception ex) { } catch (final Exception ex) {
throw new CompletionException(ex); throw new CompletionException(ex);
@ -366,9 +366,8 @@ public final class LocalExpansionManager implements Listener {
throw ((LinkageError) ex.getCause()); throw ((LinkageError) ex.getCause());
} }
plugin.getLogger() plugin.getLogger().warning("There was an issue with loading an expansion");
.log(Level.SEVERE, "Failed to load placeholder expansion from class: " + clazz.getName(),
ex);
return null; return null;
} }
} }

View File

@ -20,6 +20,9 @@
package me.clip.placeholderapi.util; package me.clip.placeholderapi.util;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@ -28,8 +31,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarInputStream; import java.util.jar.JarInputStream;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class FileUtil { public class FileUtil {
@ -51,7 +52,7 @@ public class FileUtil {
JarEntry entry; JarEntry entry;
while ((entry = stream.getNextJarEntry()) != null) { while ((entry = stream.getNextJarEntry()) != null) {
final String name = entry.getName(); final String name = entry.getName();
if (name == null || name.isEmpty() || !name.endsWith(".class")) { if (name.isEmpty() || !name.endsWith(".class")) {
continue; continue;
} }

View File

@ -3107,8 +3107,12 @@ Check [Plan Wiki](https://github.com/plan-player-analytics/Plan/wiki/Placeholder
%premiumvanish_isvanished% %premiumvanish_isvanished%
%premiumvanish_vanishedplayers% %premiumvanish_vanishedplayers%
%premiumvanish_playercount% %premiumvanish_playercount%
%premiumvanish_playercountwithoutshowintab%
%premiumvanish_bungeeplayercount% %premiumvanish_bungeeplayercount%
%premiumvanish_bungeeplayercount@<server>% %premiumvanish_bungeeplayercount@<server>%
%premiumvanish_target%
%premiumvanish_uselevel%
%premiumvanish_seelevel%
``` ```
`<server>` is the name of the server it should show the playercount of. `<server>` is the name of the server it should show the playercount of.