Skip to content

Commit

Permalink
Remove guava usage from testplugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMorpheus committed Nov 3, 2023
1 parent cab6ba2 commit 1b6cf09
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
*/
package org.spongepowered.test.channel;

import com.google.common.base.MoreObjects;
import org.spongepowered.api.network.channel.ChannelBuf;
import org.spongepowered.api.network.channel.packet.RequestPacket;

import java.util.StringJoiner;

public final class PingPacket implements RequestPacket<PongPacket> {

private int id;
Expand Down Expand Up @@ -55,8 +56,8 @@ public void write(final ChannelBuf buf) {

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", this.id)
return new StringJoiner(", ", PingPacket.class.getSimpleName() + "[", "]")
.add("id=" + this.id)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
*/
package org.spongepowered.test.channel;

import com.google.common.base.MoreObjects;
import org.spongepowered.api.network.channel.ChannelBuf;
import org.spongepowered.api.network.channel.packet.Packet;

import java.util.StringJoiner;

public final class PongPacket implements Packet {

private int id;
Expand Down Expand Up @@ -55,8 +56,8 @@ public void write(final ChannelBuf buf) {

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", this.id)
return new StringJoiner(", ", PongPacket.class.getSimpleName() + "[", "]")
.add("id=" + this.id)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
*/
package org.spongepowered.test.channel;

import com.google.common.base.MoreObjects;
import org.spongepowered.api.network.channel.ChannelBuf;
import org.spongepowered.api.network.channel.packet.Packet;

import java.util.StringJoiner;

public final class PrintTextPacket implements Packet {

private String text;
Expand Down Expand Up @@ -55,8 +56,8 @@ public void write(final ChannelBuf buf) {

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("text", this.text)
return new StringJoiner(", ", PrintTextPacket.class.getSimpleName() + "[", "]")
.add("text=" + this.text)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package org.spongepowered.test.data;

import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.HoverEvent;
Expand Down Expand Up @@ -328,7 +327,7 @@ public void testData(final ServerPlayer player) {
armorStand.equip(EquipmentTypes.MAIN_HAND.get(), ItemStack.of(ItemTypes.DIAMOND));
armorStand.equip(EquipmentTypes.OFF_HAND.get(), ItemStack.of(ItemTypes.DIAMOND));

armorStand.offer(Keys.BODY_ROTATIONS, ImmutableMap.of(BodyParts.CHEST.get(), Vector3d.RIGHT));
armorStand.offer(Keys.BODY_ROTATIONS, Map.of(BodyParts.CHEST.get(), Vector3d.RIGHT));

// TODO wither.get(Keys.BOSS_BAR)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package org.spongepowered.test.map;

import com.google.common.collect.Sets;
import com.google.inject.Inject;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.identity.Identity;
Expand Down Expand Up @@ -211,7 +210,7 @@ private CommandResult addNamedDecoration(final CommandContext ctx) throws Comman
.customName(Component.text("I AM A ").color(NamedTextColor.BLUE).append(BlockTypes.BLUE_BANNER.get()))
.rotation(MapDecorationOrientations.NORTH)
.build();
heldMap.require(Keys.MAP_INFO).offer(Keys.MAP_DECORATIONS, Sets.newHashSet(decoration));
heldMap.require(Keys.MAP_INFO).offer(Keys.MAP_DECORATIONS, Set.of(decoration));
return CommandResult.success();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package org.spongepowered.test.trades;

import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
Expand Down Expand Up @@ -79,7 +78,7 @@ public TradeTest(final PluginContainer pluginContainer) {
private static final Component LORE_FOURTH = TradeTest.blueText( "Granting delights for you and me");
private static final Component LORE_FIFTH = TradeTest.blueText("For ").append(TradeTest.sponge()).append(TradeTest.blueText(" is in a State of play"));
private static final Component LORE_SIXTH = TradeTest.blueText("Today, be happy as can be!");
static final ImmutableList<Component> LORE = ImmutableList.of(
static final List<Component> LORE = List.of(
TradeTest.LORE_FIRST, TradeTest.LORE_SECOND,
TradeTest.LORE_THIRD, TradeTest.LORE_FOURTH,
TradeTest.LORE_FIFTH,
Expand All @@ -104,10 +103,10 @@ public void enable(final CommandContext ctx) {

public static final class SpawnListener {
// Here are the items that we will sell and buy
private static final List<Supplier<ItemType>> SELL_TYPES = ImmutableList.of(
private static final List<Supplier<ItemType>> SELL_TYPES = List.of(
ItemTypes.SLIME_BALL, ItemTypes.BLAZE_ROD, ItemTypes.APPLE,
ItemTypes.GHAST_TEAR, ItemTypes.COBBLESTONE, ItemTypes.STICK, ItemTypes.EMERALD);
private static final List<Supplier<ItemType>> BUYING_TYPES = ImmutableList.of(
private static final List<Supplier<ItemType>> BUYING_TYPES = List.of(
ItemTypes.ACACIA_DOOR,
ItemTypes.ACACIA_LEAVES,
ItemTypes.BIRCH_LEAVES,
Expand Down Expand Up @@ -164,7 +163,7 @@ private void onSpawn(final SpawnEntityEvent event) {
// the job.... because they have a mind of their own...
.set(Keys.EXPERIENCE, 1)
.set(Keys.EXPERIENCE_LEVEL, 1)
.set(Keys.TRADE_OFFERS, ImmutableList.of(SpawnListener.generateTradeOffer().apply(villager, villager.random())));
.set(Keys.TRADE_OFFERS, List.of(SpawnListener.generateTradeOffer().apply(villager, villager.random())));
villager.copyFrom(container);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package org.spongepowered.test.volumestream;

import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import io.leangen.geantyref.TypeToken;
import net.kyori.adventure.identity.Identity;
Expand Down Expand Up @@ -81,6 +80,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.zip.GZIPInputStream;
Expand Down Expand Up @@ -127,7 +127,7 @@ public void onGamePreInitialization(final RegisterCommandEvent<Command.Parameter
Files.createDirectories(this.config);
final Parameter.Value<Biome> biomeKey = Parameter.registryElement(
TypeToken.get(Biome.class),
ImmutableList.of(
List.of(
VariableValueParameters.RegistryEntryBuilder.WORLD_FROM_LOCATABLE_HOLDER_PROVIDER ,
VariableValueParameters.RegistryEntryBuilder.WORLD_FROM_CAUSE_HOLDER_PROVIDER
),
Expand Down

0 comments on commit 1b6cf09

Please sign in to comment.