mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-05 23:22:47 +00:00
Fixed issue launching client specific server
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.l2jserver.service.core.vfs;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -67,16 +68,27 @@ public class Java7VFSService extends
|
||||
|
||||
@Override
|
||||
public Path resolve(String path) {
|
||||
return resolve(Paths.get(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path resolve(Path path) {
|
||||
log.debug("Resolving file {}", path);
|
||||
return root.resolve(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path resolveDataFile(String path) {
|
||||
return resolveDataFile(Paths.get(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path resolveDataFile(Path path) {
|
||||
log.debug("Resolving data file {}", path);
|
||||
return dataRoot.resolve(path);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doStop() throws ServiceStopException {
|
||||
root = null;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.l2jserver.service.core.vfs;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -63,7 +64,7 @@ public class TrueZipVFSService extends
|
||||
|
||||
@Override
|
||||
protected void doStart() throws ServiceStartException {
|
||||
root = new TPath(config.getRoot().toAbsolutePath());
|
||||
root = new TPath(config.getRoot().normalize());
|
||||
log.debug("Root path is {}", root);
|
||||
|
||||
dataRoot = root.resolve(config.getDataPath());
|
||||
@@ -72,12 +73,22 @@ public class TrueZipVFSService extends
|
||||
|
||||
@Override
|
||||
public Path resolve(String path) {
|
||||
return resolve(Paths.get(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path resolve(Path path) {
|
||||
log.debug("Resolving file {}", path);
|
||||
return root.resolve(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path resolveDataFile(String path) {
|
||||
return resolveDataFile(Paths.get(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path resolveDataFile(Path path) {
|
||||
log.debug("Resolving data file {}", path);
|
||||
return dataRoot.resolve(path);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,18 @@ public interface VFSService extends Service {
|
||||
* @return the resolved file. Will return null if could not resolve.
|
||||
*/
|
||||
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
|
||||
@@ -51,4 +63,17 @@ public interface VFSService extends Service {
|
||||
* @return the resolved file. Will return null if could not resolve.
|
||||
*/
|
||||
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
|
||||
/derby.log
|
||||
/services.xml
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
*/
|
||||
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.RandomAccessFile;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.SeekableByteChannel;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -35,6 +39,7 @@ import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
import com.l2jserver.service.core.vfs.VFSService;
|
||||
import com.l2jserver.service.game.character.CharacterService;
|
||||
import com.l2jserver.service.game.world.WorldService;
|
||||
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>
|
||||
*/
|
||||
@Depends({ CharacterService.class, WorldService.class })
|
||||
@Depends({ VFSService.class, CharacterService.class, WorldService.class })
|
||||
public class MapperPathingService extends AbstractService implements
|
||||
PathingService {
|
||||
/**
|
||||
* 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
|
||||
@@ -70,28 +75,35 @@ public class MapperPathingService extends AbstractService implements
|
||||
* The {@link WorldService} event dispatcher
|
||||
*/
|
||||
private final WorldEventDispatcherService eventDispatcher;
|
||||
/**
|
||||
* The {@link VFSService} implementation
|
||||
*/
|
||||
private final VFSService vfsService;
|
||||
|
||||
/**
|
||||
* The database channel, will remain open until service is stopped.
|
||||
*/
|
||||
private FileChannel channel;
|
||||
private SeekableByteChannel channel;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param eventDispatcher
|
||||
* the world event dispatcher
|
||||
* @param vfsService the VFS service implementation
|
||||
*/
|
||||
@Inject
|
||||
public MapperPathingService(WorldEventDispatcherService eventDispatcher) {
|
||||
public MapperPathingService(WorldEventDispatcherService eventDispatcher,
|
||||
VFSService vfsService) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.vfsService = vfsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart() throws ServiceStartException {
|
||||
try {
|
||||
this.channel = new RandomAccessFile(file, "rw").getChannel();
|
||||
this.channel.position(file.length());
|
||||
final java.nio.file.Path dbFile = vfsService.resolveDataFile(file);
|
||||
this.channel = Files.newByteChannel(dbFile, CREATE, APPEND, WRITE);
|
||||
} catch (IOException e) {
|
||||
throw new ServiceStartException(
|
||||
"Could not open pathing database file", e);
|
||||
@@ -105,7 +117,7 @@ public class MapperPathingService extends AbstractService implements
|
||||
.fromCoordinate(point.getCoordinate());
|
||||
try {
|
||||
channel.write(struct.getByteBuffer());
|
||||
channel.force(true);
|
||||
//channel.force(true);
|
||||
} catch (IOException 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"
|
||||
implementation="com.l2jserver.service.core.vfs.TrueZipVFSService">
|
||||
<!-- 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
|
||||
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. -->
|
||||
@@ -7,6 +7,10 @@
|
||||
<directory>${project.parent.basedir}/distribution</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.parent.basedir}/distribution</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
|
||||
Reference in New Issue
Block a user