Skip to content

Instantly share code, notes, and snippets.

@Notoh
Last active May 7, 2017 15:18
Show Gist options
  • Save Notoh/40bd666309b0439e8c251dd3aac41d09 to your computer and use it in GitHub Desktop.
Save Notoh/40bd666309b0439e8c251dd3aac41d09 to your computer and use it in GitHub Desktop.
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