Skip to content

Commit facc707

Browse files
Bug fix
Null pointer exception fixed in armor spell. Also added a nice message prompting users to provide any error log that occurrs when enabling volatile code for 1.11 R1. Added comments to most of the passive triggers regarding their trigger variables.
1 parent 947f0e5 commit facc707

39 files changed

+90
-4
lines changed

src/com/nisovin/magicspells/spells/buff/ArmorSpell.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ public void onPlayerDeath(PlayerDeathEvent event) {
209209
Iterator<ItemStack> drops = event.getDrops().iterator();
210210
while (drops.hasNext()) {
211211
ItemStack drop = drops.next();
212-
List<String> lore = drop.getItemMeta().getLore();
213-
if (lore != null && lore.size() > 0 && lore.get(lore.size()-1).equals(strLoreText)) {
214-
drops.remove();
212+
if (drop.hasItemMeta() && drop.getItemMeta() != null) {
213+
List<String> lore = drop.getItemMeta().getLore();
214+
if (lore != null && lore.size() > 0 && lore.get(lore.size()-1).equals(strLoreText)) {
215+
drops.remove();
216+
}
215217
}
216218
}
217219
}

src/com/nisovin/magicspells/spells/passive/BlockBreakListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.nisovin.magicspells.materials.MagicMaterial;
2020
import com.nisovin.magicspells.spells.PassiveSpell;
2121

22+
// optional trigger variable of a comma separated list of blocks to accept
2223
public class BlockBreakListener extends PassiveListener {
2324

2425
Set<Material> materials = new HashSet<Material>();

src/com/nisovin/magicspells/spells/passive/BlockPlaceListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.nisovin.magicspells.materials.MagicMaterial;
2020
import com.nisovin.magicspells.spells.PassiveSpell;
2121

22+
// optional trigger variable of comma separated list of blocks to accept
2223
public class BlockPlaceListener extends PassiveListener {
2324

2425
Set<Material> materials = new HashSet<Material>();

src/com/nisovin/magicspells/spells/passive/BuffListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.nisovin.magicspells.spells.BuffSpell;
2222
import com.nisovin.magicspells.spells.PassiveSpell;
2323

24+
// no trigger variable currently used
2425
public class BuffListener extends PassiveListener {
2526

2627
List<PassiveSpell> spells = new ArrayList<PassiveSpell>();

src/com/nisovin/magicspells/spells/passive/CraftListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.nisovin.magicspells.materials.MagicMaterial;
2020
import com.nisovin.magicspells.spells.PassiveSpell;
2121

22+
// optional trigger variable of a comma separated list of items to accept as the result
2223
public class CraftListener extends PassiveListener {
2324

2425
Set<Material> materials = new HashSet<Material>();

src/com/nisovin/magicspells/spells/passive/DeathListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.nisovin.magicspells.Spellbook;
1111
import com.nisovin.magicspells.spells.PassiveSpell;
1212

13+
// no trigger variable used here
1314
public class DeathListener extends PassiveListener {
1415

1516
List<PassiveSpell> spells = new ArrayList<PassiveSpell>();

src/com/nisovin/magicspells/spells/passive/DropItemListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.nisovin.magicspells.materials.MagicMaterial;
2020
import com.nisovin.magicspells.spells.PassiveSpell;
2121

22+
// optional trigger variable that may contain a comma separated list of items to accept
2223
public class DropItemListener extends PassiveListener {
2324

2425
Set<Material> materials = new HashSet<Material>();

src/com/nisovin/magicspells/spells/passive/EnterBedListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.nisovin.magicspells.Spellbook;
1111
import com.nisovin.magicspells.spells.PassiveSpell;
1212

13+
// no trigger variable is currently used
1314
public class EnterBedListener extends PassiveListener {
1415

1516
List<PassiveSpell> spells = new ArrayList<PassiveSpell>();

src/com/nisovin/magicspells/spells/passive/FatalDamageListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.nisovin.magicspells.Spellbook;
1313
import com.nisovin.magicspells.spells.PassiveSpell;
1414

15+
// no trigger variable is used here
1516
public class FatalDamageListener extends PassiveListener {
1617

1718
List<PassiveSpell> spells = new ArrayList<PassiveSpell>();

src/com/nisovin/magicspells/spells/passive/FishListener.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
import com.nisovin.magicspells.spells.PassiveSpell;
2020
import com.nisovin.magicspells.util.Util;
2121

22+
// trigger variable is optional
23+
// if not specified, it triggers in all forms
24+
// the trigger variable may be a comma separated list containing any of the following
25+
// ground, fish, fail, <entity type>
2226
public class FishListener extends PassiveListener {
2327

2428
Map<EntityType, List<PassiveSpell>> types = new HashMap<EntityType, List<PassiveSpell>>();

0 commit comments

Comments
 (0)