geforkt von Mirrors/Velocity
Checkstyle-auto
Dieser Commit ist enthalten in:
Ursprung
18e5953976
Commit
6734ef3a08
@ -352,7 +352,8 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
boolean doubleSwitch;
|
||||
// This is not ONE if because this will all be null in < 1.16
|
||||
if (player.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
||||
if(dimensionRegistry.getWorldNames().size() > 1 && dimensionRegistry.getDimensionRegistry().size() > 1){
|
||||
if (dimensionRegistry.getWorldNames().size() > 1
|
||||
&& dimensionRegistry.getDimensionRegistry().size() > 1) {
|
||||
String tmpDimLevelName = null;
|
||||
for (String s : dimensionRegistry.getWorldNames()) {
|
||||
if (!s.equals(dimensionInfo.getDimensionLevelName())) {
|
||||
|
@ -9,12 +9,15 @@ public class DimensionInfo {
|
||||
private final boolean isFlat;
|
||||
private final boolean isDebugType;
|
||||
|
||||
public DimensionInfo(@Nonnull String dimensionIdentifier, @Nonnull String dimensionLevelName, boolean isFlat, boolean isDebugType) {
|
||||
if(dimensionIdentifier == null || dimensionIdentifier.isEmpty() || dimensionIdentifier.isBlank()) {
|
||||
public DimensionInfo(@Nonnull String dimensionIdentifier, @Nonnull String dimensionLevelName,
|
||||
boolean isFlat, boolean isDebugType) {
|
||||
if (dimensionIdentifier == null || dimensionIdentifier.isEmpty()
|
||||
|| dimensionIdentifier.isBlank()) {
|
||||
throw new IllegalArgumentException("DimensionRegistryName may not be empty or null");
|
||||
}
|
||||
this.dimensionIdentifier = dimensionIdentifier;
|
||||
if(dimensionLevelName == null || dimensionLevelName.isEmpty() || dimensionLevelName.isBlank()) {
|
||||
if (dimensionLevelName == null || dimensionLevelName.isEmpty()
|
||||
|| dimensionLevelName.isBlank()) {
|
||||
throw new IllegalArgumentException("DimensionLevelName may not be empty or null");
|
||||
}
|
||||
this.dimensionLevelName = dimensionLevelName;
|
||||
|
@ -1,21 +1,26 @@
|
||||
package com.velocitypowered.proxy.protocol;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.kyori.nbt.CompoundTag;
|
||||
import net.kyori.nbt.ListTag;
|
||||
import net.kyori.nbt.Tag;
|
||||
import net.kyori.nbt.TagType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
|
||||
public class DimensionRegistry {
|
||||
|
||||
private final @Nonnull Map<String, String> dimensionRegistry;
|
||||
private final @Nonnull Set<String> worldNames;
|
||||
|
||||
public DimensionRegistry(Map<String, String> dimensionRegistry, Set<String> worldNames) {
|
||||
if(dimensionRegistry == null || dimensionRegistry.isEmpty() || worldNames == null || worldNames.isEmpty()) {
|
||||
throw new IllegalArgumentException("DimensionRegistry requires valid arguments, not null and not empty");
|
||||
public DimensionRegistry(Map<String, String> dimensionRegistry,
|
||||
Set<String> worldNames) {
|
||||
if (dimensionRegistry == null || dimensionRegistry.isEmpty()
|
||||
|| worldNames == null || worldNames.isEmpty()) {
|
||||
throw new IllegalArgumentException(
|
||||
"DimensionRegistry requires valid arguments, not null and not empty");
|
||||
}
|
||||
this.dimensionRegistry = dimensionRegistry;
|
||||
this.worldNames = worldNames;
|
||||
@ -34,7 +39,8 @@ public class DimensionRegistry {
|
||||
throw new IllegalArgumentException("DimensionName cannot be null!");
|
||||
}
|
||||
if (dimensionName == null || !dimensionRegistry.containsKey(dimensionName)) {
|
||||
throw new NoSuchElementException("DimensionName " + dimensionName + " doesn't exist in this Registry!");
|
||||
throw new NoSuchElementException("DimensionName " + dimensionName
|
||||
+ " doesn't exist in this Registry!");
|
||||
}
|
||||
return dimensionRegistry.get(dimensionName);
|
||||
}
|
||||
@ -48,7 +54,8 @@ public class DimensionRegistry {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException("DimensionIdentifier " + dimensionIdentifier + " doesn't exist in this Registry!");
|
||||
throw new NoSuchElementException("DimensionIdentifier " + dimensionIdentifier
|
||||
+ " doesn't exist in this Registry!");
|
||||
}
|
||||
|
||||
public boolean isValidFor(@Nonnull DimensionInfo toValidate) {
|
||||
@ -61,11 +68,9 @@ public class DimensionRegistry {
|
||||
}
|
||||
getDimensionName(toValidate.getDimensionIdentifier());
|
||||
return true;
|
||||
|
||||
} catch (NoSuchElementException thrown) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompoundTag encodeToCompoundTag() {
|
||||
@ -101,7 +106,8 @@ public class DimensionRegistry {
|
||||
throw new IllegalStateException("DimensionList in CompoundTag contains an mapping");
|
||||
}
|
||||
if (mappings.containsKey(key) || mappings.containsValue(element)) {
|
||||
throw new IllegalStateException("Dimension mappings may not have identifier/name duplicates");
|
||||
throw new IllegalStateException(
|
||||
"Dimension mappings may not have identifier/name duplicates");
|
||||
}
|
||||
mappings.put(key, element);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren