3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-24 23:30:15 +01:00

Merge branch 'master' into dev

Dieser Commit ist enthalten in:
Myles 2019-05-12 13:01:08 +01:00
Commit 1d0d032431
13 geänderte Dateien mit 43 neuen und 26 gelöschten Zeilen

Datei anzeigen

@ -30,6 +30,7 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.HandItemProvider
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
@ -85,9 +86,9 @@ public class BukkitViaLoader implements ViaPlatformLoader {
}
}
if ((Bukkit.getVersion().toLowerCase().contains("paper")
|| Bukkit.getVersion().toLowerCase().contains("taco")
|| Bukkit.getVersion().toLowerCase().contains("torch"))
if ((Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("paper")
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
storeListener(new PaperPatch(plugin)).register();

Datei anzeigen

@ -28,17 +28,17 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
Preconditions.checkArgument(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid sub-command name.");
if (hasSubCommand(command.name()))
throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later.
commandMap.put(command.name().toLowerCase(), command);
commandMap.put(command.name().toLowerCase(Locale.ROOT), command);
}
@Override
public boolean hasSubCommand(String name) {
return commandMap.containsKey(name.toLowerCase());
return commandMap.containsKey(name.toLowerCase(Locale.ROOT));
}
@Override
public ViaSubCommand getSubCommand(String name) {
return commandMap.get(name.toLowerCase());
return commandMap.get(name.toLowerCase(Locale.ROOT));
}
@Override
@ -76,7 +76,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
if (args.length == 1) {
if (!args[0].isEmpty()) {
for (ViaSubCommand sub : allowed)
if (sub.name().toLowerCase().startsWith(args[0].toLowerCase()))
if (sub.name().toLowerCase().startsWith(args[0].toLowerCase(Locale.ROOT)))
output.add(sub.name());
} else {
for (ViaSubCommand sub : allowed)

Datei anzeigen

@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@ -33,7 +34,7 @@ public class AbstractStempConnectionHandler extends ConnectionHandler {
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), handler);
}
if (blockData.getMinecraftKey().equals(toKey)) {
String facing = blockData.getValue("facing").toUpperCase();
String facing = blockData.getValue("facing").toUpperCase(Locale.ROOT);
stemps.put(BlockFace.valueOf(facing), blockData.getSavedBlockStateId());
}
}

Datei anzeigen

@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@ -19,10 +20,12 @@ class ChestConnectionHandler extends ConnectionHandler {
return new ConnectionData.ConnectorInitAction() {
@Override
public void check(WrappedBlockData blockData) {
if (!blockData.getMinecraftKey().equals("minecraft:chest") && !blockData.getMinecraftKey().equals("minecraft:trapped_chest")) return;
if (!blockData.getMinecraftKey().equals("minecraft:chest") && !blockData.getMinecraftKey().equals("minecraft:trapped_chest"))
return;
if (blockData.getValue("waterlogged").equals("true")) return;
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase()));
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest")) trappedChests.add(blockData.getSavedBlockStateId());
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)));
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest"))
trappedChests.add(blockData.getSavedBlockStateId());
connectedStates.put(getStates(blockData), blockData.getSavedBlockStateId());
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), connectionHandler);
}
@ -34,7 +37,7 @@ class ChestConnectionHandler extends ConnectionHandler {
String type = blockData.getValue("type");
if (type.equals("left")) states |= 1;
if (type.equals("right")) states |= 2;
states |= (BlockFace.valueOf(blockData.getValue("facing").toUpperCase()).ordinal() << 2);
states |= (BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)).ordinal() << 2);
if (blockData.getMinecraftKey().equals("minecraft:trapped_chest")) states |= 16;
return states;
}

Datei anzeigen

