Begin implementation of CheckStyle style checking

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2019-04-23 14:00:30 +10:00
parent a0f2b74c8d
commit 7afe4d02f8
28 changed files with 144 additions and 97 deletions

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
<module name="FileTabCharacter"/>
<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TreeWalker">
<!-- See http://checkstyle.sourceforge.net/config_import.html -->
<module name="RedundantImport"/>
<!-- See http://checkstyle.sourceforge.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<!-- See http://checkstyle.sourceforge.net/config_design.html -->
<!--<module name="FinalClass"/>-->
<!--<module name="InterfaceIsType"/>-->
<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
</module>
</module>

View File

@ -1,16 +1,12 @@
--- a/net/minecraft/server/BlockPiston.java --- a/net/minecraft/server/BlockPiston.java
+++ b/net/minecraft/server/BlockPiston.java +++ b/net/minecraft/server/BlockPiston.java
@@ -6,6 +6,18 @@ @@ -6,6 +6,14 @@
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
+// CraftBukkit start +// CraftBukkit start
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList;
+import java.util.AbstractList;
+import org.bukkit.craftbukkit.block.CraftBlock; +import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockPistonRetractEvent; +import org.bukkit.event.block.BlockPistonRetractEvent;
+import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonExtendEvent;
@ -19,7 +15,7 @@
public class BlockPiston extends BlockDirectional { public class BlockPiston extends BlockDirectional {
public static final BlockStateBoolean EXTENDED = BlockProperties.g; public static final BlockStateBoolean EXTENDED = BlockProperties.g;
@@ -112,6 +124,18 @@ @@ -112,6 +120,18 @@
} }
} }
@ -38,7 +34,7 @@
world.playBlockAction(blockposition, this, b0, enumdirection.a()); world.playBlockAction(blockposition, this, b0, enumdirection.a());
} }
@@ -281,6 +305,48 @@ @@ -281,6 +301,48 @@
IBlockData[] aiblockdata = new IBlockData[j]; IBlockData[] aiblockdata = new IBlockData[j];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite(); EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
Set<BlockPosition> set = Sets.newHashSet(list); Set<BlockPosition> set = Sets.newHashSet(list);

View File

@ -278,12 +278,10 @@
return true; return true;
} else { } else {
return false; return false;
@@ -727,14 +869,40 @@ @@ -728,13 +870,39 @@
public boolean cB() {
return this.getMonsterType() == EnumMonsterType.UNDEAD; return this.getMonsterType() == EnumMonsterType.UNDEAD;
} }
-
+
+ // CraftBukkit start + // CraftBukkit start
@Nullable @Nullable
public MobEffect c(@Nullable MobEffectList mobeffectlist) { public MobEffect c(@Nullable MobEffectList mobeffectlist) {

View File

@ -279,16 +279,15 @@
this.releaseShoulderEntities(); this.releaseShoulderEntities();
- if (!this.isSpectator()) { - if (!this.isSpectator()) {
- this.d(damagesource); - this.d(damagesource);
- }
+ // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. + // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
+ if (!event.getKeepInventory()) { + if (!event.getKeepInventory()) {
+ this.inventory.clear(); + this.inventory.clear();
+ } }
+
+ this.setSpectatorTarget(this); // Remove spectated target
+ // CraftBukkit end
- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore); - this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore);
+ this.setSpectatorTarget(this); // Remove spectated target
+ // CraftBukkit end
+
+ // CraftBukkit - Get our scores instead + // CraftBukkit - Get our scores instead
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore); + this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore);
EntityLiving entityliving = this.getKillingEntity(); EntityLiving entityliving = this.getKillingEntity();

View File

@ -1,17 +1,17 @@
--- a/net/minecraft/server/EntityTrackerEntry.java --- a/net/minecraft/server/EntityTrackerEntry.java
+++ b/net/minecraft/server/EntityTrackerEntry.java +++ b/net/minecraft/server/EntityTrackerEntry.java
@@ -8,6 +8,11 @@ @@ -9,6 +9,11 @@
import java.util.function.Consumer;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
+
+// CraftBukkit start +// CraftBukkit start
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerVelocityEvent; +import org.bukkit.event.player.PlayerVelocityEvent;
+// CraftBukkit end +// CraftBukkit end
+
public class EntityTrackerEntry { public class EntityTrackerEntry {
private static final Logger a = LogManager.getLogger();
@@ -29,8 +34,12 @@ @@ -29,8 +34,12 @@
private List<Entity> p; private List<Entity> p;
private boolean q; private boolean q;

View File

@ -1,11 +1,10 @@
--- a/net/minecraft/server/InventorySubcontainer.java --- a/net/minecraft/server/InventorySubcontainer.java
+++ b/net/minecraft/server/InventorySubcontainer.java +++ b/net/minecraft/server/InventorySubcontainer.java
@@ -4,13 +4,65 @@ @@ -4,13 +4,64 @@
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
+// CraftBukkit start +// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location; +import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.HumanEntity;

View File

@ -5,7 +5,7 @@
public class ItemSign extends ItemBlockWallable { public class ItemSign extends ItemBlockWallable {
+ public static boolean openSign; // CraftBukkit + public static boolean openSign; // CraftBukkit
+ +
public ItemSign(Item.Info item_info, Block block, Block block1) { public ItemSign(Item.Info item_info, Block block, Block block1) {
super(block, block1, item_info); super(block, block1, item_info);
} }

View File

@ -1,12 +1,11 @@
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -47,6 +47,14 @@ @@ -47,6 +47,13 @@
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
+// CraftBukkit start +// CraftBukkit start
+import jline.console.ConsoleReader; +import jline.console.ConsoleReader;
+import joptsimple.OptionSet;
+import org.bukkit.Bukkit; +import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.Main; +import org.bukkit.craftbukkit.Main;
@ -15,7 +14,7 @@
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable { public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable {
@@ -65,7 +73,7 @@ @@ -65,7 +72,7 @@
public final DataFixer dataConverterManager; public final DataFixer dataConverterManager;
private String serverIp; private String serverIp;
private int serverPort = -1; private int serverPort = -1;
@ -24,7 +23,7 @@
private PlayerList playerList; private PlayerList playerList;
private volatile boolean isRunning = true; private volatile boolean isRunning = true;
private boolean isStopped; private boolean isStopped;
@@ -104,7 +112,7 @@ @@ -104,7 +111,7 @@
private final GameProfileRepository gameProfileRepository; private final GameProfileRepository gameProfileRepository;
private final UserCache userCache; private final UserCache userCache;
private long Z; private long Z;
@ -33,7 +32,7 @@
thread.setUncaughtExceptionHandler((thread1, throwable) -> { thread.setUncaughtExceptionHandler((thread1, throwable) -> {
MinecraftServer.LOGGER.error(throwable); MinecraftServer.LOGGER.error(throwable);
}); });
@@ -133,7 +141,20 @@ @@ -133,7 +140,20 @@
@Nullable @Nullable
private String av; private String av;
@ -55,7 +54,7 @@
super("Server"); super("Server");
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread); this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
@@ -146,15 +167,15 @@ @@ -146,15 +166,15 @@
this.ao = new CustomFunctionData(this); this.ao = new CustomFunctionData(this);
this.ap = new CircularTimer(); this.ap = new CircularTimer();
this.proxy = proxy; this.proxy = proxy;
@ -75,7 +74,7 @@
this.dataConverterManager = datafixer; this.dataConverterManager = datafixer;
this.ae.a((IReloadListener) this.aj); this.ae.a((IReloadListener) this.aj);
this.ae.a((IReloadListener) this.ai); this.ae.a((IReloadListener) this.ai);
@@ -163,7 +184,32 @@ @@ -163,7 +183,32 @@
this.ae.a((IReloadListener) this.an); this.ae.a((IReloadListener) this.an);
this.executorService = SystemUtils.e(); this.executorService = SystemUtils.e();
this.K = s; this.K = s;
@ -108,7 +107,7 @@
private void initializeScoreboards(WorldPersistentData worldpersistentdata) { private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard"); PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard");
@@ -199,11 +245,11 @@ @@ -199,11 +244,11 @@
} }
if (this.forceUpgrade) { if (this.forceUpgrade) {
@ -123,7 +122,7 @@
IChatBaseComponent ichatbasecomponent = null; IChatBaseComponent ichatbasecomponent = null;
while (!worldupgrader.b()) { while (!worldupgrader.b()) {
@@ -242,8 +288,9 @@ @@ -242,8 +287,9 @@
} }
protected void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) { protected void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) {
@ -134,7 +133,7 @@
WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this); WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this);
this.a(this.getWorld(), worldnbtstorage); this.a(this.getWorld(), worldnbtstorage);
@@ -268,24 +315,134 @@ @@ -268,24 +314,134 @@
} }
this.a(worldnbtstorage.getDirectory(), worlddata); this.a(worldnbtstorage.getDirectory(), worlddata);
@ -282,7 +281,7 @@
if (!worlddata.v()) { if (!worlddata.v()) {
try { try {
@@ -309,23 +466,8 @@ @@ -309,23 +465,8 @@
worlddata.d(true); worlddata.d(true);
} }
@ -307,7 +306,7 @@
private void a(WorldData worlddata) { private void a(WorldData worlddata) {
worlddata.f(false); worlddata.f(false);
@@ -344,6 +486,25 @@ @@ -344,6 +485,25 @@
protected void a(File file, WorldData worlddata) { protected void a(File file, WorldData worlddata) {
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla())); this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks")); this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
@ -333,7 +332,7 @@
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
this.resourcePackRepository.a(); this.resourcePackRepository.a();
List<ResourcePackLoader> list = Lists.newArrayList(); List<ResourcePackLoader> list = Lists.newArrayList();
@@ -364,11 +525,13 @@ @@ -364,11 +524,13 @@
this.b(worlddata); this.b(worlddata);
} }
@ -350,7 +349,7 @@
BlockPosition blockposition = worldserver.getSpawn(); BlockPosition blockposition = worldserver.getSpawn();
worldloadlistener.a(new ChunkCoordIntPair(blockposition)); worldloadlistener.a(new ChunkCoordIntPair(blockposition));
@@ -385,11 +548,13 @@ @@ -385,11 +547,13 @@
this.nextTick += 100L; this.nextTick += 100L;
this.sleepForTick(); this.sleepForTick();
@ -368,7 +367,7 @@
if (forcedchunk != null) { if (forcedchunk != null) {
WorldServer worldserver1 = this.getWorldServer(dimensionmanager); WorldServer worldserver1 = this.getWorldServer(dimensionmanager);
@@ -408,6 +573,8 @@ @@ -408,6 +572,8 @@
this.sleepForTick(); this.sleepForTick();
worldloadlistener.b(); worldloadlistener.b();
chunkproviderserver.getLightEngine().a(5); chunkproviderserver.getLightEngine().a(5);
@ -377,7 +376,7 @@
} }
protected void a(String s, WorldNBTStorage worldnbtstorage) { protected void a(String s, WorldNBTStorage worldnbtstorage) {
@@ -466,8 +633,29 @@ @@ -466,8 +632,29 @@
this.stop(); this.stop();
} }
@ -407,7 +406,7 @@
if (this.getServerConnection() != null) { if (this.getServerConnection() != null) {
this.getServerConnection().b(); this.getServerConnection().b();
} }
@@ -476,6 +664,7 @@ @@ -476,6 +663,7 @@
MinecraftServer.LOGGER.info("Saving players"); MinecraftServer.LOGGER.info("Saving players");
this.playerList.savePlayers(); this.playerList.savePlayers();
this.playerList.shutdown(); this.playerList.shutdown();
@ -415,7 +414,7 @@
} }
MinecraftServer.LOGGER.info("Saving worlds"); MinecraftServer.LOGGER.info("Saving worlds");
@@ -548,11 +737,13 @@ @@ -548,11 +736,13 @@
if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) { if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) {
long j = i / 50L; long j = i / 50L;
@ -429,7 +428,7 @@
this.nextTick += 50L; this.nextTick += 50L;
if (this.T) { if (this.T) {
this.T = false; this.T = false;
@@ -599,6 +790,12 @@ @@ -599,6 +789,12 @@
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally { } finally {
@ -442,7 +441,7 @@
this.exit(); this.exit();
} }
@@ -709,7 +906,7 @@ @@ -709,7 +905,7 @@
this.serverPing.b().a(agameprofile); this.serverPing.b().a(agameprofile);
} }
@ -451,7 +450,7 @@
MinecraftServer.LOGGER.debug("Autosave started"); MinecraftServer.LOGGER.debug("Autosave started");
this.methodProfiler.enter("save"); this.methodProfiler.enter("save");
this.playerList.savePlayers(); this.playerList.savePlayers();
@@ -739,27 +936,43 @@ @@ -739,27 +935,43 @@
} }
protected void b(BooleanSupplier booleansupplier) { protected void b(BooleanSupplier booleansupplier) {
@ -501,7 +500,7 @@
this.methodProfiler.enter("tick"); this.methodProfiler.enter("tick");
@@ -798,7 +1011,8 @@ @@ -798,7 +1010,8 @@
this.tickables.add(runnable); this.tickables.add(runnable);
} }
@ -511,7 +510,7 @@
OptionParser optionparser = new OptionParser(); OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui"); OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -821,15 +1035,17 @@ @@ -821,15 +1034,17 @@
optionparser.printHelpOn(System.err); optionparser.printHelpOn(System.err);
return; return;
} }
@ -531,7 +530,7 @@
MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'"); MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'");
return; return;
} }
@@ -841,14 +1057,15 @@ @@ -841,14 +1056,15 @@
DispenserRegistry.init(); DispenserRegistry.init();
DispenserRegistry.c(); DispenserRegistry.c();
@ -550,7 +549,7 @@
dedicatedserver.i((String) optionset.valueOf(optionspec7)); dedicatedserver.i((String) optionset.valueOf(optionspec7));
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10)); dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
dedicatedserver.e(optionset.has(optionspec2)); dedicatedserver.e(optionset.has(optionspec2));
@@ -871,6 +1088,25 @@ @@ -871,6 +1087,25 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
Runtime.getRuntime().addShutdownHook(thread); Runtime.getRuntime().addShutdownHook(thread);
@ -576,7 +575,7 @@
} catch (Exception exception) { } catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
} }
@@ -890,7 +1126,9 @@ @@ -890,7 +1125,9 @@
} }
public void startServerThread() { public void startServerThread() {
@ -586,7 +585,7 @@
} }
public File d(String s) { public File d(String s) {
@@ -945,7 +1183,7 @@ @@ -945,7 +1182,7 @@
} }
public String getServerModName() { public String getServerModName() {
@ -595,7 +594,7 @@
} }
public CrashReport b(CrashReport crashreport) { public CrashReport b(CrashReport crashreport) {
@@ -984,7 +1222,7 @@ @@ -984,7 +1221,7 @@
} }
public boolean E() { public boolean E() {
@ -604,7 +603,7 @@
} }
@Override @Override
@@ -1480,4 +1718,16 @@ @@ -1480,4 +1717,16 @@
} }
public abstract boolean b(GameProfile gameprofile); public abstract boolean b(GameProfile gameprofile);

View File

@ -1,14 +1,12 @@
--- a/net/minecraft/server/PlayerInventory.java --- a/net/minecraft/server/PlayerInventory.java
+++ b/net/minecraft/server/PlayerInventory.java +++ b/net/minecraft/server/PlayerInventory.java
@@ -5,6 +5,15 @@ @@ -5,6 +5,13 @@
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
+// CraftBukkit start +// CraftBukkit start
+import java.util.ArrayList; +import java.util.ArrayList;
+import java.util.List;
+import org.bukkit.Location; +import org.bukkit.Location;
+
+import org.bukkit.craftbukkit.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.HumanEntity;
+// CraftBukkit end +// CraftBukkit end
@ -16,7 +14,7 @@
public class PlayerInventory implements IInventory, INamableTileEntity { public class PlayerInventory implements IInventory, INamableTileEntity {
public final NonNullList<ItemStack> items; public final NonNullList<ItemStack> items;
@@ -16,6 +25,54 @@ @@ -16,6 +23,54 @@
private ItemStack carried; private ItemStack carried;
private int h; private int h;
@ -71,7 +69,7 @@
public PlayerInventory(EntityHuman entityhuman) { public PlayerInventory(EntityHuman entityhuman) {
this.items = NonNullList.a(36, ItemStack.a); this.items = NonNullList.a(36, ItemStack.a);
this.armor = NonNullList.a(4, ItemStack.a); this.armor = NonNullList.a(4, ItemStack.a);
@@ -41,6 +98,22 @@ @@ -41,6 +96,22 @@
return itemstack.getItem() == itemstack1.getItem() && ItemStack.equals(itemstack, itemstack1); return itemstack.getItem() == itemstack1.getItem() && ItemStack.equals(itemstack, itemstack1);
} }
@ -94,7 +92,7 @@
public int getFirstEmptySlotIndex() { public int getFirstEmptySlotIndex() {
for (int i = 0; i < this.items.size(); ++i) { for (int i = 0; i < this.items.size(); ++i) {
if (((ItemStack) this.items.get(i)).isEmpty()) { if (((ItemStack) this.items.get(i)).isEmpty()) {
@@ -513,8 +586,9 @@ @@ -513,8 +584,9 @@
ItemStack itemstack = (ItemStack) this.armor.get(i); ItemStack itemstack = (ItemStack) this.armor.get(i);
if (itemstack.getItem() instanceof ItemArmor) { if (itemstack.getItem() instanceof ItemArmor) {
@ -105,7 +103,7 @@
}); });
} }
} }
@@ -550,6 +624,11 @@ @@ -550,6 +622,11 @@
} }
public ItemStack getCarried() { public ItemStack getCarried() {

View File

@ -1,11 +1,10 @@
--- a/net/minecraft/server/TileEntityFurnace.java --- a/net/minecraft/server/TileEntityFurnace.java
+++ b/net/minecraft/server/TileEntityFurnace.java +++ b/net/minecraft/server/TileEntityFurnace.java
@@ -7,6 +7,17 @@ @@ -7,6 +7,16 @@
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+// CraftBukkit start +// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.block.CraftBlock; +import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -18,7 +17,7 @@
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput, ITickable { public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput, ITickable {
@@ -135,6 +146,36 @@ @@ -135,6 +145,36 @@
return map; return map;
} }
@ -55,7 +54,7 @@
private static void a(Map<Item, Integer> map, Tag<Item> tag, int i) { private static void a(Map<Item, Integer> map, Tag<Item> tag, int i) {
Iterator iterator = tag.a().iterator(); Iterator iterator = tag.a().iterator();
@@ -211,12 +252,23 @@ @@ -211,12 +251,23 @@
this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal); this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal);
} }
} else { } else {
@ -82,7 +81,7 @@
flag1 = true; flag1 = true;
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
Item item = itemstack.getItem(); Item item = itemstack.getItem();
@@ -278,11 +330,38 @@ @@ -278,11 +329,38 @@
ItemStack itemstack1 = irecipe.c(); ItemStack itemstack1 = irecipe.c();
ItemStack itemstack2 = (ItemStack) this.items.get(2); ItemStack itemstack2 = (ItemStack) this.items.get(2);
@ -121,7 +120,7 @@
if (!this.world.isClientSide) { if (!this.world.isClientSide) {
this.a(irecipe); this.a(irecipe);
@@ -307,7 +386,7 @@ @@ -307,7 +385,7 @@
} }
protected int getRecipeCookingTime() { protected int getRecipeCookingTime() {
@ -130,7 +129,7 @@
} }
public static boolean isFuel(ItemStack itemstack) { public static boolean isFuel(ItemStack itemstack) {
@@ -434,7 +513,7 @@ @@ -434,7 +512,7 @@
@Override @Override
public void b(EntityHuman entityhuman) {} public void b(EntityHuman entityhuman) {}
@ -139,7 +138,7 @@
List<IRecipe<?>> list = Lists.newArrayList(); List<IRecipe<?>> list = Lists.newArrayList();
Iterator iterator = this.n.entrySet().iterator(); Iterator iterator = this.n.entrySet().iterator();
@@ -443,7 +522,7 @@ @@ -443,7 +521,7 @@
entityhuman.world.getCraftingManager().a((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> { entityhuman.world.getCraftingManager().a((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
list.add(irecipe); list.add(irecipe);
@ -148,7 +147,7 @@
}); });
} }
@@ -451,7 +530,7 @@ @@ -451,7 +529,7 @@
this.n.clear(); this.n.clear();
} }
@ -157,7 +156,7 @@
int j; int j;
if (f == 0.0F) { if (f == 0.0F) {
@@ -465,6 +544,14 @@ @@ -465,6 +543,14 @@
i = j; i = j;
} }

View File

@ -268,6 +268,30 @@
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.19</version>
</dependency>
</dependencies>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId> <artifactId>animal-sniffer-maven-plugin</artifactId>

View File

@ -68,7 +68,7 @@ public class CraftProfileBanList implements org.bukkit.BanList {
@Override @Override
public Set<org.bukkit.BanEntry> getBanEntries() { public Set<org.bukkit.BanEntry> getBanEntries() {
ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder(); ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder();
for (JsonListEntry entry : list.getValues()) { for (JsonListEntry entry : list.getValues()) {
GameProfile profile = (GameProfile) entry.getKey(); GameProfile profile = (GameProfile) entry.getKey();
builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list)); builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list));

View File

@ -1327,7 +1327,7 @@ public final class CraftServer implements Server {
for (JsonListEntry entry : playerList.getProfileBans().getValues()) { for (JsonListEntry entry : playerList.getProfileBans().getValues()) {
result.add(getOfflinePlayer((GameProfile) entry.getKey())); result.add(getOfflinePlayer((GameProfile) entry.getKey()));
} }
return result; return result;
} }

View File

@ -45,14 +45,14 @@ public class CraftWorldBorder implements WorldBorder {
if (time > 0L) { if (time > 0L) {
this.handle.transitionSizeBetween(this.handle.getSize(), newSize, time * 1000L); this.handle.transitionSizeBetween(this.handle.getSize(), newSize, time * 1000L);
} else { } else {
this.handle.setSize(newSize); this.handle.setSize(newSize);
} }
} }
@Override @Override
public Location getCenter() { public Location getCenter() {
double x = this.handle.getCenterX(); double x = this.handle.getCenterX();
double z = this.handle.getCenterZ(); double z = this.handle.getCenterZ();
return new Location(this.world, x, 0, z); return new Location(this.world, x, 0, z);
} }
@ -63,7 +63,7 @@ public class CraftWorldBorder implements WorldBorder {
x = Math.min(3.0E7D, Math.max(-3.0E7D, x)); x = Math.min(3.0E7D, Math.max(-3.0E7D, x));
z = Math.min(3.0E7D, Math.max(-3.0E7D, z)); z = Math.min(3.0E7D, Math.max(-3.0E7D, z));
this.handle.setCenter(x, z); this.handle.setCenter(x, z);
} }
@Override @Override
@ -108,7 +108,7 @@ public class CraftWorldBorder implements WorldBorder {
@Override @Override
public void setWarningDistance(int distance) { public void setWarningDistance(int distance) {
this.handle.setWarningDistance(distance); this.handle.setWarningDistance(distance);
} }
@Override @Override

View File

@ -273,4 +273,4 @@ public class CraftBlockState implements BlockState {
throw new IllegalStateException("The blockState must be placed to call this method"); throw new IllegalStateException("The blockState must be placed to call this method");
} }
} }
} }

