Compare commits

...

12 Commits
15.7 ... 16.6

Author SHA1 Message Date
32b57de55c 16.6
1.21 support
minor code changes / bug fixes
2024-06-15 02:34:34 +02:00
cb4a81a3c1 16.5 | 1.20.5/1.20.6 Support 2024-05-17 01:12:12 +02:00
JaTiTV
76862db7c9 pom.xml aktualisiert 2024-04-12 14:14:35 +00:00
e5cba7fe6d Update Kyori MiniMessage
API Updates:
adventure-text-minimessage - 4.16.0
adventure-platform-bukkit - 4.3.2
adventure-platform-bungeecord - 4.3.2
2024-03-31 13:32:00 +02:00
770b7daa94 1.20.4 Update / Remove debug Message
- A pointless debug message has been removed
- 1.20.4 native Suport
2024-03-30 19:41:31 +01:00
0f645300f4 1.20r2 Support 2023-12-07 18:29:51 +01:00
65e0082322 16.1 2023-12-07 16:58:39 +01:00
150d9f4933 15.9
- In MiniMessage messages placeholders were erroneously not supported by PlaceholderAPI
- Smaller API changes in T2Csend
2023-08-04 16:29:38 +02:00
f40c47e6ab 15.8
Innovation:
Commands can now be provided with delays (in ticks)

Example:
/say hi !delay:20
This command is now executed with a delay of one second
20 ticks are one second
2023-07-31 21:09:46 +02:00
de6ecdf7a8 15.8_dev 2023-07-16 08:22:30 +02:00
cdd375a673 change gitignore 2023-07-10 03:59:53 +02:00
1cfaf32ee1 Update .gitignore 2023-07-10 03:59:06 +02:00
29 changed files with 702 additions and 142 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,4 @@
# User-specific stuff
.idea/
.idea
*.iml
*.ipr
*.iws

3
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

13
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="T2CodeLib" />
</profile>
</annotationProcessing>
</component>
</project>

7
.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

7
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

3
.idea/icon.svg generated Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 295 KiB

60
.idea/jarRepositories.xml generated Normal file
View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jitpack.io" />
<option name="name" value="jitpack.io" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="T2Code" />
<option name="name" value="T2Code" />
<option name="url" value="https://repo.t2code.net/repository/T2Code/" />
</remote-repository>
<remote-repository>
<option name="id" value="spigot-repo" />
<option name="name" value="spigot-repo" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="sonatype-oss-snapshots1" />
<option name="name" value="sonatype-oss-snapshots1" />
<option name="url" value="https://s01.oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="placeholderapi" />
<option name="name" value="placeholderapi" />
<option name="url" value="https://repo.extendedclip.com/content/repositories/placeholderapi/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="minecraft-repo" />
<option name="name" value="minecraft-repo" />
<option name="url" value="https://libraries.minecraft.net/" />
</remote-repository>
<remote-repository>
<option name="id" value="bungeecord-repo" />
<option name="name" value="bungeecord-repo" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</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>
</component>
</project>

18
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="2">
<item index="0" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
<item index="1" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/T2CodeLib.iml" filepath="$PROJECT_DIR$/T2CodeLib.iml" />
</modules>
</component>
</project>

124
.idea/uiDesigner.xml generated Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

28
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>15.7</version>
<version>16.6</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->
@@ -27,8 +27,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
<plugin>
@@ -105,11 +105,11 @@
<url>https://nexus.bencodez.com/repository/maven-public/</url>
</repository>
<!--Kyori MiniMessage
<!--Kyori MiniMessage-->
<repository>
<id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>-->
</repository>
</repositories>
@@ -118,7 +118,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@@ -134,14 +134,14 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<version>1.21-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.21-R0.1-SNAPSHOT</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>
@@ -182,19 +182,19 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.14.0</version>
<version>4.18.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.0</version>
<version>4.3.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bungeecord</artifactId>
<version>4.3.0</version>
<version>4.3.3</version>
<scope>compile</scope>
</dependency>
@@ -221,6 +221,12 @@
<version>4.5.14</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230227</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -6,6 +6,7 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.t2code.t2codelib.Util;
import org.junit.Ignore;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -20,7 +21,13 @@ public class T2CplmsgBcmd implements Listener {
try {
String channel = stream.readUTF();
String input = stream.readUTF();
String serverID = stream.readUTF();
String serverID;
try {
serverID = stream.readUTF();
} catch (Exception i){
serverID = "not Found";
}
if (channel.equals("T2Code-Console")) {
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);

View File

@@ -1,25 +1,70 @@
package net.t2code.t2codelib.SPIGOT.api.commands;
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
import java.rmi.MarshalledObject;
import java.util.Map;
public class T2Ccmd {
public static void console(String cmd) {
if (cmd.contains("!onBungee")){
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
}else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
public static void console(String cmdInput) {
Map.Entry<String,Integer> map = delay(cmdInput);
int delay = map.getValue();
String cmd = map.getKey();
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
@Override
public void run() {
if (cmd.contains("!onBungee")) {
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
} else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
}
}, delay);
}
public static void player(Player player, String cmd) {
if (cmd.contains("!asConsole")) {
if (cmd.contains("!onBungee")) {
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
} else console(cmd.replace("!asConsole", ""));
} else {
if (cmd.contains("!onBungee")) {
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
} else player.chat("/" + cmd);
}
public static void player(Player player, String cmdInput) {
Map.Entry<String,Integer> map = delay(cmdInput);
int delay = map.getValue();
String cmd = map.getKey();
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
@Override
public void run() {
if (cmd.contains("!asConsole")) {
if (cmd.contains("!onBungee")) {
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
} else console(cmd.replace("!asConsole", ""));
} else {
if (cmd.contains("!onBungee")) {
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
} else player.chat("/" + cmd);
}
}
}, delay);
}
private static Map.Entry<String, Integer> delay(@NotNull String cmdInput) {
int delay = 0;
String cmd;
if (cmdInput.contains("!delay:")) {
int i = cmdInput.indexOf("!delay:") + 7;
String s2 = cmdInput.substring(i);
int i2 = 1;
if(s2.contains(" ")) {
i2 = s2.indexOf(" ");
}else{
i2 = s2.length();
}
delay = Integer.parseInt(cmdInput.substring(i, i + i2));
cmd = cmdInput.replace("!delay:" + delay, "");
} else cmd = cmdInput;
return Map.entry(cmd, delay);
}
}

View File

@@ -3,13 +3,22 @@ package net.t2code.t2codelib.SPIGOT.api.items;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.profile.PlayerProfile;
import org.bukkit.profile.PlayerTextures;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Base64;
import org.json.JSONObject;
import java.util.List;
import java.util.UUID;
@@ -66,7 +75,13 @@ public class T2CitemBuilder {
inventory.setItem(slot, item);
}
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
public static ItemStack base64(String base64Value) {
if (!T2CmcVersion.minMc1_20() || T2CmcVersion.isNms1_20_R1()|| T2CmcVersion.isNms1_20_R2()|| T2CmcVersion.isNms1_20_R3()) {
return base64Old(base64Value);
} else return base64New(base64Value);
}
private static ItemStack base64Old(String base64Value) {
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
@@ -81,11 +96,33 @@ public class T2CitemBuilder {
e.printStackTrace();
}
itemMeta.setDisplayName(displayName);
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
itemStack.setAmount(amount);
return itemStack;
}
private static ItemStack base64New(String base64Value) {
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
PlayerTextures textures = profile.getTextures();
try {
textures.setSkin(new URL(base64Convert(base64Value)));
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
profile.setTextures(textures);
itemMeta.setOwnerProfile(profile);
itemStack.setItemMeta(itemMeta);
return itemStack;
}
private static String base64Convert(String base64Value) {
String jsonString = new String(Base64.getDecoder().decode(base64Value));
JSONObject obj = new JSONObject(jsonString);
String output = obj.getJSONObject("textures").getJSONObject("SKIN").getString("url");
if (output.startsWith("http://textures.minecraft.net/texture/")){
return output;
} else return "http://textures.minecraft.net/texture/d5d20330da59c207d78352838e91a48ea1e42b45a9893226144b251fe9b9d535";
}
}

View File

@@ -8,25 +8,11 @@ import org.bukkit.entity.Player;
public class T2ChoverModule {
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
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);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void modulePlayer(String msg, Player player) {
if (msg.contains("/*/")) {
t2cmodule(msg, player);
@@ -35,24 +21,10 @@ public class T2ChoverModule {
T2CminiMessage.sendPlayerMiniMessage(msg, player);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendSenderMiniMessage(msg, sender);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void moduleSender(String msg, CommandSender sender) {
T2CminiMessage.sendSenderMiniMessage(msg, sender);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void moduleConsole(String msg) {
if (T2CodeLibMain.getMmIsLoad()) {
T2CminiMessage.sendConsoleMiniMessage(msg);
@@ -61,13 +33,6 @@ public class T2ChoverModule {
Bukkit.getConsoleSender().sendMessage(msg);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
private static void t2cmodule(String msg, Player player) {
String[] split = msg.split("/\\*/");
int i = split.length;

View File

@@ -11,7 +11,12 @@ public class T2CminiMessage {
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
bukkitAudiences.sender(sender).sendMessage(replace(msg));
String string = "";
if (sender instanceof Player) {
Player player = (Player) sender;
string =T2Creplace.replace("",player,msg);
} else string = msg;
bukkitAudiences.sender(sender).sendMessage(replace(string));
}
public static void sendConsoleMiniMessage(String msg) {
@@ -19,7 +24,7 @@ public class T2CminiMessage {
}
public static void sendPlayerMiniMessage(String msg, Player player) {
bukkitAudiences.player(player).sendMessage(replace(msg));
bukkitAudiences.player(player).sendMessage(replace(T2Creplace.replace("", player, msg)));
}
protected static Component replace(String text) {

View File

@@ -7,71 +7,47 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
public class T2Csend {
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void console(String msg) {
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleConsole(msg);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void player(Player player, String msg) {
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.modulePlayer(msg, player);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void sender(CommandSender sender, String msg) {
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleSender(msg, sender);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void console(Object object) {
String msg = String.valueOf(object);
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleConsole(msg);
for (String msg : list(object)){
if (msg == null || msg.contains("[empty]")) continue;
T2ChoverModule.moduleConsole(msg);
}
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void player(Player player, Object object) {
String msg = String.valueOf(object);
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.modulePlayer(msg, player);
for (String msg : list(object)){
if (msg == null || msg.contains("[empty]")) continue;
T2ChoverModule.modulePlayer(msg, player);
}
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void sender(CommandSender sender, Object object) {
String msg = String.valueOf(object);
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleSender(msg, sender);
for (String msg : list(object)){
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleSender(msg, sender);
}
}
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
@@ -106,4 +82,16 @@ public class T2Csend {
public static void error(Plugin plugin, String msg) {
plugin.getLogger().log(Level.SEVERE, msg);
}
private static ArrayList<String> list(Object object){
ArrayList<String> list = new ArrayList<>();
if (object instanceof List){
list= (ArrayList<String>) object;
}
if (object instanceof String){
list.add((String) object);
}
return list;
}
}

View File

@@ -1,26 +1,36 @@
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import org.bukkit.Bukkit;
public class T2CmcVersion {
public static void onCheck() {
mcVersion = Bukkit.getServer().getVersion();
bukkitVersion = Bukkit.getServer().getBukkitVersion();
nms = Bukkit.getServer().getClass().getPackage().getName();
mc1_8 = nms.contains("1_8");
mc1_9 = nms.contains("1_9");
mc1_10 = nms.contains("1_10");
mc1_11 = nms.contains("1_11");
mc1_12 = nms.contains("1_12");
mc1_13 = nms.contains("1_13");
mc1_14 = nms.contains("1_14");
mc1_15 = nms.contains("1_15");
mc1_16 = nms.contains("1_16");
mc1_17 = nms.contains("1_17");
mc1_18 = nms.contains("1_18");
mc1_19 = nms.contains("1_19");
mc1_20 = nms.contains("1_20");
T2CnmsVersions.init();
nms = String.valueOf(T2CnmsVersions.getT2CnmsEnum());
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "mcVersion: " + mcVersion);
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "bukkitVersion: " + bukkitVersion);
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "nms: " + nms);
mc1_8 = mcVersion.contains("MC: 1.8");
mc1_9 = mcVersion.contains("MC: 1.9");
mc1_10 = mcVersion.contains("MC: 1.10");
mc1_11 = mcVersion.contains("MC: 1.11");
mc1_12 = mcVersion.contains("MC: 1.12");
mc1_13 = mcVersion.contains("MC: 1.13");
mc1_14 = mcVersion.contains("MC: 1.14");
mc1_15 = mcVersion.contains("MC: 1.15");
mc1_16 = mcVersion.contains("MC: 1.16");
mc1_17 = mcVersion.contains("MC: 1.17");
mc1_18 = mcVersion.contains("MC: 1.18");
mc1_19 = mcVersion.contains("MC: 1.19");
mc1_20 = mcVersion.contains("MC: 1.20");
mc1_21 = mcVersion.contains("MC: 1.21");
nms1_8_R1 = nms.contains("1_8_R1");
nms1_8_R2 = nms.contains("1_8_R2");
@@ -44,6 +54,9 @@ public class T2CmcVersion {
nms1_19_R2 = nms.contains("1_19_R2");
nms1_20_R1 = nms.contains("1_20_R1");
nms1_20_R2 = nms.contains("1_20_R2");
nms1_20_R3 = nms.contains("1_20_R3");
nms1_20_R4 = nms.contains("1_20_R4");
nms1_21_R1 = nms.contains("1_21_R1");
}
private static String mcVersion;
@@ -61,6 +74,7 @@ public class T2CmcVersion {
private static boolean mc1_18;
private static boolean mc1_19;
private static boolean mc1_20;
private static boolean mc1_21;
private static String nms;
private static boolean nms1_8_R1;
@@ -85,6 +99,9 @@ public class T2CmcVersion {
private static boolean nms1_19_R2;
private static boolean nms1_20_R1;
private static boolean nms1_20_R2;
private static boolean nms1_20_R3;
private static boolean nms1_20_R4;
private static boolean nms1_21_R1;
public static String getMcVersion() {
return mcVersion;
@@ -146,6 +163,10 @@ public class T2CmcVersion {
return mc1_20;
}
public static boolean isMc1_21() {
return mc1_21;
}
public static String getNms() {
return nms;
}
@@ -238,6 +259,18 @@ public class T2CmcVersion {
return nms1_20_R2;
}
public static boolean isNms1_20_R3() {
return nms1_20_R3;
}
public static boolean isNms1_20_R4() {
return nms1_20_R4;
}
public static boolean isNms1_21_R1() {
return nms1_21_R1;
}
public static boolean minMc1_8() {
return isMc1_8();
@@ -260,7 +293,7 @@ public class T2CmcVersion {
}
public static boolean minMc1_13() {
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() ;
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12();
}
public static boolean minMc1_14() {
@@ -268,7 +301,7 @@ public class T2CmcVersion {
}
public static boolean minMc1_15() {
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() ;
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14();
}
public static boolean minMc1_16() {

View File

@@ -0,0 +1,31 @@
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
public enum T2CnmsEnum {
not_support,
v1_8_R1,
v1_8_R2,
v1_8_R3,
v1_9_R1,
v1_9_R2,
v1_10_R1,
v1_11_R1,
v1_12_R1,
v1_13_R1,
v1_13_R2,
v1_14_R1,
v1_15_R1,
v1_16_R1,
v1_16_R2,
v1_16_R3,
v1_17_R1,
v1_18_R1,
v1_18_R2,
v1_19_R1,
v1_19_R2,
v1_19_R3,
v1_20_R1,
v1_20_R2,
v1_20_R3,
v1_20_R4,
v1_21_R1,
}

View File

@@ -0,0 +1,129 @@
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
import lombok.Getter;
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
public class T2CnmsVersions {
public static Class minecraftServerClass;
@Getter
private static T2CnmsEnum t2CnmsEnum;
public static void init() {
String mc = T2CmcVersion.getMcVersion();
if (mc.contains("(MC: 1.8)") || mc.contains("(MC: 1.8.1)")) {
t2CnmsEnum = T2CnmsEnum.v1_8_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.8.3)")) {
t2CnmsEnum = T2CnmsEnum.v1_8_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.8.4)") || mc.contains("(MC: 1.8.5)") || mc.contains("(MC: 1.8.6)") || mc.contains("(MC: 1.8.7)") || mc.contains("(MC: 1.8.8)")) {
t2CnmsEnum = T2CnmsEnum.v1_8_R3;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.9)") || mc.contains("(MC: 1.9.2)")) {
t2CnmsEnum = T2CnmsEnum.v1_9_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.9.3)") || mc.contains("(MC: 1.9.4)")) {
t2CnmsEnum = T2CnmsEnum.v1_9_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.10")) {
t2CnmsEnum = T2CnmsEnum.v1_10_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.11")) {
t2CnmsEnum = T2CnmsEnum.v1_11_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.12")) {
t2CnmsEnum = T2CnmsEnum.v1_12_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.13)")) {
t2CnmsEnum = T2CnmsEnum.v1_13_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.13.1)") || mc.contains("(MC: 1.13.2)")) {
t2CnmsEnum = T2CnmsEnum.v1_13_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.14")) {
t2CnmsEnum = T2CnmsEnum.v1_14_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.15")) {
t2CnmsEnum = T2CnmsEnum.v1_15_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.16)") || mc.contains("(MC: 1.16.1)")) {
t2CnmsEnum = T2CnmsEnum.v1_16_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.16.2)") || mc.contains("(MC: 1.16.3)")) {
t2CnmsEnum = T2CnmsEnum.v1_16_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.16.4)") || mc.contains("(MC: 1.16.5)")) {
t2CnmsEnum = T2CnmsEnum.v1_16_R3;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.17")) {
t2CnmsEnum = T2CnmsEnum.v1_17_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.18)") || mc.contains("(MC: 1.18.1)")) {
t2CnmsEnum = T2CnmsEnum.v1_18_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.18.2)")) {
t2CnmsEnum = T2CnmsEnum.v1_18_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.19)") || mc.contains("(MC: 1.19.1)") || mc.contains("(MC: 1.19.2)")) {
t2CnmsEnum = T2CnmsEnum.v1_19_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.19.3)")) {
t2CnmsEnum = T2CnmsEnum.v1_19_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.19.4)")) {
t2CnmsEnum = T2CnmsEnum.v1_19_R3;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.20)") || mc.contains("(MC: 1.20.1)")) {
t2CnmsEnum = T2CnmsEnum.v1_20_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.20.2)")) {
t2CnmsEnum = T2CnmsEnum.v1_20_R2;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.20.3)") || mc.contains("(MC: 1.20.4)")) {
t2CnmsEnum = T2CnmsEnum.v1_20_R3;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.20.6)")) {
t2CnmsEnum = T2CnmsEnum.v1_20_R4;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else if (mc.contains("(MC: 1.21)")) {
t2CnmsEnum = T2CnmsEnum.v1_21_R1;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
} else t2CnmsEnum = T2CnmsEnum.not_support;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
}
//
// public static void init() {
//
//
// // List<String> list= Arrays.stream(Class .getPackages()).map(Package::getName).filter(n -> n.startsWith("net.minecraft.server")).collect(Collectors.toList());
//
// // for (String s : list){
// // T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(),s);
// //}
//
//
// for (T2CnmsEnum nmsEnum : T2CnmsEnum.values()) {
// try {
// minecraftServerClass = Class.forName("net.minecraft.server." + nmsEnum + ".MinecraftServer");
// } catch (ClassNotFoundException ignored) {
//
// }
//
// if (minecraftServerClass != null) {
// return;
// }
//
// }
// // todo nicht kompatiebel
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "nicht kompa");
//
// }
}

View File

@@ -53,6 +53,10 @@ public class T2CupdateCheckerGit {
);
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
if (T2CupdateAPI.pluginVersions.get(plugin.getName()) == null){
T2Csend.debugmsg(T2CodeLibMain.getPlugin(),"'"+plugin.getName() + "' UpdateAPI T2CupdateAPI.pluginVersions.get(plugin.getName()) == null");
return;
}
if (T2CupdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
if (!update.load) {
new BukkitRunnable() {
@@ -74,7 +78,7 @@ public class T2CupdateCheckerGit {
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
}
}, 0L, finalInterval * 60 * 20L);
}, 10L, finalInterval * 60 * 20L);
}
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {

View File

@@ -9,6 +9,8 @@ import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CnmsEnum;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CnmsVersions;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
@@ -62,10 +64,11 @@ public final class T2CodeLibMain extends JavaPlugin {
}
T2CmcVersion.onCheck();
if (T2CmcVersion.isNms1_20_R2()) {
if (T2CnmsVersions.getT2CnmsEnum() == T2CnmsEnum.not_support) {
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
T2Csend.console(prefix);
T2Csend.warning(plugin, "The 1.20.* (R2) 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");
T2Csend.warning(plugin, "The " + T2CmcVersion.getMcVersion() + " is a very fresh / new version.");
T2Csend.warning(plugin, "The plugin may not yet be supported on this server! If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
T2Csend.console(prefix);
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
if (!SelectLibConfig.getT2cTestDevelopment()) {
@@ -76,22 +79,45 @@ public final class T2CodeLibMain extends JavaPlugin {
}
}
}
T2Csend.console(prefix + " §3Server run on: §6" + T2CmcVersion.getMcVersion() + " / " + T2CmcVersion.getNms());
if (T2CmcVersion.isMc1_21()) {
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
T2Csend.console(prefix);
T2Csend.warning(plugin, "The 1.21 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");
T2Csend.console(prefix);
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
if (!SelectLibConfig.getT2cTestDevelopment()) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
T2Ctemplate.onLoadSeparateStroke(prefix);
T2Csend.console(prefix + " §2Server run on:");
T2Csend.console(prefix + " §3mcVersion: §6" + T2CmcVersion.getMcVersion());
T2Csend.console(prefix + " §3bukkitVersion: §6" + T2CmcVersion.getBukkitVersion());
T2Csend.console(prefix + " §3nms: §6" + T2CmcVersion.getNms());
T2Ctemplate.onLoadSeparateStroke(prefix);
if (eco != null) {
String st = eco.getName();
if (eco.getName().equals("CMIEconomy")) st = "CMI";
if (Bukkit.getPluginManager().getPlugin(st) != null) {
T2Csend.console(prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
(System.currentTimeMillis() - long_) + "ms");
} else T2Csend.console(prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else T2Csend.console(prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else
T2Csend.console(prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else
T2Csend.console(prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
if (perm != null) {
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
T2Csend.console(prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else T2Csend.console(prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else T2Csend.console(prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else
T2Csend.console(prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else
T2Csend.console(prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
if (T2CpluginCheck.papi()) {
T2Csend.console(prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");

View File

@@ -45,6 +45,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
}
Commands.info(sender);
return false;
case "permtoggle":
if (!sender.hasPermission("t2code.permtoggle.use")) {
T2Csend.sender(sender, "§4No Permission §8t2code.permtoggle.use");
return false;
}
Commands.permtoggle(sender, args);
return false;
case "updateinfo":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
@@ -52,13 +59,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
}
Commands.updateInfo(sender, args);
return false;
// case "plugininfo": todo
// if (!sender.hasPermission("t2code.admin")) {
// T2Csend.sender(sender, "§4No Permission §8t2code.admin");
// return false;
// }
// Commands.updateInfo(sender, args);
// return false;
// case "plugininfo": todo
// if (!sender.hasPermission("t2code.admin")) {
// T2Csend.sender(sender, "§4No Permission §8t2code.admin");
// return false;
// }
// Commands.updateInfo(sender, args);
// return false;
case "reloadconfig":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");

View File

@@ -1,9 +1,11 @@
package net.t2code.t2codelib.SPIGOT.system.cmd;
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -83,4 +85,23 @@ public class Commands {
protected static void updateInfo(CommandSender sender, String[] args) {
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
}
public static void permtoggle(CommandSender sender, String[] args) {
Player player = (Player) Bukkit.getOfflinePlayer(args[1]);
if (player == null) {
T2Csend.sender(sender, "§4Player §6" + args[1] + " §4not exist!");
return;
}
String permission = args[2];
if (player.hasPermission(permission)) {
T2Ccmd.console(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "false"));
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6false §2for the player §6" + player.getName() + "§2.");
} else {
T2Ccmd.console(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "true"));
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6true §2for the player §6" + player.getName() + "§2.");
}
}
}

View File

@@ -198,7 +198,7 @@ public class CreateReportLog {
"<br>[prefix] <green>You can download it <click:open_url:'[url]'><gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>." +
"<br>[prefix] <green>Please enter the following key in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
"<br><hover:show_text:'<yellow>Click to delete</yellow>'><click:run_command:'/t2code debug deleteReportLog [key]'>[prefix] <green>You can <b>delte</b> yor Debug-File by clicking me.</green>" +
"<br>[prefix] <click:run_command:'/t2code debug deleteReportLog [key]'><hover:show_text:'<yellow>Click to delete</yellow>'><green>You can <b>delete</b> your Debug-File by clicking me.</green>" +
"<br>[prefix] <color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color></click></hover>")
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", Util.getPrefix()));
}
@@ -206,7 +206,7 @@ public class CreateReportLog {
"<br><gold>Please enter the following key in the ticket:</gold> <yellow>[key]</yellow>." +
"<br><dark_red>Do not share the download URL with anyone!</dark_red>" +
"<br><color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color>" +
"<br><dark_red>You can delte yor Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
"<br><dark_red>You can delete your Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
.replace("[key]", fileID).replace("[url]", downloadURL));
ReportLogStorage.add(fileID);
}

View File

@@ -33,6 +33,8 @@ public class ConfigCreate {
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
T2Cconfig.set("Command.PermToggle.PermissionSetCommand","lp user [player] permission set [perm] [value]",yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {

View File

@@ -28,6 +28,8 @@ public class SelectLibConfig {
private static Boolean bungee;
@Getter
private static Boolean inventoriesCloseByServerStop;
@Getter
private static String commandPermToggleCommand;
public static void onSelect() {
File config = new File(T2CodeLibMain.getPath(), "config.yml");
@@ -46,5 +48,6 @@ public class SelectLibConfig {
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
commandPermToggleCommand = yamlConfiguration.getString("Command.PermToggle.PermissionSetCommand");
}
}

View File

@@ -29,3 +29,7 @@ commands:
permissions:
t2code.admin:
default: op
children:
t2code.permtoggle.use: true
t2code.permtoggle.use:
default: op