Looking for a yaml developer

Discussion in 'Plugin Development' started by mastermustard, Feb 17, 2013.

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

    mastermustard

    new topic im getting errors scroll down...
     
  2. Offline

    Tirelessly

    Is this a joke?
     
    Birdgeek3 and microgeek like this.
  3. Offline

    mastermustard

    naa i seriousely suck with yaml
     
  4. Offline

    Tirelessly

    Its not hard at all. Get an online yaml parser. Just indent code by 4(?) spaces each level
     
    ShootToMaim likes this.
  5. Offline

    Burnett1

    ok.... May i ask how you have managed to make a plugin.yml
     
  6. Offline

    gomeow

    Tirelessly
    It doesn't matter how many spaces, as long as parallel elements have the same left justification and the hierarchically nested elements are indented further.
     
  7. Offline

    mastermustard

    i don't plan to do a new line for every string
     
  8. Offline

    ShootToMaim

    plugin.yml.
    When using Eclipse:
    New File => File

    Name it plugin.yml.
    Done.
     
  9. Offline

    Sagacious_Zed Bukkit Docs

    It needs valid contents. What you have is not valid content :D
     
  10. Offline

    ShootToMaim

    [quote uid=90562329 name="Sagacious_Zed" post=1553267]It needs valid contents. What you have is not valid content :D[/quote]
    Code:java
    1. name: SimpleFly
    2. main: code.shoottomaim.simplefly.SimpleFly
    3. version: 1.4.7
    4. authors: [ShootToMaim, Tyzoid]
    5. website: <Edit by Moderator: Redacted bit url>
    6. commands:
    7. fly:
    8. description: Take to the skies!
    9. usage: /fly
    10. aliases: [efly]
    11. stopfly:
    12. description: Stop flying.
    13. usage: /stopfly
    14. aliases: [safk]
    15. sfinfo:
    16. description: Get's info on commands.
    17. usage: /sfinfo
    18. permissions:
    19. SimpleFly.fly:
    20. description: Allows a player to fly!
    21. default: op
    22. SimpleFly.pvp:
    23. description: Allows a player to PVP while flying!
    24. default: op
    25. SimpleFly.nodamage:
    26. description: Prevents a player from being damamged while flying!
    27. default: op
    28. SimpleFly.teleport:
    29. description: Allows flight to persist through teleports.
    30. default: op
    31. SimpleFly.potion:
    32. description: Allows player to throw potions in the air
    33. default: op
     
    Last edited by a moderator: Feb 17, 2017
  11. Offline

    mastermustard

    [quote uid=90596049 name="ShootToMaim" post=1553270]
    Code:java
    1. name: SimpleFly
    2. main: code.shoottomaim.simplefly.SimpleFly
    3. version: 1.4.7
    4. authors: [ShootToMaim, Tyzoid]
    5. website: <Edit by Moderator: Redacted bit url>
    6. commands:
    7. fly:
    8. description: Take to the skies!
    9. usage: /fly
    10. aliases: [efly]
    11. stopfly:
    12. description: Stop flying.
    13. usage: /stopfly
    14. aliases: [safk]
    15. sfinfo:
    16. description: Get's info on commands.
    17. usage: /sfinfo
    18. permissions:
    19. SimpleFly.fly:
    20. description: Allows a player to fly!
    21. default: op
    22. SimpleFly.pvp:
    23. description: Allows a player to PVP while flying!
    24. default: op
    25. SimpleFly.nodamage:
    26. description: Prevents a player from being damamged while flying!
    27. default: op
    28. SimpleFly.teleport:
    29. description: Allows flight to persist through teleports.
    30. default: op
    31. SimpleFly.potion:
    32. description: Allows player to throw potions in the air
    33. default: op
    [/quote]
    .........

    i already did that.... im talking bout configs.....

    guys... i already failed.... please help? http://pastie.org/6205791

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 17, 2017
  12. Offline

    ShootToMaim

  13. Offline

    Burnett1

    ok paste this in
    Code:
    Allow-Creative-PvP: false 
    Allow-Flying-PvP: false   
    Allow-Item-Drop: false   
    Allow-Chest-Interact: false   
    Allow-Crafting: false   
    Allow-Dispenser-Interact: false   
    Allow-Furnace-Interact: false   
    Allow-Enchanting: false 
    Allow-EndChest-Interact: false 
    Allow-Brewing: false   
    Allow-Anvil-Interact: false   
    Allow-Beacon-Interact: false   
    Allow-Villager-Trading: false   
    Allow-Bedrock: false 
    Allow-Lava: false 
    Allow-Beacon-Place: false 
    Allow-Water: false 
    Allow-TnT-Place: false
    
    Simple as.

    Its funny you can do the hard java part but you cant do the easy bit.

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

    mastermustard

    im getting a null pointer whenever i go to do one of the events. its coming from the line in which i get the config.
    its a null pointer exception.
    Code:
            if(!(player.hasPermission("CC.dropbypass"))){
                if(player.getGameMode() == GameMode.CREATIVE){
                    boolean drop = plugin.getConfig().getBoolean("Allow-Item-Drop"); //error here
                    if(!(drop)){
                    event.getItemDrop().getItemStack().getType();
                        event.setCancelled(true);
                    }
               
                }
            }
        }
    thats just an example it does the same for all the events

    config is
    Code:
    Allow-Creative-PvP: false
    Allow-Flying-PvP: false
    Allow-Item-Drop: false
    Allow-Chest-Interact: false
    Allow-Crafting: false
    Allow-Dispenser-Interact: false
    Allow-Furnace-Interact: false
    Allow-Enchanting: false
    Allow-EndChest-Interact: false
    Allow-Brewing: false
    Allow-Anvil-Interact: false
    Allow-Beacon-Interact: false
    Allow-Villager-Trading: false
    Allow-Bedrock: false
    Allow-Lava: false
    Allow-Beacon-Place: false
    Allow-Water: false
    Allow-TnT-Place: false
     
  15. Offline

    Burnett1

    Can you post your on enable and your permissions creation code.

    also try this where you have plugin.getConfig() change it to this.getConfig(). Might not make a difference but has fixed stuff in past for me.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  16. Offline

    mastermustard

    this.getConfig() doesnt work because its not the main class in which that code is in.

    heres the main class
    Code:
    package com.gmail.btincher99;
     
    import java.util.logging.Logger;
     
    import org.bukkit.Bukkit;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class controlledcreative extends JavaPlugin{
        public final Logger logger = Logger.getLogger("Minecraft");
       
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " Has been disabled");
        }
     
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has been enabled");
            Bukkit.getServer().getPluginManager().registerEvents(new  CCBlockListener(), this);
            Bukkit.getServer().getPluginManager().registerEvents(new  CCPlayerListener(), this);
            getConfig().options().copyDefaults(true);
            saveConfig();
       
        }
    }
     
  17. Offline

    microgeek

    [​IMG]
     
    raGan. likes this.
  18. Offline

    mastermustard

    ?????
     
  19. Offline

    Burnett1

    Ok you dont register your permissions. Can i see your permissions section.
     
  20. Offline

    mastermustard

    dont exactly have one......

    EDIT: wait do you mean what the permission nodes are???
     
  21. Offline

    MrMag518

    The permissions section in your plugin.yml file I guess.

    Could you give us a sample of the NPE you get?
     
  22. Offline

    Burnett1

    Ok in my plugin i have a class to make the permissions and then activate them in the onEnable heres my code.
    Code:
    package me.kyle.burnett.expfly;
     
    import org.bukkit.permissions.Permission;
     
    public class Permissions {
       
        public Permission user = new Permission("expfly.user");
        public Permission admin = new Permission("expfly.admin");
     
    }
    
    And the activation:

    Code:
    @Override
        public void onEnable() {
           
            this.logger.info("[EXP-Fly] Has been enabled!");
           
            PluginManager pm = this.getServer().getPluginManager();
           
            pm.addPermission(new Permissions().user);
            pm.addPermission(new Permissions().admin);
           
            this.getConfig().options().copyDefaults(true);
            this.saveConfig();
           
           
        }
     
  23. Offline

    MrMag518

    I'm pretty sure adding the permissions to the plugin.yml would do the same.
    I guess both ways are both as good =)
     
  24. Offline

    Burnett1

    ok see here " if(!(drop)){" try changing it to "if(!drop){"
     
  25. Offline

    mastermustard

    Code:
        @EventHandler(priority = EventPriority.HIGHEST)
        public void ItemDrop(PlayerDropItemEvent event){
            Player player = event.getPlayer();
     
            if(!(player.hasPermission(DB))){
                if(player.getGameMode() == GameMode.CREATIVE){
                    boolean drop = plugin.getConfig().getBoolean("Allow-Item-Drop");
                    if(!drop){
                    event.getItemDrop().getItemStack().getType();
                        event.setCancelled(true);
                       
                    }
                 
                }
            }
        }
    Code:
    2013-02-17 16:24:11 [SEVERE] Could not pass event PlayerDropItemEvent to ControlledCreative v1.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
        at net.minecraft.server.v1_4_R1.EntityHuman.a(EntityHuman.java:441)
        at net.minecraft.server.v1_4_R1.EntityHuman.drop(EntityHuman.java:403)
        at net.minecraft.server.v1_4_R1.PlayerConnection.a(PlayerConnection.java:1310)
        at net.minecraft.server.v1_4_R1.Packet107SetCreativeSlot.handle(SourceFile:21)
        at net.minecraft.server.v1_4_R1.NetworkManager.b(NetworkManager.java:290)
        at net.minecraft.server.v1_4_R1.PlayerConnection.d(PlayerConnection.java:113)
        at net.minecraft.server.v1_4_R1.ServerConnection.b(SourceFile:39)
        at net.minecraft.server.v1_4_R1.DedicatedServerConnection.b(SourceFile:30)
        at net.minecraft.server.v1_4_R1.MinecraftServer.r(MinecraftServer.java:598)
        at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:224)
        at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:494)
        at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java:427)
        at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:849)
    Caused by: java.lang.NullPointerException
        at com.gmail.btincher99.CCPlayerListener.ItemDrop(CCPlayerListener.java:69)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
        ... 16 more
    
    I also added what you said with the permissions
     
  26. Offline

    Burnett1

    ok what line of code is line 69 in that.
     
  27. Offline

    mastermustard

    boolean drop = plugin.getConfig().getBoolean("Allow-Item-Drop"); same line as b4
     
  28. Offline

    Burnett1

    try sending a message right before that code and see if it will send. This has stumped me.
     
  29. Offline

    mastermustard

    im gonna move this the topic is misleading now
     
  30. Offline

    MrMag518

    Could you paste your CCPlayerListener and the class containing your config?
     
Thread Status:
Not open for further replies.

Share This Page