User Tools

Site Tools


plugin_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
plugin_api [2016/12/21 15:37]
127.0.0.1 external edit
plugin_api [2017/01/18 17:52]
gobrosse
Line 26: Line 26:
 package io.xol.demo;​ package io.xol.demo;​
  
 +import io.xol.chunkstories.api.GameContext;​
 import io.xol.chunkstories.api.plugin.ChunkStoriesPlugin;​ import io.xol.chunkstories.api.plugin.ChunkStoriesPlugin;​
-import io.xol.chunkstories.api.plugin.server.Command; +import io.xol.chunkstories.api.plugin.PluginInformation;​ 
-import io.xol.chunkstories.server.tech.CommandEmitter;​+import io.xol.chunkstories.api.plugin.commands.Command; 
 +import io.xol.chunkstories.api.plugin.commands.CommandEmitter
 +import io.xol.chunkstories.api.plugin.commands.CommandHandler;
  
-public class DemoPlugin extends ChunkStoriesPlugin {+public class DemoPlugin extends ChunkStoriesPlugin ​implements CommandHandler ​{ 
 + 
 + public DemoPlugin(PluginInformation pluginInformation,​ GameContext pluginExecutionContext) { 
 + super(pluginInformation,​ pluginExecutionContext);​ 
 + }
  
  DemoEventHandler handler;  DemoEventHandler handler;
Line 37: Line 44:
  public void onEnable() {  public void onEnable() {
  handler = new DemoEventHandler(this);​  handler = new DemoEventHandler(this);​
- this.getPluginsManager().registerEventListener(handler,​ this); + this.getPluginManager().registerCommandHandler("​demo",​ this); 
- System.out.println("​Enabling plugin ... "+this.getServer());+  
 + this.getPluginManager().registerEventListener(handler,​ this); 
 + System.out.println("​Enabling plugin ... ");
  }  }
  
Line 47: Line 56:
  
  @Override  @Override
- public boolean handleCommand(CommandEmitter ​e, Command ​cmd, String[] ​a, String rawText)+ public boolean handleCommand(CommandEmitter ​emitter, Command ​command, String[] ​arguments)
  {  {
- if(cmd.equals("​demo"​)) + if(command.equals("​demo"​)) 
- e.sendMessage("​Hi !");+ emitter.sendMessage("​Hi !"+arguments.length);
  return true;  return true;
  }  }
  
 } }
 +
 </​Code>​ </​Code>​
  
plugin_api.txt · Last modified: 2017/01/18 17:58 by gobrosse