-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ad68c2
commit a31b3a4
Showing
10 changed files
with
315 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/club/mcams/carpet/mixin/rule/opPlayerNoCheatExtra/DifficultyCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* This file is part of the Carpet TIS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2023 Fallen_Breath and contributors | ||
* | ||
* Carpet TIS 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 TIS 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 TIS Addition. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package club.mcams.carpet.mixin.rule.opPlayerNoCheatExtra; | ||
|
||
import club.mcams.carpet.AmsServerSettings; | ||
import club.mcams.carpet.util.Messenger; | ||
import static club.mcams.carpet.AmsServer.fancyName; | ||
|
||
import net.minecraft.server.command.DifficultyCommand; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.world.Difficulty; | ||
import net.minecraft.text.*; | ||
|
||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(DifficultyCommand.class) | ||
public abstract class DifficultyCommandMixin { | ||
@Inject(method = "execute", at = @At("HEAD")) | ||
private static void execute(ServerCommandSource source, Difficulty difficulty, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/club/mcams/carpet/mixin/rule/opPlayerNoCheatExtra/KillCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* This file is part of the Carpet AMS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2023 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.rule.opPlayerNoCheatExtra; | ||
|
||
import club.mcams.carpet.AmsServerSettings; | ||
import club.mcams.carpet.util.Messenger; | ||
import static club.mcams.carpet.AmsServer.fancyName; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.server.command.KillCommand; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.text.*; | ||
|
||
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.CallbackInfoReturnable; | ||
|
||
import java.util.Collection; | ||
|
||
@Mixin(KillCommand.class) | ||
public abstract class KillCommandMixin { | ||
@Inject(method = "execute", at = @At("HEAD")) | ||
private static void execute(ServerCommandSource source, Collection<? extends Entity> targets, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/club/mcams/carpet/mixin/rule/opPlayerNoCheatExtra/TimeCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* This file is part of the Carpet AMS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2023 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.rule.opPlayerNoCheatExtra; | ||
|
||
import club.mcams.carpet.AmsServerSettings; | ||
import club.mcams.carpet.util.Messenger; | ||
import static club.mcams.carpet.AmsServer.fancyName; | ||
|
||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.server.command.TimeCommand; | ||
import net.minecraft.text.*; | ||
|
||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(TimeCommand.class) | ||
public abstract class TimeCommandMixin { | ||
@Inject(method = "executeAdd", at = @At("HEAD")) | ||
private static void executeAdd(ServerCommandSource source, int time, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
|
||
@Inject(method = "executeSet", at = @At("HEAD")) | ||
private static void executeSet(ServerCommandSource source, int time, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
|
||
@Inject(method = "executeQuery", at = @At("HEAD")) | ||
private static void executeQuery(ServerCommandSource source, int time, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/club/mcams/carpet/mixin/rule/opPlayerNoCheatExtra/WeatherCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* This file is part of the Carpet AMS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2023 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.rule.opPlayerNoCheatExtra; | ||
|
||
import club.mcams.carpet.AmsServerSettings; | ||
import club.mcams.carpet.util.Messenger; | ||
import static club.mcams.carpet.AmsServer.fancyName; | ||
|
||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.server.command.WeatherCommand; | ||
import net.minecraft.text.*; | ||
|
||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(WeatherCommand.class) | ||
public abstract class WeatherCommandMixin { | ||
@Inject(method = "executeClear", at = @At("HEAD")) | ||
private static void executeClear(ServerCommandSource source, int duration, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
|
||
@Inject(method = "executeRain", at = @At("HEAD")) | ||
private static void executeRain(ServerCommandSource source, int duration, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
|
||
@Inject(method = "executeThunder", at = @At("HEAD")) | ||
private static void executeThunder(ServerCommandSource source, int duration, CallbackInfoReturnable<Integer> cir) { | ||
if(AmsServerSettings.opPlayerNoCheatExtra) { | ||
//#if MC>11800 | ||
//$$ Messenger.tell(source, Text.literal("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#else | ||
Messenger.tell(source, (BaseText) new LiteralText("<" + fancyName + "> "+ "Disabled by opPlayerNoCheatExtra") | ||
//#endif | ||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0xFF0000))), true); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters