T2CodeLib api update to 16.7
This commit is contained in:
JaTiTV 2024-07-08 07:20:05 +02:00
parent ea4fb0b88d
commit 60cd82ef1f
9 changed files with 32 additions and 33 deletions

10
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>AutomatedMessages</artifactId> <artifactId>AutomatedMessages</artifactId>
<version>1.2</version> <version>1.3_dev</version>
<!--version>VERSION_snapshot-0</version--> <!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version--> <!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version--> <!--version>VERSION_dev-0</version-->
@ -77,22 +77,22 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version> <version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- t2code --> <!-- t2code -->
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>15.9</version> <version>16.7</version>
<classifier>dev-2</classifier> <classifier>dev-24</classifier>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.24</version> <version>1.18.30</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -8,7 +8,7 @@ public class Util {
private static String infoText = ""; private static String infoText = "";
@Getter @Getter
private static String requiredT2CodeLibVersion = "15.9"; private static String requiredT2CodeLibVersion = "16.7";
@Getter @Getter
private static String prefix = "<dark_gray>[<dark_red>T2C</dark_red>-<color:#5cff5c>Automated</color><color:#69d2ff>Messages</color>]</dark_gray>"; private static String prefix = "<dark_gray>[<dark_red>T2C</dark_red>-<color:#5cff5c>Automated</color><color:#69d2ff>Messages</color>]</dark_gray>";

View File

@ -3,7 +3,7 @@
package net.t2code.automatedMessages.command; package net.t2code.automatedMessages.command;
import net.t2code.automatedMessages.Util; import net.t2code.automatedMessages.Util;
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab; import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Tab;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -49,7 +49,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override @Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) { public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
T2Ctab.tab(list,sender,0,args,arg1); T2C_Tab.tab(list,sender,0,args,arg1);
return list; return list;
} }
} }

View File

@ -6,26 +6,26 @@ import net.t2code.automatedMessages.config.FileBuild;
import net.t2code.automatedMessages.config.messages.MessagesSelect; import net.t2code.automatedMessages.config.messages.MessagesSelect;
import net.t2code.automatedMessages.messages.Management; import net.t2code.automatedMessages.messages.Management;
import net.t2code.automatedMessages.system.Main; import net.t2code.automatedMessages.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Commands { public class Commands {
public static void reload(CommandSender sender) { public static void reload(CommandSender sender) {
T2Csend.console(Config.msgReloadStart.valueString); T2C_Send.console(Config.msgReloadStart.valueString);
if (sender instanceof Player) T2Csend.sender(sender, Config.msgReloadStart.valueString); if (sender instanceof Player) T2C_Send.sender(sender, Config.msgReloadStart.valueString);
Management.end(); Management.end();
FileBuild.selectConfig(); FileBuild.selectConfig();
MessagesSelect.select(); MessagesSelect.select();
Management.start(); Management.start();
if (sender instanceof Player) T2Csend.sender(sender, Config.msgReloadEnd.valueString); if (sender instanceof Player) T2C_Send.sender(sender, Config.msgReloadEnd.valueString);
T2Csend.console(Config.msgReloadEnd.valueString); T2C_Send.console(Config.msgReloadEnd.valueString);
} }
public static void info(CommandSender sender) { public static void info(CommandSender sender) {
T2Ctemplate.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText()); T2C_Template.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
} }
} }

View File

@ -2,7 +2,7 @@ package net.t2code.automatedMessages.config;
import net.t2code.automatedMessages.Util; import net.t2code.automatedMessages.Util;
import net.t2code.automatedMessages.system.Main; import net.t2code.automatedMessages.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
@ -21,7 +21,7 @@ public class FileBuild {
if (!yamlConfiguration.contains(value.path)) { if (!yamlConfiguration.contains(value.path)) {
yamlConfiguration.set(value.path, value.valueString); yamlConfiguration.set(value.path, value.valueString);
} }
value.valueString = T2Creplace.replace(Util.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(value.path))); value.valueString = T2C_Replace.replace(Util.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(value.path)));
break; break;
case BOOLEAN: case BOOLEAN:
if (!yamlConfiguration.contains(value.path)) { if (!yamlConfiguration.contains(value.path)) {

View File

@ -3,13 +3,12 @@ package net.t2code.automatedMessages.config.messages;
import lombok.Getter; import lombok.Getter;
import net.t2code.automatedMessages.objects.Message; import net.t2code.automatedMessages.objects.Message;
import net.t2code.automatedMessages.system.Main; import net.t2code.automatedMessages.system.Main;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion; import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Objects;
public class MessagesSelect { public class MessagesSelect {
@ -84,9 +83,9 @@ public class MessagesSelect {
} }
static Sound sound() { static Sound sound() {
if (T2CmcVersion.isMc1_8()) { if (T2C_McVersion.isMc1_8()) {
return Sound.valueOf("NOTE_PIANO"); return Sound.valueOf("NOTE_PIANO");
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) { } else if (T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
return Sound.valueOf("BLOCK_NOTE_HARP"); return Sound.valueOf("BLOCK_NOTE_HARP");
} else return Sound.BLOCK_NOTE_BLOCK_HARP; } else return Sound.BLOCK_NOTE_BLOCK_HARP;
} }

View File

@ -2,7 +2,7 @@ package net.t2code.automatedMessages.messages;
import net.t2code.automatedMessages.config.Config; import net.t2code.automatedMessages.config.Config;
import net.t2code.automatedMessages.objects.Message; import net.t2code.automatedMessages.objects.Message;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -13,11 +13,11 @@ public class SendMessage {
public static void send(Message message) { public static void send(Message message) {
String timeStamp = new SimpleDateFormat(Config.timeFormat.valueString).format(Calendar.getInstance().getTime()); String timeStamp = new SimpleDateFormat(Config.timeFormat.valueString).format(Calendar.getInstance().getTime());
if (Config.sendConsole.valueBoolean) { if (Config.sendConsole.valueBoolean) {
T2Csend.console(replace(message.message, Map.entry("[time]", timeStamp), Map.entry("[prefix]", Config.prefix.valueString))); T2C_Send.console(replace(message.message, Map.entry("[time]", timeStamp), Map.entry("[prefix]", Config.prefix.valueString)));
} }
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasPermission(message.permission) || !message.permissionNeededToSeeMessage) { if (player.hasPermission(message.permission) || !message.permissionNeededToSeeMessage) {
T2Csend.player(player, replace(message.message, Map.entry("[time]", timeStamp), Map.entry("[prefix]", Config.prefix.valueString), Map.entry("[player]", player.getName()))); T2C_Send.player(player, replace(message.message, Map.entry("[time]", timeStamp), Map.entry("[prefix]", Config.prefix.valueString), Map.entry("[player]", player.getName())));
player.playSound(player.getLocation(), message.sound, 3, 1); player.playSound(player.getLocation(), message.sound, 3, 1);
} }
} }

View File

@ -6,15 +6,15 @@ import net.t2code.automatedMessages.config.Config;
import net.t2code.automatedMessages.config.FileBuild; import net.t2code.automatedMessages.config.FileBuild;
import net.t2code.automatedMessages.config.messages.MessagesSelect; import net.t2code.automatedMessages.config.messages.MessagesSelect;
import net.t2code.automatedMessages.messages.Management; import net.t2code.automatedMessages.messages.Management;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
public class Load { public class Load {
public static void onLoad(@NotNull Main plugin, List<String> autor, String version) { public static void onLoad(@NotNull Main plugin, List<String> autor, String version) {
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord()); long long_ = T2C_Template.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
plugin.getCommand("t2c-automatedmessages").setExecutor(new CmdExecuter()); plugin.getCommand("t2c-automatedmessages").setExecutor(new CmdExecuter());
FileBuild.selectConfig(); FileBuild.selectConfig();
@ -22,10 +22,10 @@ public class Load {
Management.start(); Management.start();
T2CupdateAPI.onUpdateCheck(plugin, Util.getPrefix(), Util.getGit(), Util.getSpigotID(), Util.getDiscord(), Config.updateCheckOnJoin.valueBoolean, T2C_UpdateAPI.onUpdateCheck(plugin, Util.getPrefix(), Util.getGit(), Util.getSpigotID(), Util.getDiscord(), Config.updateCheckOnJoin.valueBoolean,
Config.updateCheckSeePreReleaseUpdates.valueBoolean, Config.updateCheckTimeInterval.valueInteger); Config.updateCheckSeePreReleaseUpdates.valueBoolean, Config.updateCheckTimeInterval.valueInteger);
Metrics.Bstats(plugin, Util.getBstatsID()); Metrics.Bstats(plugin, Util.getBstatsID());
T2Ctemplate.onLoadFooter(Util.getPrefix(), long_); T2C_Template.onLoadFooter(Util.getPrefix(), long_);
} }
} }

View File

@ -2,8 +2,8 @@ package net.t2code.automatedMessages.system;
import lombok.Getter; import lombok.Getter;
import net.t2code.automatedMessages.Util; import net.t2code.automatedMessages.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
@ -43,7 +43,7 @@ public final class Main extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
// Plugin shutdown logic // Plugin shutdown logic
if (t2codeLib) T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord()); if (t2codeLib) T2C_Template.onDisable(Util.getPrefix(),plugin);
} }
private static @NotNull Boolean pluginNotFound(String pl, Integer spigotID, String ver) { private static @NotNull Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
@ -79,6 +79,6 @@ public final class Main extends JavaPlugin {
} }
} }
public static void sendTryCatch(Class c, StackTraceElement line) { public static void sendTryCatch(Class c, StackTraceElement line) {
T2Csend.error(plugin,c.getName() + " Line: " + line.getLineNumber()); T2C_Send.error(plugin,c.getName() + " Line: " + line.getLineNumber());
} }
} }