Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into fix_commandPingConfliction
Browse files Browse the repository at this point in the history
  • Loading branch information
wendavid552 committed Jul 31, 2024
2 parents 41aa7d7 + 63376f8 commit a876590
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* This file is part of the Carpet AMS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 A Minecraft Server and contributors
*
* Carpet AMS Addition 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.
*
* Carpet AMS Addition 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 Carpet AMS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package club.mcams.carpet.mixin.carpet;

import club.mcams.carpet.utils.compat.DummyClass;

import org.spongepowered.asm.mixin.Mixin;

import top.byteeeee.annotationtoolbox.annotation.GameVersion;

@GameVersion(version = "Minecraft >= 1.19.4", desc = "Just a fix for https://github.com/gnembon/fabric-carpet/issues/1908")
@Mixin(DummyClass.class)
public class CarpetServerMixin {}
1 change: 1 addition & 0 deletions src/main/resources/amscarpet.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "club.mcams.carpet.mixin",
"compatibilityLevel": "/*JAVA_VERSION*/",
"mixins": [
"carpet.CarpetServerMixin",
"carpet.HUDControllerMixin",
"carpet.SettingsManagerMixin",
"rule.amsUpdateSuppressionCrashFix.ChainRestrictedNeighborUpdater_SixWayEntryMixin",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file is part of the Carpet AMS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 A Minecraft Server and contributors
*
* Carpet AMS Addition 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.
*
* Carpet AMS Addition 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 Carpet AMS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package club.mcams.carpet.mixin.carpet;

import carpet.CarpetServer;

import net.minecraft.server.MinecraftServer;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import top.byteeeee.annotationtoolbox.annotation.GameVersion;

@GameVersion(version = "Minecraft >= 1.19.4", desc = "Just a fix for https://github.com/gnembon/fabric-carpet/issues/1908")
@Mixin(value = CarpetServer.class, remap = false)
public abstract class CarpetServerMixin {
@Inject(method = "onServerClosed(Lnet/minecraft/server/MinecraftServer;)V", at = @At("HEAD"), cancellable = true)
private static void onlyCallIfServerNotnull(MinecraftServer server, CallbackInfo ci) {
if (server == null) {
ci.cancel();
}
}
}

0 comments on commit a876590

Please sign in to comment.