SpeedRun Minigame icon

SpeedRun Minigame -----

NEW: Racing | MySQL/SQLite | Bungee/MultiArena | Achievements | Leaderboards | API | MCJukebox/NBS



API Update
  • Added CANCELLED message for starting countdown.
  • API & System changes
    • forwardData
      • You can now forward data to servers using the API, this method will able you to send rewards or any data you want between servers..
      • Subchannel is named SpeedRun.
      • Key is any value you want, e.g you can use "winner" to identify that the data is from the winner.
      • I recommend you adding a delay to send data.
    • If you don't like how it works, you can do your own method using the Game Events on API.
Sending data
Code (Text):
@EventHandler
    public void onGameEnd(GameEndEvent e) {
        GamePlayer winner = e.getPlayerFromPosition(1);
        if(SpeedRun.getAPI().forwardPlayerReward(winner.getP(), "ALL", "winner1")) {
            Bukkit.getLogger().info("Data sent.");
        }
    }
Receiving data
Code (Text):
@Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equals("BungeeCord")) {
            return;
        }
     
        try{
          DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
            String subchannel = in.readUTF();
            if (subchannel.equals("SpeedRun")) {
                short len = in.readShort();
                byte[] data = new byte[len];
                in.readFully(data);
                String s = new String(data);
                //player:key/server
                Bukkit.getLogger().info(s);
           
                String playerName = StringUtils.substringBefore(s, ":");
                String key = StringUtils.substringBefore(s, "/").substring(playerName.length()+1);      
                String server =  StringUtils.substringAfter(s, "/");
           
                Bukkit.getLogger().info("Server: " + server);
                Bukkit.getLogger().info("Key: " + key);
                Bukkit.getLogger().info("Player: " + playerName);
            }
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
----------, Oct 3, 2017
Resource Information
Author:
----------
Total Downloads: 186
First Release: Aug 17, 2016
Last Update: Jan 19, 2025
Category: ---------------
All-Time Rating:
14 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings