Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Bumped to 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 committed Mar 18, 2017
1 parent df3b71c commit 8b77cd3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
8 changes: 4 additions & 4 deletions main/java/io/github/thatsmusic99/headsplus/HeadsPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onEnable() {
RecipeListeners.addRecipes();
}
if (!(econ()) && (getConfig().getBoolean("sellHeads"))) {
log.warning("[HeadsPlus] Vault not found! Heads cannot be sold.");
log.warning("[HeadsPlus] Vault not found! Heads cannot be sold. If you don't have SimpleAPI either, install both plugins.");
sellable = false;
} else if ((econ()) && (getConfig().getBoolean("sellHeads"))) {
if (this.getServer().getPluginManager().getPlugin("SimpleAPI") == null) {
Expand All @@ -61,9 +61,9 @@ public void onEnable() {

}
getServer().getPluginManager().registerEvents(new HeadInteractEvent(), this);
//if (getConfig().getBoolean("dropHeads")) {
getServer().getPluginManager().registerEvents(new DeathEvents(), this);
//}
if (getConfig().getBoolean("dropHeads")) {
getServer().getPluginManager().registerEvents(new DeathEvents(), this);
}
this.getCommand("headsplus").setExecutor(new HeadsPlusCommand());
this.getCommand("hp").setExecutor(new HeadsPlusCommand());
this.getCommand("head").setExecutor(new Head());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import simple.brainsynder.nbt.ItemNBT;

public class SellHead implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Expand All @@ -25,9 +26,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta skullM = (SkullMeta) skull.getItemMeta();
String owner = skullM.getOwner();
if (skull.containsEnchantment(Enchantment.DURABILITY)) { // TODO FIX
ItemNBT skullnbt = ItemNBT.getItemNBT(skull);
if (skullnbt.getBoolean("sellable-head") == true) {
Economy econ = null;

if (owner == HeadsPlusConfigHeads.getHeads().getString("zombieHeadN")) {
Double price = HeadsPlusConfigHeads.getHeads().getDouble("zombieHeadP");
String senderName = sender.getName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package io.github.thatsmusic99.headsplus.crafting;

import java.util.ArrayList;
import java.util.List;

import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.meta.SkullMeta;

import io.github.thatsmusic99.headsplus.HeadsPlus;

public class RecipeListeners {

public static List<ShapelessRecipe> recipes = new ArrayList<>();

@SuppressWarnings("deprecation")
public static void addRecipes() {


ItemStack zHead = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta zMeta = (SkullMeta) zHead.getItemMeta();
zMeta.setOwner("MHF_Zombie");
Expand All @@ -27,6 +35,7 @@ public static void addRecipes() {
.addIngredient(Material.SKULL_ITEM, 0);

HeadsPlus.getInstance().getServer().addRecipe(zombieRecipe);
recipes.add(zombieRecipe);

ItemStack bHead = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta bMeta = (SkullMeta) bHead.getItemMeta();
Expand All @@ -41,6 +50,7 @@ public static void addRecipes() {
.addIngredient(Material.SKULL_ITEM, 0);

HeadsPlus.getInstance().getServer().addRecipe(blazeRecipe);
recipes.add(blazeRecipe);

ItemStack csHead = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta csMeta = (SkullMeta) csHead.getItemMeta();
Expand All @@ -50,11 +60,13 @@ public static void addRecipes() {
csMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
csHead.setItemMeta(csMeta);


ShapelessRecipe cavespiderRecipe = new ShapelessRecipe(csHead)
.addIngredient(Material.FERMENTED_SPIDER_EYE)
.addIngredient(Material.SKULL_ITEM, 0);

HeadsPlus.getInstance().getServer().addRecipe(cavespiderRecipe);
recipes.add(cavespiderRecipe);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.github.thatsmusic99.headsplus.crafting;

import java.util.List;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.inventory.ShapelessRecipe;

public class RecipePerms implements Listener {

@EventHandler
public void onCraft(CraftItemEvent e) {
List<ShapelessRecipe> recipes = RecipeListeners.recipes;
if (recipes.contains(e.getRecipe())) {
if (e.getWhoClicked().hasPermission("headsplus.craft")) {
return;
} else {
e.setCancelled(true);
}
}
}

}
2 changes: 1 addition & 1 deletion main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main: io.github.thatsmusic99.headsplus.HeadsPlus
name: HeadsPlus
version: 0.6.1
version: 0.7
description: Spawns in heads with extra features.
author: Thatsmusic99
commands:
Expand Down

0 comments on commit 8b77cd3

Please sign in to comment.