38 Commits

Author SHA1 Message Date
LOOHP 27aae24015 Minecraft 26.1.2 2026-04-09 18:42:19 +01:00
LOOHP baf75608a3 Update README.md 2026-04-01 22:10:18 +01:00
LOOHP 3993df3017 Minecraft 26.1.1 2026-04-01 22:08:56 +01:00
LOOHP b386d97e7c Minecraft 26.1 2026-03-28 12:20:15 +00:00
LOOHP 0c625a2592 Merge pull request #105 from biubiukawa/master
Fix typo causing login failure for 1.16-1.20 clients (Vialimbo)
2026-01-24 22:50:06 +00:00
biubiukawa 2a089bf5aa Update RegistryCustom.java
Change "timelime" to "timeline".
2026-01-25 06:34:00 +08:00
LOOHP ad284544e5 Fixed terminal integration 2025-12-24 12:24:47 +00:00
LOOHP bde2c04127 Merge pull request #100 from Kas-tle/feature/performance-improvements
Performance Improvements (Update to JDK 21, Fix Scheduler Excessively Ticking, & Use Virtual Threads)
2025-12-19 00:46:24 +00:00
LOOHP 9beae66898 Refactoring 2025-12-19 00:45:40 +00:00
LOOHP 68a97ec670 Merge branch 'master' into pr/100 2025-12-19 00:20:44 +00:00
LOOHP 835caf7d71 Merge pull request #101 from Zhyren-git/fix/keepalive-timeout
Fixes player getting "Timed out" while standing still due to Keep-Alive not being sent correctly.
2025-12-18 17:00:58 +00:00
LOOHP 8ec2d34a60 Refactor 2025-12-18 16:59:52 +00:00
LOOHP 952adcfe87 Clean up 2025-12-18 16:56:44 +00:00
Zhyren-git 28d735c912 Fixed player getting "Timed out" while standing still due to Keep-Alive not being sent correctly. 2025-12-17 18:58:15 -04:00
Zhyren-git 33dacf02db Fixed player getting "Timed out" while standing still due to Keep-Alive not being sent correctly \\ Replaced return with canceling the task (oops). 2025-12-17 18:20:55 -04:00
Zhyren-git df47c40998 Fixed player getting "Timed out" while standing still due to Keep-Alive not being sent correctly. 2025-12-17 18:06:00 -04:00
Kas-tle 4939d2f9a9 Merge pull request #2 from Kas-tle/master
Merge in master (1.21.11)
2025-12-12 19:28:29 -08:00
LOOHP 0c7a78924c Update README.md 2025-12-09 16:57:32 +00:00
LOOHP 5a366404ea Minecraft 1.21.11 2025-12-09 16:56:49 +00:00
LOOHP 4f5262620a Update banner image syntax in README.md 2025-12-06 10:20:58 +00:00
LOOHP d7e25e82d9 Change banner image in README
Updated the banner image link in the README.
2025-12-06 09:40:52 +00:00
Kas-tle a7e53115ab Merge branch 'master' into feature/performance-improvements 2025-11-13 17:56:00 -08:00
LOOHP 44f89d1021 Update README.md 2025-11-13 23:27:08 +00:00
LOOHP 65ba35997f Update README.md 2025-11-13 23:25:45 +00:00
LOOHP 17c2f58069 Updated how players are counted in metrics 2025-11-09 00:05:08 +00:00
LOOHP 292f974681 Bump version 2025-10-11 10:52:16 +01:00
LOOHP 9cdfbfcfdc Minecraft 1.21.10 2025-10-08 18:38:44 +01:00
LOOHP e63226f05c Bump adventure 2025-10-06 22:49:45 +01:00
LOOHP 69d0270925 Fixed illegal file name in log files
Fixes #96
2025-10-04 11:08:43 +01:00
LOOHP 38f3c41bf5 Update README.md 2025-09-30 22:26:02 +01:00
LOOHP d8d7307fcb Minecraft 1.21.9 2025-09-30 22:24:32 +01:00
LOOHP 75191a83f7 Update pom.xml 2025-08-31 16:09:55 +01:00
LOOHP 04ed353ab9 Merge pull request #92 from danbka4z/fix/declarecommands-null
Fix: Send minimal DeclareCommands packet when no Limbo commands available
2025-08-31 16:09:27 +01:00
Danbka4Z 502aa78c3b Fix: Send minimal DeclareCommands packet when no Limbo commands available
Previously, when the command list was empty, the server returned null and did not send a DeclareCommands packet.  
This caused the client to lose the slash UI and tab completion entirely.  

