-
Notifications
You must be signed in to change notification settings - Fork 2
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
104270f
commit 9f81882
Showing
69 changed files
with
2,000 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import net.fabricmc.loom.task.RemapJarTask | ||
|
||
plugins { | ||
id('com.github.johnrengelman.shadow') version('8.1.1') | ||
id('fabric-loom') version('1.3-SNAPSHOT') | ||
} | ||
|
||
dependencies { | ||
implementation(project(path: ':common', configuration: 'shadow')) | ||
|
||
// Minecraft and Fabric mappings | ||
minecraft("com.mojang:minecraft:${project.minecraft_version}") | ||
mappings("net.fabricmc:yarn:${project.yarn_mappings}") | ||
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}") | ||
|
||
// Fabric API | ||
Set<String> apiModules = [ | ||
'fabric-api-base', | ||
'fabric-command-api-v1', | ||
'fabric-lifecycle-events-v1' | ||
] | ||
|
||
apiModules.forEach { | ||
modImplementation(fabricApi.module(it, project.fabric_version)) | ||
} | ||
|
||
// TaterLib | ||
modImplementation("dev.neuralnexus:TaterLib:${minecraft_version}-${taterlib_version}") | ||
} | ||
|
||
processResources { | ||
inputs.property("version", project.version) | ||
inputs.property("minecraft_version", project.minecraft_version) | ||
inputs.property("loader_version", project.loader_version) | ||
filteringCharset("UTF-8") | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand("version": project.version, | ||
"minecraft_version": project.minecraft_version, | ||
"loader_version": project.loader_version) | ||
} | ||
} | ||
|
||
shadowJar { | ||
dependencies { | ||
exclude('net.fabricmc:.*') | ||
include(project(":common")) | ||
exclude('/mappings/*') | ||
} | ||
|
||
archiveFileName = "${project_name}-fabric-${minecraft_version}-${version}-dev.jar" | ||
} | ||
|
||
task remappedShadowJar(type: RemapJarTask) { | ||
dependsOn(tasks.shadowJar) | ||
input.set(tasks.shadowJar.archiveFile) | ||
addNestedDependencies.set(true) | ||
|
||
destinationDirectory = file('../target') | ||
archiveFileName = "${project_name}-fabric-${minecraft_version}-${version}.jar" | ||
} | ||
remappedShadowJar.doLast { | ||
task -> | ||
ant.checksum(file: task.archivePath) { | ||
hashAlgorithm = 'md5' | ||
property = 'md5sum' | ||
} | ||
} | ||
|
||
tasks.assemble.dependsOn(tasks.remappedShadowJar) | ||
|
||
artifacts { | ||
archives(remappedShadowJar) | ||
archives(shadowJar) | ||
} |
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,5 @@ | ||
# https://fabricmc.net/develop/ | ||
minecraft_version=1.14 | ||
yarn_mappings=1.14+build.21 | ||
loader_version=0.14.21 | ||
fabric_version=0.28.5+1.14 |
42 changes: 42 additions & 0 deletions
42
fabric-1.14/src/main/java/dev/neuralnexus/tatercomms/fabric/FabricTaterCommsPlugin.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,42 @@ | ||
package dev.neuralnexus.tatercomms.fabric; | ||
|
||
import dev.neuralnexus.tatercomms.common.TaterCommsPlugin; | ||
import dev.neuralnexus.tatercomms.fabric.commands.FabricDiscordCommand; | ||
import dev.neuralnexus.taterlib.common.abstractions.logger.AbstractLogger; | ||
import dev.neuralnexus.taterlib.fabric.TemplateFabricPlugin; | ||
import dev.neuralnexus.taterlib.fabric.abstractions.logger.FabricLogger; | ||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; | ||
import org.apache.logging.log4j.LogManager; | ||
|
||
/** | ||
* The TaterComms Fabric plugin. | ||
*/ | ||
public class FabricTaterCommsPlugin extends TemplateFabricPlugin implements TaterCommsPlugin { | ||
private static final String MOD_ID = "tatercomms"; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
@Override | ||
public AbstractLogger pluginLogger() { | ||
return new FabricLogger("[TaterComms] ", LogManager.getLogger(MOD_ID)); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
@Override | ||
public void registerCommands() { | ||
CommandRegistrationCallback.EVENT.register(FabricDiscordCommand::register); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
@Override | ||
public void onInitializeServer() { | ||
pluginStart(); | ||
ServerLifecycleEvents.SERVER_STOPPED.register(server -> pluginStop()); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...c-1.14/src/main/java/dev/neuralnexus/tatercomms/fabric/commands/FabricDiscordCommand.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,55 @@ | ||
package dev.neuralnexus.tatercomms.fabric.commands; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.arguments.StringArgumentType; | ||
import dev.neuralnexus.tatercomms.common.commands.DiscordCommand; | ||
import dev.neuralnexus.taterlib.common.commands.TaterLibCommand; | ||
import dev.neuralnexus.taterlib.common.hooks.LuckPermsHook; | ||
import dev.neuralnexus.taterlib.fabric.abstractions.player.FabricPlayer; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
|
||
import static net.minecraft.server.command.CommandManager.argument; | ||
import static net.minecraft.server.command.CommandManager.literal; | ||
|
||
/** | ||
* The Fabric implementation of the Discord command. | ||
*/ | ||
public class FabricDiscordCommand { | ||
/** | ||
* Registers the command. | ||
* @param dispatcher The command dispatcher. | ||
* @param dedicated Whether the server is dedicated or not. | ||
*/ | ||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, boolean dedicated) { | ||
int permissionLevel; | ||
if (dedicated) { | ||
// Check if LuckPerms is hooked | ||
permissionLevel = LuckPermsHook.isHooked() ? 0 : 4; | ||
} else { | ||
permissionLevel = 0; | ||
} | ||
|
||
dispatcher.register(literal(TaterLibCommand.getCommandName()) | ||
.requires(source -> source.hasPermissionLevel(permissionLevel)) | ||
.then(argument("command", StringArgumentType.greedyString()) | ||
.executes(context -> { | ||
try { | ||
String[] args = context.getArgument("command", String.class).split(" "); | ||
|
||
// Check if sender is a player | ||
boolean isPlayer = context.getSource().getEntity() instanceof ServerPlayerEntity; | ||
FabricPlayer player = isPlayer ? new FabricPlayer((ServerPlayerEntity) context.getSource().getEntity()) : null; | ||
|
||
// Execute command | ||
DiscordCommand.executeCommand(player, isPlayer, args); | ||
} catch (Exception e) { | ||
System.err.println(e); | ||
e.printStackTrace(); | ||
return 0; | ||
} | ||
return 1; | ||
}) | ||
)); | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,41 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "tatercomms", | ||
"version": "${version}", | ||
"name": "TaterComms", | ||
"description": "A simple, cross API plugin that bridges communication between servers, using built-in Proxy methods, Discord channels and websockets.", | ||
"authors": [ | ||
{ | ||
"name": "p0t4t0sandwich", | ||
"contact": { | ||
"sources": "https://github.com/p0t4t0sandwich/", | ||
"homepage": "https://links.sperrer.ca/" | ||
} | ||
} | ||
], | ||
"contact": { | ||
"repo": "https://github.com/p0t4t0sandwich/TaterComms" | ||
}, | ||
"license": "GPL-3", | ||
"icon": "assets/TaterComms/icon.png", | ||
"environment": "*", | ||
"entrypoints": { | ||
"server": [ | ||
"dev.neuralnexus.tatercomms.fabric.FabricTaterCommsPlugin" | ||
] | ||
}, | ||
"mixins": [ | ||
"tatercomms.mixins.json" | ||
], | ||
"depends": { | ||
"fabricloader": ">=0.9.0", | ||
"minecraft": ">=${minecraft_version}", | ||
"fabric-api-base": "*", | ||
"fabric-command-api-v1": "*", | ||
"fabric-lifecycle-events-v1": "*", | ||
"taterlib": "*" | ||
}, | ||
"suggests": { | ||
"luckperms": "*" | ||
} | ||
} |
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,15 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "dev.neuralnexus.tatercomms.fabric.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
], | ||
"client": [ | ||
], | ||
"server": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
Oops, something went wrong.