mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 05:17:05 +02:00
Merge branch 'master' into master
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,18 +20,8 @@
|
||||
*/
|
||||
package me.clip.placeholderapi;
|
||||
|
||||
import static me.clip.placeholderapi.util.Msg.color;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
|
||||
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
@@ -42,6 +32,13 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static me.clip.placeholderapi.util.Msg.color;
|
||||
|
||||
public class PlaceholderAPI {
|
||||
|
||||
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("[%]([^%]+)[%]");
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,10 +20,6 @@
|
||||
*/
|
||||
package me.clip.placeholderapi;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import me.clip.placeholderapi.commands.PlaceholderAPICommands;
|
||||
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
|
||||
import me.clip.placeholderapi.expansion.ExpansionManager;
|
||||
@@ -39,6 +35,11 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* Yes I have a shit load of work to do...
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,9 +20,6 @@
|
||||
*/
|
||||
package me.clip.placeholderapi;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
||||
import me.clip.placeholderapi.expansion.Cacheable;
|
||||
import me.clip.placeholderapi.expansion.Cleanable;
|
||||
@@ -37,6 +34,10 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class PlaceholderListener implements Listener {
|
||||
|
||||
|
@@ -1,12 +1,32 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is 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.
|
||||
*
|
||||
* This program 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;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.ServerLoadEvent;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ServerLoadEventListener implements Listener {
|
||||
|
||||
private final PlaceholderAPIPlugin plugin;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -337,7 +337,8 @@ public class ExpansionCloudCommands implements CommandExecutor {
|
||||
}
|
||||
|
||||
List<String> ce = expansions.keySet().stream().sorted().collect(Collectors.toList());
|
||||
int i = (int) ex.keySet().toArray()[0]+1;
|
||||
|
||||
int i = (int) ex.keySet().toArray()[0];
|
||||
|
||||
for (String name : ce) {
|
||||
if (expansions.get(name) == null) {
|
||||
@@ -369,7 +370,8 @@ public class ExpansionCloudCommands implements CommandExecutor {
|
||||
}
|
||||
|
||||
List<String> ce = expansions.keySet().stream().sorted().collect(Collectors.toList());
|
||||
int i = 1;
|
||||
|
||||
int i = page > 1 ? page * 10 : 0;
|
||||
|
||||
for (String name : ce) {
|
||||
if (expansions.get(name) == null) {
|
||||
@@ -402,7 +404,7 @@ public class ExpansionCloudCommands implements CommandExecutor {
|
||||
JSONMessage line = JSONMessage.create(msg);
|
||||
line.tooltip(hover);
|
||||
|
||||
if (expansion.shouldUpdate()) {
|
||||
if (expansion.shouldUpdate() || !expansion.hasExpansion()) {
|
||||
line.suggestCommand("/papi ecloud download " + expansion.getName());
|
||||
} else {
|
||||
line.suggestCommand("/papi ecloud info " + expansion.getName());
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,8 +20,6 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.commands;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
@@ -34,6 +32,9 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PlaceholderAPICommands implements CommandExecutor {
|
||||
|
||||
private final PlaceholderAPIPlugin plugin;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.expansion;
|
||||
|
||||
import java.util.List;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.PlaceholderHook;
|
||||
@@ -28,6 +27,8 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,10 +20,11 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.expansion.cloud;
|
||||
|
||||
import me.clip.placeholderapi.util.TimeUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import me.clip.placeholderapi.util.TimeUtil;
|
||||
|
||||
|
||||
public class CloudExpansion {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,19 +21,6 @@
|
||||
package me.clip.placeholderapi.expansion.cloud;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
@@ -42,6 +29,13 @@ import me.clip.placeholderapi.util.Msg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class ExpansionCloudManager {
|
||||
|
||||
private static final String API_URL = "http://api.extendedclip.com/v2/";
|
||||
@@ -308,6 +302,7 @@ public class ExpansionCloudManager {
|
||||
|
||||
if (p != null) {
|
||||
Msg.msg(p, "&aExpansion &f" + ex.getName() + " &adownload complete!");
|
||||
Msg.msg(p, "&aMake sure to run &f/papi reload &ato enable it!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,9 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is 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.
|
||||
*
|
||||
* This program 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.updatechecker;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -12,6 +28,11 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
|
||||
public class UpdateChecker implements Listener {
|
||||
|
||||
private final int RESOURCE_ID = 6245;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,6 +20,8 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.util;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.net.URL;
|
||||
@@ -28,7 +30,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarInputStream;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
|
||||
public class FileUtil {
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,11 +20,12 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Msg {
|
||||
|
||||
public static void msg(CommandSender s, String... msg) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (C) 2018 Ryan McCarthy
|
||||
* Copyright (C) 2019 Ryan McCarthy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
Reference in New Issue
Block a user