Advertisement
EliteByte

MainClass

Mar 22nd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.48 KB | None | 0 0
  1. package tech.elitebyte.helloplugin;
  2.  
  3. import com.google.inject.Inject;
  4. import org.spongepowered.api.Game;
  5. import org.spongepowered.api.Sponge;
  6. import org.spongepowered.api.command.spec.CommandSpec;
  7. import org.spongepowered.api.event.Listener;
  8. import org.spongepowered.api.event.game.state.GameStartedServerEvent;
  9. import org.spongepowered.api.plugin.Plugin;
  10. import org.spongepowered.api.text.Text;
  11. import tech.elitebyte.helloplugin.commands.HelloWorldCommand;
  12. import tech.elitebyte.helloplugin.commands.SmiteCommand;
  13.  
  14. @Plugin(id = "exampleplugin", name = "Example Plugin",
  15.         version = "1.0", description = "Temporary description of plugin")
  16. public class HelloPlugin {
  17.  
  18.     @Inject
  19.     public Game game;
  20.  
  21.     @Listener
  22.     public void onServerStart(GameStartedServerEvent event) {
  23.         // Hey! The server has started!
  24.         // Try instantiating your logger in here.
  25.         // (There's a guide for that)
  26.  
  27.         CommandSpec helloworldCommand = CommandSpec.builder()
  28.                 .description(Text.of("Hello World Command!"))
  29.                 .executor(new HelloWorldCommand(game))
  30.                 .build();
  31.  
  32.         CommandSpec smiteCommand = CommandSpec.builder()
  33.                 .description(Text.of("Smite Command"))
  34.                 .executor(new SmiteCommand(game))
  35.                 .build();
  36.  
  37.         Sponge.getCommandManager().register(this, smiteCommand, "smite");
  38.         Sponge.getCommandManager().register(this, helloworldCommand, "helloworld");
  39.  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement