Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite: Let's make this a plugin #26

Merged
merged 25 commits into from
Jan 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a45ff2a
start on rewriting the linking server to be a plugin
onebeastchris Jan 5, 2025
3128689
tidy up commands
onebeastchris Jan 9, 2025
d8812ad
Code cleanup, add info command to display current link info
onebeastchris Jan 10, 2025
35877c6
Add util options
rtm516 Jan 10, 2025
dadcf6b
Fix build
rtm516 Jan 10, 2025
a990a70
Disable recipes and players in ping
rtm516 Jan 11, 2025
510b462
Drop util config and move more to plugin
rtm516 Jan 13, 2025
17a4656
more fixes, remove gson, other fixes
onebeastchris Jan 16, 2025
40793f0
add readme warning
onebeastchris Jan 16, 2025
e272a97
fix motd, crop trampling
onebeastchris Jan 17, 2025
becd093
only allow using link/unlink/link info commands
onebeastchris Jan 17, 2025
a890709
add custom help command
onebeastchris Jan 17, 2025
31e40a9
Show all commands to OPs and remove old recipie code
rtm516 Jan 17, 2025
4cf344a
Fix link command code argument
rtm516 Jan 17, 2025
90ecbd2
Run kick on main thread
rtm516 Jan 17, 2025
6571d42
lookup links from bedrock players in the DB as opposed to letting flo…
onebeastchris Jan 17, 2025
8053995
Kick players after 5 mins
rtm516 Jan 17, 2025
c326378
Reorganized the project
Tim203 Jan 18, 2025
8ea5760
Kick only idle when no link request, send message on link req replace
Tim203 Jan 18, 2025
3e33f4a
Add spawn location to the config
Tim203 Jan 19, 2025
c7de248
Make max pool size configurable
Tim203 Jan 19, 2025
4562e0d
Add max pool size to default config too
Tim203 Jan 19, 2025
9644c9c
Use a cached thread pool for the database instead
Tim203 Jan 19, 2025
d4415e0
Cancel all damage for players
Tim203 Jan 19, 2025
acf0853
Only teleport when damage cause is void
Tim203 Jan 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more fixes, remove gson, other fixes
  • Loading branch information
onebeastchris committed Jan 16, 2025
commit 17a46569fec5eef276ffb20936e95d0df7e5e2c0
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -27,6 +27,13 @@ jobs:
arguments: build
cache-read-only: ${{ github.ref_name != 'master' && github.ref_name != 'development' }}

- name: Archive Artifacts
uses: GeyserMC/actions/upload-multi-artifact@master
if: success()
with:
artifacts: |
GlobalLinkPlugin:build/libs/GlobalLinkPlugin.jar

- name: Notify Discord
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/GlobalLinkServer' }}
uses: Tim203/actions-git-discord-webhook@main
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
# GlobalLinkServer Plugin

> **Warning**
This repo contains the code for the Geyser Global Linking Server plugin.
If you want to just link your account, join link.geysermc.org on Minecraft Java or Bedrock.

### `server.properties`
```properties
allow-nether=false
generate-structures=false
generator-settings={"biome"\:"minecraft\:the_void","layers"\:[{"block"\:"minecraft\:air","height"\:1}]}
level-type=minecraft\:flat
motd=§aGeyserMC §bLinking §fServer
spawn-protection=200
```

### `spigot.yml`
```yaml
commands:
send-namespaced: false
```


### `bukkit.yml`
```yaml
settings:
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ group = "org.geysermc.globallinkserver"
dependencies {
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")

implementation(libs.gson) // newer version required for record support
implementation(libs.bundles.fastutil)
compileOnly(libs.floodgate.api)
implementation(libs.mariadb.client)
@@ -59,7 +58,7 @@ tasks.jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })

archiveBaseName = "GlobalLinkServer"
archiveBaseName = "GlobalLinkPlugin"
archiveVersion = ""
archiveClassifier = ""
}
3 changes: 0 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[versions]
gson = "2.10.1"
fastutil = "8.5.2"
mariadb-client = "2.7.3"
checker-qual = "3.21.1"
@@ -10,8 +9,6 @@ runpaper = "2.3.1"
[libraries]
floodgate-api = { group = "org.geysermc.floodgate", name = "api", version = "2.2.3-SNAPSHOT" }

gson = { module = "com.google.code.gson:gson", version.ref = "gson" }

fastutil-int-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-int-maps", version.ref = "fastutil" }
fastutil-int-object-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-object-maps", version.ref = "fastutil" }
fastutil-object-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-object-int-maps", version.ref = "fastutil" }
Original file line number Diff line number Diff line change
@@ -28,10 +28,7 @@
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerCommandSendEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRecipeDiscoverEvent;
import org.bukkit.event.player.*;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -122,14 +119,19 @@ public void onEnable() {
world.setGameRule(GameRule.RANDOM_TICK_SPEED, 0);
world.setGameRule(GameRule.SHOW_DEATH_MESSAGES, false);

// Other changes
getServer().motd(Component.text("Global Link Server").color(NamedTextColor.AQUA));
getServer().clearRecipes();

// Make nighttime
world.setTime(18000);

getServer().setDefaultGameMode(GameMode.ADVENTURE);

LOGGER.info("Started Global Linking Server plugin!");
LOGGER.info("Started Global Linking plugin!");
}

// TODO does not remove commands
@EventHandler
public void onCommands(PlayerCommandSendEvent event) {
Collection<String> toRemove = new ArrayList<>();
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ public CompletableFuture<Optional<Link>> attemptFindJavaLink(Player player) {
() -> {
try (Connection connection = dataSource.getConnection()) {
try (PreparedStatement query = connection.prepareStatement(
"SELECT `bedrock_id` FROM `links` WHERE `java_id` = ? LIMIT 1")) {
"SELECT `bedrock_id` FROM `links` WHERE `java_id` = ?")) {
query.setString(1, player.getUniqueId().toString());

try (ResultSet resultSet = query.executeQuery()) {