mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 12:02:53 +00:00
implement GodStatusChangeEvent
This commit is contained in:
parent
cc34c02623
commit
375caa6f9e
3 changed files with 24 additions and 18 deletions
|
@ -2,8 +2,10 @@ package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import net.ess3.api.events.GodStatusChangeEvent;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class Commandgod extends EssentialsToggleCommand
|
public class Commandgod extends EssentialsToggleCommand
|
||||||
|
@ -46,6 +48,11 @@ public class Commandgod extends EssentialsToggleCommand
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void togglePlayer(CommandSender sender, User user, Boolean enabled)
|
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)
|
if (enabled == null)
|
||||||
{
|
{
|
||||||
|
@ -66,4 +73,5 @@ public class Commandgod extends EssentialsToggleCommand
|
||||||
sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", user.getDisplayName())));
|
sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", user.getDisplayName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.utils.FormatUtil;
|
import com.earth2me.essentials.utils.FormatUtil;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.ess3.api.events.LocalChatSpyEvent;
|
|
||||||
import net.ess3.api.events.NickChangeEvent;
|
import net.ess3.api.events.NickChangeEvent;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue