3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-19 13:00:06 +01:00

Misc checkstyle fixes

Dieser Commit ist enthalten in:
md_5 2020-04-14 12:34:43 +10:00
Ursprung 8bd0e9ab0e
Commit ce66f6937b
72 geänderte Dateien mit 149 neuen und 151 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BiomeStorage;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.Blocks;

Datei anzeigen

@ -3,7 +3,7 @@ package org.bukkit.craftbukkit;
import net.minecraft.server.RayTrace.FluidCollisionOption;
import org.bukkit.FluidCollisionMode;
public class CraftFluidCollisionMode {
public final class CraftFluidCollisionMode {
private CraftFluidCollisionMode() {}

Datei anzeigen

@ -1,12 +1,12 @@
package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.function.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityRaider;
import net.minecraft.server.World;

Datei anzeigen

@ -17,6 +17,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
@ -41,7 +42,6 @@ import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import jline.console.ConsoleReader;
import net.minecraft.server.Advancement;
import net.minecraft.server.ArgumentEntity;

Datei anzeigen

@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -20,7 +21,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import net.minecraft.server.ArraySetSorted;
import net.minecraft.server.AxisAlignedBB;
import net.minecraft.server.BiomeBase;
@ -102,10 +102,10 @@ import org.bukkit.FluidCollisionMode;
import org.bukkit.GameRule;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Raid;
import org.bukkit.Sound;
import org.bukkit.StructureType;
import org.bukkit.TreeType;
import org.bukkit.Raid;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.block.Biome;

Datei anzeigen

@ -173,7 +173,6 @@ public class Main {
System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
}
if (options.has("noconsole")) {
useConsole = false;
}

Datei anzeigen

@ -254,10 +254,7 @@ public class CraftBlock implements Block {
BlockFace[] values = BlockFace.values();
for (BlockFace face : values) {
if ((this.getX() + face.getModX() == block.getX()) &&
(this.getY() + face.getModY() == block.getY()) &&
(this.getZ() + face.getModZ() == block.getZ())
) {
if ((this.getX() + face.getModX() == block.getX()) && (this.getY() + face.getModY() == block.getY()) && (this.getZ() + face.getModZ() == block.getZ())) {
return face;
}
}

Datei anzeigen

@ -215,7 +215,7 @@ public class CraftBossBar implements BossBar {
}
}
private class FlagContainer {
private final class FlagContainer {
private Supplier<Boolean> get;
private Consumer<Boolean> set;

Datei anzeigen

@ -9,7 +9,6 @@ import net.minecraft.server.EntityEnderDragon;
import org.bukkit.boss.BossBar;
import org.bukkit.boss.DragonBattle;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.boss.CraftBossBar;
import org.bukkit.craftbukkit.boss.CraftDragonBattle;
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.EnderDragon;

Datei anzeigen

@ -180,9 +180,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public static CraftEntity getEntity(CraftServer server, Entity entity) {
/**
/*
* Order is *EXTREMELY* important -- keep it right! =D
*/
// CHECKSTYLE:OFF
if (entity instanceof EntityLiving) {
// Players
if (entity instanceof EntityHuman) {
@ -368,6 +369,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityAreaEffectCloud) { return new CraftAreaEffectCloud(server, (EntityAreaEffectCloud) entity); }
else if (entity instanceof EntityEvokerFangs) { return new CraftEvokerFangs(server, (EntityEvokerFangs) entity); }
else if (entity instanceof EntityLlamaSpit) { return new CraftLlamaSpit(server, (EntityLlamaSpit) entity); }
// CHECKSTYLE:ON
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
}

Datei anzeigen

@ -45,11 +45,11 @@ import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryKey;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryMapper;
import org.bukkit.craftbukkit.inventory.CraftEntityEquipment;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryKey;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryMapper;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.DragonFireball;
import org.bukkit.entity.Egg;

Datei anzeigen

@ -2,12 +2,12 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import java.util.Locale;
import net.minecraft.server.BlockBed;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityVillager;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IRegistry;
import net.minecraft.server.VillagerProfession;
import net.minecraft.server.IBlockData;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.BlockBed;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;

Datei anzeigen

@ -37,9 +37,9 @@ import net.minecraft.server.EntityLiving;
import net.minecraft.server.EntityMonster;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityPotion;
import net.minecraft.server.EntityRaider;
import net.minecraft.server.EntitySheep;
import net.minecraft.server.EntitySlime;
import net.minecraft.server.EntityRaider;
import net.minecraft.server.EntityTypes;
import net.minecraft.server.EntityVillager;
import net.minecraft.server.EntityWaterAnimal;
@ -81,8 +81,8 @@ import org.bukkit.craftbukkit.block.CraftBlockState;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftRaider;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftRaider;
import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftMetaBook;
@ -192,12 +192,12 @@ import org.bukkit.event.player.PlayerLevelChangeEvent;
import org.bukkit.event.player.PlayerRecipeDiscoverEvent;
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import org.bukkit.event.player.PlayerUnleashEntityEvent;
import org.bukkit.event.raid.RaidFinishEvent;
import org.bukkit.event.raid.RaidSpawnWaveEvent;
import org.bukkit.event.raid.RaidStopEvent;
import org.bukkit.event.raid.RaidTriggerEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.raid.RaidTriggerEvent;
import org.bukkit.event.raid.RaidFinishEvent;
import org.bukkit.event.raid.RaidStopEvent;
import org.bukkit.event.raid.RaidSpawnWaveEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.meta.BookMeta;

Datei anzeigen

@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.inventory;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap.Builder;
import java.util.ArrayList;

Datei anzeigen

@ -85,7 +85,7 @@ import org.bukkit.persistence.PersistentDataContainer;
*
* <li> Constructor(CraftMetaItem meta)
* <li> Constructor(NBTTagCompound tag)
* <li> Constructor(Map<String, Object> map)
* <li> Constructor(Map&lt;String, Object&gt; map)
* <br><br>
* <li> void applyToItem(NBTTagCompound tag)
* <li> boolean applicableTo(Material type)
@ -99,7 +99,7 @@ import org.bukkit.persistence.PersistentDataContainer;
* <li> int applyHash()
* <li> public Class clone()
* <br><br>
* <li> Builder<String, Object> serialize(Builder<String, Object> builder)
* <li> Builder&lt;String, Object&gt; serialize(Builder&lt;String, Object&gt; builder)
* <li> SerializableMeta.Deserializers deserializer()
*/
@DelegateDeserialization(CraftMetaItem.SerializableMeta.class)
@ -132,7 +132,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
@SerializableAs("ItemMeta")
public static class SerializableMeta implements ConfigurationSerializable {
public static final class SerializableMeta implements ConfigurationSerializable {
static final String TYPE_FIELD = "meta-type";
static final ImmutableMap<Class<? extends CraftMetaItem>, String> classMap;

Datei anzeigen

@ -1,11 +1,11 @@
package org.bukkit.craftbukkit.inventory;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap.Builder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap.Builder;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.NBTTagList;
import org.apache.commons.lang.Validate;

Datei anzeigen

@ -98,8 +98,8 @@ public class CraftMapCanvas implements MapCanvas {
color = Byte.parseByte(text.substring(i + 1, j));
i = j;
continue;
} catch (NumberFormatException ex) {
}
catch (NumberFormatException ex) {}
}
throw new IllegalArgumentException("Text contains unterminated color string");
}

Datei anzeigen

@ -35,8 +35,7 @@ public final class CraftMapView implements MapView {
if (text.startsWith("map_")) {
try {
return Integer.parseInt(text.substring("map_".length()));
}
catch (NumberFormatException ex) {
} catch (NumberFormatException ex) {
throw new IllegalStateException("Map has non-numeric ID");
}
} else {

Datei anzeigen

@ -1,11 +1,11 @@
package org.bukkit.craftbukkit.persistence;
import com.google.common.primitives.Primitives;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import com.google.common.primitives.Primitives;
import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagByte;
import net.minecraft.server.NBTTagByteArray;

Datei anzeigen

@ -26,7 +26,6 @@ import org.bukkit.block.Block;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Fireball;

Datei anzeigen

@ -2,7 +2,6 @@ package org.bukkit.craftbukkit.scheduler;
import org.bukkit.plugin.Plugin;
class CraftAsyncDebugger {
private CraftAsyncDebugger next = null;
private final int expiry;

Datei anzeigen

@ -82,7 +82,12 @@ public class CraftScheduler implements BukkitScheduler {
private volatile CraftTask currentTask = null;
private volatile int currentTick = -1;
private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build());
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}};
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {
@Override
StringBuilder debugTo(StringBuilder string) {
return string;
}
};
private CraftAsyncDebugger debugTail = debugHead;
private static final int RECENT_TICKS;
@ -248,7 +253,8 @@ public class CraftScheduler implements BukkitScheduler {
}
}
return false;
}});
}
});
handle(task, 0L);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {

Datei anzeigen

@ -6,7 +6,7 @@ import net.minecraft.server.Scoreboard;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.RenderType;
class CraftScoreboardTranslations {
final class CraftScoreboardTranslations {
static final int MAX_DISPLAY_SLOT = 3;
static ImmutableBiMap<DisplaySlot, String> SLOTS = ImmutableBiMap.of(
DisplaySlot.BELOW_NAME, "belowName",

Datei anzeigen

@ -29,6 +29,7 @@ import org.objectweb.asm.Type;
*
* @author md_5
*/
// CHECKSTYLE:OFF
public class Commodore
{

Datei anzeigen

@ -37,7 +37,7 @@ public final class CraftChatMessage {
return ChatColor.getByChar(format.character);
}
private static class StringMessage {
private static final class StringMessage {
private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-or])|(\\n)|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " \\n]|$))))", Pattern.CASE_INSENSITIVE);
private final List<IChatBaseComponent> list = new ArrayList<IChatBaseComponent>();
@ -207,8 +207,7 @@ public final class CraftChatMessage {
if (matcher.reset(msg).find()) {
matcher.reset();
ChatModifier modifier = text.getChatModifier() != null ?
text.getChatModifier() : new ChatModifier();
ChatModifier modifier = text.getChatModifier() != null ? text.getChatModifier() : new ChatModifier();
List<IChatBaseComponent> extras = new ArrayList<IChatBaseComponent>();
List<IChatBaseComponent> extrasOld = new ArrayList<IChatBaseComponent>(text.getSiblings());
component = text = new ChatComponentText("");

Datei anzeigen

@ -14,7 +14,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
public class CraftRayTraceResult {
public final class CraftRayTraceResult {
private CraftRayTraceResult() {}

Datei anzeigen

@ -19,9 +19,9 @@ import org.junit.Assert;
/**
* If you are getting: java.lang.ExceptionInInitializerError
* at net.minecraft.server.StatisticList.<clinit>(SourceFile:58)
* at net.minecraft.server.Item.<clinit>(SourceFile:252)
* at net.minecraft.server.Block.<clinit>(Block.java:577)
* at net.minecraft.server.StatisticList.&lt;clinit&gt;(SourceFile:58)
* at net.minecraft.server.Item.&lt;clinit&gt;(SourceFile:252)
* at net.minecraft.server.Block.&lt;clinit&gt;(Block.java:577)
*
* extend this class to solve it.
*/

Datei anzeigen

@ -16,7 +16,7 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.Versioning;
public class DummyServer implements InvocationHandler {
public final class DummyServer implements InvocationHandler {
private static interface MethodHandler {
Object handle(DummyServer server, Object[] args);
}