[INACTIVE][CHAT, DEV] OffLine v1.0 - Transparent offline messaging for plugins [953]

Discussion in 'Inactive/Unsupported Plugins' started by Protected, Apr 10, 2011.

  1. OffLine - Transparent offline messaging for plugins
    Version 1.0 - Download JAR

    You only need this if you're using another plugin that relies on it, or if you're a plugin developer.

    This plugin provides a common interface for delivering messages to players who may be either online or offline. If your plugin stores player names for any purpose and you want to let them know something happened, but can't be sure whether they're online or not, you can message them through OffLine. Examples of plugins that can use this are bank plugins, lock/alarm plugins, mail plugins, region plugins, etc.

    I created OffLine for my own use; I'll be happy to consider suggestions from other developers as long as they aren't contrary to my own needs. Storage is currently achieved using direct file writing (every 5 minutes and on disable), but I hope to move it to Bukkit's persistence when it's ready.

    • Easy to use
    • Configurable message templates and expiration time for stored messages
    • Alerts players on join when they have unread messages
    • Messages are tagged with a plugin name
    • Console command for testing and direct use
    Installation (open)


    If you need to use OffLine in your server, just put the jar in the plugins directory and reload/restart.

    Commands (open)


    To read his messages, a player should use /?new in-game. This will display the messages he received when he was offline, up to 10, which he didn't read yet, and simultaneously delete them. If the player has more than 10 messages, he can use /?new again as many times as necessary to read them all.

    A server administrator can send a message using the OffLine interface from the console using ?msg PLAYERNAME MESSAGE . OffLine messages are sent immediately to the player if he's online, and stored for later delivery if he's not.

    Configuration (open)


    You can add configuration options to plugins/OffLine/config.yml . This is NOT necessary if you just want to use the defaults. The default configuration is:

    max-storage-time : 1209600  #This value is in seconds (default two weeks)
        msg: '§e[%plugin%§f %ago%§e]§f %msg%'
        imsg: '§e[%plugin%]§f %msg%'
        join: '§dYou have §f%count%§d offline message(s).§f Use §e/?new§f to read them.'
        head: '-- Offline messages --'
        none: 'You don't have any offline messages.'
        next: 'You have another §f%count%§f message(s). Use §e/?new§f to continue.'
    msg and imsg are the templates for message delivery, when delivered (respectively) offline and online. In addition to the variables displayed for those, you can also use %ts%, %player% and {DATE}, where DATE is a date format string.

    Plugin integration (DEVELOPERS ONLY) (open)

    Plugin integration

    First, make sure you add OffLine.jar to your build path. Then create an OffLine variable to store a reference to OffLine.

    import net.myshelter.minecraft.OffLine;
    public class MyPlugin extends JavaPlugin {
      OffLine offline = null;
    To fetch OffLine safely, either use a plugin load server event or a scheduler task (check the Bukkit documentation for more information). Either of these will help you make sure the plugin is available when you try to fetch it. Then get it normally from the plugin manager:

    offline = (OffLine)getServer().getPluginManager().getPlugin("OffLine");
    You should trigger this procedure from your onEnable method, so the reference will be available immediately.

    You can now send messages to a player using offline.msg. I recommend adding this method to your plugin so you don't have to add the plugin name every time:

    public boolean msg(String player, String message) {
         if (offline == null) return false;
         return offline.msg(getDescription().getName(), player, message);
    Here's a very simple example of a command that allows a player to send an empty OffLine message to any other player:

    public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)  {
      if (command.getName().equalsIgnoreCase("poke") && args.length > 0) {
        msg(args[0], "");
        sender.sendMessage("Poked " + args[0]);
        return true;
      return false;
    You shouldn't actually allow players to send unrestricted OffLine messages, though. Add your own logic on top of it!

    Plugins using OffLine

    Memo (example plugin, source code included)

    Bugs? Let me know.

    Moderator who moved this to the submissions forum fucked up the formatting ~_~ These things take quite a while you know?

    EDIT: Fixed now.

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


    I don't know if I moved this or not, but I do move most of them.
    I always edit formatting to make it look like the original plugin template by evilseph. I never change download links and I do look at the result so if there were any formatting characters badly placed, it must have been some error.

    I AM however editing it again, since changelog and download placement is not according to a templeate.

    And when there is Fill plugin release system you will have to conform with it's formatting not yours.
  3. Are you on IRC? Maybe we should talk on IRC.
  4. Offline


    Awesome plugin! Can't wait to see this working with other plugins ;)
    Nice work! +Like
  5. Not sure if you'll see them here, since apparently this forum's moderators like to bully random people and mess up the work of others, which doesn't really encourage me to release my plugins outside IRC.
  6. Offline


    Is it my fault that you do not read the guidelines and format according to them? You made the extra work for nothing only because you wanted to do it differently, not because anybody made you do it ;)
  7. Plague: There are practically no deviations from the guidelines up there, structurally speaking. I don't see why you need to be so nitpicky about it ;) And I was mostly annoyed because you put bold tags all over my source code snippets (probably accidentally but still) and deleted or resized my titles, not because you moved the changelog or download link :p This is NOT fill yet, so as long as we CAN style the post a little I don't see why not. Anyway I released a plugin for this days ago, it's AuctionHouse.

    If you ever need me to change my top post and it's not anything tiny just ask and I'll do it, or if you need to do it yourself please be careful with the bolds and sizes.
  8. Offline


    Considered inactive.
  9. Offline


    Hi! I have a problem.
    When I using custom configuration (creating "config.yml" in plugins/OffLine) and filling it like in your example I get this:
    10:31:40 [SEVERE] Could not load 'plugins\OffLine.jar' in folder 'plugins':
    unacceptable character #FFFD special characters are not allowed
    in "<reader>", position 94
            at org.yaml.snakeyaml.reader.StreamReader.checkPrintable(StreamReader.java:68)
            at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:159)
            at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:117)
            at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:106)
            at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:964)
            at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:237)
            at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:183)
            at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:200)
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:163)
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:104)
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:124)
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:264)
            at org.bukkit.util.config.Configuration.load(Configuration.java:74)
            at org.bukkit.plugin.java.JavaPlugin.initialize(JavaPlugin.java:156)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:174)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:194)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:117)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:103)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:232)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:219)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:146)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:285)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    CB 818
  10. Where are you from?
  11. Offline


    :confused: Hm, from Russia. I don't understand how it relates to my problem. Or you about my illiteracy?
  12. Offline


    Also caught this error :) And fixed it
    Config should be in Unicode, and quotas in message texts should be doubled.
    Fixed default config flie
  13. Offline


    BASED, thanks, now it works!
    Protected, sorry, now I understand what you mean encoding. :) Thank you for great plugin. ;)

Share This Page