Now, when there are no available commands, the server sends a minimal valid tree (only a root node with no children).  
This keeps the client UI functional while still reflecting the fact that no commands are available.
2025-08-31 17:49:37 +03:00
Joshua Castle 7d9ef7f927 Performance improvements:
- Update dependencies
- Use blocking queue for Tick.asyncTasksQueue
- Do not call removed method Thread#stop in Tick#waitAndKillThreads
- Use virtual threads for ClientConnection
- Add build action

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
2025-08-16 00:54:38 -07:00
LOOHP 94ad6d8460 Merge pull request #88 from Kas-tle/feature/prefer-limbo-yml
Prefer use of limbo.yml for plugin loading
2025-07-17 20:34:46 +01:00
LOOHP b19bba7140 Minecraft 1.21.8 2025-07-17 20:32:11 +01:00
Joshua Castle a0382bd64c Prefer use of limbo.yml ofr plugin loading
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
2025-07-14 09:22:11 -07:00
1193 changed files with 77583 additions and 48347 deletions
+6 -5
View File
@@ -1,8 +1,9 @@
# Limbo
[![Build Status](http://ci.loohpjames.com/job/Limbo/badge/icon)](http://ci.loohpjames.com/job/Limbo/) [![Build Status](http://ci.loohpjames.com/job/Limbo/badge/icon)](http://ci.loohpjames.com/job/Limbo/)
## Standalone Limbo Minecraft Server (Currently 1.21.7) # Limbo
## Standalone Limbo Minecraft Server (Currently 26.1.2)
https://www.spigotmc.org/resources/82468/ https://www.spigotmc.org/resources/82468/<br>
https://modrinth.com/mod/limbo-server
### Starting the server ### Starting the server
Use the following command lines to start the limbo server just like any other Minecraft server Use the following command lines to start the limbo server just like any other Minecraft server
@@ -18,7 +19,7 @@ IP: mc.loohpjames.com
``` ```
![Server Banner](https://api.loohpjames.com/serverbanner.png?ip=mc.loohpjames.com&width=918&name=IP:%20mc.loohpjames.com) ![Server Banner](https://api.loohpjames.com/serverbanner.png?ip=mc.loohpjames.com&width=918&name=IP:%20mc.loohpjames.com)
*** ***
### Downloads (1.17.1-1.21.7) ### Downloads (1.17.1-26.1.2)
- [Jenkins](http://ci.loohpjames.com/job/Limbo/) - [Jenkins](http://ci.loohpjames.com/job/Limbo/)
*** ***
### Offical Plugins ### Offical Plugins
@@ -52,4 +53,4 @@ It also **supports my development**, take it as an alternative way to donate whi
**https://www.bisecthosting.com/loohp** **https://www.bisecthosting.com/loohp**
![https://www.bisecthosting.com/loohp](https://www.bisecthosting.com/partners/custom-banners/fc7f7b10-8d1a-4478-a23a-8a357538a180.png) [![](https://www.bisecthosting.com/partners/custom-banners/96e11ee5-50e4-494f-854d-8c1708813abd.png)](https://www.bisecthosting.com/loohp)
+36 -44
View File
@@ -1,8 +1,8 @@
<!-- <!--
~ This file is part of Limbo. ~ This file is part of Limbo.
~ ~
~ Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> ~ Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
~ Copyright (C) 2022. Contributors ~ Copyright (C) 2026. Contributors
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
<groupId>com.loohp</groupId> <groupId>com.loohp</groupId>
<artifactId>Limbo</artifactId> <artifactId>Limbo</artifactId>
<name>Limbo</name> <name>Limbo</name>
<version>0.7.15-ALPHA</version> <version>2026.0.1-ALPHA</version>
<description>Standalone Limbo Minecraft Server.</description> <description>Standalone Limbo Minecraft Server.</description>
<url>https://github.com/LOOHP/Limbo</url> <url>https://github.com/LOOHP/Limbo</url>
@@ -34,8 +34,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number></project.build.number> <project.build.number></project.build.number>
<project.fullVersion>${project.version}</project.fullVersion> <project.fullVersion>${project.version}</project.fullVersion>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
</properties> </properties>
<build> <build>
@@ -91,17 +91,17 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.14.0</version>
<configuration> <configuration>
<source>1.8</source> <source>21</source>
<target>1.8</target> <target>21</target>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version> <version>3.11.2</version>
<configuration> <configuration>
<failOnError>false</failOnError> <failOnError>false</failOnError>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
@@ -124,7 +124,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version> <version>3.3.1</version>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
@@ -136,7 +136,7 @@
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}-1.21.7</finalName> <finalName>${project.artifactId}-${project.version}-26.1.2</finalName>
</build> </build>
<profiles> <profiles>
@@ -170,7 +170,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version> <version>3.3.1</version>
<configuration> <configuration>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
@@ -187,7 +187,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version> <version>3.11.2</version>
<configuration> <configuration>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
@@ -206,47 +206,39 @@
</profiles> </profiles>
<repositories> <repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository> <repository>
<id>maven_central</id> <id>maven_central</id>
<name>Maven Central</name> <name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2/</url> <url>https://repo.maven.apache.org/maven2/</url>
</repository> </repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.14.0</version> <version>3.18.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.Querz</groupId> <groupId>com.github.Querz</groupId>
<artifactId>NBT</artifactId> <artifactId>NBT</artifactId>
<version>5.5</version> <version>6.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.10.1</version> <version>2.13.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<version>2.3</version> <version>2.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@@ -258,58 +250,58 @@
<dependency> <dependency>
<groupId>net.md-5</groupId> <groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId> <artifactId>bungeecord-chat</artifactId>
<version>1.18-R0.1-SNAPSHOT</version> <version>1.21-R0.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-serializer</artifactId>
<version>1.21-R0.3</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId> <artifactId>adventure-text-serializer-gson</artifactId>
<version>4.23.0</version> <version>4.26.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId> <artifactId>adventure-text-serializer-legacy</artifactId>
<version>4.23.0</version> <version>4.26.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-plain</artifactId> <artifactId>adventure-text-serializer-plain</artifactId>
<version>4.23.0</version> <version>4.26.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId> <artifactId>adventure-api</artifactId>
<version>4.23.0</version> <version>4.26.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId> <artifactId>adventure-nbt</artifactId>
<version>4.23.0</version> <version>4.26.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.fusesource.jansi</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId> <artifactId>jansi</artifactId>
<version>1.18</version> <version>2.4.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jline</groupId> <groupId>org.jline</groupId>
<artifactId>jline</artifactId> <artifactId>jline</artifactId>
<version>3.16.0</version> <version>3.30.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.11</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
+14 -17
View File
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ package com.loohp.limbo;
import com.loohp.limbo.commands.CommandSender; import com.loohp.limbo.commands.CommandSender;
import com.loohp.limbo.consolegui.ConsoleTextOutput; import com.loohp.limbo.consolegui.ConsoleTextOutput;
import com.loohp.limbo.utils.CustomStringUtils; import com.loohp.limbo.utils.CustomStringUtils;
import jline.console.ConsoleReader;
import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.bossbar.BossBar; import net.kyori.adventure.bossbar.BossBar;
import net.kyori.adventure.identity.Identity; import net.kyori.adventure.identity.Identity;
@@ -45,6 +44,7 @@ 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.reader.UserInterruptException;
import org.jline.terminal.Size;
import org.jline.terminal.Terminal; import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder; import org.jline.terminal.TerminalBuilder;
@@ -76,7 +76,6 @@ public class Console implements CommandSender {
private final Terminal terminal; private final Terminal terminal;
private final LineReader tabReader; private final LineReader tabReader;
private final ConsoleReader reader;
private final InputStream in; private final InputStream in;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@@ -86,7 +85,7 @@ public class Console implements CommandSender {
protected final PrintStream logs; protected final PrintStream logs;
public Console(InputStream in, PrintStream out, PrintStream err) throws IOException { public Console(InputStream in, PrintStream out, PrintStream err) throws IOException {
String fileName = new SimpleDateFormat("yyyy'-'MM'-'dd'_'HH'-'mm'-'ss'_'zzz'.log'").format(new Date()); String fileName = new SimpleDateFormat("yyyy'-'MM'-'dd'_'HH'-'mm'-'ss'_'zzz'.log'").format(new Date()).replace(":", "");
File dir = new File("logs"); File dir = new File("logs");
dir.mkdirs(); dir.mkdirs();
File logs = new File(dir, fileName); File logs = new File(dir, fileName);
@@ -114,11 +113,7 @@ public class Console implements CommandSender {
}) : err, this.logs)); }) : err, this.logs));
this.err = System.err; this.err = System.err;
reader = new ConsoleReader(in, out); terminal = TerminalBuilder.builder().streams(in, out).jansi(true).build();
reader.setExpandEvents(false);
reader.setHandleUserInterrupt(false);
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() {
@Override @Override
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) {
@@ -129,7 +124,13 @@ public class Console implements CommandSender {
} }
} }
}).build(); }).build();
tabReader.unsetOpt(LineReader.Option.INSERT_TAB);
tabReader.setVariable(LineReader.SECONDARY_PROMPT_PATTERN, "");
tabReader.setAutosuggestion(SuggestionType.NONE); tabReader.setAutosuggestion(SuggestionType.NONE);
if (terminal.getWidth() <= 0 || terminal.getHeight() <= 0) {
terminal.setSize(new Size(80, 24));
}
} }
@Override @Override
@@ -242,13 +243,9 @@ public class Console implements CommandSender {
String date = new SimpleDateFormat("HH':'mm':'ss").format(new Date()); String date = new SimpleDateFormat("HH':'mm':'ss").format(new Date());
ConsoleTextOutput.appendText(ChatColor.stripColor("[" + date + " Info] " + message), true); ConsoleTextOutput.appendText(ChatColor.stripColor("[" + date + " Info] " + message), true);
logs.println(ChatColor.stripColor("[" + date + " Info] " + message)); logs.println(ChatColor.stripColor("[" + date + " Info] " + message));
try { terminal.writer().append("[").append(date).append(" Info] ").append(translateToConsole(message)).append("\n");
reader.getOutput().append("[" + date + " Info] " + translateToConsole(message) + "\n"); terminal.writer().flush();
reader.getOutput().flush(); unstashLine();
} catch (IOException e) {
e.printStackTrace();
}
unstashLine();
} }
protected void run() { protected void run() {
+5 -5
View File
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -132,8 +132,8 @@ public final class Limbo {
//=========================== //===========================
public final String SERVER_IMPLEMENTATION_VERSION = "1.21.7"; public final String SERVER_IMPLEMENTATION_VERSION = "26.1.2";
public final int SERVER_IMPLEMENTATION_PROTOCOL = 772; public final int SERVER_IMPLEMENTATION_PROTOCOL = 775;
public final String LIMBO_IMPLEMENTATION_VERSION; public final String LIMBO_IMPLEMENTATION_VERSION;
private final AtomicBoolean isRunning; private final AtomicBoolean isRunning;
@@ -162,7 +162,7 @@ public final class Limbo {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private Unsafe unsafe; private Unsafe unsafe;
public Limbo() throws IOException, ParseException, NumberFormatException, ClassNotFoundException, InterruptedException { public Limbo() throws IOException, ParseException, NumberFormatException, ClassNotFoundException, InterruptedException {
instance = this; instance = this;
unsafe = new Unsafe(this); unsafe = new Unsafe(this);
+3 -2
View File
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -85,6 +85,7 @@ public class Unsafe {
public void a(Player player) { public void a(Player player) {
instance.playersByName.put(player.getName(), player); instance.playersByName.put(player.getName(), player);
instance.playersByUUID.put(player.getUniqueId(), player); instance.playersByUUID.put(player.getUniqueId(), player);
instance.getMetrics().updatePlayersCount();
} }
@Deprecated @Deprecated
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -21,13 +21,13 @@ package com.loohp.limbo.consolegui;
import com.loohp.limbo.Limbo; import com.loohp.limbo.Limbo;
import java.lang.management.ManagementFactory;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class SystemInfo { public class SystemInfo {
public static void printInfo() { @SuppressWarnings("InfiniteLoopStatement")
public static void printInfo() {
if (!Limbo.noGui) { if (!Limbo.noGui) {
while (true) { while (true) {
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
@@ -47,11 +47,11 @@ public class SystemInfo {
try { try {
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
com.sun.management.OperatingSystemMXBean operatingSystemMXBean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); com.sun.management.OperatingSystemMXBean operatingSystemMXBean = (com.sun.management.OperatingSystemMXBean) java.lang.management.ManagementFactory.getOperatingSystemMXBean();
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
double processLoad = operatingSystemMXBean.getProcessCpuLoad(); double processLoad = operatingSystemMXBean.getProcessCpuLoad();
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
double systemLoad = operatingSystemMXBean.getSystemCpuLoad(); double systemLoad = operatingSystemMXBean.getCpuLoad();
int processors = runtime.availableProcessors(); int processors = runtime.availableProcessors();
sb.append("Available Processors: ").append(processors).append("\n"); sb.append("Available Processors: ").append(processors).append("\n");
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2023. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,3 +1,22 @@
/*
* This file is part of Limbo.
*
* Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2026. Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.loohp.limbo.inventory; package com.loohp.limbo.inventory;
/** /**
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,3 +1,22 @@
/*
* This file is part of Limbo.
*
* Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2026. Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.loohp.limbo.inventory; package com.loohp.limbo.inventory;
/** /**
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,3 +1,22 @@
/*
* This file is part of Limbo.
*
* Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2026. Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.loohp.limbo.inventory; package com.loohp.limbo.inventory;
/** /**
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -0,0 +1,46 @@
/*
* This file is part of Limbo.
*
* Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2026. Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.loohp.limbo.location;
import com.loohp.limbo.world.BlockPosition;
import com.loohp.limbo.world.World;
public class GlobalPos {
private final World world;
private final BlockPosition pos;
public GlobalPos(World world, BlockPosition pos) {
this.world = world;
this.pos = pos;
}
public World getWorld() {
return world;
}
public BlockPosition getPos() {
return pos;
}
public static GlobalPos from(Location location) {
return new GlobalPos(location.getWorld(), BlockPosition.from(location));
}
}
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
/** /**
@@ -49,6 +50,9 @@ import java.util.zip.GZIPOutputStream;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class Metrics { public class Metrics {
// The name of the server software
private static final String SERVER_SOFTWARE = "Limbo";
// The version of this bStats class // The version of this bStats class
public static final int B_STATS_VERSION = 1; public static final int B_STATS_VERSION = 1;
@@ -58,29 +62,15 @@ public class Metrics {
// Should failed requests be logged? // Should failed requests be logged?
private static boolean logFailedRequests = false; private static boolean logFailedRequests = false;
// The name of the server software
private final String name;
// The uuid of the server // The uuid of the server
private final String serverUUID; private final String serverUUID;
private final String limboVersion;
// A list with all custom charts // A list with all custom charts
private final List<CustomChart> charts = new ArrayList<>(); private final List<CustomChart> charts = new ArrayList<>();
/** private final AtomicInteger maxPlayerCountInPeriod = new AtomicInteger(0);
* Class constructor.
*
* @param name The name of the server software.
* @param serverUUID The uuid of the server.
* @param logFailedRequests Whether failed requests should be logged or not.
* @param logger The logger for the failed requests.
* @throws IOException
*/
public Metrics() throws IOException { public Metrics() throws IOException {
name = "Limbo";
// Get the config file // Get the config file
File configFile = new File("plugins/bStats", "config.yml"); File configFile = new File("plugins/bStats", "config.yml");
FileConfiguration config = new FileConfiguration(configFile); FileConfiguration config = new FileConfiguration(configFile);
@@ -108,8 +98,6 @@ public class Metrics {
e.printStackTrace(); e.printStackTrace();
} }
} }
limboVersion = Limbo.getInstance().LIMBO_IMPLEMENTATION_VERSION;
// Load the data // Load the data
serverUUID = config.get("serverUuid", String.class); serverUUID = config.get("serverUuid", String.class);
@@ -118,26 +106,16 @@ public class Metrics {
startSubmitting(); startSubmitting();
} }
addCustomChart(new Metrics.SingleLineChart("players", new Callable<Integer>() { addCustomChart(new Metrics.SingleLineChart("players", () -> maxPlayerCountInPeriod.getAndSet(0)));
@Override addCustomChart(new Metrics.SimplePie("limbo_version", () -> Limbo.getInstance().LIMBO_IMPLEMENTATION_VERSION));
public Integer call() throws Exception { addCustomChart(new Metrics.SimplePie("minecraftVersion", () -> Limbo.getInstance().SERVER_IMPLEMENTATION_VERSION));
return Limbo.getInstance().getPlayers().size(); }
}
}));
addCustomChart(new Metrics.SimplePie("limbo_version", new Callable<String>() {
@Override
public String call() throws Exception {
return limboVersion;
}
}));
addCustomChart(new Metrics.SimplePie("minecraftVersion", new Callable<String>() { /**
@Override * Record the max player count for the last update period.
public String call() throws Exception { */
return Limbo.getInstance().SERVER_IMPLEMENTATION_VERSION; public void updatePlayersCount() {
} maxPlayerCountInPeriod.getAndUpdate(i -> Math.max(i, Limbo.getInstance().getPlayers().size()));
}));
} }
/** /**
@@ -176,7 +154,7 @@ public class Metrics {
private JSONObject getPluginData() { private JSONObject getPluginData() {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("pluginName", name); // Append the name of the server software data.put("pluginName", SERVER_SOFTWARE); // Append the name of the server software
JSONArray customCharts = new JSONArray(); JSONArray customCharts = new JSONArray();
for (CustomChart customChart : charts) { for (CustomChart customChart : charts) {
// Add the data of the custom charts // Add the data of the custom charts
@@ -232,7 +210,7 @@ public class Metrics {
} catch (Exception e) { } catch (Exception e) {
// Something went wrong! :( // Something went wrong! :(
if (logFailedRequests) { if (logFailedRequests) {
Limbo.getInstance().getConsole().sendMessage("Could not submit stats of " + name + "\n" + e); Limbo.getInstance().getConsole().sendMessage("Could not submit stats of " + SERVER_SOFTWARE + "\n" + e);
} }
} }
} }
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -40,9 +40,11 @@ import com.loohp.limbo.file.ServerProperties;
import com.loohp.limbo.inventory.AnvilInventory; import com.loohp.limbo.inventory.AnvilInventory;
import com.loohp.limbo.inventory.Inventory; import com.loohp.limbo.inventory.Inventory;
import com.loohp.limbo.inventory.ItemStack; import com.loohp.limbo.inventory.ItemStack;
import com.loohp.limbo.location.GlobalPos;
import com.loohp.limbo.location.Location; import com.loohp.limbo.location.Location;
import com.loohp.limbo.network.protocol.packets.ClientboundFinishConfigurationPacket; import com.loohp.limbo.network.protocol.packets.ClientboundFinishConfigurationPacket;
import com.loohp.limbo.network.protocol.packets.ClientboundRegistryDataPacket; import com.loohp.limbo.network.protocol.packets.ClientboundRegistryDataPacket;
import com.loohp.limbo.network.protocol.packets.ClientboundUpdateTagsPacket;
import com.loohp.limbo.network.protocol.packets.PacketHandshakingIn; import com.loohp.limbo.network.protocol.packets.PacketHandshakingIn;
import com.loohp.limbo.network.protocol.packets.PacketIn; import com.loohp.limbo.network.protocol.packets.PacketIn;
import com.loohp.limbo.network.protocol.packets.PacketLoginInLoginStart; import com.loohp.limbo.network.protocol.packets.PacketLoginInLoginStart;
@@ -110,7 +112,6 @@ import com.loohp.limbo.utils.GameMode;
import com.loohp.limbo.utils.InventoryClickUtils; import com.loohp.limbo.utils.InventoryClickUtils;
import com.loohp.limbo.utils.MojangAPIUtils; import com.loohp.limbo.utils.MojangAPIUtils;
import com.loohp.limbo.utils.MojangAPIUtils.SkinResponse; import com.loohp.limbo.utils.MojangAPIUtils.SkinResponse;
import com.loohp.limbo.world.BlockPosition;
import com.loohp.limbo.world.BlockState; import com.loohp.limbo.world.BlockState;
import com.loohp.limbo.world.World; import com.loohp.limbo.world.World;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
@@ -149,23 +150,28 @@ import java.util.TimerTask;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ClientConnection extends Thread { public class ClientConnection implements Runnable {
private static final Key DEFAULT_HANDLER_NAMESPACE = Key.key("default"); private static final Key DEFAULT_HANDLER_NAMESPACE = Key.key("default");
private static final String BRAND_ANNOUNCE_CHANNEL = Key.key("brand").toString(); private static final String BRAND_ANNOUNCE_CHANNEL = Key.key("brand").toString();
private final Random random = new Random(); private final Random random = new Random();
private final Socket clientSocket; private final Socket clientSocket;
private final Lock packetSendLock = new ReentrantLock();
protected Channel channel; protected Channel channel;
private boolean running; private boolean running;
private volatile ClientState state; private volatile ClientState state;
private final AtomicLong lastPacketTimestamp;
private final AtomicLong lastKeepAlivePayLoad;
private final AtomicLong lastKeepAliveResponse;
private Player player; private Player player;
private TimerTask keepAliveTask; private TimerTask keepAliveTask;
private AtomicLong lastPacketTimestamp;
private AtomicLong lastKeepAlivePayLoad;
private InetAddress inetAddress; private InetAddress inetAddress;
private boolean ready; private boolean ready;
@@ -174,6 +180,7 @@ public class ClientConnection extends Thread {
this.inetAddress = clientSocket.getInetAddress(); this.inetAddress = clientSocket.getInetAddress();
this.lastPacketTimestamp = new AtomicLong(-1); this.lastPacketTimestamp = new AtomicLong(-1);
this.lastKeepAlivePayLoad = new AtomicLong(-1); this.lastKeepAlivePayLoad = new AtomicLong(-1);
this.lastKeepAliveResponse = new AtomicLong(-1);
this.channel = null; this.channel = null;
this.running = false; this.running = false;
this.ready = false; this.ready = false;
@@ -191,6 +198,10 @@ public class ClientConnection extends Thread {
this.lastKeepAlivePayLoad.set(payLoad); this.lastKeepAlivePayLoad.set(payLoad);
} }
public long getLastKeepAliveResponse() {
return lastKeepAliveResponse.get();
}
public long getLastPacketTimestamp() { public long getLastPacketTimestamp() {
return lastPacketTimestamp.get(); return lastPacketTimestamp.get();
} }
@@ -232,9 +243,14 @@ public class ClientConnection extends Thread {
sendPacket(packet); sendPacket(packet);
} }
public synchronized void sendPacket(PacketOut packet) throws IOException { public void sendPacket(PacketOut packet) throws IOException {
if (channel.writePacket(packet)) { packetSendLock.lock();
setLastPacketTimestamp(System.currentTimeMillis()); try {
if (channel.writePacket(packet)) {
setLastPacketTimestamp(System.currentTimeMillis());
}
} finally {
packetSendLock.unlock();
} }
} }
@@ -249,6 +265,9 @@ public class ClientConnection extends Thread {
} catch (IOException ignored) { } catch (IOException ignored) {
} }
try { try {
ServerProperties properties = Limbo.getInstance().getServerProperties();
String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "<ip address withheld>") + ":" + clientSocket.getPort();
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player disconnected with the reason " + PlainTextComponentSerializer.plainText().serialize(reason));
clientSocket.close(); clientSocket.close();
} catch (IOException ignored) { } catch (IOException ignored) {
} }
@@ -556,6 +575,9 @@ public class ClientConnection extends Thread {
sendPacket(registryDataPacket); sendPacket(registryDataPacket);
} }
ClientboundUpdateTagsPacket updateTagsPacket = new ClientboundUpdateTagsPacket(RegistryCustom.getRegistries());
sendPacket(updateTagsPacket);
ClientboundFinishConfigurationPacket clientboundFinishConfigurationPacket = new ClientboundFinishConfigurationPacket(); ClientboundFinishConfigurationPacket clientboundFinishConfigurationPacket = new ClientboundFinishConfigurationPacket();
sendPacket(clientboundFinishConfigurationPacket); sendPacket(clientboundFinishConfigurationPacket);
@@ -580,12 +602,12 @@ public class ClientConnection extends Thread {
ByteArrayOutputStream brandOut = new ByteArrayOutputStream(); ByteArrayOutputStream brandOut = new ByteArrayOutputStream();
DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8); DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8);
sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray()); sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray());
SkinResponse skinresponce = (isVelocityModern || isBungeeGuard || isBungeecord) && forwardedSkin != null ? forwardedSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName()); SkinResponse skinresponce = (isVelocityModern || isBungeeGuard || isBungeecord) && forwardedSkin != null ? forwardedSkin : 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(EnumSet.of(PlayerInfoAction.ADD_PLAYER, PlayerInfoAction.UPDATE_GAME_MODE, PlayerInfoAction.UPDATE_LISTED, PlayerInfoAction.UPDATE_LATENCY, PlayerInfoAction.UPDATE_DISPLAY_NAME), player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), true, Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty())); PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(EnumSet.of(PlayerInfoAction.ADD_PLAYER, PlayerInfoAction.UPDATE_GAME_MODE, PlayerInfoAction.UPDATE_LISTED, PlayerInfoAction.UPDATE_LATENCY, PlayerInfoAction.UPDATE_DISPLAY_NAME), player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), true, Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty()));
sendPacket(info); sendPacket(info);
Set<PlayerAbilityFlags> flags = new HashSet<>(); Set<PlayerAbilityFlags> flags = new HashSet<>();
if (properties.isAllowFlight()) { if (properties.isAllowFlight()) {
flags.add(PlayerAbilityFlags.FLY); flags.add(PlayerAbilityFlags.FLY);
@@ -595,7 +617,7 @@ public class ClientConnection extends Thread {
} }
PacketPlayOutPlayerAbilities abilities = new PacketPlayOutPlayerAbilities(0.05F, 0.1F, flags.toArray(new PlayerAbilityFlags[flags.size()])); PacketPlayOutPlayerAbilities abilities = new PacketPlayOutPlayerAbilities(0.05F, 0.1F, flags.toArray(new PlayerAbilityFlags[flags.size()]));
sendPacket(abilities); sendPacket(abilities);
String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "<ip address withheld>") + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")"; String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "<ip address withheld>") + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")";
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!"); Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!");
@@ -608,18 +630,18 @@ public class ClientConnection extends Thread {
if (declare != null) { if (declare != null) {
sendPacket(declare); sendPacket(declare);
} }
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn), worldSpawn.getPitch()); PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(GlobalPos.from(worldSpawn), worldSpawn.getYaw(), worldSpawn.getPitch());
sendPacket(spawnPos); sendPacket(spawnPos);
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1); PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1);
Limbo.getInstance().getUnsafe().a(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch())); Limbo.getInstance().getUnsafe().a(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch()));
sendPacket(positionLook); sendPacket(positionLook);
player.getDataWatcher().update(); player.getDataWatcher().update();
PacketPlayOutEntityMetadata show = new PacketPlayOutEntityMetadata(player, false, Player.class.getDeclaredField("skinLayers")); PacketPlayOutEntityMetadata show = new PacketPlayOutEntityMetadata(player, false, Player.class.getDeclaredField("skinLayers"));
sendPacket(show); sendPacket(show);
Limbo.getInstance().getEventsManager().callEvent(new PlayerJoinEvent(player)); Limbo.getInstance().getEventsManager().callEvent(new PlayerJoinEvent(player));
if (properties.isAllowFlight()) { if (properties.isAllowFlight()) {
@@ -644,27 +666,26 @@ public class ClientConnection extends Thread {
player.sendPlayerListHeaderAndFooter(properties.getTabHeader(), properties.getTabFooter()); player.sendPlayerListHeaderAndFooter(properties.getTabHeader(), properties.getTabFooter());
ready = true; ready = true;
keepAliveTask = new TimerTask() { keepAliveTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
if (state.equals(ClientState.DISCONNECTED)) { if (state != ClientState.PLAY || !ready) {
this.cancel(); this.cancel();
} else if (ready && state.equals(ClientState.PLAY)) { }
long now = System.currentTimeMillis();
if (now - getLastPacketTimestamp() > 15000) { long now = System.currentTimeMillis();
PacketPlayOutKeepAlive keepAlivePacket = new PacketPlayOutKeepAlive(now); PacketPlayOutKeepAlive keepAlive = new PacketPlayOutKeepAlive(now);
try { try {
sendPacket(keepAlivePacket); sendPacket(keepAlive);
setLastKeepAlivePayLoad(now); setLastKeepAlivePayLoad(now);
} catch (Exception e) { } catch (IOException e) {
} cancel();
}
} }
} }
}; };
new Timer().schedule(keepAliveTask, 5000, 10000); new Timer().schedule(keepAliveTask, 0, 10000);
while (clientSocket.isConnected()) { while (clientSocket.isConnected()) {
try { try {
CheckedBiConsumer<PlayerMoveEvent, Location, IOException> processMoveEvent = (event, originalTo) -> { CheckedBiConsumer<PlayerMoveEvent, Location, IOException> processMoveEvent = (event, originalTo) -> {
@@ -715,12 +736,12 @@ public class ClientConnection extends Thread {
processMoveEvent.consume(event, to); processMoveEvent.consume(event, to);
} }
} else if (packetIn instanceof PacketPlayInKeepAlive) { } else if (packetIn instanceof PacketPlayInKeepAlive) {
long lastPayload = getLastKeepAlivePayLoad();
PacketPlayInKeepAlive alive = (PacketPlayInKeepAlive) packetIn; PacketPlayInKeepAlive alive = (PacketPlayInKeepAlive) packetIn;
if (lastPayload == -1) {
Limbo.getInstance().getConsole().sendMessage("Unsolicited KeepAlive packet for player " + player.getName()); if (alive.getPayload() == getLastKeepAlivePayLoad()) {
} else if (alive.getPayload() != lastPayload) { lastKeepAliveResponse.set(System.currentTimeMillis());
Limbo.getInstance().getConsole().sendMessage("Incorrect Payload received in KeepAlive packet for player " + player.getName()); } else {
disconnect(Component.text("Bad Keepalive Payload"));
break; break;
} }
} else if (packetIn instanceof PacketPlayInTabComplete) { } else if (packetIn instanceof PacketPlayInTabComplete) {
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -27,24 +27,30 @@ import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ServerConnection extends Thread { public class ServerConnection extends Thread {
private final String ip; private final String ip;
private final int port; private final int port;
private final boolean silent; private final boolean silent;
private final ExecutorService executorService;
private final List<ClientConnection> clients;
private ServerSocket serverSocket; private ServerSocket serverSocket;
private List<ClientConnection> clients;
public ServerConnection(String ip, int port, boolean silent) { public ServerConnection(String ip, int port, boolean silent) {
this.clients = new ArrayList<>(); this.clients = new ArrayList<>();
this.ip = ip; this.ip = ip;
this.port = port; this.port = port;
this.silent = silent; this.silent = silent;
this.executorService = Executors.newVirtualThreadPerTaskExecutor();
start(); start();
} }
@Override @SuppressWarnings("InfiniteLoopStatement")
@Override
public void run() { public void run() {
try { try {
serverSocket = new ServerSocket(port, 50, InetAddress.getByName(ip)); serverSocket = new ServerSocket(port, 50, InetAddress.getByName(ip));
@@ -53,11 +59,11 @@ public class ServerConnection extends Thread {
} }
while (true) { while (true) {
Socket connection = serverSocket.accept(); Socket connection = serverSocket.accept();
ClientConnection sc = new ClientConnection(connection); ClientConnection clientTask = new ClientConnection(connection);
clients.add(sc); clients.add(clientTask);
sc.start(); executorService.submit(clientTask);
} }
} catch(IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2023. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -146,6 +146,7 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
} }
} }
dataOut.writeShort(counter); dataOut.writeShort(counter);
dataOut.writeShort(0);
int newBits = 32 - Integer.numberOfLeadingZeros(section.getPalette().size() - 1); int newBits = 32 - Integer.numberOfLeadingZeros(section.getPalette().size() - 1);
newBits = Math.max(newBits, 4); newBits = Math.max(newBits, 4);
@@ -223,6 +224,7 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
} }
} }
} else { } else {
dataOut.writeShort(0);
dataOut.writeShort(0); dataOut.writeShort(0);
dataOut.writeByte(0); dataOut.writeByte(0);
DataTypeIO.writeVarInt(dataOut, 0); DataTypeIO.writeVarInt(dataOut, 0);
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2023. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -0,0 +1,88 @@
/*
* This file is part of Limbo.
*
* Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2026. Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.loohp.limbo.network.protocol.packets;
import com.loohp.limbo.registry.PacketRegistry;
import com.loohp.limbo.registry.RegistryCustom;
import com.loohp.limbo.utils.DataTypeIO;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.kyori.adventure.key.Key;
public class ClientboundUpdateTagsPacket extends PacketOut {
private final Collection<RegistryCustom> registries;
public ClientboundUpdateTagsPacket(Collection<RegistryCustom> registries) {
this.registries = registries;
}
public Collection<RegistryCustom> getRegistries() {
return registries;
}
@Override
public byte[] serializePacket() throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(buffer);
output.writeByte(PacketRegistry.getPacketId(getClass()));
DataTypeIO.writeVarInt(output, registries.size());
for (RegistryCustom registry : registries) {
DataTypeIO.writeString(output, registry.getIdentifier().asString(), StandardCharsets.UTF_8);
DataTypeIO.writeVarInt(output, registry.getTags().size());
for (Map.Entry<Key, List<RegistryCustom.Tag>> entry : registry.getTags().entrySet()) {
DataTypeIO.writeString(output, entry.getKey().asString(), StandardCharsets.UTF_8);
List<Integer> tagIds = transformTags(registry, entry.getValue());
DataTypeIO.writeVarInt(output, tagIds.size());
for (int value : tagIds) {
DataTypeIO.writeVarInt(output, value);
}
}
}
return buffer.toByteArray();
}
private static List<Integer> transformTags(RegistryCustom registry, List<RegistryCustom.Tag> tags) {
List<Integer> tagIds = new ArrayList<>();
for (RegistryCustom.Tag value : tags) {
if (value.isReference()) {
List<RegistryCustom.Tag> referencedTags = registry.getTags().get(value.key());
if (referencedTags != null) {
tagIds.addAll(transformTags(registry, referencedTags));
}
} else {
int index = registry.indexOf(value.key());
if (index >= 0) {
tagIds.add(index);
}
}
}
return tagIds;
}
}
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -1,8 +1,8 @@
/* /*
* This file is part of Limbo. * This file is part of Limbo.
* *
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com> * Copyright (C) 2026. LoohpJames <jamesloohp@gmail.com>
* Copyright (C) 2022. Contributors * Copyright (C) 2026. Contributors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

Some files were not shown because too many files have changed in this diff Show More