Skip to content

Commit

Permalink
Fix for NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob "N3X15" Nelson committed Apr 28, 2011
1 parent 3465fa0 commit a330026
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -143,6 +143,11 @@
<version>2.3.1</version>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>BigBrother</Implementation-Title>
<Implementation-Version>${describe}</Implementation-Version>
<Implementation-Vendor>BigBrother Team</Implementation-Vendor>
</manifestEntries>
<manifestFile>src/main/resources/MANIFEST.MF</manifestFile>
</archive>
</configuration>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/me/taylorkelly/bigbrother/BigBrother.java
Expand Up @@ -55,11 +55,11 @@
import me.taylorkelly.bigbrother.tablemgrs.BBUsersTable;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
Expand All @@ -78,6 +78,7 @@ public class BigBrother extends JavaPlugin {
public WorldManager worldManager;
public static String name;
public static String version;
public static String build;
public final static String premessage = ChatColor.AQUA + "[BBROTHER]: " + ChatColor.WHITE;
private Updater updater;

Expand All @@ -98,6 +99,7 @@ public void onEnable() {
// Stuff that was in Constructor
name = this.getDescription().getName();
version = this.getDescription().getVersion();
build = BigBrother.class.getPackage().getImplementationVersion();

if(version.endsWith("SNAPSHOT")) {
BBLogging.info("------------------------------------");
Expand Down Expand Up @@ -191,7 +193,7 @@ public void onEnable() {
Cleanser.initialize(this);

// Done!
BBLogging.info(name + " " + version + " enabled");
BBLogging.info(name + " " + version + " (build "+build+") enabled");
}

private void updateSettings(File dataFolder) {
Expand Down Expand Up @@ -226,8 +228,6 @@ private void registerEvents() {
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Monitor, this);

// These events are used for Super Sticks
// Moved to playerListener. God help us. - N3X15
//pm.registerEvent(Event.Type.PLAYER_INTERACT, stickListener, Priority.Low, this);
pm.registerEvent(Event.Type.BLOCK_PLACE, stickListener, Priority.Low, this);


Expand Down
Expand Up @@ -276,8 +276,13 @@ private void do_NewRollback(World currWorld, Block block) {
case ADDED:
case REMOVED:
ItemStack stack = inv.getItem(i);
stack.setAmount(stack.getAmount()-diff[i].Amount);
stack.setDurability(diff[i].Damage);
if(stack==null)
stack=diff[i].oldStack;
else
{
stack.setAmount(stack.getAmount()-diff[i].Amount);
stack.setDurability(diff[i].Damage);
}
inv.setItem(i, stack);
break;
case REPLACED:
Expand All @@ -290,7 +295,7 @@ private void do_NewRollback(World currWorld, Block block) {
}
}

public void do_OldRollback(World currWorld,Block block) {
private void do_OldRollback(World currWorld,Block block) {
String[] changes = data.split(";");
if (block.getState() instanceof Chest) {
Chest chest = (Chest) block.getState();
Expand Down

0 comments on commit a330026

Please sign in to comment.