API/Usage

ALL OF THIS INFORMATION IS OUTDATED AND SHOULD NOT BE USED

In order to integrate sChat into your plugin, you must import tk.nekotech.sChat.SChat. Whenever your plugin is ready to tell sChat that it wants to be notified, you must do the following:

1. Create two methods in whatever class and with whatever name you want. Do the following:

  • Create a public method that takes the following arguments: (Player player, String message, String type)
  • Create a public method that takes the following arguments: (Player from, Player to, String message, String type)
  • Note that both methods must have the same name!

2. Tell SChat that you are a listener. Do the following:

  • SChat.Informer.getListener(MainClass, ClassContainingMethod, MethodName)
  • Where: MainClass is the main class of your plugin, ClassContainingMethod is the class file that contains the two methods mentioned above, and MethodName is the name of the two methods (Both methods must have the same name!).
  • Note: Do NOT set this as a variable or alias! Simply execute the code! (Ex. DO NOT do "v = SChat.Informer.getListener.....", just do "SChat.Informer.getListener.....")
  • Note: DO NOT EXPLICITLY CALL A NEW INSTANCE OF CHATLISTENER! YOU MUST USE THE ONE INVOKED BY SCHAT'S MAIN CLASS, "SChat"
  • On succession of adding your plugin to inform list, the getListener method will return int 1.
  • On error (attempting to create more than one listener, other errors), the method will return int 0.

3. Add code to your two methods to handle the information! Done!

Questions? Leave a comment!


Comments

Posts Quoted:
Reply
Clear All Quotes