Solved I need some help :)

Discussion in 'Plugin Development' started by LeonTG77, Oct 29, 2014.

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

    LeonTG77

    I just want some help, i've been trying lots of stuff that didn't work.
    I have some stuff I need help with and @TheMintyMate can you help here too? :3

    I'm working on a UHC plugin, and I'm having these errors:

    1. FIXED

    2. Spectators block people from placing blocks where a spectator is standing

    3. FIXED

    4. FIXED

    Please help me find errors and help me fix the stuff I asked for
     
  2. Offline

    fireblast709

    LeonTG77 please stop abusing static for lazy access. For the block placing, I refer to BlockCanBuildEvent.
     
  3. Offline

    LeonTG77

    fireblast709 I just like static, makes me able to have different classes for stuff to find it more easy :3
     
  4. Offline

    fireblast709

    LeonTG77 yea... it's considered a bad habit. You should learn how to use constructors to pass around instances.

    As a side note: are you fully aware what static is and what it does? Are you also aware of why people think that you shouldn't rely on static (for 99 out of 100 things) (pretty important questions!)
     
  5. Offline

    LeonTG77

    fireblast709 I know how to, I'm just
    :p
     
  6. Offline

    Rocoty

    LeonTG77 Code is not supposed to be strict and concrete, but versatile and extensible. Extensive use of static makes your code less so.
     
    es359 likes this.
  7. Offline

    LeonTG77

    I added a 4th thing to my list of I need helpz
    @fireblast709 This sounds stupid, but how to I check if theres a spectator where hes placing/breaking it?
     
  8. Offline

    glassbillen

    About the crafting recipie:
    Im not sure, but first, add this to your ondisable:
    Code:java
    1. getServer().clearRecipes();
    2.  

    and for the code:
    Code:java
    1. ItemStack Stick = new ItemStack(Material.STICK, 1);
    2. ItemMeta StickMeta = Stick.getItemMeta();
    3. StickMeta.setDisplayName(ChatColor.DARK_PURPLE + "My nice stick");
    4. Stick.setItemMeta(StickMeta);
    5. //AK47
    6. ShapedRecipe stick = new ShapedRecipe(Stick)
    7. .shape(" / ", " / ", " / ")
    8. .setIngredient('/', Material.STICK);
    9. getServer().addRecipe(stick);
    10.  

    And add this to your onEnable (This is just a example^^
     
  9. Offline

    LeonTG77

    glassbillen I already had that stuff on onEnable/disable
    Code:java
    1. @Override
    2. public void onDisable() {
    3. getServer().clearRecipes();
    4. }
    5.  
    6. @Override
    7. public void onEnable() {
    8. goldenhead();
    9. }
     
  10. Offline

    fireblast709

    LeonTG77
    1. your best bet would be setting the experience to 0 in the event, and spawning a new experience orb with the previous amount.
    2. For the block placing, and I'm just repeating myself, BlockCanBuildEvent. I don't know why they can't break blocks, but if they aren't hidden for the players I wouldn't be surprised.
    3. Could you explain your issue a bit more.
    4. Only two remarks:
      1. You don't have to wrap head in a new ItemStack
      2. In the case you try the recipe with playerheads, add a datavalue to the ingredient.
     
  11. Offline

    glassbillen

    k
     
  12. Offline

    LeonTG77

    ok, thanks, I'll try that.
    I use online-players.hidePlayer(spectator) on the onplayerdeath event, so their hidden for everyone that isn't spectating, again I ask how do I detect when theres a spectator standing where the block is placed or am I just not understanding what you mean by that event, also, when a spectator is standing infront of you when you try to mine/hit you just get the crit particles/enchant particles and you hit nothing really

    ok, thanks, I'll try that.

    So I have the spread command I made, where I use dispatch command to make console do /spreadplayers 0 0 <radius> <maxradius> then I put everyone that is online's name here and then true for spreading teams, but bukkit /spreadplayers doesn't spread the teams together
     
  13. Offline

    es359

  14. Offline

    MineStein

    For the experience bug with spectators, use the PlayerExpChangeEvent and set the amount to zero.
     
  15. Offline

    LeonTG77

    Breaking blocks when a spectator is there, exp pickup by spectators fixed and and the custom recipie is fixed, now only spreading teams and placing blocks at spectators left
     
  16. Offline

    LeonTG77

    I fixed 1, 3 and 4, now only placing blocks where a spectator is
    fireblast709 Could you explain a bit more on BlockCanBuildEvent?
     
  17. Offline

    Orange Tabby

    LeonTG77 I think this works
    Code:java
    1. Player p = //Get Player
    2. for (Player ps : Bukkit.getOnlinePlayers()) {
    3. ps.hideplayer(p);
     
  18. Offline

    LeonTG77

    Orange Tabby
    I already have hideplayer when you get set into spectator, but if a spectator stand where the player is placing a block, it will just despawn and player might fall or something
     
  19. Offline

    Orange Tabby

    LeonTG77 oh well sorry that's the only thing I can think of :)
    Hope you can find it
     
  20. Offline

    fireblast709

    LeonTG77 if the block can't be placed because of a Player (I assume the most basic thing to check is if there is a spectator on the block, and no other players), set it buildable (see event in documentation).
     
Thread Status:
Not open for further replies.

Share This Page