fix things

This commit is contained in:
EOT3000 2019-08-08 21:50:29 -04:00
parent ba21acc9c8
commit c621ead6d9
3 changed files with 9 additions and 12 deletions

View file

@ -54,11 +54,7 @@ import org.geysermc.connector.utils.Toolbox;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -158,7 +154,7 @@ public class GeyserConnector implements Connector {
} }
public Collection<Player> getConnectedPlayers() { public Collection<Player> getConnectedPlayers() {
return players.values(); return new ArrayList<>(players.values());
} }
public void shutdown() { public void shutdown() {
@ -185,7 +181,7 @@ public class GeyserConnector implements Connector {
} }
private static void addMetrics(Metrics m) { private static void addMetrics(Metrics m) {
m.addCustomChart(new Metrics.SingleLineChart("servers", () -> 3 + new Random().nextInt(4))); m.addCustomChart(new Metrics.SingleLineChart("servers", () -> 1));
m.addCustomChart(new Metrics.SingleLineChart("players", () -> 5 + new Random().nextInt(7))); m.addCustomChart(new Metrics.SingleLineChart("players", Geyser::getPlayerCount));
} }
} }

View file

@ -51,8 +51,8 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
Vector3f pos = new Vector3f(0, 0, 0); Vector3f pos = new Vector3f(0, 0, 0);
int chunkX = pos.getFloorX() >> 4; int chunkX = pos.getFloorX() >> 4;
int chunkZ = pos.getFloorZ() >> 4; int chunkZ = pos.getFloorZ() >> 4;
for (int x = -3; x < 3; x++) { for (int x = -1; x < 1; x++) {
for (int z = -3; z < 3; z++) { for (int z = -1; z < 1; z++) {
LevelChunkPacket data = new LevelChunkPacket(); LevelChunkPacket data = new LevelChunkPacket();
data.setChunkX(chunkX + x); data.setChunkX(chunkX + x);
data.setChunkZ(chunkZ + z); data.setChunkZ(chunkZ + z);

View file

@ -21,7 +21,7 @@ class RemapUtils {
.equalsIgnoreCase(x.getIdentifier()) && x.getData() == 0) { .equalsIgnoreCase(x.getIdentifier()) && x.getData() == 0) {
for (DyeColor dyeColor : DyeColor.values()) { for (DyeColor dyeColor : DyeColor.values()) {
JavaItem j = new JavaItem(y.getIdentifier().replaceAll("white", dyeColor.getName()), y.getId()); JavaItem j = new JavaItem(y.getIdentifier().replaceAll("white", dyeColor.getName()), y.getId() + dyeColor.getId());
Remapper.convertions.computeIfAbsent(j, (q) -> new ArrayList<>()); Remapper.convertions.computeIfAbsent(j, (q) -> new ArrayList<>());
Remapper.convertions.get(j).add(new BedrockItem(x.getIdentifier(), x.getId(), dyeColor.getId())); Remapper.convertions.get(j).add(new BedrockItem(x.getIdentifier(), x.getId(), dyeColor.getId()));
} }
@ -62,7 +62,7 @@ class RemapUtils {
.equalsIgnoreCase(x.getIdentifier()) && x.getData() == 0) { .equalsIgnoreCase(x.getIdentifier()) && x.getData() == 0) {
for (WoodType woodType : WoodType.values()) { for (WoodType woodType : WoodType.values()) {
JavaItem j = new JavaItem(y.getIdentifier().replaceAll("oak", woodType.getName()), y.getId()); JavaItem j = new JavaItem(y.getIdentifier().replaceAll("oak", woodType.getName()), y.getId() + woodType.getId());
Remapper.convertions.computeIfAbsent(j, (q) -> new ArrayList<>()); Remapper.convertions.computeIfAbsent(j, (q) -> new ArrayList<>());
Remapper.convertions.get(j).add(new BedrockItem(x.getIdentifier(), x.getId(), woodType.getId())); Remapper.convertions.get(j).add(new BedrockItem(x.getIdentifier(), x.getId(), woodType.getId()));
} }
@ -80,6 +80,7 @@ class RemapUtils {
} }
private static boolean customWoodIfNeeded(JavaItem j) { private static boolean customWoodIfNeeded(JavaItem j) {
if(j.getIdentifier().contains("fence_gate")) return true;
for(WoodType t : WoodType.values()) { for(WoodType t : WoodType.values()) {
if (j.getIdentifier().equalsIgnoreCase(MINECRAFT + "stripped_" + t.getName() +"_wood")) { if (j.getIdentifier().equalsIgnoreCase(MINECRAFT + "stripped_" + t.getName() +"_wood")) {
Remapper.convertions.put(j, Arrays.asList(new BedrockItem(MINECRAFT + "wood", 467, t.getId() + 8))); Remapper.convertions.put(j, Arrays.asList(new BedrockItem(MINECRAFT + "wood", 467, t.getId() + 8)));