Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ A hosted version of the javadoc can be found [here](https://mapengine.finndohrma

<repositories>
<repository>
<id>tjcserver</id>
<id>minceraft</id>
<url>https://repo.minceraft.dev/releases/</url>
</repository>
</repositories>
Expand Down Expand Up @@ -106,7 +106,7 @@ A hosted version of the javadoc can be found [here](https://mapengine.finndohrma
repositories {
maven {
url = 'https://repo.minceraft.dev/releases/'
name = 'tjcserver'
name = 'minceraft'
}
}

Expand All @@ -123,7 +123,7 @@ dependencies {
```kotlin
repositories {
maven("https://repo.minceraft.dev/releases/") {
name = "tjcserver"
name = "minceraft"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.pianoman911.mapengine.common.platform.IListenerBridge;
import de.pianoman911.mapengine.common.platform.IPlatform;
import de.pianoman911.mapengine.common.platform.PacketContainer;
import io.netty.channel.Channel;
import io.papermc.paper.adventure.PaperAdventure;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.SharedConstants;
Expand Down Expand Up @@ -37,6 +38,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.map.MapCursor;
import org.bukkit.map.MapCursorCollection;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -81,6 +83,19 @@ public void onJoin(PlayerJoinEvent event) {
.pipeline().addAfter("decoder", "mapengine", listener);
}

@EventHandler
public void onQuit(PlayerQuitEvent event) {
// remove mapengine pipeline handler if the player is still connected
// while this event is being fired; this prevents errors if the player goes
// through a second configuration phase
Channel ch = ((CraftPlayer) event.getPlayer()).getHandle().connection.connection.channel;
ch.eventLoop().execute(() -> {
if (ch.isActive()) {
ch.pipeline().remove("mapengine");
}
});
}

@Override
public String getDisplayedName() {
return MinecraftServer.getServer().getServerModName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
public final class Paper1216Provider implements IPlatformProvider {

private static final IntSet SUPPORTED_PROTOCOLS = IntSet.of(
771, // 1.21.6
772 // 1.21.7
771, // 1.21.6
772, // 1.21.7
773 // 1.21.9
);

@SuppressWarnings("deprecation") // bukkit unsafe
Expand Down
2 changes: 1 addition & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ tasks {

runServer {
runDirectory = rootProject.layout.projectDirectory.dir("run")
minecraftVersion("1.21.6")
minecraftVersion("1.21.9")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

public final class MapEngineUpdater implements Listener {

private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient();
private static final HttpClient HTTP_CLIENT = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NORMAL)
.build();
private static final Gson GSON = new Gson();
private static final Component PREFIX = Component.text()
.append(Component.text('[', NamedTextColor.GRAY))
Expand Down