Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-23 14:50:08 +01:00
Misc checkstyle fixes
Dieser Commit ist enthalten in:
Ursprung
8bd0e9ab0e
Commit
ce66f6937b
@ -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;
|
||||
@ -286,7 +285,7 @@ public class CraftChunk implements Chunk {
|
||||
|
||||
BiomeStorage biome = null;
|
||||
|
||||
if (includeBiome|| includeBiomeTempRain) {
|
||||
if (includeBiome || includeBiomeTempRain) {
|
||||
biome = chunk.getBiomeIndex().b();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.potion.Potion;
|
||||
public class CraftEffect {
|
||||
public static <T> int getDataValue(Effect effect, T data) {
|
||||
int datavalue;
|
||||
switch(effect) {
|
||||
switch (effect) {
|
||||
case VILLAGER_PLANT_GROW:
|
||||
datavalue = (Integer) data;
|
||||
break;
|
||||
@ -24,7 +24,7 @@ public class CraftEffect {
|
||||
datavalue = Item.getId(CraftMagicNumbers.getItem((Material) data));
|
||||
break;
|
||||
case SMOKE:
|
||||
switch((BlockFace) data) { // TODO: Verify (Where did these values come from...?)
|
||||
switch ((BlockFace) data) { // TODO: Verify (Where did these values come from...?)
|
||||
case SOUTH_EAST:
|
||||
datavalue = 0;
|
||||
break;
|
||||
|
@ -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() {}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import org.bukkit.Bukkit;
|
||||
public class CraftProfileBanList implements org.bukkit.BanList {
|
||||
private final GameProfileBanList list;
|
||||
|
||||
public CraftProfileBanList(GameProfileBanList list){
|
||||
public CraftProfileBanList(GameProfileBanList list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -676,7 +676,7 @@ public final class CraftServer implements Server {
|
||||
// NOTE: Should only be called from DedicatedServer.ah()
|
||||
public boolean dispatchServerCommand(CommandSender sender, ServerCommand serverCommand) {
|
||||
if (sender instanceof Conversable) {
|
||||
Conversable conversable = (Conversable)sender;
|
||||
Conversable conversable = (Conversable) sender;
|
||||
|
||||
if (conversable.isConversing()) {
|
||||
conversable.acceptConversationInput(serverCommand.command);
|
||||
@ -933,7 +933,7 @@ public final class CraftServer implements Server {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while(used);
|
||||
} while (used);
|
||||
boolean hardcore = creator.hardcore();
|
||||
|
||||
WorldNBTStorage sdm = new WorldNBTStorage(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager);
|
||||
@ -1409,7 +1409,7 @@ public final class CraftServer implements Server {
|
||||
public BanList getBanList(BanList.Type type) {
|
||||
Validate.notNull(type, "Type cannot be null");
|
||||
|
||||
switch(type){
|
||||
switch (type) {
|
||||
case IP:
|
||||
return new CraftIpBanList(playerList.getIPBans());
|
||||
case NAME:
|
||||
|
@ -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;
|
||||
@ -621,7 +621,7 @@ public class CraftWorld implements World {
|
||||
((EntityTippedArrow) arrow).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
|
||||
} else if (SpectralArrow.class.isAssignableFrom(clazz)) {
|
||||
arrow = EntityTypes.SPECTRAL_ARROW.a(world);
|
||||
} else if (Trident.class.isAssignableFrom(clazz)){
|
||||
} else if (Trident.class.isAssignableFrom(clazz)) {
|
||||
arrow = EntityTypes.TRIDENT.a(world);
|
||||
} else {
|
||||
arrow = EntityTypes.ARROW.a(world);
|
||||
@ -1009,7 +1009,7 @@ public class CraftWorld implements World {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... classes) {
|
||||
return (Collection<T>)getEntitiesByClasses(classes);
|
||||
return (Collection<T>) getEntitiesByClasses(classes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1561,7 +1561,7 @@ public class CraftWorld implements World {
|
||||
entity = EntityTypes.HORSE.a(world);
|
||||
}
|
||||
} else if (Skeleton.class.isAssignableFrom(clazz)) {
|
||||
if (Stray.class.isAssignableFrom(clazz)){
|
||||
if (Stray.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.STRAY.a(world);
|
||||
} else if (WitherSkeleton.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.WITHER_SKELETON.a(world);
|
||||
@ -1633,7 +1633,7 @@ public class CraftWorld implements World {
|
||||
} else if (Endermite.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.ENDERMITE.a(world);
|
||||
} else if (Guardian.class.isAssignableFrom(clazz)) {
|
||||
if (ElderGuardian.class.isAssignableFrom(clazz)){
|
||||
if (ElderGuardian.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.ELDER_GUARDIAN.a(world);
|
||||
} else {
|
||||
entity = EntityTypes.GUARDIAN.a(world);
|
||||
|
@ -156,8 +156,8 @@ public class Main {
|
||||
|
||||
try {
|
||||
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
|
||||
String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'});
|
||||
String jline_terminal = new String(new char[] {'j','l','i','n','e','.','t','e','r','m','i','n','a','l'});
|
||||
String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
|
||||
String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
|
||||
|
||||
useJline = !(jline_UnsupportedTerminal).equals(System.getProperty(jline_terminal));
|
||||
|
||||
@ -173,7 +173,6 @@ public class Main {
|
||||
System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
|
||||
}
|
||||
|
||||
|
||||
if (options.has("noconsole")) {
|
||||
useConsole = false;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
||||
}
|
||||
|
||||
static int getSkullType(SkullType type) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
default:
|
||||
case SKELETON:
|
||||
return 0;
|
||||
|
@ -215,7 +215,7 @@ public class CraftBossBar implements BossBar {
|
||||
}
|
||||
}
|
||||
|
||||
private class FlagContainer {
|
||||
private final class FlagContainer {
|
||||
|
||||
private Supplier<Boolean> get;
|
||||
private Consumer<Boolean> set;
|
||||
|
@ -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;
|
||||
|
@ -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()));
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
||||
|
||||
if (this.biteChance == -1) {
|
||||
if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) {
|
||||
return 1/300.0;
|
||||
return 1 / 300.0;
|
||||
}
|
||||
return 1/500.0;
|
||||
return 1 / 500.0;
|
||||
}
|
||||
return this.biteChance;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||
|
||||
old.die();
|
||||
|
||||
EntityItemFrame frame = new EntityItemFrame(world,position,direction);
|
||||
EntityItemFrame frame = new EntityItemFrame(world, position, direction);
|
||||
frame.setItem(item);
|
||||
world.addEntity(frame);
|
||||
this.entity = frame;
|
||||
|
@ -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;
|
||||
|
@ -75,7 +75,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
||||
|
||||
@Override
|
||||
public void setDisplayBlock(MaterialData material) {
|
||||
if(material != null) {
|
||||
if (material != null) {
|
||||
IBlockData block = CraftMagicNumbers.getBlock(material);
|
||||
this.getHandle().setDisplayBlock(block);
|
||||
} else {
|
||||
|
@ -229,7 +229,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
name = getName();
|
||||
}
|
||||
getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromStringOrNull(name);
|
||||
for (EntityPlayer player : (List<EntityPlayer>)server.getHandle().players) {
|
||||
for (EntityPlayer player : (List<EntityPlayer>) server.getHandle().players) {
|
||||
if (player.getBukkitEntity().canSee(this)) {
|
||||
player.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle()));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
|
||||
|
||||
@Override
|
||||
public EntityTameableAnimal getHandle() {
|
||||
return (EntityTameableAnimal)super.getHandle();
|
||||
return (EntityTameableAnimal) super.getHandle();
|
||||
}
|
||||
|
||||
public UUID getOwnerUUID() {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -510,7 +510,7 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static boolean doEntityAddEventCalling(World world, Entity entity, SpawnReason spawnReason){
|
||||
public static boolean doEntityAddEventCalling(World world, Entity entity, SpawnReason spawnReason) {
|
||||
if (entity == null) return false;
|
||||
|
||||
org.bukkit.event.Cancellable event = null;
|
||||
@ -532,7 +532,7 @@ public class CraftEventFactory {
|
||||
} else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Projectile) {
|
||||
// Not all projectiles extend EntityProjectile, so check for Bukkit interface instead
|
||||
event = CraftEventFactory.callProjectileLaunchEvent(entity);
|
||||
} else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Vehicle){
|
||||
} else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Vehicle) {
|
||||
event = CraftEventFactory.callVehicleCreateEvent(entity);
|
||||
} else if (!(entity instanceof EntityPlayer)) {
|
||||
event = CraftEventFactory.callEntitySpawnEvent(entity);
|
||||
|
@ -136,7 +136,7 @@ public class SimpleHelpMap implements HelpMap {
|
||||
if (t != null) addTopic(t);
|
||||
continue outer;
|
||||
}
|
||||
if (command instanceof PluginCommand && c.isAssignableFrom(((PluginCommand)command).getExecutor().getClass())) {
|
||||
if (command instanceof PluginCommand && c.isAssignableFrom(((PluginCommand) command).getExecutor().getClass())) {
|
||||
HelpTopic t = topicFactoryMap.get(c).createTopic(command);
|
||||
if (t != null) addTopic(t);
|
||||
continue outer;
|
||||
@ -206,7 +206,7 @@ public class SimpleHelpMap implements HelpMap {
|
||||
return "Bukkit";
|
||||
}
|
||||
if (command instanceof PluginIdentifiableCommand) {
|
||||
return ((PluginIdentifiableCommand)command).getPlugin().getName();
|
||||
return ((PluginIdentifiableCommand) command).getPlugin().getName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -215,7 +215,7 @@ public class SimpleHelpMap implements HelpMap {
|
||||
if ((command instanceof BukkitCommand) && ignoredPlugins.contains("Bukkit")) {
|
||||
return true;
|
||||
}
|
||||
if (command instanceof PluginIdentifiableCommand && ignoredPlugins.contains(((PluginIdentifiableCommand)command).getPlugin().getName())) {
|
||||
if (command instanceof PluginIdentifiableCommand && ignoredPlugins.contains(((PluginIdentifiableCommand) command).getPlugin().getName())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -126,7 +126,7 @@ public class CraftContainer extends Container {
|
||||
case CHEST:
|
||||
case ENDER_CHEST:
|
||||
case BARREL:
|
||||
switch(inventory.getSize()) {
|
||||
switch (inventory.getSize()) {
|
||||
case 9:
|
||||
return Containers.GENERIC_9X1;
|
||||
case 18:
|
||||
|
@ -132,7 +132,7 @@ public class CraftInventory implements Inventory {
|
||||
return true;
|
||||
}
|
||||
for (ItemStack item : getStorageContents()) {
|
||||
if (item != null && item.getType()== material) {
|
||||
if (item != null && item.getType() == material) {
|
||||
if ((amount -= item.getAmount()) <= 0) {
|
||||
return true;
|
||||
}
|
||||
@ -182,7 +182,7 @@ public class CraftInventory implements Inventory {
|
||||
ItemStack[] inventory = getStorageContents();
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
ItemStack item = inventory[i];
|
||||
if (item != null && item.getType()== material) {
|
||||
if (item != null && item.getType() == material) {
|
||||
slots.put(i, item);
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class CraftInventory implements Inventory {
|
||||
ItemStack[] inventory = getStorageContents();
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
ItemStack item = inventory[i];
|
||||
if (item != null && item.getType()== material) {
|
||||
if (item != null && item.getType() == material) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class CraftInventory implements Inventory {
|
||||
ItemStack[] inventory = getStorageContents();
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
ItemStack item = inventory[i];
|
||||
if (item != null && item.getType()== material && item.getAmount() < item.getMaxStackSize()) {
|
||||
if (item != null && item.getType() == material && item.getAmount() < item.getMaxStackSize()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ public class CraftInventory implements Inventory {
|
||||
material = CraftLegacy.fromLegacy(material);
|
||||
ItemStack[] items = getStorageContents();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] != null && items[i].getType()== material) {
|
||||
if (items[i] != null && items[i].getType() == material) {
|
||||
clear(i);
|
||||
}
|
||||
}
|
||||
@ -460,7 +460,7 @@ public class CraftInventory implements Inventory {
|
||||
} else if (inventory instanceof TileEntityFurnace) {
|
||||
return InventoryType.FURNACE;
|
||||
} else if (this instanceof CraftInventoryEnchanting) {
|
||||
return InventoryType.ENCHANTING;
|
||||
return InventoryType.ENCHANTING;
|
||||
} else if (inventory instanceof TileEntityBrewingStand) {
|
||||
return InventoryType.BREWING;
|
||||
} else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) {
|
||||
@ -472,7 +472,7 @@ public class CraftInventory implements Inventory {
|
||||
} else if (this instanceof CraftInventoryBeacon) {
|
||||
return InventoryType.BEACON;
|
||||
} else if (this instanceof CraftInventoryAnvil) {
|
||||
return InventoryType.ANVIL;
|
||||
return InventoryType.ANVIL;
|
||||
} else if (inventory instanceof IHopper) {
|
||||
return InventoryType.HOPPER;
|
||||
} else if (inventory instanceof TileEntityShulkerBox) {
|
||||
|
@ -43,7 +43,7 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
|
||||
List<net.minecraft.server.ItemStack> mcResultItems = getResultInventory().getContents();
|
||||
|
||||
int i = 0;
|
||||
for (i = 0; i < mcResultItems.size(); i++ ) {
|
||||
for (i = 0; i < mcResultItems.size(); i++) {
|
||||
items[i] = CraftItemStack.asCraftMirror(mcResultItems.get(i));
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ public class CraftInventoryEnchanting extends CraftInventory implements Enchanti
|
||||
|
||||
@Override
|
||||
public void setItem(ItemStack item) {
|
||||
setItem(0,item);
|
||||
setItem(0, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,17 +27,17 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
|
||||
|
||||
@Override
|
||||
public void setFuel(ItemStack stack) {
|
||||
setItem(1,stack);
|
||||
setItem(1, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResult(ItemStack stack) {
|
||||
setItem(2,stack);
|
||||
setItem(2, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSmelting(ItemStack stack) {
|
||||
setItem(0,stack);
|
||||
setItem(0, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,11 +154,11 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
|
||||
ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
|
||||
super.serialize(builder);
|
||||
|
||||
if(base != null){
|
||||
if (base != null) {
|
||||
builder.put(BASE.BUKKIT, base.toString());
|
||||
}
|
||||
|
||||
if(!patterns.isEmpty()){
|
||||
if (!patterns.isEmpty()) {
|
||||
builder.put(PATTERNS.BUKKIT, ImmutableList.copyOf(patterns));
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
||||
|
||||
@Override
|
||||
boolean applicableTo(Material type) {
|
||||
switch(type){
|
||||
switch (type) {
|
||||
case FURNACE:
|
||||
case CHEST:
|
||||
case TRAPPED_CHEST:
|
||||
@ -459,58 +459,58 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
||||
}
|
||||
return new CraftEnchantingTable(material, (TileEntityEnchantTable) te);
|
||||
case ENDER_CHEST:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityEnderChest();
|
||||
}
|
||||
return new CraftEnderChest(material, (TileEntityEnderChest) te);
|
||||
case DAYLIGHT_DETECTOR:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityLightDetector();
|
||||
}
|
||||
return new CraftDaylightDetector(material, (TileEntityLightDetector) te);
|
||||
case COMPARATOR:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityComparator();
|
||||
}
|
||||
return new CraftComparator(material, (TileEntityComparator) te);
|
||||
case BARREL:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityBarrel();
|
||||
}
|
||||
return new CraftBarrel(material, (TileEntityBarrel) te);
|
||||
case BELL:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityBell();
|
||||
}
|
||||
return new CraftBell(material, (TileEntityBell) te);
|
||||
case BLAST_FURNACE:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityBlastFurnace();
|
||||
}
|
||||
return new CraftBlastFurnace(material, (TileEntityBlastFurnace) te);
|
||||
case CAMPFIRE:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityCampfire();
|
||||
}
|
||||
return new CraftCampfire(material, (TileEntityCampfire) te);
|
||||
case JIGSAW:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityJigsaw();
|
||||
}
|
||||
return new CraftJigsaw(material, (TileEntityJigsaw) te);
|
||||
case LECTERN:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityLectern();
|
||||
}
|
||||
return new CraftLectern(material, (TileEntityLectern) te);
|
||||
case SMOKER:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntitySmoker();
|
||||
}
|
||||
return new CraftSmoker(material, (TileEntitySmoker) te);
|
||||
case BEE_NEST:
|
||||
case BEEHIVE:
|
||||
if (te == null){
|
||||
if (te == null) {
|
||||
te = new TileEntityBeehive();
|
||||
}
|
||||
return new CraftBeehive(material, (TileEntityBeehive) te);
|
||||
|
@ -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;
|
||||
@ -97,7 +96,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
setTitle(SerializableMeta.getString(map, BOOK_TITLE.BUKKIT, true));
|
||||
|
||||
Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true);
|
||||
if(pages != null) {
|
||||
if (pages != null) {
|
||||
for (Object page : pages) {
|
||||
if (page instanceof String) {
|
||||
addPage((String) page);
|
||||
|
@ -254,7 +254,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
||||
|
||||
@Override
|
||||
boolean applicableTo(Material type) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case FIREWORK_ROCKET:
|
||||
return true;
|
||||
default:
|
||||
@ -268,7 +268,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
||||
}
|
||||
|
||||
boolean isFireworkEmpty() {
|
||||
return !(hasEffects() || hasPower());
|
||||
return !(hasEffects() || hasPower());
|
||||
}
|
||||
|
||||
boolean hasPower() {
|
||||
|
@ -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<String, Object> 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<String, Object> serialize(Builder<String, Object> 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;
|
||||
@ -617,7 +617,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
if (hasDisplayName()) {
|
||||
setDisplayTag(itemTag, NAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(displayName)));
|
||||
}
|
||||
if (hasLocalizedName()){
|
||||
if (hasLocalizedName()) {
|
||||
setDisplayTag(itemTag, LOCNAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(locName)));
|
||||
}
|
||||
|
||||
@ -1131,7 +1131,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@Overridden
|
||||
boolean equalsCommon(CraftMetaItem that) {
|
||||
return ((this.hasDisplayName() ? that.hasDisplayName() && this.displayName.equals(that.displayName) : !that.hasDisplayName()))
|
||||
&& (this.hasLocalizedName()? that.hasLocalizedName()&& this.locName.equals(that.locName) : !that.hasLocalizedName())
|
||||
&& (this.hasLocalizedName() ? that.hasLocalizedName() && this.locName.equals(that.locName) : !that.hasLocalizedName())
|
||||
&& (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants())
|
||||
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
|
||||
&& (this.hasCustomModelData() ? that.hasCustomModelData() && this.customModelData.equals(that.customModelData) : !that.hasCustomModelData())
|
||||
@ -1165,7 +1165,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
int applyHash() {
|
||||
int hash = 3;
|
||||
hash = 61 * hash + (hasDisplayName() ? this.displayName.hashCode() : 0);
|
||||
hash = 61 * hash + (hasLocalizedName()? this.locName.hashCode() : 0);
|
||||
hash = 61 * hash + (hasLocalizedName() ? this.locName.hashCode() : 0);
|
||||
hash = 61 * hash + (hasLore() ? this.lore.hashCode() : 0);
|
||||
hash = 61 * hash + (hasCustomModelData() ? this.customModelData.hashCode() : 0);
|
||||
hash = 61 * hash + (hasBlockData() ? this.blockData.hashCode() : 0);
|
||||
|
@ -66,7 +66,7 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta {
|
||||
|
||||
@Override
|
||||
boolean applicableTo(Material type) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_HORSE_ARMOR:
|
||||
case LEATHER_CHESTPLATE:
|
||||
|
@ -100,7 +100,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
|
||||
void applyToItem(NBTTagCompound tag) {
|
||||
super.applyToItem(tag);
|
||||
|
||||
if (hasMapId()){
|
||||
if (hasMapId()) {
|
||||
tag.setInt(MAP_ID.NBT, getMapId());
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
|
||||
@Override
|
||||
boolean applicableTo(Material type) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case POTION:
|
||||
case SPLASH_POTION:
|
||||
case LINGERING_POTION:
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -32,7 +32,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
|
||||
*/
|
||||
@Override
|
||||
protected String disambiguate(Block block, String metadataKey) {
|
||||
return Integer.toString(block.getX()) + ":" + Integer.toString(block.getY()) + ":" + Integer.toString(block.getZ()) + ":" + metadataKey;
|
||||
return Integer.toString(block.getX()) + ":" + Integer.toString(block.getY()) + ":" + Integer.toString(block.getZ()) + ":" + metadataKey;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
|
||||
*/
|
||||
@Override
|
||||
public List<MetadataValue> getMetadata(Block block, String metadataKey) {
|
||||
if(block.getWorld() == owningWorld) {
|
||||
if (block.getWorld() == owningWorld) {
|
||||
return super.getMetadata(block, metadataKey);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
|
||||
@ -56,7 +56,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
|
||||
*/
|
||||
@Override
|
||||
public boolean hasMetadata(Block block, String metadataKey) {
|
||||
if(block.getWorld() == owningWorld) {
|
||||
if (block.getWorld() == owningWorld) {
|
||||
return super.hasMetadata(block, metadataKey);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
|
||||
@ -70,7 +70,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
|
||||
*/
|
||||
@Override
|
||||
public void removeMetadata(Block block, String metadataKey, Plugin owningPlugin) {
|
||||
if(block.getWorld() == owningWorld) {
|
||||
if (block.getWorld() == owningWorld) {
|
||||
super.removeMetadata(block, metadataKey, owningPlugin);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
|
||||
@ -84,7 +84,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
|
||||
*/
|
||||
@Override
|
||||
public void setMetadata(Block block, String metadataKey, MetadataValue newMetadataValue) {
|
||||
if(block.getWorld() == owningWorld) {
|
||||
if (block.getWorld() == owningWorld) {
|
||||
super.setMetadata(block, metadataKey, newMetadataValue);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -2,14 +2,13 @@ package org.bukkit.craftbukkit.scheduler;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
class CraftAsyncDebugger {
|
||||
private CraftAsyncDebugger next = null;
|
||||
private final int expiry;
|
||||
private final Plugin plugin;
|
||||
private final Class<?> clazz;
|
||||
|
||||
CraftAsyncDebugger(final int expiry, final Plugin plugin, final Class<?> clazz) {
|
||||
CraftAsyncDebugger(final int expiry, final Plugin plugin, final Class<?> clazz) {
|
||||
this.expiry = expiry;
|
||||
this.plugin = plugin;
|
||||
this.clazz = clazz;
|
||||
|
@ -25,7 +25,7 @@ class CraftAsyncTask extends CraftTask {
|
||||
@Override
|
||||
public void run() {
|
||||
final Thread thread = Thread.currentThread();
|
||||
synchronized(workers) {
|
||||
synchronized (workers) {
|
||||
if (getPeriod() == CraftTask.CANCEL) {
|
||||
// Never continue running after cancelled.
|
||||
// Checking this with the lock is important!
|
||||
@ -63,7 +63,7 @@ class CraftAsyncTask extends CraftTask {
|
||||
thrown);
|
||||
} finally {
|
||||
// Cleanup is important for any async task, otherwise ghost tasks are everywhere
|
||||
synchronized(workers) {
|
||||
synchronized (workers) {
|
||||
try {
|
||||
final Iterator<BukkitWorker> workers = this.workers.iterator();
|
||||
boolean removed = false;
|
||||
|
@ -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) {
|
||||
@ -465,8 +471,8 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
// We split this because of the way things are ordered for all of the async calls in CraftScheduler
|
||||
// (it prevents race-conditions)
|
||||
for (task = head; task != lastTask; task = head) {
|
||||
head = task.getNext();
|
||||
task.setNext(null);
|
||||
head = task.getNext();
|
||||
task.setNext(null);
|
||||
}
|
||||
this.head = lastTask;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ final class CraftCriteria {
|
||||
static {
|
||||
ImmutableMap.Builder<String, CraftCriteria> defaults = ImmutableMap.builder();
|
||||
|
||||
for (Map.Entry<?, ?> entry : ((Map<?,?> ) IScoreboardCriteria.criteria).entrySet()) {
|
||||
for (Map.Entry<?, ?> entry : ((Map<?, ?>) IScoreboardCriteria.criteria).entrySet()) {
|
||||
String name = entry.getKey().toString();
|
||||
IScoreboardCriteria criteria = (IScoreboardCriteria) entry.getValue();
|
||||
|
||||
|
@ -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",
|
||||
|
@ -149,7 +149,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
CraftScoreboard scoreboard = checkState();
|
||||
|
||||
ImmutableSet.Builder<String> entries = ImmutableSet.builder();
|
||||
for (String playerName: team.getPlayerNameSet()){
|
||||
for (String playerName : team.getPlayerNameSet()) {
|
||||
entries.add(playerName);
|
||||
}
|
||||
return entries.build();
|
||||
|
@ -29,6 +29,7 @@ import org.objectweb.asm.Type;
|
||||
*
|
||||
* @author md_5
|
||||
*/
|
||||
// CHECKSTYLE:OFF
|
||||
public class Commodore
|
||||
{
|
||||
|
||||
|
@ -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>();
|
||||
@ -47,10 +47,10 @@ public final class CraftChatMessage {
|
||||
private int currentIndex;
|
||||
private final String message;
|
||||
|
||||
private StringMessage(String message, boolean keepNewlines) {
|
||||
private StringMessage(String message, boolean keepNewlines) {
|
||||
this.message = message;
|
||||
if (message == null) {
|
||||
output = new IChatBaseComponent[] { currentChatComponent };
|
||||
output = new IChatBaseComponent[]{currentChatComponent};
|
||||
return;
|
||||
}
|
||||
list.add(currentChatComponent);
|
||||
@ -100,7 +100,7 @@ public final class CraftChatMessage {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) {
|
||||
if (!(match.startsWith("http://") || match.startsWith("https://"))) {
|
||||
match = "http://" + match;
|
||||
}
|
||||
modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
|
||||
@ -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("");
|
||||
@ -217,7 +216,7 @@ public final class CraftChatMessage {
|
||||
while (matcher.find()) {
|
||||
String match = matcher.group();
|
||||
|
||||
if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) {
|
||||
if (!(match.startsWith("http://") || match.startsWith("https://"))) {
|
||||
match = "http://" + match;
|
||||
}
|
||||
|
||||
@ -262,7 +261,7 @@ public final class CraftChatMessage {
|
||||
if (c.getChatModifier() != null && c.getChatModifier().getClickEvent() == null) {
|
||||
subs[i] = fixComponent(c, matcher);
|
||||
}
|
||||
} else if (comp instanceof String && matcher.reset((String)comp).find()) {
|
||||
} else if (comp instanceof String && matcher.reset((String) comp).find()) {
|
||||
subs[i] = fixComponent(new ChatComponentText((String) comp), matcher);
|
||||
}
|
||||
}
|
||||
|
@ -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() {}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public abstract class LazyHashSet<E> implements Set<E> {
|
||||
}
|
||||
|
||||
public Set<E> getReference() {
|
||||
Set<E> reference = this.reference ;
|
||||
Set<E> reference = this.reference;
|
||||
if (reference != null) {
|
||||
return reference;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public final class WeakCollection<T> implements Collection<T> {
|
||||
|
||||
@Override
|
||||
public boolean contains(Object object) {
|
||||
if (object == null) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
for (T compare : this) {
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.util.permissions.DefaultPermissions;
|
||||
|
||||
public final class CraftDefaultPermissions {
|
||||
private static final String ROOT= "minecraft";
|
||||
private static final String ROOT = "minecraft";
|
||||
|
||||
private CraftDefaultPermissions() {}
|
||||
|
||||
|
@ -15,7 +15,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class DyeColorsTest extends AbstractTestingBase {
|
||||
|
||||
@Parameters(name= "{index}: {0}")
|
||||
@Parameters(name = "{index}: {0}")
|
||||
public static List<Object[]> data() {
|
||||
List<Object[]> list = new ArrayList<Object[]>();
|
||||
for (DyeColor dye : DyeColor.values()) {
|
||||
|
@ -40,7 +40,7 @@ public class PerMaterialTest extends AbstractTestingBase {
|
||||
fireValues = Util.getInternalState(BlockFire.class, Blocks.FIRE, "flameChances");
|
||||
}
|
||||
|
||||
@Parameters(name= "{index}: {0}")
|
||||
@Parameters(name = "{index}: {0}")
|
||||
public static List<Object[]> data() {
|
||||
List<Object[]> list = Lists.newArrayList();
|
||||
for (Material material : Material.values()) {
|
||||
@ -91,7 +91,7 @@ public class PerMaterialTest extends AbstractTestingBase {
|
||||
|
||||
if (material == Material.AIR) {
|
||||
assertThat((int) material.getMaxDurability(), is(0));
|
||||
} else if (material.isBlock()){
|
||||
} else if (material.isBlock()) {
|
||||
Item item = CraftMagicNumbers.getItem(material);
|
||||
assertThat((int) material.getMaxDurability(), is(item.getMaxDurability()));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class FactoryItemMaterialTest extends AbstractTestingBase {
|
||||
return buffer.delete(0, Integer.MAX_VALUE).append(from.getClass().getName()).append('(').append(from.name()).append(") to ").append(to.getClass().getName()).append('(').append(to.name()).append(')').toString();
|
||||
}
|
||||
|
||||
@Parameters(name="Material[{index}]:{0}")
|
||||
@Parameters(name = "Material[{index}]:{0}")
|
||||
public static List<Object[]> data() {
|
||||
List<Object[]> list = new ArrayList<Object[]>();
|
||||
for (Material material : materials) {
|
||||
|
@ -19,7 +19,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
public class ItemMetaImplementationOverrideTest {
|
||||
static final Class<CraftMetaItem> parent = CraftMetaItem.class;
|
||||
|
||||
@Parameters(name="[{index}]:{1}")
|
||||
@Parameters(name = "[{index}]:{1}")
|
||||
public static List<Object[]> data() {
|
||||
final List<Object[]> testData = new ArrayList<Object[]>();
|
||||
List<Class<? extends CraftMetaItem>> classes = new ArrayList<Class<? extends CraftMetaItem>>();
|
||||
|
@ -56,22 +56,22 @@ public class ItemMetaTest extends AbstractTestingBase {
|
||||
|
||||
static final int MAX_FIREWORK_POWER = 127; // Please update ItemStackFireworkTest if/when this gets changed.
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testPowerLimitExact() {
|
||||
newFireworkMeta().setPower(MAX_FIREWORK_POWER + 1);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testPowerLimitMax() {
|
||||
newFireworkMeta().setPower(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testPowerLimitMin() {
|
||||
newFireworkMeta().setPower(Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testPowerLimitNegative() {
|
||||
newFireworkMeta().setPower(-1);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackBookTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.WRITTEN_BOOK, Material.WRITABLE_BOOK);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackEnchantStorageTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.ENCHANTED_BOOK);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackFireworkChargeTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_STAR);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackFireworkTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_ROCKET);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackLeatherTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.LEATHER_BOOTS, Material.LEATHER_CHESTPLATE, Material.LEATHER_HELMET, Material.LEATHER_LEGGINGS);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackLoreEnchantmentTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, ItemStackTest.COMPOUND_MATERIALS);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackMapTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FILLED_MAP);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackPotionsTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.POTION);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
@RunWith(Parameterized.class)
|
||||
public class ItemStackSkullTest extends ItemStackTest {
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.PLAYER_HEAD);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public class ItemStackTest extends AbstractTestingBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
|
||||
@Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
|
||||
public static List<Object[]> data() {
|
||||
return ImmutableList.of(); // TODO, test basic durability issues
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class EntityTypesTest extends AbstractTestingBase {
|
||||
public void testMaps() {
|
||||
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
|
||||
|
||||
for (EntityTypes<?> nms : IRegistry.ENTITY_TYPE) {
|
||||
for (EntityTypes<?> nms : IRegistry.ENTITY_TYPE) {
|
||||
MinecraftKey key = EntityTypes.getName(nms);
|
||||
|
||||
EntityType bukkit = EntityType.fromName(key.getKey());
|
||||
|
@ -17,7 +17,7 @@ public class PotionTest extends AbstractTestingBase {
|
||||
public void testEffectCompleteness() throws Throwable {
|
||||
Map<PotionType, String> effects = new EnumMap(PotionType.class);
|
||||
for (Object reg : IRegistry.POTION) {
|
||||
List<MobEffect> eff = ((PotionRegistry)reg).a();
|
||||
List<MobEffect> eff = ((PotionRegistry) reg).a();
|
||||
if (eff.size() != 1) continue;
|
||||
int id = MobEffectList.getId(eff.get(0).getMobEffect());
|
||||
PotionEffectType type = PotionEffectType.getById(id);
|
||||
|
@ -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.<clinit>(SourceFile:58)
|
||||
* at net.minecraft.server.Item.<clinit>(SourceFile:252)
|
||||
* at net.minecraft.server.Block.<clinit>(Block.java:577)
|
||||
*
|
||||
* extend this class to solve it.
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren