mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-10 07:47:42 +07:00
Added support within StatListBuilder to retrieve previously put stat
This commit is contained in:
@ -3,10 +3,14 @@ package com.riiablo.attributes;
|
||||
public final class StatListBuilder {
|
||||
final StatList stats;
|
||||
final int list;
|
||||
final StatGetter tuple;
|
||||
int index;
|
||||
|
||||
StatListBuilder(StatList stats, int list) {
|
||||
this.stats = stats;
|
||||
this.list = list;
|
||||
this.tuple = new StatGetter(stats);
|
||||
this.index = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -21,27 +25,33 @@ public final class StatListBuilder {
|
||||
return stats.get(list);
|
||||
}
|
||||
|
||||
/** @see StatList#get(int) */
|
||||
public StatGetter last() {
|
||||
if (index < 0) throw new IllegalStateException("cannot retrieve last stat when no stats have been added yet!");
|
||||
return tuple.update(index);
|
||||
}
|
||||
|
||||
/** @see StatList#put(int, short, int, int) */
|
||||
public StatListBuilder put(short stat, int param, int value) {
|
||||
stats.put(list, stat, param, value);
|
||||
index = stats.put(list, stat, param, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @see StatList#put(int, short, int) */
|
||||
public StatListBuilder put(short stat, int value) {
|
||||
stats.put(list, stat, value);
|
||||
index = stats.put(list, stat, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @see StatList#put(int, short, long) */
|
||||
public StatListBuilder put(short stat, long value) {
|
||||
stats.put(list, stat, value);
|
||||
index = stats.put(list, stat, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @see StatList#put(int, short, float) */
|
||||
public StatListBuilder put(short stat, float value) {
|
||||
stats.put(list, stat, value);
|
||||
index = stats.put(list, stat, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user