Removed some redundant code

This commit is contained in:
MattBDev 2020-01-26 16:03:10 -05:00
parent 5d5ee7e61e
commit 995e1261e5
2 changed files with 8 additions and 22 deletions

View File

@ -422,19 +422,6 @@ object FaweCache : Trimable {
return null return null
} else { } else {
val clazz = value.javaClass val clazz = value.javaClass
if (clazz.name.startsWith("com.intellectualcrafters.jnbt")) {
try {
if (clazz.name == "com.intellectualcrafters.jnbt.EndTag") {
return EndTag()
}
val field = clazz.getDeclaredField("value")
field.isAccessible = true
return asTag(field.get(value))
} catch (e: Throwable) {
e.printStackTrace()
}
}
println("Invalid nbt: $value") println("Invalid nbt: $value")
return null return null
} }
@ -477,12 +464,11 @@ object FaweCache : Trimable {
val nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS val nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS
val queue = ArrayBlockingQueue<Runnable>(nThreads) val queue = ArrayBlockingQueue<Runnable>(nThreads)
return object : ThreadPoolExecutor(nThreads, nThreads, return object : ThreadPoolExecutor(nThreads, nThreads,
0L, TimeUnit.MILLISECONDS, queue, Executors.defaultThreadFactory(), 0L, TimeUnit.MILLISECONDS, queue, Executors.defaultThreadFactory(), CallerRunsPolicy()) {
ThreadPoolExecutor.CallerRunsPolicy()) {
override fun afterExecute(r: Runnable?, t: Throwable?) { override fun afterExecute(r: Runnable?, t: Throwable?) {
var t = t var throwable = t
try { try {
super.afterExecute(r, t) super.afterExecute(r, throwable)
if (t == null && r is Future<*>) { if (t == null && r is Future<*>) {
try { try {
val future = r as Future<*>? val future = r as Future<*>?
@ -490,15 +476,15 @@ object FaweCache : Trimable {
future.get() future.get()
} }
} catch (ce: CancellationException) { } catch (ce: CancellationException) {
t = ce throwable = ce
} catch (ee: ExecutionException) { } catch (ee: ExecutionException) {
t = ee.cause throwable = ee.cause
} catch (ie: InterruptedException) { } catch (ie: InterruptedException) {
Thread.currentThread().interrupt() Thread.currentThread().interrupt()
} }
} }
t?.printStackTrace() throwable?.printStackTrace()
} catch (e: Throwable) { } catch (e: Throwable) {
e.printStackTrace() e.printStackTrace()
} }

View File

@ -129,7 +129,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
checkNotNull(position); checkNotNull(position);
if (position1 != null && position.equals(position1)) { if (position.equals(position1)) {
return false; return false;
} }
@ -142,7 +142,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
checkNotNull(position); checkNotNull(position);
if (position2 != null && position.equals(position2)) { if (position.equals(position2)) {
return false; return false;
} }