package NET.worlds.scape; import NET.worlds.console.AdBanner; import NET.worlds.console.Console; import NET.worlds.console.Gamma; import NET.worlds.console.Main; import NET.worlds.console.WorldsMarkPart; import NET.worlds.core.Hashtable; import NET.worlds.core.IniFile; import NET.worlds.core.Std; import NET.worlds.network.Galaxy; import NET.worlds.network.NetUpdate; import NET.worlds.network.URL; import NET.worlds.network.WorldServer; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.text.MessageFormat; import java.util.Enumeration; import java.util.Vector; public class World extends SuperRoot implements URLSelf, LoadedURLSelf, IncrementalRestorer { static WorldRedirector redir = new WorldRedirector(URL.make(Gamma.getHome() + "redir.txt")); private static boolean cloistered = false; private static boolean cloisteredSet = false; private String adCubeBaseURL = null; private boolean hasClickableAdCube = false; private boolean adCubeFormatIsGif = false; private String defaultAdCubeURL = IniFile.override().getIniString("defaultAdCubeURL", "http://www.worlds.com/"); private boolean hasBeenEdited = false; private String defaultRoomName = ""; protected Hashtable roomHash = new Hashtable(); protected Vector roomList = new Vector(); Vector eventHandlers; private static boolean[] didTouch = new boolean[1]; private static int lastGeneratedFrameEvents; private int renderStamp; private int timeoutAge = 15000; private int nextRoomCheck = 0; private static Hashtable worldHash = new Hashtable(); private static Vector worldList = new Vector(); private boolean registerable = false; private static Object classCookie = new Object(); private static final int INIT = 0; private static final int RESTOREROOMS = 1; private static final int ADDROOMS = 2; private static final int LOADCONSOLE = 3; private static final int DONE = -1; private Enumeration tmpenum; protected Console console = null; String loadErr; static URL defaultServerURL = URL.make("worldserver://www.3dcd.com:6650/"); private URL worldServerURL; private URL desiredWorldServerURL = defaultServerURL; private boolean isCourtesyVIP; private boolean isForceHuman = false; private boolean hasAdBanner = false; private int adBannerWidth = 474; private int adBannerHeight = 65; private String adBannerURL = "$SCRIPTSERVERgetad.pl?s=$SERIALNUM"; private static AdBanner theAdBanner = null; private boolean isMultiuser; World() { } @Override public World getWorld() { return this; } public static void load(URL url, LoadedURLSelf callback, boolean force) { if (Gamma.loadProgress != null) { Gamma.loadProgress.setMessage("Loading world files..."); Gamma.loadProgress.advance(); } if (url.toString().indexOf("UserHomeWorld") != -1) { String homeWorld = WorldsMarkPart.getFirstSystemMarkURL(); if (homeWorld != null) { int poundIdx = homeWorld.indexOf("#"); if (poundIdx != -1) { homeWorld = homeWorld.substring(0, poundIdx); } url = URL.make(homeWorld); } } File f = new File(url.unalias()); if (!f.exists()) { url = redir.get(url); } if (isProscribed(url, force)) { callback.loadedURLSelf(null, url, "Can't autoload WorldsStore"); } else { World w = (World)worldHash.get(url); if (w != null) { w.incRef(); callback.loadedURLSelf(w, url, null); } else { URLSelfLoader.load(url, callback, true); } } } public static void load(URL url, LoadedURLSelf callback) { load(url, callback, false); } public static boolean isCloistered() { if (!cloisteredSet) { URL homeDir = URL.make("home:" + WorldsMarkPart.getFirstWorld()); cloistered = new File(homeDir.unalias() + "/cloistered").exists(); cloisteredSet = true; } return cloistered; } public static URL getHomeStore() { URL storeinf = URL.make("home:" + WorldsMarkPart.getFirstWorld() + "/store.inf"); URL homeStore = URL.make("home:PolyGram/polygramdlb.world"); File sf = new File(storeinf.unalias()); if (!sf.exists() || !sf.isFile()) { sf = new File(URL.make("home:PolyGram/store.inf").unalias()); if (!sf.exists() || !sf.isFile()) { return homeStore; } } try { BufferedReader rdr = new BufferedReader(new FileReader(sf)); String s = rdr.readLine(); rdr.close(); homeStore = new URL(s); } catch (IOException var5) { } return homeStore; } public static boolean isWorldsStoreProscribed() { return isCloistered() && IniFile.gamma().getIniInt("WorldsStoreProscribed", 1) != 0; } public static boolean isProscribed(URL url, boolean forceLoad) { return !forceLoad && !WorldValidator.allow(url.toString()); } public boolean isHomeWorld() { URL url = this.getSourceURL(); if (url != null) { URL homeURL = URL.make("home:" + WorldsMarkPart.getFirstWorld()); if (url.unalias().startsWith(homeURL.unalias() + "/")) { return true; } } return false; } public void setEdited(boolean state) { if (state != this.hasBeenEdited) { this.hasBeenEdited = state; worldListChanged(); } } @Override public void markEdited() { this.setEdited(true); } public String getAdCubeBaseURL() { if (this.adCubeBaseURL == null) { String worldURL = this.getSourceURL().toString(); if (worldURL.lastIndexOf("/") == -1) { return "ads/ad"; } else { worldURL = worldURL.substring(0, worldURL.lastIndexOf("/")); WorldServer w = Pilot.getActive().getServer(); if (w != null && w.getGalaxy().getOnline()) { String adserverURL = NetUpdate.getUpgradeServerURL(); if (adserverURL != null) { int i1 = worldURL.lastIndexOf("/"); int i2 = worldURL.lastIndexOf(":"); i1 = i1 > i2 ? i1 : i2; if (i1 > -1) { worldURL = worldURL.substring(i1 + 1); } return adserverURL + worldURL + "/ads/ad"; } } return worldURL + "/ads/ad"; } } else { return this.adCubeBaseURL; } } public void setAdCubeBaseURL(String s) { this.adCubeBaseURL = new String(s); } public boolean getHasClickableAdCube() { return this.hasClickableAdCube; } public void setHasClickableAdCube(boolean b) { this.hasClickableAdCube = b; } public boolean getAdCubeFormatIsGif() { return this.adCubeFormatIsGif; } public void setAdCubeFormatIsGif(boolean b) { this.adCubeFormatIsGif = b; } public String getDefaultAdCubeURL() { return this.defaultAdCubeURL; } public void setDefaultAdCubeURL(String s) { this.defaultAdCubeURL = new String(s); } public boolean getEdited() { return this.hasBeenEdited; } private static void worldListChanged() { if (Gamma.getShaper() != null) { Gamma.getShaper().worldListChange(); } } @Override public void getChildren(DeepEnumeration d) { d.addChildEnumeration(this.getRooms()); if (this.eventHandlers != null) { d.addChildVector(this.eventHandlers); } } public Room getRoom(String roomName) { if (roomName.indexOf("UserHomeRoom") != -1) { roomName = this.getDefaultRoomName(); } return (Room)this.roomHash.get(roomName); } public String getDefaultRoomName() { if (this.getRoom(this.defaultRoomName) == null) { if (this.roomList.isEmpty()) { this.defaultRoomName = ""; } else { this.defaultRoomName = ((Room)this.roomList.elementAt(0)).getName(); } } return this.defaultRoomName; } public void setDefaultRoomName(String name) { this.defaultRoomName = name; } public void addRoom(Room room) { String name = room.getName(); int roomNum = 1; while (this.getRoom(name) != null) { name = "Room" + roomNum++; } room.setName(name); this.roomHash.put(name, room); this.roomList.addElement(room); this.add(room); URL sourceURL = this.getSourceURL(); if (sourceURL != null && worldHash.containsKey(sourceURL)) { room.register(); } } public void renameRoom(String oldName, String newName, Room room) { if (oldName != null) { assert this.roomHash.get(oldName) == room; this.roomHash.remove(oldName); } else { assert !this.roomList.removeElement(room); this.roomList.addElement(room); } assert newName != null; assert room.getName().equals(newName); this.roomHash.put(newName, room); } public void removeRoom(Room room) { this.roomHash.remove(this.roomHash.getKey(room)); this.roomList.removeElement(room); } public Enumeration getRooms() { return this.roomList.elements(); } public static Room findRoomByName(String name) { Enumeration we = worldList.elements(); while (we.hasMoreElements()) { World w = we.nextElement(); Enumeration re = w.getRooms(); while (re.hasMoreElements()) { Room r = (Room)re.nextElement(); if (r.toString().equals(name)) { return r; } } } return null; } public void invokeActions(String actLabel) { Enumeration en = this.getDeepOwned(); while (en.hasMoreElements()) { Object obj = en.nextElement(); if (obj instanceof WObject) { ((WObject)obj).doAction(actLabel, null); } } } public boolean deliver(FrameEvent event) { if (this.eventHandlers != null) { if (Main.profile != 0) { int i = this.eventHandlers.size(); while (--i >= 0) { FrameHandler fh = (FrameHandler)this.eventHandlers.elementAt(i); int start = Std.getRealTime(); long startBytes = Runtime.getRuntime().freeMemory(); event.retargetAndDeliver(fh, null); int dur = Std.getRealTime() - start; long used = Runtime.getRuntime().freeMemory() - startBytes; if (dur > Main.profile) { System.out.println("Took " + dur + "ms and " + used + " bytes to call world eventHandler " + fh); } } } else { int i = this.eventHandlers.size(); while (--i >= 0) { event.retargetAndDeliver((FrameHandler)this.eventHandlers.elementAt(i), null); } } } return true; } public static void generateFrameEvents(FrameEvent f) { didTouch[0] = false; int now = Std.getFastTime(); int i = worldList.size(); while (--i >= 0) { World w = worldList.elementAt(i); if (!w.discardIfOld(didTouch)) { w.deliver(f); } } if (Pilot.getActiveWorld() != null) { lastGeneratedFrameEvents = now; } } public Enumeration getHandlers() { return this.eventHandlers == null ? new Vector().elements() : this.eventHandlers.elements(); } public boolean hasHandler(SuperRoot h) { return this.eventHandlers != null && this.eventHandlers.indexOf(h) != -1; } public World addHandler(SuperRoot h) { if (!(h instanceof FrameHandler)) { Object[] arguments = new Object[]{new String(h.getName())}; Console.println(MessageFormat.format(Console.message("FrameHandler"), arguments)); return this; } else { if (this.eventHandlers == null) { this.eventHandlers = new Vector(); } this.eventHandlers.addElement(h); this.add(h); return this; } } public void removeHandler(SuperRoot h) { if (this.eventHandlers.contains(h)) { h.detach(); this.eventHandlers.removeElement(h); if (this.eventHandlers.size() == 0) { this.eventHandlers = null; } } } @Override public void incRef() { this.renderStamp = Std.getFastTime(); } @Override public void decRef() { } private void touchAdjacentRooms(boolean[] didTouch) { if (!didTouch[0]) { didTouch[0] = true; Room r = Pilot.getActiveRoom(); if (r != null) { Vector portals = r.getOutgoingPortals(); int i = portals.size(); while (--i >= 0) { Room farr = portals.elementAt(i).farSideRoom(); if (farr != null) { farr.noteRef(); } } } } } boolean discardIfOld(boolean[] didTouch) { int now = Std.getFastTime(); if (now < this.nextRoomCheck) { return false; } else { this.nextRoomCheck = now + 5000 + (int)(3000.0 * Math.random()); this.touchAdjacentRooms(didTouch); int i = this.roomList.size(); while (--i >= 0) { ((Room)this.roomList.elementAt(i)).discardIfOld(); } if (this.hasBeenEdited) { return false; } else { i = now - this.renderStamp; if (i > this.timeoutAge && this.renderStamp < lastGeneratedFrameEvents && i > this.timeoutAge) { this.discard(); return true; } else { return false; } } } } @Override public void discard() { URL url = this.getSourceURL(); synchronized (worldHash) { worldHash.remove(url); worldList.removeElement(this); } worldListChanged(); URLSelfLoader.unload(this); if (this.eventHandlers != null) { int i = this.eventHandlers.size(); while (--i >= 0) { this.removeHandler((SuperRoot)this.eventHandlers.elementAt(i)); } } assert this.eventHandlers == null; this.discardRooms(); if (this.console != null) { this.console.decRef(); } this.console = null; System.gc(); System.runFinalization(); } private void discardRooms() { while (!this.roomList.isEmpty()) { Room r = (Room)this.roomList.elementAt(0); r.discard(); } } @Override protected void finalize() { this.discardRooms(); super.finalize(); } private void markInitialized() { if (this.getSourceURL() != null) { this.register(); } else { this.registerable = true; } } private void register() { URL url = this.getSourceURL(); synchronized (worldHash) { assert !worldHash.containsKey(url); worldHash.put(url, this); worldList.addElement(this); } worldListChanged(); this.registerable = false; int i = this.roomList.size(); while (--i >= 0) { ((Room)this.roomList.elementAt(i)).register(); } } @Override public void setSourceURL(URL url) { super.setSourceURL(url); if (this.registerable) { this.register(); } } @Override public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException { Object ret = null; switch (index - offset) { case 0: if (mode == 0) { ret = StringPropertyEditor.make(new Property(this, index, "Default Room Name")); } else if (mode == 1) { ret = this.getDefaultRoomName(); } else if (mode == 2) { String name = (String)value; if (this.getRoom(name) == null) { Console.println(name + Console.message("No-room-named")); } else { this.setDefaultRoomName(name); } } break; case 1: if (mode == 0) { ret = BooleanPropertyEditor.make(new Property(this, index, "Multiuser"), "No", "Yes"); } else if (mode == 1) { ret = new Boolean(this.getMultiuser()); } else if (mode == 2) { this.setMultiuser((Boolean)value); } break; case 2: if (mode == 0) { ret = new Property(this, index, "Console"); } else if (mode == 1) { ret = this.console; } break; case 3: if (mode == 0) { ret = PropAdder.make(new VectorProperty(this, index, "Rooms")); } else if (mode == 1) { ret = VectorProperty.toVector(this.roomHash); } else if (mode == 4) { ((Room)value).detach(); } else if (mode == 3) { if (!(value instanceof Room)) { throw new Error("Can only add Rooms to a World."); } this.addRoom((Room)value); } else if (mode == 5 && value instanceof Room) { ret = value; } break; case 4: if (mode == 0) { ret = FloatPropertyEditor.make(new Property(this, index, "Time-out Age (seconds)")); } else if (mode == 1) { ret = new Float(this.timeoutAge / 1000.0F); } else if (mode == 2) { this.timeoutAge = Math.round((Float)value * 1000.0F); } break; case 5: if (mode == 0) { ret = PropAdder.make(new VectorProperty(this, index, "Running Actions (delete to stop)")); } else if (mode == 1) { if (this.eventHandlers != null) { ret = this.eventHandlers.clone(); } } else if (mode == 4) { this.removeHandler((SuperRoot)value); } break; case 6: if (mode == 0) { ret = URLPropertyEditor.make(new Property(this, index, "Server URL"), "console"); } else if (mode == 1) { ret = this.desiredWorldServerURL; if (ret != null) { String u = this.desiredWorldServerURL.unalias(); if (u.startsWith("worldserver://")) { ret = URL.make(u + "default.console"); } } } else if (mode == 2) { URL url = (URL)value; if (url != null) { String u = url.unalias(); int len = u.length(); if (u.startsWith("worldserver://")) { if (!url.endsWith("/default.console") || len < 31) { Console.println(Console.message("server-URL") + "default.console"); break; } u = u.substring(14, len - 16); } url = Console.makeServerURL(u); } this.setWorldServerURL(url); } break; case 7: if (mode == 0) { ret = BooleanPropertyEditor.make(new Property(this, index, "Courtesy VIP"), "No", "Yes"); } else if (mode == 1) { ret = new Boolean(this.getCourtesyVIP()); } else if (mode == 2) { this.setCourtesyVIP((Boolean)value); } break; case 8: if (mode == 0) { ret = BooleanPropertyEditor.make(new Property(this, index, "Force Human"), "No", "Yes"); } else if (mode == 1) { ret = new Boolean(this.getForceHuman()); } else if (mode == 2) { this.setForceHuman((Boolean)value); } break; case 9: if (mode == 0) { ret = BooleanPropertyEditor.make(new Property(this, index, "Has Ad Banner"), "No", "Yes"); } else if (mode == 1) { ret = new Boolean(this.getHasAdBanner()); } else if (mode == 2) { this.setHasAdBanner((Boolean)value); this.setupAdBanner(); } break; case 10: if (mode == 0) { ret = IntegerPropertyEditor.make(new Property(this, index, "Banner Width")); } else if (mode == 1) { ret = new Integer(this.getBannerWidth()); } else if (mode == 2) { this.setBannerWidth((Integer)value); this.setupAdBanner(); } break; case 11: if (mode == 0) { ret = IntegerPropertyEditor.make(new Property(this, index, "Banner Height")); } else if (mode == 1) { ret = new Integer(this.getBannerHeight()); } else if (mode == 2) { this.setBannerHeight((Integer)value); this.setupAdBanner(); } break; case 12: if (mode == 0) { ret = StringPropertyEditor.make(new Property(this, index, "Ad Banner URL")); } else if (mode == 1) { ret = this.getBannerURL(); } else if (mode == 2) { String name = (String)value; this.setBannerURL(name); } break; case 13: if (mode == 0) { ret = BooleanPropertyEditor.make(new Property(this, index, "Has Clickable Ad Cube"), "No", "Yes"); } else if (mode == 1) { ret = new Boolean(this.getHasClickableAdCube()); } else if (mode == 2) { this.setHasClickableAdCube((Boolean)value); } break; case 14: if (mode == 0) { ret = BooleanPropertyEditor.make(new Property(this, index, "Ad Cube image format"), "CMP", "GIF"); } else if (mode == 1) { ret = new Boolean(this.getAdCubeFormatIsGif()); } else if (mode == 2) { this.setAdCubeFormatIsGif((Boolean)value); } break; case 15: if (mode == 0) { ret = StringPropertyEditor.make(new Property(this, index, "Ad cube base URL")); } else if (mode == 1) { ret = this.getAdCubeBaseURL(); } else if (mode == 2) { String name = (String)value; this.setAdCubeBaseURL(name); } break; case 16: if (mode == 0) { ret = StringPropertyEditor.make(new Property(this, index, "Ad cube default click URL")); } else if (mode == 1) { ret = this.getDefaultAdCubeURL(); } else if (mode == 2) { String name = (String)value; this.setDefaultAdCubeURL(name); } break; default: ret = super.properties(index, offset + 17, mode, value); } return ret; } @Override public void saveState(Saver s) throws IOException { s.saveVersion(13, classCookie); super.saveState(s); s.saveString(this.defaultRoomName); URL.save(s, this.desiredWorldServerURL); s.saveInt(this.timeoutAge); s.saveBoolean(this.getMultiuser()); s.saveBoolean(this.getCourtesyVIP()); s.saveBoolean(this.getForceHuman()); s.saveBoolean(this.getHasAdBanner()); s.saveInt(this.getBannerWidth()); s.saveInt(this.getBannerHeight()); s.saveString(this.getBannerURL()); s.saveBoolean(this.getHasClickableAdCube()); s.saveBoolean(this.getAdCubeFormatIsGif()); s.saveString(this.getAdCubeBaseURL()); s.saveString(this.getDefaultAdCubeURL()); s.save(this.roomHash); } @Override public void restoreState(Restorer r) throws IOException, TooNewException { URLSelfLoader.immediateLoad(this, r); } private void restoreOldURL(Restorer r) throws IOException { String s = r.restoreString(); URL url; if (s == null || s.equals("UNSHARED")) { url = null; } else if (!s.endsWith(".console")) { url = Console.makeServerURL(s); } else { url = URL.restore(r, s, null); } if (url == null) { url = defaultServerURL; } else { this.setMultiuser(true); } this.setWorldServerURL(url); } public int restorePreRooms(Restorer r) throws IOException, TooNewException { int version = r.restoreVersion(classCookie); switch (version) { case 0: r.setOldFlag(); this.setName(r.restoreString()); this.defaultRoomName = r.restoreString(); this.restoreOldURL(r); this.roomHash = (Hashtable)r.restore(false); break; case 1: case 3: r.setOldFlag(); super.restoreState(r); this.defaultRoomName = r.restoreString(); this.restoreOldURL(r); this.roomHash = (Hashtable)r.restore(false); break; case 2: r.setOldFlag(); super.restoreState(r); this.defaultRoomName = r.restoreString(); this.restoreOldURL(r); r.restoreString(); this.roomHash = (Hashtable)r.restore(false); break; case 4: super.restoreState(r); this.defaultRoomName = r.restoreString(); this.restoreOldURL(r); this.roomHash = (Hashtable)r.restore(false); break; case 5: super.restoreState(r); this.defaultRoomName = r.restoreString(); this.restoreOldURL(r); this.timeoutAge = r.restoreInt(); this.roomHash = (Hashtable)r.restore(false); break; case 6: super.restoreState(r); this.defaultRoomName = r.restoreString(); this.restoreOldURL(r); this.timeoutAge = r.restoreInt(); r.restoreBoolean(); this.roomHash = (Hashtable)r.restore(false); break; case 7: super.restoreState(r); this.defaultRoomName = r.restoreString(); URL url = URL.restore(r); if (url == null) { url = defaultServerURL; } else { this.setMultiuser(true); } this.setWorldServerURL(url); this.timeoutAge = r.restoreInt(); r.restoreBoolean(); this.roomHash = (Hashtable)r.restore(false); break; case 8: case 9: case 10: case 11: case 12: case 13: super.restoreState(r); this.defaultRoomName = r.restoreString(); this.setWorldServerURL(URL.restore(r)); this.timeoutAge = r.restoreInt(); this.setMultiuser(r.restoreBoolean()); if (version > 9) { this.setCourtesyVIP(r.restoreBoolean()); } if (version > 10) { this.setForceHuman(r.restoreBoolean()); } if (version > 11) { this.setHasAdBanner(r.restoreBoolean()); this.setBannerWidth(r.restoreInt()); this.setBannerHeight(r.restoreInt()); this.setBannerURL(r.restoreString()); } if (version > 12) { this.setHasClickableAdCube(r.restoreBoolean()); this.setAdCubeFormatIsGif(r.restoreBoolean()); this.setAdCubeBaseURL(r.restoreString()); this.setDefaultAdCubeURL(r.restoreString()); } this.roomHash = (Hashtable)r.restore(false); break; default: throw new TooNewException(); } Enumeration e = this.roomHash.elements(); while (e.hasMoreElements()) { this.roomList.addElement(e.nextElement()); } if (version < 9 && this.timeoutAge == 60000) { this.timeoutAge = 15000; } return version; } @Override public Object clone() { World newWorld = (World)super.clone(); int worldNum = 1; String newname; URL key; do { newname = "World" + worldNum++; key = URL.make("session:" + newname + ".world"); } while (worldHash.containsKey(key)); newWorld.setName(newname); newWorld.setSourceURL(key); return newWorld; } @Override public int incRestore(int state, Restorer r, URLSelfLoader p) throws Exception { switch (state) { case 0: p.itemp2 = this.restorePreRooms(r); p.itemp1 = this.roomHash.restoreCount(r); case 1: if (--p.itemp1 >= 0) { this.roomHash.restoreEntry(r); return 1; } else { if (p.itemp2 == 4) { this.timeoutAge = r.restoreInt(); if (this.timeoutAge == 900000 || this.timeoutAge == 60000) { this.timeoutAge = 15000; } } if (r.version() < 3) { return -1; } } case 2: case 3: return this.finishRestore(state, r.version() != Saver.version() || r.oldFlag(), p.getURL()); default: assert false; return -1; } } public int finishRestore(int state, boolean oldFlag, URL url) throws Exception { switch (state) { case 0: case 1: this.tmpenum = this.roomHash.elements(); this.roomHash = new Hashtable(); case 2: if (this.tmpenum.hasMoreElements()) { Room rm = this.tmpenum.nextElement(); this.addRoom(rm); return 2; } else { this.tmpenum = null; } case 3: if (this.console == null && this.loadErr == null) { return 3; } else { if (this.loadErr != null) { throw new IOException(this.loadErr); } this.markInitialized(); return -1; } default: assert false; return -1; } } @Override public void postRestore(int version) { super.postRestore(version); if (version <= 2) { int state = 0; try { while ((state = this.finishRestore(state, true, URL.make("error:This file"))) != -1) { } } catch (Exception var4) { var4.printStackTrace(System.out); assert false; } } } public Console getConsole() { return this.console; } @Override public void loadedURLSelf(URLSelf o, URL url, String err) { if (err == null && o instanceof Console) { Console oldConsole = this.console; this.console = (Console)o; if (oldConsole != null) { Galaxy oldGalaxy = oldConsole.getGalaxy(); Galaxy galaxy = this.console.getGalaxy(); assert oldGalaxy != null; assert galaxy != null; if (oldGalaxy != galaxy) { oldGalaxy.forceObjectRereg(); } oldConsole.decRef(); } this.worldServerURL = url; if (Pilot.getActive() != null && Pilot.getActive().getWorld() == this) { Pilot.changeActiveRoom(Pilot.getActive().getRoom()); } } else { if (err == null) { Object[] arguments = new Object[]{new String("" + url)}; Console.println(MessageFormat.format(Console.message("no-world"), arguments)); o.decRef(); } Console.println(Console.message("cant-load") + err); Console.load(null, this); } } public boolean getCourtesyVIP() { return this.isCourtesyVIP; } private void setCourtesyVIP(boolean b) { this.isCourtesyVIP = b; } public boolean getForceHuman() { return this.isForceHuman; } private void setForceHuman(boolean b) { this.isForceHuman = b; } public boolean getHasAdBanner() { return this.hasAdBanner; } public void setHasAdBanner(boolean b) { this.hasAdBanner = b; } public int getBannerWidth() { return this.adBannerWidth; } public void setBannerWidth(int i) { this.adBannerWidth = i; } public int getBannerHeight() { return this.adBannerHeight; } public void setBannerHeight(int i) { this.adBannerHeight = i; } public String getBannerURL() { return this.adBannerURL; } public void setBannerURL(String s) { this.adBannerURL = s; } public void setupAdBanner() { if (theAdBanner != null) { theAdBanner.detach(); theAdBanner = null; } if (this.hasAdBanner) { theAdBanner = new AdBanner(this.adBannerWidth, this.adBannerHeight, this.adBannerURL); } } private boolean getMultiuser() { return this.isMultiuser; } private void setMultiuser(boolean b) { this.isMultiuser = b; this.setWorldServerURL(this.desiredWorldServerURL); } public World setWorldServerURL(URL s) { this.desiredWorldServerURL = s; String i = s.getInternal(); if (i.startsWith("worldserver://www.3dcd.com") && NetUpdate.overrideWorldServer != null) { i = i.substring(26); if (i.startsWith(":") && NetUpdate.overrideWorldServer.indexOf(58, 13) >= 0) { int j = 1; while (j < i.length() && Character.isDigit(i.charAt(j))) { j++; } i = i.substring(j); } s = URL.make(NetUpdate.overrideWorldServer + i); } this.loadErr = null; Console.load(this.isMultiuser ? s : null, this); return this; } public static Enumeration getWorlds() { return worldList.elements(); } }