Added /mwiki - Added /un- with the tbmc.admin permission
This commit is contained in:
parent
8005f715c8
commit
d22f2bee69
14 changed files with 62 additions and 5 deletions
Binary file not shown.
|
@ -15,5 +15,11 @@ commands:
|
|||
description: Unlaugh the last laugh.
|
||||
unlaugh:
|
||||
description: Unlaugh the last laugh.
|
||||
mwiki:
|
||||
description: Search the wiki.
|
||||
usage: "&vUsage: /mwiki [query]&r"
|
||||
author: NorbiPeti
|
||||
depend: [Essentials, Towny, Minigames, Votifier]
|
||||
permissions:
|
||||
tbmc.admin:
|
||||
description: Gives access to /un- commands and /u admin commands
|
||||
|
|
|
@ -213,6 +213,9 @@ public class Commands implements CommandExecutor {
|
|||
p.sendMessage("§b* " + p.getDisplayName() + " YEEHAWs.");
|
||||
}
|
||||
}
|
||||
case "mwiki": {
|
||||
DoMWiki(player, args);
|
||||
}
|
||||
default:
|
||||
player.sendMessage("Unknown command: " + cmd.getName());
|
||||
break;
|
||||
|
@ -259,9 +262,8 @@ public class Commands implements CommandExecutor {
|
|||
|
||||
private static String DoAdminUsage = "§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin|togglerpshow|toggledebug|savepos|loadpos§r";
|
||||
|
||||
private static void DoAdmin(Player player, String[] args) { // 2015.08.09.
|
||||
if (player == null || player.isOp()
|
||||
|| player.getName().equals("NorbiPeti")) {
|
||||
private static void DoAdmin(Player player, String[] args) {
|
||||
if (player == null || PluginMain.permission.has(player, "tbmc.admin")) {
|
||||
if (args.length == 1) {
|
||||
String message = DoAdminUsage;
|
||||
SendMessage(player, message);
|
||||
|
@ -322,7 +324,7 @@ public class Commands implements CommandExecutor {
|
|||
return;
|
||||
}
|
||||
} else
|
||||
player.sendMessage("§cYou need to be OP to use this command.§r");
|
||||
player.sendMessage("§cYou don't have permission to use this command.§r");
|
||||
}
|
||||
|
||||
private static void DoPlayerInfo(Player player, String[] args) { // 2015.08.09.
|
||||
|
@ -620,4 +622,18 @@ public class Commands implements CommandExecutor {
|
|||
} catch (MobException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private static void DoMWiki(Player player, String[] args) {
|
||||
String query = "";
|
||||
for (int i = 0; i < args.length; i++)
|
||||
query += args[i];
|
||||
query = query.trim();
|
||||
if (args.length == 0)
|
||||
SendMessage(player,
|
||||
"§bMinecraft Wiki link: http://minecraft.gamepedia.com/");
|
||||
else
|
||||
SendMessage(player,
|
||||
"§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search="
|
||||
+ query + "&title=Special%3ASearch&go=Go");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,11 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.help.HelpTopic;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
|
||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||
|
@ -710,7 +713,8 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
|||
} catch (NotRegisteredException e) {
|
||||
return;
|
||||
}
|
||||
} else if (cmd.equalsIgnoreCase("home") || cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("tp")) {
|
||||
} else if (cmd.equalsIgnoreCase("home") || cmd.equalsIgnoreCase("tpa")
|
||||
|| cmd.equalsIgnoreCase("tp")) {
|
||||
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(event
|
||||
.getPlayer());
|
||||
if (mgp.isInMinigame()
|
||||
|
@ -718,6 +722,34 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
|||
.equals("creativeglobal")) {
|
||||
mgp.setAllowTeleport(true);
|
||||
}
|
||||
} else if (cmd.toLowerCase().startsWith("un")) {
|
||||
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap()
|
||||
.getHelpTopics()) {
|
||||
// event.getPlayer().sendMessage("HT: " + ht.getName());
|
||||
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
||||
return;
|
||||
}
|
||||
if (PluginMain.permission.has(event.getPlayer(), "tbmc.admin")) {
|
||||
String s = cmd.substring(2);
|
||||
Player target = null;
|
||||
target = Bukkit.getPlayer(event.getMessage().substring(
|
||||
index + 1));
|
||||
if (target == null) {
|
||||
event.getPlayer().sendMessage(
|
||||
"§cError: Player not found. (/un" + s
|
||||
+ " <player>)");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (target != null) {
|
||||
target.addPotionEffect(new PotionEffect(
|
||||
PotionEffectType.BLINDNESS, 10 * 20, 5, false,
|
||||
false));
|
||||
for (Player pl : PluginMain.GetPlayers())
|
||||
pl.sendMessage(event.getPlayer().getDisplayName()
|
||||
+ " un" + s + "'d " + target.getDisplayName());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,9 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
this.getCommand("ooc").getUsage().replace('&', '§'));
|
||||
this.getCommand("unlol").setExecutor(comm);
|
||||
this.getCommand("unlaugh").setExecutor(comm);
|
||||
this.getCommand("mwiki").setExecutor(comm);
|
||||
this.getCommand("mwiki").setUsage(
|
||||
this.getCommand("mwiki").getUsage().replace('&', '§'));
|
||||
Instance = this; // 2015.08.08.
|
||||
Console = this.getServer().getConsoleSender(); // 2015.08.12.
|
||||
LoadFiles(false); // 2015.08.09.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue