Sueta

ServerAge

1.0

A placeholder add-on used to display the age of a server.

·Plugin

ServerAge

A placeholder add-on used to display the age of a server, supporting both PlaceholderAPI and MVdWPlaceholderAPI . This plugin simply provides a placeholder which can display the time difference between the current and a given timestamp, meaning it can be used for different purposes too.

Guide
Use the placeholders shown below depending on your chosen placeholder plugin to retrieve the age of a server based on the given wildcard timestamp. The '#' below should be replaced with the server's start date in a UNIX timestamp format, which can be retrieved here by entering a date, selecting 'Convert' and then copying the resulting timestamp into your placeholder, most probably within a scoreboard or menu configuration. The plugin supports both past and future timestamps and will calculate the difference accordingly.

Placeholders:

  • PlaceholderAPI: %serverage_#%
  • MVdWPlaceholderAPI: {serverage_#}

Configuration
You are not required to modify the configuration unless you use both PlaceholderAPI and MVdWPlaceholderAPI on your server. If this is the case, you should set the 'default-provider' option to the plugin you wish to use for ServerAge placeholders.

# ServerAge by Shockzeh  

 # This is only required if you run both PlaceholderAPI and MvDWPlaceholderAPI  
 # on your server. This will prevent the plugin from hooking into the incorrect  
 # placeholder plugin.  
 # Supported providers are: 'placeholderapi' or 'mvdwplaceholderapi'   
default-provider   :  placeholderapi

API
I f you wish to supply your own result to the placeholder, you can create a Pla ceholderSupplier implementation and then replace the default supplier with your own. An example of where this could be used is if you wish to use your own time formatting.

if   (  Bukkit.  getPluginManager   (   )  .  isPluginEnabled   (   "ServerAge"   )   )   {   // Make sure plugin is enabled  
     ServerAgePlugin plugin  =   (  ServerAgePlugin  )  Bukkit.  getPluginManager   (   )  .  getPlugin   (   "ServerAge"   )   ;   // Get instance  
     plugin.  setSupplier   (  argument  ->   {   // Replace the supplier (PlaceholderSupplier is a functional interface)  
       long  time  =    Long   .  parseLong   (  argument  )   ;   // A raw long is expected, but should be checked  
       return    String   .  valueOf   (  time  )   ;   // Parse time how you like and return result  
   }   )   ;  
 }

Terms and Conditions

  • You may not upload, share or distribute this resource elsewhere unless I given written permission. If this plugin is requested, please link this resource page.
  • You will private message me for support, do not use the reviews section.
  • I am not required to add a suggestion, although I do take every one into consideration.

Similar projects

Plugin →