This commit is contained in:
JaTiTV 2022-07-08 19:06:22 +02:00
parent c89afa3c68
commit 8f05d5c677
9 changed files with 51 additions and 50 deletions

View File

@ -13,7 +13,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" 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">

View File

@ -4,7 +4,7 @@
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_dev-1</version>
<version>12.4</version>
<!-- <classifier>dev-1</classifier> -->
<groupId>net.t2code</groupId>

View File

@ -7,25 +7,36 @@ import net.md_5.bungee.api.chat.ClickEvent;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.lib.Spigot.system.T2CodeMain;
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
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("/*/") || !SelectLibConfig.getMiniMessage()) {
public static void modulePlayer(String msg, Player player) {
if (msg.contains("/*/")) {
t2cmodule(msg, player);
return;
}
MiniMessage mm = MiniMessage.miniMessage();
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("/\\*/");

View File

@ -20,7 +20,7 @@ public class send {
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) {
@ -37,7 +37,7 @@ public class send {
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) {

View File

@ -118,28 +118,28 @@ public class Replace {
.replace("&o", "§o").replace("&r", "§r");
}
public static String convertColorCode(String msg) {
return msg.replace("§0", "<black>")
.replace("§1", "<dark_blue>")
.replace("§2", "<dark_green>")
.replace("§3", "<dark_aqua>")
.replace("§4", "<dark_red>")
.replace("§5", "<dark_purple>")
.replace("§6", "<gold>")
.replace("§7", "<gray>")
.replace("§8", "<dark_gray>")
.replace("§9", "<blue>")
.replace("§a", "<green>")
.replace("§b", "<aqua>")
.replace("§c", "<red>")
.replace("§d", "<light_purple>")
.replace("§e", "<yellow>")
.replace("§f", "<white>")
.replace("§k", "<obfuscated>")
.replace("§l", "<bold>")
.replace("§m", "<strikethrough>")
.replace("§n", "<underlined>")
.replace("§o", "<italic>")
.replace("§r", "<reset>");
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>");
}
}

View File

@ -81,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);
}

View File

@ -18,7 +18,6 @@ import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File;
import java.util.List;
@ -128,7 +127,7 @@ public final class T2CodeMain extends JavaPlugin {
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.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 {
@ -172,8 +171,6 @@ public final class T2CodeMain extends JavaPlugin {
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
T2CodeTemplate.onLoadFooter(prefix, long_);
}
@Override
public void onDisable() {
// Plugin shutdown logic

View File

@ -29,8 +29,6 @@ public class ConfigCreate {
Config.set("BungeeCord.ThisServer", "server", yamlConfiguration);
Config.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
Config.set("PlayerMessage.MiniMessage", false,yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {

View File

@ -14,7 +14,6 @@ public class SelectLibConfig {
private static Boolean Debug;
private static String language;
private static Boolean InventoriesCloseByServerStop;
private static Boolean miniMessage;
public static void onSelect() {
File config = new File(T2CodeMain.getPath(), "config.yml");
@ -26,7 +25,6 @@ public class SelectLibConfig {
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
language = yamlConfiguration.getString("Plugin.language");
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
miniMessage = yamlConfiguration.getBoolean("PlayerMessage.MiniMessage");
}
public static Boolean getUpdateCheckOnJoin() {
@ -53,7 +51,4 @@ public class SelectLibConfig {
return InventoriesCloseByServerStop;
}
public static Boolean getMiniMessage() {
return miniMessage;
}
}