forked from lucko/spark
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from onebeastchris/feature/geyser
Pull upstream, fix Geyser extension
- Loading branch information
Showing
30 changed files
with
1,461 additions
and
28 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
Binary file not shown.
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
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
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
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,64 @@ | ||
plugins { | ||
id 'com.github.johnrengelman.shadow' version '8.1.1' | ||
id 'net.neoforged.gradle.userdev' version '7.0.97' | ||
} | ||
|
||
java.toolchain.languageVersion = JavaLanguageVersion.of(17) | ||
|
||
tasks.withType(JavaCompile) { | ||
// override, compile targeting J17 | ||
options.release = 17 | ||
} | ||
|
||
minecraft { | ||
accessTransformers { | ||
file('src/main/resources/META-INF/accesstransformer.cfg') | ||
} | ||
} | ||
|
||
configurations { | ||
shade | ||
implementation.extendsFrom shade | ||
} | ||
|
||
dependencies { | ||
implementation "net.neoforged:neoforge:20.4.223" | ||
shade project(':spark-common') | ||
} | ||
|
||
processResources { | ||
from(sourceSets.main.resources.srcDirs) { | ||
include 'META-INF/mods.toml' | ||
expand ( | ||
'pluginVersion': project.pluginVersion, | ||
'pluginDescription': project.pluginDescription | ||
) | ||
} | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
exclude 'META-INF/mods.toml' | ||
} | ||
} | ||
|
||
shadowJar { | ||
archiveFileName = "spark-${project.pluginVersion}-neoforge.jar" | ||
configurations = [project.configurations.shade] | ||
|
||
relocate 'net.kyori.adventure', 'me.lucko.spark.lib.adventure' | ||
relocate 'net.kyori.examination', 'me.lucko.spark.lib.adventure.examination' | ||
relocate 'net.bytebuddy', 'me.lucko.spark.lib.bytebuddy' | ||
relocate 'com.google.protobuf', 'me.lucko.spark.lib.protobuf' | ||
relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' | ||
relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' | ||
relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' | ||
relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' | ||
|
||
exclude 'module-info.class' | ||
exclude 'META-INF/maven/**' | ||
exclude 'META-INF/proguard/**' | ||
} | ||
|
||
artifacts { | ||
archives shadowJar | ||
shadow shadowJar | ||
} |
36 changes: 36 additions & 0 deletions
36
spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeClassSourceLookup.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,36 @@ | ||
/* | ||
* This file is part of spark. | ||
* | ||
* Copyright (c) lucko (Luck) <[email protected]> | ||
* Copyright (c) contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.lucko.spark.neoforge; | ||
|
||
import cpw.mods.modlauncher.TransformingClassLoader; | ||
import me.lucko.spark.common.sampler.source.ClassSourceLookup; | ||
|
||
public class NeoForgeClassSourceLookup implements ClassSourceLookup { | ||
|
||
@Override | ||
public String identify(Class<?> clazz) { | ||
if (clazz.getClassLoader() instanceof TransformingClassLoader) { | ||
String name = clazz.getModule().getName(); | ||
return name.equals("forge") || name.equals("minecraft") ? null : name; | ||
} | ||
return null; | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeCommandSender.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,77 @@ | ||
/* | ||
* This file is part of spark. | ||
* | ||
* Copyright (c) lucko (Luck) <[email protected]> | ||
* Copyright (c) contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.lucko.spark.neoforge; | ||
|
||
import me.lucko.spark.common.command.sender.AbstractCommandSender; | ||
import me.lucko.spark.neoforge.plugin.NeoForgeSparkPlugin; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; | ||
import net.minecraft.commands.CommandSource; | ||
import net.minecraft.network.chat.Component.Serializer; | ||
import net.minecraft.network.chat.MutableComponent; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.server.rcon.RconConsoleSource; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
public class NeoForgeCommandSender extends AbstractCommandSender<CommandSource> { | ||
private final NeoForgeSparkPlugin plugin; | ||
|
||
public NeoForgeCommandSender(CommandSource source, NeoForgeSparkPlugin plugin) { | ||
super(source); | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
if (super.delegate instanceof Player) { | ||
return ((Player) super.delegate).getGameProfile().getName(); | ||
} else if (super.delegate instanceof MinecraftServer) { | ||
return "Console"; | ||
} else if (super.delegate instanceof RconConsoleSource) { | ||
return "RCON Console"; | ||
} else { | ||
return "unknown:" + super.delegate.getClass().getSimpleName(); | ||
} | ||
} | ||
|
||
@Override | ||
public UUID getUniqueId() { | ||
if (super.delegate instanceof Player) { | ||
return ((Player) super.delegate).getUUID(); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public void sendMessage(Component message) { | ||
MutableComponent component = Serializer.fromJson(GsonComponentSerializer.gson().serializeToTree(message)); | ||
Objects.requireNonNull(component, "component"); | ||
super.delegate.sendSystemMessage(component); | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(String permission) { | ||
return this.plugin.hasPermission(super.delegate, permission); | ||
} | ||
} |
Oops, something went wrong.