fancy enable
This commit is contained in:
parent
e317b693db
commit
1fbb608d53
@ -6,10 +6,13 @@ import me.xginko.villageroptimizer.config.Config;
|
|||||||
import me.xginko.villageroptimizer.config.LanguageCache;
|
import me.xginko.villageroptimizer.config.LanguageCache;
|
||||||
import me.xginko.villageroptimizer.modules.VillagerOptimizerModule;
|
import me.xginko.villageroptimizer.modules.VillagerOptimizerModule;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.format.Style;
|
||||||
import net.kyori.adventure.text.format.TextColor;
|
import net.kyori.adventure.text.format.TextColor;
|
||||||
import net.kyori.adventure.text.format.TextDecoration;
|
import net.kyori.adventure.text.format.TextDecoration;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -33,29 +36,38 @@ public final class VillagerOptimizer extends JavaPlugin {
|
|||||||
private static Config config;
|
private static Config config;
|
||||||
private static Logger logger;
|
private static Logger logger;
|
||||||
|
|
||||||
|
private final static Style plugin_style = Style.style(TextColor.color(102,255,230), TextDecoration.BOLD);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
logger = getLogger();
|
logger = getLogger();
|
||||||
getServer().getConsoleSender().sendMessage(Component.text(
|
ConsoleCommandSender console = getServer().getConsoleSender();
|
||||||
"""
|
console.sendMessage(Component.text("╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮").style(plugin_style));
|
||||||
\s
|
console.sendMessage(Component.text("│ │").style(plugin_style));
|
||||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
console.sendMessage(Component.text("│ │").style(plugin_style));
|
||||||
┃ _ __ _ __ __ ____ __ _ _ ┃\s
|
console.sendMessage(Component.text("│ _ __ _ __ __ ____ __ _ _ │").style(plugin_style));
|
||||||
┃ | | / /(_)/ // /____ _ ____ _ ___ _____ / __ \\ ____ / /_ (_)____ ___ (_)____ ___ _____ ┃\s
|
console.sendMessage(Component.text("│ | | / /(_)/ // /____ _ ____ _ ___ _____ / __ \\ ____ / /_ (_)____ ___ (_)____ ___ _____ │").style(plugin_style));
|
||||||
┃ | | / // // // // __ `// __ `// _ \\ / ___// / / // __ \\ / __// // __ `__ \\ / //_ / / _ \\ / ___/ ┃\s
|
console.sendMessage(Component.text("│ | | / // // // // __ `// __ `// _ \\ / ___// / / // __ \\ / __// // __ `__ \\ / //_ / / _ \\ / ___/ │").style(plugin_style));
|
||||||
┃ | |/ // // // // /_/ // /_/ // __// / / /_/ // /_/ // /_ / // / / / / // / / /_/ __// / ┃\s
|
console.sendMessage(Component.text("│ | |/ // // // // /_/ // /_/ // __// / / /_/ // /_/ // /_ / // / / / / // / / /_/ __// / │").style(plugin_style));
|
||||||
┃ |___//_//_//_/ \\__,_/ \\__, / \\___//_/ \\____// .___/ \\__//_//_/ /_/ /_//_/ /___/\\___//_/ ┃\s
|
console.sendMessage(Component.text("│ |___//_//_//_/ \\__,_/ \\__, / \\___//_/ \\____// .___/ \\__//_//_/ /_/ /_//_/ /___/\\___//_/ │").style(plugin_style));
|
||||||
┃ /____/ /_/ by xGinko ┃\s
|
console.sendMessage(Component.text("│ /____/ /_/ by xGinko │").style(plugin_style));
|
||||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"""
|
console.sendMessage(Component.text("│ │").style(plugin_style));
|
||||||
).color(TextColor.color(102,255,230)).decorate(TextDecoration.BOLD));
|
console.sendMessage(Component.text("│ │").style(plugin_style));
|
||||||
logger.info("Loading Translations...");
|
console.sendMessage(Component.text("│ ").style(plugin_style)
|
||||||
reloadLang();
|
.append(Component.text(" ➤ Loading Translations...").style(plugin_style)).append(Component.text(" │")).decorate(TextDecoration.BOLD));
|
||||||
logger.info("Loading Config...");
|
reloadLang(true);
|
||||||
|
console.sendMessage(Component.text("│ ").style(plugin_style)
|
||||||
|
.append(Component.text(" ➤ Loading Config...").style(plugin_style)).append(Component.text(" │")).decorate(TextDecoration.BOLD));
|
||||||
reloadConfiguration();
|
reloadConfiguration();
|
||||||
logger.info("Registering Commands...");
|
console.sendMessage(Component.text("│ ").style(plugin_style)
|
||||||
|
.append(Component.text(" ➤ Registering Commands...").style(plugin_style)).append(Component.text(" │").style(plugin_style)));
|
||||||
VillagerOptimizerCommand.reloadCommands();
|
VillagerOptimizerCommand.reloadCommands();
|
||||||
logger.info("Done.");
|
console.sendMessage(Component.text("│ ").style(plugin_style)
|
||||||
|
.append(Component.text(" ✓ Done.").color(NamedTextColor.WHITE).decorate(TextDecoration.BOLD)).append(Component.text(" │").style(plugin_style)));
|
||||||
|
console.sendMessage(Component.text("│ │").style(plugin_style));
|
||||||
|
console.sendMessage(Component.text("│ │").style(plugin_style));
|
||||||
|
console.sendMessage(Component.text("╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯").style(plugin_style));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VillagerOptimizer getInstance() {
|
public static VillagerOptimizer getInstance() {
|
||||||
@ -75,7 +87,7 @@ public final class VillagerOptimizer extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reloadPlugin() {
|
public void reloadPlugin() {
|
||||||
reloadLang();
|
reloadLang(false);
|
||||||
reloadConfiguration();
|
reloadConfiguration();
|
||||||
VillagerOptimizerCommand.reloadCommands();
|
VillagerOptimizerCommand.reloadCommands();
|
||||||
}
|
}
|
||||||
@ -92,14 +104,18 @@ public final class VillagerOptimizer extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reloadLang() {
|
private void reloadLang(boolean fancy) {
|
||||||
languageCacheMap = new HashMap<>();
|
languageCacheMap = new HashMap<>();
|
||||||
|
ConsoleCommandSender console = getServer().getConsoleSender();
|
||||||
try {
|
try {
|
||||||
File langDirectory = new File(getDataFolder() + "/lang");
|
File langDirectory = new File(getDataFolder() + "/lang");
|
||||||
Files.createDirectories(langDirectory.toPath());
|
Files.createDirectories(langDirectory.toPath());
|
||||||
for (String fileName : getDefaultLanguageFiles()) {
|
for (String fileName : getDefaultLanguageFiles()) {
|
||||||
String localeString = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf('.'));
|
String localeString = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf('.'));
|
||||||
logger.info(String.format("Found language file for %s", localeString));
|
if (fancy) { console.sendMessage(Component.text("│ ").style(plugin_style)
|
||||||
|
.append(Component.text(" "+localeString).color(NamedTextColor.WHITE).decorate(TextDecoration.BOLD))
|
||||||
|
.append(Component.text(" │").style(plugin_style)));
|
||||||
|
} else { logger.info(String.format("Found language file for %s", localeString)); }
|
||||||
LanguageCache langCache = new LanguageCache(localeString);
|
LanguageCache langCache = new LanguageCache(localeString);
|
||||||
languageCacheMap.put(localeString, langCache);
|
languageCacheMap.put(localeString, langCache);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user