mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
parent
958f40fcbf
commit
a4353bb760
@ -387,10 +387,22 @@ public class Fawe {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the main thread
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Thread getMainThread() {
|
public Thread getMainThread() {
|
||||||
return this.thread;
|
return this.thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the main thread to the current thread
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Thread setMainThread() {
|
||||||
|
return this.thread = Thread.currentThread();
|
||||||
|
}
|
||||||
|
|
||||||
private ConcurrentHashMap<String, FawePlayer> players = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<String, FawePlayer> players = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public <T> void register(FawePlayer<T> player) {
|
public <T> void register(FawePlayer<T> player) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.forge;
|
package com.boydti.fawe.forge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
@ -55,6 +56,7 @@ public class ForgeTaskMan extends TaskManager {
|
|||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onServerTick(TickEvent.ServerTickEvent event) {
|
public void onServerTick(TickEvent.ServerTickEvent event) {
|
||||||
|
Fawe.get().setMainThread();
|
||||||
int asyncSize = asyncTasks.size();
|
int asyncSize = asyncTasks.size();
|
||||||
for (int i = 0; i < asyncSize; i++) {
|
for (int i = 0; i < asyncSize; i++) {
|
||||||
Runnable item = asyncTasks.poll();
|
Runnable item = asyncTasks.poll();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.forge;
|
package com.boydti.fawe.forge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -55,6 +56,7 @@ public class ForgeTaskMan extends TaskManager {
|
|||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onServerTick(TickEvent.ServerTickEvent event) {
|
public void onServerTick(TickEvent.ServerTickEvent event) {
|
||||||
|
Fawe.get().setMainThread();
|
||||||
int asyncSize = asyncTasks.size();
|
int asyncSize = asyncTasks.size();
|
||||||
for (int i = 0; i < asyncSize; i++) {
|
for (int i = 0; i < asyncSize; i++) {
|
||||||
Runnable item = asyncTasks.poll();
|
Runnable item = asyncTasks.poll();
|
||||||
|
Loading…
Reference in New Issue
Block a user