Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.calebbfmv.StopAskingOp;
- import java.io.File;
- import java.util.logging.Logger;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerChatEvent;
- import org.bukkit.permissions.Permission;
- import org.bukkit.plugin.PluginDescriptionFile;
- import org.bukkit.plugin.java.JavaPlugin;
- public class StopOP extends JavaPlugin implements Listener {
- public Logger log = Logger.getLogger("Minecraft");
- public FileConfiguration config;
- public Permission enablePermission = new Permission ("KickOP.enable");
- @Override
- public void onEnable() {
- if(!new File(getDataFolder(), "config.yml").exists()){
- log.info("[KickOp] Config file doesn't exist, creating it...");
- saveDefaultConfig();
- PluginDescriptionFile pdffile = this.getDescription();
- log.info(pdffile.getName() + " " + pdffile.getVersion() + " enabled Kick Op by calebbfmv");
- getServer().getPluginManager().registerEvents(this, this);
- }
- }
- @Override
- public void onDisable() {
- PluginDescriptionFile pdffile = this.getDescription();
- log.info(pdffile.getName() + " " + pdffile.getVersion() + " is now disabled.");
- }
- @EventHandler
- public void onPlayerChat(AsyncPlayerChatEvent event){
- String msg = event.getMessage().toLowerCase();
- if(msg.contains(getConfig().getStringList("Words"))) {
- event.getPlayer().kickPlayer(getConfig().getStringList("Message"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement