Added documentation to Mixin classes
This commit is contained in:
@ -22,6 +22,9 @@ import java.util.Set;
|
|||||||
@Mixin(PlayerManager.class)
|
@Mixin(PlayerManager.class)
|
||||||
public abstract class PlayerManagerMixin {
|
public abstract class PlayerManagerMixin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send join message to joined player
|
||||||
|
*/
|
||||||
@Inject(method = {"onPlayerConnect"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V")})
|
@Inject(method = {"onPlayerConnect"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V")})
|
||||||
public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData clientData, CallbackInfo ci) {
|
public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData clientData, CallbackInfo ci) {
|
||||||
if (ConfigManager.getConfig().joinMessageEnabled && !player.getServer().isSingleplayer()) {
|
if (ConfigManager.getConfig().joinMessageEnabled && !player.getServer().isSingleplayer()) {
|
||||||
@ -30,6 +33,9 @@ public abstract class PlayerManagerMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify join message broadcasted to server
|
||||||
|
*/
|
||||||
@ModifyArg(method = {"onPlayerConnect"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V"))
|
@ModifyArg(method = {"onPlayerConnect"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V"))
|
||||||
private Text onPlayerConnect(Text text) {
|
private Text onPlayerConnect(Text text) {
|
||||||
if (ConfigManager.getConfig().joinMessageEnabled) {
|
if (ConfigManager.getConfig().joinMessageEnabled) {
|
||||||
@ -39,6 +45,9 @@ public abstract class PlayerManagerMixin {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get player out of specator mode if necessary
|
||||||
|
*/
|
||||||
@Inject(method = {"remove"}, at = {@At("HEAD")})
|
@Inject(method = {"remove"}, at = {@At("HEAD")})
|
||||||
public void onPlayerLeave(ServerPlayerEntity player, CallbackInfo ci) {
|
public void onPlayerLeave(ServerPlayerEntity player, CallbackInfo ci) {
|
||||||
if (SpectatorCommand.spectating.containsKey(player)) {
|
if (SpectatorCommand.spectating.containsKey(player)) {
|
||||||
@ -48,6 +57,9 @@ public abstract class PlayerManagerMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify chat messages
|
||||||
|
*/
|
||||||
@Inject(method = {"broadcast(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/network/message/MessageType$Parameters;)V"}, at = {@At("HEAD")}, cancellable = true)
|
@Inject(method = {"broadcast(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/network/message/MessageType$Parameters;)V"}, at = {@At("HEAD")}, cancellable = true)
|
||||||
private void onBroadcast(SignedMessage message, ServerPlayerEntity sender, MessageType.Parameters parameters, CallbackInfo ci) {
|
private void onBroadcast(SignedMessage message, ServerPlayerEntity sender, MessageType.Parameters parameters, CallbackInfo ci) {
|
||||||
if (sender != null) {
|
if (sender != null) {
|
||||||
|
@ -10,6 +10,9 @@ import wtf.hak.survivalfabric.config.ConfigManager;
|
|||||||
@Mixin(ServerPlayNetworkHandler.class)
|
@Mixin(ServerPlayNetworkHandler.class)
|
||||||
public abstract class ServerPlayNetworkHandlerMixin {
|
public abstract class ServerPlayNetworkHandlerMixin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify quit message
|
||||||
|
*/
|
||||||
@ModifyArg(method = {"cleanUp"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V"))
|
@ModifyArg(method = {"cleanUp"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V"))
|
||||||
private Text quitMessage(Text text) {
|
private Text quitMessage(Text text) {
|
||||||
if (ConfigManager.getConfig().quitMessageEnabled) {
|
if (ConfigManager.getConfig().quitMessageEnabled) {
|
||||||
|
@ -12,6 +12,9 @@ import wtf.hak.survivalfabric.config.ConfigManager;
|
|||||||
@Mixin(ServerPlayerEntity.class)
|
@Mixin(ServerPlayerEntity.class)
|
||||||
public abstract class ServerPlayerEntityMixin {
|
public abstract class ServerPlayerEntityMixin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change player list name if enabled
|
||||||
|
*/
|
||||||
@Inject(method = "getPlayerListName", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "getPlayerListName", at = @At("HEAD"), cancellable = true)
|
||||||
private void changePlayerListName(CallbackInfoReturnable<Text> cir) {
|
private void changePlayerListName(CallbackInfoReturnable<Text> cir) {
|
||||||
if (ConfigManager.getConfig().dimensionIndicatorEnabled) {
|
if (ConfigManager.getConfig().dimensionIndicatorEnabled) {
|
||||||
|
@ -12,6 +12,9 @@ import wtf.hak.survivalfabric.utils.PacketUtils;
|
|||||||
@Mixin(ServerWorld.class)
|
@Mixin(ServerWorld.class)
|
||||||
public class ServerWorldMixin {
|
public class ServerWorldMixin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update List Names if needed
|
||||||
|
*/
|
||||||
@Inject(method = "onDimensionChanged", at = {@At("HEAD")})
|
@Inject(method = "onDimensionChanged", at = {@At("HEAD")})
|
||||||
public void onDimensionChange(Entity entity, CallbackInfo ci) {
|
public void onDimensionChange(Entity entity, CallbackInfo ci) {
|
||||||
if (entity instanceof ServerPlayerEntity) {
|
if (entity instanceof ServerPlayerEntity) {
|
||||||
|
Reference in New Issue
Block a user