Skip to content

Instantly share code, notes, and snippets.

View kvizdos's full-sized avatar
💭
working on PRAUXY.app

Kenton Vizdos kvizdos

💭
working on PRAUXY.app
View GitHub Profile
@kvizdos
kvizdos / Custom Bukkit ANDOR Spigot Crafting Recipes
Created February 10, 2017 02:45
If you would like a more in-depth video on this, either visit my Twitter (@kvizdos) and ask me, or watch my YouTube video about it, located https://youtu.be/R_TvwakuCAc, or, if neither of those work, join my Discord channel, where you can talk to me about it Join Code: discord.gg/sGzwhKG!
public void onEnable() {
// WHAT YOU WANT TO GIVE TO THE PLAYER
ItemStack aStand = new ItemStack(Material.ARMOR_STAND);
ShapedRecipe arStand = new ShapedRecipe(aStand);
// ITS JUST LIKE A CRAFTING BENCH!!!
arStand.shape
("*H*"
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerBreakBlockEvent(BlockBreakEvent e) {
Player p = e.getPlayer();
p.sendMessage("You broke a " + ChatColor.GREEN + e.getBlock().getType());
// TODO: THEN TEST!!!!!!!!!!!!!!!!!!!
if(e.getBlock().getType().equals(Material.STONE)) {
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerPlaceBlockEvent(BlockPlaceEvent e) {
Player p = e.getPlayer();
if(e.getBlock().getType().equals(Material.DIAMOND_BLOCK)) {
p.sendMessage(ChatColor.AQUA + "Nope, this will always be..."+ChatColor.RED+" IMPERFECT!");
// ADD THIS TO YOUR ONENABLE()
getServer().getPluginManager().registerEvents(new <trigger>(), this);
// IN YOUR EVENT CLASS:
public class <event-name> implements Listener {
@EventHandler
public void <trigger>(<event> e) {
// EVENT STUFFS!
}
// Just remember to use this in your main class / where your calling the method from
<class-name> <class-name-abbr> = new <class-name>();
// To call a method, Ill use sendConsoleMsg() as a example:
<class-name-abbr>.sendConsoleMsg("Hello!");
// Or
<class-name-abbr>.<method>;
// IN YOUR ON ENABLE:
getCommand("<cmd>").setExecutor(new <cmd-path>());
// IN YOUR <cmd-path> FILE:
// MAKE SURE TO IMPLEMENT CommandExecutor!
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player p = (Player) sender;
if(cmd.getName().equalsIgnoreCase("<cmd>") && sender.hasPermission("<perm-node>")) {
if(args.length == 0) {
@EventHandler
public void blockExEvent(PlayerBedEnterEvent e) {
Player p = e.getPlayer();
Block b = e.getBed();
b.breakNaturally();
e.setCancelled(true);
p.sendMessage("No no no!");
}
@EventHandler
public void onLeashEvent(PlayerLeashEntityEvent e) {
Player p = e.getPlayer();
if(e.getEntity().getType().toString().equals("SHEEP")) {
p.sendMessage("You have captured a sheep!");
}
if(e.getEntity().getType().toString().equals("PIG")) {
p.sendMessage(ChatColor.LIGHT_PURPLE + "You have captured a pig!");
<html>
<head>
<title>this is bad formatting</title>
</head>
<body>
<p>Hello World :D</p>
<p>How are you today?</p>
<div>
<h1>Hello</h1>
#deb cdrom:[Ubuntu 14.04 LTS _Trusty Tahr_ - Release amd64 (20140417)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted