Guest User

Untitled

a guest
May 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. package me.Fire_Head431.MyPackage;
  2.  
  3. import java.io.File;
  4. import java.util.ArrayList;
  5. import java.util.HashMap;
  6. import java.util.logging.Logger;
  7.  
  8. import org.bukkit.Server;
  9. import org.bukkit.block.Block;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.event.Event;
  14. import org.bukkit.plugin.PluginDescriptionFile;
  15. import org.bukkit.plugin.PluginLoader;
  16. import org.bukkit.plugin.PluginManager;
  17. import org.bukkit.plugin.java.JavaPlugin;
  18.  
  19. public class Basic extends JavaPlugin {
  20. public static Basic plugin;
  21.  
  22. public final Logger logger = Logger.getLogger("Minecraft");
  23. public final HashMap<Player, ArrayList<Block>> basicUsers = new HashMap<Player, ArrayList<Block>>();
  24. //Creating HashMap.
  25. private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. @Override
  33. public void onDisable(){
  34.  
  35. this.logger.info("TNTNotify has been Disabled!");
  36.  
  37.  
  38. }
  39.  
  40. @Override
  41. public void onEnable(){
  42. PluginManager pm = getServer().getPluginManager();
  43.  
  44. pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Event.Priority.Normal, this);
  45. PluginDescriptionFile pdfFile = this.getDescription();
  46. this.logger.info( pdfFile.getName() + " version " + pdfFile.getVersion() + "is enabled!" );
  47. }
  48.  
  49. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  50. String commandLabel, String[] args) {
  51. if (commandLabel.equalsIgnoreCase("gun")
  52. || commandLabel.equalsIgnoreCase("g"))
  53. toggleVision((Player) sender);
  54. }
  55. return false;
  56. }
  57.  
  58.  
  59. public boolean isDebugging(final Player player){
  60. if (debugees.containsKey(player)){
  61. return debugees.get(player);
  62. }else{
  63. return false;
  64.  
  65. }
  66. }
  67.  
  68. public void setDebugging(final Player player, final boolean value) {
  69. debugees.put(player, value);
  70. }
  71. //the method enabled which checks to see the player is in the hashmap
  72.  
  73. public boolean enabled(Player player) {
  74. return this.basicUsers.containsKey(player);
  75. }
  76. public void toggleVision(Player player){
  77. if (enabled(player)) {
  78. this.basicUsers.remove(player);
  79. player.sendMessage("TNTNotify disabled");
  80. } else {
  81. this.basicUsers.put(player, null);
  82. player.sendMessage("TNTNotify enabled");
  83. }
  84.  
  85. }
  86. }
Add Comment
Please, Sign In to add comment