MCPcopy
hub / github.com/walterhiggins/ScriptCraft / _world

Function _world

src/main/js/modules/utils/utils.js:73–101  ·  view source on GitHub ↗

### utils.world( worldName ) function Returns a World object matching the given name

(worldName)

Source from the content-addressed store, hash-verified

71
72***/
73function _world(worldName) {
74 if (__plugin.canary) {
75 if (worldName instanceof Packages.net.canarymod.api.world.World) {
76 return worldName;
77 }
78 var worldMgr = Canary.server.worldManager;
79 try {
80 if (worldName === undefined) {
81 var worldNames = worldMgr.getLoadedWorldsNames();
82 worldName = worldNames[0];
83 }
84 return worldMgr.getWorld(worldName, true);
85 } catch (error) {
86 console.error(
87 'utils.world() failed to load ' + worldName + ',Error:' + error
88 );
89 }
90 }
91 if (__plugin.bukkit) {
92 if (worldName instanceof org.bukkit.World) {
93 return worldName;
94 }
95 if (worldName === undefined) {
96 return bkBukkit.getWorlds().get(0);
97 }
98 return bkBukkit.getWorld(worldName);
99 }
100 return null;
101}
102exports.world = _world;
103
104/*************************************************************************

Callers 3

utils.jsFile · 0.85
getTimeFunction · 0.85
getTime24Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected