Advertisement
maxthelinkfan

Untitled

Sep 16th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. MAIN :
  2.  
  3. package me.kyrp.MaxSpeedz;
  4.  
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.Server;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. public class Main extends JavaPlugin {
  13.  
  14. public void onDisable(){
  15. System.out.println("[MaxSpeedz] Disabled");
  16.  
  17. }
  18.  
  19. public void onEnable() {
  20. System.out.println("[MaxSpeedz] Enabled.");
  21. this.getServer().getPluginManager().registerEvents(new Events(), this); {
  22.  
  23. }
  24. }
  25.  
  26. public boolean onCommand(CommandSender sender, Command cmd, String commandText, String[] args){
  27. Player player = (Player)sender;
  28. if(sender instanceof Player){
  29. Server server = player.getServer();
  30. }
  31. if(cmd.getName().equalsIgnoreCase("bafk")){
  32. server.broadcastMessage(ChatColor.GOLD + playername + " is now AFK "); {
  33. return false;
  34.  
  35. }
  36.  
  37. }
  38.  
  39.  
  40. EVENTS:
  41. package me.kyrp.MaxSpeedz;
  42.  
  43. import org.bukkit.ChatColor;
  44. import org.bukkit.Material;
  45. import org.bukkit.Server;
  46. import org.bukkit.entity.Player;
  47. import org.bukkit.event.EventHandler;
  48. import org.bukkit.event.EventPriority;
  49. import org.bukkit.event.Listener;
  50. import org.bukkit.event.block.BlockPlaceEvent;
  51. import org.bukkit.potion.PotionEffect;
  52. import org.bukkit.potion.PotionEffectType;
  53.  
  54. public class Events implements Listener {
  55.  
  56. @EventHandler(priority = EventPriority.NORMAL)
  57. public void onBlockPlace(BlockPlaceEvent event) {
  58. Player player = event.getPlayer();
  59. String playername = player.getName();
  60. Server server = player.getServer();
  61. Material material = event.getBlock().getType();
  62. server.broadcastMessage(ChatColor.GOLD + playername + " has placed: " + material);
  63. player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 7000, 6));
  64. player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 7000, 6));
  65. player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 7000, 6));
  66. player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 7000, 6));
  67. player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 7000, 6));
  68.  
  69.  
  70.  
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement