Golden Heads

Discussion in 'Plugin Requests' started by AleXutzZu_, Jul 20, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    AleXutzZu_

    Plugin category: Crafting

    Minecraft version: 1.7-1.8

    Suggested name: GoldenHeads*

    What I want: I want a plugin which enables the crafting of golden heads. It requires 8 gold ingots and 1 skull in the following format: # - gold ingot ; @ - head
    ###
    #@#
    ###
    It has a config in which I can define what effects to give when the head is consumed and I'd like to be able to edit the golden head's name, item (e.g. golden_apple) and lore.

    Ideas for commands: /gh reload - Reloads the plugin

    Ideas for permissions: goldenheads.craft (To allow players to craft a golden head)
    goldenheads.reload (Reload the plugin)

    When I'd like it by: The following week

    *I know that I can find skripts or plugins on spigot/bukkit but none of them require a permission to be able to craft them and I'd like to have that permission so I can make some rewards based on the amount of kills a player has in a minigame.
     
  2. Offline

    johnny boy

    I will attempt this.
     
  3. Offline

    nethergoblin

    I can do this give me a hour or less

    EDIT 1 >
    -Nvm cant do this got busy-
    Code if someone wants to follow up on it, just needs configuration added so pretty simple
    Code:
    package me.nethergoblin;
    
    import java.io.File;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class MainPluginName extends JavaPlugin {
    
        Utility ut = new Utility();
     
        public void onEnable() {
            getServer().getPluginManager().registerEvents(new Events(this), this);
            createConfig();
            ut.addGoldenHead();
        }
    
        public void onDisable() {
            saveConfig();
        }
    
        private void createConfig() {
            try {
                if (!getDataFolder().exists()) {
                    getDataFolder().mkdirs();
                }
                File file = new File(getDataFolder(), "config.yml");
                if (!file.exists()) {
                    getLogger().info("Config.yml not found, creating!");
                    saveDefaultConfig();
                } else {
                    getLogger().info("Config.yml found, loading!");
                }
            } catch (Exception e) {
                e.printStackTrace();
    
            }
    
        }
    
    }
    
    Code:
    package me.nethergoblin;
    [CODE]package me.nethergoblin;
    
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.ShapedRecipe;
    import org.bukkit.inventory.meta.ItemMeta;
    
    public class Utility {
    
        public void addGoldenHead() {
            Material mat = Material.GOLDEN_APPLE;
            ItemStack head = new ItemStack(mat);
            ItemMeta meta = head.getItemMeta();
            meta.setDisplayName(ChatColor.GOLD + "Golden Head");
         
            ShapedRecipe recipe = new ShapedRecipe(head);
            recipe.shape("GGG","GSG","GGG");
            recipe.setIngredient('S', Material.SKULL);
            recipe.setIngredient('G', Material.GOLD_INGOT);
        }
     
    }
    
    Code:
    
    import org.bukkit.ChatColor;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEvent;
    
    public class Events implements Listener {
    
        MainPluginName plugin;
    
        public Events(MainPluginName plugin) {
            this.plugin = plugin;
        }
    
        @EventHandler
        public void EventName(PlayerInteractEvent event) {
            if(event.getPlayer().getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Golden Apple")) {
                event.getPlayer().getInventory().remove(event.getPlayer().getItemInHand());
                event.getPlayer().setHealth(event.getPlayer().getHealth() + 5.0);
            }
        }
    }
    
     
    Last edited: Jul 21, 2018
  4. Offline

    tkuiyeager1

    I will try to make it for you
     
  5. Offline

    AleXutzZu_

    Has anyone made any progress on this so far?
     
  6. Offline

    johnny boy

    assumed other people did - I stopped when that other guy said "ill do it" I tend to just give up when that happens..
     
  7. Offline

    InstanceofDeath

    I am close to done. The main problem is that I can't delete the Potioneffects given by the golden apple itself.

    Okey, here you go.

    This plugin needs a short instruction to work so READ IT closely:

    1. When someone crafts the item who doesn't have the permission, the item will still appear in the workbench but not be able to be picked up (CraftItemEvents fault)

    2. The config is very sensitive so listen even more closely:

    You have to create a folder in your plugins folder with the name "GoldenHeads" (everything is casesensitive) in which you create the config.yml

    My config.yml looks like this:
    ----------------------------------
    Name: "&6Cheesecake"
    Lore:
    - "&5Test"
    - "&4Cucumber"
    Potioneffects:
    - INVISIBILITY,10,0
    - HUNGER,100,2
    ---------------------------------- (those are just markers)

    I would suggest you to copy those 7 lines and then start to edit them.
    You can use & as colorcodes. (https://minecraft.gamepedia.com/Formatting_codes)

    The Potioneffects are in a specific format (no spaces between the commas)

    PotioneffectType,Duration,Strengths

    All Potioneffecttypes you can use can be seen here:

    http://docs.codelanx.com/Bukkit/1.8/org/bukkit/potion/PotionEffectType.html (Field)


    3. As I already said, I had no idea how to delete the Potioneffects given by the golden apple

    4. I removed the reload-command as it's a bit useless in my opinion

    If everything works fine, I would appreciate a small thank you, as this took a while
    If not, just write it in this chat.

    P.S. Sorry for my bad English

    https://www.dropbox.com/s/u9adzye9l122uof/GoldenHeads.jar?dl=0

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Jul 23, 2018
  8. Offline

    AleXutzZu_


    Well, thank you! But the crafting doesn't work. I loaded the plugin, made the folder & config and copied the config and I restarted the server and it doesn't work.

    Has anyone else tried to code it? I really need this plugin ASAP

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 24, 2018
Thread Status:
Not open for further replies.

Share This Page