From 43c419dce68adab85bcacd52fb9d01f045700a68 Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Tue, 20 Dec 2011 13:15:14 -0800 Subject: [PATCH] Fixed some bugs from the beta - 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 --- .../spoutinstantcamera/SpoutInstantCameraPlugin.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/zhuoweizhang/spoutinstantcamera/SpoutInstantCameraPlugin.java b/src/main/java/net/zhuoweizhang/spoutinstantcamera/SpoutInstantCameraPlugin.java index f57b413..acb4dce 100644 --- a/src/main/java/net/zhuoweizhang/spoutinstantcamera/SpoutInstantCameraPlugin.java +++ b/src/main/java/net/zhuoweizhang/spoutinstantcamera/SpoutInstantCameraPlugin.java @@ -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!"); @@ -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); @@ -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(); } @@ -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; @@ -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."); } } }