Sueta

[1.8-1.13] CorePoints - A simple alternative currency plugin

1.0.5

A simple alternative currency plugin built for developers!

·Plugin


CorePoints | A simple alternative currency plugin!


What is CorePoints?

CorePoints is a simple plugin that provides an alternative currency, known as points, for plugins to use. This plugin is for servers who want to use a separate currency for specific transactions, such as buying rare items or gambling!

How do I use CorePoints?
You must first download CoreData , my personalized data solution available to the public, and place it in your plugins folder. Next, download CorePoints and place it in your plugins folder. Finally, start your server and you're good to go!

What are the benefits of CorePoints?
On the front end, CorePoints provides a variety of different commands designed to allow you to control every aspect of the alternative currency. Commands allow you to manage the balance of players and even allow players to send their points to other players.

On the back end, CorePoints has a very simple to use developer API to allow quick integration into your projects. This API is built with CoreData to provide you with the fastest and most efficient methods of reading and writing data.

What are the commands and permissions?

/points (corepoints.points) 
/points <player> (corepoints.points.other) 

/points reload (corepoints.reload) 
/points help (NO PERMISSION) 
/points reset <player> (corepoints.reset) 

/points pay <player> <amount> (corepoints.pay) 
/points add <player> <amount> (corepoints.add) 
/points take <player> <amount> (corepoints.take) 
/points set <player> <amount> (corepoints.set)

How do I configure messages?
The plugin has a built-in messages.yml file that will control all messages in the plugin. It provides complete control over all messages that are displayed in the plugin.

Messages.yml
# CorePoints | messages.yml  
 #  
 # This config file manages all of the messages for the plugin.  
 # Some messages have placeholders.  
 # Be sure to read the config before changing the lines.  

 # Error Messages   
error-nopermission   :   "&e[Points] &7You do not have permission to use this command."   
error-playeronly   :   "&e[Points] &7This is a player only command."   
error-error_playernotfound   :   "&e[Points] &7Player not found."   
error-playernopoints   :   "&e[Points] &7You do not have any points."   
error-targetnopoints   :   "&e[Points] &7Your target does not have any points."   
error-notnumber   :   "&e[Points] &7This command contains an invalid number."   
error-notenoughpoints   :   "&e[Points] &7You do not have enough points."  

 # `/points help` messages   
success-help   : 
 -  "&e--[ Points Help Menu ]--"  
-  "&7-> &e/points &7- Shows your balance"  
-  "&7-> &e/points <player> &7- Shows a player's balance"  
-  "&7-> &e/points reload &7- Reloads the messages"  
-  "&7-> &e/points help &7- Shows this help menu"  
-  "&7-> &e/points reset <player> &7- Reset a player's points to 0"  
-  "&7-> &e/points pay <player> <amount> &7- Give a player some of your points"  
-  "&7-> &e/points add <player> <amount> &7- Add some points to a player"  
-  "&7-> &e/points remove <player> <amount> &7- Remove some points from a player"  
-  "&7-> &e/points set <player> <amount> &7- Set a player's points"  

 # `/points` and `/points <player>` message  
 # Placeholders:  
 # -> %target% - The player who's balance was found  
 # -> %balance% - The balance of the player   
success-points   :   "&e[Points] &a%target% &7currently has &a%balance% &7points."  

 # `/points reset` message  
 # Placeholders:  
 # -> %target% - The player who's balance was reset   
success-reset-sender   :   "&e[Points] &7You reset &a%target%&7's points balance."   
success-reset-target   :   "&e[Points] &7Your points balance has been reset."  

 # `/points add` message  
 # Placeholders:  
 # -> %target% - The player who's balance was added to  
 # -> %amount% - The amount added to the target's balance  
 # -> %balance% - The target's new balance   
success-add-sender   :   "&e[Points] &7You added &a%amount% &7points to &a%target%&7's balance. New balance: &a%balance%"   
success-add-target   :   "&e[Points] &7You were given &a%amount% &7points. New balance: &a%balance%"  

 # `/points remove` message  
 # Placeholders:  
 # -> %target% - The player who's balance was removed from  
 # -> %amount% - The amount removed from the target's balance  
 # -> %balance% - The target's new balance   
success-remove-sender   :   "&e[Points] &7You removed &a%amount% &7points to &a%target%&7's balance. New balance: &a%balance%"   
success-remove-target   :   "&e[Points] &a%amount% &7points were removed from your balance. New balance: &a%balance%"  

 # `/points set` message  
 # Placeholders:  
 # -> %target% - The player who's balance was removed from  
 # -> %balance% - The target's new balance   
success-set-sender   :   "&e[Points] &7You set &a%target%&7's points to &a%balance%&7."   
success-set-target   :   "&e[Points] &7Your new balance is &a%balance%&7."  

 # `/points pay` message  
 # Placeholders:  
 # -> %target% - The player who received points  
 # -> %sender% - The player who sent points  
 # -> %amount% - The amount sent from sender to target   
success-pay-sender   :   "&e[Points] &7You sent &a%amount% &7points to &a%target%&7."   
success-pay-target   :   "&e[Points] &a%sender% &7sent you &a%amount% &7points."

If you make any changes, simply type "/points reload" to load new messages!

How do I use this in my plugins?
The first step is ensuring your plugin depends on CorePoints.

depend   :   [  CorePoints  ]

The next step is creating a reference to our points handler.

if   (   !   this  .  getServer   (   )  .  getPluginManager   (   )  .  isPluginEnabled   (   "CorePoints"   )   )   {  
     this  .  getLogger   (   )  .  severe   (   "[Hook] CorePoints not found. Disabling plugin..."   )   ;  
     return   ;  
 }  
PointsHandler pointsHandler  =   (   (  com.  ethanpritchard  .  points  .  Main   )   this  .  getServer   (   )  .  getPluginManager   (   )  .  getPlugin   (   "CorePoints"   )   )  .  getPointsHandler   (   )   ;

Once you have hooked into our plugin and gathered the points handler instance, you have access to a few functions.

pointsHandler.  getPoints   (  uuid  )   ;  
pointsHandler.  setPoints   (  uuid, points  )   ;  
pointsHandler.  addPoints   (  uuid, points  )   ;  
pointsHandler.  removePoints   (  uuid, points  )   ;  

pointsHandler.  hasEnoughPoints   (  uuid, points  )   ;

Points are handled as doubles. However, commands only support integers. Please keep that in mind when using the API.

Similar projects

Plugin →