mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
Fixed issue launching client specific server
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package com.l2jserver.service.core.vfs;
|
package com.l2jserver.service.core.vfs;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -67,16 +68,27 @@ public class Java7VFSService extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path resolve(String path) {
|
public Path resolve(String path) {
|
||||||
|
return resolve(Paths.get(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path resolve(Path path) {
|
||||||
log.debug("Resolving file {}", path);
|
log.debug("Resolving file {}", path);
|
||||||
return root.resolve(path);
|
return root.resolve(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path resolveDataFile(String path) {
|
public Path resolveDataFile(String path) {
|
||||||
|
return resolveDataFile(Paths.get(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path resolveDataFile(Path path) {
|
||||||
log.debug("Resolving data file {}", path);
|
log.debug("Resolving data file {}", path);
|
||||||
return dataRoot.resolve(path);
|
return dataRoot.resolve(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStop() throws ServiceStopException {
|
protected void doStop() throws ServiceStopException {
|
||||||
root = null;
|
root = null;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.l2jserver.service.core.vfs;
|
package com.l2jserver.service.core.vfs;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -63,7 +64,7 @@ public class TrueZipVFSService extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws ServiceStartException {
|
protected void doStart() throws ServiceStartException {
|
||||||
root = new TPath(config.getRoot().toAbsolutePath());
|
root = new TPath(config.getRoot().normalize());
|
||||||
log.debug("Root path is {}", root);
|
log.debug("Root path is {}", root);
|
||||||
|
|
||||||
dataRoot = root.resolve(config.getDataPath());
|
dataRoot = root.resolve(config.getDataPath());
|
||||||
@@ -72,12 +73,22 @@ public class TrueZipVFSService extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path resolve(String path) {
|
public Path resolve(String path) {
|
||||||
|
return resolve(Paths.get(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path resolve(Path path) {
|
||||||
log.debug("Resolving file {}", path);
|
log.debug("Resolving file {}", path);
|
||||||
return root.resolve(path);
|
return root.resolve(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path resolveDataFile(String path) {
|
public Path resolveDataFile(String path) {
|
||||||
|
return resolveDataFile(Paths.get(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path resolveDataFile(Path path) {
|
||||||
log.debug("Resolving data file {}", path);
|
log.debug("Resolving data file {}", path);
|
||||||
return dataRoot.resolve(path);
|
return dataRoot.resolve(path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,18 @@ public interface VFSService extends Service {
|
|||||||
*/
|
*/
|
||||||
Path resolve(String path);
|
Path resolve(String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves an file. If the file cannot be resolved, null will be returned.
|
||||||
|
* <p>
|
||||||
|
* Please note that even if the file DOES NOT exists a valid object will be
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
* the file path
|
||||||
|
* @return the resolved file. Will return null if could not resolve.
|
||||||
|
*/
|
||||||
|
Path resolve(Path path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves an file inside the data storage file system. If the file cannot
|
* Resolves an file inside the data storage file system. If the file cannot
|
||||||
* be resolved, null will be returned.
|
* be resolved, null will be returned.
|
||||||
@@ -51,4 +63,17 @@ public interface VFSService extends Service {
|
|||||||
* @return the resolved file. Will return null if could not resolve.
|
* @return the resolved file. Will return null if could not resolve.
|
||||||
*/
|
*/
|
||||||
Path resolveDataFile(String path);
|
Path resolveDataFile(String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves an file inside the data storage file system. If the file cannot
|
||||||
|
* be resolved, null will be returned.
|
||||||
|
* <p>
|
||||||
|
* Please note that, differently from {@link #resolve(String)}, if the file
|
||||||
|
* does not exists, <code>null</code> is returned.
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
* the file path
|
||||||
|
* @return the resolved file. Will return null if could not resolve.
|
||||||
|
*/
|
||||||
|
Path resolveDataFile(Path path);
|
||||||
}
|
}
|
||||||
|
|||||||
1
l2jserver2-gameserver/.gitignore
vendored
1
l2jserver2-gameserver/.gitignore
vendored
@@ -1,3 +1,2 @@
|
|||||||
/log
|
/log
|
||||||
/derby.log
|
/derby.log
|
||||||
/services.xml
|
|
||||||
|
|||||||
@@ -16,10 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jserver.service.game.map.pathing;
|
package com.l2jserver.service.game.map.pathing;
|
||||||
|
|
||||||
import java.io.File;
|
import static java.nio.file.StandardOpenOption.APPEND;
|
||||||
|
import static java.nio.file.StandardOpenOption.CREATE;
|
||||||
|
import static java.nio.file.StandardOpenOption.WRITE;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.nio.channels.SeekableByteChannel;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
@@ -35,6 +39,7 @@ import com.l2jserver.service.AbstractService;
|
|||||||
import com.l2jserver.service.AbstractService.Depends;
|
import com.l2jserver.service.AbstractService.Depends;
|
||||||
import com.l2jserver.service.ServiceStartException;
|
import com.l2jserver.service.ServiceStartException;
|
||||||
import com.l2jserver.service.ServiceStopException;
|
import com.l2jserver.service.ServiceStopException;
|
||||||
|
import com.l2jserver.service.core.vfs.VFSService;
|
||||||
import com.l2jserver.service.game.character.CharacterService;
|
import com.l2jserver.service.game.character.CharacterService;
|
||||||
import com.l2jserver.service.game.world.WorldService;
|
import com.l2jserver.service.game.world.WorldService;
|
||||||
import com.l2jserver.service.game.world.event.TypedWorldListener;
|
import com.l2jserver.service.game.world.event.TypedWorldListener;
|
||||||
@@ -53,13 +58,13 @@ import com.l2jserver.util.geometry.Point3D;
|
|||||||
*
|
*
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
@Depends({ CharacterService.class, WorldService.class })
|
@Depends({ VFSService.class, CharacterService.class, WorldService.class })
|
||||||
public class MapperPathingService extends AbstractService implements
|
public class MapperPathingService extends AbstractService implements
|
||||||
PathingService {
|
PathingService {
|
||||||
/**
|
/**
|
||||||
* The database file for the pathing engine
|
* The database file for the pathing engine
|
||||||
*/
|
*/
|
||||||
private static final File file = new File("data/pathing.db");
|
private static final java.nio.file.Path file = Paths.get("pathing.db");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The logger
|
* The logger
|
||||||
@@ -70,28 +75,35 @@ public class MapperPathingService extends AbstractService implements
|
|||||||
* The {@link WorldService} event dispatcher
|
* The {@link WorldService} event dispatcher
|
||||||
*/
|
*/
|
||||||
private final WorldEventDispatcherService eventDispatcher;
|
private final WorldEventDispatcherService eventDispatcher;
|
||||||
|
/**
|
||||||
|
* The {@link VFSService} implementation
|
||||||
|
*/
|
||||||
|
private final VFSService vfsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database channel, will remain open until service is stopped.
|
* The database channel, will remain open until service is stopped.
|
||||||
*/
|
*/
|
||||||
private FileChannel channel;
|
private SeekableByteChannel channel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
*
|
*
|
||||||
* @param eventDispatcher
|
* @param eventDispatcher
|
||||||
* the world event dispatcher
|
* the world event dispatcher
|
||||||
|
* @param vfsService the VFS service implementation
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public MapperPathingService(WorldEventDispatcherService eventDispatcher) {
|
public MapperPathingService(WorldEventDispatcherService eventDispatcher,
|
||||||
|
VFSService vfsService) {
|
||||||
this.eventDispatcher = eventDispatcher;
|
this.eventDispatcher = eventDispatcher;
|
||||||
|
this.vfsService = vfsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws ServiceStartException {
|
protected void doStart() throws ServiceStartException {
|
||||||
try {
|
try {
|
||||||
this.channel = new RandomAccessFile(file, "rw").getChannel();
|
final java.nio.file.Path dbFile = vfsService.resolveDataFile(file);
|
||||||
this.channel.position(file.length());
|
this.channel = Files.newByteChannel(dbFile, CREATE, APPEND, WRITE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceStartException(
|
throw new ServiceStartException(
|
||||||
"Could not open pathing database file", e);
|
"Could not open pathing database file", e);
|
||||||
@@ -105,7 +117,7 @@ public class MapperPathingService extends AbstractService implements
|
|||||||
.fromCoordinate(point.getCoordinate());
|
.fromCoordinate(point.getCoordinate());
|
||||||
try {
|
try {
|
||||||
channel.write(struct.getByteBuffer());
|
channel.write(struct.getByteBuffer());
|
||||||
channel.force(true);
|
//channel.force(true);
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
log.warn("Error writing pathing file!", e1);
|
log.warn("Error writing pathing file!", e1);
|
||||||
}
|
}
|
||||||
|
|||||||
1
l2jserver2-gameserver/l2jserver2-gameserver-freya/.gitignore
vendored
Normal file
1
l2jserver2-gameserver/l2jserver2-gameserver-freya/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/services.xml
|
||||||
0
l2jserver2-gameserver/distribution/services.xml → l2jserver2-gameserver/l2jserver2-gameserver-freya/distribution/services.xml
Normal file → Executable file
0
l2jserver2-gameserver/distribution/services.xml → l2jserver2-gameserver/l2jserver2-gameserver-freya/distribution/services.xml
Normal file → Executable file
2
l2jserver2-gameserver/services-sample.xml → l2jserver2-gameserver/l2jserver2-gameserver-freya/services-sample.xml
Normal file → Executable file
2
l2jserver2-gameserver/services-sample.xml → l2jserver2-gameserver/l2jserver2-gameserver-freya/services-sample.xml
Normal file → Executable file
@@ -35,7 +35,7 @@
|
|||||||
<service interface="com.l2jserver.service.core.vfs.VFSService"
|
<service interface="com.l2jserver.service.core.vfs.VFSService"
|
||||||
implementation="com.l2jserver.service.core.vfs.TrueZipVFSService">
|
implementation="com.l2jserver.service.core.vfs.TrueZipVFSService">
|
||||||
<!-- Configures the root of the server data. Where all the files are placed. -->
|
<!-- Configures the root of the server data. Where all the files are placed. -->
|
||||||
<fileSystem root="./">
|
<fileSystem root="../">
|
||||||
<!-- The "data file system" location. There, templates, static data and
|
<!-- The "data file system" location. There, templates, static data and
|
||||||
several other important files are located. This can be a zip or a directory. -->
|
several other important files are located. This can be a zip or a directory. -->
|
||||||
<!-- The "data file system" is relative to the file system root. -->
|
<!-- The "data file system" is relative to the file system root. -->
|
||||||
@@ -7,6 +7,10 @@
|
|||||||
<directory>${project.parent.basedir}/distribution</directory>
|
<directory>${project.parent.basedir}/distribution</directory>
|
||||||
<outputDirectory>/</outputDirectory>
|
<outputDirectory>/</outputDirectory>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.parent.basedir}/distribution</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
</fileSets>
|
</fileSets>
|
||||||
<files>
|
<files>
|
||||||
<file>
|
<file>
|
||||||
|
|||||||
Reference in New Issue
Block a user