Skip to content

Commit

Permalink
Mark BB-10 fixed, also add in more informative logs so people know wh…
Browse files Browse the repository at this point in the history
…y the chest won't roll back correctly.
  • Loading branch information
Rob "N3X15" Nelson committed Apr 27, 2011
1 parent 9c32045 commit 8f88a19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
8 changes: 7 additions & 1 deletion pom.xml
Expand Up @@ -28,6 +28,12 @@
<url>http://ci.nexisonline.net:8080/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bukkit-plugins</id>
<url>http://repo.bukkit.org/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<!-- Grabs from Bukkit Artifactory -->
Expand Down Expand Up @@ -98,7 +104,7 @@
<artifactId>gitdescribe-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<outputPrefix>BigBrother-</outputPrefix>
<outputPrefix>git-BigBrother-</outputPrefix>
<outputPostfix></outputPostfix>
</configuration>
<executions>
Expand Down
Expand Up @@ -57,24 +57,29 @@ public static String getInventoryDelta(ItemStack[] orig, ItemStack[] latest) {
return builder.toString();
}

public static DeltaEntry[] processDeltaStream(int chestCapacity,String data) {
public static DeltaEntry[] processDeltaStream(int chestCapacity, String data) {
data=data.substring(1);
DeltaEntry[] de = new DeltaEntry[chestCapacity];
for(int i = 0;i<chestCapacity;i++) {
de[i] = new DeltaEntry(i);
}
int numskipped=0;
for(String chunk : data.split(";")) {
// Maybe handle BB-11? (Test)
if(chunk.startsWith("{"))
chunk=chunk.substring(1);
DeltaEntry e = new DeltaEntry(chunk);
// Check if we have enough room before adding crap to the array. Solves BB-10.
if(e.Slot > chestCapacity-1) {
BBLogging.debug("Skipping slot #"+e.Slot+", not enough room in chest.");
BBLogging.debug("Skipping slot #"+e.Slot+", not enough room in chest. ("+e.Slot+" > "+chestCapacity+")");
numskipped++;
} else {
de[e.Slot]=e;
}
}
if(numskipped>0)
BBLogging.warning("Skipped "+numskipped+" slots because there's not enough room in the chest.");

return de;
}
public static class DeltaEntry {
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/me/taylorkelly/bigbrother/tests/TestUtils.java
@@ -1,11 +1,5 @@
package me.taylorkelly.bigbrother.tests;

import java.io.File;

import me.taylorkelly.bigbrother.BBLogging;
import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.ServerNBTManager;
import net.minecraft.server.WorldManager;
import net.minecraft.server.WorldServer;

import org.bukkit.World;
Expand Down

0 comments on commit 8f88a19

Please sign in to comment.