Open Soruce

Files

All of the downloads are the root dev file that I use. Fell free to make your own version of this plugin. Just please know that you must list this plugin somewhere in that plugin. Thanks

Main.java

package me.christophernjspchaka.plugins.no;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {
    public void onDisable() {
        System.out.println("[I Said No] Disabled.");
    }

    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        System.out.println("[I Said No] Enabled.");
        try {
        	ISNData.createFiles();
        	} catch (Exception e) {
        	e.printStackTrace();
        	}
        getCommand("nohelp").setExecutor(new CommandExecutor(this));
        getCommand("canibestaff").setExecutor(new CommandExecutor(this));
        getCommand("mycommands").setExecutor(new CommandExecutor(this));
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        event.getPlayer().sendMessage("Welcome, " + event.getPlayer().getDisplayName() + "! Type /nohelp for I Said No Info");
    }
    String message = this.getConfig().getString("message");
}

CommandExecutor.java

package me.christophernjspchaka.plugins.no;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

public class CommandExecutor implements org.bukkit.command.CommandExecutor {
 
	@SuppressWarnings("unused")
	private Main plugin;
 
	public CommandExecutor(Main plugin) {
		this.plugin = plugin;
	}
 
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		if(cmd.getName().equalsIgnoreCase("nohelp")){
			sender.sendMessage("/opme - Returns NO! /n /canibestaff - Returns NO!");
		}
		return false;
	}
	
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		if(cmd.getName().equalsIgnoreCase("opme")){
			sender.sendMessage("NO!");
		}
		return false;
	}
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		if(cmd.getName().equalsIgnoreCase("canibestaff")){
			sender.sendMessage("NO!");
		}
		return false;
	}
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		if(cmd.getName().equalsIgnoreCase("mycommands")){
			sender.sendMessage("Please type /help for a list of valid commands.");
		}
		return false;
	}
}

ISNData.java

package me.christophernjspchaka.plugins.no;

import java.io.File;


public class ISNData {
	
	public static void createFiles() throws Exception {
		File configFile = new File(Main.getInstance().getDataFolder(), "config.yml");
		if (!configFile.exists()) {
		configFile.getParentFile().mkdirs();
		copy(Main.getInstance().getResource("config.yml"), configFile);
		Main.log.info(Main.getInstance().title + "'config.yml' didn't exist. Created it for you..");
		}
		}

}

Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes