Skip to content

Instantly share code, notes, and snippets.

@LaxWasHere
Created February 20, 2014 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LaxWasHere/9123395 to your computer and use it in GitHub Desktop.
Save LaxWasHere/9123395 to your computer and use it in GitHub Desktop.
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