Coding help (Noob)

Discussion in 'Plugin Development' started by andrewginn, Oct 27, 2014.

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

    es359

    Wow this thread. If you are using Static in your plugins you should better know why. Otherwise, Don't. Use. It. Please.
    Don't use youtube. Please use books. Or java's documentation. Also, LEARN JAVA before attempting to write Bukkit plugins. I can't make it any more simple than that.


    If that's what you think, you can stop now.
     
    CraftCreeper6 likes this.
  2. FerusGrim Cus you're all saying don't watch YouTube videos. And all saying I'm using logger etc when I don't and you're all here crying about it lol.

    Edit: es359 #FuckPostmanPat
     
  3. Offline

    mythbusterma

    TheGamesHawk2001

    pogostickdev does it too, and it's funny that you rush to defend your precious YouTube tutorials in such a fashion, that's not even the bad practice I'm talking about, but nice try. There's tons of other examples of bad practice, just look at what andrewginn came up with, by watching one of those tutorials and not knowing java (or what he's doing). I rest my case m
     
    andrewginn and CraftCreeper6 like this.
  4. Offline

    andrewginn

  5. mythbusterma What am I doing bad then? Surely, if a "tutorialer" uses logger etc, I can ajust my code in a way that isn't, well, using logger. PogoStick29
     
  6. Offline

    CraftCreeper6

    andrewginn
    Could I see your plugin.yml?
    And yes, change your class name to "Main" << exact capitalization.
     
  7. Offline

    andrewginn

    mythbusterma What did i do wrong? :D

    CraftCreeper6 i dont have a plugin.yml i didnt think i needed it for a recipe?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  8. Offline

    CraftCreeper6

    andrewginn
    You need a plugin.yml for EVERY plugin you make.
     
  9. Offline

    andrewginn

  10. Offline

    es359

  11. Offline

    andrewginn

    SHOUTOUT TO CraftCreeper6 HE SOLVED IT :D THERE WAS NO PLUGIN.YML AND I ADDED ONE AND IT FIXED IT (MY CAPS LOCK IS STUCK BRB LEMME FIX IT)
     
    es359 likes this.
  12. Offline

    CraftCreeper6

  13. Offline

    andrewginn

    @CRAFTERCREEPER6 Ok fixed it just needed to unplug it and plug it back in.
    One last thing how do i implement it so it works with votifer.
    I vote for my server, i receive the key and how do i implement it so a playerevent happens with the key to open the crate, also how do i make the crate?
     
  14. Offline

    CraftCreeper6

  15. Offline

    andrewginn

    CraftCreeper6 Where do i look, or do i install it also i dont know the code, can you link a video or post the code down below. Thanks also im getting a error with the colors i dont know how to fix it here is the new code:
    http://pastebin.com/pL82iUD7
     
  16. Offline

    CraftCreeper6

    andrewginn
    Download the plugin. Add it to your External Jar's. Use the API I linked. It has custom events & you can add items to the voters inventory. Scroll down and you'll find the API.
     
  17. Offline

    andrewginn

  18. Offline

    CraftCreeper6

  19. Offline

    andrewginn

    CraftCreeper6 Ok i understand it but how do i give them the item when they vote?
     
  20. Offline

    CraftCreeper6

    andrewginn
    Never used the Votifier API before but I believe you would get the vote. I think you may have to cast Player to the Voter.
    Code:java
    1. Player player = (Player) e.getVote();


    Not sure. I believe it returns a String of the player name.
     
  21. Offline

    andrewginn

  22. Offline

    CraftCreeper6

    andrewginn
    What line, where?
    EDIT: Change to this:
    Code:java
    1. package me.andrew.Test;
    2.  
    3. import java.util.ArrayList;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.Material;
    8. import org.bukkit.enchantments.Enchantment;
    9. import org.bukkit.inventory.ItemStack;
    10. import org.bukkit.inventory.ShapedRecipe;
    11. import org.bukkit.inventory.meta.ItemMeta;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. public class Main extends JavaPlugin
    15. {
    16.  
    17. @Override
    18. public void onEnable()
    19. {
    20. ItemStack tripwirehook = new ItemStack(Material.TRIPWIRE_HOOK, 1);
    21. ItemMeta meta = tripwirehook.getItemMeta();
    22. meta.setDisplayName(ChatColor.RED + "Vote Crate Key");
    23.  
    24. ArrayList<String> lore = new ArrayList<String>();
    25. lore.add(ChatColor.GRAY + "Click the" + ChatColor.GREEN + "Vote Crate treasure chest" + ChatColor.GRAY + "to use this key");
    26.  
    27. meta.setLore(lore);
    28.  
    29. tripwirehook.setItemMeta(meta);
    30.  
    31. ShapedRecipe Votekey = new ShapedRecipe(tripwirehook);
    32. Votekey.shape(new String[] { " s ", " s ", " w " }).setIngredient('w', Material.WHEAT).setIngredient('s', Material.STICK);
    33. Bukkit.getServer().addRecipe(Votekey);
    34. }
    35.  
    36. }
     
  23. Offline

    andrewginn

  24. Offline

    FerusGrim

    You're forgetting the '+' between sections.

    Code:java
    1. lore.add(ChatColor.GRAY + "Click the" + ChatColor.GREEN + "Vote Crate treasure chest" + ChatColor.GRAY + "to use this key");
     
  25. Offline

    CraftCreeper6

  26. Offline

    andrewginn

    CraftCreeper6 and FerusGrim thank you both for the help im going to follow you both :)
    Also if you play on arkham network i will give you a ton of money :D
     
  27. Offline

    CraftCreeper6

    andrewginn
    I don't need money, don't worry about it :)
     
  28. Offline

    andrewginn

    CraftCreeper6 FerusGrim 1 last thing above the custom lore it saids "Redstone" How do i remove it?

    Oh dw i fixed it :D

    CraftCreeper6 and FerusGrim How do i do this? with the player interact event if he right clicks a chest then with coding to check if the item in his hand is a tripwire hook and then take away the key and give him a random chance to win something.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  29. Offline

    CraftCreeper6

  30. Offline

    andrewginn

    CraftCreeper6 What is this meant to tell me i have already learned the basics?
     
Thread Status:
Not open for further replies.

Share This Page