Skip to content

Instantly share code, notes, and snippets.

@benphelps
Created August 19, 2012 19:17
Show Gist options
  • Save benphelps/3397110 to your computer and use it in GitHub Desktop.
Save benphelps/3397110 to your computer and use it in GitHub Desktop.
package me.benphelps.Plots;
import org.bukkit.plugin.java.JavaPlugin;
public class Plots extends JavaPlugin {
public boolean creating;
public void onEnable(){
getServer().getPluginManager().registerEvents(new PlotsBlockListener(this), this);
getCommand("new").setExecutor(new PlotsCommandExecutor(this));
getLogger().info("Plots has been enabled!");
}
public void onDisable(){
getLogger().info("Plots has been disabled.");
}
}
package me.benphelps.Plots;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class PlotsCommandExecutor implements CommandExecutor {
private Plots plots;
public PlotsCommandExecutor(Plots plots) {
this.plots = plots;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
// Sanity Checks
if (args.length > 4) {
sender.sendMessage("Too many arguments!");
return false;
}
if (args.length < 2) {
sender.sendMessage("Not enough arguments!");
return false;
}
if (sender instanceof Player == false) {
sender.sendMessage("You must be a player!");
return false;
}
if(cmd.getName().equalsIgnoreCase("new")){
sender.sendMessage("Woot mutherfucker!");
plots.creating = true;
return true;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment