Charcoal_Inc

CrouchJump[OSD] Source Code

Nov 30th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============//
  2. //MAIN CLASS   //
  3. //CrouchJump   //
  4. //=============//
  5.  
  6. package me.charcoal_inc;
  7.  
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class CrouchJump extends JavaPlugin  {
  11.    
  12.     @Override
  13.     public void onEnable() {
  14.        
  15.         getLogger().info("[CrouchJump] CrouchJump enabled! Jump away!");
  16.         new PlayerListener(this);
  17.        
  18.     }
  19.     @Override
  20.     public void onDisable() {
  21.         getLogger().info("[CrouchJump] CrouchJump disabled! No more bouncy. :(");
  22.        
  23.  }
  24. }
  25.  
  26. //===============//
  27. //PlayerListener //
  28. //===============//
  29.  
  30. package me.charcoal_inc;
  31.  
  32. import org.bukkit.entity.Player;
  33. import org.bukkit.event.EventHandler;
  34. import org.bukkit.event.Listener;
  35. import org.bukkit.event.player.PlayerToggleSneakEvent;
  36. import org.bukkit.potion.PotionEffect;
  37. import org.bukkit.potion.PotionEffectType;
  38.  
  39. public class PlayerListener implements Listener {
  40.    
  41.     public PlayerListener(CrouchJump plugin) {
  42.         plugin.getServer().getPluginManager().registerEvents(this, plugin);
  43.        
  44.     }
  45.  
  46.     @EventHandler
  47.     public void jumpPrep(PlayerToggleSneakEvent e) {
  48.    
  49.         Player player = e.getPlayer();
  50.        
  51.         if (player.isSneaking())
  52.         player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20, 2));
  53.    
  54.        
  55.     }
  56.  
  57. }
  58.  
  59. //===========//
  60. //plugin.yml //
  61. //===========//
  62.  
  63. name: CrouchJump
  64. main: me.charcoal_inc.CrouchJump
  65. version: 1.0
Advertisement
Add Comment
Please, Sign In to add comment