[API] SGSuite 1.0

A very nice SG plugin with its own API!

  1. alzdoesmc
    Tested Minecraft Versions:
    • 1.8
    This project has been abandoned. No support will be given.
    Introduction

    A lot of people have been in the search for an amazing SurvivalGames plugin for more than a year. There have been many iterations of SurvivalGames being uploaded over the years that it's become overbearingly difficult to choose the right system for your server. While it may be hard to choose a good plugin for your average hybrid server, it's become increasingly difficult for BungeeCord networks trying to find a good plugin that will suite their needs. Which is why I made SGSuite: A BungeeCord-Enabled High-performance SurvivalGames plugin. Throughout the past week, I've been working on this almost non-stop, with loads of features from my own personal network (optimusmc.org). After final touches on the first release, I've decided to finally get around to uploading it.

    Features
    Here are some of the pre-existing features:
    1. Arena downloading (as highly requested and sought after in this poll)
    2. Fancy scoreboards (very little to no flicker with up to 48 characters per line and 32 characters as the objective)
    3. 1.8 Spectating (still in beta, this is still being worked out)
    4. Completely customizable chests with support for up to 5 levels, unlimited items, custom item names and lore, frequency rate, and specific amount of items per chest.
    5. Arena voting
    6. Automatic arena handling; whatever arenas you put in the MySQL table will work on all servers
    7. Virtually unlimited language customization
    8. Ability to change all death messages
    9. Hide any commands (for example, if you block /ncp, it will show the unknown command message)
    10. Change commands for voting
    11. Change the commands for /plugins and /version as well as their output
    12. Change the unknown command message without spigot.yml
    13. Notifies staff if there is an update available!
    14. No need for Multiverse; this plugin can run standalone (unless you need a permissions plugin)
    15. DeathMatch 1.8 WorldBorder (as of v1.0.0-r5)

    Commands/Permissions
    /sg - Check version info including a nice little message - No permission
    /help - view a list of all commands for SurvivalGames - No permission
    /pl - customized plugins list - No permission
    /version - customized version output - No permission
    /vote - Vote for an arena - No permission
    /sgreload - Reload configurations - sgsuite.reload
    /setlobby - Set the main lobby for voting - sgsuite.setlobby
    /forcemap - start the game with a specific arena - sgsuite.forcemap
    /deathmatch - start the deathmatch immediately - sgsuite.deathmatch
    /refill - Refill the chests (if you have SuiteChests) - sgsuite.restock
    /time - Set the time left in a certain state - sgsuite.time
    For all commands: sgsuite.*

    Screenshots
    [​IMG]
    [​IMG]
    I will add more screenshots as more features are added.

    Prerequisites
    Before you buy, make sure you have knowledge of the following and have access to the following:
    • MySQL
    • (Optional) PhpMyAdmin
    • Spigot 1.8.8 server (v1_8_R3)
    • (Optional) BungeeCord instance
    • Access to a web-host for arena downloading, whether it be an Apache/Nginx server or a Dropbox account.
    Installation
    Installing may seem difficult at first, but it's really not. Follow these instructions thoroughly.
    1. Create a database if you haven't already.
    2. Open the ZIP file and extract all files you want into your plugins folder.
      1. SGSuite-Core is required to have SurvivalGames on your server.
      2. SGSuite-Chests should be installed if you would like access to an automatic chest system.
      3. SGSuite-Scoreboards should be installed if you would like scoreboards on the right side of your screen.

        Everything in the ZIP File except SGSuite-Core.jar should be an Add-On and cannot run without SGSuite-Core installed.
    3. Run your server once. It should automatically halt itself if you haven't already set-up the configuration. If your server automatically restarts, prevent it from starting again.
    4. Go to plugins/SGSuite/config.yml and open it in a familiar text editor such as Notepad++. Change the following to the database information:
      1. [​IMG]
        If you don't know what port does, don't mess with it!
    5. Save the file. Start your server, and then halt it again. Edit the rest of the config.yml to your liking. There will be a video on the configuration very soon! If you have any addons you want to modify, change their settings now! Repeat steps 2-5 for every survivalgames server you have.
    6. Afterwards, head into PhpMyAdmin and navigate to the "sg_arenas" table in the database you created in step 1. Click insert and fill out the data as shown in the picture below.
      [​IMG]
    7. Click go and repeat this step for each arena you want to add.
    8. Save any configuration files you have opened and start your server!
    Arena Structure
    The download file used must be a zip file, not a jar or RAR file. The structure must also be like this:

    CORRECT STRUCTURE:
    -\ data
    \ region
    \ level.dat


    INCORRECT STRUCTURE:
    -\ myarena
    -\ data
    -\ region
    -\ level.dat


    Each arena must have at least 2 signs. 1 sign for the center, and 1 other for a tribute spawn. First, in a singleplayer world with the arena you will be uploading, go to the spawn of the world. At the center, use /setworldspawn (if you get a no permission error, make sure Open To LAN is enabled and cheats are on). Then, at the center, place a sign with these lines:

    Code (Text):

    Line1: {center}
    Line2:
    Line3:
    Line4:
     
    Then at each spawn, place a sign with these lines:

    Code (Text):

    Line1: {tribute}
    Line2:
    Line3:
    Line4:
     
    Make sure that you used /setworldspawn within 50 blocks (on the X/Z axis) and 10 blocks (on the Y axis) of each sign. Afterwards, add the files to an archive, upload to something like Dropbox or your own Apache site, get the link, and add it to the database.

    Configuration

    Here is the default config.yml in plugins/SGSuite/config.yml.

    Code (Text):

    mysql:
      host: lol
      port: 3306
      database: thenovamc_open_sgsuite_video
      username: lol
      password: lol
    bungee:
      enabled: false
      hub-server: hub
    game:
      lobby: world,0,0,0,0,0
      min-players: 6
      mobs: false
      grace-period:
        enabled: false
        time: 30
      deathmatch-players: 4
      times:
        recruiting-time: 45
        preparing-time: 30
        live-time: 1200
        deathmatch-countdown-time: 60
        deathmatch-time: 300
        finish-time: 10
      tnt:
        fuse-ticks: 40
      max-arenas: 5
      blocks:
        breakable:
        - 18
        - 30
        - 31
        - 32
        - 37
        - 38
        - 39
        - 40
        - 59
        - 92
        - 103
        - 106
        - 141
        - 142
        - 161
        - 175
        placable:
        - 18
        - 161
        - 103
        - 37
        - 38
        - 39
        - 40
        - 30
        - 31
        - 32
        not-interactable:
        - 61
        - 62
        - 84
        - 158
        - 145
        - 138
        - 117
    messages:
      prefix: '&8[&6SG&8] &f'
      not-right-now: '&cYou can''t do that right now!'
      not-enough-players: '&cThere aren''t enough players to start the game.'
      minimum-player-count-met: '&aThere are enough players to start the game! Starting
      soon...'
      load-successful: '&aThe server has been loaded succesfully.'
      next-arena: '&a&lVoting ended! &aThe next arena is &l%arena%&a by &l%creator%&a!'
      join: '&2&lJoin &a%player%'
      kick: '&6&lKick &e%player%'
      quit: '&4&lQuit &c%player%'
      not-a-number: '&cThat''s not a number!'
      arena-non-existent: '&cThat arena is non-existent!'
      grace-period: '&cThere is a %grace%-second grace period!'
      grace-period-ended: The grace period has &cended&f!
      game-already-starting: '&cThe game is already starting!'
      now-spectating: '&fYou are now &6spectating&f the game.'
      recruiting-countdown: '&fVoting ends in &6%time%&f.'
      prepare-countdown: '&fThe game starts in &6%time%&f.'
      deathmatch-start-countdown: '&fArena deathmatch starts in &6%time%&f.'
      deathmatch-countdown: '&fGame ends in &6%time%&f.'
      end-countdown: '&fServer restarting in &6%time%&f.'
      server-restarting: '&cThe server is restarting. &6%winner% &cwas the winner!'
      good-luck: '&aThe game has begun! &bGood luck!'
      vote:
        header: '&a&lVote now! &bUse /%cmd% <ID> to cast your vote!'
        arena: '&a&l%index%&f. &b%arena% &fby &b%creator% &7| &6%votes% &7Vote(s)'
        player-voted: '&b%player% &avoted for &b%arena%&a!'
      voting-closed: '&cThe voting is currently closed.'
      already-voted: '&cYou have already voted!'
      deathmatch-starting: '&c&lThe deathmatch countdown has been started.'
      deathmatch-started: '&c&lThe deathmatch has been started. Good luck!'
      death:
        by-player: '&a%player%&f was slain by &b%killer%&f with &e%item%&f.'
        by-player-with-projectile: '&a%player%&f was shot by &b%killer%&f from &7%distance%&f
      block(s) away.'
        by-mob-with-projectile: '&a%player%&f was shot by a(n) &b%creature%&f from &7%distance%&f
      block(s) away.'
        by-projectile-generic: '&a%player%&f was shot.'
        by-block-explosion: '&a%player%&f was sent flying into the air by a nearby explosion.'
        by-contact: '&a%player%&f learned not to hug cactuses.'
        by-drowning: '&a%player%&f forgot how to swim.'
        by-fall: '&a%player%&f slipped on a banana and plummeted to the ground from a tower.'
        by-falling-block: '&fA block fell on &a%player%&f.'
        by-fire: '&a%player%&f became a piece of fried chicken.'
        by-lava: '&a%player%&f took a bath in some lava.'
        by-lightning: '&a%player%&f was unlucky and got struck by lightning.'
        by-magic: '&a%player%&f took a hit from a potion.'
        by-starvation: '&a%player%&f forgot this was the hunger games.'
        by-suffocation: '&a%player%&f was suffocated by a block.'
        by-suicide: '&a%player%&f took their life.'
        by-thorns: '&a%player%&f was killed by their opponent''s thorns ability.'
        by-void: '&a%player%&f fell into an endless abyss.'
        by-wither-effect: '&a%player%&f withered away.'
        generic: '&a%player%&f died.'
      motd:
      - '%prefix%Welcome to the SurvivalGames, &a%player%&f!'
      status:
      - Arena deathmatch begins in &b%time%&f.
      - There are &a%tributes% tributes&f left in the games.
      - '&c%specs% spectators&f are watching the games.'
      - You are playing on &d%arena%&f by &e%arenacreator%&f.
    commands:
      unknown-command:
        message: '%prefix%&fThat command could not be found. Use /help for a list of commands.'
        sound: NOTE_BASS
      no-permission:
        message: '%prefix%&cYou don''t have permission to do that!'
        sound: NOTE_BASS
      commands:
        help:
          commands:
          - help
          - '?'
        version:
          commands:
          - ver
          - version
          - about
          - icanhasbukkit
          output: 'This server is running SGBukkit version null (MC: 1.8.8) (Implementing API version null)'
        plugins:
          commands:
          - pl
          - plugins
          output: 'Plugins (1): &aSGSuite'
        vote:
          commands:
          - vote
          - v
      hidden-commands:
      - ncp
      - nocheatplus
     
    Planned Features
    • PreDeathmatch state
    • Stats add-on
    • Sponsoring
    • Shops
    • Kits
    Support
    I am a very nice person, so I am going to be accepting support via Spigot Conversations and forum posts! However, any negative reviews that are submitted talking about how the plugin is buggy or is not working because of something on your end will not be taken into consideration. If you have any issues installing the plugin, let me know! I'd be more than willing to help you solve your issue.

    API
    The API is very detailed. To create a plugin using our api, you must "hook" into our system. Here's an exmaple.

    Code (Java):


    public class MyPlugin extends JavaPlugin {

      private static MyAddon addon;

      @Override
      public void onEnable(){
      // Get the hook
      SuiteHook hook = SuitePlugin.getHook();
      // Initialize the addon for later use
      addon = new MyAddon(this, hook);
      // Register the addon
      hook.registerAddon(addon);
      }

      public static class MyAddon implements SuiteAddon, Listener {

      private MyPlugin plugin;
      private SuiteHook hook;

      public MyAddon(MyPlugin plugin, SuiteHook hook){
      this.plugin = plugin;
      this.hook = hook;
      }

      public MyPlugin getProvidingPlugin(){
      return plugin;
      }

      public SuiteHook getHook(){
      return hook;
      }

      @Override // Basically the onEnable, but for add-ons. This is called after SGSuite has been enabled.
      public void setup(){
      plugin.getServer().getPluginManager().registerEvents(this, plugin);
      System.out.println("Hello, world!");
      }

      @Override // This is called as the server is shutting down or as the addon is being disabled.
      publicvoid close(){
      System.out.println("Goodbye!");
      }

      @EventHandler
      public void update(SuiteScheduleEvent event){
      if(event.getScheduleType() != UpdateType.SECOND){ // Once every second...
      return;
      }

      if(hook.getState() != GameState.LIVE){ // While the game is in session...
      return;
      }

      for(Player p : Bukkit.getOnlinePlayers()){ // we'll loop through all the players and...
      p.getWorld().strikeLightningEffect(p.getLocation()); // strike lightning at their feet.
      }
      }

      @Override // What's your name?
      public String getAuthor(){
      return "bigLEEThacker";
      }

      @Override // We need to specify the JavaPlugin instance.
      public JavaPlugin getPlugin() {
      return plugin;
      }

      @Override // get the version number of your addon
      public String getVersion() {
      return"0.69.0";
      }

      @Override // get the name of your addon
      public String getName() {
      return"MySGSuiteAddon";
      }
      }

      public static MyAddon getMyAddon(){
      return addon;
      }

      public static SuiteAddon getAddon(){
      return addon;
      }
    }