Signed-off-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Ursprung
3584b83b28
Commit
b1e376d47f
@ -33,6 +33,7 @@ import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.OneArgFunction;
|
||||
|
||||
@Linked
|
||||
public class RegionLib implements LuaLib {
|
||||
@ -43,8 +44,7 @@ public class RegionLib implements LuaLib {
|
||||
return "region";
|
||||
}
|
||||
|
||||
@Override
|
||||
public LuaTable get(Player player) {
|
||||
private LuaTable create(Region region, Player player) {
|
||||
LuaTable table = LuaValue.tableOf();
|
||||
|
||||
table.set("name", getter(() -> Region.getRegion(player.getLocation()).getName()));
|
||||
@ -74,4 +74,16 @@ public class RegionLib implements LuaLib {
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LuaTable get(Player player) {
|
||||
LuaTable table = create(Region.getRegion(player.getLocation()), player);
|
||||
table.set("get", new OneArgFunction() {
|
||||
@Override
|
||||
public LuaValue call(LuaValue arg) {
|
||||
return create(Region.getREGION_MAP().get(arg.checkjstring()), player);
|
||||
}
|
||||
});
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
@ -123,13 +123,14 @@ Das `region`-Modul stellt Funktion zur Verfügung, die die Region des Spielers b
|
||||
Es gibt folgende Funktionen:
|
||||
|
||||
| Name | Signature | Beschreibung |
|
||||
|-----------|--------------------|------------------------------------------------------------------------------------------------------------|
|
||||
|-----------|---------------------|------------------------------------------------------------------------------------------------------------|
|
||||
| `name` | name(): String | Gibt den Regionsnamen |
|
||||
| `type` | type(): String | Gibt den Regionstyp |
|
||||
| `fire` | fire(): Boolean | Gibt den Fire-Modus der Region zurück |
|
||||
| `freeze` | freeze(): Boolean | Gibt den Freeze-Modus der Region zurück |
|
||||
| `protect` | protect(): Boolean | Gibt den Protect-Modus der Region zurück |
|
||||
| `loader` | loader(): String | Gibt den Status des Loaders des Spielers zurück, die Werte sind: `OFF`, `SETUP`, `RUNNING`, `PAUSE`, `END` |
|
||||
| `get` | get(String): Region | Gibt die Region mit dem Namen zurück. Die Region ist gleich aufgebaut wie das Regions-Modul |
|
||||
|
||||
Es gibt folgende weitere Module:
|
||||
|
||||
|
21
sw.def.lua
21
sw.def.lua
@ -127,28 +127,31 @@ function random.nextBool() return nil end
|
||||
|
||||
---@alias RegionType 'wg' | 'mwg' | 'as' | 'ws' | 'ws_inner' | 'ws_rumpf' | 'ws_rahmen' | 'spawn'
|
||||
|
||||
---@class region
|
||||
---@class iregion
|
||||
---@field tnt tnt
|
||||
---@field trace trace
|
||||
local iregion = {}
|
||||
|
||||
---@class region: iregion
|
||||
region = {}
|
||||
|
||||
---@return string
|
||||
function region.name() return nil end
|
||||
function iregion.name() return nil end
|
||||
|
||||
---@return RegionType
|
||||
function region.type() return nil end
|
||||
function iregion.type() return nil end
|
||||
|
||||
---@return boolean
|
||||
function region.fire() return nil end
|
||||
function iregion.fire() return nil end
|
||||
|
||||
---@return boolean
|
||||
function region.freeze() return nil end
|
||||
function iregion.freeze() return nil end
|
||||
|
||||
---@return boolean
|
||||
function region.protect() return nil end
|
||||
function iregion.protect() return nil end
|
||||
|
||||
---@return string
|
||||
function region.loader() return nil end
|
||||
function iregion.loader() return nil end
|
||||
|
||||
---@alias TNTMode 'ALLOW' | 'DENY' | 'ONLY_TB'
|
||||
|
||||
@ -179,6 +182,10 @@ function trace.status() return nil end
|
||||
---@return number
|
||||
function trace.time() return nil end
|
||||
|
||||
---@param name string
|
||||
---@return iregion
|
||||
function region.get(name) return nil end
|
||||
|
||||
---@class Position
|
||||
---@field x number
|
||||
---@field y number
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren