[ECO/FIX]FayConomy v1.4 - iConomy to Essentials Eco Bridge [740]

Discussion in 'Inactive/Unsupported Plugins' started by xeology, Apr 28, 2011.

  1. Offline

    xeology

    FayConomy - iConomy to Essentials Eco Bridge:
    - Doubles as Essentials Eco API - EcoAPI
    Version: v1.4

    THIS IS INCLUDED IN ESSENTIALS!

    Use these if you are using the new version! ONLY USE 1 BY THE VERSION YOU NEED!

    http://dl.dropbox.com/u/18601879/EssentialsiConomyBridges.rar


    Ever want all those awesome iConomy plugins for Essentials Eco? Are you a developer and wanted an easy API for Essentials Eco? Well guess what! I got your solution!

    FayConomy (Fake - iConomy) is a mock API of iConomy's API while pretending to be iConomy. It will take iConomy API calls and reformat and redirect them directly into Essentials Eco!

    FayConomy also supports non-player accounts separate from Essentials but following their standards! Now you can have plugins that work with such features in iConomy such as iCoLand.

    If you are curious on how it is done the source is in the JAR and FULLY annotated. To develop using the API just develop as if it were iConomy using the iConomy JAR.

    WARNING: Do NOT attempt to run this with iConomy or without Essentials Eco! Do NOT delete the config.yml in the iConomy folder, this belongs to FayConomy. If you have a file with that name PRIOR to installing FayConomy then back it up and remove it!


    Features:
    • Bridges iConomy API over to Essentials Eco!
    • Custom API for Essentials Eco that is simple, easy and intuitive!
    • Bridges Deprecated API Functions for reverse compatibility
    • Fixes improper use of the API and makes it work regardless of the improper usage
    • Makes iConomy plugins work with Essentials Eco!
    • Adds NPC account support to Essentials Eco!
    • Change the name of the Currency!
    • Basic Persistance with configurable save times (in minutes!)
    Download The Plugin

    Source Code is in the JAR

    Install:
    • Just install the JAR
    • Run once, then open the iConomy\config.yml and change SaveRate: 10 to any amount in minutes that you may want!
    • Open the iConomy\config.yml and change CurrencyName and MultipleCurrencyName to whatever you like!
    Tested Plugins:

    • CookieMonster
    • iCoLand
    • MultiVerse
    • Towny
    ToDo:

    • Create a method for storing non-player money in Essentials
    • Bug fixes? +4
    • Optimization As optimized as it will get, no loops, no constants, no arrays, NOTHING
    • Get rid of my hacky Essentials iConomy Check bypass (ALMOST!)
    Changelog:

    Show Spoiler

    Version 1.4
    • Added Essentials Eco API, EcoAPI. Easier, less confusing and more intuitive. ONLY SUPPORTS ESSENTIALS!
    Version 1.3
    • Now allow improper iConomy API usage and fixes the negative results of such usage!
    • Added Currencyname and MultipleCurrencyName.
    Version 1.2
    • Added left out iConomy API, even the Deprecated ones!
    • Added NPC support!
    • Added basic lightweight persistance Minor fixes
    Version 1.1
    • Removed ALL loops
    • Removed ALL arrays
    • Removed ALL methods for storing
    • NEW, LIGHTER and IMPROVED!
    • Fixed decimals messing up essentials, essentials just doesn't handle them well so I truncate!
    • Direct player access opposed to storing player references on login
    Version 1.0b
    • Fixed the pesky ArrayIndexOutofBounds error, sorry guys, should have tested better!
    Version 1.0
    • Released


    Essentials Eco API - For Devs!
    Show Spoiler
    First off you will want to make sure you are checking for FayConomy so your not hooking into iConomy. Here is what you put in your main somewhere,

    Show Spoiler

    Code:
        private void detectFay() throws NoSuchMethodException{
            try{
            if (com.nijiko.coelho.iConomy.iConomy.isFay()){
                System.out.println("FayExtended - Linked with FayConomy!");
                return;
            }
            }
            catch(Throwable ex){
                System.out.println("FayExtended - YOU NEED FAYCONOMY!");
                throw new NoSuchMethodException();
            }
            System.out.println("FayExtended - YOU NEED FAYCONOMY!");
            return;
        }
    


    Put this in your onEnable()

    Code:
    detectFay();
    

    Put this in the import area of whatever class is going to use FayConomy hooks,

    Code:
    import com.nijiko.coelho.iConomy.EcoAPI;
    
    OR
    
    if you will be using the Essentials Version of this it will be
    
    import com.earth2me.essentials.EcoAPI;
    
    Here are a few rules, follow them well!

    Show Spoiler

    Accounts for npc's must be made first.

    Do not bother will decimals right now they will be truncated until Essentials Eco supports them.

    You will have to have your methods using the following hooks throw NoSuchMethodException, this is because that is the only way I can stop Essentials Eco calling to FayConomy thinking it is iConomy.

    The API will NEVER have anything removed or reformatted. I will ONLY change their internals in a way that does not break plugins unless some act of GOD stops me from keeping this promise.

    I may add new things, I may not. Doubles will be supported eventually!


    These are the player account checks

    Show Spoiler

    EcoAPI.getMoney(String player);

    - This gets the player's balance
    !Returns double


    EcoAPI.isNegative(String player);

    -This will see if it the player's balance is negative or not
    !Returns boolean


    EcoAPI.hasEnough(String player, double amount) ;

    - Will see if the player can afford amount
    !Returns boolean


    EcoAPI.hasMore(String player, amount);

    - Will see if the player has more than the amount
    !Returns boolean


    EcoAPI.hasLess(String player, amount);

    -Will see if the player has less than the amount
    !Returns boolean


    EcoAPI.getCurrency() ;

    - This will return the currency set by the admin
    !Returns String


    EcoAPI.getCurrencyPlural();

    - This will return the currency set by the admin in plural
    !Returns String


    These are the player account modifiers

    Show Spoiler

    EcoAPI.setMoney(String player, double amount);

    -This will set the player's balance


    EcoAPI.add(String player, amount);

    - This will add the amount to the player's balance


    EcoAPI.subtract(String player, amount);

    - This will subtact from the player's balance


    EcoAPI.multiply(String player, double multiplier);

    -This will multiply the player's balance by the multiplier.


    EcoAPI.multiply(String player, double dividend);

    -This will divide the player's balance by the dividend.


    EcoAPI.resetBalance(String player);

    - This will reset the player's balance to 0!


    Here are the NPC functions, YOU MUST USE newAccount() BEFORE PROCCESSING AN NPC'S ACCOUNT AS A PLAYER!

    Show Spoiler

    EcoAPI.newAccount(String npc);

    - This will generate a new npc account, it will not recreate existing accounts!
    !Returns boolean, true for success and false for already exists!


    EcoAPI.accountExist(String Name);

    -This will return if the npc's account exists
    !Returns boolean


    EcoAPI.removeAccount(String name);

    - This will remove an EXISTING npc account!


    Credits:
    • Makers of Essentials
    • Makers of iConomy
    • Guys on IRC for aid with my iConomy Check Bypass (one was scared of what I was doing lol)
    • Me for the time and code, Xeology
     
    Xordaii and KidCanada like this.
  2. Offline

    MineCleric

    Update plz to [1000]
     
  3. Offline

    rareshutzu

    Seconded!
     
  4. Offline

    spomino

    Does it work with bukkit[1000] .
     
  5. Offline

    MineCleric

    I can use permissons 3.1.6 I need i-chat 3 to i get [Mod]
     
  6. Offline

    0xDEADMEAT

    Do i have to have iConomy for this to work, or can i get rid of it????
     
  7. Offline

    userdel_9192018

    Hey Can Somebody make a good video tutrial on how to install this because i really need it and i have no idea how to install this!
     
  8. Offline

    rareshutzu

    Any chance to have this updated for 1185?
     
  9. Offline

    rex123105

    So if we install this can we install other plugins we would originally use for iconomy?
     
  10. Offline

    MongooseBoy26

    Quick Question:
    Does this support the Essentials Signs using the fake Iconomy money accounts?

    -MongooseBoy26
     

Share This Page