Skip to content

Commit

Permalink
fix: thread issue when reloading multimeter options
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceWalkerRS committed Jan 25, 2022
1 parent de798a2 commit e096409
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerTask;
import net.minecraft.util.thread.ReentrantThreadExecutor;

import redstone.multimeter.common.TickTask;
import redstone.multimeter.interfaces.mixin.IMinecraftServer;
import redstone.multimeter.server.MultimeterServer;

@Mixin(MinecraftServer.class)
public class MinecraftServerMixin implements IMinecraftServer {
public abstract class MinecraftServerMixin extends ReentrantThreadExecutor<ServerTask> implements IMinecraftServer {

private MultimeterServer multimeterServer;

public MinecraftServerMixin(String name) {
super(name);
}

@Inject(
method = "<init>",
at = @At(
Expand Down Expand Up @@ -172,7 +178,7 @@ private void endTickTaskServerGui(BooleanSupplier isAheadOfTime, CallbackInfo ci
)
)
private void onReloadResources(Collection<String> datapacks, CallbackInfoReturnable<CompletableFuture<Void>> cir) {
multimeterServer.getMultimeter().reloadOptions();
execute(() -> multimeterServer.getMultimeter().reloadOptions());
}

@Inject(
Expand Down

0 comments on commit e096409

Please sign in to comment.