View File

@ -1,7 +1,6 @@
package org.bukkit.craftbukkit.block.data; package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftWaterlogged extends CraftBlockData implements Waterlogged { public abstract class CraftWaterlogged extends CraftBlockData implements Waterlogged {

View File

@ -61,11 +61,11 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
public void setPhase(Phase phase) { public void setPhase(Phase phase) {
getHandle().getDragonControllerManager().setControllerPhase(getMinecraftPhase(phase)); getHandle().getDragonControllerManager().setControllerPhase(getMinecraftPhase(phase));
} }
public static Phase getBukkitPhase(DragonControllerPhase phase) { public static Phase getBukkitPhase(DragonControllerPhase phase) {
return Phase.values()[phase.b()]; return Phase.values()[phase.b()];
} }
public static DragonControllerPhase getMinecraftPhase(Phase phase) { public static DragonControllerPhase getMinecraftPhase(Phase phase) {
return DragonControllerPhase.getById(phase.ordinal()); return DragonControllerPhase.getById(phase.ordinal());
} }

View File

@ -31,7 +31,7 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
@Override @Override
public Type getRabbitType() { public Type getRabbitType() {
int type = getHandle().getRabbitType(); int type = getHandle().getRabbitType();
return CraftMagicMapping.fromMagic(type); return CraftMagicMapping.fromMagic(type);
} }
@ -46,7 +46,7 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
entity.initializePathFinderGoals(); entity.initializePathFinderGoals();
} }
entity.setRabbitType(CraftMagicMapping.toMagic(type)); entity.setRabbitType(CraftMagicMapping.toMagic(type));
} }
private static class CraftMagicMapping { private static class CraftMagicMapping {

View File

@ -208,7 +208,7 @@ public class CraftContainer extends Container {
break; break;
case SMOKER: case SMOKER:
delegate = new ContainerSmoker(windowId, bottom, top, new ContainerProperties(4)); delegate = new ContainerSmoker(windowId, bottom, top, new ContainerProperties(4));
break; break;
case LOOM: case LOOM:
delegate = new ContainerLoom(windowId, bottom); delegate = new ContainerLoom(windowId, bottom);
break; break;

View File

@ -31,7 +31,7 @@ class CraftMetaCharge extends CraftMetaItem implements FireworkEffectMeta {
setEffect(SerializableMeta.getObject(FireworkEffect.class, map, EXPLOSION.BUKKIT, true)); setEffect(SerializableMeta.getObject(FireworkEffect.class, map, EXPLOSION.BUKKIT, true));
} }
CraftMetaCharge(NBTTagCompound tag) { CraftMetaCharge(NBTTagCompound tag) {
super(tag); super(tag);

View File

@ -102,7 +102,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
if (hasMapId()){ if (hasMapId()){
tag.setInt(MAP_ID.NBT, getMapId()); tag.setInt(MAP_ID.NBT, getMapId());
} }
if (hasScaling()) { if (hasScaling()) {
tag.setBoolean(MAP_SCALING.NBT, isScaling()); tag.setBoolean(MAP_SCALING.NBT, isScaling());
} }

View File

@ -61,4 +61,4 @@ public class InventoryIterator implements ListIterator<ItemStack> {
public void remove() { public void remove() {
throw new UnsupportedOperationException("Can't change the size of an inventory!"); throw new UnsupportedOperationException("Can't change the size of an inventory!");
} }
} }

View File

@ -305,7 +305,7 @@ public class CraftScheduler implements BukkitScheduler {
return false; return false;
} }
if (task.isSync()) { if (task.isSync()) {
return (task == currentTask); return (task == currentTask);
} }
final CraftAsyncTask asyncTask = (CraftAsyncTask) task; final CraftAsyncTask asyncTask = (CraftAsyncTask) task;
synchronized (asyncTask.getWorkers()) { synchronized (asyncTask.getWorkers()) {

View File

@ -11,8 +11,8 @@ import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.Ansi.Erase; import org.fusesource.jansi.Ansi.Erase;
public class TerminalConsoleWriterThread extends Thread { public class TerminalConsoleWriterThread extends Thread {
final private ConsoleReader reader; private final ConsoleReader reader;
final private OutputStream output; private final OutputStream output;
public TerminalConsoleWriterThread(OutputStream output, ConsoleReader reader) { public TerminalConsoleWriterThread(OutputStream output, ConsoleReader reader) {
this.output = output; this.output = output;

View File

@ -60,19 +60,19 @@ public class ChunkDataTest extends AbstractTestingBase {
testSetRegion(data, 0, 0, 0, 0, 0, 0, RED_WOOL); // minimum == maximum testSetRegion(data, 0, 0, 0, 0, 0, 0, RED_WOOL); // minimum == maximum
testSetRegion(data, 0, 0, 0, 16, 16, 16, RED_WOOL); // Whole Chunk Section testSetRegion(data, 0, 0, 0, 16, 16, 16, RED_WOOL); // Whole Chunk Section
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 8, 0, 16, 24, 16, RED_WOOL); // Start middle of this section, end middle of next testSetRegion(data, 0, 8, 0, 16, 24, 16, RED_WOOL); // Start middle of this section, end middle of next
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 4, 0, 16, 12, 16, RED_WOOL); // Start in this section, end in this section testSetRegion(data, 0, 4, 0, 16, 12, 16, RED_WOOL); // Start in this section, end in this section
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 0, 0, 16, 16, 1, RED_WOOL); // Whole Chunk Section testSetRegion(data, 0, 0, 0, 16, 16, 1, RED_WOOL); // Whole Chunk Section
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 8, 0, 16, 24, 1, RED_WOOL); // Start middle of this section, end middle of next testSetRegion(data, 0, 8, 0, 16, 24, 1, RED_WOOL); // Start middle of this section, end middle of next
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 4, 0, 16, 12, 1, RED_WOOL); // Start in this section, end in this section testSetRegion(data, 0, 4, 0, 16, 12, 1, RED_WOOL); // Start in this section, end in this section
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 0, 0, 1, 16, 1, RED_WOOL); // Whole Chunk Section testSetRegion(data, 0, 0, 0, 1, 16, 1, RED_WOOL); // Whole Chunk Section
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 8, 0, 1, 24, 1, RED_WOOL); // Start middle of this section, end middle of next testSetRegion(data, 0, 8, 0, 1, 24, 1, RED_WOOL); // Start middle of this section, end middle of next
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);
testSetRegion(data, 0, 4, 0, 1, 12, 1, RED_WOOL); // Start in this section, end in this section testSetRegion(data, 0, 4, 0, 1, 12, 1, RED_WOOL); // Start in this section, end in this section
data.setRegion(0, 0, 0, 16, 256, 16, AIR); data.setRegion(0, 0, 0, 16, 256, 16, AIR);

View File

@ -26,7 +26,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest {
return CompoundOperator.compound( return CompoundOperator.compound(
Joiner.on('+'), Joiner.on('+'),
NAME_PARAMETER, NAME_PARAMETER,
~0l, ~0L,
Arrays.asList( Arrays.asList(
new Object[] { new Object[] {
new Operator() { new Operator() {

View File

@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableList;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ItemStackTest extends AbstractTestingBase { public class ItemStackTest extends AbstractTestingBase {
static abstract class StackProvider { abstract static class StackProvider {
final Material material; final Material material;
StackProvider(Material material) { StackProvider(Material material) {

View File

@ -17,7 +17,7 @@ public class EnderDragonPhaseTest {
assertNotNull(phase.name(), CraftEnderDragon.getBukkitPhase(dragonControllerPhase)); assertNotNull(phase.name(), CraftEnderDragon.getBukkitPhase(dragonControllerPhase));
} }
} }
@Test @Test
public void testBukkitToMinecraft() { public void testBukkitToMinecraft() {
Assert.assertEquals("CIRCLING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.CIRCLING), DragonControllerPhase.HOLDING_PATTERN); Assert.assertEquals("CIRCLING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.CIRCLING), DragonControllerPhase.HOLDING_PATTERN);
@ -46,5 +46,5 @@ public class EnderDragonPhaseTest {
Assert.assertEquals("CHARGE_PLAYER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.CHARGING_PLAYER), EnderDragon.Phase.CHARGE_PLAYER); Assert.assertEquals("CHARGE_PLAYER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.CHARGING_PLAYER), EnderDragon.Phase.CHARGE_PLAYER);
Assert.assertEquals("DYING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.DYING), EnderDragon.Phase.DYING); Assert.assertEquals("DYING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.DYING), EnderDragon.Phase.DYING);
Assert.assertEquals("HOVER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.HOVER), EnderDragon.Phase.HOVER); Assert.assertEquals("HOVER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.HOVER), EnderDragon.Phase.HOVER);
} }
} }