Guest User

Untitled

a guest
Apr 26th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package me.josh.DicePlugin;
  2.  
  3. import java.util.Random;
  4. import java.util.logging.Logger;
  5.  
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.configuration.file.FileConfiguration;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. public class DicePlugin extends JavaPlugin{
  12. protected FileConfiguration config;
  13. static final Logger log = Logger.getLogger("Minecraft");
  14.  
  15.  
  16. public void onEnable(){
  17. log.info("Your plugin has been enabled!");
  18. config = getConfig();
  19. this.getConfig().set("dice.running", true);
  20. this.getConfig().set("dice.enabled", "yes");
  21. this.getConfig().set("dice.range", 6);
  22.  
  23.  
  24. }
  25. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  26. if(cmd.getName().equalsIgnoreCase("roll")){ // If the player typed /basic then do the following...
  27. sender.sendMessage(number + "");
  28. return true;
  29. } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned.
  30. return false;
  31. }
  32.  
  33. public void onDisable(){
  34. log.info("Dice Plugin has been disabled.");
  35. }
  36. Random dice = new Random();
  37. int number;{
  38.  
  39. for (int counter=1; counter<=10;counter++)
  40. number = 1+dice.nextInt(6);}
  41. }
Add Comment
Please, Sign In to add comment