forked from SteamWar/SteamWar
Fix RegionLib.type
This commit is contained in:
@@ -181,7 +181,6 @@ public class RegionListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void tagChangedRegion(final Location location) {
|
||||
Region.getRegion(location).getFlags().set(Flag.CHANGED, ChangedMode.HAS_CHANGE);
|
||||
}
|
||||
|
||||
+8
-3
@@ -29,6 +29,7 @@ import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.OneArgFunction;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -46,11 +47,15 @@ public class RegionLib implements LuaLib {
|
||||
table.set("name", getter(() -> region.get().getID().toString()));
|
||||
table.set("id", getter(() -> region.get().getID().toString()));
|
||||
table.set("type", getter(() -> {
|
||||
Region region1 = region.get();
|
||||
if (region1.getType().isGlobal()) {
|
||||
Region rg = region.get();
|
||||
if (rg.getType().isGlobal()) {
|
||||
return "global";
|
||||
}
|
||||
return region1.getType().name().toLowerCase();
|
||||
List<String> chatNames = rg.getGameModeConfig().getServer().getChatNames();
|
||||
if (chatNames.isEmpty()) {
|
||||
return "unknown";
|
||||
}
|
||||
return chatNames.get(0).toLowerCase();
|
||||
}));
|
||||
|
||||
LuaValue tntLib = LuaValue.tableOf();
|
||||
|
||||
Reference in New Issue
Block a user