Browse Source

LightningEvent Version 1.01

Added cast command for casting lightning bolts. Added chat and kick
events for lightning bolts. Support for PermissionsBukkit. Removed
Legacy Permissions support. (This is due to the Inactivity of the
plugin.)
main
Nichole Mattera 10 years ago
parent
commit
4f01a30c07
  1. 99
      src/net/mcbat/LightningEvent/Commands/CommandCast.java
  2. 86
      src/net/mcbat/LightningEvent/Commands/SubcommandFake.java
  3. 86
      src/net/mcbat/LightningEvent/Commands/SubcommandReal.java
  4. 44
      src/net/mcbat/LightningEvent/LightningEvent.java
  5. 7
      src/net/mcbat/LightningEvent/Listeners/LightningEventEntityListener.java
  6. 47
      src/net/mcbat/LightningEvent/Listeners/LightningEventPlayerListener.java
  7. 41
      src/net/mcbat/LightningEvent/Listeners/LightningEventServerListener.java
  8. 81
      src/plugin.yml

99
src/net/mcbat/LightningEvent/Commands/CommandCast.java

@ -0,0 +1,99 @@
package net.mcbat.LightningEvent.Commands;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import net.mcbat.LightningEvent.LightningEvent;
public class CommandCast {
private final LightningEvent _plugin;
private final SubcommandFake _fake;
private final SubcommandReal _real;
public CommandCast(LightningEvent plugin) {
_plugin = plugin;
_fake = new SubcommandFake(plugin, this);
_real = new SubcommandReal(plugin, this);
}
public boolean checkPlayer(String p) {
return (_plugin.getServer().getPlayer(p) != null);
}
public boolean checkWorld(String w) {
return (_plugin.getServer().getWorld(w) != null);
}
public boolean checkLocation(String x, String y, String z) {
return (x.matches("[-]?[0-9]+") && y.matches("[-]?[0-9]+") && z.matches("[-]?[0-9]+"));
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof ConsoleCommandSender) {
if (args.length >= 1 && args[0].equalsIgnoreCase("fake"))
return _fake.onConsoleCommand(sender, command, label, args);
else if (args.length >= 1 && args[0].equalsIgnoreCase("real"))
return _real.onConsoleCommand(sender, command, label, args);
else
return commandUsage(sender, label, false);
}
else {
if (args.length >= 1 && args[0].equalsIgnoreCase("fake")) {
if (!sender.hasPermission("lightningevent.commands.cast.fake"))
return noAccess(sender);
return _fake.onPlayerCommand(sender, command, label, args);
}
else if (args.length >= 1 && args[0].equalsIgnoreCase("real")) {
if (!sender.hasPermission("lightningevent.commands.cast.real"))
return noAccess(sender);
return _real.onPlayerCommand(sender, command, label, args);
}
else
return commandUsage(sender, label, true);
}
}
private boolean noAccess(CommandSender sender) {
sender.sendMessage(ChatColor.DARK_RED+"You do not have access to that command.");
return true;
}
private boolean commandUsage(CommandSender sender, String label, boolean isPlayer) {
if (!isPlayer) {
sender.sendMessage(ChatColor.RED+"[==== "+ChatColor.GREEN+"/"+label+ChatColor.RED+" ====]");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt on a player.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt on a player.");
return true;
}
else {
if (sender.hasPermission("lightningevent.commands.cast.fake") || sender.hasPermission("lightningevent.commands.cast.real")) {
sender.sendMessage(ChatColor.RED+"[==== "+ChatColor.GREEN+"/"+label+ChatColor.RED+" ====]");
if (sender.hasPermission("lightningevent.commmands.cast.fake")) {
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt in the specified world and location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt in the current world at the specified location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt on a player.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt where you are looking.");
}
if (sender.hasPermission("lightningevent.commands.cast.real")) {
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt in the specified world and location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt in the current world at the specified location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt on a player.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt where you are looking.");
}
return true;
}
else
return noAccess(sender);
}
}
}

86
src/net/mcbat/LightningEvent/Commands/SubcommandFake.java

@ -0,0 +1,86 @@
package net.mcbat.LightningEvent.Commands;
import net.mcbat.LightningEvent.LightningEvent;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class SubcommandFake {
private final LightningEvent _plugin;
private final CommandCast _command;
public SubcommandFake(LightningEvent plugin, CommandCast command) {
_plugin = plugin;
_command = command;
}
public boolean onConsoleCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 5:
if (_command.checkWorld(args[1]) && _command.checkLocation(args[2], args[3], args[4]))
_plugin.castFakeLightningAtLocation(new Location(_plugin.getServer().getWorld(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), Integer.parseInt(args[4])));
else
commandUsage(sender, label, false);
break;
case 2:
if (_command.checkPlayer(args[1]))
_plugin.castFakeLightningAtLocation(_plugin.getServer().getPlayer(args[1]).getLocation());
else
commandUsage(sender, label, false);
break;
default:
commandUsage(sender, label, false);
break;
}
return true;
}
public boolean onPlayerCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 5:
if (_command.checkWorld(args[1]) && _command.checkLocation(args[2], args[3], args[4]))
_plugin.castFakeLightningAtLocation(new Location(_plugin.getServer().getWorld(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), Integer.parseInt(args[4])));
else
commandUsage(sender, label, true);
break;
case 4:
if (_command.checkLocation(args[1], args[2], args[3]))
_plugin.castFakeLightningAtLocation(new Location(((Player) sender).getWorld(), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])));
else
commandUsage(sender, label, true);
break;
case 2:
if (_command.checkPlayer(args[1]))
_plugin.castFakeLightningAtLocation(_plugin.getServer().getPlayer(args[1]).getLocation());
else
commandUsage(sender, label, true);
break;
case 1:
_plugin.castFakeLightningAtLocation(((Player) sender).getTargetBlock(null, 600).getLocation());
break;
default:
commandUsage(sender, label, true);
break;
}
return true;
}
private void commandUsage(CommandSender sender, String label, boolean isPlayer) {
if (!isPlayer) {
sender.sendMessage(ChatColor.RED+"[==== "+ChatColor.GREEN+"/"+label+" fake"+ChatColor.RED+" ====]");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt on a player.");
}
else {
sender.sendMessage(ChatColor.RED+"[==== "+ChatColor.GREEN+"/"+label+" fake"+ChatColor.RED+" ====]");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt in the specified world and location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt in the current world at the specified location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt on a player.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" fake "+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a fake lightning bolt where you are looking.");
}
}
}

86
src/net/mcbat/LightningEvent/Commands/SubcommandReal.java

@ -0,0 +1,86 @@
package net.mcbat.LightningEvent.Commands;
import net.mcbat.LightningEvent.LightningEvent;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class SubcommandReal {
private final LightningEvent _plugin;
private final CommandCast _command;
public SubcommandReal(LightningEvent plugin, CommandCast command) {
_plugin = plugin;
_command = command;
}
public boolean onConsoleCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 5:
if (_command.checkWorld(args[1]) && _command.checkLocation(args[2], args[3], args[4]))
_plugin.castRealLightningAtLocation(new Location(_plugin.getServer().getWorld(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), Integer.parseInt(args[4])));
else
commandUsage(sender, label, false);
break;
case 2:
if (_command.checkPlayer(args[1]))
_plugin.castRealLightningAtLocation(_plugin.getServer().getPlayer(args[1]).getLocation());
else
commandUsage(sender, label, false);
break;
default:
commandUsage(sender, label, false);
break;
}
return true;
}
public boolean onPlayerCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 5:
if (_command.checkWorld(args[1]) && _command.checkLocation(args[2], args[3], args[4]))
_plugin.castRealLightningAtLocation(new Location(_plugin.getServer().getWorld(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), Integer.parseInt(args[4])));
else
commandUsage(sender, label, true);
break;
case 4:
if (_command.checkLocation(args[1], args[2], args[3]))
_plugin.castRealLightningAtLocation(new Location(((Player) sender).getWorld(), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])));
else
commandUsage(sender, label, true);
break;
case 2:
if (_command.checkPlayer(args[1]))
_plugin.castRealLightningAtLocation(_plugin.getServer().getPlayer(args[1]).getLocation());
else
commandUsage(sender, label, true);
break;
case 1:
_plugin.castRealLightningAtLocation(((Player) sender).getTargetBlock(null, 600).getLocation());
break;
default:
commandUsage(sender, label, true);
break;
}
return true;
}
private void commandUsage(CommandSender sender, String label, boolean isPlayer) {
if (!isPlayer) {
sender.sendMessage(ChatColor.RED+"[==== "+ChatColor.GREEN+"/"+label+" real"+ChatColor.RED+" ====]");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt on a player.");
}
else {
sender.sendMessage(ChatColor.RED+"[==== "+ChatColor.GREEN+"/"+label+" real"+ChatColor.RED+" ====]");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<world> <x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt in the specified world and location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<x> <y> <z>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt in the current world at the specified location.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.LIGHT_PURPLE+"<player>"+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt on a player.");
sender.sendMessage(ChatColor.GREEN+"/"+label+" real "+ChatColor.GREEN+" - "+ChatColor.WHITE+"Casts a lightning bolt where you are looking.");
}
}
}

44
src/net/mcbat/LightningEvent/LightningEvent.java

@ -3,44 +3,28 @@ package net.mcbat.LightningEvent;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import net.mcbat.LightningEvent.Commands.CommandCast;
import net.mcbat.LightningEvent.Listeners.LightningEventEntityListener;
import net.mcbat.LightningEvent.Listeners.LightningEventPlayerListener;
import net.mcbat.LightningEvent.Listeners.LightningEventServerListener;
public class LightningEvent extends JavaPlugin {
private final Logger _logger;
public PermissionHandler Permissions = null;
private final Logger _logger = Logger.getLogger("minecraft");
private CommandCast _castCommand;
public LightningEvent() {
_logger = Logger.getLogger("Minecraft");
}
@Override
public void onEnable() {
_logger.info("[LightningEvent] v"+this.getDescription().getVersion()+" (Helium) loaded.");
_logger.info("[LightningEvent] Developed by: [Mattera, Steven (IchigoKyger)]");
if (Permissions == null) {
Plugin PermissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
if (PermissionsPlugin != null) {
if (PermissionsPlugin.isEnabled()) {
Permissions = ((Permissions) PermissionsPlugin).getHandler();
_logger.info("[LightningEvent] hooked into Permissions/GroupManager.");
}
}
}
_castCommand = new CommandCast(this);
(new LightningEventEntityListener(this)).registerEvents();
(new LightningEventPlayerListener(this)).registerEvents();
(new LightningEventServerListener(this)).registerEvents();
}
@Override
@ -48,11 +32,23 @@ public class LightningEvent extends JavaPlugin {
_logger.info("[LightningEvent] Plugin disabled.");
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equals("cast"))
return _castCommand.onCommand(sender, command, label, args);
return true;
}
public Logger getMinecraftLogger() {
return _logger;
}
public void castLightningAtLocation(Location location) {
public void castRealLightningAtLocation(Location location) {
location.getWorld().strikeLightning(location);
}
public void castFakeLightningAtLocation(Location location) {
location.getWorld().strikeLightningEffect(location);
}
}

7
src/net/mcbat/LightningEvent/Listeners/LightningEventEntityListener.java

@ -26,11 +26,8 @@ public class LightningEventEntityListener extends EntityListener {
if (event.getEntity() instanceof Player) {
Player player = (Player)event.getEntity();
if (_plugin.Permissions != null && _plugin.Permissions.has(player, "LightningEvent.onDeath"))
_plugin.castLightningAtLocation(player.getLocation());
_plugin.getMinecraftLogger().info("OnDeath: "+player.getLocation().toString());
if (player.hasPermission("lightningevent.events.death"))
_plugin.castFakeLightningAtLocation(player.getLocation());
}
}
}

47
src/net/mcbat/LightningEvent/Listeners/LightningEventPlayerListener.java

@ -6,7 +6,9 @@ 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;
@ -26,7 +28,9 @@ public class LightningEventPlayerListener extends PlayerListener {
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);
@ -34,41 +38,50 @@ public class LightningEventPlayerListener extends PlayerListener {
}
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
if (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onBedEnter"))
_plugin.castLightningAtLocation(event.getPlayer().getLocation());
if (event.getPlayer().hasPermission("lightningevent.events.bed.enter"))
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
}
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
if (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onBedLeave"))
_plugin.castLightningAtLocation(event.getPlayer().getLocation());
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 (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onJoin"))
_plugin.castLightningAtLocation(event.getPlayer().getLocation());
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 (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onQuit"))
_plugin.castLightningAtLocation(event.getPlayer().getLocation());
if (event.getPlayer().hasPermission("lightningevent.events.quit"))
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
}
public void onPlayerMove(PlayerMoveEvent event) {
if (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onMove"))
_plugin.castLightningAtLocation(event.getPlayer().getLocation());
if (event.getPlayer().hasPermission("lightningevent.events.move"))
_plugin.castFakeLightningAtLocation(event.getPlayer().getLocation());
}
public void onPlayerTeleport(PlayerTeleportEvent event) {
if (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onTeleport.from"))
_plugin.castLightningAtLocation(event.getFrom());
if (event.getPlayer().hasPermission("lightningevent.events.teleport.from"))
_plugin.castFakeLightningAtLocation(event.getFrom());
if (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onTeleport.to"))
_plugin.castLightningAtLocation(event.getTo());
if (event.getPlayer().hasPermission("lightningevent.events.teleport.to"))
_plugin.castFakeLightningAtLocation(event.getTo());
}
public void onPlayerRespawn(PlayerRespawnEvent event) {
if (_plugin.Permissions != null && _plugin.Permissions.has(event.getPlayer(), "LightningEvent.onRespawn"))
_plugin.castLightningAtLocation(event.getRespawnLocation());
_plugin.getMinecraftLogger().info("OnRespawn: "+event.getRespawnLocation().toString());
if (event.getPlayer().hasPermission("lightningevent.events.respawn"))
_plugin.castFakeLightningAtLocation(event.getRespawnLocation());
}
}

41
src/net/mcbat/LightningEvent/Listeners/LightningEventServerListener.java

@ -1,41 +0,0 @@
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.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.PluginManager;
import com.nijikokun.bukkit.Permissions.Permissions;
public class LightningEventServerListener extends ServerListener {
private final LightningEvent _plugin;
public LightningEventServerListener(LightningEvent plugin) {
_plugin = plugin;
}
public void registerEvents() {
PluginManager pm = _plugin.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLUGIN_ENABLE, this, Priority.Monitor, _plugin);
pm.registerEvent(Event.Type.PLUGIN_DISABLE, this, Priority.Monitor, _plugin);
}
public void onPluginEnable(PluginEnableEvent event) {
if (_plugin.Permissions == null && event.getPlugin().getDescription().getName().equals("Permissions")) {
_plugin.Permissions = ((Permissions)event.getPlugin()).getHandler();
_plugin.getMinecraftLogger().info("[LightningEvent] hooked into Permissions/GroupManager.");
}
}
public void onPluginDisable(PluginDisableEvent event) {
if (_plugin.Permissions != null && event.getPlugin().getDescription().getName().equals("Permissions")) {
_plugin.Permissions = null;
_plugin.getMinecraftLogger().info("[LightningEvent] un-hooked from Permissions/GroupManager");
}
}
}

81
src/plugin.yml

@ -1,6 +1,83 @@
name: LightningEvent
main: net.mcbat.LightningEvent.LightningEvent
version: 1.00
version: 1.01
website: http://mc-bat.net
author: Steven Mattera
description: Simple plugin that casts lightning on events.
description: Simple plugin that casts lightning on events.
commands:
cast:
aliases: [c]
description: Commands for casting lightning bolts.
usage: |
/<command> fake <world> <x> <y> <z> - Casts a fake lightning bolt in the specified world and location.
/<command> fake <x> <y> <z> - Casts a fake lightning bolt in the current world at the specified location.
/<command> fake <player> - Casts a fake lightning bolt on a player.
/<command> fake - Casts a fake lightning bolt where you are looking.
/<command> real <world> <x> <y> <z> - Casts a lightning bolt in the specified world and location.
/<command> real <x> <y> <z> - Casts a lightning bolt in the current world at the specified location.
/<command> real <player> - Casts a lightning bolt on a player.
/<command> real - Casts a lightning bolt where you are looking.
permissions:
lightningevent.*:
description: Allows use of all commands and lightning events.
children:
lightningevent.commands.*: true
lightningevent.events.*: true
lightningevent.commands.*:
default: op
description: Allows use of all commands.
children:
lightningevent.commands.cast.*: true
lightningevent.commands.cast.*:
description: Casts lightning bolts.
children:
lightningevent.commands.cast.fake: true
lightningevent.commands.cast.real: true
lightningevent.commands.cast.fake:
description: Casts fake lightning bolts.
lightningevent.commands.cast.real:
description: Casts real lightning bolts.
lightningevent.events.*:
description: Allows use of all lightning events.
children:
lightningevent.events.bed.*: true
lightningevent.events.chat: true
lightningevent.events.death: true
lightningevent.events.join: true
lightningevent.events.kick: true
lightningevent.events.quit: true
lightningevent.events.move: true
lightningevent.events.teleport.*: true
lightningevent.events.respawn: true
lightningevent.events.bed.*:
description: Allows use of all bed lightning events.
children:
lightningevent.events.bed.enter: true
lightningevent.events.bed.leave: true
lightningevent.events.bed.enter:
description: Allows for a lightning strike when a player enters a bed.
lightningevent.events.bed.leave:
description: Allows for a lightning strike when a player leaves a bed.
lightningevent.events.chat:
description: Allows for a lightning strike when a player talks in chat.
lightningevent.events.death:
description: Allows for a lightning strike when a player dies.
lightningevent.events.join:
description: Allows for a lightning strike when a player joins.
lightningevent.events.kick:
description: Allows for a lightning strike when a player is kicked.
lightningevent.events.quit:
description: Allows for a lightning strike when a player quits.
lightningevent.events.move:
description: Allows for a lightning strike when a player moves.
lightningevent.events.teleport.*:
description: Allows use of all teleport lightning events.
children:
lightningevent.events.teleport.from: true
lightningevent.events.teleport.to: true
lightningevent.events.teleport.from:
description: Allows for a lightning strike when a player teleports at the location that they are teleporting from.
lightningevent.events.teleport.to:
description: Allows for a lightning strike when a player teleports at the location that they are teleporting to.
lightningevent.events.respawn:
description: Allows for a lightning strike when a player respawns.
Loading…
Cancel
Save