Finally implemented #41 and an event

YEEHAW
Oh, and smaller /mwiki changes
This commit is contained in:
Norbi Peti 2016-12-07 21:15:09 +01:00
parent bd55c580c9
commit 3aacd07691
2 changed files with 13 additions and 8 deletions

View file

@ -25,8 +25,9 @@ public class MWikiCommand extends TBMCCommandBase {
query += args[i] + " ";
query = query.trim();
try {
if (args.length == 0)
sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/");
if (query.length() == 0)
sender.sendMessage(new String[] { "§bMinecraft Wiki link: http://minecraft.gamepedia.com/",
"You can also search on it using /mwiki <query>" });
else
sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search="
+ URLEncoder.encode(query, "UTF-8") + "&title=Special%3ASearch&go=Go");

View file

@ -1,27 +1,31 @@
package buttondevteam.chat.commands;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.chat.PluginMain;
import buttondevteam.lib.TBMCYEEHAWEvent;
import buttondevteam.lib.chat.TBMCCommandBase;
public class YeehawCommand extends TBMCCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[] { "§6---- YEEHAW command ----",
"This command makes you YEEHAW." };
return new String[] { "§6---- YEEHAW command ----", "This command makes you YEEHAW." };
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
final String message = "§b* "
+ (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs.";
for (Player p : PluginMain.GetPlayers()) {
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
p.sendMessage("§b* "
+ (sender instanceof Player ? ((Player) sender)
.getDisplayName() : sender.getName()) + " §bYEEHAWs.");
} //Even a cmdblock could yeehaw in theory
p.sendMessage(message);
} // Even a cmdblock could yeehaw in theory
// Or anyone from Discord
Bukkit.getConsoleSender().sendMessage(message);
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
return true;
}