Essentials Economy connection?

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

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

    timtower Administrator Administrator Moderator

  2. Offline

    Boneyskull

  3. Online

    timtower Administrator Administrator Moderator

  4. Offline

    Boneyskull

    @timtower
    http://prntscr.com/9tarq4
    but i think i figured out something.
    i repeatedly exported the program and tested it
    untill it said "enabling SpecialBoxes" and then it couldn't load it
    here is the error message
    http://prntscr.com/9tasz3
    Code:
    [13:25:45] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [13:25:46] [Server thread/INFO]: Loading properties
    [13:25:46] [Server thread/INFO]: Default game type: SURVIVAL
    [13:25:46] [Server thread/INFO]: Generating keypair
    [13:25:47] [Server thread/INFO]: Starting Minecraft server on *:25565
    [13:25:47] [Server thread/INFO]: Using default channel type
    [13:25:49] [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)
    [13:25:51] [Server thread/INFO]: [Essentials] Loading Essentials vTeamCity
    [13:25:51] [Server thread/INFO]: [EssentialsProtect] Loading EssentialsProtect vTeamCity
    [13:25:51] [Server thread/INFO]: [Vault] Loading Vault v1.5.6-b49
    [13:25:51] [Server thread/INFO]: [EssentialsSpawn] Loading EssentialsSpawn vTeamCity
    [13:25:51] [Server thread/INFO]: [EssentialsChat] Loading EssentialsChat vTeamCity
    [13:25:51] [Server thread/INFO]: [EssentialsGeoIP] Loading EssentialsGeoIP vTeamCity
    [13:25:51] [Server thread/INFO]: [EssentialsAntiBuild] Loading EssentialsAntiBuild vTeamCity
    [13:25:51] [Server thread/INFO]: [SpecialBoxes] Loading SpecialBoxes v1.0
    [13:25:51] [Server thread/INFO]: [EssentialsXMPP] Loading EssentialsXMPP vTeamCity
    [13:25:51] [Server thread/INFO]: [Vault] Enabling Vault v1.5.6-b49
    [13:25:51] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
    [13:25:51] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
    [13:25:51] [Server thread/INFO]: [Vault] Enabled Version 1.5.6-b49
    [13:25:51] [Server thread/INFO]: Preparing level "world"
    [13:25:51] [Server thread/INFO]: Preparing start region for level 0 (Seed: 4425489245916815405)
    [13:25:52] [Server thread/INFO]: Preparing spawn area: 6%
    [13:25:54] [Server thread/INFO]: Preparing spawn area: 40%
    [13:25:55] [Server thread/INFO]: Preparing spawn area: 78%
    [13:25:55] [Server thread/INFO]: Preparing start region for level 1 (Seed: 4425489245916815405)
    [13:25:56] [Server thread/INFO]: Preparing spawn area: 24%
    [13:25:57] [Server thread/INFO]: Preparing spawn area: 50%
    [13:25:58] [Server thread/INFO]: Preparing start region for level 2 (Seed: 4425489245916815405)
    [13:25:59] [Server thread/INFO]: Preparing spawn area: 42%
    [13:26:00] [Server thread/INFO]: [Essentials] Enabling Essentials vTeamCity
    [13:26:00] [Server thread/INFO]: Bukkit version format changed. Version not checked.
    [13:26:00] [Server thread/INFO]: git-Bukkit-18fbb24 (MC: 1.8.8)
    [13:26:00] [Server thread/INFO]: 1.8.8-R0.1-SNAPSHOT
    [13:26:00] [Server thread/INFO]: Using locale en_US
    [13:26:01] [Server thread/INFO]: Using locale en_US
    [13:26:01] [Server thread/INFO]: [Vault][Economy] Essentials Economy hooked.
    [13:26:01] [Server thread/INFO]: Essentials: Using config file enhanced permissions.
    [13:26:01] [Server thread/INFO]: Permissions listed in as player-commands will be given to all users.
    [13:26:01] [Server thread/INFO]: [EssentialsProtect] Enabling EssentialsProtect vTeamCity
    [13:26:01] [Server thread/INFO]: [EssentialsSpawn] Enabling EssentialsSpawn vTeamCity
    [13:26:01] [Server thread/INFO]: [EssentialsChat] Enabling EssentialsChat vTeamCity
    [13:26:01] [Server thread/INFO]: [EssentialsGeoIP] Enabling EssentialsGeoIP vTeamCity
    [13:26:01] [Server thread/INFO]: [EssentialsGeoIP] This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
    [13:26:01] [Server thread/INFO]: [EssentialsAntiBuild] Enabling EssentialsAntiBuild vTeamCity
    [13:26:01] [Server thread/INFO]: [SpecialBoxes] Enabling SpecialBoxes v1.0
    [13:26:01] [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]
    [13:26:01] [Server thread/INFO]: [EssentialsXMPP] Enabling EssentialsXMPP vTeamCity
    [13:26:01] [Server thread/WARN]: config broken for xmpp
    [13:26:01] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [13:26:01] [Server thread/INFO]: Done (10.397s)! For help, type "help" or "?"
    [13:26:01] [pool-3-thread-7/INFO]: [Vault] Checking for Updates ...
    [13:26:07] [pool-3-thread-7/INFO]: [Vault] No new version available
    [13:26:47] [Thread-4/INFO]: Stopping server
    
     
  5. Online

    timtower Administrator Administrator Moderator

    @Boneyskull You main line 50 is getCommand("somecommandname").setExectutor?
    Did you register the command in the command.yml ?
     
  6. Offline

    Boneyskull

  7. Online

    timtower Administrator Administrator Moderator

  8. Offline

    Boneyskull

  9. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Then what is at line 50 of your main? Post the entire class, don't remove the imports.
     
  10. Offline

    Boneyskull

    @timtower
    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);
           
        }
    }
    }
    this is the 50th line
    Code:
            getCommand("getpb").setExecutor(new getpb());
     
  11. Online

    timtower Administrator Administrator Moderator

    @Boneyskull Do you see that the command that you are trying to register isn't the one in the plugin.yml ?
     
  12. Offline

    Boneyskull

    @timtower
    oh lemme try to fix that.
    i was making a choice of the command name.

    It finally worked, Idk how to thank you
    @timtower and the others
    mostly @timtower you spent alots of your time helping me,
    Thank you really.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jan 22, 2016
Thread Status:
Not open for further replies.

Share This Page