@snailycfx/nexus 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { EventClass } from "../EventClass";
2
2
  export declare const NexusMetadata: {
3
- define(key: string, paramTypes: EventClass[], methodName: string): void;
4
- getEventClass(methodName: string): EventClass | undefined;
3
+ define(this: void, key: string, paramTypes: EventClass[], methodName: string): void;
4
+ getEventClass(this: void, methodName: string): EventClass | undefined;
5
5
  };
@@ -1,7 +1,7 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local store = {}
3
3
  local NexusMetadata = {
4
- define = function(self, key, paramTypes, methodName)
4
+ define = function(key, paramTypes, methodName)
5
5
  if key ~= "paramtypes" then
6
6
  return nil
7
7
  end
@@ -12,7 +12,7 @@ local NexusMetadata = {
12
12
  local _arg1 = paramTypes[1]
13
13
  store[_methodName] = _arg1
14
14
  end,
15
- getEventClass = function(self, methodName)
15
+ getEventClass = function(methodName)
16
16
  local _methodName = methodName
17
17
  return store[_methodName]
18
18
  end,
@@ -4,7 +4,7 @@ local NexusMetadata = TS.import(script, script.Parent.Parent, "core", "metadata"
4
4
  local EVENT_HANDLER_KEY = "__nexus_event_handlers__"
5
5
  local function EventHandler(options)
6
6
  return function(target, methodName)
7
- local eventClass = NexusMetadata:getEventClass(methodName)
7
+ local eventClass = NexusMetadata.getEventClass(methodName)
8
8
  if eventClass == nil then
9
9
  return nil
10
10
  end
@@ -2,7 +2,9 @@ import { NexusEvent } from "../..";
2
2
  import { IListener } from "../../interfaces/IListener";
3
3
  export declare class EventManager {
4
4
  private readonly handlers;
5
+ constructor();
5
6
  register(listener: IListener): void;
6
7
  dispatch<T extends NexusEvent>(event: T): void;
7
8
  private addHandler;
9
+ private setupRobloxEvents;
8
10
  }
@@ -1,6 +1,10 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
+ local ___ = TS.import(script, script.Parent.Parent.Parent)
4
+ local PlayerJoinEvent = ___.PlayerJoinEvent
5
+ local PlayerLeaveEvent = ___.PlayerLeaveEvent
3
6
  local getEventHandlerMetas = TS.import(script, script.Parent.Parent.Parent, "events", "decorators", "EventHandler").getEventHandlerMetas
7
+ local Players = TS.import(script, TS.getModule(script, "@rbxts", "services")).Players
4
8
  local EventManager
5
9
  do
6
10
  EventManager = setmetatable({}, {
@@ -15,6 +19,7 @@ do
15
19
  end
16
20
  function EventManager:constructor()
17
21
  self.handlers = {}
22
+ self:setupRobloxEvents()
18
23
  end
19
24
  function EventManager:register(listener)
20
25
  local metas = getEventHandlerMetas(listener)
@@ -78,6 +83,14 @@ do
78
83
  local _eventClass_1 = eventClass
79
84
  _handlers_1[_eventClass_1] = existing
80
85
  end
86
+ function EventManager:setupRobloxEvents()
87
+ Players.PlayerAdded:Connect(function(player)
88
+ return self:dispatch(PlayerJoinEvent.new(player))
89
+ end)
90
+ Players.PlayerRemoving:Connect(function(player)
91
+ return self:dispatch(PlayerLeaveEvent.new(player))
92
+ end)
93
+ end
81
94
  end
82
95
  return {
83
96
  EventManager = EventManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snailycfx/nexus",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Bukkit-inspired framework for roblox-ts",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",