Skip to content
Browse files

Fix NPE and Quest ID containing ".quest".

Signed-off-by: Robert Xu <robxu9@gmail.com>
  • Loading branch information...
1 parent 83d1b57 commit 08b2d2ee1c0ef8c62d387d4ac8c0b5d6ca5afd92 @robxu9 robxu9 committed Apr 21, 2012
View
10 src/main/java/com/theminequest/MineQuest/Editable/EditManager.java
@@ -36,7 +36,10 @@ public void rmEditTracking(Edit e){
@EventHandler
public void onBlockPlace(BlockPlaceEvent e){
- if (!MineQuest.groupManager.getGroup(MineQuest.groupManager.indexOf(e.getPlayer())).isInQuest())
+ long id = MineQuest.groupManager.indexOf(e.getPlayer());
+ if (id==-1)
+ return;
+ if (!MineQuest.groupManager.getGroup(id).isInQuest())
return;
e.setCancelled(true);
for (Edit ed : edits){
@@ -48,7 +51,10 @@ public void onBlockPlace(BlockPlaceEvent e){
@EventHandler
public void onBlockDamage(BlockDamageEvent e){
- if (!MineQuest.groupManager.getGroup(MineQuest.groupManager.indexOf(e.getPlayer())).isInQuest())
+ long id = MineQuest.groupManager.indexOf(e.getPlayer());
+ if (id==-1)
+ return;
+ if (!MineQuest.groupManager.getGroup(id).isInQuest())
return;
e.setCancelled(true);
for (Edit ed : edits){
View
2 src/main/java/com/theminequest/MineQuest/Quest/QuestDescription.java
@@ -81,7 +81,7 @@
* @throws FileNotFoundException If file was suddenly disappears
*/
protected QuestDescription(File f) throws FileNotFoundException{
- String id = f.getName();
+ String id = f.getName().substring(0, f.getName().indexOf(".quest"));
file = f;
setDefaults(id);
readInFile();

0 comments on commit 08b2d2e

Please sign in to comment.
Something went wrong with that request. Please try again.