From 995e1261e5136f9a5faa9e38f6c72ef73648cd1c Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 26 Jan 2020 16:03:10 -0500 Subject: [PATCH] Removed some redundant code --- .../main/java/com/boydti/fawe/FaweCache.kt | 26 +++++-------------- .../selector/CuboidRegionSelector.java | 4 +-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.kt b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.kt index 7c7d788ad..073314c67 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.kt +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.kt @@ -422,19 +422,6 @@ object FaweCache : Trimable { return null } else { 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") return null } @@ -477,12 +464,11 @@ object FaweCache : Trimable { val nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS val queue = ArrayBlockingQueue(nThreads) return object : ThreadPoolExecutor(nThreads, nThreads, - 0L, TimeUnit.MILLISECONDS, queue, Executors.defaultThreadFactory(), - ThreadPoolExecutor.CallerRunsPolicy()) { + 0L, TimeUnit.MILLISECONDS, queue, Executors.defaultThreadFactory(), CallerRunsPolicy()) { override fun afterExecute(r: Runnable?, t: Throwable?) { - var t = t + var throwable = t try { - super.afterExecute(r, t) + super.afterExecute(r, throwable) if (t == null && r is Future<*>) { try { val future = r as Future<*>? @@ -490,15 +476,15 @@ object FaweCache : Trimable { future.get() } } catch (ce: CancellationException) { - t = ce + throwable = ce } catch (ee: ExecutionException) { - t = ee.cause + throwable = ee.cause } catch (ie: InterruptedException) { Thread.currentThread().interrupt() } } - t?.printStackTrace() + throwable?.printStackTrace() } catch (e: Throwable) { e.printStackTrace() } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java index 1a4cecc71..63ba9a430 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java @@ -129,7 +129,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { checkNotNull(position); - if (position1 != null && position.equals(position1)) { + if (position.equals(position1)) { return false; } @@ -142,7 +142,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { checkNotNull(position); - if (position2 != null && position.equals(position2)) { + if (position.equals(position2)) { return false; }