This commit is contained in:
Sotr
2018-06-14 19:38:31 +08:00
parent 3e38351ce7
commit 974cf681d0
19 changed files with 41 additions and 19 deletions

View File

@@ -14,7 +14,7 @@ import io.akarin.api.internal.Akari;
import io.akarin.server.core.AkarinGlobalConfig; import io.akarin.server.core.AkarinGlobalConfig;
@Mixin(value = Main.class, remap = false) @Mixin(value = Main.class, remap = false)
public class Bootstrap { public abstract class Bootstrap {
@Inject(method = "main([Ljava/lang/String;)V", at = @At("HEAD")) @Inject(method = "main([Ljava/lang/String;)V", at = @At("HEAD"))
private static void premain(CallbackInfo info) { private static void premain(CallbackInfo info) {
AkarinGlobalConfig.init(new File("akarin.yml")); AkarinGlobalConfig.init(new File("akarin.yml"));

View File

@@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.Overwrite;
import net.minecraft.server.EULA; import net.minecraft.server.EULA;
@Mixin(value = EULA.class, remap = false) @Mixin(value = EULA.class, remap = false)
public class DummyEula { public abstract class DummyEula {
/** /**
* Read then check the EULA file <i>formerly</i> * Read then check the EULA file <i>formerly</i>
* @param file * @param file

View File

@@ -14,7 +14,7 @@ import com.destroystokyo.paper.Metrics;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@Mixin(targets = "com.destroystokyo.paper.Metrics$PaperMetrics", remap = false) @Mixin(targets = "com.destroystokyo.paper.Metrics$PaperMetrics", remap = false)
public class MetricsBootstrap { public abstract class MetricsBootstrap {
@Overwrite @Overwrite
static void startMetrics() { static void startMetrics() {
// Get the config file // Get the config file

View File

@@ -17,7 +17,7 @@ import com.destroystokyo.paper.Metrics;
import com.destroystokyo.paper.Metrics.CustomChart; import com.destroystokyo.paper.Metrics.CustomChart;
@Mixin(value = Metrics.class, remap = false) @Mixin(value = Metrics.class, remap = false)
public class MixinMetrics { public abstract class MixinMetrics {
// The url to which the data is sent - bukkit/Torch (keep our old name) // The url to which the data is sent - bukkit/Torch (keep our old name)
private final static String URL = "https://bStats.org/submitData/bukkit"; private final static String URL = "https://bStats.org/submitData/bukkit";

View File

@@ -24,7 +24,7 @@ import net.minecraft.server.PotionRegistry;
import net.minecraft.server.SoundEffect; import net.minecraft.server.SoundEffect;
@Mixin(value = DispenserRegistry.class, remap = false) @Mixin(value = DispenserRegistry.class, remap = false)
public class ParallelRegistry { public abstract class ParallelRegistry {
/** /**
* Registry order: SoundEffect -> Block * Registry order: SoundEffect -> Block
*/ */

View File

@@ -21,7 +21,7 @@ import io.akarin.server.core.AkarinGlobalConfig;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@Mixin(value = WatchdogThread.class, remap = false) @Mixin(value = WatchdogThread.class, remap = false)
public class Watchcat extends Thread { public abstract class Watchcat extends Thread {
@Shadow private static WatchdogThread instance; @Shadow private static WatchdogThread instance;
@Shadow private @Final long timeoutTime; @Shadow private @Final long timeoutTime;
@Shadow private @Final boolean restart; @Shadow private @Final boolean restart;

View File

@@ -10,7 +10,7 @@ import io.akarin.server.core.AkarinGlobalConfig;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@Mixin(value = AsyncCatcher.class, remap = false) @Mixin(value = AsyncCatcher.class, remap = false)
public class MixinAsyncCatcher { public abstract class MixinAsyncCatcher {
@Shadow public static boolean enabled; @Shadow public static boolean enabled;
@Overwrite @Overwrite

View File

@@ -12,7 +12,7 @@ import io.akarin.server.core.AkarinGlobalConfig;
import net.minecraft.server.Chunk; import net.minecraft.server.Chunk;
@Mixin(value = ChunkIOExecutor.class, remap = false) @Mixin(value = ChunkIOExecutor.class, remap = false)
public class MixinChunkIOExecutor { public abstract class MixinChunkIOExecutor {
@Shadow @Final static int BASE_THREADS; @Shadow @Final static int BASE_THREADS;
@Shadow @Mutable @Final static int PLAYERS_PER_THREAD; @Shadow @Mutable @Final static int PLAYERS_PER_THREAD;
@Shadow @Final private static AsynchronousExecutor<?, Chunk, Runnable, RuntimeException> instance; @Shadow @Final private static AsynchronousExecutor<?, Chunk, Runnable, RuntimeException> instance;

View File

@@ -14,7 +14,7 @@ import io.akarin.server.core.AkarinGlobalConfig;
import net.minecraft.server.MCUtil; import net.minecraft.server.MCUtil;
@Mixin(value = VersionCommand.class, remap = false) @Mixin(value = VersionCommand.class, remap = false)
public class MixinVersionCommand { public abstract class MixinVersionCommand {
@Shadow private static int getFromRepo(String repo, String hash) { return 0; } @Shadow private static int getFromRepo(String repo, String hash) { return 0; }
/** /**

View File

@@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.server.WorldServer; import net.minecraft.server.WorldServer;
@Mixin(value = WorldServer.class, remap = false) @Mixin(value = WorldServer.class, remap = false)
public class MixinWorldServer { public abstract class MixinWorldServer {
@Redirect(method = "doTick", at = @At( @Redirect(method = "doTick", at = @At(
value = "INVOKE", value = "INVOKE",
target = "net/minecraft/server/PlayerChunkMap.flush()V" target = "net/minecraft/server/PlayerChunkMap.flush()V"

View File

@@ -11,7 +11,7 @@ import net.minecraft.server.Blocks;
import net.minecraft.server.ItemMonsterEgg; import net.minecraft.server.ItemMonsterEgg;
@Mixin(value = ItemMonsterEgg.class, remap = false) @Mixin(value = ItemMonsterEgg.class, remap = false)
public class MonsterEggGuardian { public abstract class MonsterEggGuardian {
@Redirect(method = "a", at = @At( @Redirect(method = "a", at = @At(
value = "FIELD", value = "FIELD",
target = "net/minecraft/server/Blocks.MOB_SPAWNER:Lnet/minecraft/server/Block;", target = "net/minecraft/server/Blocks.MOB_SPAWNER:Lnet/minecraft/server/Block;",

View File

@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.server.WorldServer; import net.minecraft.server.WorldServer;
@Mixin(value = CraftWorld.class, remap = false) @Mixin(value = CraftWorld.class, remap = false)
public class MixinCraftWorld { public abstract class MixinCraftWorld {
@Shadow @Final private WorldServer world; @Shadow @Final private WorldServer world;
@Redirect(method = "processChunkGC()V", at = @At( @Redirect(method = "processChunkGC()V", at = @At(

View File

@@ -35,7 +35,7 @@ import net.minecraft.server.ChunkProviderServer;
import net.minecraft.server.WorldServer; import net.minecraft.server.WorldServer;
@Mixin(value = ChunkProviderServer.class, remap = false, priority = 1001) @Mixin(value = ChunkProviderServer.class, remap = false, priority = 1001)
public class MixinChunkProviderServer { public abstract class MixinChunkProviderServer {
@Shadow @Final public WorldServer world; @Shadow @Final public WorldServer world;
@Redirect(method = "unloadChunks", at = @At( @Redirect(method = "unloadChunks", at = @At(

View File

@@ -17,7 +17,6 @@ import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import io.akarin.api.internal.Akari;
import io.akarin.api.internal.LocalAddress; import io.akarin.api.internal.LocalAddress;
import io.akarin.server.core.AkarinGlobalConfig; import io.akarin.server.core.AkarinGlobalConfig;
import io.akarin.server.core.ChannelAdapter; import io.akarin.server.core.ChannelAdapter;
@@ -37,7 +36,7 @@ import net.minecraft.server.PacketPlayOutKickDisconnect;
import net.minecraft.server.ServerConnection; import net.minecraft.server.ServerConnection;
@Mixin(value = ServerConnection.class, remap = false) @Mixin(value = ServerConnection.class, remap = false)
public class NonblockingServerConnection { public abstract class NonblockingServerConnection {
private final static Logger logger = LogManager.getLogger("NSC"); private final static Logger logger = LogManager.getLogger("NSC");
/** /**

View File

@@ -15,7 +15,7 @@ import net.minecraft.server.EntityPlayer;
import net.minecraft.server.PlayerChunk; import net.minecraft.server.PlayerChunk;
@Mixin(value = PlayerChunk.class, remap = false) @Mixin(value = PlayerChunk.class, remap = false)
public class MixinPlayerChunk { public abstract class MixinPlayerChunk {
@Shadow @Final public List<EntityPlayer> c; // PAIL: players @Shadow @Final public List<EntityPlayer> c; // PAIL: players
@Inject(method = "b", at = @At( @Inject(method = "b", at = @At(

View File

@@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Overwrite;
import net.minecraft.server.TileEntityEnchantTable; import net.minecraft.server.TileEntityEnchantTable;
@Mixin(value = TileEntityEnchantTable.class, remap = false) @Mixin(value = TileEntityEnchantTable.class, remap = false)
public class MixinTileEntityEnchantTable { public abstract class MixinTileEntityEnchantTable {
@Overwrite @Overwrite
public void e() {} // No tickable public void e() {} // No tickable
} }

View File

@@ -7,7 +7,6 @@ import java.util.Set;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockRedstoneEvent;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Overwrite;

View File

@@ -40,7 +40,7 @@ import net.minecraft.server.ItemStack;
* Fixes MC-128547(https://bugs.mojang.com/browse/MC-128547) * Fixes MC-128547(https://bugs.mojang.com/browse/MC-128547)
*/ */
@Mixin(value = EnchantmentManager.class, remap = false) @Mixin(value = EnchantmentManager.class, remap = false)
public class WeakEnchantmentManager { public abstract class WeakEnchantmentManager {
@Shadow(aliases = "a") @Final private static EnchantmentManager.EnchantmentModifierProtection protection; @Shadow(aliases = "a") @Final private static EnchantmentManager.EnchantmentModifierProtection protection;
@Shadow(aliases = "c") @Final private static EnchantmentManager.EnchantmentModifierThorns thorns; @Shadow(aliases = "c") @Final private static EnchantmentManager.EnchantmentModifierThorns thorns;
@Shadow(aliases = "d") @Final private static EnchantmentManager.EnchantmentModifierArthropods arthropods; @Shadow(aliases = "d") @Final private static EnchantmentManager.EnchantmentModifierArthropods arthropods;

View File

@@ -1,3 +1,27 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package io.akarin.server.mixin.realtime; package io.akarin.server.mixin.realtime;
import javax.annotation.Nullable; import javax.annotation.Nullable;