implement GodStatusChangeEvent

This commit is contained in:
Iaccidentally 2013-10-10 20:26:39 -04:00 committed by KHobbits
parent cc34c02623
commit 375caa6f9e
3 changed files with 24 additions and 18 deletions

View file

@ -2,8 +2,10 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import net.ess3.api.events.GodStatusChangeEvent;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandgod extends EssentialsToggleCommand
@ -46,6 +48,11 @@ public class Commandgod extends EssentialsToggleCommand
@Override
void togglePlayer(CommandSender sender, User user, Boolean enabled)
{
final User controller = sender instanceof Player ? ess.getUser(sender) : null;
final GodStatusChangeEvent godEvent = new GodStatusChangeEvent(controller, user, enabled);
ess.getServer().getPluginManager().callEvent(godEvent);
if (!godEvent.isCancelled())
{
if (enabled == null)
{
@ -67,3 +74,4 @@ public class Commandgod extends EssentialsToggleCommand
}
}
}
}

View file

@ -4,7 +4,6 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import java.util.Locale;
import net.ess3.api.events.LocalChatSpyEvent;
import net.ess3.api.events.NickChangeEvent;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;

View file

@ -1,6 +1,5 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import java.util.List;
import org.bukkit.Server;