You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.6 KiB
87 lines
3.6 KiB
package net.mcbat.LightningEvent.Listeners;
|
|
|
|
import net.mcbat.LightningEvent.LightningEvent;
|
|
|
|
import org.bukkit.event.Event;
|
|
import org.bukkit.event.Event.Priority;
|
|
import org.bukkit.event.player.PlayerBedEnterEvent;
|
|
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
|
import org.bukkit.event.player.PlayerChatEvent;
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
|
import org.bukkit.event.player.PlayerKickEvent;
|
|
import org.bukkit.event.player.PlayerListener;
|
|
import org.bukkit.event.player.PlayerMoveEvent;
|
|
import org.bukkit.event.player.PlayerQuitEvent;
|
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
import org.bukkit.plugin.PluginManager;
|
|
|
|
public class LightningEventPlayerListener extends PlayerListener {
|
|
private final LightningEvent _plugin;
|
|
|
|
public LightningEventPlayerListener(LightningEvent plugin) {
|
|
_plugin = plugin;
|
|
}
|
|
|
|
public void registerEvents() {
|
|
PluginManager pm = _plugin.getServer().getPluginManager();
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_BED_ENTER, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_BED_LEAVE, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_CHAT, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_JOIN, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_KICK, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_QUIT, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_MOVE, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_TELEPORT, this, Priority.Monitor, _plugin);
|
|
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this, Priority.Monitor, _plugin);
|
|
}
|
|
|
|
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.bed.enter"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.bed.leave"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerChat(PlayerChatEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.chat"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.join"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerKick(PlayerKickEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.kick"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.quit"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerMove(PlayerMoveEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.move"))
|
|
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
|
|
}
|
|
|
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.teleport.from"))
|
|
_plugin.castFakeLightningAtLocation(event.getFrom());
|
|
|
|
if (event.getPlayer().hasPermission("lightningevent.events.teleport.to"))
|
|
_plugin.castFakeLightningAtLocation(event.getTo());
|
|
}
|
|
|
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
|
if (event.getPlayer().hasPermission("lightningevent.events.respawn"))
|
|
_plugin.castFakeLightningAtLocation(event.getRespawnLocation());
|
|
}
|
|
}
|
|
|