mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-22 17:43:51 +00:00
Add PlayerPreLoginEvent (#8)
* PlayerPreLoginEvent, comments for more events * basic plugin events * plugin failed to load event * add docs --------- Co-authored-by: sylvessa <225480449+sylvessa@users.noreply.github.com>
This commit is contained in:
parent
33e0ecac56
commit
da2aaf1247
12 changed files with 241 additions and 4 deletions
40
Minecraft.Server.FourKit/Event/Player/PlayerPreLoginEvent.cs
Normal file
40
Minecraft.Server.FourKit/Event/Player/PlayerPreLoginEvent.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Player;
|
||||
|
||||
using Minecraft.Server.FourKit.Net;
|
||||
|
||||
/// <summary>
|
||||
/// Stores details for players attempting to log in.
|
||||
/// </summary>
|
||||
public class PlayerPreLoginEvent : Event, Cancellable
|
||||
{
|
||||
private string name;
|
||||
private InetSocketAddress ipAddress; //bukkit uses InetAddress but we expose port also
|
||||
private bool _cancelled;
|
||||
|
||||
|
||||
internal PlayerPreLoginEvent(string name, InetSocketAddress ipAddress) : base()
|
||||
{
|
||||
this.name = name;
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player's name.
|
||||
/// </summary>
|
||||
/// <returns>The player's name.</returns>
|
||||
public string getName() => name;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player IP address.
|
||||
/// </summary>
|
||||
/// <returns>The IP address.</returns>
|
||||
public InetSocketAddress getAddress() => ipAddress;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool isCancelled() => _cancelled;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void setCancelled(bool cancel) => _cancelled = cancel;
|
||||
}
|
||||
11
Minecraft.Server.FourKit/Event/Server/PluginDisableEvent.cs
Normal file
11
Minecraft.Server.FourKit/Event/Server/PluginDisableEvent.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Server;
|
||||
|
||||
using Minecraft.Server.FourKit.Plugin;
|
||||
|
||||
public class PluginDisableEvent : PluginEvent
|
||||
{
|
||||
|
||||
internal PluginDisableEvent(ServerPlugin plugin) : base(plugin)
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Minecraft.Server.FourKit/Event/Server/PluginEnableEvent.cs
Normal file
11
Minecraft.Server.FourKit/Event/Server/PluginEnableEvent.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Server;
|
||||
|
||||
using Minecraft.Server.FourKit.Plugin;
|
||||
|
||||
public class PluginEnableEvent : PluginEvent
|
||||
{
|
||||
|
||||
internal PluginEnableEvent(ServerPlugin plugin) : base(plugin)
|
||||
{
|
||||
}
|
||||
}
|
||||
16
Minecraft.Server.FourKit/Event/Server/PluginEvent.cs
Normal file
16
Minecraft.Server.FourKit/Event/Server/PluginEvent.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Server;
|
||||
|
||||
using Minecraft.Server.FourKit.Plugin;
|
||||
|
||||
public abstract class PluginEvent : ServerEvent
|
||||
{
|
||||
private readonly ServerPlugin _plugin;
|
||||
|
||||
internal protected PluginEvent(ServerPlugin plugin) : base()
|
||||
{
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
/// <summary>Returns the plugin involved in this event.</summary>
|
||||
public ServerPlugin getPlugin() => _plugin;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Server;
|
||||
|
||||
using Minecraft.Server.FourKit.Plugin;
|
||||
|
||||
public class PluginLoadFailedEvent : ServerEvent
|
||||
{
|
||||
private readonly string _fileName;
|
||||
private readonly string _message;
|
||||
internal PluginLoadFailedEvent(string fileName, string message) : base()
|
||||
{
|
||||
_fileName = fileName;
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public string getFileName() => _fileName;
|
||||
|
||||
public string getMessage() => _message;
|
||||
}
|
||||
11
Minecraft.Server.FourKit/Event/Server/ServerEvent.cs
Normal file
11
Minecraft.Server.FourKit/Event/Server/ServerEvent.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Server;
|
||||
|
||||
using Minecraft.Server.FourKit.Plugin;
|
||||
|
||||
public abstract class ServerEvent : Event
|
||||
{
|
||||
|
||||
internal protected ServerEvent() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue