Including external libraries

Discussion in 'Plugin Development' started by Lite, Dec 16, 2011.

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

    Lite

    Hello,

    i'm working on a plugin that's using the Apache HttpClient library.
    How can I include it in my plugin.jar?
    I've imported the library in Eclipse, but it doesn't seem to export it.

    Thanks for your help,
    Lite
     
  2. Offline

    CodeRedstone

    Try:

    Use WinRar (7-zip should be fine) and open up Apache HttpClient (jar) and your plugin jar. Where your plugin.yml is, drag and drop the all folders from Apache HttpClient jar.

    This is the only way I've found, but I suppose I've never actually googled it. There is probably another (cleaner) way though.
     
  3. Offline

    Lite

    Works :)
    Thanks
     
  4. Offline

    wwsean08

    there is also a plugin for eclipse which will essentially do this automatically, it's called fatjar
     
  5. Offline

    Lite

    It's a one time thing, i only need it for this one plugin.
    I've extracted the .jars to my project folder. It includes them automatically, each time i export them.

    Thanks for the tip anyways :)
     
  6. Note that for more common libraries this is a bad way to do this (for example JDBC). If multiple plugins have the library included, you will get errors because it tries to load it twice.
    Libraries are usually downloaded in the directory "lib", where they can be shared by multiple plugins.
    Take a look at sources of plugins that do that (LWC for example) and use google to find out how to load the classes from there (hint: class loaders may be a good keyword).

    But for your case, probably not so many plugins include a complete apache client, so the risk of incompatibility is not so high ...
     
  7. Offline

    wwsean08

    no problem i just figured i'd let you know about it since I had to do it on a long term project so i used it a-lot on that
     
  8. Offline

    Afforess

    One word: "Maven".

    Learn it, use it, love it. Complete and automagic dependancy management.
     
    md_5 and r3Fuze like this.
  9. Offline

    Don Redhorse

    yeah... but I can't find some GOOD documentation about it... especially for all the different stuff you need to enter and how to set it up..

    does nobody explain stuff nowadays anymore?

    oh, and on a side note? I PMed you Afforess... what about Minecart Mania?
     
  10. Offline

    Afforess

    Ugh, my current project is a sinkhole of time. I'd talk to @bergerkiller instead, he has a really good grasp of minecarts.
     
  11. Offline

    bergerkiller

  12. Offline

    Don Redhorse

    well I REALLY appreciate Spout... but minecart mania is a "must" ... so we really need somebody to keep it going..

    publish a new version of minecraft mania... gogogogo...

    if you need somebody to do heavy lifting drag me in...

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

    nickrak

    Eclipse will do the merge for you if you check the Copy required class files option in the export jar menu. No plugin needed.
     
  14. Offline

    bergerkiller

    @Don Redhorse Already got TrainCarts running, not sure if you need any features in that for it to replace Minecart Mania? I could go and edit MM, but it will probably take a bit long for me to understand how it's coded. (I know TrainCarts while blindly scrolling along the lines)
     
  15. Offline

    Afforess

    Gross, I would never wish support of MM 1.0 on anyone. A bunch of it is a mess, and I made of plenty of mistakes. You could write a successor though.
     
  16. Offline

    bergerkiller

    @Afforess What are the key features needed for a good successor then? I suppose minecart<>chest dispension and the click-change-direction feature (that will probably become for owners only)
     
  17. Offline

    Afforess

    @bergerkiller
    Ability to customize the effects of track pieces (i.e how fast/slow the powered track pieces are), some kind of stop/start launching system for minecarts (look at the obsidian launchers...), chest dispensing are all excellent starts. Since you already have rewritten collision physics, you could also make minecarts travel through stuff on the tracks too.

    One of the other big problem area's is getting from point A to B. I used a complicated sign interface to switch at intersections, but I was thinking of ditching that and writing some kind of path finding setup. I'd be happy to share all of my ideas on how to do this in a PM.

    Anyway, if you are really interested, you have my permission to re-use the MM name and call it official.
     
  18. Offline

    bergerkiller

    @Afforess @Thulinma already made a very awesome destination system. It is almost like AI intelligence, only difference is that it stores nodes in the real world with a distance. There is also a video of it on the TrainCarts page. (where I make a train ride to A-E)
    You simply place tag signs underneath the track pieces to change and destination signs to mark destinations. Tag signs can also be used to toggle tracks based on tags on the train.

    It also has a whole batch of collision settings already, like whether or not to collide at all and whether or not to collide (push away) misc entities, mobs or players. It also ignores blocks on the sides of corner pieces (as that was a serious headache). Not a good idea to make it travel through blocks though, it could hurt the passengers :)

    So TODO for TrainCarts:
    - Chest dispension
    - 'Special' rails (I already do this somewhat using signs underneath the tracks)

    What types of 'special' rails do you need? I already have a fully automatic station system which can stop/launch based on redstone or settings on the sign, so the launcher is already there. I also have eject signs and it's possible to alter train properties through a property signs. (for example, deny/allow players to enter/exit the train)
     
  19. Offline

    Afforess

    That pathfinding sounds cool!

    Don't ask me what I want, I don't run a server anymore. Open a thread, ask MM users what they want. :p
     
  20. Offline

    Don Redhorse

  21. 'sup.
    Yes, the pathfinding is pretty cool, if I do say so myself :)

    Btw, @bergerkiller , I found a few bugs in the pathfinding a while ago... will send you some fixes sometime soon. :)
     
  22. Offline

    bergerkiller

    @Thulinma ok no problem, didn't touch the pathfinding so it can easily be fixed. (I suppose)

    Do prepare for the fact that I will give single-carts their own destination. This way it is possible to split trains at intersections. Commands like /train dest will set the destination on all carts. The same applies to the tag switcher.
     
  23. Sure. Shouldn't make any real difference for the routing, I think... Just have to make sure to only check single carts and not the whole train. Will the splitting be automatic or need some kind of function call?
     
  24. Offline

    bergerkiller

    @Thulinma I am currently implementing 'smart train splitting'. This basically means:
    - Can cart go to cart in front when taking direction and the tracks in consideration?
    If no, it splits the train at that cart. I still got some issues with >4 cart trains stopping.
     
Thread Status:
Not open for further replies.

Share This Page