Essentials Economy connection?

Discussion in 'Plugin Development' started by Boneyskull, Jan 21, 2016.

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

    Boneyskull

    So i am creating a rewards plugin, i am using block event, and every time i break a block i want to get rewarded by money and connecting it to essentials economy, is that possible? please answer D:
     
  2. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Very possible, add money using Vault on blockbreakevent.
     
  3. Offline

    mcdorli

    Use vault, it pretty much supports every economy plugins.
    You need a block break event, then add the money to the player.

    Ninja'd @timtower
     
  4. Offline

    Boneyskull

    how do i do dat? is there any tutorials out there?
     
  5. Online

    timtower Administrator Administrator Moderator

  6. Offline

    Boneyskull

    i did all of that but i get an error at the getServer()

    Code:
        public static Economy economy = null;
        private boolean setupEconomy()
        {
            RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
            if (economyProvider != null) {
                economy = economyProvider.getProvider();
            }
    
            return (economy != null);
        }
    
     
  7. Online

    timtower Administrator Administrator Moderator

    @Boneyskull
    1. Please don't use public static
    2. If you get errors on getServer then you probably aren't using this in the main class and then you need a reference to the main plugin.
     
  8. Offline

    ShowbizLocket61

    @Boneyskull
    It would be helpful if you tell us what your error is ;)
     
  9. Offline

    Boneyskull

    umm.. am sorry if am annoying af. but
    xD how do i make a reference?

    [
    so here is the error

    it says the method
    Code:
                    econ.withdrawPlayer(player.getName(), 345000000);
    is deprecated.

    and it says that getServer() is undefined.
    Code:
        public static Economy econ = null;
       
        private boolean setupEconomy() {
            if (getServer().getPluginManager().getPlugin("Vault") == null) {
                return false;
            }
            RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp == null) {
                return false;
            }
            econ = rsp.getProvider();
            return econ != null;
        }
    timtower said i have to make a reference to the main class
    but idk how.
    i never worked with economy before so this is a new thing for me...
    i made it in another class because it is an event, Block Event class that i made.
     
    Last edited by a moderator: Jan 21, 2016
  10. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Constructors are what you need, econ.withdrawPlayer(string,amount) is deprecated, use
    econ.withdrawPlayer(player,amount) instead.
     
  11. Offline

    ShowbizLocket61

    @Boneyskull
    You don't have to make it in another class. Just put the event handler in your main class.
    Also, you should use up-to-date methods, but don't fret too much about deprecated ones.
     
  12. Offline

    Boneyskull

    @timtower

    @ShowbizLocket61

    i figured it out, i can just add this xD
    Code:
    public class BlockBreak extends JavaPlugin implements Listener {
    "extends JavaPlugin" before "implements Listener {"
    but it says that the economy thing is not in use, i think that is just okay.
    thanks for the help ;3
     
  13. Online

    timtower Administrator Administrator Moderator

    @Boneyskull You can't do that, will throw errors when you use it in the server.
     
  14. Offline

    Boneyskull

    okay i copied everything to main, the block events and everything and i deleted the block event class, do i have to import "Implements listener"? after "extends JavaPlugin"????
     
  15. Online

    timtower Administrator Administrator Moderator

  16. Offline

    Boneyskull

    @timtower i just copied everything to Main class, now when i use the plugin it says that it cannot find the Main class ;-; why is dat ;-; i have it in the "plugin.yml" everything is fine. D:
     
  17. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Please post your main class and your plugin.yml
     
  18. Offline

    Boneyskull

    Main.java
    Code:
    package me.mn.specialboxes;
    
    import java.util.Random;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.block.Block;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.block.BlockBreakEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.PlayerInventory;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.RegisteredServiceProvider;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    import me.mn.specialboxes.commands.getpb;
    import net.milkbowl.vault.economy.Economy;
    
    public class Main extends JavaPlugin {
    
        public void onEnable() {
            PluginDescriptionFile PDF = getDescription();
            Logger logger = getLogger();
            registerCommands();
            registerEvents();
            getLogger().info("Starting %1");
            getLogger().info("Starting %16");
            getLogger().info("Starting %36");
            getLogger().info("Starting %67");
            getLogger().info("Starting %75");
            getLogger().info("Starting %86");
            getLogger().info("Starting %99");
            getLogger().info("Plugin initialization complete.");
            getLogger().info("Made by bob (not really)");
            logger.info(PDF.getName() + " Has been enabled (v." + PDF.getVersion() + ")");
          
        }
    
        public void onDisable() {
            PluginDescriptionFile PDF = getDescription();
            Logger logger = getLogger();
            logger.info(PDF.getName() + " Has been disabled (v." + PDF.getVersion() + ")");
        }
        public void registerCommands(){
            getCommand("getpb").setExecutor(new getpb());
          
        }
        public void registerEvents(){
            PluginManager pm = getServer().getPluginManager();
    
        }
        public static Economy econ = null;
    
    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
        econ = rsp.getProvider();
        return econ != null;
    }
    
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event){
        Player player = event.getPlayer();
        Block block = event.getBlock();
        Material material = block.getType();
        PlayerInventory inv = player.getInventory();
        World world = player.getWorld();
      
    
      
        if(material == Material.ENDER_PORTAL_FRAME){
            Random random = new Random();
            int Chance = random.nextInt(16);
            player.sendMessage(ChatColor.GOLD + "You broke a Pandora's Box!");
          
            if(Chance == 1) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 72000, 7));
                player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 72000, 5));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 5));
                player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 72000, 4));
                player.sendMessage(ChatColor.GOLD + "You just recieved Good Buffs for an hour!");
            }
            if(Chance == 2) {
                player.giveExpLevels(9999);
                player.sendMessage(ChatColor.GOLD + "You just recieved x9999 EXP Levels!");
            }
            if(Chance == 3) {
                ItemStack SpecialBox = new ItemStack(Material.ENDER_PORTAL_FRAME, 3);
                ItemMeta meta = SpecialBox.getItemMeta();
                meta.setDisplayName(ChatColor.GOLD + "Pandora's Box");
                SpecialBox.setItemMeta(meta);
                inv.addItem(SpecialBox);
                player.sendMessage(ChatColor.GOLD + "You just recieved 3 Pandora's Box!");
            }
            if(Chance == 4) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 720, 1));
                player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 720, 4));
                player.sendMessage(ChatColor.GOLD + "You just got some deadly debuffs! run for your life..");
            }
            if(Chance == 5) {
                player.setRemainingAir(0);
                player.setHealth(0);
            }
            if(Chance == 6) {
                player.performCommand("/kit oparmour");
            }
            if(Chance == 7) {
                econ.depositPlayer(player.getName(), 1000000000);
                player.sendMessage(ChatColor.GOLD + "You just won $1B!");
            }
            if(Chance == 8) {
                econ.depositPlayer(player.getName(), 2000000000);
                player.sendMessage(ChatColor.GOLD + "You just won $2B!");
            }
            if(Chance == 9) {
                econ.depositPlayer(player.getName(), 1500000000);
                player.sendMessage(ChatColor.GOLD + "You just won $1.5B!");
            }
            if(Chance == 10) {
                player.performCommand("/kit quantum");
            }
            if(Chance == 11) {
                econ.withdrawPlayer(player.getName(), 250000000);
                player.sendMessage(ChatColor.GOLD + "You just lost $250M!");
            }
            if(Chance == 12) {
                ItemStack SpecialBox = new ItemStack(Material.ENDER_PORTAL_FRAME, 5);
                ItemMeta meta = SpecialBox.getItemMeta();
                meta.setDisplayName(ChatColor.GOLD + "Pandora's Box");
                SpecialBox.setItemMeta(meta);
                inv.addItem(SpecialBox);
                player.sendMessage(ChatColor.GOLD + "You just recieved x5 Pandora's Box!");
            }
            if(Chance == 13) {
                econ.withdrawPlayer(player.getName(), 345000000);
                player.sendMessage(ChatColor.GOLD + "You just lost $345M!");
            }
            if(Chance == 14) {
                econ.withdrawPlayer(player.getName(), 125000000);
                player.sendMessage(ChatColor.GOLD + "You just lost $125M!");
            }
            if(Chance == 16) {
            }
            event.setCancelled(true);
            world.getBlockAt(event.getBlock().getLocation()).setType(Material.AIR);
          
        }
    }
    }
    Plugin.yml
    Code:
    name: SpecialBoxes
    version: 1.0
    author: Boneyskull
    main: me.mn.specialboxes.Main
    commands:
      getsb:
        description: Recieve a Panadora's Box
        usage: /<Command>
        permission: specialboxes.commands.getsb
    permissions:
      specialboxes.commands.getsb:  
    softdepend: [Vault]
    
    i hope you remove this before somebody steals it D:
    and yeah it is a custom plugin for a server.
     
  19. Online

    timtower Administrator Administrator Moderator

    Don't sweat it about that.
    Please post your full server log.
     
  20. Offline

    Boneyskull

    @timtower
    Code:
    [20:48:17] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [20:48:17] [Server thread/INFO]: Loading properties
    [20:48:17] [Server thread/INFO]: Default game type: SURVIVAL
    [20:48:17] [Server thread/INFO]: Generating keypair
    [20:48:18] [Server thread/INFO]: Starting Minecraft server on *:25565
    [20:48:18] [Server thread/INFO]: Using default channel type
    [20:48:18] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-18fbb24 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [20:48:19] [Server thread/ERROR]: Could not load 'plugins\SpecialBoxes.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.mn.specialboxes.Main'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:42) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:289) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.<init>(CraftServer.java:251) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.PlayerList.<init>(PlayerList.java:69) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:179) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_65]
    Caused by: java.lang.ClassNotFoundException: me.mn.specialboxes.Main
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_65]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_65]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_65]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_65]
        at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_65]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        ... 10 more
    [20:48:19] [Server thread/INFO]: [Essentials] Loading Essentials vTeamCity
    [20:48:19] [Server thread/INFO]: [EssentialsProtect] Loading EssentialsProtect vTeamCity
    [20:48:19] [Server thread/INFO]: [Vault] Loading Vault v1.5.6-b49
    [20:48:19] [Server thread/INFO]: [EssentialsSpawn] Loading EssentialsSpawn vTeamCity
    [20:48:19] [Server thread/INFO]: [EssentialsChat] Loading EssentialsChat vTeamCity
    [20:48:19] [Server thread/INFO]: [EssentialsGeoIP] Loading EssentialsGeoIP vTeamCity
    [20:48:19] [Server thread/INFO]: [EssentialsAntiBuild] Loading EssentialsAntiBuild vTeamCity
    [20:48:19] [Server thread/INFO]: [EssentialsXMPP] Loading EssentialsXMPP vTeamCity
    [20:48:19] [Server thread/INFO]: [Vault] Enabling Vault v1.5.6-b49
    [20:48:19] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
    [20:48:19] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
    [20:48:19] [Server thread/INFO]: [Vault] Enabled Version 1.5.6-b49
    [20:48:19] [Server thread/INFO]: Preparing level "world"
    [20:48:19] [Server thread/INFO]: Preparing start region for level 0 (Seed: 4425489245916815405)
    [20:48:20] [Server thread/INFO]: Preparing spawn area: 57%
    [20:48:20] [Server thread/INFO]: Preparing start region for level 1 (Seed: 4425489245916815405)
    [20:48:21] [Server thread/INFO]: Preparing spawn area: 42%
    [20:48:22] [Server thread/INFO]: Preparing start region for level 2 (Seed: 4425489245916815405)
    [20:48:23] [Server thread/INFO]: [Essentials] Enabling Essentials vTeamCity
    [20:48:23] [Server thread/INFO]: Bukkit version format changed. Version not checked.
    [20:48:23] [Server thread/INFO]: git-Bukkit-18fbb24 (MC: 1.8.8)
    [20:48:23] [Server thread/INFO]: 1.8.8-R0.1-SNAPSHOT
    [20:48:23] [Server thread/INFO]: Using locale en_US
    [20:48:23] [Server thread/INFO]: Using locale en_US
    [20:48:23] [Server thread/INFO]: [Vault][Economy] Essentials Economy hooked.
    [20:48:23] [Server thread/INFO]: Essentials: Using config file enhanced permissions.
    [20:48:23] [Server thread/INFO]: Permissions listed in as player-commands will be given to all users.
    [20:48:23] [Server thread/INFO]: [EssentialsProtect] Enabling EssentialsProtect vTeamCity
    [20:48:23] [Server thread/INFO]: [EssentialsSpawn] Enabling EssentialsSpawn vTeamCity
    [20:48:23] [Server thread/INFO]: [EssentialsChat] Enabling EssentialsChat vTeamCity
    [20:48:23] [Server thread/INFO]: [EssentialsGeoIP] Enabling EssentialsGeoIP vTeamCity
    [20:48:23] [Server thread/INFO]: [EssentialsGeoIP] This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
    [20:48:23] [Server thread/INFO]: [EssentialsAntiBuild] Enabling EssentialsAntiBuild vTeamCity
    [20:48:23] [Server thread/INFO]: [EssentialsXMPP] Enabling EssentialsXMPP vTeamCity
    [20:48:23] [Server thread/WARN]: config broken for xmpp
    [20:48:23] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [20:48:24] [Server thread/INFO]: Done (4.778s)! For help, type "help" or "?"
    [20:48:24] [pool-3-thread-7/INFO]: [Vault] Checking for Updates ...
    [20:48:30] [pool-3-thread-7/INFO]: [Vault] No new version available
    
    it is just a test server
     
  21. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Is the file there when you open it up with winzip?
     
  22. Offline

    Boneyskull

  23. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Try to export the compiled code as well, you aren't doing that at the moment.
     
  24. Offline

    mcdorli

    getLogger().info("Starting %1");
    getLogger().info("Starting %16");
    getLogger().info("Starting %36");
    getLogger().info("Starting %67");
    getLogger().info("Starting %75");
    getLogger().info("Starting %86");
    getLogger().info("Starting %99");
    Is this really needed? This would drive me crazy, if I was a server owner.
    Code:
    if(Chance == 1) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 72000, 7));
                player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 72000, 5));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 5));
                player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 72000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 72000, 4));
                player.sendMessage(ChatColor.GOLD + "You just recieved Good Buffs for an hour!");
            }
            if(Chance == 2) {
                player.giveExpLevels(9999);
                player.sendMessage(ChatColor.GOLD + "You just recieved x9999 EXP Levels!");
            }
            if(Chance == 3) {
                ItemStack SpecialBox = new ItemStack(Material.ENDER_PORTAL_FRAME, 3);
                ItemMeta meta = SpecialBox.getItemMeta();
                meta.setDisplayName(ChatColor.GOLD + "Pandora's Box");
                SpecialBox.setItemMeta(meta);
                inv.addItem(SpecialBox);
                player.sendMessage(ChatColor.GOLD + "You just recieved 3 Pandora's Box!");
            }
            if(Chance == 4) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 720, 1));
                player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 720, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 720, 4));
                player.sendMessage(ChatColor.GOLD + "You just got some deadly debuffs! run for your life..");
            }
            if(Chance == 5) {
                player.setRemainingAir(0);
                player.setHealth(0);
            }
            if(Chance == 6) {
                player.performCommand("/kit oparmour");
            }
            if(Chance == 7) {
                econ.depositPlayer(player.getName(), 1000000000);
                player.sendMessage(ChatColor.GOLD + "You just won $1B!");
            }
            if(Chance == 8) {
                econ.depositPlayer(player.getName(), 2000000000);
                player.sendMessage(ChatColor.GOLD + "You just won $2B!");
            }
            if(Chance == 9) {
                econ.depositPlayer(player.getName(), 1500000000);
                player.sendMessage(ChatColor.GOLD + "You just won $1.5B!");
            }
            if(Chance == 10) {
                player.performCommand("/kit quantum");
            }
            if(Chance == 11) {
                econ.withdrawPlayer(player.getName(), 250000000);
                player.sendMessage(ChatColor.GOLD + "You just lost $250M!");
            }
            if(Chance == 12) {
                ItemStack SpecialBox = new ItemStack(Material.ENDER_PORTAL_FRAME, 5);
                ItemMeta meta = SpecialBox.getItemMeta();
                meta.setDisplayName(ChatColor.GOLD + "Pandora's Box");
                SpecialBox.setItemMeta(meta);
                inv.addItem(SpecialBox);
                player.sendMessage(ChatColor.GOLD + "You just recieved x5 Pandora's Box!");
            }
            if(Chance == 13) {
                econ.withdrawPlayer(player.getName(), 345000000);
                player.sendMessage(ChatColor.GOLD + "You just lost $345M!");
            }
            if(Chance == 14) {
                econ.withdrawPlayer(player.getName(), 125000000);
                player.sendMessage(ChatColor.GOLD + "You just lost $125M!");
            }
            if(Chance == 16) {
            }
    
    switches, just saying.

    Don't create a new random each time the command runs, create it either on the class-level, or use threadlocalrandom
     
    Zombie_Striker likes this.
  25. Offline

    Boneyskull

    @timtower
    i don't think that worked either
    http://prntscr.com/9t1s98
    Code (open)

    Code:
    [21:52:26] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [21:52:26] [Server thread/INFO]: Loading properties
    [21:52:26] [Server thread/INFO]: Default game type: SURVIVAL
    [21:52:26] [Server thread/INFO]: Generating keypair
    [21:52:27] [Server thread/INFO]: Starting Minecraft server on *:25565
    [21:52:27] [Server thread/INFO]: Using default channel type
    [21:52:28] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-18fbb24 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [21:52:28] [Server thread/INFO]: [Essentials] Loading Essentials vTeamCity
    [21:52:28] [Server thread/INFO]: [EssentialsProtect] Loading EssentialsProtect vTeamCity
    [21:52:28] [Server thread/INFO]: [Vault] Loading Vault v1.5.6-b49
    [21:52:28] [Server thread/INFO]: [EssentialsSpawn] Loading EssentialsSpawn vTeamCity
    [21:52:28] [Server thread/INFO]: [EssentialsChat] Loading EssentialsChat vTeamCity
    [21:52:28] [Server thread/INFO]: [EssentialsGeoIP] Loading EssentialsGeoIP vTeamCity
    [21:52:28] [Server thread/INFO]: [EssentialsAntiBuild] Loading EssentialsAntiBuild vTeamCity
    [21:52:28] [Server thread/INFO]: [SpecialBoxes] Loading SpecialBoxes v1.0
    [21:52:28] [Server thread/INFO]: [EssentialsXMPP] Loading EssentialsXMPP vTeamCity
    [21:52:28] [Server thread/INFO]: [Vault] Enabling Vault v1.5.6-b49
    [21:52:28] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
    [21:52:28] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
    [21:52:28] [Server thread/INFO]: [Vault] Enabled Version 1.5.6-b49
    [21:52:28] [Server thread/INFO]: Preparing level "world"
    [21:52:29] [Server thread/INFO]: Preparing start region for level 0 (Seed: 4425489245916815405)
    [21:52:30] [Server thread/INFO]: Preparing spawn area: 20%
    [21:52:31] [Server thread/INFO]: Preparing start region for level 1 (Seed: 4425489245916815405)
    [21:52:32] [Server thread/INFO]: Preparing spawn area: 68%
    [21:52:32] [Server thread/INFO]: Preparing start region for level 2 (Seed: 4425489245916815405)
    [21:52:32] [Server thread/INFO]: [Essentials] Enabling Essentials vTeamCity
    [21:52:32] [Server thread/INFO]: Bukkit version format changed. Version not checked.
    [21:52:32] [Server thread/INFO]: git-Bukkit-18fbb24 (MC: 1.8.8)
    [21:52:32] [Server thread/INFO]: 1.8.8-R0.1-SNAPSHOT
    [21:52:32] [Server thread/INFO]: Using locale en_US
    [21:52:32] [Server thread/INFO]: Using locale en_US
    [21:52:32] [Server thread/INFO]: [Vault][Economy] Essentials Economy hooked.
    [21:52:32] [Server thread/INFO]: Essentials: Using config file enhanced permissions.
    [21:52:32] [Server thread/INFO]: Permissions listed in as player-commands will be given to all users.
    [21:52:32] [Server thread/INFO]: [EssentialsProtect] Enabling EssentialsProtect vTeamCity
    [21:52:32] [Server thread/INFO]: [EssentialsSpawn] Enabling EssentialsSpawn vTeamCity
    [21:52:32] [Server thread/INFO]: [EssentialsChat] Enabling EssentialsChat vTeamCity
    [21:52:32] [Server thread/INFO]: [EssentialsGeoIP] Enabling EssentialsGeoIP vTeamCity
    [21:52:32] [Server thread/INFO]: [EssentialsGeoIP] This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
    [21:52:32] [Server thread/INFO]: [EssentialsAntiBuild] Enabling EssentialsAntiBuild vTeamCity
    [21:52:32] [Server thread/INFO]: [SpecialBoxes] Enabling SpecialBoxes v1.0
    [21:52:32] [Server thread/ERROR]: Error occurred while enabling SpecialBoxes v1.0 (Is it up to date?)
    java.lang.NullPointerException
        at me.mn.specialboxes.Main.registerCommands(Main.java:50) ~[?:?]
        at me.mn.specialboxes.Main.onEnable(Main.java:29) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_65]
    [21:52:32] [Server thread/ERROR]: Permission node 'specialboxes.commands.getsb' in plugin description file for SpecialBoxes v1.0 is invalid
    java.lang.IllegalArgumentException: Data cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.permissions.Permission.loadPermission(Permission.java:284) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.permissions.Permission.loadPermissions(Permission.java:233) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.PluginDescriptionFile.getPermissions(PluginDescriptionFile.java:789) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:344) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_65]
    [21:52:32] [Server thread/INFO]: [EssentialsXMPP] Enabling EssentialsXMPP vTeamCity
    [21:52:32] [Server thread/WARN]: config broken for xmpp
    [21:52:32] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [21:52:32] [Server thread/INFO]: Done (4.119s)! For help, type "help" or "?"
    [21:52:33] [pool-3-thread-7/INFO]: [Vault] Checking for Updates ... 
    [21:52:44] [pool-3-thread-7/INFO]: [Vault] There was an issue attempting to check for the latest version.
    [21:52:44] [pool-3-thread-7/INFO]: [Vault] No new version available
    


    @mcdorli
    that is just for looks.
    and that is for the random events ;3 i might only know some tiny basic java.
     
  26. Online

    timtower Administrator Administrator Moderator

    @Boneyskull It does work now, but you have a permission in your plugin.yml with a colon at the end but nothing within that colon.
     
  27. Offline

    Boneyskull

    @timtower
    it does the same god damn error ;-;
    what is with my luck today..
    Code:
    [22:04:44] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [22:04:44] [Server thread/INFO]: Loading properties
    [22:04:44] [Server thread/INFO]: Default game type: SURVIVAL
    [22:04:44] [Server thread/INFO]: Generating keypair
    [22:04:45] [Server thread/INFO]: Starting Minecraft server on *:25565
    [22:04:45] [Server thread/INFO]: Using default channel type
    [22:04:46] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-18fbb24 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [22:04:46] [Server thread/ERROR]: Could not load 'plugins\SpecialBoxes.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.mn.specialboxes.Main'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:42) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:289) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.<init>(CraftServer.java:251) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.PlayerList.<init>(PlayerList.java:69) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:179) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit_server.jar:git-Bukkit-18fbb24]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_65]
    Caused by: java.lang.ClassNotFoundException: me.mn.specialboxes.Main
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_65]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_65]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_65]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_65]
        at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_65]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit_server.jar:git-Bukkit-18fbb24]
        ... 10 more
    [22:04:46] [Server thread/INFO]: [Essentials] Loading Essentials vTeamCity
    [22:04:46] [Server thread/INFO]: [EssentialsProtect] Loading EssentialsProtect vTeamCity
    [22:04:46] [Server thread/INFO]: [Vault] Loading Vault v1.5.6-b49
    [22:04:46] [Server thread/INFO]: [EssentialsSpawn] Loading EssentialsSpawn vTeamCity
    [22:04:46] [Server thread/INFO]: [EssentialsChat] Loading EssentialsChat vTeamCity
    [22:04:46] [Server thread/INFO]: [EssentialsGeoIP] Loading EssentialsGeoIP vTeamCity
    [22:04:46] [Server thread/INFO]: [EssentialsAntiBuild] Loading EssentialsAntiBuild vTeamCity
    [22:04:46] [Server thread/INFO]: [EssentialsXMPP] Loading EssentialsXMPP vTeamCity
    [22:04:46] [Server thread/INFO]: [Vault] Enabling Vault v1.5.6-b49
    [22:04:46] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
    [22:04:46] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
    [22:04:46] [Server thread/INFO]: [Vault] Enabled Version 1.5.6-b49
    [22:04:47] [Server thread/INFO]: Preparing level "world"
    [22:04:47] [Server thread/INFO]: Preparing start region for level 0 (Seed: 4425489245916815405)
    [22:04:48] [Server thread/INFO]: Preparing spawn area: 25%
    [22:04:49] [Server thread/INFO]: Preparing start region for level 1 (Seed: 4425489245916815405)
    [22:04:50] [Server thread/INFO]: Preparing spawn area: 44%
    [22:04:50] [Server thread/INFO]: Preparing start region for level 2 (Seed: 4425489245916815405)
    [22:04:51] [Server thread/INFO]: [Essentials] Enabling Essentials vTeamCity
    [22:04:51] [Server thread/INFO]: Bukkit version format changed. Version not checked.
    [22:04:51] [Server thread/INFO]: git-Bukkit-18fbb24 (MC: 1.8.8)
    [22:04:51] [Server thread/INFO]: 1.8.8-R0.1-SNAPSHOT
    [22:04:51] [Server thread/INFO]: Using locale en_US
    [22:04:51] [Server thread/INFO]: Using locale en_US
    [22:04:51] [Server thread/INFO]: [Vault][Economy] Essentials Economy hooked.
    [22:04:51] [Server thread/INFO]: Essentials: Using config file enhanced permissions.
    [22:04:51] [Server thread/INFO]: Permissions listed in as player-commands will be given to all users.
    [22:04:51] [Server thread/INFO]: [EssentialsProtect] Enabling EssentialsProtect vTeamCity
    [22:04:51] [Server thread/INFO]: [EssentialsSpawn] Enabling EssentialsSpawn vTeamCity
    [22:04:51] [Server thread/INFO]: [EssentialsChat] Enabling EssentialsChat vTeamCity
    [22:04:51] [Server thread/INFO]: [EssentialsGeoIP] Enabling EssentialsGeoIP vTeamCity
    [22:04:51] [Server thread/INFO]: [EssentialsGeoIP] This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
    [22:04:51] [Server thread/INFO]: [EssentialsAntiBuild] Enabling EssentialsAntiBuild vTeamCity
    [22:04:51] [Server thread/INFO]: [EssentialsXMPP] Enabling EssentialsXMPP vTeamCity
    [22:04:51] [Server thread/WARN]: config broken for xmpp
    [22:04:51] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [22:04:51] [Server thread/INFO]: Done (5.023s)! For help, type "help" or "?"
    [22:04:52] [pool-3-thread-7/INFO]: [Vault] Checking for Updates ...
    [22:05:01] [pool-3-thread-7/INFO]: [Vault] There was an issue attempting to check for the latest version.
    [22:05:01] [pool-3-thread-7/INFO]: [Vault] No new version available
    
     
  28. Online

    timtower Administrator Administrator Moderator

  29. Offline

    Boneyskull

  30. Offline

    mcdorli

Thread Status:
Not open for further replies.

Share This Page