Temp
unknown
java
3 years ago
2.0 kB
9
Indexable
/*
Gathers the active symbols from the trigger and stores them into the
context state. If at any point this cannot be achieved a plugin exception
is thrown.
*/
@Override
public void init() {
final PluginContext ctx = getContext();
final Profile profile = ctx.get(Profile.class);
// Ensures the trigger is present and not null
Trigger trigger;
try {
trigger = checkNotNull(ctx.getTrigger(), "Trigger is NULL!");
} catch (Exception e) {
throw new PluginException("Trigger is not present!", e);
}
Map<TriggerKey, Object> triggerAsMap = trigger.asMap();
// Throw an exception if a required trigger key isn't present.
for(SlotTriggerKey triggeringKey: REQUIRED_TRIGGERING_KEYS){
if(!triggerAsMap.containsKey(triggeringKey)){
throw new PluginException("%s Trigger does not contain required keys", INIT_ERROR_PREFIX);
}
}
// Ensure we're only dealing with one award
SpinLines cause = (SpinLines) triggerAsMap.get(SlotTriggerKey.CAUSE);
if (cause.getSpinLines().size() != 1) {
throw new PluginException("%s Trigger CAUSE does not contain a single SpinLine", INIT_ERROR_PREFIX);
}
// Get active symbols.
List<ActiveSymbol> activeSymbolsList = cause.getSpinLines().get(0).getActiveSymbolsList();
// For debugging the activating symbols that enter the plugin.
if(log.isDebugEnabled()){
StringBuilder stringBuilder = new StringBuilder();
for(ActiveSymbol activeSymbols: activeSymbolsList){
stringBuilder.append("Symbol id: ").append(activeSymbols.getSymbol().getId())
.append("Position:")
.append("x=").append(activeSymbols.getReel())
.append("y=").append(activeSymbols.getOffset());
}
}
// Store the active symbol collection
ctx.get(State.class, Scope.INVOCATION)
.put(HOLD_TRIGGER_SYMBOL_STATE_KEY, activeSymbolsList);
}Editor is loading...