mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-13 02:51:37 +01:00
Add 1.6 effect clear functionality. Fixes BUKKIT-4473
By: h31ix <zero_gravity@outlook.com>
This commit is contained in:
parent
c0822889d0
commit
804827463e
@ -16,7 +16,7 @@ public class EffectCommand extends VanillaCommand {
|
|||||||
public EffectCommand() {
|
public EffectCommand() {
|
||||||
super("effect");
|
super("effect");
|
||||||
this.description = "Adds/Removes effects on players";
|
this.description = "Adds/Removes effects on players";
|
||||||
this.usageMessage = "/effect <player> <effect> [seconds] [amplifier]";
|
this.usageMessage = "/effect <player> <effect|clear> [seconds] [amplifier]";
|
||||||
this.setPermission("bukkit.command.effect");
|
this.setPermission("bukkit.command.effect");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +50,14 @@ public class EffectCommand extends VanillaCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("clear".equalsIgnoreCase(args[1])) {
|
||||||
|
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
|
player.removePotionEffect(effect.getType());
|
||||||
|
}
|
||||||
|
sender.sendMessage(String.format("Took all effects from %s", args[0]));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
PotionEffectType effect = PotionEffectType.getByName(args[1]);
|
PotionEffectType effect = PotionEffectType.getByName(args[1]);
|
||||||
|
|
||||||
if (effect == null) {
|
if (effect == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user