This commit is contained in:
Kenzie Togami
2019-09-04 22:50:14 -07:00
committed by Jesse Boyd
parent 122f3b2562
commit d9b0aeca7f
9 changed files with 176 additions and 27 deletions

View File

@ -34,6 +34,7 @@ import net.minecraft.SharedConstants;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
@ -64,8 +65,8 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
this.mod = mod;
this.server = server;
this.dataFixer = new FabricDataFixer(getDataVersion());
this.watchdog = server instanceof DedicatedServer
? new FabricWatchdog((MixinMinecraftServer) (Object) server) : null;
this.watchdog = server instanceof MinecraftDedicatedServer
? new FabricWatchdog((MinecraftDedicatedServer) server) : null;
}
boolean isHookingEvents() {

View File

@ -1,19 +1,39 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.fabric;
import com.sk89q.worldedit.extension.platform.Watchdog;
import com.sk89q.worldedit.fabric.mixin.MixinMinecraftServer;
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import net.minecraft.util.SystemUtil;
class FabricWatchdog implements Watchdog {
private final MixinMinecraftServer server;
private final MinecraftDedicatedServer server;
FabricWatchdog(MixinMinecraftServer server) {
FabricWatchdog(MinecraftDedicatedServer server) {
this.server = server;
}
@Override
public void tick() {
server.timeReference = SystemUtil.getMeasuringTimeMs();
((MixinMinecraftServer) (Object) server).timeReference = SystemUtil.getMeasuringTimeMs();
}
}

View File

@ -1,3 +1,22 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.fabric.mixin;
import net.minecraft.server.MinecraftServer;
@ -11,8 +30,8 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(MinecraftServer.class)
public abstract class MixinMinecraftServer extends NonBlockingThreadExecutor<ServerTask> implements SnooperListener, CommandOutput, AutoCloseable, Runnable {
public MixinMinecraftServer(String string_1) {
super(string_1);
public MixinMinecraftServer(String name) {
super(name);
}
@Shadow