mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-23 18:42:44 +00:00
Return nice list with /papijsp list
This commit is contained in:
parent
385dcc9af3
commit
49fdcd1016
@ -77,7 +77,7 @@ public class JavascriptExpansion extends PlaceholderExpansion implements Cacheab
|
|||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
// default command
|
// default command
|
||||||
if (msg.indexOf(" ") == -1) {
|
if (!msg.contains(" ")) {
|
||||||
Msg.msg(p, "&7Javascript expansion v: &f" + getVersion());
|
Msg.msg(p, "&7Javascript expansion v: &f" + getVersion());
|
||||||
Msg.msg(p, "&7Created by: &f" + getAuthor());
|
Msg.msg(p, "&7Created by: &f" + getAuthor());
|
||||||
Msg.msg(p, "&fWiki: &ahttps://github.com/PlaceholderAPI-Expansions/Javascript-Expansion/wiki");
|
Msg.msg(p, "&fWiki: &ahttps://github.com/PlaceholderAPI-Expansions/Javascript-Expansion/wiki");
|
||||||
@ -97,7 +97,7 @@ public class JavascriptExpansion extends PlaceholderExpansion implements Cacheab
|
|||||||
if (msg.equals("/papijsp list")) {
|
if (msg.equals("/papijsp list")) {
|
||||||
List<String> loaded = this.getLoadedIdentifiers();
|
List<String> loaded = this.getLoadedIdentifiers();
|
||||||
Msg.msg(p, loaded.size() + " &7script" + (loaded.size() == 1 ? "" : "s")+ " loaded");
|
Msg.msg(p, loaded.size() + " &7script" + (loaded.size() == 1 ? "" : "s")+ " loaded");
|
||||||
Msg.msg(p, loaded.toString());
|
Msg.msg(p, String.join(", ", loaded));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ public class JavascriptExpansion extends PlaceholderExpansion implements Cacheab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
scripts.stream().forEach(s -> {
|
scripts.forEach(s -> {
|
||||||
s.saveData();
|
s.saveData();
|
||||||
s.cleanup();
|
s.cleanup();
|
||||||
});
|
});
|
||||||
@ -164,7 +164,7 @@ public class JavascriptExpansion extends PlaceholderExpansion implements Cacheab
|
|||||||
for (JavascriptPlaceholder script : scripts) {
|
for (JavascriptPlaceholder script : scripts) {
|
||||||
if (identifier.startsWith(script.getIdentifier() + "_")) {
|
if (identifier.startsWith(script.getIdentifier() + "_")) {
|
||||||
identifier = identifier.replace(script.getIdentifier() + "_", "");
|
identifier = identifier.replace(script.getIdentifier() + "_", "");
|
||||||
return identifier.indexOf(",") == -1 ? script.evaluate(p, identifier) : script.evaluate(p, identifier.split(","));
|
return !identifier.contains(",") ? script.evaluate(p, identifier) : script.evaluate(p, identifier.split(","));
|
||||||
} else if (identifier.equalsIgnoreCase(script.getIdentifier())) {
|
} else if (identifier.equalsIgnoreCase(script.getIdentifier())) {
|
||||||
return script.evaluate(p);
|
return script.evaluate(p);
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ public class JavascriptExpansion extends PlaceholderExpansion implements Cacheab
|
|||||||
|
|
||||||
public List<String> getLoadedIdentifiers() {
|
public List<String> getLoadedIdentifiers() {
|
||||||
List<String> l = new ArrayList<>();
|
List<String> l = new ArrayList<>();
|
||||||
scripts.stream().forEach(s -> {
|
scripts.forEach(s -> {
|
||||||
l.add(s.getIdentifier());
|
l.add(s.getIdentifier());
|
||||||
});
|
});
|
||||||
return l;
|
return l;
|
||||||
@ -222,7 +222,7 @@ public class JavascriptExpansion extends PlaceholderExpansion implements Cacheab
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int reloadScripts() {
|
private int reloadScripts() {
|
||||||
scripts.stream().forEach(s -> {
|
scripts.forEach(s -> {
|
||||||
s.saveData();
|
s.saveData();
|
||||||
s.cleanup();
|
s.cleanup();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user