removed yawp
This commit is contained in:
parent
2762f6e29f
commit
e08dc0ef17
@ -4,8 +4,8 @@ org.gradle.parallel=true
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.20.2
|
||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.20.2+build.2
|
||||||
loader_version=0.14.22
|
loader_version=0.14.22
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
@ -14,4 +14,4 @@ maven_group=com.xeovalyte.polarcraft
|
|||||||
archives_base_name=polarcraft-mod
|
archives_base_name=polarcraft-mod
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.86.1+1.20.1
|
fabric_version=0.89.3+1.20.2
|
||||||
|
@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@ -18,6 +19,9 @@ import java.io.File;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
import static spark.Spark.*;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||||
|
|
||||||
public class PolarcraftMod implements ModInitializer {
|
public class PolarcraftMod implements ModInitializer {
|
||||||
@ -29,10 +33,11 @@ public class PolarcraftMod implements ModInitializer {
|
|||||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||||
private static final File CONFIG_FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "polarcraft.json");
|
private static final File CONFIG_FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "polarcraft.json");
|
||||||
|
|
||||||
public static String configChatMessageUrl = "https://example.com/api/minecraft/message/chattodiscord";
|
public static String configChatMessageUrl = "https://example.com/message/player";
|
||||||
public static String configGameMessageUrl = "https://example.com/api/minecraft/message/gametodiscord";
|
public static String configGameMessageUrl = "https://example.com/message/game";
|
||||||
public static String configVerifyUrl = "https://example.com/verifyminecraft";
|
public static String configVerifyUrl = "https://example.com/verifyminecraft";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||||
@ -54,6 +59,28 @@ public class PolarcraftMod implements ModInitializer {
|
|||||||
ServerMessageEvents.CHAT_MESSAGE.register((message, sender, params) -> {
|
ServerMessageEvents.CHAT_MESSAGE.register((message, sender, params) -> {
|
||||||
messageFunctions.sendChatMessage(message, sender);
|
messageFunctions.sendChatMessage(message, sender);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> {
|
||||||
|
port(8080); // Choose a suitable port for your web server
|
||||||
|
|
||||||
|
// Define the /console POST endpoint
|
||||||
|
post("/console", (req, res) -> {
|
||||||
|
String command = req.body(); // Get the command from the request body
|
||||||
|
// Validate and sanitize the command if needed
|
||||||
|
|
||||||
|
// Execute the console command in the Minecraft environment
|
||||||
|
executeConsoleCommand(command, server);
|
||||||
|
|
||||||
|
res.status(200);
|
||||||
|
return "Command executed successfully.";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void executeConsoleCommand(String command, MinecraftServer server) {
|
||||||
|
// Code to execute the console command within the Minecraft environment.
|
||||||
|
|
||||||
|
server.getCommandManager().executeWithPrefix(server.getCommandSource(), command);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfig() {
|
private void loadConfig() {
|
||||||
|
@ -54,7 +54,7 @@ public class verifyFunction {
|
|||||||
if (!whitelisted) {
|
if (!whitelisted) {
|
||||||
int code = jsonResponse.get("code").getAsInt();
|
int code = jsonResponse.get("code").getAsInt();
|
||||||
|
|
||||||
player.networkHandler.disconnect(Text.literal("Whitelist yourself by using this code: " + code));
|
player.networkHandler.disconnect(Text.literal("Whitelist yourself by using the /whitelist command in Discord with this code: " + code));
|
||||||
} else {
|
} else {
|
||||||
server.getCommandManager().executeWithPrefix(server.getCommandSource(), "/lp user " + player.getUuid() + " meta set display " + "\"" + jsonResponse.get("username").getAsString() + "\"");
|
server.getCommandManager().executeWithPrefix(server.getCommandSource(), "/lp user " + player.getUuid() + " meta set display " + "\"" + jsonResponse.get("username").getAsString() + "\"");
|
||||||
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package com.xeovalyte.polarcraft.mixin;
|
|
||||||
|
|
||||||
import com.xeovalyte.polarcraft.util.messageFunctions;
|
|
||||||
import net.minecraft.advancement.Advancement;
|
|
||||||
import net.minecraft.advancement.PlayerAdvancementTracker;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
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.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Mixin(PlayerAdvancementTracker.class)
|
|
||||||
public class MixinPlayerAdvancementTracker {
|
|
||||||
@Shadow
|
|
||||||
private ServerPlayerEntity owner;
|
|
||||||
|
|
||||||
@Inject(method = "grantCriterion",
|
|
||||||
at = @At(
|
|
||||||
target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V",
|
|
||||||
value = "INVOKE"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private void grantCriterion(Advancement advancement, String criterionName, CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
// messageFunctions.sendGameMessage(owner.getUuid(), " has completed the challenge [" + Objects.requireNonNull(advancement.getDisplay()).getTitle().getString() + "]");
|
|
||||||
messageFunctions.sendGameMessage(owner.getUuid(), owner.getDisplayName().getString() + " has completed the advancement [" + Objects.requireNonNull(advancement.getDisplay()).getTitle().getString() + "]");
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,20 +8,15 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
||||||
|
|
||||||
@Mixin(ServerPlayerEntity.class)
|
@Mixin(ServerPlayerEntity.class)
|
||||||
public class MixinPlayerEntity {
|
public class MixinPlayerEntity {
|
||||||
@Inject(method = "onDeath",
|
@Inject(method = "onDeath", at = @At("HEAD"))
|
||||||
at = @At(
|
private void onDeath(DamageSource damageSource, CallbackInfo ci){
|
||||||
target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;)V",
|
|
||||||
value = "INVOKE",
|
|
||||||
ordinal = 0),
|
|
||||||
locals = LocalCapture.CAPTURE_FAILSOFT
|
|
||||||
)
|
|
||||||
private void onDeath(DamageSource damageSource, CallbackInfo ci, boolean bl, Text text){
|
|
||||||
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) (Object) this;
|
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) (Object) this;
|
||||||
|
|
||||||
messageFunctions.sendGameMessage(serverPlayerEntity.getUuid(), text.getString());
|
Text deathMessage = damageSource.getDeathMessage(serverPlayerEntity);
|
||||||
|
|
||||||
|
messageFunctions.sendGameMessage(serverPlayerEntity.getUuid(), deathMessage.getString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"package": "com.xeovalyte.polarcraft.mixin",
|
"package": "com.xeovalyte.polarcraft.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinPlayerAdvancementTracker",
|
|
||||||
"MixinPlayerEntity"
|
"MixinPlayerEntity"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
name = "Yet Another World Protector"
|
|
||||||
filename = "yawp-1.20-0.0.2.9-beta2-fabric.jar"
|
|
||||||
side = "both"
|
|
||||||
|
|
||||||
[download]
|
|
||||||
url = "https://cdn.modrinth.com/data/py6EMmAJ/versions/dSAE9S9d/yawp-1.20-0.0.2.9-beta2-fabric.jar"
|
|
||||||
hash-format = "sha1"
|
|
||||||
hash = "9cb703fb762460e6fbeaccbaa4dd2973abb5064a"
|
|
||||||
|
|
||||||
[update]
|
|
||||||
[update.modrinth]
|
|
||||||
mod-id = "py6EMmAJ"
|
|
||||||
version = "dSAE9S9d"
|
|
Loading…
Reference in New Issue
Block a user