some ge changes

This commit is contained in:
ceikry
2021-07-21 13:35:05 -05:00
parent cbf9c426b8
commit 0b230a980b
4 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ dependencies {
implementation 'com.google.guava:guava:29.0-jre' implementation 'com.google.guava:guava:29.0-jre'
implementation 'mysql:mysql-connector-java:8.0.21' implementation 'mysql:mysql-connector-java:8.0.21'
implementation 'io.github.classgraph:classgraph:4.8.98' implementation 'io.github.classgraph:classgraph:4.8.98'
implementation 'org.jetbrains.kotlin:kotlin-reflect' implementation 'org.jetbrains.kotlin:kotlin-reflect:1.5.20'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
implementation files("libs/ConstLib-1.2.jar") implementation files("libs/ConstLib-1.2.jar")
implementation files("libs/PrimitiveExtensions-1.0.jar") implementation files("libs/PrimitiveExtensions-1.0.jar")
@@ -32,6 +32,11 @@ object GrandExchange : CallBack {
while(true) { while(true) {
SystemLogger.logGE("Updating offers...") SystemLogger.logGE("Updating offers...")
OfferManager.update() OfferManager.update()
if(OfferManager.dumpDatabase){
SystemLogger.logGE("Saving GE...")
OfferManager.save()
OfferManager.dumpDatabase = false
}
Thread.sleep(60_000) //sleep for 60 seconds Thread.sleep(60_000) //sleep for 60 seconds
} }
}.start() }.start()
@@ -382,7 +382,6 @@ object OfferManager {
if (!offer.isActive) { if (!offer.isActive) {
return return
} }
GE_OFFER_LOCK.lock()
for (o in OFFERS_BY_ITEMID[offer.itemID]!!) { for (o in OFFERS_BY_ITEMID[offer.itemID]!!) {
if (o.sell != offer.sell && o.isActive) { if (o.sell != offer.sell && o.isActive) {
exchange(offer, o) exchange(offer, o)
@@ -392,7 +391,6 @@ object OfferManager {
} }
} }
buyFromBots(offer) buyFromBots(offer)
GE_OFFER_LOCK.unlock()
} }
private fun getBuylimitAmount(offer: GrandExchangeOffer): Int { private fun getBuylimitAmount(offer: GrandExchangeOffer): Int {
@@ -18,7 +18,6 @@ import rs09.game.system.SystemLogger
import rs09.game.system.command.Command import rs09.game.system.command.Command
import java.util.* import java.util.*
import java.util.function.Consumer import java.util.function.Consumer
import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
/** /**
* Represents a class used to handle the loading of all plugins. * Represents a class used to handle the loading of all plugins.
@@ -62,7 +61,7 @@ object PluginManager {
var result = ClassGraph().enableClassInfo().enableAnnotationInfo().scan() var result = ClassGraph().enableClassInfo().enableAnnotationInfo().scan()
result.getClassesWithAnnotation("core.plugin.Initializable").forEach(Consumer { p: ClassInfo -> result.getClassesWithAnnotation("core.plugin.Initializable").forEach(Consumer { p: ClassInfo ->
try { try {
definePlugin(p.loadClass().newInstance() as Plugin<JvmType.Object>) definePlugin(p.loadClass().newInstance() as Plugin<Object>)
} catch (e: InstantiationException) { } catch (e: InstantiationException) {
e.printStackTrace() e.printStackTrace()
} catch (e: IllegalAccessException) { } catch (e: IllegalAccessException) {