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>
<artifactId>AutomatedMessages</artifactId>
<version>1.2</version>
<version>1.3_dev</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->
@ -77,22 +77,22 @@
<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>
<!-- t2code -->
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>15.9</version>
<classifier>dev-2</classifier>
<version>16.7</version>
<classifier>dev-24</classifier>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -8,7 +8,7 @@ public class Util {
private static String infoText = "";
@Getter
private static String requiredT2CodeLibVersion = "15.9";
private static String requiredT2CodeLibVersion = "16.7";
@Getter
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;
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.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -49,7 +49,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>();
T2Ctab.tab(list,sender,0,args,arg1);
T2C_Tab.tab(list,sender,0,args,arg1);
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.messages.Management;
import net.t2code.automatedMessages.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commands {
public static void reload(CommandSender sender) {
T2Csend.console(Config.msgReloadStart.valueString);
if (sender instanceof Player) T2Csend.sender(sender, Config.msgReloadStart.valueString);
T2C_Send.console(Config.msgReloadStart.valueString);
if (sender instanceof Player) T2C_Send.sender(sender, Config.msgReloadStart.valueString);
Management.end();
FileBuild.selectConfig();
MessagesSelect.select();
Management.start();
if (sender instanceof Player) T2Csend.sender(sender, Config.msgReloadEnd.valueString);
T2Csend.console(Config.msgReloadEnd.valueString);
if (sender instanceof Player) T2C_Send.sender(sender, Config.msgReloadEnd.valueString);
T2C_Send.console(Config.msgReloadEnd.valueString);
}
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.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 java.io.File;
@ -21,7 +21,7 @@ public class FileBuild {
if (!yamlConfiguration.contains(value.path)) {
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;
case BOOLEAN:
if (!yamlConfiguration.contains(value.path)) {

View File

@ -3,13 +3,12 @@ package net.t2code.automatedMessages.config.messages;
import lombok.Getter;
import net.t2code.automatedMessages.objects.Message;
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.configuration.file.YamlConfiguration;
import java.io.File;
import java.util.HashMap;
import java.util.Objects;
public class MessagesSelect {
@ -84,9 +83,9 @@ public class MessagesSelect {
}
static Sound sound() {
if (T2CmcVersion.isMc1_8()) {
if (T2C_McVersion.isMc1_8()) {
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");
} 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.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.entity.Player;
@ -13,11 +13,11 @@ public class SendMessage {
public static void send(Message message) {
String timeStamp = new SimpleDateFormat(Config.timeFormat.valueString).format(Calendar.getInstance().getTime());
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()) {
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);
}
}

View File

@ -6,15 +6,15 @@ import net.t2code.automatedMessages.config.Config;
import net.t2code.automatedMessages.config.FileBuild;
import net.t2code.automatedMessages.config.messages.MessagesSelect;
import net.t2code.automatedMessages.messages.Management;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class Load {
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());
FileBuild.selectConfig();
@ -22,10 +22,10 @@ public class Load {
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);
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 net.t2code.automatedMessages.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Contract;
@ -43,7 +43,7 @@ public final class Main extends JavaPlugin {
@Override
public void onDisable() {
// 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) {
@ -79,6 +79,6 @@ public final class Main extends JavaPlugin {
}
}
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());
}
}