Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
8f05d5c677 | |||
c89afa3c68 | |||
df22ddd9d2 | |||
c92e36163e | |||
d4f311493f | |||
fb289bd66e | |||
72d33dca90 | |||
3ce11b3d12 | |||
f14aeb6078 |
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -36,6 +36,11 @@
|
||||
<option name="name" value="placeholderapi" />
|
||||
<option name="url" value="http://repo.extendedclip.com/content/repositories/placeholderapi/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BenCodez Repo" />
|
||||
<option name="name" value="BenCodez Repo" />
|
||||
<option name="url" value="https://nexus.bencodez.com/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Builders-Paradise" />
|
||||
<option name="name" value="Builders-Paradise" />
|
||||
|
13
.idea/libraries/Maven__junit_junit_4_10.xml
generated
13
.idea/libraries/Maven__junit_junit_4_10.xml
generated
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: junit:junit:4.10">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@@ -13,7 +13,10 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="16" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="jpab" />
|
||||
</component>
|
||||
</project>
|
@@ -24,8 +24,7 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||
@@ -33,17 +32,40 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.12.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.8" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.9" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.t2code:bungee:1615" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.t2code:bungee:1642" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.t2code:LuckyBox-API:4.2.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.11.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:19.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:19.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.bencodez:votingplugin:6.9.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-velocity:2.2.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-base:2.2.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.bencodez:advancedcore:master-1634c37011-1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-simple:1.7.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: xyz.upperlevel.spigot.book:spigot-book-api:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-text-minimessage:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-api:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-key:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:examination-api:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:examination-string:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-platform-bukkit:4.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-platform-api:4.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-text-serializer-bungeecord:4.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-text-serializer-legacy:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-nbt:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-text-serializer-gson:4.11.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.kyori:adventure-text-serializer-gson-legacy-impl:4.11.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.kyori:adventure-platform-facet:4.1.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.kyori:adventure-platform-viaversion:4.1.1" level="project" />
|
||||
</component>
|
||||
</module>
|
42
pom.xml
42
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.4</version>
|
||||
<!-- <classifier>dev-1</classifier> -->
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>11.9</version>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
|
||||
<name>T2CodeLib</name>
|
||||
|
||||
@@ -55,10 +57,12 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<!-- Mojang / Spigot -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
@@ -67,44 +71,74 @@
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
<!-- Vault-->
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<!-- placeholderapi -->
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<!-- votingplugin -->
|
||||
<repository>
|
||||
<id>BenCodez Repo</id>
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mojang / Spigot-->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18-R0.1-SNAPSHOT</version>
|
||||
<version>1.19-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1615</version>
|
||||
<version>1642</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>LuckyBox-API</artifactId>
|
||||
<version>4.2.7</version>
|
||||
</dependency>
|
||||
<!-- Vault-->
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- placeholderapi -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- votingplugin -->
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--Kyori MiniMessage-->
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.11.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@@ -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
|
||||
|
@@ -3,7 +3,6 @@ package net.t2code.lib.Bungee.Lib.plugins;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.BMain;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@@ -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)) {
|
||||
@@ -78,7 +75,7 @@ public class Tab {
|
||||
}
|
||||
|
||||
|
||||
private static Boolean passend(String command, String arg) {
|
||||
public static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
|
104
src/main/java/net/t2code/lib/Spigot/Lib/eco/Eco.java
Normal file
104
src/main/java/net/t2code/lib/Spigot/Lib/eco/Eco.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package net.t2code.lib.Spigot.Lib.eco;
|
||||
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Eco {
|
||||
|
||||
public static boolean moneyRemove(String prefix, Player player, Double price) {
|
||||
if (vault(prefix, player)) {
|
||||
return T2CodeMain.getEco().withdrawPlayer(player, price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean moneyAdd(String prefix, Player player, Double price) {
|
||||
if (vault(prefix, player)) {
|
||||
return T2CodeMain.getEco().depositPlayer(player, price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean vault(String prefix, Player player) {
|
||||
if (T2CodeMain.getEco() == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
|
||||
}
|
||||
player.sendMessage(prefix + "\n" + SelectLibMsg.vaultNotSetUp + "\n" + prefix);
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
|
||||
public static boolean itemRemove(Player player, String item, int amount) {
|
||||
ItemStack itemStack = new ItemStack(Material.valueOf(item.toUpperCase()));
|
||||
boolean have = false;
|
||||
int anz = 0;
|
||||
for (int iam = 0; iam < player.getInventory().getSize(); iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm == null) continue;
|
||||
if (itm.getType() == itemStack.getType()) {
|
||||
anz = anz + itm.getAmount();
|
||||
}
|
||||
}
|
||||
if (anz >= amount) {
|
||||
player.getInventory().removeItem(new ItemStack(Material.valueOf(item), amount));
|
||||
have = true;
|
||||
}
|
||||
return have;
|
||||
}
|
||||
|
||||
public static boolean itemAdd(Player player, String item, int amount) {
|
||||
ItemStack itemStack = new ItemStack(Material.valueOf(item.toUpperCase()));
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < player.getInventory().getSize() - 5; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
empty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < amount; i++) {
|
||||
if (empty) {
|
||||
player.getInventory().addItem(itemStack);
|
||||
} else {
|
||||
player.getLocation().getWorld().dropItem(player.getLocation(), itemStack);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean votePointsRemove(String prefix, Player player, Integer amount) {
|
||||
if (votePlugin(prefix, player)) {
|
||||
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).removePoints(amount);
|
||||
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public static boolean votePointsAdd(String prefix, Player player, Integer amount) {
|
||||
if (votePlugin(prefix, player)) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(T2CodeMain.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).addPoints(amount);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
private static boolean votePlugin(String prefix, Player player) {
|
||||
if (PluginCheck.votingPlugin()) return true;
|
||||
send.console(prefix + " §4\n" + prefix + " §4VotingPlugin could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/votingplugin.15358/§4\n" + prefix);
|
||||
player.sendMessage(prefix + "\n" + SelectLibMsg.votingPluginNotSetUp + "\n" + prefix);
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -1,30 +1,54 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class HoverModule {
|
||||
|
||||
public static void module(String text, String hover, String action, String actionValue, Player player) {
|
||||
module((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
||||
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
||||
}
|
||||
private static final MiniMessage mm = MiniMessage.miniMessage();
|
||||
|
||||
public static void module(String msg, Player player) {
|
||||
if (!msg.contains("/*/")) {
|
||||
player.sendMessage(msg);
|
||||
public static void modulePlayer(String msg, Player player) {
|
||||
if (msg.contains("/*/")) {
|
||||
t2cmodule(msg, player);
|
||||
return;
|
||||
}
|
||||
miniMessage(msg,player);
|
||||
}
|
||||
public static void moduleSender(String msg, CommandSender sender) {
|
||||
miniMessage(msg,sender);
|
||||
}
|
||||
|
||||
public static void miniMessage(String msg, Player player){
|
||||
Component parsed = mm.deserialize(Replace.convertColorCode(msg));
|
||||
T2CodeMain.adventure.player(player).sendMessage(parsed);
|
||||
}
|
||||
public static void miniMessage(String msg, CommandSender sender){
|
||||
Component parsed = mm.deserialize(Replace.convertColorCode(msg));
|
||||
T2CodeMain.adventure.sender(sender).sendMessage(parsed);
|
||||
}
|
||||
|
||||
private static void t2cmodule(String msg, Player player) {
|
||||
String[] split = msg.split("/\\*/");
|
||||
int i = split.length;
|
||||
String text = null;
|
||||
String hover = null;
|
||||
String action = null;
|
||||
String actionValue = null;
|
||||
if (i > 0) text= split[0];
|
||||
if (i > 1) hover =split[1];
|
||||
if (i > 2)action = split[2];
|
||||
if (i > 3)actionValue = split[3];
|
||||
if (i > 0) text = split[0];
|
||||
if (i > 1) hover = split[1];
|
||||
if (i > 2) action = split[2];
|
||||
if (i > 3) actionValue = split[3];
|
||||
|
||||
TextBuilder textBuilder = new TextBuilder(text);
|
||||
if (hover != null && !hover.equals("null")) {
|
||||
|
@@ -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,17 +98,19 @@ 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) {
|
||||
Player player = (Player) sender;
|
||||
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)
|
||||
.addHover("§8Click to copy").addClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, Replace.removeColorCode(prefix) + " - " + pluginVersion).build();
|
||||
sender.spigot().sendMessage(comp2);
|
||||
player.spigot().sendMessage(comp2);
|
||||
}
|
||||
|
||||
if (!publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
@@ -112,10 +118,11 @@ public class T2CodeTemplate {
|
||||
}
|
||||
TextComponent comp3 = new TextBuilder(prefix + " §2Spigot: §6" + spigot)
|
||||
.addHover("§8Open Spigot").addClickEvent(ClickEvent.Action.OPEN_URL, spigot).build();
|
||||
sender.spigot().sendMessage(comp3);
|
||||
|
||||
player.spigot().sendMessage(comp3);
|
||||
TextComponent comp4 = new TextBuilder(prefix + " §2Discord: §6" + discord)
|
||||
.addHover("§8Open Discord").addClickEvent(ClickEvent.Action.OPEN_URL, discord).build();
|
||||
sender.spigot().sendMessage(comp4);
|
||||
player.spigot().sendMessage(comp4);
|
||||
} else {
|
||||
if (publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
send.sender(sender, 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.modulePlayer(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);
|
||||
HoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ public class MCVersion {
|
||||
public static boolean minecraft1_17;
|
||||
public static boolean minecraft1_18;
|
||||
public static boolean minecraft1_19;
|
||||
public static boolean minecraft1_20;
|
||||
public static void onCheck(){
|
||||
isVersion = Bukkit.getServer().getVersion();
|
||||
isBuckitVersion = Bukkit.getServer().getBukkitVersion();
|
||||
@@ -32,5 +33,6 @@ public class MCVersion {
|
||||
minecraft1_17 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17");
|
||||
minecraft1_18 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18");
|
||||
minecraft1_19 = Bukkit.getServer().getClass().getPackage().getName().contains("1_19");
|
||||
minecraft1_20 = Bukkit.getServer().getClass().getPackage().getName().contains("1_20");
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ public class NMSVersion {
|
||||
public static boolean v1_18_R1;
|
||||
public static boolean v1_18_R2;
|
||||
public static boolean v1_19_R1;
|
||||
public static boolean v1_19_R2;
|
||||
|
||||
public static void onCheck() {
|
||||
isNMS = Bukkit.getServer().getClass().getPackage().getName();
|
||||
@@ -45,5 +46,6 @@ public class NMSVersion {
|
||||
v1_18_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R1");
|
||||
v1_18_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R2");
|
||||
v1_19_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_19_R1");
|
||||
v1_19_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_19_R2");
|
||||
}
|
||||
}
|
||||
|
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,6 +1,6 @@
|
||||
package net.t2code.lib.Spigot.Lib.plugins;
|
||||
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -28,12 +28,15 @@ public class PluginCheck {
|
||||
public static Boolean cmi(){
|
||||
return Bukkit.getPluginManager().getPlugin("CMI") != null;
|
||||
}
|
||||
|
||||
public static Boolean votingPlugin(){
|
||||
return Bukkit.getPluginManager().getPlugin("VotingPlugin") != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* T2Code Plugins
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static Boolean cgui(){
|
||||
return Bukkit.getPluginManager().getPlugin("CommandGUI") != null;
|
||||
}
|
||||
@@ -73,7 +76,7 @@ public class PluginCheck {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
T2CodeMain.getPlugin().getPluginLoader().disablePlugin(T2CodeMain.getPlugin());
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
@@ -0,0 +1,22 @@
|
||||
package net.t2code.lib.Spigot.Lib.plugins;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class T2CPluginManager {
|
||||
|
||||
public static void restart(String plugin) {
|
||||
|
||||
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)).onEnable();
|
||||
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)).onDisable();
|
||||
}
|
||||
|
||||
public static void enable(String plugin) {
|
||||
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)).onEnable();
|
||||
}
|
||||
|
||||
public static void disable(String plugin) {
|
||||
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)).onDisable();
|
||||
}
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
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 org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -10,31 +12,31 @@ import java.util.List;
|
||||
public class Replace {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
|
||||
return replaceLegacyColor(Text).replace("[prefix]", prefix).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) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
public static String replace(String prefix, Player player, String Text) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
||||
.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("&", "§")
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.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");
|
||||
@@ -43,61 +45,101 @@ public class Replace {
|
||||
return Collections.singletonList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, input.replace("[prefix]", prefix).replace("&", "§")
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.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("&", "§")
|
||||
rp.add(replaceLegacyColor(s).replace("[prefix]", prefix)
|
||||
.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){
|
||||
String text = value.replace("&", "§");
|
||||
while(text.contains("§")){
|
||||
int stelle = text.indexOf("§");
|
||||
if(text.length() >= stelle+2) {
|
||||
text = text.substring(0, stelle) + text.substring(stelle + 2);
|
||||
}else{
|
||||
text = text.substring(0, stelle) + text.substring(stelle + 1);
|
||||
}
|
||||
}
|
||||
return (text);
|
||||
public static String removeColorCode(String value) {
|
||||
return value.replace("&0", "").replace("&1", "").replace("&2", "").replace("&3", "")
|
||||
.replace("&4", "").replace("&5", "").replace("&6", "").replace("&7", "")
|
||||
.replace("&8", "").replace("&9", "").replace("&a", "").replace("&b", "")
|
||||
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
||||
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
||||
.replace("&o", "").replace("&r", "");
|
||||
// String text = value.replace("&", "§");
|
||||
// while (text.contains("§")) {
|
||||
// int stelle = text.indexOf("§");
|
||||
// if (text.length() >= stelle + 2) {
|
||||
// text = text.substring(0, stelle) + text.substring(stelle + 2);
|
||||
// } 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("&", "§")
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix)
|
||||
.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 replacePrice(String prefix, String Text, String price) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
return replaceLegacyColor(Text).replace("[prefix]", prefix)
|
||||
.replace("&o", "§o").replace("&r", "§r").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) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
||||
.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")));
|
||||
}
|
||||
|
||||
public static String replaceLegacyColor(String text) {
|
||||
return text.replace("&0", "§0").replace("&1", "§1").replace("&2", "§2").replace("&3", "§3")
|
||||
.replace("&4", "§4").replace("&5", "§5").replace("&6", "§6").replace("&7", "§7")
|
||||
.replace("&8", "§8").replace("&9", "§9").replace("&a", "§a").replace("&b", "§b")
|
||||
.replace("&c", "§c").replace("&d", "§d").replace("&e", "§e").replace("&f", "§f")
|
||||
.replace("&k", "§k").replace("&l", "§l").replace("&m", "§m").replace("&n", "§n")
|
||||
.replace("&o", "§o").replace("&r", "§r");
|
||||
}
|
||||
|
||||
public static String convertColorCode(String text) {
|
||||
return text.replace("&0", "<black>").replace("§0", "<black>")
|
||||
.replace("&1", "<dark_blue>").replace("§1", "<dark_blue>")
|
||||
.replace("&2", "<dark_green>").replace("§2", "<dark_green>")
|
||||
.replace("&3", "<dark_aqua>").replace("§3", "<dark_aqua>")
|
||||
.replace("&4", "<dark_red>").replace("§4", "<dark_red>")
|
||||
.replace("&5", "<dark_purple>").replace("§5", "<dark_purple>")
|
||||
.replace("&6", "<gold>").replace("§6", "<gold>")
|
||||
.replace("&7", "<gray>").replace("§7", "<gray>")
|
||||
.replace("&8", "<dark_gray>").replace("§8", "<dark_gray>")
|
||||
.replace("&9", "<blue>").replace("§9", "<blue>")
|
||||
.replace("&a", "<green>").replace("§a", "<green>")
|
||||
.replace("&b", "<aqua>").replace("§b", "<aqua>")
|
||||
.replace("&c", "<red>").replace("§c", "<red>")
|
||||
.replace("&d", "<light_purple>").replace("§d", "<light_purple>")
|
||||
.replace("&e", "<yellow>").replace("§e", "<yellow>")
|
||||
.replace("&f", "<white>").replace("§f", "<white>")
|
||||
.replace("&k", "<obfuscated>").replace("§k", "<obfuscated>")
|
||||
.replace("&l", "<bold>").replace("§l", "<bold>")
|
||||
.replace("&m", "<strikethrough>").replace("§m", "<strikethrough>")
|
||||
.replace("&n", "<underlined>").replace("§n", "<underlined>")
|
||||
.replace("&o", "<italic>").replace("§o", "<italic>")
|
||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,8 @@
|
||||
package net.t2code.lib.Spigot.Lib.update;
|
||||
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.HoverModule;
|
||||
import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -26,7 +21,7 @@ public class UpdateAPI {
|
||||
public static HashMap<String, UpdateObject> PluginVersionen = new HashMap<>();
|
||||
|
||||
public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) {
|
||||
if (!SelectLibConfig.UpdateCheckOnJoin) {
|
||||
if (!SelectLibConfig.getUpdateCheckOnJoin()) {
|
||||
return;
|
||||
}
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
@@ -86,19 +81,19 @@ public class UpdateAPI {
|
||||
send.player(player, Prefix);
|
||||
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
HoverModule.module(Prefix + " §6A new §4DEV§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
HoverModule.modulePlayer(Prefix + " §6A new §4DEV§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
HoverModule.module(Prefix + " §6A new §2BETA§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
HoverModule.modulePlayer(Prefix + " §6A new §2BETA§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
HoverModule.module(Prefix + " §6A new §eSNAPSHOT§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
HoverModule.modulePlayer(Prefix + " §6A new §eSNAPSHOT§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
}
|
||||
} else {
|
||||
HoverModule.module(Prefix + " §6A new version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
HoverModule.modulePlayer(Prefix + " §6A new version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
}
|
||||
HoverModule.module(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion, "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
HoverModule.module(Prefix + " §6You can find more information on Discord.", "§e" + Discord, "OPEN_URL", Discord, player);
|
||||
HoverModule.modulePlayer(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion, "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
||||
HoverModule.modulePlayer(Prefix + " §6You can find more information on Discord.", "§e" + Discord, "OPEN_URL", Discord, player);
|
||||
send.player(player, Prefix);
|
||||
}
|
||||
|
||||
|
@@ -1,77 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.vault;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class Vault {
|
||||
|
||||
public static Boolean vaultEnable;
|
||||
public static Boolean connected;
|
||||
|
||||
public static boolean buy(String prefix, Player p, Double price) {
|
||||
if (Main.eco == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
|
||||
}
|
||||
p.sendMessage(prefix + "\n" + SelectLibMsg.vaultNotSetUp + "\n" + prefix);
|
||||
} else {
|
||||
return Main.eco.withdrawPlayer(p,price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean addMoney(String prefix, Player p, Double price) {
|
||||
if (Main.eco == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
|
||||
}
|
||||
p.sendMessage(prefix + "\n" + SelectLibMsg.vaultNotSetUp + "\n" + prefix);
|
||||
} else {
|
||||
return Main.eco.depositPlayer(p,price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void loadVault() throws InterruptedException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (Main.plugin.getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
vaultEnable = true;
|
||||
RegisteredServiceProvider<Economy> eco = Main.plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (eco != null) {
|
||||
Main.eco = eco.getProvider();
|
||||
if (Main.eco != null) {
|
||||
connected = true;
|
||||
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");
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
RegisteredServiceProvider<Permission> perm = Main.plugin.getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (perm != null) {
|
||||
Main.perm = perm.getProvider();
|
||||
}
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaultDisable() {
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Vault / Economy successfully deactivated.");
|
||||
}
|
||||
}
|
@@ -1,26 +1,17 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
|
||||
@@ -31,7 +22,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), T2CodeMain.getAutor(), T2CodeMain.getVersion(), UpdateAPI.PluginVersionen.get(T2CodeMain.getPlugin().getName()).publicVersion);
|
||||
return false;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
@@ -40,7 +31,10 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
case "pl":
|
||||
case "version":
|
||||
case "ver":
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), T2CodeMain.getAutor(), T2CodeMain.getVersion(), UpdateAPI.PluginVersionen.get(T2CodeMain.getPerm().getName()).publicVersion);
|
||||
return false;
|
||||
case "reloadconfig":
|
||||
SelectLibConfig.onSelect();
|
||||
return false;
|
||||
case "debug":
|
||||
if (args.length != 2) {
|
||||
@@ -63,6 +57,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("debug", "t2code.admin");
|
||||
put("info", "t2code.admin");
|
||||
put("reloadconfig", "t2code.admin");
|
||||
}};
|
||||
|
||||
@Override
|
||||
|
@@ -4,7 +4,6 @@ import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.vault.Vault;
|
||||
import net.t2code.lib.Util;
|
||||
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -22,15 +21,15 @@ import java.util.zip.ZipOutputStream;
|
||||
|
||||
public class CreateReportLog {
|
||||
protected static void create(CommandSender sender) {
|
||||
send.sender(sender, Main.prefix + " §6A DebugLog is created...");
|
||||
send.sender(sender, T2CodeMain.getPrefix() + " §6A DebugLog is created...");
|
||||
String timeStampFile = new SimpleDateFormat("HH_mm_ss-dd_MM_yyyy").format(Calendar.getInstance().getTime());
|
||||
|
||||
File directory = new File(Main.getPath() + "/DebugLogs");
|
||||
File directory = new File(T2CodeMain.getPath() + "/DebugLogs");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
}
|
||||
|
||||
File file = new File(Main.getPath(), "/DebugLogs/T2CodeLog.txt");
|
||||
File file = new File(T2CodeMain.getPath(), "/DebugLogs/T2CodeLog.txt");
|
||||
PrintWriter pWriter = null;
|
||||
try {
|
||||
pWriter = new PrintWriter(new FileWriter(file.getPath()));
|
||||
@@ -51,17 +50,17 @@ public class CreateReportLog {
|
||||
if (Vault.vaultEnable) {
|
||||
pWriter.println("Vault: " + Bukkit.getPluginManager().getPlugin("Vault").getName() + " - " + Bukkit.getPluginManager().getPlugin("Vault").getDescription().getVersion());
|
||||
} else pWriter.println("Vault: not connected");
|
||||
if (Main.eco != null) {
|
||||
String st = Main.eco.getName();
|
||||
if (Main.eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (T2CodeMain.getEco() != null) {
|
||||
String st = T2CodeMain.getEco().getName();
|
||||
if (T2CodeMain.getEco().getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||
pWriter.println("Economy: " + Main.eco.isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||
} else pWriter.println("Economy: " + Main.eco.isEnabled() + " - " + st);
|
||||
pWriter.println("Economy: " + T2CodeMain.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||
} else pWriter.println("Economy: " + T2CodeMain.getEco().isEnabled() + " - " + st);
|
||||
} else pWriter.println("Economy: not connected via vault");
|
||||
if (Main.perm != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(Main.perm.getName()) != null) {
|
||||
pWriter.println("Permission: " + Main.perm.isEnabled() + " - " + Main.perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(Main.perm.getName()).getDescription().getVersion());
|
||||
} else pWriter.println("Permission: " + Main.perm.isEnabled() + " - " + Main.perm.getName());
|
||||
if (T2CodeMain.getPerm() != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(T2CodeMain.getPerm().getName()) != null) {
|
||||
pWriter.println("Permission: " + T2CodeMain.getPerm().isEnabled() + " - " + T2CodeMain.getPerm().getName() + " - " + Bukkit.getPluginManager().getPlugin(T2CodeMain.getPerm().getName()).getDescription().getVersion());
|
||||
} else pWriter.println("Permission: " + T2CodeMain.getPerm().isEnabled() + " - " + T2CodeMain.getPerm().getName());
|
||||
} else pWriter.println("Permission: not connected via vault");
|
||||
pWriter.println();
|
||||
pWriter.println("Java: " + System.getProperty("java.version"));
|
||||
@@ -69,7 +68,7 @@ public class CreateReportLog {
|
||||
pWriter.println("System: " + System.getProperty("os.version"));
|
||||
pWriter.println("User Home: " + System.getProperty("user.home"));
|
||||
pWriter.println();
|
||||
pWriter.println("T2CodeLib: " + Main.plugin.getDescription().getVersion());
|
||||
pWriter.println("T2CodeLib: " + T2CodeMain.getPlugin().getDescription().getVersion());
|
||||
pWriter.println();
|
||||
if (PluginCheck.luckyBox()) {
|
||||
pWriter.println("T2C-PremiumPlugins: ");
|
||||
@@ -93,7 +92,7 @@ public class CreateReportLog {
|
||||
}
|
||||
}
|
||||
|
||||
String filePath = Main.getPath() + "/DebugLogs/T2CodeLog.txt";
|
||||
String filePath = T2CodeMain.getPath() + "/DebugLogs/T2CodeLog.txt";
|
||||
String log = "logs/latest.log";
|
||||
String zipPath = "plugins/T2CodeLib/DebugLogs/T2CLog-" + timeStampFile + ".zip";
|
||||
try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(zipPath))) {
|
||||
@@ -128,9 +127,9 @@ public class CreateReportLog {
|
||||
}
|
||||
file.delete();
|
||||
if (sender instanceof Player) {
|
||||
send.sender(sender, Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
send.console(Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
} else send.sender(sender, Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
send.sender(sender, T2CodeMain.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
send.console(T2CodeMain.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
} else send.sender(sender, T2CodeMain.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,6 @@ package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
@@ -13,6 +12,6 @@ public class JoinEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
UpdateAPI.join(Main.plugin, Util.getPrefix(), "t2code.lib.updatemsg", event.getPlayer(), Main.spigot, Main.discord);
|
||||
UpdateAPI.join(T2CodeMain.getPlugin(), Util.getPrefix(), "t2code.lib.updatemsg", event.getPlayer(), T2CodeMain.getSpigot(), T2CodeMain.getDiscord());
|
||||
}
|
||||
}
|
@@ -1,132 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.Lib.vault.Vault;
|
||||
import net.t2code.lib.Spigot.system.config.ConfigCreate;
|
||||
import net.t2code.lib.Spigot.system.languages.LanguagesCreate;
|
||||
import net.t2code.lib.Util;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public static File getPath() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
public static Main plugin;
|
||||
public static Economy eco = null;
|
||||
public static Permission perm = null;
|
||||
|
||||
public static List<String> autor;
|
||||
public static String version;
|
||||
|
||||
public static String prefix = Util.getPrefix();
|
||||
public static Integer spigotID = Util.getSpigotID();
|
||||
public static Integer bstatsID = Util.getBstatsID();
|
||||
public static String spigot = Util.getSpigot();
|
||||
public static String discord = Util.getDiscord();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
long long_;
|
||||
long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
if (Util.getSnapshot()){
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! §4This is a trial version! §eSome 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();
|
||||
}
|
||||
}
|
||||
|
||||
//send.console("§4 _|_|_|_|_| _|_| _|_|_| _| ");
|
||||
//send.console("§4 _| _| _| _| _|_| _|_|_| _|_| ");
|
||||
//send.console("§4 _| _| _| _| _| _| _| _|_|_|_| ");
|
||||
//send.console("§4 _| _| _| _| _| _| _| _| ");
|
||||
//send.console("§4 _| _|_|_|_| _|_|_| _|_| _|_|_| _|_|_| ");
|
||||
//T2CodeTemplate.onLoadSeparateStroke(prefix);
|
||||
try {
|
||||
Vault.loadVault();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NMSVersion.onCheck();
|
||||
MCVersion.onCheck();
|
||||
if (MCVersion.minecraft1_19){
|
||||
send.warning(this, "The 1.19 is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ItemVersion.scan();
|
||||
send.console(Main.prefix + " §3Server run on: §6" + MCVersion.isVersion + " / " + NMSVersion.isNMS);
|
||||
if (eco != null) {
|
||||
String st = eco.getName();
|
||||
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null){
|
||||
send.console(Main.prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
||||
(System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(Main.prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(Main.prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
if (perm != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null){
|
||||
send.console(Main.prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(Main.prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(Main.prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
if (PluginCheck.pluginCheck("PlaceholderAPI")) {
|
||||
send.console(Main.prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
}
|
||||
|
||||
Main.plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
ConfigCreate.configCreate();
|
||||
LanguagesCreate.langCreate();
|
||||
SelectLibConfig.onSelect();
|
||||
SelectLibMsg.onSelect(prefix);
|
||||
if (!Util.getSnapshot()){
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (SelectLibConfig.InventoriesCloseByServerStop){
|
||||
for (Player player : Bukkit.getOnlinePlayers()){
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
Vault.vaultDisable();
|
||||
T2CodeTemplate.onDisable(prefix, autor, version, spigot, discord);
|
||||
}
|
||||
}
|
@@ -31,7 +31,7 @@ public class Metrics {
|
||||
public static void Bstats(Plugin plugin, int bstatsID) {
|
||||
int pluginId = bstatsID; // <-- Replace with the id of your plugin!
|
||||
Metrics metrics = new Metrics((JavaPlugin) plugin, pluginId);
|
||||
metrics.addCustomChart(new SimplePie("updatecheckonjoin", () -> String.valueOf(SelectLibConfig.UpdateCheckOnJoin)));
|
||||
metrics.addCustomChart(new SimplePie("updatecheckonjoin", () -> String.valueOf(SelectLibConfig.getUpdateCheckOnJoin())));
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
||||
|
189
src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java
Normal file
189
src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java
Normal file
@@ -0,0 +1,189 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.system.config.ConfigCreate;
|
||||
import net.t2code.lib.Spigot.system.languages.LanguagesCreate;
|
||||
import net.t2code.lib.Util;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public final class T2CodeMain extends JavaPlugin {
|
||||
|
||||
public static File getPath() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
public static BukkitAudiences adventure;
|
||||
|
||||
|
||||
private static T2CodeMain plugin;
|
||||
private static Economy eco = null;
|
||||
private static Permission perm = null;
|
||||
|
||||
private static List<String> autor;
|
||||
private static String version;
|
||||
|
||||
private static String prefix = Util.getPrefix();
|
||||
private static Integer spigotID = Util.getSpigotID();
|
||||
private static Integer bstatsID = Util.getBstatsID();
|
||||
private static String spigot = Util.getSpigot();
|
||||
private static String discord = Util.getDiscord();
|
||||
|
||||
private static Boolean load = false;
|
||||
|
||||
public static String getDiscord() {
|
||||
return discord;
|
||||
}
|
||||
|
||||
public static T2CodeMain getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static Economy getEco() {
|
||||
return eco;
|
||||
}
|
||||
|
||||
static void setEco(Economy eco) {
|
||||
T2CodeMain.eco = eco;
|
||||
}
|
||||
public static Permission getPerm() {
|
||||
return perm;
|
||||
}
|
||||
|
||||
public static List<String> getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return spigotID;
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return bstatsID;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return spigot;
|
||||
}
|
||||
|
||||
public static Boolean getLoad() {
|
||||
return load;
|
||||
}
|
||||
|
||||
public static void setPerm(Permission perm) {
|
||||
T2CodeMain.perm = perm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
this.adventure = BukkitAudiences.create(this);
|
||||
long long_;
|
||||
long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
if (Util.getSnapshot()) {
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! §4This is a trial version! §eSome 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();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Vault.loadVault();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NMSVersion.onCheck();
|
||||
MCVersion.onCheck();
|
||||
if (MCVersion.minecraft1_19) {
|
||||
send.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(prefix );
|
||||
send.warning(this, "The 1.19.* is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||
send.console(prefix);
|
||||
send.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ItemVersion.scan();
|
||||
send.console(T2CodeMain.prefix + " §3Server run on: §6" + MCVersion.isVersion + " / " + NMSVersion.isNMS);
|
||||
if (eco != null) {
|
||||
String st = eco.getName();
|
||||
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||
send.console(T2CodeMain.prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
||||
(System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(T2CodeMain.prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(T2CodeMain.prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
if (perm != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
|
||||
send.console(T2CodeMain.prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(T2CodeMain.prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else send.console(T2CodeMain.prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
if (PluginCheck.papi()) {
|
||||
send.console(T2CodeMain.prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
T2CodeMain.plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
ConfigCreate.configCreate();
|
||||
LanguagesCreate.langCreate();
|
||||
SelectLibConfig.onSelect();
|
||||
SelectLibMsg.onSelect(prefix);
|
||||
if (!Util.getSnapshot() || version.toLowerCase().contains("dev")) {
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (SelectLibConfig.getInventoriesCloseByServerStop()) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
if(this.adventure != null) {
|
||||
this.adventure.close();
|
||||
this.adventure = null;
|
||||
}
|
||||
Vault.vaultDisable();
|
||||
T2CodeTemplate.onDisable(prefix, autor, version, spigot, discord);
|
||||
}
|
||||
}
|
48
src/main/java/net/t2code/lib/Spigot/system/Vault.java
Normal file
48
src/main/java/net/t2code/lib/Spigot/system/Vault.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class Vault {
|
||||
|
||||
public static Boolean vaultEnable;
|
||||
public static Boolean connected;
|
||||
|
||||
public static void loadVault() throws InterruptedException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (T2CodeMain.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
vaultEnable = true;
|
||||
RegisteredServiceProvider<Economy> eco = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (eco != null) {
|
||||
T2CodeMain.setEco(eco.getProvider());
|
||||
if (T2CodeMain.getEco() != null) {
|
||||
connected = true;
|
||||
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");
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
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) {
|
||||
T2CodeMain.setPerm(perm.getProvider());
|
||||
}
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaultDisable() {
|
||||
if (!connected) return;
|
||||
connected = false;
|
||||
send.console(Util.getPrefix() + " §4Vault / Economy successfully deactivated.");
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
package net.t2code.lib.Spigot.system.config;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -11,60 +11,31 @@ import java.io.IOException;
|
||||
|
||||
public class ConfigCreate {
|
||||
|
||||
private static Boolean UpdateCheckOnJoin = true;
|
||||
private static Integer UpdateCheckTimeInterval = 60;
|
||||
private static Boolean Debug = false;
|
||||
private static String language = "english";
|
||||
|
||||
|
||||
private static Boolean mySQL = false;
|
||||
private static String Storage = "YML";
|
||||
private static String ip = "localhost";
|
||||
private static Integer port = 3306;
|
||||
private static String database = "database";
|
||||
private static String user = "root";
|
||||
private static String password = "password";
|
||||
private static Boolean SSL = false;
|
||||
|
||||
private static Boolean Bungee = false;
|
||||
private static String thisServer = "server";
|
||||
|
||||
public static void configCreate() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
if (new File(Main.getPath(), "config.yml").exists()){
|
||||
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Main.prefix + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else send.console(Main.prefix + " §4config.yml are created...");
|
||||
if (new File(T2CodeMain.getPath(), "config.yml").exists()){
|
||||
if (T2CodeMain.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(T2CodeMain.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else send.console(T2CodeMain.getPrefix() + " §4config.yml are created...");
|
||||
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
File config = new File(T2CodeMain.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
Config.set("Plugin.UpdateCheck.OnJoin", UpdateCheckOnJoin, yamlConfiguration);
|
||||
Config.set("Plugin.UpdateCheck.TimeInterval", UpdateCheckTimeInterval, yamlConfiguration);
|
||||
Config.set("Plugin.language", language, yamlConfiguration);
|
||||
Config.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
|
||||
Config.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
|
||||
Config.set("Plugin.language", "english", yamlConfiguration);
|
||||
|
||||
Config.set("BungeeCord.Enable", Bungee, yamlConfiguration);
|
||||
Config.set("BungeeCord.ThisServer", thisServer, yamlConfiguration);
|
||||
Config.set("BungeeCord.Enable", false, yamlConfiguration);
|
||||
Config.set("BungeeCord.ThisServer", "server", yamlConfiguration);
|
||||
Config.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
||||
|
||||
// Config.set("Storage.MySQL.Enable", mySQL, yamlConfiguration);
|
||||
// Config.set("Storage.Type", Storage, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.IP", ip, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.Port", port, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.Database", database, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.User", user, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.Password", password, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.SSL", SSL, yamlConfiguration);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
send.console(T2CodeMain.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package net.t2code.lib.Spigot.system.config;
|
||||
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@@ -8,15 +8,15 @@ import java.io.File;
|
||||
public class SelectLibConfig {
|
||||
|
||||
|
||||
public static Boolean UpdateCheckOnJoin;
|
||||
public static Boolean t2cTestDevelopment;
|
||||
public static Integer UpdateCheckTimeInterval;
|
||||
public static Boolean Debug;
|
||||
public static String language;
|
||||
public static Boolean InventoriesCloseByServerStop;
|
||||
private static Boolean UpdateCheckOnJoin;
|
||||
private static Boolean t2cTestDevelopment;
|
||||
private static Integer UpdateCheckTimeInterval;
|
||||
private static Boolean Debug;
|
||||
private static String language;
|
||||
private static Boolean InventoriesCloseByServerStop;
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
File config = new File(T2CodeMain.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
||||
@@ -25,6 +25,30 @@ public class SelectLibConfig {
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return UpdateCheckOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean getT2cTestDevelopment() {
|
||||
return t2cTestDevelopment;
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return UpdateCheckTimeInterval;
|
||||
}
|
||||
|
||||
public static Boolean getDebug() {
|
||||
return Debug;
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public static Boolean getInventoriesCloseByServerStop() {
|
||||
return InventoriesCloseByServerStop;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package net.t2code.lib.Spigot.system.languages;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -10,10 +10,10 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LanguagesCreate {
|
||||
static Plugin plugin = Main.plugin;
|
||||
static Plugin plugin = T2CodeMain.getPlugin();
|
||||
|
||||
public static void langCreate() {
|
||||
send.debug(plugin,"§4Language files are created / updated...");
|
||||
send.debug(plugin, "§4Language files are created / updated...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
|
||||
/**
|
||||
@@ -22,16 +22,17 @@ public class LanguagesCreate {
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesEN = new File(Main.getPath(), "languages/english_messages.yml");
|
||||
File messagesEN = new File(T2CodeMain.getPath(), "languages/english_messages.yml");
|
||||
YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN);
|
||||
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.EN_VaultNotSetUp, yamlConfigurationEN);
|
||||
Config.set("Plugin.VotingPluginNotSetUp", MSG.EN_VotingPluginNotSetUp, yamlConfigurationEN);
|
||||
Config.set("Plugin.SoundNotFound", MSG.EN_SoundNotFound, yamlConfigurationEN);
|
||||
|
||||
try {
|
||||
yamlConfigurationEN.save(messagesEN);
|
||||
} catch (IOException e) {
|
||||
send.warning(Main.plugin,e.getMessage());
|
||||
send.warning(T2CodeMain.getPlugin(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -41,16 +42,17 @@ public class LanguagesCreate {
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
||||
File messagesDE = new File(T2CodeMain.getPath(), "languages/german_messages.yml");
|
||||
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
||||
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.DE_VaultNotSetUp, yamlConfigurationDE);
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.DE_VotingPluginNotSetUp, yamlConfigurationDE);
|
||||
Config.set("Plugin.VotingPluginNotSetUp", MSG.DE_VotingPluginNotSetUp, yamlConfigurationDE);
|
||||
Config.set("Plugin.SoundNotFound", MSG.DE_SoundNotFound, yamlConfigurationDE);
|
||||
|
||||
try {
|
||||
yamlConfigurationDE.save(messagesDE);
|
||||
} catch (IOException e) {
|
||||
send.warning(Main.plugin,e.getMessage());
|
||||
send.warning(T2CodeMain.getPlugin(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -60,19 +62,20 @@ public class LanguagesCreate {
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesNO = new File(Main.getPath(), "languages/norwegian_messages.yml");
|
||||
File messagesNO = new File(T2CodeMain.getPath(), "languages/norwegian_messages.yml");
|
||||
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messagesNO);
|
||||
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.NO_VaultNotSetUp, yamlConfigurationNO);
|
||||
Config.set("Plugin.VotingPluginNotSetUp", MSG.NO_VotingPluginNotSetUp, yamlConfigurationNO);
|
||||
Config.set("Plugin.SoundNotFound", MSG.NO_SoundNotFound, yamlConfigurationNO);
|
||||
|
||||
try {
|
||||
yamlConfigurationNO.save(messagesNO);
|
||||
} catch (IOException e) {
|
||||
send.warning(Main.plugin,e.getMessage());
|
||||
send.warning(T2CodeMain.getPlugin(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
send.console(T2CodeMain.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
}
|
||||
|
@@ -6,17 +6,20 @@ public class MSG {
|
||||
|
||||
// EN
|
||||
public static String EN_VaultNotSetUp = "[prefix] &4Vault / Economy not set up!";
|
||||
public static String EN_VotingPluginNotSetUp = "[prefix] &4VotingPlugin is not present on the server!";
|
||||
public static String EN_SoundNotFound = "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.";
|
||||
|
||||
|
||||
// DE
|
||||
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
|
||||
public static String DE_VaultPluginNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
|
||||
public static String DE_VotingPluginNotSetUp = "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!";
|
||||
public static String DE_SoundNotFound = "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe die Einstellungen.";
|
||||
|
||||
|
||||
|
||||
// NO
|
||||
public static String NO_VaultNotSetUp = "[prefix] &4Vault / Økonomi har ikke blitt satt opp!";
|
||||
public static String NO_VotingPluginNotSetUp = "[prefix] &4VotingPlugin er ikke til stede på serveren!";
|
||||
public static String NO_SoundNotFound = "[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk innstillingene.";
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package net.t2code.lib.Spigot.system.languages;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -10,12 +10,13 @@ import org.bukkit.plugin.Plugin;
|
||||
import java.io.File;
|
||||
|
||||
public class SelectLibMsg {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static String prefix = Main.prefix;
|
||||
private static Plugin plugin = T2CodeMain.getPlugin();
|
||||
private static String prefix = T2CodeMain.getPrefix();
|
||||
|
||||
public static String selectMSG;
|
||||
|
||||
public static String vaultNotSetUp;
|
||||
public static String votingPluginNotSetUp;
|
||||
public static String soundNotFound;
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
@@ -25,20 +26,21 @@ public class SelectLibMsg {
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectLibConfig.language + "_messages.yml");
|
||||
msg = new File(T2CodeMain.getPath(), "languages/" + SelectLibConfig.getLanguage() + "_messages.yml");
|
||||
if (!msg.isFile()) {
|
||||
send.console(Prefix);
|
||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(Prefix + " §4The selected §c" + SelectLibConfig.language + " §4language file was not found.");
|
||||
send.console(Prefix + " §4The selected §c" + SelectLibConfig.getLanguage() + " §4language file was not found.");
|
||||
send.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(Prefix);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
msg = new File(T2CodeMain.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectLibConfig.language;
|
||||
} else selectMSG = SelectLibConfig.getLanguage();
|
||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
vaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
|
||||
votingPluginNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VotingPluginNotSetUp"));
|
||||
soundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
|
||||
|
||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
@@ -1,14 +1,25 @@
|
||||
name: T2CodeLib
|
||||
version: ${project.version}
|
||||
main: net.t2code.lib.Spigot.system.Main
|
||||
main: net.t2code.lib.Spigot.system.T2CodeMain
|
||||
api-version: 1.13
|
||||
prefix: T2CodeLib
|
||||
authors: [ JaTiTV, Jkobs ]
|
||||
description: Library from T2Code Plugins
|
||||
website: T2Code.net
|
||||
load: STARTUP
|
||||
softdepend: [ PlaceholderAPI, PlotSquared, CMI, CMILib, Vault, Economy, XConomy ]
|
||||
loadbefore: [ T2C-Alias ]
|
||||
softdepend:
|
||||
- VotingPlugin
|
||||
- PlaceholderAPI
|
||||
- PlotSquared
|
||||
- CMI
|
||||
- CMILib
|
||||
- Vault
|
||||
- Economy
|
||||
- XConomy
|
||||
|
||||
loadbefore:
|
||||
- T2C-Alias
|
||||
- CommandGUI
|
||||
|
||||
commands:
|
||||
t2code:
|
||||
|
Reference in New Issue
Block a user