1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-16 19:44:15 +02:00

implement GodStatusChangeEvent

This commit is contained in:
Iaccidentally
2013-10-10 20:26:39 -04:00
committed by KHobbits
parent 7f059ac725
commit 36bc71b093
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;