Changes in SpongeAPI-8

This commit is contained in:
Blue (Lukas Rieger) 2021-06-04 11:21:21 +02:00
parent 633021d6e8
commit c9ed2e4de2
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800
3 changed files with 7 additions and 16 deletions

View File

@ -26,21 +26,11 @@
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.text.Text;
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.adventure.SpongeComponents;
import org.spongepowered.api.block.BlockSnapshot;
import org.spongepowered.api.data.Transaction;
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.block.ChangeBlockEvent;
import org.spongepowered.api.event.message.PlayerChatEvent;
import org.spongepowered.api.event.network.ServerSideConnectionEvent;
import org.spongepowered.api.event.world.chunk.ChunkEvent;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.api.world.server.ServerWorld;
import java.util.Optional;
public class EventForwarder {
@ -62,7 +52,7 @@ public void onPlayerLeave(ServerSideConnectionEvent.Disconnect evt) {
@Listener(order = Order.POST)
public void onPlayerChat(PlayerChatEvent evt) {
listener.onChatMessage(Text.of(SpongeComponents.plainSerializer().serialize(evt.message())));
listener.onChatMessage(Text.of(PlainComponentSerializer.plain().serialize(evt.message())));
}
}

View File

@ -23,13 +23,14 @@
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.sponge8;
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.kyori.adventure.audience.Audience;
import org.spongepowered.api.adventure.SpongeComponents;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.spongepowered.api.service.permission.Subject;
import org.spongepowered.api.world.Locatable;
@ -49,7 +50,7 @@ public SpongeCommandSource(Plugin plugin, Audience audience, Subject subject) {
@Override
public void sendMessage(Text text) {
audience.sendMessage(SpongeComponents.gsonSerializer().deserialize(text.toJSONString()));
audience.sendMessage(GsonComponentSerializer.gson().deserialize(text.toJSONString()));
}
@Override

View File

@ -36,12 +36,12 @@
import de.bluecolored.bluemap.core.logger.Logger;
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
import de.bluecolored.bluemap.sponge8.SpongeCommands.SpongeCommandProxy;
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
import net.querz.nbt.CompoundTag;
import net.querz.nbt.NBTUtil;
import org.spongepowered.api.Platform;
import org.spongepowered.api.Server;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.adventure.SpongeComponents;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.event.Listener;
@ -210,7 +210,7 @@ public String getWorldName(UUID worldUUID) {
serverWorld -> serverWorld
.properties()
.displayName()
.map(SpongeComponents.plainSerializer()::serialize)
.map(PlainComponentSerializer.plain()::serialize)
)
.orElse(null);
}