Using the Bukkit version of JODA

Discussion in 'Plugin Development' started by bwinkl04, May 1, 2013.

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

    bwinkl04

    I wrote a plugin that uses JODA time and included it in the fat jar. It was working fine for most servers, but I recently found out it was causing some other plugins that rely on the Bukkit implementation of ebeans to crash, and quite frankly this is just poor programming on my part. I have two options. (1) Use maven to shade the plugin and JODA, which I have NO idea how to use, and cant find any good information on how to do this. (2) Use the bukkit implementation of JODA, which is what I would like to do, but I can not figure out how to do it.

    Here is my current method.
    Code:
    private static int getHours(int row) throws Exception
        {
            String[] token = new String[4];
            token = clearedlist.get(row);
            String date = token[2];
            DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
            Date now = new Date();
            String rightNow = new String(dateFormat.format(now));
           
            DateTimeFormatter format = DateTimeFormat.forPattern("yyyy/MM/dd hh:mm:ss");
            DateTime time1 = format.parseDateTime(date);
            DateTime time2 = format.parseDateTime(rightNow);
            Hours hoursBetween = Hours.hoursBetween(time1, time2);
           
            int hoursOut = 0;
            if (hoursBetween.getHours() <= 0)
            {
                hoursOut = 1;
            }
            else
            {
                hoursOut = hoursBetween.getHours();
            }
            return hoursOut;
        }
    
    Can one of you brilliant developers please help me change this method to use the bukkit implementation of JODA time?
     
Thread Status:
Not open for further replies.

Share This Page