12.2
- A new method has been added for Tab (tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap, Boolean onlinePlayer, String permForPlayer)). - The class net.t2code.lib.Spigot.Lib.player. NameHistory was added - Minor code changes
This commit is contained in:
parent
fb289bd66e
commit
d4f311493f
@ -16,4 +16,7 @@
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="16" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="jpab" />
|
||||
</component>
|
||||
</project>
|
6
pom.xml
6
pom.xml
@ -4,10 +4,12 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<version>12.2</version>
|
||||
<!-- <classifier>dev-#2</classifier> -->
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>12.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
|
||||
<name>T2CodeLib</name>
|
||||
|
||||
|
@ -10,6 +10,7 @@ public final class BMain extends Plugin {
|
||||
|
||||
public static Plugin plugin;
|
||||
public static String Version;
|
||||
private static String orgVersion;
|
||||
public static String Autor;
|
||||
|
||||
public static String Prefix = Util.getPrefix();
|
||||
@ -23,9 +24,12 @@ public final class BMain extends Plugin {
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
Version = plugin.getDescription().getVersion();
|
||||
orgVersion = plugin.getDescription().getVersion();
|
||||
Autor = plugin.getDescription().getAuthor();
|
||||
BLoad.onLoad(plugin, Prefix, Autor, Version, Spigot, Discord, SpigotID,BstatsID);
|
||||
BLoad.onLoad(plugin, Prefix, Autor, orgVersion, Spigot, Discord, SpigotID,BstatsID);
|
||||
String[] fv=orgVersion.split("_");
|
||||
plugin.getDescription().setVersion(fv[0]);
|
||||
Version = plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,25 +38,22 @@ public class Tab {
|
||||
}
|
||||
}
|
||||
|
||||
//public static void tab(List<String> matches,CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
//
|
||||
// for (String command : permMap.keySet()) {
|
||||
// if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
// matches.add(command);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap, Boolean onlinePlayer, String permForPlayer) {
|
||||
if (args.length == arg + 1) {
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
} else if (onlinePlayer != null && permForPlayer != null) {
|
||||
tab(matches, sender, arg, args, permForPlayer, onlinePlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
tab(matches, sender, arg, args, permMap, null, null);
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length == arg + 1) {
|
||||
if (args[argEquals].toLowerCase().equals(equalsValue)) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class HoverModule {
|
||||
|
@ -6,6 +6,7 @@ import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -46,16 +47,19 @@ public class T2CodeTemplate {
|
||||
}
|
||||
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
if (SelectLibConfig.t2cTestDevelopment) return long_;
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
if (!(Util.getSnapshot() && spigot.equals(Util.getSpigot()))){
|
||||
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all" +
|
||||
" bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//onLoadSeparateStroke(prefix);
|
||||
return long_;
|
||||
}
|
||||
@ -94,12 +98,14 @@ public class T2CodeTemplate {
|
||||
send.console(prefix + " §4Plugin successfully disabled.");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List<String> autor, String pluginVersion, String publicVersion, Boolean isPremium) {
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List<String> autor, String pluginVersion, String publicVersion,
|
||||
Boolean isPremium) {
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
if (sender instanceof Player) {
|
||||
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 ||
|
||||
MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) {
|
||||
send.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
TextComponent comp2 = new TextBuilder(prefix + " §2Version: §6" + pluginVersion)
|
||||
|
@ -18,54 +18,57 @@ public class send {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
public static void player( Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
HoverModule.module(msg,player);
|
||||
HoverModule.module(msg, player);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2) {
|
||||
public static void title( Player player, String msg, String msg2) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
if (msg2 == null || msg2.contains("[empty]")) return;
|
||||
player.sendTitle(msg, msg2);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2, int i, int i1, int i2) {
|
||||
public static void title( Player player, String msg, String msg2, int i, int i1, int i2) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
if (msg2 == null || msg2.contains("[empty]")) return;
|
||||
player.sendTitle(msg, msg2, i, i1, i2);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
public static void sender( CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
public static void debug( Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
public static void debug( Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
if (plugin.getConfig().getBoolean("Plugin.Debug")) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
if (plugin.getConfig().getBoolean("Plugin.Debug"))
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
return;
|
||||
}
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage)
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG-MSG: §6" + msg);
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
warning(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void info(Plugin plugin, String msg) {
|
||||
public static void info( Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.INFO, msg);
|
||||
}
|
||||
|
||||
public static void warning(Plugin plugin, String msg) {
|
||||
public static void warning( Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.WARNING, msg);
|
||||
}
|
||||
|
||||
public static void error(Plugin plugin, String msg) {
|
||||
public static void error( Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.SEVERE, msg);
|
||||
}
|
||||
}
|
||||
|
143
src/main/java/net/t2code/lib/Spigot/Lib/player/NameHistory.java
Normal file
143
src/main/java/net/t2code/lib/Spigot/Lib/player/NameHistory.java
Normal file
@ -0,0 +1,143 @@
|
||||
package net.t2code.lib.Spigot.Lib.player;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class NameHistory {
|
||||
public static class NameLookup {
|
||||
|
||||
/**
|
||||
* The URL from Mojang API that provides the JSON String in response.
|
||||
*/
|
||||
private static final String LOOKUP_URL = "https://api.mojang.com/user/profiles/%s/names";
|
||||
|
||||
/**
|
||||
* The URL from Mojang API to resolve the UUID of a player from their name.
|
||||
*/
|
||||
private static final String GET_UUID_URL = "https://api.mojang.com/users/profiles/minecraft/%s?t=0";
|
||||
private static final Gson JSON_PARSER = new Gson();
|
||||
|
||||
/**
|
||||
* <h1>NOTE: Avoid running this method <i>Synchronously</i> with the main thread!It blocks while attempting to get a response from Mojang servers!</h1>
|
||||
* @param player The UUID of the player to be looked up.
|
||||
* @return Returns an array of {@link PreviousPlayerNameEntry} objects, or null if the response couldn't be interpreted.
|
||||
* @throws IOException {@link #getPlayerPreviousNames(String)}
|
||||
*/
|
||||
public static PreviousPlayerNameEntry[] getPlayerPreviousNames(UUID player) throws IOException {
|
||||
return getPlayerPreviousNames(player.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>NOTE: Avoid running this method <i>Synchronously</i> with the main thread! It blocks while attempting to get a response from Mojang servers!</h1>
|
||||
* Alternative method accepting an 'OfflinePlayer' (and therefore 'Player') objects as parameter.
|
||||
* @param player The OfflinePlayer object to obtain the UUID from.
|
||||
* @return Returns an array of {@link PreviousPlayerNameEntry} objects, or null if the response couldn't be interpreted.
|
||||
* @throws IOException {@link #getPlayerPreviousNames(UUID)}
|
||||
*/
|
||||
public static PreviousPlayerNameEntry[] getPlayerPreviousNames(OfflinePlayer player) throws IOException {
|
||||
return getPlayerPreviousNames(player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>NOTE: Avoid running this method <i>Synchronously</i> with the main thread! It blocks while attempting to get a response from Mojang servers!</h1>
|
||||
* Alternative method accepting an {@link OfflinePlayer} (and therefore {@link Player}) objects as parameter.
|
||||
* @param uuid The UUID String to lookup
|
||||
* @return Returns an array of {@link PreviousPlayerNameEntry} objects, or null if the response couldn't be interpreted.
|
||||
* @throws IOException
|
||||
*/
|
||||
public static PreviousPlayerNameEntry[] getPlayerPreviousNames(String uuid) throws IOException {
|
||||
if (uuid == null || uuid.isEmpty())
|
||||
return null;
|
||||
String response = getRawJsonResponse(new URL(String.format(LOOKUP_URL, uuid)));
|
||||
PreviousPlayerNameEntry[] names = JSON_PARSER.fromJson(response, PreviousPlayerNameEntry[].class);
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you don't have the UUID of a player, this method will resolve it for you.<br>
|
||||
* The output of this method may be used directly with {@link #getPlayerPreviousNames(String)}.<br>
|
||||
* <b>NOTE: as with the rest, this method opens a connection with a remote server, so running it synchronously will block the main thread which will lead to server lag.</b>
|
||||
* @param name The name of the player to lookup.
|
||||
* @return A String which represents the player's UUID. <b>Note: the uuid cannot be parsed to a UUID object directly, as it doesnt contain dashes. This feature will be implemented later</b>
|
||||
* @throws IOException Inherited by {@link BufferedReader#readLine()}, {@link BufferedReader#close()}, {@link URL}, {@link HttpURLConnection#getInputStream()}
|
||||
*/
|
||||
public static String getPlayerUUID(String name) throws IOException {
|
||||
String response = getRawJsonResponse(new URL(String.format(GET_UUID_URL, name)));
|
||||
JsonObject o = JSON_PARSER.fromJson(response, JsonObject.class);
|
||||
if (o == null)
|
||||
return null;
|
||||
return o.get("id") == null ? null : o.get("id").getAsString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper method used to read the response of Mojang's API webservers.
|
||||
* @param u the URL to connect to
|
||||
* @return a String with the data read.
|
||||
* @throws IOException Inherited by {@link BufferedReader#readLine()}, {@link BufferedReader#close()}, {@link URL}, {@link HttpURLConnection#getInputStream()}
|
||||
*/
|
||||
private static String getRawJsonResponse(URL u) throws IOException {
|
||||
HttpURLConnection con = (HttpURLConnection) u.openConnection();
|
||||
con.setDoInput(true);
|
||||
con.setConnectTimeout(2000);
|
||||
con.setReadTimeout(2000);
|
||||
con.connect();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String response = in.readLine();
|
||||
in.close();
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents the typical response expected by Mojang servers when requesting the name history of a player.
|
||||
*/
|
||||
public class PreviousPlayerNameEntry {
|
||||
private String name;
|
||||
@SerializedName("changedToAt")
|
||||
private long changeTime;
|
||||
|
||||
/**
|
||||
* Gets the player name of this entry.
|
||||
* @return The name of the player.
|
||||
*/
|
||||
public String getPlayerName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time of change of the name.
|
||||
* <br><b>Note: This will return 0 if the name is the original (initial) name of the player! Make sure you check if it is 0 before handling!
|
||||
* <br>Parsing 0 to a Date will result in the date "01/01/1970".</b>
|
||||
* @return a timestamp in miliseconds that you can turn into a date or handle however you want :)
|
||||
*/
|
||||
public long getChangeTime() {
|
||||
return changeTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this name is the name used to register the account (the initial/original name)
|
||||
* @return a boolean, true if it is the the very first name of the player, otherwise false.
|
||||
*/
|
||||
public boolean isPlayersInitialName() {
|
||||
return getChangeTime() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Name: " + name + " Date of change: " + new Date(changeTime).toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +1,15 @@
|
||||
package net.t2code.lib.Spigot.Lib.replace;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -12,29 +18,29 @@ public class Replace {
|
||||
public static String replace(String prefix, String Text) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n");
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
public static String replace(String prefix,Player player, String Text) {
|
||||
public static String replace(String prefix, Player player, String Text) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n"));
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
||||
output.add(input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n"));
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replace(String prefix,Player player, List<String> Text) {
|
||||
public static List<String> replace(String prefix, Player player, List<String> Text) {
|
||||
List<String> output = new ArrayList();
|
||||
if (player == null) {
|
||||
return Collections.singletonList("player is null");
|
||||
@ -45,59 +51,58 @@ public class Replace {
|
||||
for (String input : Text) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n")));
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replacePrice(String prefix,List<String> Text, String price) {
|
||||
public static List<String> replacePrice(String prefix, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n")
|
||||
.replace("[price]", String.valueOf(price)));
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n").replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String removeColorCode(String value){
|
||||
public static String removeColorCode(String value) {
|
||||
String text = value.replace("&", "§");
|
||||
while(text.contains("§")){
|
||||
while (text.contains("§")) {
|
||||
int stelle = text.indexOf("§");
|
||||
if(text.length() >= stelle+2) {
|
||||
if (text.length() >= stelle + 2) {
|
||||
text = text.substring(0, stelle) + text.substring(stelle + 2);
|
||||
}else{
|
||||
} else {
|
||||
text = text.substring(0, stelle) + text.substring(stelle + 1);
|
||||
}
|
||||
}
|
||||
return (text);
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replacePrice(String prefix,Player player, List<String> Text, String price) {
|
||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]","\n")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
||||
.replace("[price]", String.valueOf(price))));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, String Text, String price) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price)).replace("[nl]","\n");
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price))
|
||||
.replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
|
||||
public static String replacePrice(String prefix,Player player, String Text, String price) {
|
||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]","\n"));
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public final class T2CodeMain extends JavaPlugin {
|
||||
return eco;
|
||||
}
|
||||
|
||||
protected static void setEco(Economy eco) {
|
||||
static void setEco(Economy eco) {
|
||||
T2CodeMain.eco = eco;
|
||||
}
|
||||
public static Permission getPerm() {
|
||||
@ -160,7 +160,7 @@ public final class T2CodeMain extends JavaPlugin {
|
||||
LanguagesCreate.langCreate();
|
||||
SelectLibConfig.onSelect();
|
||||
SelectLibMsg.onSelect(prefix);
|
||||
if (!Util.getSnapshot()) {
|
||||
if (!Util.getSnapshot() || version.toLowerCase().contains("dev")) {
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ public class Vault {
|
||||
send.console(Util.getPrefix() + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.console(Util.getPrefix() + " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.console(Util.getPrefix() + " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
RegisteredServiceProvider<Permission> perm = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (perm != null) {
|
||||
@ -36,7 +36,7 @@ public class Vault {
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.console(Util.getPrefix() + " §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,5 @@ public class SelectLibConfig {
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user