try(Connectionconnection=Emulator.getDatabase().getDataSource().getConnection();PreparedStatementstatement=connection.prepareStatement("INSERT INTO catalog_items_limited (catalog_item_id, number) VALUES (?, ?)"))
{
statement.setInt(1,this.itemId);
for(inti=starting;i<=amount;i++)
{
statement.setInt(2,i);
statement.addBatch();
this.limitedNumbers.push(i);
}
statement.executeBatch();
}
catch(SQLExceptione)
{
Emulator.getLogging().logSQLException(e);
}
this.totalSet+=amount;
Collections.shuffle(this.limitedNumbers);
}
}
publicintavailable()
{
returnthis.limitedNumbers.size();
}
publicintgetTotalSet()
{
returnthis.totalSet;
}
publicvoidsetTotalSet(inttotalSet)
{
this.totalSet=totalSet;
}
@Override
publicvoidrun()
{
try(Connectionconnection=Emulator.getDatabase().getDataSource().getConnection();PreparedStatementstatement=connection.prepareStatement("UPDATE catalog_items SET limited_stack = ?, limited_sells = ? WHERE id = ?"))