Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main extends JavaPlugin implements Listener {
- Localization messages;
- Config config;
- public void onEnable() {
- Bukkit.getServer().getPluginManager().registerEvents(this, this);
- CSCoreLibLoader loader = new CSCoreLibLoader(this);
- if (loader.load()) {
- PluginUtils utils = new PluginUtils(this);
- utils.setupConfig();
- config = utils.getConfig();
- utils.setupLocalization();
- messages = utils.getLocalization();
- // utils.setupUpdater(91167, getFile());
- messages.setDefault("blocked-message", "&cYou cannot perform {CMD}!");
- messages.save();
- }
- }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onCommandPreprocess(PlayerCommandPreprocessEvent e) {
- Player p = e.getPlayer();
- String c = e.getMessage();
- if (p.hasPermission("commandblocker.bypass")) return;
- for (String l : config.getStringList("blocked-commands")) {
- if (c.contains(l)) {
- messages.sendTranslation(p, "blocked-message", false, new Variable("{CMD}", c));
- e.setCancelled(true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement