mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 06:28:49 +00:00
Text overhaul
This commit is contained in:
1 parent
cc90d5f15d
commit
d7e50b3a37
6 files changed
+117
-179
No files matched your search
@@ -1,12 +1,10 @@
|
||||
package me.william278.huskhomes2.commands;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import me.william278.huskhomes2.HuskHomes;
|
||||
import me.william278.huskhomes2.MessageManager;
|
||||
import me.william278.huskhomes2.migrators.EssentialsMigrator;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
@@ -17,21 +15,18 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static net.md_5.bungee.api.chat.ClickEvent.Action.OPEN_URL;
|
||||
|
||||
public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
||||
|
||||
private static final HuskHomes plugin = HuskHomes.getInstance();
|
||||
|
||||
private static void showAboutMenu(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "HuskHomes" + ChatColor.RESET + " " + ChatColor.GREEN + "| Version " + plugin.getDescription().getVersion());
|
||||
sender.sendMessage(ChatColor.GRAY + plugin.getDescription().getDescription());
|
||||
sender.sendMessage("• Author: " + ChatColor.GRAY + "William278");
|
||||
sender.sendMessage("• Contributors: " + ChatColor.GRAY + "imDaniX");
|
||||
sender.sendMessage("• Translators: " + ChatColor.GRAY + "RohFrenzy (de-de), 咖波 (zh-tw), imDaniX (ru), ReferTV (pl), Villag3r_ (it-it)");
|
||||
sender.sendMessage("• Help Wiki: " + ChatColor.GRAY + "https://github.com/WiIIiam278/HuskHomes2/wiki/");
|
||||
sender.sendMessage("• Issue Tracker: " + ChatColor.GRAY + "https://github.com/WiIIiam278/HuskHomes2/issues");
|
||||
}
|
||||
private static final StringBuilder PLUGIN_INFORMATION = new StringBuilder()
|
||||
.append("[HuskHomes](#00fb9a bold) [| Version ").append(plugin.getDescription().getVersion()).append("](#00fb9a)\n")
|
||||
.append("[").append(plugin.getDescription().getDescription()).append("](gray)\n")
|
||||
.append("[• Author:](white) [William278](gray show_text=&7Click to pay a visit open_url=https://youtube.com/William27528)\n")
|
||||
.append("[• Contributors:](white) [imDaniX](gray show_text=&7Code, refactoring)\n")
|
||||
.append("[• Translators:](white) [RohFrenzy](gray show_text=&7German Translation, de-de), [咖波](gray show_text=&7Chinese Translation, zh-tw), [imDaniX](gray show_text=&7Russian Translation, ru), [ReferTV](gray show_text=&7Polish Translation, pl), [Villag3r_](gray show_text=&7Italian Translation, it-it) \n")
|
||||
.append("[• Help Wiki:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/HuskHomes2/wiki/)\n")
|
||||
.append("[• Report Issues:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/HuskHomes2/issues)\n")
|
||||
.append("[• Support Discord:](white) [[Link]](#00fb9a show_text=&7Click to join open_url=https://discord.gg/tVYhJfyDWG)");
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -43,7 +38,7 @@ public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
showAboutMenu(sender);
|
||||
sender.spigot().sendMessage(new MineDown(PLUGIN_INFORMATION.toString()).toComponent());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,19 +48,13 @@ public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("huskhomes.version_checker")) {
|
||||
if (!HuskHomes.getVersionCheckString().contains("HuskHomes is up to date!")) {
|
||||
p.sendMessage(org.bukkit.ChatColor.DARK_RED + "Update: " + org.bukkit.ChatColor.RED + HuskHomes.getVersionCheckString());
|
||||
String updateMessage = "[Update:](dark_red) [" +
|
||||
HuskHomes.getVersionCheckString() + "](red)\n" + "[Get the latest version:](gray) " +
|
||||
"[[Download]](#00fb9a show_text=&7Click to visit webpage open_url=https://www.spigotmc.org/resources/huskhomes.83767/updates)";
|
||||
sender.spigot().sendMessage(new MineDown(updateMessage).toComponent());
|
||||
|
||||
// Send a link to Spigot downloads page
|
||||
ComponentBuilder componentBuilder = new ComponentBuilder();
|
||||
TextComponent projectURL = new TextComponent("[Download]");
|
||||
ClickEvent clickEvent = new ClickEvent(OPEN_URL, "https://www.spigotmc.org/resources/huskhomes.83767/updates");
|
||||
projectURL.setClickEvent(clickEvent);
|
||||
projectURL.setColor(net.md_5.bungee.api.ChatColor.AQUA);
|
||||
componentBuilder = componentBuilder.append(TextComponent.fromLegacyText("§7Get the latest version: "));
|
||||
componentBuilder = componentBuilder.append(projectURL);
|
||||
p.spigot().sendMessage(componentBuilder.create());
|
||||
} else {
|
||||
p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "HuskHomes" + ChatColor.RESET + "" + ChatColor.GREEN + " | HuskHomes is up-to-date! (Version " + plugin.getDescription().getVersion() + ")");
|
||||
sender.spigot().sendMessage(new MineDown("[HuskHomes](#00fb9a bold) �fb9a&| HuskHomes is up-to-date! (Version " + plugin.getDescription().getVersion() + ")").toComponent());
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendMessage(p, "error_no_permission");
|
||||
@@ -80,7 +69,7 @@ public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
||||
if (p.hasPermission("huskhomes.reload")) {
|
||||
HuskHomes.getSettings().reload();
|
||||
MessageManager.loadMessages(HuskHomes.getSettings().getLanguage());
|
||||
p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "HuskHomes" + ChatColor.RESET + "" + ChatColor.GREEN + " | Reloaded config and message files.");
|
||||
sender.spigot().sendMessage(new MineDown("[HuskHomes](#00fb9a bold) �fb9a&| Reloaded config & message files.").toComponent());
|
||||
} else {
|
||||
MessageManager.sendMessage(p, "error_no_permission");
|
||||
}
|
||||
@@ -99,7 +88,7 @@ public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
||||
}
|
||||
if (args.length == 2) {
|
||||
if (args[1].equalsIgnoreCase("essentialsX")) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Attempting to migrate from EssentialsX...");
|
||||
sender.spigot().sendMessage(new MineDown("[HuskHomes](#00fb9a bold) �fb9a&| Starting data migration from EssentialsX...").toComponent());
|
||||
EssentialsMigrator.migrate();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid argument! Usage: /huskhomes migrate essentialsX");
|
||||
@@ -116,7 +105,7 @@ public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
showAboutMenu(sender);
|
||||
sender.spigot().sendMessage(new MineDown(PLUGIN_INFORMATION.toString()).toComponent());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user