@ -217,7 +217,7 @@ public class ConnectionData {
JsonObject object = type.getValue().getAsJsonObject();
boolean[] data = new boolean[6];
for (BlockFace value : BlockFace.values()) {
String face = value.toString().toLowerCase();
String face = value.toString().toLowerCase(Locale.ROOT);
if (object.has(face)) {
data[value.ordinal()] = object.getAsJsonPrimitive(face).getAsBoolean();
}

Datei anzeigen

@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class DoorConnectionHandler extends ConnectionHandler {
@ -40,7 +41,7 @@ public class DoorConnectionHandler extends ConnectionHandler {
blockData.getValue("hinge").equals("right"),
blockData.getValue("powered").equals("true"),
blockData.getValue("open").equals("true"),
BlockFace.valueOf(blockData.getValue("facing").toUpperCase()),
BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)),
type
);

Datei anzeigen

@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class StairConnectionHandler extends ConnectionHandler {
@ -58,7 +59,7 @@ public class StairConnectionHandler extends ConnectionHandler {
StairData stairData = new StairData(
blockData.getValue("half").equals("bottom"),
shape, (byte) type,
BlockFace.valueOf(blockData.getValue("facing").toUpperCase())
BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT))
);
stairDataMap.put(blockData.getSavedBlockStateId(), stairData);

Datei anzeigen

@ -8,6 +8,7 @@ import us.myles.ViaVersion.api.minecraft.BlockFace;
import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class TripwireConnectionHandler extends ConnectionHandler {
@ -21,7 +22,7 @@ public class TripwireConnectionHandler extends ConnectionHandler {
@Override
public void check(WrappedBlockData blockData) {
if (blockData.getMinecraftKey().equals("minecraft:tripwire_hook")) {
tripwireHooks.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase()));
tripwireHooks.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)));
} else if (blockData.getMinecraftKey().equals("minecraft:tripwire")) {
TripwireData tripwireData = new TripwireData(
blockData.getValue("attached").equals("true"),

Datei anzeigen

@ -1,6 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class NamedSoundRewriter {
@ -148,6 +149,6 @@ public class NamedSoundRewriter {
public static String getNewId(String old) {
String newId = oldToNew.get(old);
return newId != null ? newId : old.toLowerCase();
return newId != null ? newId : old.toLowerCase(Locale.ROOT);
}
}

Datei anzeigen

@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers;
import com.google.common.base.Optional;
import us.myles.ViaVersion.api.platform.providers.Provider;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -45,7 +46,7 @@ public class PaintingProvider implements Provider {
public Optional<Integer> getIntByIdentifier(String motive) {
// Handle older versions
if (!motive.startsWith("minecraft:"))
motive = "minecraft:" + motive.toLowerCase();
motive = "minecraft:" + motive.toLowerCase(Locale.ROOT);
return Optional.fromNullable(paintings.get(motive));
}
}

Datei anzeigen

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.List;
import java.util.logging.Level;
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
public Chunk1_13Type(ClientWorld param) {
@ -30,7 +31,7 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
boolean groundUp = input.readBoolean();
int primaryBitmask = Type.VAR_INT.read(input);
Type.VAR_INT.read(input);
ByteBuf data = input.readSlice(Type.VAR_INT.read(input));
BitSet usedSections = new BitSet(16);
ChunkSection[] sections = new ChunkSection[16];
@ -44,18 +45,22 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
// Read sections
for (int i = 0; i < 16; i++) {
if (!usedSections.get(i)) continue; // Section not set
ChunkSection section = Types1_13.CHUNK_SECTION.read(input);
ChunkSection section = Types1_13.CHUNK_SECTION.read(data);
sections[i] = section;
section.readBlockLight(input);
section.readBlockLight(data);
if (world.getEnvironment() == Environment.NORMAL) {
section.readSkyLight(input);
section.readSkyLight(data);
}
}
int[] biomeData = groundUp ? new int[256] : null;
if (groundUp) {
for (int i = 0; i < 256; i++) {
biomeData[i] = input.readInt();
if (data.readableBytes() >= 256 * 4) {
for (int i = 0; i < 256; i++) {
biomeData[i] = data.readInt();
}
} else {
Via.getPlatform().getLogger().log(Level.WARNING, "Chunk x="+ chunkX + " z=" + chunkZ + " doesn't have biome data!");
}
}

Datei anzeigen

@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds;
import lombok.Getter;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@Getter
@ -284,7 +285,7 @@ public enum SoundEffect {
}
public static SoundEffect getByName(String name) {
name = name.toLowerCase();
name = name.toLowerCase(Locale.ROOT);
return effects.get(name);
}

Datei anzeigen

@ -12,6 +12,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
import java.util.UUID;
public class UpdateUtil {
@ -81,7 +82,7 @@ public class UpdateUtil {
if (current.compareTo(newest) < 0)
return "There is a newer version available: " + newest.toString() + ", you're on: " + current.toString();
else if (console && current.compareTo(newest) != 0) {
if (current.getTag().toLowerCase().startsWith("dev") || current.getTag().toLowerCase().startsWith("snapshot")) {
if (current.getTag().toLowerCase(Locale.ROOT).startsWith("dev") || current.getTag().toLowerCase(Locale.ROOT).startsWith("snapshot")) {
return "You are running a development version, please report any bugs to GitHub.";
} else {
return "You are running a newer version than is released!";