Solved Depose Money with a lore...

Discussion in 'Plugin Development' started by Sneling, May 13, 2014.

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

    Sneling

    Hello,
    i wanted to create a plugin, wich with that, you can make that when the player right click a paper, if the paper's lore contains MONEY, give the amount of money in lore 1...

    Is it possible?
    Main:
    Code:java
    1. package fr.sneling.prisonbreak.dpmoney;
    2.  
    3. import net.milkbowl.vault.economy.Economy;
    4. import net.milkbowl.vault.economy.EconomyResponse;
    5.  
    6. import org.bukkit.Material;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.event.block.Action;
    11. import org.bukkit.event.player.PlayerInteractEvent;
    12. import org.bukkit.inventory.ItemStack;
    13. import org.bukkit.plugin.RegisteredServiceProvider;
    14. import org.bukkit.plugin.java.JavaPlugin;
    15.  
    16. public class Main extends JavaPlugin implements Listener{
    17.  
    18. public static Economy econ = null;
    19.  
    20. public void onEnable(){
    21. getLogger().info("[DP Money] DP Money v" + getDescription().getVersion() +" is now enabled!" );
    22. getServer().getPluginManager().registerEvents(this, this);
    23. if (!setupEconomy() ) {
    24. getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    25. getServer().getPluginManager().disablePlugin(this);
    26. return;
    27. }
    28. }
    29. private boolean setupEconomy() {
    30. if (getServer().getPluginManager().getPlugin("Vault") == null) {
    31. return false;
    32. }
    33. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    34. if (rsp == null) {
    35. return false;
    36. }
    37. econ = rsp.getProvider();
    38. return econ != null;
    39. }
    40.  
    41. @EventHandler
    42. public void onInteract(PlayerInteractEvent e){
    43. Player p = e.getPlayer();
    44. if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
    45. if(p.getItemInHand().equals(new ItemStack(Material.PAPER))){
    46. ItemStack item = p.getItemInHand();
    47. if(item.getItemMeta().getLore().contains("MONEY")){
    48. EconomyResponse r = econ.depositPlayer(p.getName(), item.getItemMeta().getLore().get(index));
    49.  
    50. }
    51. }
    52. }
    53. }
    54. }
    55.  
     
  2. Offline

    DxDy

    Of course it is possible ;) What exactly are you asking? Does the code work ? If not: What error do you get? What does happen?
     
  3. Offline

    Sneling

    It's not finished at all x)
    I just want to do that the plugin gives money to a player...
    I want that the amount of money is set in the lores.
    And i'll try for working or not

    EDIT : The PLugin Launch correctly
     
  4. Offline

    DxDy

    Btw, you should check .hasLore before you operate on the lore.

    Regarding the actual problem, you're not far from solving it. The above code should work for most parts, you only need to convert the line from the lore to an actual number. (See Double.parseDouble or Integer and don't forget to handle NumberFormatExceptions).

    Note that your code only checks for a line that is exactly "MONEY". If there's something else behind it in the line, it won't trigger.
     
  5. Offline

    stuntguy3000

    Sneling So is it working or not?
     
  6. Offline

    Sneling

    For the Money, i know .. and thats what i want.. I finishing creating a command for having paper w/ lores.. etc and i say how the test finished
     
  7. Offline

    JoeyDevs

    O,o intresting i have posted this 1-3 days ago with the same concept.
    So yes it is possible! Soon I will 'release' a plugin with this feature.
     
  8. Offline

    Sneling

    Ok.. i have done some strange errors.. Invalid plugin.yml
    plugin.yml:
    Code:
    main: fr.sneling.prisonbreak.dpmoney.Main
    name: DP Money
    version: 1.0
    commands:
        dpmoney:
            description: admin only
            aliase:[dpm]
    Main:
    Code:java
    1. package fr.sneling.prisonbreak.dpmoney;
    2.  
    3. import java.util.Arrays;
    4.  
    5. import net.milkbowl.vault.economy.Economy;
    6.  
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.event.block.Action;
    15. import org.bukkit.event.player.PlayerInteractEvent;
    16. import org.bukkit.inventory.ItemStack;
    17. import org.bukkit.inventory.meta.ItemMeta;
    18. import org.bukkit.plugin.RegisteredServiceProvider;
    19. import org.bukkit.plugin.java.JavaPlugin;
    20.  
    21. public class Main extends JavaPlugin implements Listener{
    22.  
    23. public static Economy econ = null;
    24.  
    25. public void onEnable(){
    26. getLogger().info("[DP Money] DP Money is now enabled!" );
    27. getServer().getPluginManager().registerEvents(this, this);
    28. if (!setupEconomy() ) {
    29. getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    30. getServer().getPluginManager().disablePlugin(this);
    31. return;
    32. }
    33. }
    34. private boolean setupEconomy() {
    35. if (getServer().getPluginManager().getPlugin("Vault") == null) {
    36. return false;
    37. }
    38. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    39. if (rsp == null) {
    40. return false;
    41. }
    42. econ = rsp.getProvider();
    43. return econ != null;
    44. }
    45.  
    46. public boolean onCommand(CommandSender sender, Command cmd, String string, String[] args){
    47. if(cmd.getLabel().equalsIgnoreCase("dpmoney")){
    48. if(!(sender instanceof Player)){
    49. sender.sendMessage("Only for Players!");
    50. }
    51. if(args.length != 1){
    52. sender.sendMessage(ChatColor.RED +" Usage: /dpmoney <Number Of Money>");
    53. }
    54. ItemStack paper = new ItemStack(Material.PAPER);
    55. ItemMeta meta = paper.getItemMeta();
    56. meta.setLore(Arrays.asList(new String[] { args[0] }));
    57. meta.setLore(Arrays.asList(new String[] { ChatColor.GRAY +"MONEY" }));
    58. paper.setItemMeta(meta);
    59. }
    60. return false;
    61. }
    62.  
    63. @EventHandler
    64. public void onInteract(PlayerInteractEvent e){
    65. Player p = e.getPlayer();
    66. if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
    67. if(p.getItemInHand().equals(new ItemStack(Material.PAPER))){
    68. ItemStack item = p.getItemInHand();
    69. if(!item.getItemMeta().hasLore()){
    70. return;
    71. }
    72. if(item.getItemMeta().getLore().contains("MONEY")){
    73. p.sendMessage("sweg");
    74. }
    75. }
    76. }
    77. }
    78. }
    79.  


    Error:
    Code:
    [15:18:11] [Server thread/INFO]: Starting minecraft server version 1.7.9
    [15:18:11] [Server thread/INFO]: Loading properties
    [15:18:11] [Server thread/INFO]: Default game type: SURVIVAL
    [15:18:11] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-1438 (MC: 1.7.9) (Implementing API version 1.7.9-R0.1-SNAPSHOT)
    [15:18:11] [Server thread/INFO]: Server Ping Player Sample Count: 12
    [15:18:11] [Server thread/INFO]: Using 4 threads for Netty based IO
    [15:18:11] [Server thread/INFO]: Generating keypair
    [15:18:11] [Server thread/INFO]: Starting Minecraft server on *:25565
    [15:18:11] [Server thread/WARN]: Plugin `Egien_Lobby_Item v1.0' uses the space-character (0x20) in its name `Egien Lobby Item' - this is discouraged
    [15:18:11] [Server thread/WARN]: Plugin `Modular_Chat v1.0' uses the space-character (0x20) in its name `Modular Chat' - this is discouraged
    [15:18:11] [Server thread/WARN]: Plugin `Pvp_Box_For_Xoz v1.0' uses the space-character (0x20) in its name `Pvp Box For Xoz' - this is discouraged
    [15:18:11] [Server thread/WARN]: Plugin `Kits_by_Sneling v1.0' uses the space-character (0x20) in its name `Kits by Sneling' - this is discouraged
    [15:18:11] [Server thread/ERROR]: Could not load 'plugins\[PrisonBreak] DP Money.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:160) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot.jar:git-Spigot-1438]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:362) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:135) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:450) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1438]
    Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key; could not found expected ':';  in 'reader', line 7, column 21:
        aliase:[dpm]
                    ^
        at org.yaml.snakeyaml.scanner.ScannerImpl.removePossibleSimpleKey(ScannerImpl.java:514) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.scanner.ScannerImpl.fetchStreamEnd(ScannerImpl.java:588) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:301) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:558) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) ~[spigot.jar:git-Spigot-1438]
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:412) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:189) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:155) ~[spigot.jar:git-Spigot-1438]
        ... 5 more
    [15:18:11] [Server thread/ERROR]: Could not load 'plugins\PvPBoxForZOX.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NullPointerException
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot.jar:git-Spigot-1438]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:362) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:135) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:450) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1438]
    Caused by: java.lang.NullPointerException
        at fr.sneling.pvpboxforzox.Main.<init>(Main.java:21) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_55]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_55]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_55]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_55]
        at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_55]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[spigot.jar:git-Spigot-1438]
        ... 6 more
    [15:18:11] [Server thread/ERROR]: Could not load 'plugins\[CraftYourServer][XRaider70] Kits.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NullPointerException
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot.jar:git-Spigot-1438]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:362) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:135) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:450) [spigot.jar:git-Spigot-1438]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1438]
    Caused by: java.lang.NullPointerException
        at fr.sneling.xraider70.kits.Main.<init>(Main.java:31) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_55]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_55]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_55]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_55]
        at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_55]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[spigot.jar:git-Spigot-1438]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[spigot.jar:git-Spigot-1438]
        ... 6 more
    [15:18:11] [Server thread/INFO]: [Vault] Loading Vault v1.2.31-b411
    [15:18:11] [Server thread/INFO]: [Egien_Lobby_Item] Loading Egien_Lobby_Item v1.0
    [15:18:11] [Server thread/INFO]: [MineFeat] Loading MineFeat v1.0
    [15:18:11] [Server thread/INFO]: [VelyriaCraft] Loading VelyriaCraft v1.0
    [15:18:11] [Server thread/INFO]: [Modular_Chat] Loading Modular_Chat v1.0
    [15:18:11] [Server thread/INFO]: [Essentials] Loading Essentials v2.13.1
    [15:18:11] [Server thread/INFO]: [EssentialsChat] Loading EssentialsChat v2.13.1
    [15:18:11] [Server thread/INFO]: [EssentialsProtect] Loading EssentialsProtect v2.13.1
    [15:18:11] [Server thread/INFO]: [EssentialsSpawn] Loading EssentialsSpawn v2.13.1
    [15:18:11] [Server thread/INFO]: [EssentialsAntiBuild] Loading EssentialsAntiBuild v2.13.1
    [15:18:11] [Server thread/INFO]: [Vault] Enabling Vault v1.2.31-b411
    [15:18:11] [Server thread/INFO]: [Vault] [Vault][Economy] Essentials Economy found: Waiting
    [15:18:11] [Server thread/INFO]: [Vault] [Vault][Permission] SuperPermissions loaded as backup permission system.
    [15:18:11] [Server thread/INFO]: [Vault] [Vault] Enabled Version 1.2.31-b411
    [15:18:11] [Server thread/INFO]: **** Beginning UUID conversion, this may take A LONG time ****
    [15:18:11] [Server thread/INFO]: Preparing level "world"
    [15:18:11] [Server thread/INFO]: -------- World Settings For [world] --------
    [15:18:11] [Server thread/INFO]: View Distance: 10
    [15:18:11] [Server thread/INFO]: Experience Merge Radius: 3.0
    [15:18:11] [Server thread/INFO]: Chunks to Grow per Tick: 650
    [15:18:11] [Server thread/INFO]: Clear tick list: false
    [15:18:11] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [15:18:11] [Server thread/INFO]: Mob Spawn Range: 4
    [15:18:11] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [15:18:11] [Server thread/INFO]: Item Despawn Rate: 6000
    [15:18:11] [Server thread/INFO]: Item Merge Radius: 2.5
    [15:18:11] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [15:18:11] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [15:18:11] [Server thread/INFO]: Sending up to 5 chunks per packet
    [15:18:11] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Cane Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Melon Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Max Entity Collisions: 8
    [15:18:11] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
    [15:18:11] [Server thread/INFO]: Structure Info Saving: true
    [15:18:11] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    [15:18:11] [Server thread/INFO]: Anti X-Ray: true
    [15:18:11] [Server thread/INFO]:    Engine Mode: 1
    [15:18:11] [Server thread/INFO]:    Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
    [15:18:11] [Server thread/INFO]:    Replace Blocks: [1, 5]
    [15:18:11] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [15:18:11] [Server thread/INFO]: Random Lighting Updates: false
    [15:18:11] [Server thread/INFO]: -------- World Settings For [world_nether] --------
    [15:18:11] [Server thread/INFO]: View Distance: 10
    [15:18:11] [Server thread/INFO]: Experience Merge Radius: 3.0
    [15:18:11] [Server thread/INFO]: Chunks to Grow per Tick: 650
    [15:18:11] [Server thread/INFO]: Clear tick list: false
    [15:18:11] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [15:18:11] [Server thread/INFO]: Mob Spawn Range: 4
    [15:18:11] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [15:18:11] [Server thread/INFO]: Item Despawn Rate: 6000
    [15:18:11] [Server thread/INFO]: Item Merge Radius: 2.5
    [15:18:11] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [15:18:11] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [15:18:11] [Server thread/INFO]: Sending up to 5 chunks per packet
    [15:18:11] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Cane Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Melon Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Max Entity Collisions: 8
    [15:18:11] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
    [15:18:11] [Server thread/INFO]: Structure Info Saving: true
    [15:18:11] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    [15:18:11] [Server thread/INFO]: Anti X-Ray: true
    [15:18:11] [Server thread/INFO]:    Engine Mode: 1
    [15:18:11] [Server thread/INFO]:    Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
    [15:18:11] [Server thread/INFO]:    Replace Blocks: [1, 5]
    [15:18:11] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [15:18:11] [Server thread/INFO]: Random Lighting Updates: false
    [15:18:11] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
    [15:18:11] [Server thread/INFO]: View Distance: 10
    [15:18:11] [Server thread/INFO]: Experience Merge Radius: 3.0
    [15:18:11] [Server thread/INFO]: Chunks to Grow per Tick: 650
    [15:18:11] [Server thread/INFO]: Clear tick list: false
    [15:18:11] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [15:18:11] [Server thread/INFO]: Mob Spawn Range: 4
    [15:18:11] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [15:18:11] [Server thread/INFO]: Item Despawn Rate: 6000
    [15:18:11] [Server thread/INFO]: Item Merge Radius: 2.5
    [15:18:11] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [15:18:11] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [15:18:11] [Server thread/INFO]: Sending up to 5 chunks per packet
    [15:18:11] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Cane Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Melon Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [15:18:11] [Server thread/INFO]: Max Entity Collisions: 8
    [15:18:11] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
    [15:18:11] [Server thread/INFO]: Structure Info Saving: true
    [15:18:11] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    [15:18:11] [Server thread/INFO]: Anti X-Ray: true
    [15:18:11] [Server thread/INFO]:    Engine Mode: 1
    [15:18:11] [Server thread/INFO]:    Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
    [15:18:11] [Server thread/INFO]:    Replace Blocks: [1, 5]
    [15:18:11] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [15:18:11] [Server thread/INFO]: Random Lighting Updates: false
    [15:18:11] [Server thread/INFO]: Preparing start region for level 0 (Seed: 8369705711221472354)
    [15:18:12] [Server thread/INFO]: Preparing start region for level 1 (Seed: 8369705711221472354)
    [15:18:12] [Server thread/INFO]: Preparing start region for level 2 (Seed: 8369705711221472354)
    [15:18:13] [Server thread/INFO]: [Egien_Lobby_Item] Enabling Egien_Lobby_Item v1.0
    [15:18:13] [Server thread/ERROR]: [Egien_Lobby_Item] Egien_Lobby_Item v1.0 attempted to register an invalid EventHandler method signature "public static org.bukkit.inventory.ItemStack fr.sneling.item.MenuInv.getMyItem()" in class fr.sneling.item.MenuInv
    [15:18:13] [Server thread/INFO]: [MineFeat] Enabling MineFeat v1.0
    [15:18:13] [Server thread/INFO]: [VelyriaCraft] Enabling VelyriaCraft v1.0
    [15:18:13] [Server thread/INFO]: [Modular_Chat] Enabling Modular_Chat v1.0
    [15:18:13] [Server thread/INFO]: [Modular_Chat] Modular Chat v1.0 has been enabled.
    [15:18:13] [Server thread/INFO]: [Essentials] Enabling Essentials v2.13.1
    [15:18:13] [Server thread/INFO]: Bukkit version format changed. Version not checked.
    [15:18:13] [Server thread/INFO]: git-Spigot-1438 (MC: 1.7.9)
    [15:18:13] [Server thread/INFO]: 1.7.9-R0.1-SNAPSHOT
    [15:18:13] [Server thread/INFO]: [Vault][Economy] Essentials Economy hooked.
    [15:18:13] [Server thread/INFO]: Essentials: Using config file enhanced permissions.
    [15:18:13] [Server thread/INFO]: Permissions listed in as player-commands will be given to all users.
    [15:18:13] [Server thread/INFO]: [EssentialsChat] Enabling EssentialsChat v2.13.1
    [15:18:13] [Server thread/INFO]: [EssentialsProtect] Enabling EssentialsProtect v2.13.1
    [15:18:13] [Server thread/INFO]: [EssentialsSpawn] Enabling EssentialsSpawn v2.13.1
    [15:18:13] [Server thread/INFO]: [EssentialsAntiBuild] Enabling EssentialsAntiBuild v2.13.1
    [15:18:13] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [15:18:13] [Server thread/INFO]: Done (1.703s)! For help, type "help" or "?"
    [15:18:14] [Craft Scheduler Thread - 7/INFO]: [Vault] Checking for Updates:
    [15:18:14] [Craft Scheduler Thread - 7/INFO]: [Vault] No new version available
    
    EDIT : Fixed
     
  9. Offline

    JoeyDevs

    Code:
    Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key; could not found expected ':'; in 'reader', line 7, column 21: aliase:[dpm]
    So check your plugin.yml and go to that line: And then go trouble shooting...

    This time i helped you and next time do it by yourself its a easy mistake watch the diffrence in the yml

    You created:
    Code:
    main: fr.sneling.prisonbreak.dpmoney.Main
    name: DP Money
    version: 1.0
    commands:
        dpmoney:
            description: admin only
            aliase:[dpm]
    I Fixed
    Code:
    main: fr.sneling.prisonbreak.dpmoney.Main
    name: DP Money
    version: 1.0
    commands:
        dpmoney:
            description: admin only
            aliases: [dpm]
     
  10. Offline

    Sneling

    Oh... ok xD

    EDIT : So the Giving of Paper works.. etc. Now , i have to found how to get a number from lores
    Code for Interested:
    Code:java
    1. package fr.sneling.prisonbreak.dpmoney;
    2.  
    3. import java.util.Arrays;
    4.  
    5. import net.milkbowl.vault.economy.Economy;
    6.  
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.event.block.Action;
    15. import org.bukkit.event.player.PlayerInteractEvent;
    16. import org.bukkit.inventory.ItemStack;
    17. import org.bukkit.inventory.meta.ItemMeta;
    18. import org.bukkit.plugin.RegisteredServiceProvider;
    19. import org.bukkit.plugin.java.JavaPlugin;
    20.  
    21. public class Main extends JavaPlugin implements Listener{
    22.  
    23. public static Economy econ = null;
    24.  
    25. public void onEnable(){
    26. getLogger().info("[DP Money] DP Money is now enabled!" );
    27. getServer().getPluginManager().registerEvents(this, this);
    28. if (!setupEconomy() ) {
    29. getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    30. getServer().getPluginManager().disablePlugin(this);
    31. return;
    32. }
    33. }
    34. private boolean setupEconomy() {
    35. if (getServer().getPluginManager().getPlugin("Vault") == null) {
    36. return false;
    37. }
    38. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    39. if (rsp == null) {
    40. return false;
    41. }
    42. econ = rsp.getProvider();
    43. return econ != null;
    44. }
    45.  
    46. public boolean onCommand(CommandSender sender, Command cmd, String string, String[] args){
    47. if(cmd.getLabel().equalsIgnoreCase("dpmoney")){
    48. if(!(sender instanceof Player)){
    49. sender.sendMessage("Only for Players!");
    50. return true;
    51. }
    52. if(args.length != 1){
    53. sender.sendMessage(ChatColor.RED +" Usage: /dpmoney <Number Of Money>");
    54. return true;
    55. }
    56. ItemStack paper = new ItemStack(Material.PAPER);
    57. ItemMeta meta = paper.getItemMeta();
    58. meta.setLore(Arrays.asList(new String[] { args[0], ChatColor.GRAY +"MONEY" }));
    59. paper.setItemMeta(meta);
    60. Player p = (Player)sender;
    61. p.getInventory().addItem(paper);
    62. }
    63. return false;
    64. }
    65.  
    66. @EventHandler
    67. public void onInteract(PlayerInteractEvent e){
    68. Player p = e.getPlayer();
    69. if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
    70. if(p.getItemInHand().equals(new ItemStack(Material.PAPER))){
    71. ItemStack item = p.getItemInHand();
    72. if(!item.getItemMeta().hasLore()){
    73. return;
    74. }
    75. if(item.getItemMeta().getLore().contains("MONEY")){
    76. p.sendMessage("sweg");
    77. }
    78. }
    79. }
    80. }
    81. }
    82.  
     
  11. Offline

    JoeyDevs

    If your error is fixed please use: Thread Tools -> Solved

    So everyone can see you problem is solved!
     
  12. Offline

    Sneling

    This was not for the error. it was for giving money by reading lores.. just the error appearing after some time

    DxDy Ok.. now that giving the paper works.. how i do that it gives money with detecting lore?
    I'll try something, but i'm note sure at all

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

    JoeyDevs

    O oke, i have also get some trouble with that but with some help it's been fixed now. Only the point is that likes you don't understand the BukkitAPI or its to difficult. But you want a normal paper to read there lore? Or you also want a custom item name?
     
  14. Offline

    Sneling

    The thing is, i want a normal paper to read there lore.. i searched a lot. but still not found/undesrtand
     
  15. Offline

    JoeyDevs

    I think this is a bit to difficult for you ( I don't want to hate ) and try something easyer. Because you forgot much 'Basic' thinks in your code. 1 Example: You want to get the lore and you forgot to check if the item has itemmeta before get the itemmeta
     
  16. Offline

    Sneling

    Yes... but i really wanted to do something with that :(

    Also, when i reread my code, i effectivly see errors..
     
  17. Offline

    JoeyDevs

    Begin simple that is the best tip i can give you know + Quote people on the forum or add them in a message with @ so they get a alert and then the see your post faster if you awnsered them.


    EDIT: What you want to do with? Maybe i can help you with it add me on skype if you want... Skype: joey_hf
     
  18. Offline

    Sneling

    Ok, we(JoeyDevs & me) finished out how to do ;)

    Post : SOLVED
     
Thread Status:
Not open for further replies.

Share This Page