Added some static analysis tools to the build, fix a few bugs found
This commit is contained in:
@@ -12,6 +12,9 @@ import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.errorprone.annotations.CheckReturnValue;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a container which contains items.
|
||||
*
|
||||
@@ -277,6 +280,7 @@ public class Container {
|
||||
* @param items The set of items.
|
||||
* @return {@code True} if all items got successfully removed.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
public boolean remove(Item... items) {
|
||||
boolean removedAll = true;
|
||||
for (Item item : items) {
|
||||
@@ -294,6 +298,7 @@ public class Container {
|
||||
* @param item The item.
|
||||
* @return {@code True} if the item got removed, {@code false} if not.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
public boolean remove(Item item) {
|
||||
return remove(item, true);
|
||||
}
|
||||
@@ -305,6 +310,7 @@ public class Container {
|
||||
* @param fireListener If the fire listener should be "notified".
|
||||
* @return {@code True} if the item got removed, <br> {@code false} if not.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
public boolean remove(Item item, boolean fireListener) {
|
||||
int slot = getSlot(item);
|
||||
if (slot != -1) {
|
||||
@@ -322,6 +328,7 @@ public class Container {
|
||||
* @return {@code True} if the item got removed, <br> {@code false} if the
|
||||
* item on the slot was null or the ids didn't match.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
public boolean remove(Item item, int slot, boolean fireListener) {
|
||||
Item oldItem = items[slot];
|
||||
if (oldItem == null || oldItem.getId() != item.getId()) {
|
||||
|
||||
@@ -415,12 +415,14 @@ class CombatBotAssembler {
|
||||
skillAmt++
|
||||
}
|
||||
when (tier){
|
||||
Tier.PURE -> bot.skills.setStaticLevel(Skills.DEFENCE,10)
|
||||
Tier.PURE -> bot.skills.setStaticLevel(Skills.STRENGTH,99)
|
||||
Tier.PURE -> bot.skills.setStaticLevel(Skills.ATTACK,90)
|
||||
Tier.PURE -> bot.skills.setStaticLevel(Skills.PRAYER,43)
|
||||
Tier.PURE -> bot.skills.setStaticLevel(Skills.RANGE,1)
|
||||
Tier.PURE -> bot.skills.setStaticLevel(Skills.MAGIC,1)
|
||||
Tier.PURE -> {
|
||||
bot.skills.setStaticLevel(Skills.DEFENCE,10)
|
||||
bot.skills.setStaticLevel(Skills.STRENGTH,99)
|
||||
bot.skills.setStaticLevel(Skills.ATTACK,90)
|
||||
bot.skills.setStaticLevel(Skills.PRAYER,43)
|
||||
bot.skills.setStaticLevel(Skills.RANGE,1)
|
||||
bot.skills.setStaticLevel(Skills.MAGIC,1)
|
||||
}
|
||||
}
|
||||
|
||||
bot.skills.addExperience(Skills.HITPOINTS, (totalXPAdd / skillAmt) * 0.2)
|
||||
@@ -528,4 +530,4 @@ class CombatBotAssembler {
|
||||
val RING_ARCH = arrayOf(6733)
|
||||
|
||||
val RICH_MELEE_HELMS = arrayOf(2587,2595,2605,2613,2619,2627,2657,2665,2673,3486,1149,10828,4716,4724,4753)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,12 +146,12 @@ class AvanDialogue (player: Player? = null): DialoguePlugin(player) {
|
||||
304 -> npc("Well, the last I heard of my brother Johnathon," ,
|
||||
" he was studying the magical arts, " ,
|
||||
"and trying to hunt some demon or other out in The Wilderness.").also{stage++}
|
||||
304 -> npc("Unsurprisingly, I do not believe he is doing a particularly good job of things, ",
|
||||
305 -> npc("Unsurprisingly, I do not believe he is doing a particularly good job of things, ",
|
||||
"and spends most of his time recovering from his injuries " ,
|
||||
"in some tavern or other near the eastern edge of The Wilderness. " ,
|
||||
"You'll probably find him still there.").also{stage++}
|
||||
|
||||
305 -> player("Thanks Avan.").also { stage = 1000 }
|
||||
306 -> player("Thanks Avan.").also { stage = 1000 }
|
||||
|
||||
400 -> player("I am still working on it.").also{stage++}
|
||||
|
||||
|
||||
+4
-3
@@ -35,7 +35,8 @@ class LightSourceExtinguisher : OptionHandler(){
|
||||
}
|
||||
|
||||
fun Container.replace(item: Item, with: Item){
|
||||
remove(item)
|
||||
add(with)
|
||||
if(remove(item)) {
|
||||
add(with)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -73,8 +73,9 @@ class LightSourceLighter : UseWithHandler(590,36,38){
|
||||
}
|
||||
|
||||
fun Container.replace(item: Item, with: Item){
|
||||
remove(item)
|
||||
add(with)
|
||||
if(remove(item)) {
|
||||
add(with)
|
||||
}
|
||||
}
|
||||
|
||||
fun light(player: Player, item: Item, lightSource: LightSources): Boolean{
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.*
|
||||
@Initializable
|
||||
class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
|
||||
protected var npcs: List<NPC> = ArrayList()
|
||||
private var npcs: List<NPC> = ArrayList()
|
||||
|
||||
override fun defineCommands() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user