3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +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.lang.ref.WeakReference;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BiomeStorage; import net.minecraft.server.BiomeStorage;
import net.minecraft.server.BlockPosition; import net.minecraft.server.BlockPosition;
import net.minecraft.server.Blocks; import net.minecraft.server.Blocks;
@ -286,7 +285,7 @@ public class CraftChunk implements Chunk {
BiomeStorage biome = null; BiomeStorage biome = null;
if (includeBiome|| includeBiomeTempRain) { if (includeBiome || includeBiomeTempRain) {
biome = chunk.getBiomeIndex().b(); biome = chunk.getBiomeIndex().b();
} }

Datei anzeigen

@ -12,7 +12,7 @@ import org.bukkit.potion.Potion;
public class CraftEffect { public class CraftEffect {
public static <T> int getDataValue(Effect effect, T data) { public static <T> int getDataValue(Effect effect, T data) {
int datavalue; int datavalue;
switch(effect) { switch (effect) {
case VILLAGER_PLANT_GROW: case VILLAGER_PLANT_GROW:
datavalue = (Integer) data; datavalue = (Integer) data;
break; break;
@ -24,7 +24,7 @@ public class CraftEffect {
datavalue = Item.getId(CraftMagicNumbers.getItem((Material) data)); datavalue = Item.getId(CraftMagicNumbers.getItem((Material) data));
break; break;
case SMOKE: 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: case SOUTH_EAST:
datavalue = 0; datavalue = 0;
break; break;

Datei anzeigen

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

Datei anzeigen

@ -18,7 +18,7 @@ import org.bukkit.Bukkit;
public class CraftProfileBanList implements org.bukkit.BanList { public class CraftProfileBanList implements org.bukkit.BanList {
private final GameProfileBanList list; private final GameProfileBanList list;
public CraftProfileBanList(GameProfileBanList list){ public CraftProfileBanList(GameProfileBanList list) {
this.list = list; this.list = list;
} }

Datei anzeigen

@ -1,12 +1,12 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.function.Function; 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.BlockPosition;
import net.minecraft.server.EntityRaider; import net.minecraft.server.EntityRaider;
import net.minecraft.server.World; 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.ByteBuf;
import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -41,7 +42,6 @@ import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import jline.console.ConsoleReader; import jline.console.ConsoleReader;
import net.minecraft.server.Advancement; import net.minecraft.server.Advancement;
import net.minecraft.server.ArgumentEntity; import net.minecraft.server.ArgumentEntity;
@ -676,7 +676,7 @@ public final class CraftServer implements Server {
// NOTE: Should only be called from DedicatedServer.ah() // NOTE: Should only be called from DedicatedServer.ah()
public boolean dispatchServerCommand(CommandSender sender, ServerCommand serverCommand) { public boolean dispatchServerCommand(CommandSender sender, ServerCommand serverCommand) {
if (sender instanceof Conversable) { if (sender instanceof Conversable) {
Conversable conversable = (Conversable)sender; Conversable conversable = (Conversable) sender;
if (conversable.isConversing()) { if (conversable.isConversing()) {
conversable.acceptConversationInput(serverCommand.command); conversable.acceptConversationInput(serverCommand.command);
@ -933,7 +933,7 @@ public final class CraftServer implements Server {
break; break;
} }
} }
} while(used); } while (used);
boolean hardcore = creator.hardcore(); boolean hardcore = creator.hardcore();
WorldNBTStorage sdm = new WorldNBTStorage(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager); 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) { public BanList getBanList(BanList.Type type) {
Validate.notNull(type, "Type cannot be null"); Validate.notNull(type, "Type cannot be null");
switch(type){ switch (type) {
case IP: case IP:
return new CraftIpBanList(playerList.getIPBans()); return new CraftIpBanList(playerList.getIPBans());
case NAME: case NAME:

Datei anzeigen

@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -20,7 +21,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import net.minecraft.server.ArraySetSorted; import net.minecraft.server.ArraySetSorted;
import net.minecraft.server.AxisAlignedBB; import net.minecraft.server.AxisAlignedBB;
import net.minecraft.server.BiomeBase; import net.minecraft.server.BiomeBase;
@ -102,10 +102,10 @@ import org.bukkit.FluidCollisionMode;
import org.bukkit.GameRule; import org.bukkit.GameRule;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.Raid;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.StructureType; import org.bukkit.StructureType;
import org.bukkit.TreeType; import org.bukkit.TreeType;
import org.bukkit.Raid;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldBorder; import org.bukkit.WorldBorder;
import org.bukkit.block.Biome; 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))); ((EntityTippedArrow) arrow).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(clazz)) { } else if (SpectralArrow.class.isAssignableFrom(clazz)) {
arrow = EntityTypes.SPECTRAL_ARROW.a(world); arrow = EntityTypes.SPECTRAL_ARROW.a(world);
} else if (Trident.class.isAssignableFrom(clazz)){ } else if (Trident.class.isAssignableFrom(clazz)) {
arrow = EntityTypes.TRIDENT.a(world); arrow = EntityTypes.TRIDENT.a(world);
} else { } else {
arrow = EntityTypes.ARROW.a(world); arrow = EntityTypes.ARROW.a(world);
@ -1009,7 +1009,7 @@ public class CraftWorld implements World {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Deprecated @Deprecated
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... classes) { public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... classes) {
return (Collection<T>)getEntitiesByClasses(classes); return (Collection<T>) getEntitiesByClasses(classes);
} }
@Override @Override
@ -1561,7 +1561,7 @@ public class CraftWorld implements World {
entity = EntityTypes.HORSE.a(world); entity = EntityTypes.HORSE.a(world);
} }
} else if (Skeleton.class.isAssignableFrom(clazz)) { } else if (Skeleton.class.isAssignableFrom(clazz)) {
if (Stray.class.isAssignableFrom(clazz)){ if (Stray.class.isAssignableFrom(clazz)) {
entity = EntityTypes.STRAY.a(world); entity = EntityTypes.STRAY.a(world);
} else if (WitherSkeleton.class.isAssignableFrom(clazz)) { } else if (WitherSkeleton.class.isAssignableFrom(clazz)) {
entity = EntityTypes.WITHER_SKELETON.a(world); entity = EntityTypes.WITHER_SKELETON.a(world);
@ -1633,7 +1633,7 @@ public class CraftWorld implements World {
} else if (Endermite.class.isAssignableFrom(clazz)) { } else if (Endermite.class.isAssignableFrom(clazz)) {
entity = EntityTypes.ENDERMITE.a(world); entity = EntityTypes.ENDERMITE.a(world);
} else if (Guardian.class.isAssignableFrom(clazz)) { } else if (Guardian.class.isAssignableFrom(clazz)) {
if (ElderGuardian.class.isAssignableFrom(clazz)){ if (ElderGuardian.class.isAssignableFrom(clazz)) {
entity = EntityTypes.ELDER_GUARDIAN.a(world); entity = EntityTypes.ELDER_GUARDIAN.a(world);
} else { } else {
entity = EntityTypes.GUARDIAN.a(world); entity = EntityTypes.GUARDIAN.a(world);

Datei anzeigen

@ -156,8 +156,8 @@ public class Main {
try { try {
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals // 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_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_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)); 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()); System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
} }
if (options.has("noconsole")) { if (options.has("noconsole")) {
useConsole = false; useConsole = false;
} }

Datei anzeigen

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

Datei anzeigen

@ -37,7 +37,7 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
} }
static int getSkullType(SkullType type) { static int getSkullType(SkullType type) {
switch(type) { switch (type) {
default: default:
case SKELETON: case SKELETON:
return 0; return 0;

Datei anzeigen

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

Datei anzeigen

@ -9,7 +9,6 @@ import net.minecraft.server.EntityEnderDragon;
import org.bukkit.boss.BossBar; import org.bukkit.boss.BossBar;
import org.bukkit.boss.DragonBattle; import org.bukkit.boss.DragonBattle;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.boss.CraftBossBar;
import org.bukkit.craftbukkit.boss.CraftDragonBattle; import org.bukkit.craftbukkit.boss.CraftDragonBattle;
import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.EnderDragon; 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) { public static CraftEntity getEntity(CraftServer server, Entity entity) {
/** /*
* Order is *EXTREMELY* important -- keep it right! =D * Order is *EXTREMELY* important -- keep it right! =D
*/ */
// CHECKSTYLE:OFF
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
// Players // Players
if (entity instanceof EntityHuman) { 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 EntityAreaEffectCloud) { return new CraftAreaEffectCloud(server, (EntityAreaEffectCloud) entity); }
else if (entity instanceof EntityEvokerFangs) { return new CraftEvokerFangs(server, (EntityEvokerFangs) entity); } else if (entity instanceof EntityEvokerFangs) { return new CraftEvokerFangs(server, (EntityEvokerFangs) entity); }
else if (entity instanceof EntityLlamaSpit) { return new CraftLlamaSpit(server, (EntityLlamaSpit) entity); } else if (entity instanceof EntityLlamaSpit) { return new CraftLlamaSpit(server, (EntityLlamaSpit) entity); }
// CHECKSTYLE:ON
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass())); throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
} }

Datei anzeigen

@ -54,9 +54,9 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
if (this.biteChance == -1) { if (this.biteChance == -1) {
if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) { 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; return this.biteChance;
} }

Datei anzeigen

@ -48,7 +48,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
old.die(); old.die();
EntityItemFrame frame = new EntityItemFrame(world,position,direction); EntityItemFrame frame = new EntityItemFrame(world, position, direction);
frame.setItem(item); frame.setItem(item);
world.addEntity(frame); world.addEntity(frame);
this.entity = frame; this.entity = frame;

Datei anzeigen

@ -45,11 +45,11 @@ import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; 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.CraftEntityEquipment;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.potion.CraftPotionUtil; 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.AbstractArrow;
import org.bukkit.entity.DragonFireball; import org.bukkit.entity.DragonFireball;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;

Datei anzeigen

@ -75,7 +75,7 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
@Override @Override
public void setDisplayBlock(MaterialData material) { public void setDisplayBlock(MaterialData material) {
if(material != null) { if (material != null) {
IBlockData block = CraftMagicNumbers.getBlock(material); IBlockData block = CraftMagicNumbers.getBlock(material);
this.getHandle().setDisplayBlock(block); this.getHandle().setDisplayBlock(block);
} else { } else {

Datei anzeigen

@ -229,7 +229,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
name = getName(); name = getName();
} }
getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromStringOrNull(name); 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)) { if (player.getBukkitEntity().canSee(this)) {
player.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle())); player.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle()));
} }

Datei anzeigen

@ -14,7 +14,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
@Override @Override
public EntityTameableAnimal getHandle() { public EntityTameableAnimal getHandle() {
return (EntityTameableAnimal)super.getHandle(); return (EntityTameableAnimal) super.getHandle();
} }
public UUID getOwnerUUID() { public UUID getOwnerUUID() {

Datei anzeigen

@ -2,12 +2,12 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import java.util.Locale; import java.util.Locale;
import net.minecraft.server.BlockBed;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityVillager; import net.minecraft.server.EntityVillager;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IRegistry; import net.minecraft.server.IRegistry;
import net.minecraft.server.VillagerProfession; 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.apache.commons.lang.Validate;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer; 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.EntityMonster;
import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityPotion; import net.minecraft.server.EntityPotion;
import net.minecraft.server.EntityRaider;
import net.minecraft.server.EntitySheep; import net.minecraft.server.EntitySheep;
import net.minecraft.server.EntitySlime; import net.minecraft.server.EntitySlime;
import net.minecraft.server.EntityRaider;
import net.minecraft.server.EntityTypes; import net.minecraft.server.EntityTypes;
import net.minecraft.server.EntityVillager; import net.minecraft.server.EntityVillager;
import net.minecraft.server.EntityWaterAnimal; 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.block.data.CraftBlockData;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftRaider;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftRaider;
import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting; import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftMetaBook; 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.PlayerRecipeDiscoverEvent;
import org.bukkit.event.player.PlayerStatisticIncrementEvent; import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import org.bukkit.event.player.PlayerUnleashEntityEvent; 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.server.ServerListPingEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent; 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.EquipmentSlot;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
@ -510,7 +510,7 @@ public class CraftEventFactory {
return event; 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; if (entity == null) return false;
org.bukkit.event.Cancellable event = null; org.bukkit.event.Cancellable event = null;
@ -532,7 +532,7 @@ public class CraftEventFactory {
} else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Projectile) { } else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Projectile) {
// Not all projectiles extend EntityProjectile, so check for Bukkit interface instead // Not all projectiles extend EntityProjectile, so check for Bukkit interface instead
event = CraftEventFactory.callProjectileLaunchEvent(entity); 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); event = CraftEventFactory.callVehicleCreateEvent(entity);
} else if (!(entity instanceof EntityPlayer)) { } else if (!(entity instanceof EntityPlayer)) {
event = CraftEventFactory.callEntitySpawnEvent(entity); event = CraftEventFactory.callEntitySpawnEvent(entity);

Datei anzeigen

@ -136,7 +136,7 @@ public class SimpleHelpMap implements HelpMap {
if (t != null) addTopic(t); if (t != null) addTopic(t);
continue outer; 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); HelpTopic t = topicFactoryMap.get(c).createTopic(command);
if (t != null) addTopic(t); if (t != null) addTopic(t);
continue outer; continue outer;
@ -206,7 +206,7 @@ public class SimpleHelpMap implements HelpMap {
return "Bukkit"; return "Bukkit";
} }
if (command instanceof PluginIdentifiableCommand) { if (command instanceof PluginIdentifiableCommand) {
return ((PluginIdentifiableCommand)command).getPlugin().getName(); return ((PluginIdentifiableCommand) command).getPlugin().getName();
} }
return null; return null;
} }
@ -215,7 +215,7 @@ public class SimpleHelpMap implements HelpMap {
if ((command instanceof BukkitCommand) && ignoredPlugins.contains("Bukkit")) { if ((command instanceof BukkitCommand) && ignoredPlugins.contains("Bukkit")) {
return true; 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 true;
} }
return false; return false;

Datei anzeigen

@ -126,7 +126,7 @@ public class CraftContainer extends Container {
case CHEST: case CHEST:
case ENDER_CHEST: case ENDER_CHEST:
case BARREL: case BARREL:
switch(inventory.getSize()) { switch (inventory.getSize()) {
case 9: case 9:
return Containers.GENERIC_9X1; return Containers.GENERIC_9X1;
case 18: case 18:

Datei anzeigen

@ -132,7 +132,7 @@ public class CraftInventory implements Inventory {
return true; return true;
} }
for (ItemStack item : getStorageContents()) { for (ItemStack item : getStorageContents()) {
if (item != null && item.getType()== material) { if (item != null && item.getType() == material) {
if ((amount -= item.getAmount()) <= 0) { if ((amount -= item.getAmount()) <= 0) {
return true; return true;
} }
@ -182,7 +182,7 @@ public class CraftInventory implements Inventory {
ItemStack[] inventory = getStorageContents(); ItemStack[] inventory = getStorageContents();
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i]; ItemStack item = inventory[i];
if (item != null && item.getType()== material) { if (item != null && item.getType() == material) {
slots.put(i, item); slots.put(i, item);
} }
} }
@ -210,7 +210,7 @@ public class CraftInventory implements Inventory {
ItemStack[] inventory = getStorageContents(); ItemStack[] inventory = getStorageContents();
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i]; ItemStack item = inventory[i];
if (item != null && item.getType()== material) { if (item != null && item.getType() == material) {
return i; return i;
} }
} }
@ -254,7 +254,7 @@ public class CraftInventory implements Inventory {
ItemStack[] inventory = getStorageContents(); ItemStack[] inventory = getStorageContents();
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[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; return i;
} }
} }
@ -396,7 +396,7 @@ public class CraftInventory implements Inventory {
material = CraftLegacy.fromLegacy(material); material = CraftLegacy.fromLegacy(material);
ItemStack[] items = getStorageContents(); ItemStack[] items = getStorageContents();
for (int i = 0; i < items.length; i++) { 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); clear(i);
} }
} }
@ -460,7 +460,7 @@ public class CraftInventory implements Inventory {
} else if (inventory instanceof TileEntityFurnace) { } else if (inventory instanceof TileEntityFurnace) {
return InventoryType.FURNACE; return InventoryType.FURNACE;
} else if (this instanceof CraftInventoryEnchanting) { } else if (this instanceof CraftInventoryEnchanting) {
return InventoryType.ENCHANTING; return InventoryType.ENCHANTING;
} else if (inventory instanceof TileEntityBrewingStand) { } else if (inventory instanceof TileEntityBrewingStand) {
return InventoryType.BREWING; return InventoryType.BREWING;
} else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) { } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) {
@ -472,7 +472,7 @@ public class CraftInventory implements Inventory {
} else if (this instanceof CraftInventoryBeacon) { } else if (this instanceof CraftInventoryBeacon) {
return InventoryType.BEACON; return InventoryType.BEACON;
} else if (this instanceof CraftInventoryAnvil) { } else if (this instanceof CraftInventoryAnvil) {
return InventoryType.ANVIL; return InventoryType.ANVIL;
} else if (inventory instanceof IHopper) { } else if (inventory instanceof IHopper) {
return InventoryType.HOPPER; return InventoryType.HOPPER;
} else if (inventory instanceof TileEntityShulkerBox) { } else if (inventory instanceof TileEntityShulkerBox) {

Datei anzeigen

@ -43,7 +43,7 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
List<net.minecraft.server.ItemStack> mcResultItems = getResultInventory().getContents(); List<net.minecraft.server.ItemStack> mcResultItems = getResultInventory().getContents();
int i = 0; int i = 0;
for (i = 0; i < mcResultItems.size(); i++ ) { for (i = 0; i < mcResultItems.size(); i++) {
items[i] = CraftItemStack.asCraftMirror(mcResultItems.get(i)); items[i] = CraftItemStack.asCraftMirror(mcResultItems.get(i));
} }

Datei anzeigen

@ -11,7 +11,7 @@ public class CraftInventoryEnchanting extends CraftInventory implements Enchanti
@Override @Override
public void setItem(ItemStack item) { public void setItem(ItemStack item) {
setItem(0,item); setItem(0, item);
} }
@Override @Override

Datei anzeigen

@ -27,17 +27,17 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
@Override @Override
public void setFuel(ItemStack stack) { public void setFuel(ItemStack stack) {
setItem(1,stack); setItem(1, stack);
} }
@Override @Override
public void setResult(ItemStack stack) { public void setResult(ItemStack stack) {
setItem(2,stack); setItem(2, stack);
} }
@Override @Override
public void setSmelting(ItemStack stack) { public void setSmelting(ItemStack stack) {
setItem(0,stack); setItem(0, stack);
} }
@Override @Override

Datei anzeigen

@ -154,11 +154,11 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) { ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
super.serialize(builder); super.serialize(builder);
if(base != null){ if (base != null) {
builder.put(BASE.BUKKIT, base.toString()); builder.put(BASE.BUKKIT, base.toString());
} }
if(!patterns.isEmpty()){ if (!patterns.isEmpty()) {
builder.put(PATTERNS.BUKKIT, ImmutableList.copyOf(patterns)); builder.put(PATTERNS.BUKKIT, ImmutableList.copyOf(patterns));
} }

Datei anzeigen

@ -184,7 +184,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
@Override @Override
boolean applicableTo(Material type) { boolean applicableTo(Material type) {
switch(type){ switch (type) {
case FURNACE: case FURNACE:
case CHEST: case CHEST:
case TRAPPED_CHEST: case TRAPPED_CHEST:
@ -459,58 +459,58 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
} }
return new CraftEnchantingTable(material, (TileEntityEnchantTable) te); return new CraftEnchantingTable(material, (TileEntityEnchantTable) te);
case ENDER_CHEST: case ENDER_CHEST:
if (te == null){ if (te == null) {
te = new TileEntityEnderChest(); te = new TileEntityEnderChest();
} }
return new CraftEnderChest(material, (TileEntityEnderChest) te); return new CraftEnderChest(material, (TileEntityEnderChest) te);
case DAYLIGHT_DETECTOR: case DAYLIGHT_DETECTOR:
if (te == null){ if (te == null) {
te = new TileEntityLightDetector(); te = new TileEntityLightDetector();
} }
return new CraftDaylightDetector(material, (TileEntityLightDetector) te); return new CraftDaylightDetector(material, (TileEntityLightDetector) te);
case COMPARATOR: case COMPARATOR:
if (te == null){ if (te == null) {
te = new TileEntityComparator(); te = new TileEntityComparator();
} }
return new CraftComparator(material, (TileEntityComparator) te); return new CraftComparator(material, (TileEntityComparator) te);
case BARREL: case BARREL:
if (te == null){ if (te == null) {
te = new TileEntityBarrel(); te = new TileEntityBarrel();
} }
return new CraftBarrel(material, (TileEntityBarrel) te); return new CraftBarrel(material, (TileEntityBarrel) te);
case BELL: case BELL:
if (te == null){ if (te == null) {
te = new TileEntityBell(); te = new TileEntityBell();
} }
return new CraftBell(material, (TileEntityBell) te); return new CraftBell(material, (TileEntityBell) te);
case BLAST_FURNACE: case BLAST_FURNACE:
if (te == null){ if (te == null) {
te = new TileEntityBlastFurnace(); te = new TileEntityBlastFurnace();
} }
return new CraftBlastFurnace(material, (TileEntityBlastFurnace) te); return new CraftBlastFurnace(material, (TileEntityBlastFurnace) te);
case CAMPFIRE: case CAMPFIRE:
if (te == null){ if (te == null) {
te = new TileEntityCampfire(); te = new TileEntityCampfire();
} }
return new CraftCampfire(material, (TileEntityCampfire) te); return new CraftCampfire(material, (TileEntityCampfire) te);
case JIGSAW: case JIGSAW:
if (te == null){ if (te == null) {
te = new TileEntityJigsaw(); te = new TileEntityJigsaw();
} }
return new CraftJigsaw(material, (TileEntityJigsaw) te); return new CraftJigsaw(material, (TileEntityJigsaw) te);
case LECTERN: case LECTERN:
if (te == null){ if (te == null) {
te = new TileEntityLectern(); te = new TileEntityLectern();
} }
return new CraftLectern(material, (TileEntityLectern) te); return new CraftLectern(material, (TileEntityLectern) te);
case SMOKER: case SMOKER:
if (te == null){ if (te == null) {
te = new TileEntitySmoker(); te = new TileEntitySmoker();
} }
return new CraftSmoker(material, (TileEntitySmoker) te); return new CraftSmoker(material, (TileEntitySmoker) te);
case BEE_NEST: case BEE_NEST:
case BEEHIVE: case BEEHIVE:
if (te == null){ if (te == null) {
te = new TileEntityBeehive(); te = new TileEntityBeehive();
} }
return new CraftBeehive(material, (TileEntityBeehive) te); return new CraftBeehive(material, (TileEntityBeehive) te);

Datei anzeigen

@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.inventory; package org.bukkit.craftbukkit.inventory;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.ImmutableMap.Builder;
import java.util.ArrayList; import java.util.ArrayList;
@ -97,7 +96,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
setTitle(SerializableMeta.getString(map, BOOK_TITLE.BUKKIT, true)); setTitle(SerializableMeta.getString(map, BOOK_TITLE.BUKKIT, true));
Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true); Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true);
if(pages != null) { if (pages != null) {
for (Object page : pages) { for (Object page : pages) {
if (page instanceof String) { if (page instanceof String) {
addPage((String) page); addPage((String) page);

Datei anzeigen

@ -254,7 +254,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
@Override @Override
boolean applicableTo(Material type) { boolean applicableTo(Material type) {
switch(type) { switch (type) {
case FIREWORK_ROCKET: case FIREWORK_ROCKET:
return true; return true;
default: default:
@ -268,7 +268,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
} }
boolean isFireworkEmpty() { boolean isFireworkEmpty() {
return !(hasEffects() || hasPower()); return !(hasEffects() || hasPower());
} }
boolean hasPower() { boolean hasPower() {

Datei anzeigen

@ -85,7 +85,7 @@ import org.bukkit.persistence.PersistentDataContainer;
* *
* <li> Constructor(CraftMetaItem meta) * <li> Constructor(CraftMetaItem meta)
* <li> Constructor(NBTTagCompound tag) * <li> Constructor(NBTTagCompound tag)
* <li> Constructor(Map<String, Object> map) * <li> Constructor(Map&lt;String, Object&gt; map)
* <br><br> * <br><br>
* <li> void applyToItem(NBTTagCompound tag) * <li> void applyToItem(NBTTagCompound tag)
* <li> boolean applicableTo(Material type) * <li> boolean applicableTo(Material type)
@ -99,7 +99,7 @@ import org.bukkit.persistence.PersistentDataContainer;
* <li> int applyHash() * <li> int applyHash()
* <li> public Class clone() * <li> public Class clone()
* <br><br> * <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() * <li> SerializableMeta.Deserializers deserializer()
*/ */
@DelegateDeserialization(CraftMetaItem.SerializableMeta.class) @DelegateDeserialization(CraftMetaItem.SerializableMeta.class)
@ -132,7 +132,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
@SerializableAs("ItemMeta") @SerializableAs("ItemMeta")
public static class SerializableMeta implements ConfigurationSerializable { public static final class SerializableMeta implements ConfigurationSerializable {
static final String TYPE_FIELD = "meta-type"; static final String TYPE_FIELD = "meta-type";
static final ImmutableMap<Class<? extends CraftMetaItem>, String> classMap; static final ImmutableMap<Class<? extends CraftMetaItem>, String> classMap;
@ -617,7 +617,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (hasDisplayName()) { if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(displayName))); setDisplayTag(itemTag, NAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(displayName)));
} }
if (hasLocalizedName()){ if (hasLocalizedName()) {
setDisplayTag(itemTag, LOCNAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(locName))); setDisplayTag(itemTag, LOCNAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(locName)));
} }
@ -1131,7 +1131,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Overridden @Overridden
boolean equalsCommon(CraftMetaItem that) { boolean equalsCommon(CraftMetaItem that) {
return ((this.hasDisplayName() ? that.hasDisplayName() && this.displayName.equals(that.displayName) : !that.hasDisplayName())) 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.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants())
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore()) && (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
&& (this.hasCustomModelData() ? that.hasCustomModelData() && this.customModelData.equals(that.customModelData) : !that.hasCustomModelData()) && (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 applyHash() {
int hash = 3; int hash = 3;
hash = 61 * hash + (hasDisplayName() ? this.displayName.hashCode() : 0); 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 + (hasLore() ? this.lore.hashCode() : 0);
hash = 61 * hash + (hasCustomModelData() ? this.customModelData.hashCode() : 0); hash = 61 * hash + (hasCustomModelData() ? this.customModelData.hashCode() : 0);
hash = 61 * hash + (hasBlockData() ? this.blockData.hashCode() : 0); hash = 61 * hash + (hasBlockData() ? this.blockData.hashCode() : 0);

Datei anzeigen

@ -66,7 +66,7 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta {
@Override @Override
boolean applicableTo(Material type) { boolean applicableTo(Material type) {
switch(type) { switch (type) {
case LEATHER_HELMET: case LEATHER_HELMET:
case LEATHER_HORSE_ARMOR: case LEATHER_HORSE_ARMOR:
case LEATHER_CHESTPLATE: case LEATHER_CHESTPLATE:

Datei anzeigen

@ -100,7 +100,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
void applyToItem(NBTTagCompound tag) { void applyToItem(NBTTagCompound tag) {
super.applyToItem(tag); super.applyToItem(tag);
if (hasMapId()){ if (hasMapId()) {
tag.setInt(MAP_ID.NBT, getMapId()); tag.setInt(MAP_ID.NBT, getMapId());
} }

Datei anzeigen

@ -147,7 +147,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
@Override @Override
boolean applicableTo(Material type) { boolean applicableTo(Material type) {
switch(type) { switch (type) {
case POTION: case POTION:
case SPLASH_POTION: case SPLASH_POTION:
case LINGERING_POTION: case LINGERING_POTION:

Datei anzeigen

@ -1,11 +1,11 @@
package org.bukkit.craftbukkit.inventory; 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.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; 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.NBTTagCompound;
import net.minecraft.server.NBTTagList; import net.minecraft.server.NBTTagList;
import org.apache.commons.lang.Validate; 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)); color = Byte.parseByte(text.substring(i + 1, j));
i = j; i = j;
continue; continue;
} catch (NumberFormatException ex) {
} }
catch (NumberFormatException ex) {}
} }
throw new IllegalArgumentException("Text contains unterminated color string"); throw new IllegalArgumentException("Text contains unterminated color string");
} }

Datei anzeigen

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

Datei anzeigen

@ -32,7 +32,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
*/ */
@Override @Override
protected String disambiguate(Block block, String metadataKey) { 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 @Override
public List<MetadataValue> getMetadata(Block block, String metadataKey) { public List<MetadataValue> getMetadata(Block block, String metadataKey) {
if(block.getWorld() == owningWorld) { if (block.getWorld() == owningWorld) {
return super.getMetadata(block, metadataKey); return super.getMetadata(block, metadataKey);
} else { } else {
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName()); throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
@ -56,7 +56,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
*/ */
@Override @Override
public boolean hasMetadata(Block block, String metadataKey) { public boolean hasMetadata(Block block, String metadataKey) {
if(block.getWorld() == owningWorld) { if (block.getWorld() == owningWorld) {
return super.hasMetadata(block, metadataKey); return super.hasMetadata(block, metadataKey);
} else { } else {
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName()); throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
@ -70,7 +70,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
*/ */
@Override @Override
public void removeMetadata(Block block, String metadataKey, Plugin owningPlugin) { public void removeMetadata(Block block, String metadataKey, Plugin owningPlugin) {
if(block.getWorld() == owningWorld) { if (block.getWorld() == owningWorld) {
super.removeMetadata(block, metadataKey, owningPlugin); super.removeMetadata(block, metadataKey, owningPlugin);
} else { } else {
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName()); throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
@ -84,7 +84,7 @@ public class BlockMetadataStore extends MetadataStoreBase<Block> implements Meta
*/ */
@Override @Override
public void setMetadata(Block block, String metadataKey, MetadataValue newMetadataValue) { public void setMetadata(Block block, String metadataKey, MetadataValue newMetadataValue) {
if(block.getWorld() == owningWorld) { if (block.getWorld() == owningWorld) {
super.setMetadata(block, metadataKey, newMetadataValue); super.setMetadata(block, metadataKey, newMetadataValue);
} else { } else {
throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName()); throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());

Datei anzeigen

@ -1,11 +1,11 @@
package org.bukkit.craftbukkit.persistence; package org.bukkit.craftbukkit.persistence;
import com.google.common.primitives.Primitives;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import com.google.common.primitives.Primitives;
import net.minecraft.server.NBTBase; import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagByte; import net.minecraft.server.NBTTagByte;
import net.minecraft.server.NBTTagByteArray; 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.inventory.CraftItemStack;
import org.bukkit.craftbukkit.potion.CraftPotionUtil; import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.AbstractArrow; import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.EnderPearl; import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;

Datei anzeigen

@ -2,14 +2,13 @@ package org.bukkit.craftbukkit.scheduler;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
class CraftAsyncDebugger { class CraftAsyncDebugger {
private CraftAsyncDebugger next = null; private CraftAsyncDebugger next = null;
private final int expiry; private final int expiry;
private final Plugin plugin; private final Plugin plugin;
private final Class<?> clazz; 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.expiry = expiry;
this.plugin = plugin; this.plugin = plugin;
this.clazz = clazz; this.clazz = clazz;

Datei anzeigen

@ -25,7 +25,7 @@ class CraftAsyncTask extends CraftTask {
@Override @Override
public void run() { public void run() {
final Thread thread = Thread.currentThread(); final Thread thread = Thread.currentThread();
synchronized(workers) { synchronized (workers) {
if (getPeriod() == CraftTask.CANCEL) { if (getPeriod() == CraftTask.CANCEL) {
// Never continue running after cancelled. // Never continue running after cancelled.
// Checking this with the lock is important! // Checking this with the lock is important!
@ -63,7 +63,7 @@ class CraftAsyncTask extends CraftTask {
thrown); thrown);
} finally { } finally {
// Cleanup is important for any async task, otherwise ghost tasks are everywhere // Cleanup is important for any async task, otherwise ghost tasks are everywhere
synchronized(workers) { synchronized (workers) {
try { try {
final Iterator<BukkitWorker> workers = this.workers.iterator(); final Iterator<BukkitWorker> workers = this.workers.iterator();
boolean removed = false; boolean removed = false;

Datei anzeigen

@ -82,7 +82,12 @@ public class CraftScheduler implements BukkitScheduler {
private volatile CraftTask currentTask = null; private volatile CraftTask currentTask = null;
private volatile int currentTick = -1; private volatile int currentTick = -1;
private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build()); 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 CraftAsyncDebugger debugTail = debugHead;
private static final int RECENT_TICKS; private static final int RECENT_TICKS;
@ -248,7 +253,8 @@ public class CraftScheduler implements BukkitScheduler {
} }
} }
return false; return false;
}}); }
});
handle(task, 0L); handle(task, 0L);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) { 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 // We split this because of the way things are ordered for all of the async calls in CraftScheduler
// (it prevents race-conditions) // (it prevents race-conditions)
for (task = head; task != lastTask; task = head) { for (task = head; task != lastTask; task = head) {
head = task.getNext(); head = task.getNext();
task.setNext(null); task.setNext(null);
} }
this.head = lastTask; this.head = lastTask;
} }

Datei anzeigen

@ -12,7 +12,7 @@ final class CraftCriteria {
static { static {
ImmutableMap.Builder<String, CraftCriteria> defaults = ImmutableMap.builder(); 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(); String name = entry.getKey().toString();
IScoreboardCriteria criteria = (IScoreboardCriteria) entry.getValue(); IScoreboardCriteria criteria = (IScoreboardCriteria) entry.getValue();

Datei anzeigen

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

Datei anzeigen

@ -149,7 +149,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
CraftScoreboard scoreboard = checkState(); CraftScoreboard scoreboard = checkState();
ImmutableSet.Builder<String> entries = ImmutableSet.builder(); ImmutableSet.Builder<String> entries = ImmutableSet.builder();
for (String playerName: team.getPlayerNameSet()){ for (String playerName : team.getPlayerNameSet()) {
entries.add(playerName); entries.add(playerName);
} }
return entries.build(); return entries.build();

Datei anzeigen

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

Datei anzeigen

@ -37,7 +37,7 @@ public final class CraftChatMessage {
return ChatColor.getByChar(format.character); 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 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>(); private final List<IChatBaseComponent> list = new ArrayList<IChatBaseComponent>();
@ -47,10 +47,10 @@ public final class CraftChatMessage {
private int currentIndex; private int currentIndex;
private final String message; private final String message;
private StringMessage(String message, boolean keepNewlines) { private StringMessage(String message, boolean keepNewlines) {
this.message = message; this.message = message;
if (message == null) { if (message == null) {
output = new IChatBaseComponent[] { currentChatComponent }; output = new IChatBaseComponent[]{currentChatComponent};
return; return;
} }
list.add(currentChatComponent); list.add(currentChatComponent);
@ -100,7 +100,7 @@ public final class CraftChatMessage {
} }
break; break;
case 3: case 3:
if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) { if (!(match.startsWith("http://") || match.startsWith("https://"))) {
match = "http://" + match; match = "http://" + match;
} }
modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match)); modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
@ -207,8 +207,7 @@ public final class CraftChatMessage {
if (matcher.reset(msg).find()) { if (matcher.reset(msg).find()) {
matcher.reset(); matcher.reset();
ChatModifier modifier = text.getChatModifier() != null ? ChatModifier modifier = text.getChatModifier() != null ? text.getChatModifier() : new ChatModifier();
text.getChatModifier() : new ChatModifier();
List<IChatBaseComponent> extras = new ArrayList<IChatBaseComponent>(); List<IChatBaseComponent> extras = new ArrayList<IChatBaseComponent>();
List<IChatBaseComponent> extrasOld = new ArrayList<IChatBaseComponent>(text.getSiblings()); List<IChatBaseComponent> extrasOld = new ArrayList<IChatBaseComponent>(text.getSiblings());
component = text = new ChatComponentText(""); component = text = new ChatComponentText("");
@ -217,7 +216,7 @@ public final class CraftChatMessage {
while (matcher.find()) { while (matcher.find()) {
String match = matcher.group(); String match = matcher.group();
if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) { if (!(match.startsWith("http://") || match.startsWith("https://"))) {
match = "http://" + match; match = "http://" + match;
} }
@ -262,7 +261,7 @@ public final class CraftChatMessage {
if (c.getChatModifier() != null && c.getChatModifier().getClickEvent() == null) { if (c.getChatModifier() != null && c.getChatModifier().getClickEvent() == null) {
subs[i] = fixComponent(c, matcher); 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); subs[i] = fixComponent(new ChatComponentText((String) comp), matcher);
} }
} }

Datei anzeigen

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

Datei anzeigen

@ -73,7 +73,7 @@ public abstract class LazyHashSet<E> implements Set<E> {
} }
public Set<E> getReference() { public Set<E> getReference() {
Set<E> reference = this.reference ; Set<E> reference = this.reference;
if (reference != null) { if (reference != null) {
return reference; return reference;
} }

Datei anzeigen

@ -39,7 +39,7 @@ public final class WeakCollection<T> implements Collection<T> {
@Override @Override
public boolean contains(Object object) { public boolean contains(Object object) {
if (object == null) { if (object == null) {
return false; return false;
} }
for (T compare : this) { for (T compare : this) {

Datei anzeigen

@ -4,7 +4,7 @@ import org.bukkit.permissions.Permission;
import org.bukkit.util.permissions.DefaultPermissions; import org.bukkit.util.permissions.DefaultPermissions;
public final class CraftDefaultPermissions { public final class CraftDefaultPermissions {
private static final String ROOT= "minecraft"; private static final String ROOT = "minecraft";
private CraftDefaultPermissions() {} private CraftDefaultPermissions() {}

Datei anzeigen

@ -15,7 +15,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class DyeColorsTest extends AbstractTestingBase { public class DyeColorsTest extends AbstractTestingBase {
@Parameters(name= "{index}: {0}") @Parameters(name = "{index}: {0}")
public static List<Object[]> data() { public static List<Object[]> data() {
List<Object[]> list = new ArrayList<Object[]>(); List<Object[]> list = new ArrayList<Object[]>();
for (DyeColor dye : DyeColor.values()) { for (DyeColor dye : DyeColor.values()) {

Datei anzeigen

@ -40,7 +40,7 @@ public class PerMaterialTest extends AbstractTestingBase {
fireValues = Util.getInternalState(BlockFire.class, Blocks.FIRE, "flameChances"); fireValues = Util.getInternalState(BlockFire.class, Blocks.FIRE, "flameChances");
} }
@Parameters(name= "{index}: {0}") @Parameters(name = "{index}: {0}")
public static List<Object[]> data() { public static List<Object[]> data() {
List<Object[]> list = Lists.newArrayList(); List<Object[]> list = Lists.newArrayList();
for (Material material : Material.values()) { for (Material material : Material.values()) {
@ -91,7 +91,7 @@ public class PerMaterialTest extends AbstractTestingBase {
if (material == Material.AIR) { if (material == Material.AIR) {
assertThat((int) material.getMaxDurability(), is(0)); assertThat((int) material.getMaxDurability(), is(0));
} else if (material.isBlock()){ } else if (material.isBlock()) {
Item item = CraftMagicNumbers.getItem(material); Item item = CraftMagicNumbers.getItem(material);
assertThat((int) material.getMaxDurability(), is(item.getMaxDurability())); assertThat((int) material.getMaxDurability(), is(item.getMaxDurability()));
} }

Datei anzeigen

@ -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(); 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() { public static List<Object[]> data() {
List<Object[]> list = new ArrayList<Object[]>(); List<Object[]> list = new ArrayList<Object[]>();
for (Material material : materials) { for (Material material : materials) {

Datei anzeigen

@ -19,7 +19,7 @@ import org.junit.runners.Parameterized.Parameters;
public class ItemMetaImplementationOverrideTest { public class ItemMetaImplementationOverrideTest {
static final Class<CraftMetaItem> parent = CraftMetaItem.class; static final Class<CraftMetaItem> parent = CraftMetaItem.class;
@Parameters(name="[{index}]:{1}") @Parameters(name = "[{index}]:{1}")
public static List<Object[]> data() { public static List<Object[]> data() {
final List<Object[]> testData = new ArrayList<Object[]>(); final List<Object[]> testData = new ArrayList<Object[]>();
List<Class<? extends CraftMetaItem>> classes = new ArrayList<Class<? extends CraftMetaItem>>(); List<Class<? extends CraftMetaItem>> classes = new ArrayList<Class<? extends CraftMetaItem>>();

Datei anzeigen

@ -56,22 +56,22 @@ public class ItemMetaTest extends AbstractTestingBase {
static final int MAX_FIREWORK_POWER = 127; // Please update ItemStackFireworkTest if/when this gets changed. 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() { public void testPowerLimitExact() {
newFireworkMeta().setPower(MAX_FIREWORK_POWER + 1); newFireworkMeta().setPower(MAX_FIREWORK_POWER + 1);
} }
@Test(expected=IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testPowerLimitMax() { public void testPowerLimitMax() {
newFireworkMeta().setPower(Integer.MAX_VALUE); newFireworkMeta().setPower(Integer.MAX_VALUE);
} }
@Test(expected=IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testPowerLimitMin() { public void testPowerLimitMin() {
newFireworkMeta().setPower(Integer.MIN_VALUE); newFireworkMeta().setPower(Integer.MIN_VALUE);
} }
@Test(expected=IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testPowerLimitNegative() { public void testPowerLimitNegative() {
newFireworkMeta().setPower(-1); newFireworkMeta().setPower(-1);
} }

Datei anzeigen

@ -13,7 +13,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackBookTest extends ItemStackTest { public class ItemStackBookTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.WRITTEN_BOOK, Material.WRITABLE_BOOK); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.WRITTEN_BOOK, Material.WRITABLE_BOOK);
} }

Datei anzeigen

@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackEnchantStorageTest extends ItemStackTest { public class ItemStackEnchantStorageTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.ENCHANTED_BOOK); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.ENCHANTED_BOOK);
} }

Datei anzeigen

@ -16,7 +16,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackFireworkChargeTest extends ItemStackTest { public class ItemStackFireworkChargeTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_STAR); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_STAR);
} }

Datei anzeigen

@ -16,7 +16,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackFireworkTest extends ItemStackTest { public class ItemStackFireworkTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_ROCKET); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_ROCKET);
} }

Datei anzeigen

@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackLeatherTest extends ItemStackTest { public class ItemStackLeatherTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { 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); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.LEATHER_BOOTS, Material.LEATHER_CHESTPLATE, Material.LEATHER_HELMET, Material.LEATHER_LEGGINGS);
} }

Datei anzeigen

@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackLoreEnchantmentTest extends ItemStackTest { public class ItemStackLoreEnchantmentTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, ItemStackTest.COMPOUND_MATERIALS); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, ItemStackTest.COMPOUND_MATERIALS);
} }

Datei anzeigen

@ -13,7 +13,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackMapTest extends ItemStackTest { public class ItemStackMapTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FILLED_MAP); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FILLED_MAP);
} }

Datei anzeigen

@ -14,7 +14,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackPotionsTest extends ItemStackTest { public class ItemStackPotionsTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.POTION); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.POTION);
} }

Datei anzeigen

@ -13,7 +13,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackSkullTest extends ItemStackTest { public class ItemStackSkullTest extends ItemStackTest {
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.PLAYER_HEAD); return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.PLAYER_HEAD);
} }

Datei anzeigen

@ -305,7 +305,7 @@ public class ItemStackTest extends AbstractTestingBase {
} }
} }
@Parameters(name="[{index}]:{" + NAME_PARAMETER + "}") @Parameters(name = "[{index}]:{" + NAME_PARAMETER + "}")
public static List<Object[]> data() { public static List<Object[]> data() {
return ImmutableList.of(); // TODO, test basic durability issues return ImmutableList.of(); // TODO, test basic durability issues
} }

Datei anzeigen

@ -16,7 +16,7 @@ public class EntityTypesTest extends AbstractTestingBase {
public void testMaps() { public void testMaps() {
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet()); 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); MinecraftKey key = EntityTypes.getName(nms);
EntityType bukkit = EntityType.fromName(key.getKey()); EntityType bukkit = EntityType.fromName(key.getKey());

Datei anzeigen

@ -17,7 +17,7 @@ public class PotionTest extends AbstractTestingBase {
public void testEffectCompleteness() throws Throwable { public void testEffectCompleteness() throws Throwable {
Map<PotionType, String> effects = new EnumMap(PotionType.class); Map<PotionType, String> effects = new EnumMap(PotionType.class);
for (Object reg : IRegistry.POTION) { for (Object reg : IRegistry.POTION) {
List<MobEffect> eff = ((PotionRegistry)reg).a(); List<MobEffect> eff = ((PotionRegistry) reg).a();
if (eff.size() != 1) continue; if (eff.size() != 1) continue;
int id = MobEffectList.getId(eff.get(0).getMobEffect()); int id = MobEffectList.getId(eff.get(0).getMobEffect());
PotionEffectType type = PotionEffectType.getById(id); PotionEffectType type = PotionEffectType.getById(id);

Datei anzeigen

@ -19,9 +19,9 @@ import org.junit.Assert;
/** /**
* If you are getting: java.lang.ExceptionInInitializerError * If you are getting: java.lang.ExceptionInInitializerError
* at net.minecraft.server.StatisticList.<clinit>(SourceFile:58) * at net.minecraft.server.StatisticList.&lt;clinit&gt;(SourceFile:58)
* at net.minecraft.server.Item.<clinit>(SourceFile:252) * at net.minecraft.server.Item.&lt;clinit&gt;(SourceFile:252)
* at net.minecraft.server.Block.<clinit>(Block.java:577) * at net.minecraft.server.Block.&lt;clinit&gt;(Block.java:577)
* *
* extend this class to solve it. * 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.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.Versioning; import org.bukkit.craftbukkit.util.Versioning;
public class DummyServer implements InvocationHandler { public final class DummyServer implements InvocationHandler {
private static interface MethodHandler { private static interface MethodHandler {
Object handle(DummyServer server, Object[] args); Object handle(DummyServer server, Object[] args);
} }