forked from BLOCKFANTASY/LOOHP-Limbo
Updated pom.xml, handles interrupt signal
This commit is contained in:
parent
201bafcc87
commit
5be44b597a
111
pom.xml
111
pom.xml
|
|
@ -2,9 +2,23 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.loohp</groupId>
|
<groupId>com.loohp.limbo</groupId>
|
||||||
<artifactId>Limbo</artifactId>
|
<artifactId>Limbo</artifactId>
|
||||||
<version>0.4.0-ALPHA</version>
|
<name>Limbo</name>
|
||||||
|
<version>0.4.1-ALPHA</version>
|
||||||
|
|
||||||
|
<description>Standalone Limbo Minecraft Server.</description>
|
||||||
|
<url>https://github.com/LOOHP/Limbo</url>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.build.number></project.build.number>
|
||||||
|
<project.fullVersion>${project.version}</project.fullVersion>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
@ -50,10 +64,98 @@
|
||||||
<encoding>ISO-8859-1</encoding>
|
<encoding>ISO-8859-1</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnError>false</failOnError>
|
||||||
|
<encoding>ISO-8859-1</encoding>
|
||||||
|
<doctitle>Limbo JavaDocs</doctitle>
|
||||||
|
<windowtitle>Limbo JavaDocs</windowtitle>
|
||||||
|
<additionalOptions>
|
||||||
|
<additionalOption>-Xdoclint:none</additionalOption>
|
||||||
|
</additionalOptions>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>aggregate</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<finalName>${project.artifactId}-${project.version}-1.16.5</finalName>
|
<finalName>${project.artifactId}-${project.version}-1.16.5</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>jenkins</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>env.BUILD_NUMBER</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<project.build.number>-b${env.BUILD_NUMBER}</project.build.number>
|
||||||
|
<!--<project.fullVersion>${project.version}${project.build.number}</project.fullVersion> -->
|
||||||
|
<project.fullVersion>${project.version}</project.fullVersion>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>release-sign-artifacts</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>performRelease</name>
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<project.fullVersion>${project.version}</project.fullVersion>
|
||||||
|
</properties>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
|
|
@ -117,9 +219,4 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -20,10 +20,12 @@ import org.fusesource.jansi.Ansi;
|
||||||
import org.fusesource.jansi.Ansi.Attribute;
|
import org.fusesource.jansi.Ansi.Attribute;
|
||||||
import org.jline.reader.Candidate;
|
import org.jline.reader.Candidate;
|
||||||
import org.jline.reader.Completer;
|
import org.jline.reader.Completer;
|
||||||
|
import org.jline.reader.EndOfFileException;
|
||||||
import org.jline.reader.LineReader;
|
import org.jline.reader.LineReader;
|
||||||
import org.jline.reader.LineReader.SuggestionType;
|
import org.jline.reader.LineReader.SuggestionType;
|
||||||
import org.jline.reader.LineReaderBuilder;
|
import org.jline.reader.LineReaderBuilder;
|
||||||
import org.jline.reader.ParsedLine;
|
import org.jline.reader.ParsedLine;
|
||||||
|
import org.jline.reader.UserInterruptException;
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
import org.jline.terminal.TerminalBuilder;
|
import org.jline.terminal.TerminalBuilder;
|
||||||
|
|
||||||
|
|
@ -85,7 +87,7 @@ public class Console implements CommandSender {
|
||||||
|
|
||||||
reader = new ConsoleReader(in, out);
|
reader = new ConsoleReader(in, out);
|
||||||
reader.setExpandEvents(false);
|
reader.setExpandEvents(false);
|
||||||
|
reader.setHandleUserInterrupt(false);
|
||||||
|
|
||||||
terminal = TerminalBuilder.builder().streams(in, out).system(true).jansi(true).build();
|
terminal = TerminalBuilder.builder().streams(in, out).system(true).jansi(true).build();
|
||||||
tabReader = LineReaderBuilder.builder().terminal(terminal).completer(new Completer() {
|
tabReader = LineReaderBuilder.builder().terminal(terminal).completer(new Completer() {
|
||||||
|
|
@ -152,10 +154,16 @@ public class Console implements CommandSender {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
String command = tabReader.readLine(PROMPT).trim();
|
try {
|
||||||
if (command.length() > 0) {
|
String command = tabReader.readLine(PROMPT).trim();
|
||||||
String[] input = CustomStringUtils.splitStringToArgs(command);
|
if (command.length() > 0) {
|
||||||
new Thread(() -> Limbo.getInstance().dispatchCommand(this, input)).start();
|
String[] input = CustomStringUtils.splitStringToArgs(command);
|
||||||
|
new Thread(() -> Limbo.getInstance().dispatchCommand(this, input)).start();
|
||||||
|
}
|
||||||
|
} catch (UserInterruptException e) {
|
||||||
|
System.exit(0);
|
||||||
|
} catch (EndOfFileException e) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,10 @@ public class Limbo {
|
||||||
|
|
||||||
metrics = new Metrics();
|
metrics = new Metrics();
|
||||||
|
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
|
Limbo.getInstance().terminate();
|
||||||
|
}));
|
||||||
|
|
||||||
console.run();
|
console.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -496,7 +500,7 @@ public class Limbo {
|
||||||
return String.join("\00", begin, "127", version, String.join("", Arrays.asList(motd).stream().map(each -> each.toLegacyText()).collect(Collectors.toList())), String.valueOf(playersOnline), String.valueOf(maxPlayers));
|
return String.join("\00", begin, "127", version, String.join("", Arrays.asList(motd).stream().map(each -> each.toLegacyText()).collect(Collectors.toList())), String.valueOf(playersOnline), String.valueOf(maxPlayers));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopServer() {
|
protected void terminate() {
|
||||||
isRunning.set(false);
|
isRunning.set(false);
|
||||||
console.sendMessage("Stopping Server...");
|
console.sendMessage("Stopping Server...");
|
||||||
|
|
||||||
|
|
@ -520,6 +524,9 @@ public class Limbo {
|
||||||
|
|
||||||
console.sendMessage("Server closed");
|
console.sendMessage("Server closed");
|
||||||
console.logs.close();
|
console.logs.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopServer() {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,37 +293,26 @@ public class ClientConnection extends Thread {
|
||||||
|
|
||||||
TimeUnit.MILLISECONDS.sleep(500);
|
TimeUnit.MILLISECONDS.sleep(500);
|
||||||
|
|
||||||
ServerProperties p = Limbo.getInstance().getServerProperties();
|
ServerProperties properties = Limbo.getInstance().getServerProperties();
|
||||||
Location s = p.getWorldSpawn();
|
Location worldSpawn = properties.getWorldSpawn();
|
||||||
|
|
||||||
PlayerJoinEvent evt = new PlayerJoinEvent(player, s);
|
PlayerJoinEvent joinEvent = Limbo.getInstance().getEventsManager().callEvent(new PlayerJoinEvent(player, worldSpawn));
|
||||||
Limbo.getInstance().getEventsManager().callEvent(evt);
|
worldSpawn = joinEvent.getSpawnLocation();
|
||||||
s = evt.getSpawnLocation();
|
World world = worldSpawn.getWorld();
|
||||||
|
|
||||||
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, p.getDefaultGamemode(), Limbo.getInstance().getWorlds().stream().map(each -> new NamespacedKey(each.getName()).toString()).collect(Collectors.toList()).toArray(new String[Limbo.getInstance().getWorlds().size()]), Limbo.getInstance().getDimensionRegistry().getCodec(), p.getWorldSpawn().getWorld(), 0, (byte) p.getMaxPlayers(), 8, p.isReducedDebugInfo(), true, false, true);
|
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, properties.getDefaultGamemode(), Limbo.getInstance().getWorlds().stream().map(each -> new NamespacedKey(each.getName()).toString()).collect(Collectors.toList()).toArray(new String[Limbo.getInstance().getWorlds().size()]), Limbo.getInstance().getDimensionRegistry().getCodec(), world, 0, (byte) properties.getMaxPlayers(), 8, properties.isReducedDebugInfo(), true, false, true);
|
||||||
sendPacket(join);
|
sendPacket(join);
|
||||||
Limbo.getInstance().getUnsafe().setPlayerGameModeSilently(player, p.getDefaultGamemode());
|
Limbo.getInstance().getUnsafe().setPlayerGameModeSilently(player, properties.getDefaultGamemode());
|
||||||
|
|
||||||
//PacketPlayOutKeepAlive alive = new PacketPlayOutKeepAlive((long) (Math.random() * Long.MAX_VALUE));
|
|
||||||
|
|
||||||
World world = s.getWorld();
|
|
||||||
|
|
||||||
player.playerInteractManager.update();
|
player.playerInteractManager.update();
|
||||||
|
|
||||||
SkinResponse skinresponce = isBungeecord && bungeeSkin != null ? bungeeSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName());
|
SkinResponse skinresponce = isBungeecord && bungeeSkin != null ? bungeeSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName());
|
||||||
PlayerSkinProperty skin = skinresponce != null ? new PlayerSkinProperty(skinresponce.getSkin(), skinresponce.getSignature()) : null;
|
PlayerSkinProperty skin = skinresponce != null ? new PlayerSkinProperty(skinresponce.getSkin(), skinresponce.getSignature()) : null;
|
||||||
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(PlayerInfoAction.ADD_PLAYER, player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), Optional.ofNullable(skin), p.getDefaultGamemode(), 0, false, Optional.empty()));
|
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(PlayerInfoAction.ADD_PLAYER, player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty()));
|
||||||
sendPacket(info);
|
sendPacket(info);
|
||||||
/*
|
|
||||||
for (ClientConnection client : Limbo.getInstance().getServerConnection().getClients()) {
|
|
||||||
DataOutputStream other = new DataOutputStream(client.getSocket().getOutputStream());
|
|
||||||
DataTypeIO.writeVarInt(other, packetByte.length);
|
|
||||||
other.write(packetByte);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Set<PlayerAbilityFlags> flags = new HashSet<>();
|
Set<PlayerAbilityFlags> flags = new HashSet<>();
|
||||||
if (p.isAllowFlight()) {
|
if (properties.isAllowFlight()) {
|
||||||
flags.add(PlayerAbilityFlags.FLY);
|
flags.add(PlayerAbilityFlags.FLY);
|
||||||
}
|
}
|
||||||
if (player.getGamemode().equals(GameMode.CREATIVE)) {
|
if (player.getGamemode().equals(GameMode.CREATIVE)) {
|
||||||
|
|
@ -340,11 +329,11 @@ public class ClientConnection extends Thread {
|
||||||
sendPacket(declare);
|
sendPacket(declare);
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(s));
|
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn));
|
||||||
sendPacket(spawnPos);
|
sendPacket(spawnPos);
|
||||||
|
|
||||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(s.getX(), s.getY(), s.getZ(), s.getYaw(), s.getPitch(), 1);
|
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1);
|
||||||
Limbo.getInstance().getUnsafe().setPlayerLocationSilently(player, new Location(world, s.getX(), s.getY(), s.getZ(), s.getYaw(), s.getPitch()));
|
Limbo.getInstance().getUnsafe().setPlayerLocationSilently(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch()));
|
||||||
sendPacket(positionLook);
|
sendPacket(positionLook);
|
||||||
|
|
||||||
player.getDataWatcher().update();
|
player.getDataWatcher().update();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue