Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Merge branch 'master' into dev
Dieser Commit ist enthalten in:
Commit
1d0d032431
@ -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 us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@ -85,9 +86,9 @@ public class BukkitViaLoader implements ViaPlatformLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Bukkit.getVersion().toLowerCase().contains("paper")
|
if ((Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("paper")
|
||||||
|| Bukkit.getVersion().toLowerCase().contains("taco")
|
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|
||||||
|| Bukkit.getVersion().toLowerCase().contains("torch"))
|
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))
|
||||||
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
|
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
|
||||||
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
|
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
|
||||||
storeListener(new PaperPatch(plugin)).register();
|
storeListener(new PaperPatch(plugin)).register();
|
||||||
|
@ -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.");
|
Preconditions.checkArgument(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid sub-command name.");
|
||||||
if (hasSubCommand(command.name()))
|
if (hasSubCommand(command.name()))
|
||||||
throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later.
|
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
|
@Override
|
||||||
public boolean hasSubCommand(String name) {
|
public boolean hasSubCommand(String name) {
|
||||||
return commandMap.containsKey(name.toLowerCase());
|
return commandMap.containsKey(name.toLowerCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViaSubCommand getSubCommand(String name) {
|
public ViaSubCommand getSubCommand(String name) {
|
||||||
return commandMap.get(name.toLowerCase());
|
return commandMap.get(name.toLowerCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -76,7 +76,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
|
|||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (!args[0].isEmpty()) {
|
if (!args[0].isEmpty()) {
|
||||||
for (ViaSubCommand sub : allowed)
|
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());
|
output.add(sub.name());
|
||||||
} else {
|
} else {
|
||||||
for (ViaSubCommand sub : allowed)
|
for (ViaSubCommand sub : allowed)
|
||||||
|
@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ public class AbstractStempConnectionHandler extends ConnectionHandler {
|
|||||||
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), handler);
|
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), handler);
|
||||||
}
|
}
|
||||||
if (blockData.getMinecraftKey().equals(toKey)) {
|
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());
|
stemps.put(BlockFace.valueOf(facing), blockData.getSavedBlockStateId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -19,10 +20,12 @@ class ChestConnectionHandler extends ConnectionHandler {
|
|||||||
return new ConnectionData.ConnectorInitAction() {
|
return new ConnectionData.ConnectorInitAction() {
|
||||||
@Override
|
@Override
|
||||||
public void check(WrappedBlockData blockData) {
|
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;
|
if (blockData.getValue("waterlogged").equals("true")) return;
|
||||||
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase()));
|
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)));
|
||||||
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest")) trappedChests.add(blockData.getSavedBlockStateId());
|
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest"))
|
||||||
|
trappedChests.add(blockData.getSavedBlockStateId());
|
||||||
connectedStates.put(getStates(blockData), blockData.getSavedBlockStateId());
|
connectedStates.put(getStates(blockData), blockData.getSavedBlockStateId());
|
||||||
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), connectionHandler);
|
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), connectionHandler);
|
||||||
}
|
}
|
||||||
@ -34,7 +37,7 @@ class ChestConnectionHandler extends ConnectionHandler {
|
|||||||
String type = blockData.getValue("type");
|
String type = blockData.getValue("type");
|
||||||
if (type.equals("left")) states |= 1;
|
if (type.equals("left")) states |= 1;
|
||||||
if (type.equals("right")) states |= 2;
|
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;
|
if (blockData.getMinecraftKey().equals("minecraft:trapped_chest")) states |= 16;
|
||||||
return states;
|
return states;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public class ConnectionData {
|
|||||||
JsonObject object = type.getValue().getAsJsonObject();
|
JsonObject object = type.getValue().getAsJsonObject();
|
||||||
boolean[] data = new boolean[6];
|
boolean[] data = new boolean[6];
|
||||||
for (BlockFace value : BlockFace.values()) {
|
for (BlockFace value : BlockFace.values()) {
|
||||||
String face = value.toString().toLowerCase();
|
String face = value.toString().toLowerCase(Locale.ROOT);
|
||||||
if (object.has(face)) {
|
if (object.has(face)) {
|
||||||
data[value.ordinal()] = object.getAsJsonPrimitive(face).getAsBoolean();
|
data[value.ordinal()] = object.getAsJsonPrimitive(face).getAsBoolean();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DoorConnectionHandler extends ConnectionHandler {
|
public class DoorConnectionHandler extends ConnectionHandler {
|
||||||
@ -40,7 +41,7 @@ public class DoorConnectionHandler extends ConnectionHandler {
|
|||||||
blockData.getValue("hinge").equals("right"),
|
blockData.getValue("hinge").equals("right"),
|
||||||
blockData.getValue("powered").equals("true"),
|
blockData.getValue("powered").equals("true"),
|
||||||
blockData.getValue("open").equals("true"),
|
blockData.getValue("open").equals("true"),
|
||||||
BlockFace.valueOf(blockData.getValue("facing").toUpperCase()),
|
BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)),
|
||||||
type
|
type
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class StairConnectionHandler extends ConnectionHandler {
|
public class StairConnectionHandler extends ConnectionHandler {
|
||||||
@ -58,7 +59,7 @@ public class StairConnectionHandler extends ConnectionHandler {
|
|||||||
StairData stairData = new StairData(
|
StairData stairData = new StairData(
|
||||||
blockData.getValue("half").equals("bottom"),
|
blockData.getValue("half").equals("bottom"),
|
||||||
shape, (byte) type,
|
shape, (byte) type,
|
||||||
BlockFace.valueOf(blockData.getValue("facing").toUpperCase())
|
BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT))
|
||||||
);
|
);
|
||||||
|
|
||||||
stairDataMap.put(blockData.getSavedBlockStateId(), stairData);
|
stairDataMap.put(blockData.getSavedBlockStateId(), stairData);
|
||||||
|
@ -8,6 +8,7 @@ import us.myles.ViaVersion.api.minecraft.BlockFace;
|
|||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class TripwireConnectionHandler extends ConnectionHandler {
|
public class TripwireConnectionHandler extends ConnectionHandler {
|
||||||
@ -21,7 +22,7 @@ public class TripwireConnectionHandler extends ConnectionHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void check(WrappedBlockData blockData) {
|
public void check(WrappedBlockData blockData) {
|
||||||
if (blockData.getMinecraftKey().equals("minecraft:tripwire_hook")) {
|
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")) {
|
} else if (blockData.getMinecraftKey().equals("minecraft:tripwire")) {
|
||||||
TripwireData tripwireData = new TripwireData(
|
TripwireData tripwireData = new TripwireData(
|
||||||
blockData.getValue("attached").equals("true"),
|
blockData.getValue("attached").equals("true"),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class NamedSoundRewriter {
|
public class NamedSoundRewriter {
|
||||||
@ -148,6 +149,6 @@ public class NamedSoundRewriter {
|
|||||||
|
|
||||||
public static String getNewId(String old) {
|
public static String getNewId(String old) {
|
||||||
String newId = oldToNew.get(old);
|
String newId = oldToNew.get(old);
|
||||||
return newId != null ? newId : old.toLowerCase();
|
return newId != null ? newId : old.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers;
|
|||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import us.myles.ViaVersion.api.platform.providers.Provider;
|
import us.myles.ViaVersion.api.platform.providers.Provider;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ public class PaintingProvider implements Provider {
|
|||||||
public Optional<Integer> getIntByIdentifier(String motive) {
|
public Optional<Integer> getIntByIdentifier(String motive) {
|
||||||
// Handle older versions
|
// Handle older versions
|
||||||
if (!motive.startsWith("minecraft:"))
|
if (!motive.startsWith("minecraft:"))
|
||||||
motive = "minecraft:" + motive.toLowerCase();
|
motive = "minecraft:" + motive.toLowerCase(Locale.ROOT);
|
||||||
return Optional.fromNullable(paintings.get(motive));
|
return Optional.fromNullable(paintings.get(motive));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
||||||
public Chunk1_13Type(ClientWorld param) {
|
public Chunk1_13Type(ClientWorld param) {
|
||||||
@ -30,7 +31,7 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
|
|
||||||
boolean groundUp = input.readBoolean();
|
boolean groundUp = input.readBoolean();
|
||||||
int primaryBitmask = Type.VAR_INT.read(input);
|
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);
|
BitSet usedSections = new BitSet(16);
|
||||||
ChunkSection[] sections = new ChunkSection[16];
|
ChunkSection[] sections = new ChunkSection[16];
|
||||||
@ -44,18 +45,22 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
// Read sections
|
// Read sections
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (!usedSections.get(i)) continue; // Section not set
|
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;
|
sections[i] = section;
|
||||||
section.readBlockLight(input);
|
section.readBlockLight(data);
|
||||||
if (world.getEnvironment() == Environment.NORMAL) {
|
if (world.getEnvironment() == Environment.NORMAL) {
|
||||||
section.readSkyLight(input);
|
section.readSkyLight(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] biomeData = groundUp ? new int[256] : null;
|
int[] biomeData = groundUp ? new int[256] : null;
|
||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
|
if (data.readableBytes() >= 256 * 4) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
biomeData[i] = input.readInt();
|
biomeData[i] = data.readInt();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Via.getPlatform().getLogger().log(Level.WARNING, "Chunk x="+ chunkX + " z=" + chunkZ + " doesn't have biome data!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -284,7 +285,7 @@ public enum SoundEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getByName(String name) {
|
public static SoundEffect getByName(String name) {
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase(Locale.ROOT);
|
||||||
return effects.get(name);
|
return effects.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import java.io.InputStreamReader;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UpdateUtil {
|
public class UpdateUtil {
|
||||||
@ -81,7 +82,7 @@ public class UpdateUtil {
|
|||||||
if (current.compareTo(newest) < 0)
|
if (current.compareTo(newest) < 0)
|
||||||
return "There is a newer version available: " + newest.toString() + ", you're on: " + current.toString();
|
return "There is a newer version available: " + newest.toString() + ", you're on: " + current.toString();
|
||||||
else if (console && current.compareTo(newest) != 0) {
|
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.";
|
return "You are running a development version, please report any bugs to GitHub.";
|
||||||
} else {
|
} else {
|
||||||
return "You are running a newer version than is released!";
|
return "You are running a newer version than is released!";
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren