Created
August 19, 2012 19:17
-
-
Save benphelps/3397110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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