From cb7509eff2fbdbdd97584b81241537486f12f83a Mon Sep 17 00:00:00 2001 From: Deliable Date: Mon, 4 Jul 2022 21:50:49 +0200 Subject: [PATCH 1/5] Added lang.yml support --- src/com/entryrise/lagassist/Main.java | 301 +++++++++++++------------- 1 file changed, 153 insertions(+), 148 deletions(-) diff --git a/src/com/entryrise/lagassist/Main.java b/src/com/entryrise/lagassist/Main.java index 2d0a72a..3ce54f5 100644 --- a/src/com/entryrise/lagassist/Main.java +++ b/src/com/entryrise/lagassist/Main.java @@ -1,148 +1,153 @@ -package com.entryrise.lagassist; - -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; - -import com.entryrise.lagassist.api.APIManager; -import com.entryrise.lagassist.chunks.ChkAnalyse; -import com.entryrise.lagassist.chunks.ChkLimiter; -import com.entryrise.lagassist.chunks.DynViewer; -import com.entryrise.lagassist.client.ClientMain; -import com.entryrise.lagassist.cmd.CommandListener; -import com.entryrise.lagassist.cmd.CommandTabListener; -import com.entryrise.lagassist.cmd.StatsAnalyse; -import com.entryrise.lagassist.economy.EconomyManager; -import com.entryrise.lagassist.gui.DataGUI; -import com.entryrise.lagassist.hoppers.HopperManager; -import com.entryrise.lagassist.logpurger.PurgerMain; -import com.entryrise.lagassist.metrics.MetricsManager; -import com.entryrise.lagassist.microfeatures.MicroManager; -import com.entryrise.lagassist.mobs.SmartMob; -import com.entryrise.lagassist.mobs.SpawnerMgr; -import com.entryrise.lagassist.packets.PacketInjector; -import com.entryrise.lagassist.packets.PacketMain; -import com.entryrise.lagassist.packets.Reflection; -import com.entryrise.lagassist.safety.SafetyManager; -import com.entryrise.lagassist.stacker.StackManager; -import com.entryrise.lagassist.updater.SmartUpdater; -import com.entryrise.lagassist.utils.Others; -import com.entryrise.lagassist.utils.VersionMgr; -import com.entryrise.lagassist.utils.WorldMgr; - -public class Main extends JavaPlugin implements Listener { - - public static String USER = "%%__USER__%%"; - - public static final String PREFIX = "§2§lLag§f§lAssist §e» §f"; - - public static JavaPlugin p; - public static boolean paper = false; - - // Debug mode means people will get verbose info. - public static int debug = 0; - - private static File file; - public static FileConfiguration config = new YamlConfiguration(); - - @Override - public void onEnable() { - p = this; - - file = new File(getDataFolder(), "server.yml"); - config = Others.getConfig(file, 32); - - paper = VersionMgr.isPaper(); - - // Start Smart updater to check for updates. - SmartUpdater.Enabler(); - - Bukkit.getLogger().info(Main.PREFIX + "Enabling Systems:"); - EnableClasses(false); - - getServer().getPluginManager().registerEvents(this, this); - getCommand("lagassist").setExecutor(new CommandListener()); - getCommand("lagassist").setTabCompleter(new CommandTabListener()); - } - - private static void EnableClasses(boolean reload) { - - EconomyManager.Enabler(reload); - - SafetyManager.Enabler(reload); - Reflection.Enabler(); - Data.Enabler(); - SmartMob.Enabler(reload); - MicroManager.Enabler(reload); - HopperManager.Enabler(reload); - StackManager.Enabler(reload); - Redstone.Enabler(reload); - Physics.Enabler(reload); - Monitor.Enabler(reload); - MonTools.Enabler(reload); - WorldMgr.Enabler(); - ChkAnalyse.Enabler(); - ChkLimiter.Enabler(reload); - StatsAnalyse.Enabler(reload); - PurgerMain.Enabler(); - - SpawnerMgr.Enabler(reload); - DynViewer.Enabler(reload); - ClientMain.Enabler(); - DataGUI.Enabler(reload); - - MetricsManager.Enabler(reload); - - PacketMain.Enabler(reload); - - // API ICON - APIManager.Enabler(reload); - } - - public static void ReloadPlugin(CommandSender s) { - config = Others.getConfig(file, 32); - - Bukkit.getLogger().info(Main.PREFIX + "Reloading Systems:"); - EnableClasses(true); - - s.sendMessage(Main.PREFIX + "Reloaded the config successfully."); - } - - @Override - public void onDisable() { - if (PacketMain.isPacketEnabled()) { - PacketInjector.Disabler(); - } - StackManager.Disabler(); - } - - public static void sendDebug(String msg, int mindebug) { - if (mindebug > debug) { - return; - } - - for (Player p : Bukkit.getOnlinePlayers()) { - if (!p.hasPermission("lagassist.debug")) { - continue; - } - - p.sendMessage(msg + "(MINDEBUG: " + mindebug + ")"); - } - - if (debug == 3) { - try { - throw new Exception(msg); - } catch (Exception e) { - e.printStackTrace(); - } - return; - } - } - -} +package com.entryrise.lagassist; + +import java.io.File; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import com.entryrise.lagassist.api.APIManager; +import com.entryrise.lagassist.chunks.ChkAnalyse; +import com.entryrise.lagassist.chunks.ChkLimiter; +import com.entryrise.lagassist.chunks.DynViewer; +import com.entryrise.lagassist.client.ClientMain; +import com.entryrise.lagassist.cmd.CommandListener; +import com.entryrise.lagassist.cmd.CommandTabListener; +import com.entryrise.lagassist.cmd.StatsAnalyse; +import com.entryrise.lagassist.economy.EconomyManager; +import com.entryrise.lagassist.gui.DataGUI; +import com.entryrise.lagassist.hoppers.HopperManager; +import com.entryrise.lagassist.logpurger.PurgerMain; +import com.entryrise.lagassist.metrics.MetricsManager; +import com.entryrise.lagassist.microfeatures.MicroManager; +import com.entryrise.lagassist.mobs.SmartMob; +import com.entryrise.lagassist.mobs.SpawnerMgr; +import com.entryrise.lagassist.packets.PacketInjector; +import com.entryrise.lagassist.packets.PacketMain; +import com.entryrise.lagassist.packets.Reflection; +import com.entryrise.lagassist.safety.SafetyManager; +import com.entryrise.lagassist.stacker.StackManager; +import com.entryrise.lagassist.updater.SmartUpdater; +import com.entryrise.lagassist.utils.Others; +import com.entryrise.lagassist.utils.VersionMgr; +import com.entryrise.lagassist.utils.WorldMgr; + +public class Main extends JavaPlugin implements Listener { + + public static String USER = "%%__USER__%%"; + + public static JavaPlugin p; + public static boolean paper = false; + + // Debug mode means people will get verbose info. + public static int debug = 0; + + private static File file; + public static FileConfiguration config = new YamlConfiguration(); + + private static File langfile = new File(getDataFolder(), "lang.yml"); + public static YamlConfiguration lang = new YamlConfiguration(); + + public static final String PREFIX = "§2§lLag§f§lAssist §e» §f"; + + @Override + public void onEnable() { + p = this; + + file = new File(getDataFolder(), "server.yml"); + + config = Others.getConfig(file, 32); + lang = Others.getConfig(langfile, 1); + + paper = VersionMgr.isPaper(); + + // Start Smart updater to check for updates. + SmartUpdater.Enabler(); + + Bukkit.getLogger().info(Main.PREFIX + "Enabling Systems:"); + EnableClasses(false); + + getServer().getPluginManager().registerEvents(this, this); + getCommand("lagassist").setExecutor(new CommandListener()); + getCommand("lagassist").setTabCompleter(new CommandTabListener()); + } + + private static void EnableClasses(boolean reload) { + + EconomyManager.Enabler(reload); + + SafetyManager.Enabler(reload); + Reflection.Enabler(); + Data.Enabler(); + SmartMob.Enabler(reload); + MicroManager.Enabler(reload); + HopperManager.Enabler(reload); + StackManager.Enabler(reload); + Redstone.Enabler(reload); + Physics.Enabler(reload); + Monitor.Enabler(reload); + MonTools.Enabler(reload); + WorldMgr.Enabler(); + ChkAnalyse.Enabler(); + ChkLimiter.Enabler(reload); + StatsAnalyse.Enabler(reload); + PurgerMain.Enabler(); + + SpawnerMgr.Enabler(reload); + DynViewer.Enabler(reload); + ClientMain.Enabler(); + DataGUI.Enabler(reload); + + MetricsManager.Enabler(reload); + + PacketMain.Enabler(reload); + + // API ICON + APIManager.Enabler(reload); + } + + public static void ReloadPlugin(CommandSender s) { + config = Others.getConfig(file, 32); + + Bukkit.getLogger().info(Main.PREFIX + "Reloading Systems:"); + EnableClasses(true); + + s.sendMessage(Main.PREFIX + "Reloaded the config successfully."); + } + + @Override + public void onDisable() { + if (PacketMain.isPacketEnabled()) { + PacketInjector.Disabler(); + } + StackManager.Disabler(); + } + + public static void sendDebug(String msg, int mindebug) { + if (mindebug > debug) { + return; + } + + for (Player p : Bukkit.getOnlinePlayers()) { + if (!p.hasPermission("lagassist.debug")) { + continue; + } + + p.sendMessage(msg + "(MINDEBUG: " + mindebug + ")"); + } + + if (debug == 3) { + try { + throw new Exception(msg); + } catch (Exception e) { + e.printStackTrace(); + } + return; + } + } + +} -- 2.30.2 From 3d499022af8e9600c48577b6b9eb4eb92495c60e Mon Sep 17 00:00:00 2001 From: Deliable Date: Mon, 4 Jul 2022 21:59:36 +0200 Subject: [PATCH 2/5] Update 'src/com/entryrise/lagassist/api/MotdAPI.java' --- src/com/entryrise/lagassist/api/MotdAPI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/entryrise/lagassist/api/MotdAPI.java b/src/com/entryrise/lagassist/api/MotdAPI.java index 4d7c89e..cb8a42b 100644 --- a/src/com/entryrise/lagassist/api/MotdAPI.java +++ b/src/com/entryrise/lagassist/api/MotdAPI.java @@ -24,7 +24,7 @@ public class MotdAPI implements Listener { String saddr = addr.getHostAddress(); - Main.sendDebug("Received ping from " + saddr, 1); + Main.sendDebug(Main.lang.getString("debug.ping.received").replace("$1", saddr), 1); boolean found = false; @@ -41,7 +41,7 @@ public class MotdAPI implements Listener { return; } - Main.sendDebug("API ping response to " + saddr, 1); + Main.sendDebug(Main.lang.getString("debug.ping.response").replace("$1", saddr), 1); try { e.setServerIcon(generateIcon()); -- 2.30.2 From 74bd7292ef554a05b8103b710d3b62c223ceb7b7 Mon Sep 17 00:00:00 2001 From: Deliable Date: Mon, 4 Jul 2022 22:16:23 +0200 Subject: [PATCH 3/5] Update 'src/com/entryrise/lagassist/chunks/ChkAnalyse.java' --- .../lagassist/chunks/ChkAnalyse.java | 289 +++++++++--------- 1 file changed, 144 insertions(+), 145 deletions(-) diff --git a/src/com/entryrise/lagassist/chunks/ChkAnalyse.java b/src/com/entryrise/lagassist/chunks/ChkAnalyse.java index 90d2f54..fc4fc3f 100644 --- a/src/com/entryrise/lagassist/chunks/ChkAnalyse.java +++ b/src/com/entryrise/lagassist/chunks/ChkAnalyse.java @@ -1,145 +1,144 @@ -package com.entryrise.lagassist.chunks; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.BlockState; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; - -import com.entryrise.lagassist.Main; - -public class ChkAnalyse { - - protected static int ammoshow = Main.config.getInt("chunkanalyse.ammount"); - protected static Map values = new HashMap(); - private static List scores = new ArrayList(); - - public static void Enabler() { - Bukkit.getLogger().info(" §e[§a✔§e] §fChunk Analyser."); - - Set slist = Main.config.getConfigurationSection("chunkanalyse.values").getKeys(false); - - for (String s : slist) { - int value = Main.config.getInt("chunkanalyse.values." + s); - values.put(s.toLowerCase(), value); - } - } - - public static void analyseChunks(Player p) { - scores.clear(); - for (World w : Bukkit.getWorlds()) { - for (Chunk ch : w.getLoadedChunks()) { - scores.add(new ChkStats(ch, false)); - } - } - Bukkit.getScheduler().runTaskAsynchronously(Main.p, new Runnable() { - @Override - public void run() { - - for (ChkStats ch : scores) { - ch.genScores(); - } - Collections.sort(scores); - p.sendMessage(""); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER §2§l⬛⬛⬛⬛⬛⬛"); - p.sendMessage(""); - - for (int i = 0; i < ammoshow; i++) { - ChkStats cs = scores.get(i); - p.spigot().sendMessage(cs.genText()); - } - - p.sendMessage(""); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); - } - }); - - } - - public static void analyseChunks(CommandSender p) { - Map chunkscore = new HashMap(); - for (World w : Bukkit.getWorlds()) { - for (Chunk ch : w.getLoadedChunks()) { - if (!chunkscore.containsKey(ch)) { - chunkscore.put(ch, 0); - } - BlockState[] tiles = ch.getTileEntities(); - for (BlockState blkst : tiles) { - String m = blkst.getType().toString().toLowerCase(); - if (values.containsKey(m)) { - chunkscore.put(ch, chunkscore.get(ch) + values.get(m)); - } - } - Entity[] ents = ch.getEntities(); - for (Entity e : ents) { - String et = e.getType().toString().toLowerCase(); - if (values.containsKey(et)) { - chunkscore.put(ch, chunkscore.get(ch) + values.get(et)); - } - } - - } - } - p.sendMessage(""); - p.sendMessage("⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER ⬛⬛⬛⬛⬛⬛"); - p.sendMessage(""); - - Stream> sorted = chunkscore.entrySet().stream() - .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())); - - Map topTen = sorted.limit(ammoshow) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); - - for (Chunk ch : topTen.keySet()) { - int score = chunkscore.get(ch); - p.sendMessage(" ✸ Chunk (" + String.valueOf(ch.getX()) + " " + String.valueOf(ch.getZ()) + ") - Score " - + String.valueOf(score)); - } - p.sendMessage(""); - p.sendMessage("⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); - - } - - public static void analyseCurrentChunk(CommandSender s) { - if (!(s instanceof Player)) { - s.sendMessage(Main.PREFIX + "You cannot analyse the current chunk from console."); - return; - } - Player p = (Player) s; - Location l = p.getLocation(); - ChkStats stats = new ChkStats(l.getChunk(), true); - - int coords[] = stats.getCoords(); - - String crds = String.valueOf(coords[0]) + " " + String.valueOf(coords[1]); - - String cmd = "lagassist tpchunk " + p.getWorld().getName() + " " + String.valueOf(coords[0]) + " " - + String.valueOf(coords[1]); - - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNK STATS §2§l⬛⬛⬛⬛⬛⬛"); - p.sendMessage(""); - p.sendMessage(" §2✸ §fChunk coordonates: §7" + crds); - p.sendMessage(""); - p.sendMessage(" §2✸ §fEntity Amount: §7" + stats.getEnts().length); - p.sendMessage(" §2✸ §fTiles Amount: §7" + stats.getTiles().length); - p.sendMessage(""); - p.spigot().sendMessage(stats.genMobCount(" §2✸ §fDetailed Info §7(HOVER)", cmd)); - p.sendMessage(""); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); - - } - -} +package com.entryrise.lagassist.chunks; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.BlockState; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import com.entryrise.lagassist.Main; + +public class ChkAnalyse { + + protected static int ammoshow = Main.config.getInt("chunkanalyse.amount"); + protected static Map values = new HashMap(); + private static List scores = new ArrayList(); + + public static void Enabler() { + Bukkit.getLogger().info(" §e[§a✔§e] §fChunk Analyser."); + + Set slist = Main.config.getConfigurationSection("chunkanalyse.values").getKeys(false); + + for (String s : slist) { + int value = Main.config.getInt("chunkanalyse.values." + s); + values.put(s.toLowerCase(), value); + } + } + + public static void analyseChunks(Player p) { + scores.clear(); + for (World w : Bukkit.getWorlds()) { + for (Chunk ch : w.getLoadedChunks()) { + scores.add(new ChkStats(ch, false)); + } + } + Bukkit.getScheduler().runTaskAsynchronously(Main.p, new Runnable() { + @Override + public void run() { + + for (ChkStats ch : scores) { + ch.genScores(); + } + Collections.sort(scores); + p.sendMessage(""); + p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER §2§l⬛⬛⬛⬛⬛⬛"); + p.sendMessage(""); + + for (int i = 0; i < ammoshow; i++) { + ChkStats cs = scores.get(i); + p.spigot().sendMessage(cs.genText()); + } + + p.sendMessage(""); + p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); + } + }); + + } + + public static void analyseChunks(CommandSender p) { + Map chunkscore = new HashMap(); + for (World w : Bukkit.getWorlds()) { + for (Chunk ch : w.getLoadedChunks()) { + if (!chunkscore.containsKey(ch)) { + chunkscore.put(ch, 0); + } + BlockState[] tiles = ch.getTileEntities(); + for (BlockState blkst : tiles) { + String m = blkst.getType().toString().toLowerCase(); + if (values.containsKey(m)) { + chunkscore.put(ch, chunkscore.get(ch) + values.get(m)); + } + } + Entity[] ents = ch.getEntities(); + for (Entity e : ents) { + String et = e.getType().toString().toLowerCase(); + if (values.containsKey(et)) { + chunkscore.put(ch, chunkscore.get(ch) + values.get(et)); + } + } + + } + } + Stream> sorted = chunkscore.entrySet().stream() + .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())); + + Map topTen = sorted.limit(ammoshow) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); + + for (Chunk ch : topTen.keySet()) { + int score = chunkscore.get(ch); + p.sendMessage(""); + p.sendMessage("⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER ⬛⬛⬛⬛⬛⬛"); + p.sendMessage(""); + p.sendMessage(""); + p.sendMessage("⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); + for (String str : Main.lang.getStringList("chunkanalyse.result")) { + p.sendMessage(str.replace("$1", String.valueOf(ch.getX()) + " " + String.valueOf(ch.getZ())).replace("$2", String.valueOf(score))) + } + } + } + + public static void analyseCurrentChunk(CommandSender s) { + if (!(s instanceof Player)) { + s.sendMessage(Main.PREFIX + "You cannot analyse the current chunk from console."); + return; + } + Player p = (Player) s; + Location l = p.getLocation(); + ChkStats stats = new ChkStats(l.getChunk(), true); + + int coords[] = stats.getCoords(); + + String crds = String.valueOf(coords[0]) + " " + String.valueOf(coords[1]); + + String cmd = "lagassist tpchunk " + p.getWorld().getName() + " " + String.valueOf(coords[0]) + " " + + String.valueOf(coords[1]); + + p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNK STATS §2§l⬛⬛⬛⬛⬛⬛"); + p.sendMessage(""); + p.sendMessage(" §2✸ §fChunk coordonates: §7" + crds); + p.sendMessage(""); + p.sendMessage(" §2✸ §fEntity Amount: §7" + stats.getEnts().length); + p.sendMessage(" §2✸ §fTiles Amount: §7" + stats.getTiles().length); + p.sendMessage(""); + p.spigot().sendMessage(stats.genMobCount(" §2✸ §fDetailed Info §7(HOVER)", cmd)); + p.sendMessage(""); + p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); + + } + +} -- 2.30.2 From cc88b1360cdbd7ee9d07115210a1bae838332ebe Mon Sep 17 00:00:00 2001 From: Deliable Date: Mon, 4 Jul 2022 22:39:31 +0200 Subject: [PATCH 4/5] Update 'src/com/entryrise/lagassist/chunks/ChkAnalyse.java' --- .../lagassist/chunks/ChkAnalyse.java | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/src/com/entryrise/lagassist/chunks/ChkAnalyse.java b/src/com/entryrise/lagassist/chunks/ChkAnalyse.java index fc4fc3f..e96500b 100644 --- a/src/com/entryrise/lagassist/chunks/ChkAnalyse.java +++ b/src/com/entryrise/lagassist/chunks/ChkAnalyse.java @@ -53,17 +53,17 @@ public class ChkAnalyse { ch.genScores(); } Collections.sort(scores); - p.sendMessage(""); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER §2§l⬛⬛⬛⬛⬛⬛"); - p.sendMessage(""); for (int i = 0; i < ammoshow; i++) { ChkStats cs = scores.get(i); - p.spigot().sendMessage(cs.genText()); + for (String str : Main.lang.getStringList("chunkanalyse.result1")) { + if (str.contains("$1")) { + p.spigot().sendMessage(cs.genText()) + } else { + p.sendMessage(str.replace("$1", cs.genText())) + } + } } - - p.sendMessage(""); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); } }); @@ -101,12 +101,7 @@ public class ChkAnalyse { for (Chunk ch : topTen.keySet()) { int score = chunkscore.get(ch); - p.sendMessage(""); - p.sendMessage("⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER ⬛⬛⬛⬛⬛⬛"); - p.sendMessage(""); - p.sendMessage(""); - p.sendMessage("⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); - for (String str : Main.lang.getStringList("chunkanalyse.result")) { + for (String str : Main.lang.getStringList("chunkanalyse.result2")) { p.sendMessage(str.replace("$1", String.valueOf(ch.getX()) + " " + String.valueOf(ch.getZ())).replace("$2", String.valueOf(score))) } } @@ -114,7 +109,7 @@ public class ChkAnalyse { public static void analyseCurrentChunk(CommandSender s) { if (!(s instanceof Player)) { - s.sendMessage(Main.PREFIX + "You cannot analyse the current chunk from console."); + s.sendMessage(Main.PREFIX + Main.lang.getString("errors.chunkanalyse.console-execution")); return; } Player p = (Player) s; @@ -128,17 +123,13 @@ public class ChkAnalyse { String cmd = "lagassist tpchunk " + p.getWorld().getName() + " " + String.valueOf(coords[0]) + " " + String.valueOf(coords[1]); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNK STATS §2§l⬛⬛⬛⬛⬛⬛"); - p.sendMessage(""); - p.sendMessage(" §2✸ §fChunk coordonates: §7" + crds); - p.sendMessage(""); - p.sendMessage(" §2✸ §fEntity Amount: §7" + stats.getEnts().length); - p.sendMessage(" §2✸ §fTiles Amount: §7" + stats.getTiles().length); - p.sendMessage(""); - p.spigot().sendMessage(stats.genMobCount(" §2✸ §fDetailed Info §7(HOVER)", cmd)); - p.sendMessage(""); - p.sendMessage("§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛"); - + for (String str : Main.lang.getStringList("chunkanalyse.result3")) { + if (str.endsWith("HOVERTEXT")) { + p.spigot().sendMessage(stats.genMobCount(str, cmd).replaceAll("HOVERTEXT", "")) + } else { + p.sendMessage(str.replace("$1", crds).replace("$2", stats.getEnts().length).replace("$3", stats.getTiles().length)) + } + } } } -- 2.30.2 From a7902ae9826059b54ee8e8ca3198859db8cfb392 Mon Sep 17 00:00:00 2001 From: Deliable Date: Mon, 4 Jul 2022 22:41:31 +0200 Subject: [PATCH 5/5] Added la --- lang.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lang.yml diff --git a/lang.yml b/lang.yml new file mode 100644 index 0000000..dd4856c --- /dev/null +++ b/lang.yml @@ -0,0 +1,56 @@ +# _ _ _ +# | | /\ (_) | | +# | | __ _ __ _ / \ ___ ___ _ ___| |_ +# | | / _` |/ _` | / /\ \ / __/ __| / __| __| +# | |___| (_| | (_| |/ ____ \\__ \__ \ \__ \ |_ +# |______\__,_|\__, /_/ \_\___/___/_|___/\__| +# __/ | +# |___/ By EntryRise +# +# This is the default language configuration. You can edit any text you want. +# If you need help configuring it, please visit our dedicated Discord Server. +# DISCORD: https://discord.gg/4aWWPcb + +# What should LagAssist write in the beginning of most of the sentences? +prefix: "§2§lLag§f§lAssist §e» §f" + +errors: + chunkanalyse: + console-execution: "You cannot analyse the current chunk from console." + +debug: + ping: + #What should LagAssist debug if it receives a MOTD ping from anyone? + received: "Received ping from $1" + response: "API ping response to $1" + +chunkanalyse: + result1: + - "" + - "§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER §2§l⬛⬛⬛⬛⬛⬛" + - "" + - "$1" + - "" + - "⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛" + result2: + - "" + - "⬛⬛⬛⬛⬛⬛ §f§lCHUNKANALYSER ⬛⬛⬛⬛⬛⬛" + - "" + - " ✸ Chunk ($1) - Score $2" + - "" + - "§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛" + result3: + - "§2§l⬛⬛⬛⬛⬛⬛ §f§lCHUNK STATS §2§l⬛⬛⬛⬛⬛⬛" + - "" + - " §2✸ §fChunk coordonates: §7$1" + - "" + - " §2✸ §fEntity Amount: §7$2" + - " §2✸ §fTiles Amount: §7$3" + - "" + # CAUTION: Do not delete the "HOVERTEXT" text which is at the end of the sentence. The LagAssist will take care of it, "HOVERTEXT" text makes the string hoverable. + - " §2✸ §fDetailed Info §7(HOVER) HOVERTEXT" + - "" + - "§2§l⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛" + +# This allows the system to update the config if the plugin is updated. +version: 1 \ No newline at end of file -- 2.30.2