Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PotionEffectz implements CommandExecutor {
- @Override
- public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
- if(s.equalsIgnoreCase("potioneffectz")) {
- if(!(commandSender instanceof Player)) {
- commandSender.sendMessage(ChatColor.RED + "You must be a player");
- return true;
- }
- Player p = (Player) commandSender;
- if(!p.hasPermission("pve.command")) {
- p.sendMessage(ChatColor.RED + "No permissions");
- return true;
- }
- if(strings.length != 1) {
- p.sendMessage(ChatColor.RED + "Usage: /potioneffectz <effect>");
- return true;
- }
- String type = strings[0];
- if(type == "speed") {
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1));
- p.sendMessage(ChatColor.YELLOW + "Successfully given you speed!");
- return true;
- }
- if(type == "absorb") {
- p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 200, 1));
- p.sendMessage(ChatColor.YELLOW + "Successfully given you Absorption!");
- return true;
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement