Last active
May 7, 2017 15:18
-
-
Save Notoh/40bd666309b0439e8c251dd3aac41d09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.notoh.BlindnessTest; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandExecutor; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import org.bukkit.potion.PotionEffect; | |
import org.bukkit.potion.PotionEffectType; | |
/** | |
* @author Notoh | |
*/ | |
public class BlindnessTest extends JavaPlugin { | |
public void onEnable(){ | |
getCommand("blindme").setExecutor((new CommandExecutor() { | |
@Override | |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | |
if(sender instanceof Player) { | |
Player player = (Player) sender; | |
PotionEffect potionEffect = new PotionEffect(PotionEffectType.BLINDNESS,10,1); | |
player.addPotionEffect(potionEffect); | |
while(potionEffect.getDuration() != 0) { | |
//wait | |
} | |
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,10,1)); | |
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,10,1)); | |
return true; | |
} else { | |
return false; | |
} | |
} | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment