From 44984d8987df0c0c8a210fa4322cd0b56d32acbe Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 4 Dec 2016 19:06:18 +0100 Subject: [PATCH] Smaller fixes --- .../chat/commands/MWikiCommand.java | 17 ++++++++++++----- .../chat/commands/ucmds/admin/UpdatePlugin.java | 10 ++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/buttondevteam/chat/commands/MWikiCommand.java b/src/main/java/buttondevteam/chat/commands/MWikiCommand.java index 290b712..03a0343 100644 --- a/src/main/java/buttondevteam/chat/commands/MWikiCommand.java +++ b/src/main/java/buttondevteam/chat/commands/MWikiCommand.java @@ -1,5 +1,8 @@ package buttondevteam.chat.commands; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; @@ -21,11 +24,15 @@ public class MWikiCommand extends TBMCCommandBase { for (int i = 0; i < args.length; i++) query += args[i] + " "; query = query.trim(); - if (args.length == 0) - sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/"); - else - sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search=" + query - + "&title=Special%3ASearch&go=Go"); + try { + if (args.length == 0) + sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/"); + else + sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search=" + + URLEncoder.encode(query, "UTF-8") + "&title=Special%3ASearch&go=Go"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } return true; } diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java b/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java index 055fbae..057af1a 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java @@ -10,9 +10,12 @@ public class UpdatePlugin extends AdminCommandBase { @Override public String[] GetHelpText(String alias) { - return new String[] { "§6---- Update plugin ----", - "This command downloads the latest version of a TBMC plugin from GitHub", - "To update a plugin: /" + alias + " ", "To list the plugin names: /" + alias }; + return new String[] { // + "§6---- Update plugin ----", // + "This command downloads the latest version of a TBMC plugin from GitHub", // + "To update a plugin: /" + alias + " ", // + "To list the plugin names: /" + alias // + }; } @Override @@ -29,7 +32,6 @@ public class UpdatePlugin extends AdminCommandBase { } return true; } else { - sender.sendMessage("Updating plugin..."); Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> { TBMCCoreAPI.UpdatePlugin(args[0], sender); });