Created
February 20, 2014 21:19
-
-
Save LaxWasHere/9123395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.awesomepowered.ultimatecommandblocker420; | |
import java.util.List; | |
import net.craftminecraft.bungee.bungeeyaml.pluginapi.ConfigurablePlugin; | |
import net.md_5.bungee.api.ChatColor; | |
import net.md_5.bungee.api.connection.ProxiedPlayer; | |
import net.md_5.bungee.api.event.ChatEvent; | |
import net.md_5.bungee.api.plugin.Listener; | |
import net.md_5.bungee.event.EventHandler; | |
public class UltimateCommandBlocker420 extends ConfigurablePlugin implements Listener { | |
public List<String> BCmds; | |
public String BlockMessage; | |
public String BlockPermBypass; | |
public void onEanble() { | |
this.getProxy().getPluginManager().registerListener(this, this); | |
configStuff(); | |
} | |
public void configStuff() { | |
this.getConfig().options().copyDefaults(true); | |
this.saveConfig(); | |
BCmds = this.getConfig().getStringList("BlockedCommands"); | |
BlockMessage = this.getConfig().getString("BlockMessage"); | |
BlockPermBypass = this.getConfig().getString("BlockPermBypass"); | |
} | |
@SuppressWarnings("deprecation") | |
@EventHandler | |
public void BungeeChat(ChatEvent ev) { | |
ProxiedPlayer p = (ProxiedPlayer) ev.getSender(); | |
String msg = ev.getMessage(); | |
for (String cmdz : BCmds) | |
if (cmdz.contains(msg) && !p.hasPermission(BlockPermBypass)) { | |
ev.setCancelled(true); | |
p.sendMessage(ChatColor.translateAlternateColorCodes('&', BlockMessage)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment