Skip to content

Commit

Permalink
Fixed some bugs from the beta
Browse files Browse the repository at this point in the history
- Fixed the CRC checksum error; clients will only download each picture once.
- Fixed the blank configuration file
- Fixed a typo: Spout -> Spoutcraft
- Reduced the number of duplicate camera items on the creative inventory screen to 2 by not manually registering the item
  • Loading branch information
zhuowei committed Dec 20, 2011
1 parent 54b7b47 commit 43c419d
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -53,6 +53,9 @@ public class SpoutInstantCameraPlugin extends JavaPlugin {
public SpoutShapedRecipe cameraRecipe;

public void onDisable() {
config.set("cameraItemTextureUrl", cameraItemTextureUrl);
config.set("cameraShutterSoundUrl", cameraShutterSoundUrl);
config.set("cameraItemName", cameraItemName);
config.set("nextPhotoId", nextPhotoId);
this.saveConfig();
System.out.println(this + " is now disabled!");
Expand All @@ -70,7 +73,6 @@ public void onEnable() {
fileManager.addToCache(this, cameraItemTextureUrl);
fileManager.addToCache(this, cameraShutterSoundUrl);
cameraItem = new CameraItem(this);
MaterialData.addCustomItem(cameraItem);
cameraRecipe = new SpoutShapedRecipe(new SpoutItemStack(cameraItem, 1)).shape("iii", "ird", "iii").
setIngredient('i', MaterialData.ironIngot).setIngredient('r', MaterialData.redstone).setIngredient('d', MaterialData.diamondBlock);
SpoutManager.getMaterialManager().registerSpoutRecipe(cameraRecipe);
Expand Down Expand Up @@ -119,7 +121,7 @@ private void cachePictureFor(SpoutPlayer player, short id) {
String fileName = FileUtil.getFileName(file.getPath());
long crc = -1;
try {
crc = CRCStore.getCRC(fileName, FileUtils.readFileToByteArray(file));
crc = FileUtil.getCRC(file, FileUtils.readFileToByteArray(file));
} catch (IOException e) {
e.printStackTrace();
}
Expand All @@ -142,7 +144,6 @@ public boolean openPictureScreen(SpoutPlayer player, short id) {

private class SpoutInstantCameraScreenListener extends ScreenListener {
public void onScreenshotReceived(ScreenshotReceivedEvent event) {
//System.out.println("Received a screenshot.");
SpoutPlayer player = event.getPlayer();
if (!playersTakingPictures.contains(player)) {
return;
Expand Down Expand Up @@ -176,7 +177,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
if (player.isSpoutCraftEnabled()) {
openPictureScreen(player, stack.getDurability());
} else {
player.sendMessage("You will need Spout to see this picture.");
player.sendMessage("You will need Spoutcraft to see this picture.");
}
}
}
Expand Down

0 comments on commit 43c419d

Please sign in to comment.