diff --git a/config.yml b/config.yml index e83c78f..c79e860 100644 --- a/config.yml +++ b/config.yml @@ -3,4 +3,9 @@ banDuration: 5 # days onDeathRemove: 4.0 # 2 hearts headsGive: 4.0 # 2 hearts lifextractorEnabled: true -startingLives: 2 # different than hearts \ No newline at end of file +heartExtractorEnabled: true +startingLives: 2 # different than hearts + +crafting: + allowCraftingHeads: true + allowCraftingLives: true \ No newline at end of file diff --git a/src/ca/thetechrobo/smp/DeathListener.java b/src/ca/thetechrobo/smp/DeathListener.java index 992aab0..f0876f7 100644 --- a/src/ca/thetechrobo/smp/DeathListener.java +++ b/src/ca/thetechrobo/smp/DeathListener.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import org.bukkit.Sound; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -25,7 +26,7 @@ public class DeathListener implements Listener { ItemStack skull = rethead(e.getEntity()); e.getEntity().getWorld().dropItemNaturally(e.getEntity().getLocation(), skull); } - public ItemStack rethead(Player p) { + public ItemStack rethead(OfflinePlayer p) { ItemStack skull = new ItemStack(Material.PLAYER_HEAD); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setOwningPlayer(p); @@ -34,6 +35,9 @@ public class DeathListener implements Listener { skull.setItemMeta(newmeta); return skull; } + public ItemStack rethead(Player p) { + return rethead((OfflinePlayer) p); + } @EventHandler public void onPlayerJoin(PlayerJoinEvent e) { this.scores.addPlayerToScoreboard(e.getPlayer()); diff --git a/src/ca/thetechrobo/smp/LifestealPlugin.java b/src/ca/thetechrobo/smp/LifestealPlugin.java index 5fcc46a..40dfcbe 100644 --- a/src/ca/thetechrobo/smp/LifestealPlugin.java +++ b/src/ca/thetechrobo/smp/LifestealPlugin.java @@ -8,6 +8,7 @@ import org.bukkit.inventory.ShapedRecipe; import org.bukkit.plugin.java.JavaPlugin; public class LifestealPlugin extends JavaPlugin { + private DeathListener dl; public void addRecipes() { LifeExtractor lifextractor = new LifeExtractor(); lifextractor.create(); @@ -45,14 +46,38 @@ public class LifestealPlugin extends JavaPlugin { recipe.setIngredient('B', Material.BUCKET); recipe.setIngredient('S', Material.STICK); Bukkit.addRecipe(recipe); + + item = this.dl.rethead(Bukkit.getOfflinePlayer("D")); + key = new NamespacedKey(this, "headRecipe0"); + recipe = new ShapedRecipe(key, item); + recipe.shape("did", " ", " "); + recipe.setIngredient('d', Material.DIAMOND); + recipe.setIngredient('i', Material.IRON_INGOT); + Bukkit.addRecipe(recipe); + + item = this.dl.rethead(Bukkit.getOfflinePlayer("D")); + key = new NamespacedKey(this, "headRecipe1"); + recipe = new ShapedRecipe(key, item); + recipe.shape("WWW", "WsW", "WWW"); + recipe.setIngredient('W', Material.STICK); + recipe.setIngredient('s', Material.NETHERITE_SCRAP); + Bukkit.addRecipe(recipe); + + item = this.dl.rethead(Bukkit.getOfflinePlayer("D")); + key = new NamespacedKey(this, "headRecipe2"); + recipe = new ShapedRecipe(key, item); + recipe.shape("RR ", " ", " "); + recipe.setIngredient('R', Material.REDSTONE_BLOCK); + Bukkit.addRecipe(recipe); } @Override public void onEnable() { DeathListener dl = new DeathListener(); - dl.initialise(this); - getServer().getPluginManager().registerEvents(dl, this); + this.dl = dl; + this.dl.initialise(this); + getServer().getPluginManager().registerEvents(this.dl, this); DeleteMyData dlmydata = new DeleteMyData(); - dlmydata.initialise(dl.scores); + dlmydata.initialise(this.dl.scores); this.getCommand("deletemydata").setExecutor(dlmydata); this.getCommand("setHearts").setExecutor(new ExploitAbuse101ByLunarRam()); addRecipes();