MoneySQL (bungee money sync) 1.4

Easy way to sync money between servers using MySQL database (+ PHP script for site!)

  1. Wruczek
    MoneySQL is a simple plugin to sync your players money with MySQL database and other servers. Its fast, easy, powerfull, configurable and simple. Works with all economy plugins. It supports UUID and works on 1.7 and 1.8 Minecraft versions.​

    Commands and permissions
    [​IMG]

    Installation
    1. Download plugin and put it into your plugins folder.
    2. If you not have, download and install Vault.
    3. If you not have, download and install any economy plugin which is supported by Vault, for example IConomy.
    4. Go to config.yml and configure your MySQL connection, optionally other things (Event list).
    5. Done!

    PHP script for website
    [​IMG]

    Download [v6]: http://pastebin.com/RfHQ5JAj

    Server Requirements:
    • Newest PHP version.
    • Newest MySQL server version.
    • Be sure your PHP supports mysqli.

    Developers API
    Using API you can:

    • Listen to MoneySQLUpdateEvent which is called when updating players money
    • Check reason of updating using CausedBy enumeration (EVENT, PLUGIN_DISABLE, COMMAND, AUTO_SCHEDULER, OTHER)
    • Use powerfull mr.wruczek.moneysql.Methods class (you can get: player UUID, player money, check if event from configuration is enabled, and get numerous of asynchronous and non-asynchronous updating methods)
    • Check information about database, execute sql and more
      • mr.wruczek.moneysql.data.MySQLManager - methods which MoneySQL are using (creating player in database ect.).
      • mr.wruczek.moneysql.data.MoneySQLManager - mysql variable - everything about MySQL (executing query, opening and closing connection ect.)
    • Get configuration variables: mr.wruczek.moneysql.ConfigManager
    Examples

    Click here for version with Syntax Highliting and more readable code

    Basics:

    Code (Text):
    // Our player
    Player player = Bukkit.getPlayer("Wruczek");

    // Get his UUID
    Methods.getUUID(player);

    // Getting his money
    Methods.getPlayerMoney(player);

    // Using string with name
    Methods.getPlayerMoney("Wruczek");

    // Check if event from configuration is enabled
    Methods.isEventEnabled("PlayerJoinEvent");

    // Update player (easiest way)
    Methods.update(player);

    // Update player (lets set CausedBy and get response)
    Methods.update(player, CausedBy.COMMAND, new Runnable() {
    @Override
    public void run() {
    System.out.println("Done updating");
    }
    });

    // Get MySQL host name from config
    ConfigManager.mysql_host;

    // Get list of events
    ConfigManager.update_events;

    // Lets execute query
    MySQLManager.mysql.updateSQL("UPDATE moneysql SET money=100 WHERE last_known_name=\"Wruczek\"");

    // Lets execute query, but this time we want to get ResultSet
    ResultSet rs = MySQLManager.mysql.querySQL("SELECT * FROM moneysql");
    Examples with events:

    Code (Text):
    // Lets inform about working PlayerJoinEvent
    @EventHandler
    public void join(PlayerJoinEvent event) {
    if(Methods.isEventEnabled("PlayerJoinEvent")) {
    System.out.println("You enabled updating player money when player join...");
    System.out.println("Updating player " + event.getPlayer().getName() + "...");
    }
    }

    // Lets use our custom event
    @EventHandler
    public void onMoneySQLUpdate(MoneySQLUpdateEvent event) {
    // Lets make that player Wruczek will never be updated by command /moneysql update...
    if(event.getPlayer().getName().equals("Wruczek") && event.getCausedBy() == CausedBy.COMMAND) {
    event.setCancelled(true);
    }
    }

    Donate
    I'm using a lot of my personal time for this plugin. If you like this plugin please donate to support development

    [​IMG]



    Please rate 5 starts if you like this plugin, it helps me a lot. Thank you!

    Images

    1. site.jpg

Recent Reviews

  1. undersquire
    undersquire
    1/5,
    Version: 1.4
    Your link for download doesnt work, dont respond to this here so that when fixed i will change this.
  2. Blood
    Blood
    4/5,
    Version: 1.4
    Good, but sync doesn't work for warez players :/ Please repair it! Otherwise, it is very good plugin :)
  3. Xu_wznln
    Xu_wznln
    5/5,
    Version: 1.4
    Good plugin! Please work on it. And can you add support for PlayerPoints? I really need sync players' points.
  4. Ghalid
    Ghalid
    5/5,
    Version: 1.4
    Appears to work correctly. It does update the money properly in MySQL, and also shows UUID and player name:

    mysql> select * from moneysql;
    +----+----------------------------------+-----------------+-------+
    | id | UUID | last_known_name | money |
    +----+----------------------------------+-----------------+-------+
    | 1 | 1f9bd7857a104b13b6f7ec692e73c7b7 | Ghalid | 1 |
    +----+----------------------------------+-----------------+-------+
    1 row in set (0.00 sec)

    Thanks!