Created
July 27, 2014 02:56
-
-
Save brianherman/2c1285d15981ad734ec6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 org.discordpvp; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import org.bukkit.potion.PotionEffect; | |
public class KitchenSink extends JavaPlugin{ | |
@Override | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
if (cmd.getName().equalsIgnoreCase("removePotion")) { | |
if (!(sender instanceof Player)) { | |
sender.sendMessage("Only players can use this command!"); | |
return true; | |
} | |
// After checking to make sure that the sender is a Player, we can safely case it to one. | |
Player s = (Player) sender; | |
for (PotionEffect effect : s.getActivePotionEffects()) | |
s.removePotionEffect(effect.getType()); | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment