Need some help

Discussion in 'Plugin Development' started by blondy2247, Jan 22, 2015.

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

    blondy2247

    So I can't load the plugin that I made for some reason. I have attached the console error I'm getting. If someone can point me in the right direction it would be highly appreciated. Thank you!

    Code:
    [22:37:01 ERROR]: Could not load 'plugins/Apartments.jar' in folder 'plugins'
    org.bukkit.plugin.UnknownDependencyException: Vault
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:216) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:355) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:317) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
     
  2. Offline

    Skionz

    @blondy2247
    Code:
    UnknownDependencyException: Vault
     
  3. Offline

    blondy2247

    Thanks, but I would like to know what that means. If you would like me to I can attach the full code.
     
  4. Offline

    Skionz

    @blondy2247 Is Vault registered as a dependency? Is it in your plugins folder?
     
  5. Offline

    blondy2247

    It is in fact in my plugins folder, but it was renamed to something else. Im gonna try to rename it to "Vault" and see if that works. Thank you for your help.
     
  6. Offline

    Skionz

  7. Offline

    blondy2247

    Now its saying that it cannot find the main.

    Code:
    Could not load 'plugins/Apartments.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.blondy2247.apartments'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:42) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:355) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:317) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    Caused by: java.lang.ClassNotFoundException: me.blondy2247.apartments
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[?:1.8.0_20]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.8.0_20]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_20]
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[?:1.8.0_20]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_20]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_20]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_20]
        at java.lang.Class.forName(Class.java:340) ~[?:1.8.0_20]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
        ... 10 more
    
    And here is the actual code:

    Code:
    package me.blondy2247.Apartments;
    
    import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
    import com.sk89q.worldguard.domains.DefaultDomain;
    import com.sk89q.worldguard.protection.managers.RegionManager;
    import com.sk89q.worldguard.protection.regions.ProtectedRegion;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.HashMap;
    import java.util.concurrent.ConcurrentHashMap;
    import java.util.logging.Logger;
    import net.milkbowl.vault.economy.Economy;
    import net.milkbowl.vault.economy.EconomyResponse;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.Server;
    import org.bukkit.World;
    import org.bukkit.block.Block;
    import org.bukkit.block.Sign;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.configuration.file.FileConfigurationOptions;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.block.SignChangeEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.RegisteredServiceProvider;
    import org.bukkit.plugin.ServicesManager;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitScheduler;
    import org.bukkit.util.Vector;
    
    public class Apartments extends JavaPlugin
      implements Listener
    {
      static final String dataLoc = "plugins" + File.separator + "Apartments" + File.separator;
      static final String signDataLoc = "plugins" + File.separator + "Apartments" + File.separator + "rent" + File.separator;
      static final String rentedRE = "RentedRegionExpirations";
      static final String rentedRC = "RentedRegionCounts";
      static final String autoRenewsFileName = "AutoRenews";
      static long tickRate = 60L;
    
      public static Economy econ = null;
    
      public int ApartmentsMax = 0;
      public int rentRegionMax = 0;
    
      public boolean requireBuyMode = true;
    
      public boolean requireBuyPerms = false;
      public boolean requireRentPerms = false;
    
      public String dateFormatString = "yy/MM/dd h:mma";
    
      public HashMap<String, Boolean> BuyMode = new HashMap();
    
      public HashMap<String, Integer> RegionCounts = new HashMap();
    
      public ConcurrentHashMap<String, Integer> RentedRegionCounts = new ConcurrentHashMap();
    
      public ConcurrentHashMap<String, Long> RentedRegionExpirations = new ConcurrentHashMap();
    
      public ConcurrentHashMap<String, Boolean> AutoRenews = new ConcurrentHashMap();
    
      public ConcurrentHashMap<String, String> Messages = new ConcurrentHashMap();
    
      public void onEnable()
      {
        try
        {
          new File(dataLoc).mkdirs();
          new File(signDataLoc).mkdirs();
    
          getServer().getPluginManager().registerEvents(this, this);
    
          getLogger().info("Apartments - Created by blondy2247");
    
          if (!setupEconomy()) {
            getLogger().info("Disabled due to no Vault dependency found!");
            getServer().getPluginManager().disablePlugin(this);
            return;
          }
    
          this.Messages = getDefaultMessages();
    
          getConfig().options().copyDefaults(true);
    
          loadRegionCounts();
          loadRentedRegionExpirations();
          loadRentedRegionCounts();
          loadAutoRenews();
          try
          {
            this.ApartmentsMax = getConfig().getInt("ApartmentsMax", 0); } catch (Exception e) { this.ApartmentsMax = 0; } try {
            this.rentRegionMax = getConfig().getInt("RentRegionMax", 0); } catch (Exception e) { this.rentRegionMax = 0; } try {
            this.requireBuyMode = getConfig().getBoolean("RequireBuyMode", true); } catch (Exception e) { this.requireBuyMode = true; } try {
            tickRate = getConfig().getLong("CheckExpirationsInMins"); tickRate = tickRate * 60L * 20L; } catch (Exception e) { tickRate = 6000L; } try {
            this.requireBuyPerms = getConfig().getBoolean("RequireBuyPerms", false); } catch (Exception e) { this.requireBuyPerms = false; } try {
            this.requireRentPerms = getConfig().getBoolean("RequireRentPerms", false); } catch (Exception e) { this.requireRentPerms = false; } try {
            setFormatString(getConfig().getString("DateFormat", "Default")); } catch (Exception e) { this.dateFormatString = "yy/MM/dd h:mma"; }
    
          loadMessageConfig();
    
          saveConfig();
    
          scheduleRenterTask();
    
          File file = new File(dataLoc + "RegionActivityLog.txt");
    
          if (!file.exists())
            try {
              file.createNewFile();
            } catch (IOException e) {
              getLogger().info("Error creating log file");
            }
        }
        catch (Exception e) {
          e.printStackTrace();
        }
      }
    
      private void loadMessageConfig()
      {
        this.Messages.put("InvalidPriceTime", getConfig().getString("Messages.InvalidPriceTime", "Invalid sign. Invalid price or timespan!"));
        this.Messages.put("RegionNoExist", getConfig().getString("Messages.RegionNoExist", "Invalid sign. Region doesn't exist!"));
        this.Messages.put("EvictedFrom", getConfig().getString("Messages.EvictedFrom", "You have been evicted from"));
        this.Messages.put("InvalidArg", getConfig().getString("Messages.InvalidArg", "Invalid argument. Accepted values: true, false, yes, no, off, on"));
        this.Messages.put("RenewTurnOff", getConfig().getString("Messages.RenewTurnOff", "Auto-Renew has been turned OFF for you."));
        this.Messages.put("RenewTurnOn", getConfig().getString("Messages.RenewTurnOn", "Auto-Renew has been turned ON for you."));
        this.Messages.put("RenewOff", getConfig().getString("Messages.RenewOff", "Auto-Renew is off!"));
        this.Messages.put("RenewOn", getConfig().getString("Messages.RenewOn", "Auto-Renew is on!"));
        this.Messages.put("InvalidRenewArgs", getConfig().getString("Messages.InvalidRenewArgs", "Invalid args: /Apartments renew <region>"));
        this.Messages.put("BuyModeExit", getConfig().getString("Messages.BuyModeExit", "You have exited Buy Mode."));
        this.Messages.put("BuyModeEnter", getConfig().getString("Messages.BuyModeEnter", "You are now in Buy Mode - right-click the Apartments sign!"));
        this.Messages.put("ToEnterBuyMode", getConfig().getString("Messages.ToEnterBuyMode", "To enter Buy Mode type: /Apartments"));
        this.Messages.put("BuyModeRent", getConfig().getString("Messages.BuyModeRent", "You must be in Buy Mode to rent this region!"));
        this.Messages.put("BuyModeBuy", getConfig().getString("Messages.BuyModeBuy", "You must be in Buy Mode to buy this region!"));
        this.Messages.put("NotEnoughRent", getConfig().getString("Messages.NotEnoughRent", "Not enough money to rent this region!"));
        this.Messages.put("NotEnoughBuy", getConfig().getString("Messages.NotEnoughBuy", "Not enough money to buy this region!"));
        this.Messages.put("TransFailed", getConfig().getString("Messages.TransFailed", "Transaction Failed!"));
        this.Messages.put("Rented", getConfig().getString("Messages.Rented", "Congrats! You have rented"));
        this.Messages.put("NewBalance", getConfig().getString("Messages.NewBalance", "Your new balance is"));
        this.Messages.put("RentMax", getConfig().getString("Messages.RentMax", "You are not allowed to rent more regions. Max"));
        this.Messages.put("RentPerms", getConfig().getString("Messages.RentPerms", "You do not have permission to rent regions."));
        this.Messages.put("Balance", getConfig().getString("Messages.Balance", "Your balance is"));
        this.Messages.put("Purchased", getConfig().getString("Messages.Purchased", "Congrats! You have purchased"));
        this.Messages.put("BuyMax", getConfig().getString("Messages.BuyMax", "You are not allowed to buy more regions. Max"));
        this.Messages.put("BuyPerms", getConfig().getString("Messages.BuyPerms", "You do not have permission to buy regions."));
        this.Messages.put("NotRented", getConfig().getString("Messages.NotRented", "is not currently rented."));
        this.Messages.put("NotRenting", getConfig().getString("Messages.NotRenting", "You are not renting this region. You cannot renew it!"));
        this.Messages.put("NotEnoughRenew", getConfig().getString("Messages.NotEnoughRenew", "Not enough money to renew rental for this region!"));
        this.Messages.put("Renewed", getConfig().getString("Messages.Renewed", "Congrats! You have renewed"));
        this.Messages.put("Expired", getConfig().getString("Messages.Expired", "Your rental has expired for region"));
        this.Messages.put("Help1", getConfig().getString("Messages.Help1", "Apartments Commands"));
        this.Messages.put("Help2", getConfig().getString("Messages.Help2", "/Apartments - toggles buy mode"));
        this.Messages.put("Help3", getConfig().getString("Messages.Help3", "/Apartments renew <region> - renews rental of <region>"));
        this.Messages.put("Help4", getConfig().getString("Messages.Help4", "/Apartments autorenew <true/false> - sets auto-renew for all rented regions"));
      }
    
      public void onDisable()
      {
        try
        {
          saveRegionCounts();
          saveRentedRegionExpirations();
          saveRentedRegionCounts();
          saveAutoRenews();
    
          getServer().getScheduler().cancelTasks(this);
        } catch (Exception e) {
          getLogger().info("An error occured during shutdown.");
        }
      }
    
      private ConcurrentHashMap<String, String> getDefaultMessages()
      {
        ConcurrentHashMap msgs = new ConcurrentHashMap();
    
        msgs.put("InvalidPriceTime", "Invalid sign. Invalid price or timespan!");
        msgs.put("RegionNoExist", "Invalid sign. Region doesn't exist!");
        msgs.put("EvictedFrom", "You have been evicted from");
        msgs.put("InvalidArg", "Invalid argument. Accepted values: true, false, yes, no, off, on");
        msgs.put("RenewTurnOff", "Auto-Renew has been turned OFF for you.");
        msgs.put("RenewTurnOn", "Auto-Renew has been turned ON for you.");
        msgs.put("RenewOff", "Auto-Renew is off!");
        msgs.put("RenewOn", "Auto-Renew is on!");
        msgs.put("InvalidRenewArgs", "Invalid args: /Apartments renew <region>");
        msgs.put("BuyModeExit", "You have exited Buy Mode.");
        msgs.put("BuyModeEnter", "You are now in Buy Mode - right-click the Apartments sign!");
        msgs.put("ToEnterBuyMode", "To enter Buy Mode type: /Apartments");
        msgs.put("BuyModeRent", "You must be in Buy Mode to rent this region!");
        msgs.put("BuyModeBuy", "You must be in Buy Mode to buy this region!");
        msgs.put("NotEnoughRent", "Not enough money to rent this region!");
        msgs.put("NotEnoughBuy", "Not enough money to buy this region!");
        msgs.put("TransFailed", "Transaction Failed!");
        msgs.put("Rented", "Congrats! You have rented");
        msgs.put("NewBalance", "Your new balance is");
        msgs.put("RentMax", "You are not allowed to rent more regions. Max");
        msgs.put("RentPerms", "You do not have permission to rent regions.");
        msgs.put("Balance", "Your balance is");
        msgs.put("Purchased", "Congrats! You have purchased");
        msgs.put("BuyMax", "You are not allowed to buy more regions. Max");
        msgs.put("BuyPerms", "You do not have permission to buy regions.");
        msgs.put("NotRented", "is not currently rented.");
        msgs.put("NotRenting", "You are not renting this region. You cannot renew it!");
        msgs.put("NotEnoughRenew", "Not enough money to renew rental for this region!");
        msgs.put("Renewed", "Congrats! You have renewed");
        msgs.put("Expired", "Your rental has expired for region");
        msgs.put("Help1", "Apartments Commands");
        msgs.put("Help2", "/Apartments - toggles buy mode");
        msgs.put("Help3", "/Apartments renew <region> - renews rental of <region>");
        msgs.put("Help4", "/Apartments autorenew <true/false> - sets auto-renew for all rented regions");
    
        return msgs;
      }
    
      private String getMessage(String key) {
        return (String)this.Messages.get(key);
      }
    
      public void scheduleRenterTask() {
        getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
        {
          public void run()
          {
            try
            {
              long now = new Date().getTime();
    
              for (String regionName :  Apartments.this.RentedRegionExpirations.keySet())
              {
                if (Apartments.this.RentedRegionExpirations.containsKey(regionName)) {
                  long regionExp = ((Long)Apartments.this.RentedRegionExpirations.get(regionName)).longValue();
    
                  if (regionExp <= now)
                  {
                    boolean renewed = false;
    
                    Apartments.RentableRegion rentedRegion = Apartments.this.loadRegion(regionName);
    
                    if (Apartments.this.AutoRenews.containsKey(rentedRegion.renter))
                    {
                      if (((Boolean)Apartments.this.AutoRenews.get(rentedRegion.renter)).booleanValue())
                      {
                        Player player = Apartments.this.getServer().getPlayer(rentedRegion.renter);
    
                        Double regionPrice = Double.valueOf(Double.parseDouble(rentedRegion.signLine3));
    
                        if (Apartments.econ.getBalance(rentedRegion.renter) >= regionPrice.doubleValue())
                        {
                          EconomyResponse response = Apartments.econ.withdrawPlayer(rentedRegion.renter, regionPrice.doubleValue());
    
                          if (response.transactionSuccess())
                          {
                            renewed = true;
    
                            String[] timeSpan = rentedRegion.signLine4.split(" ");
    
                            long currentExpiration = ((Long)Apartments.this.RentedRegionExpirations.get(regionName)).longValue();
    
                            Apartments.DateResult timeData = Apartments.this.parseDateString(Integer.parseInt(timeSpan[0]), timeSpan[1], currentExpiration);
    
                            Apartments.this.RentedRegionExpirations.put(regionName, Long.valueOf(timeData.Time));
                            Apartments.this.saveRentedRegionExpirations();
    
                            Apartments.this.logActivity(rentedRegion.renter, " AUTORENEW " + regionName);
    
                            SimpleDateFormat sdf = new SimpleDateFormat(Apartments.this.dateFormatString);
    
                            if ((player instanceof Player)) {
                              player.sendMessage(Apartments.this.Notice(Apartments.this.getMessage("Renewed") + " " + regionName + " -> " + sdf.format(new Date(timeData.Time))));
                              player.sendMessage(Apartments.this.Notice(Apartments.this.getMessage("NewBalance") + " " + Apartments.econ.getBalance(rentedRegion.renter)));
                            }
    
                            World world = Apartments.this.getServer().getWorld(rentedRegion.worldName);
    
                            double x = Double.parseDouble(rentedRegion.signLocationX);
                            double y = Double.parseDouble(rentedRegion.signLocationY);
                            double z = Double.parseDouble(rentedRegion.signLocationZ);
                            float pitch = Float.parseFloat(rentedRegion.signLocationPitch);
                            float yaw = Float.parseFloat(rentedRegion.signLocationYaw);
    
                            Location signLoc = new Location(world, x, y, z, pitch, yaw);
    
                            Block currentBlock = world.getBlockAt(signLoc);
    
                            if ((currentBlock.getType() == Material.SIGN_POST) || (currentBlock.getType() == Material.WALL_SIGN))
                            {
                              Sign theSign = (Sign)currentBlock.getState();
    
                              theSign.setLine(0, regionName);
                              theSign.setLine(1, rentedRegion.renter);
                              theSign.setLine(2, ChatColor.WHITE + "Until:");
                              theSign.setLine(3, sdf.format(new Date(timeData.Time)));
                              theSign.update();
    
                              theSign.update();
                            }
    
                          }
    
                        }
                        else if ((player instanceof Player)) {
                          player.sendMessage(Apartments.this.Notice(Apartments.this.getMessage("NotEnoughRenew") + " " + regionName + "!"));
                          player.sendMessage(Apartments.this.Notice(Apartments.this.getMessage("Balance") + " " + Apartments.econ.getBalance(rentedRegion.renter)));
                        }
    
                      }
    
                    }
    
                    if (!renewed)
                    {
                      Apartments.this.RentedRegionExpirations.remove(regionName);
                      Apartments.this.saveRentedRegionExpirations();
    
                      World world = Apartments.this.getServer().getWorld(rentedRegion.worldName);
                      RegionManager rm = Apartments.this.getWorldGuard().getRegionManager(world);
                      ProtectedRegion region = rm.getRegion(regionName);
                      DefaultDomain dd = new DefaultDomain();
    
                      dd = region.getMembers();
    
                      dd.removePlayer(rentedRegion.renter);
    
                      region.setMembers(dd);
    
                      Apartments.this.removeRentedRegionFromCount(rentedRegion.renter);
    
                      double x = Double.parseDouble(rentedRegion.signLocationX);
                      double y = Double.parseDouble(rentedRegion.signLocationY);
                      double z = Double.parseDouble(rentedRegion.signLocationZ);
                      float pitch = Float.parseFloat(rentedRegion.signLocationPitch);
                      float yaw = Float.parseFloat(rentedRegion.signLocationYaw);
    
                      Location signLoc = new Location(world, x, y, z, pitch, yaw);
    
                      Block currentBlock = world.getBlockAt(signLoc);
    
                      if ((currentBlock.getType() == Material.SIGN_POST) || (currentBlock.getType() == Material.WALL_SIGN))
                      {
                        Sign theSign = (Sign)currentBlock.getState();
    
                        theSign.setLine(0, rentedRegion.signLine1);
                        theSign.setLine(1, rentedRegion.signLine2);
                        theSign.setLine(2, rentedRegion.signLine3);
                        theSign.setLine(3, rentedRegion.signLine4);
    
                        theSign.update();
                      }
                      else
                      {
                        try
                        {
                          if (rentedRegion.signType == "WALL_SIGN")
                            currentBlock.setType(Material.WALL_SIGN);
                          else {
                            currentBlock.setType(Material.SIGN_POST);
                          }
    
                          Sign newSign = (Sign)currentBlock.getState();
    
                          newSign.setLine(0, rentedRegion.signLine1);
                          newSign.setLine(1, rentedRegion.signLine2);
                          newSign.setLine(2, rentedRegion.signLine3);
                          newSign.setLine(3, rentedRegion.signLine4);
    
                          newSign.update();
                        }
                        catch (Exception e) {
                          Apartments.this.getLogger().info("RentRegion automatic sign creation failed for region " + rentedRegion.regionName);
                        }
    
                      }
    
                      File regionFile = new File(Apartments.signDataLoc + regionName + ".digi");
    
                      if (regionFile.exists()) {
                        regionFile.delete();
                      }
    
                      Player player = Apartments.this.getServer().getPlayer(rentedRegion.renter);
    
                      if ((player instanceof Player)) {
                        player.sendMessage(Apartments.this.Notice(Apartments.this.getMessage("Expired") + " " + regionName));
                      }
    
                      Apartments.this.logActivity(rentedRegion.renter, " EXPIRED " + rentedRegion.regionName);
                    }
    
                  }
    
                }
    
              }
    
            }
            catch (Exception e)
            {
              e.printStackTrace();
            }
          }
        }
        , tickRate, tickRate);
      }
    
      public void renewRental(String regionName, String playerName, CommandSender sender)
      {
        try
        {
          if ((new File(signDataLoc + regionName + ".digi").exists()) && (this.RentedRegionExpirations.containsKey(regionName)))
          {
            RentableRegion region = loadRegion(regionName);
    
            if (sender.getName().equalsIgnoreCase(region.renter))
            {
              Double regionPrice = Double.valueOf(Double.parseDouble(region.signLine3));
    
              if (econ.getBalance(playerName) >= regionPrice.doubleValue())
              {
                EconomyResponse response = econ.withdrawPlayer(playerName, regionPrice.doubleValue());
    
                if (response.transactionSuccess())
                {
                  String[] timeSpan = region.signLine4.split(" ");
    
                  long currentExpiration = ((Long)this.RentedRegionExpirations.get(regionName)).longValue();
    
                  DateResult timeData = parseDateString(Integer.parseInt(timeSpan[0]), timeSpan[1], currentExpiration);
    
                  this.RentedRegionExpirations.put(regionName, Long.valueOf(timeData.Time));
                  saveRentedRegionExpirations();
    
                  logActivity(playerName, " RENEW " + regionName);
    
                  SimpleDateFormat sdf = new SimpleDateFormat(this.dateFormatString);
    
                  sender.sendMessage(Notice(getMessage("Renewed") + " " + regionName + " until " + sdf.format(new Date(timeData.Time))));
                  sender.sendMessage(Notice(getMessage("Balance") + " " + econ.getBalance(playerName)));
    
                  World world = getServer().getWorld(region.worldName);
    
                  double x = Double.parseDouble(region.signLocationX);
                  double y = Double.parseDouble(region.signLocationY);
                  double z = Double.parseDouble(region.signLocationZ);
                  float pitch = Float.parseFloat(region.signLocationPitch);
                  float yaw = Float.parseFloat(region.signLocationYaw);
    
                  Location signLoc = new Location(world, x, y, z, pitch, yaw);
    
                  Block currentBlock = world.getBlockAt(signLoc);
    
                  if ((currentBlock.getType() == Material.SIGN_POST) || (currentBlock.getType() == Material.WALL_SIGN))
                  {
                    Sign theSign = (Sign)currentBlock.getState();
    
                    theSign.setLine(0, regionName);
                    theSign.setLine(1, playerName);
                    theSign.setLine(2, ChatColor.WHITE + "Until:");
                    theSign.setLine(3, sdf.format(new Date(timeData.Time)));
                    theSign.update();
    
                    theSign.update();
                  }
    
                }
                else
                {
                  sender.sendMessage(Notice(getMessage("TransFailed")));
                }
              } else {
                sender.sendMessage(Notice(getMessage("NotEnoughRenew")));
                sender.sendMessage(Notice(getMessage("Balance") + " " + econ.getBalance(playerName)));
              }
    
            }
            else
            {
              sender.sendMessage(Notice(getMessage("NotRenting")));
            }
    
          }
          else
          {
            sender.sendMessage(Notice(regionName + " " + getMessage("NotRented")));
          }
        } catch (Exception e) {
          getLogger().info("An error has occured while renewing rental for: " + regionName);
        }
      }
    
      private void logActivity(String player, String action)
      {
        try
        {
          Date tmp = new Date();
          File file = new File(dataLoc + "RegionActivityLog.txt");
    
          FileWriter out = new FileWriter(file, true);
          out.write(tmp.toString() + " [" + player + "] " + action + "\r\n");
          out.flush();
          out.close();
        }
     
    
        
    And a pic of my plugin.yml:

    http://prntscr.com/5vwd0q
     
  8. Offline

    Skionz

    @blondy2247 Thats not the correct plugin.yml file corresponding to the exception. Make sure the main class is correct, but it should be now.
     
  9. Offline

    blondy2247

    Yes, the main is correct and so is everything in the java file as well. I don't understand why it keeps saying that it can't find the main.
     
  10. Offline

    Skionz

  11. Offline

    blondy2247

    What am I doing wrong? I am clicking export, then java jar file, then selecting apartments and exporting it.
    http://prntscr.com/5vwfxi
     
  12. Offline

    Skionz

    @blondy2247 Why are you exporting with syntax errors? Also, you aren't exporting to the plugins folder.
     
  13. Offline

    blondy2247

    I always get syntax errors in my plugins, and after I export it I just move the plugin to the plugins folder, but ill try exporting it straight to the plugins folder.
     
  14. Offline

    Skionz

    @blondy2247 You should never have syntax errors when exporting and your IDE will tell you exactly what to fix.
     
  15. Offline

    blondy2247

    I seem to have found the problem:

    Code:
    [23:22:03 INFO]: [Apartments] Enabling Apartments v1.0
    [23:22:03 INFO]: [Apartments] Apartments - Created by blondy2247
    [23:22:03 INFO]: [Apartments] Disabled due to no Vault dependency found!
    [23:22:03 INFO]: [Apartments] Disabling Apartments v1.0
    
    I don't know what else to try, vault is already in the plugins folder.

    @Skionz Please help, ur the only one who seems to care

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

    Skionz

  17. Offline

    xTigerRebornx

  18. Offline

    blondy2247

    Here it is:
    name: Apartments

    main: me.blondy2247.Apartments.Apartments

    version: 1.0

    author:

    - blondy2247

    depend: [Vault,WorldGuard]

    commands:

    apartments:

    description: toggles region buy or rent mode.

    @xTigerRebornx U still there?

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

    sirrus86

    Does the console show Vault as being enabled before your plugin is?
     
  20. Offline

    blondy2247

    Yes, it does.
     
  21. Offline

    mythbusterma

    @blondy2247

    Are you certain you're still getting the exact same error?
     
  22. Offline

    blondy2247

    Yep:

    Code:
    [23:22:03 INFO]: [Apartments] Enabling Apartments v1.0
    [23:22:03 INFO]: [Apartments] Apartments - Created by blondy2247
    [23:22:03 INFO]: [Apartments] Disabled due to no Vault dependency found!
    [23:22:03 INFO]: [Apartments] Disabling Apartments v1.0
    
     
  23. Offline

    sirrus86

    For kicks, how about if you could show us everything in the console when you first start up the server. Your server is acting like Vault isn't being found (which usually indicates it isn't loading).
     
  24. Offline

    blondy2247

    Here it is:

    Code:
    Loading libraries, please wait...
    [00:37:57 INFO]: Starting minecraft server version 1.7.9
    [00:37:57 INFO]: Loading properties
    [00:37:57 INFO]: Default game type: SURVIVAL
    [00:37:57 INFO]: Generating keypair
    [00:37:58 INFO]: Starting Minecraft server on *:25565
    [00:37:58 INFO]: This server is running CraftBukkit version git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks (MC: 1.7.9) (Implementing API version 1.7.9-R0.3-SNAPSHOT)
    [00:37:58 INFO]: [Vanish] Loading Vanish v1.0
    [00:37:58 INFO]: [SuperheroPvP] Loading SuperheroPvP v0.1
    [00:37:58 INFO]: [WorldEdit] Loading WorldEdit v5.6.2
    [00:37:58 INFO]: [AutoFly] Loading AutoFly v0.1
    [00:37:58 INFO]: [CompassTeleport] Loading CompassTeleport v1.0
    [00:37:58 INFO]: [Vault] Loading Vault v1.4.1-b436
    [00:37:58 INFO]: [AdvancedVoting] Loading AdvancedVoting v1.0
    [00:37:58 INFO]: [ProtocolLib] Loading ProtocolLib v3.4.0
    [00:37:58 WARN]: [ProtocolLib] Version (MC: 1.7.9) has not yet been tested! Proceed with caution.
    [00:37:59 WARN]: Could not get information about this CraftBukkit version; perhaps you are running a custom one?: IOException
    [00:37:59 INFO]: [WorldGuard] Loading WorldGuard v5.9
    [00:37:59 INFO]: [Apartments] Loading Apartments v1.0
    [00:37:59 INFO]: [LibsDisguises] Loading LibsDisguises v8.2.6
    [00:37:59 INFO]: [SuperWars] Loading SuperWars v1.1
    [00:37:59 INFO]: [Vault] Enabling Vault v1.4.1-b436
    [00:37:59 INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
    [00:37:59 INFO]: [Vault] Enabled Version 1.4.1-b436
    [00:37:59 INFO]: [ProtocolLib] Enabling ProtocolLib v3.4.0
    [00:37:59 INFO]: [ProtocolLib] Started structure compiler thread.
    [00:37:59 INFO]: Preparing level "world"
    [00:37:59 INFO]: Preparing start region for level 0 (Seed: -6965050058068558065)
    [00:37:59 WARN]: Could not get latest artifact information: IOException
    [00:38:00 INFO]: Preparing spawn area: 76%
    [00:38:00 INFO]: Preparing start region for level 1 (Seed: -6965050058068558065)
    [00:38:01 INFO]: Preparing start region for level 2 (Seed: -6965050058068558065)
    [00:38:01 INFO]: [Vanish] Enabling Vanish v1.0
    [00:38:01 INFO]: [SuperheroPvP] Enabling SuperheroPvP v0.1
    [00:38:01 INFO]: [SuperheroPvP] SuperheroPvP has been enabled. - created by blondy2247
    [00:38:01 INFO]: [WorldEdit] Enabling WorldEdit v5.6.2
    [00:38:01 INFO]: WEPIF: Using the Bukkit Permissions API.
    [00:38:01 INFO]: [AutoFly] Enabling AutoFly v0.1
    [00:38:01 INFO]: Made by @blondy2247
    [00:38:01 INFO]: [CompassTeleport] Enabling CompassTeleport v1.0
    [00:38:01 INFO]: [AdvancedVoting] Enabling AdvancedVoting v1.0
    [00:38:01 INFO]: [WorldGuard] Enabling WorldGuard v5.9
    [00:38:01 INFO]: [WorldGuard] (world) TNT ignition is PERMITTED.
    [00:38:01 INFO]: [WorldGuard] (world) Lighters are PERMITTED.
    [00:38:01 INFO]: [WorldGuard] (world) Lava fire is blocked.
    [00:38:01 INFO]: [WorldGuard] (world) Fire spread is UNRESTRICTED.
    [00:38:01 INFO]: [WorldGuard] Loaded configuration for world 'world'
    [00:38:01 INFO]: [WorldGuard] (world_nether) TNT ignition is PERMITTED.
    [00:38:01 INFO]: [WorldGuard] (world_nether) Lighters are PERMITTED.
    [00:38:01 INFO]: [WorldGuard] (world_nether) Lava fire is blocked.
    [00:38:01 INFO]: [WorldGuard] (world_nether) Fire spread is UNRESTRICTED.
    [00:38:01 INFO]: [WorldGuard] Loaded configuration for world 'world_nether'
    [00:38:01 INFO]: [WorldGuard] (world_the_end) TNT ignition is PERMITTED.
    [00:38:01 INFO]: [WorldGuard] (world_the_end) Lighters are PERMITTED.
    [00:38:01 INFO]: [WorldGuard] (world_the_end) Lava fire is blocked.
    [00:38:01 INFO]: [WorldGuard] (world_the_end) Fire spread is UNRESTRICTED.
    [00:38:01 INFO]: [WorldGuard] Loaded configuration for world 'world_the_end'
    [00:38:01 INFO]: [WorldGuard] 0 regions loaded for 'world'
    [00:38:01 INFO]: [WorldGuard] 0 regions loaded for 'world_nether'
    [00:38:01 INFO]: [WorldGuard] 0 regions loaded for 'world_the_end'
    [00:38:01 INFO]: [Apartments] Enabling Apartments v1.0
    [00:38:01 INFO]: [Apartments] Apartments - Created by blondy2247
    [00:38:01 INFO]: [Apartments] Disabled due to no Vault dependency found!
    [00:38:01 INFO]: [Apartments] Disabling Apartments v1.0
    [00:38:01 INFO]: [LibsDisguises] Enabling LibsDisguises v8.2.6
    [00:38:02 INFO]: [SuperWars] Enabling SuperWars v1.1
    [00:38:02 INFO]: Server permissions file permissions.yml is empty, ignoring it
    [00:38:02 INFO]: Done (3.013s)! For help, type "help" or "?"
    [00:38:03 INFO]: [Vault] Checking for Updates:
    [00:38:03 WARN]: [Vault] Stable Version: 1.5.2 is out! You are still running version: 1.4.1
    [00:38:03 WARN]: [Vault] Update at: http://dev.bukkit.org/server-mods/vault
    >
    
    @Skionz @xTigerRebornx @sirrus86 @mythbusterma thank you so much for all your help, I figure out the problem was that I was missing and economy plugin and accidentally forgot I deleted essentials and forgot to re-add it, also I had a few things missing from the main code. But anyways thanks guys!

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

    mythbusterma

    @blondy2247

    Also, some serious issues with your code:

    1. Why is EVERYTHING public? Make it private, don't expose implementation.

    2. Why are you using ConcurrentHashMaps? They're very expensive data structures, and you're only using one thread, don't bother.

    3. Why are you catching Exception? You're swallowing exceptions left and right. Don't do that.

    4. You do know you actually have to have a permissions plugin for Vault to work, and it doesn't look like you have one.
     
  26. Offline

    blondy2247

    1. Don't see a point since I'm only doing it for my server and no one else
    2. Ill change that
    3. Fixed that already
    4. And I do, I'm using group manager.
     
  27. Offline

    mythbusterma

    @blondy2247

    I meant economy plugin, my mistake.

    Also, there was no Group Manager in that startup log.

    And making the plugin just for yourself is no excuse for bad practises.
     
Thread Status:
Not open for further replies.

Share This Page