Configurable server brand name, #11 w/ Clean up
This commit is contained in:
@@ -274,4 +274,9 @@ public class AkarinGlobalConfig {
|
||||
private static void messagePlayerQuit() {
|
||||
messagePlayerQuit = getString("messages.disconnect.player-quit-server", "§e%s left the game");
|
||||
}
|
||||
|
||||
public static String serverBrandName;
|
||||
private static void serverBrandName() {
|
||||
serverBrandName = getString("alternative.modified-server-brand-name", "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import io.akarin.api.internal.Akari;
|
||||
import io.akarin.server.core.AkarinGlobalConfig;
|
||||
import me.nallar.whocalled.WhoCalled;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -22,7 +23,7 @@ public abstract class MixinCraftServer {
|
||||
// We cannot apply the name modification in <init> method,
|
||||
// cause the initializer will be added to the tail
|
||||
if (needApplyServerName) {
|
||||
serverName = "Akarin";
|
||||
serverName = AkarinGlobalConfig.serverBrandName.equals(Akari.EMPTY_STRING) ? "Akarin" : AkarinGlobalConfig.serverBrandName;
|
||||
needApplyServerName = false;
|
||||
}
|
||||
return serverName;
|
||||
|
||||
@@ -2,14 +2,12 @@ package io.akarin.server.mixin.optimization;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.PlayerChunk;
|
||||
@@ -18,13 +16,11 @@ import net.minecraft.server.PlayerChunk;
|
||||
public abstract class MixinPlayerChunk {
|
||||
@Shadow @Final public List<EntityPlayer> c; // PAIL: players
|
||||
|
||||
@Inject(method = "b", at = @At(
|
||||
@Inject(method = "b()Z", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "net/minecraft/server/PacketPlayOutMapChunk.<init>(Lnet/minecraft/server/Chunk;I)V",
|
||||
opcode = Opcodes.INVOKESPECIAL,
|
||||
shift = Shift.BEFORE
|
||||
target = "net/minecraft/server/PacketPlayOutMapChunk.<init>(Lnet/minecraft/server/Chunk;I)V"
|
||||
))
|
||||
private void beforeCreateChunkPacket(CallbackInfo ci) {
|
||||
if (c.isEmpty()) ci.cancel(); // Akarin - Fixes MC-120780
|
||||
private void beforeCreateChunkPacket(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (c.isEmpty()) cir.setReturnValue(true); // Akarin - Fixes MC-120780
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import io.akarin.api.internal.Akari;
|
||||
import net.minecraft.server.BaseBlockPosition;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockDiodeAbstract;
|
||||
|
||||
Reference in New Issue
Block a user