Skip to content

Instantly share code, notes, and snippets.

View kennytv's full-sized avatar
☃️

Nassim Jahnke kennytv

☃️
View GitHub Profile
import java.nio.file.Path;
import java.nio.file.Paths;
public final class ProjectsPath {
public static final Path HOME = Paths.get(System.getProperty("user.home"));
public static final Path PROJECTS = HOME.resolve("IdeaProjects");
public static Path resolve(final String path) {
final int firstSeparator = path.indexOf('/');
@kennytv
kennytv / build.gradle.kts
Last active May 31, 2024 16:48
OpenRewrite recipes for ViaVersion 5.0.0
// Use the rewriteRun Gradle task to apply them all
// Check https://docs.openrewrite.org/reference/rewrite-maven-plugin for the maven equivalent
plugins {
id("org.openrewrite.rewrite") version "6.15.1"
}
// Most of these are related to internal classes, but there's no harm in running all of them
rewrite {
activeRecipe(
"com.viaversion.viabackwards.PrepareProtocolRenames", // To prevent clashes of VV and VB class names
@kennytv
kennytv / HangarVersionUploader.java
Last active August 25, 2023 09:07
Hangar version uploader example
package eu.kennytv.test.hangar;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import eu.kennytv.test.hangar.VersionUpload.MultipartFileOrUrl;
import eu.kennytv.test.hangar.VersionUpload.Platform;
import eu.kennytv.test.hangar.VersionUpload.PluginDependency;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
@kennytv
kennytv / readme.md
Last active September 7, 2024 18:09
Signed Chat and Chat Types

Signed chat

This gist intends on clearing up some of the misinformation surrounding signed chat/the reporting feature Mojang has added to Minecraft 1.19.1. Here you can find both technical information as well as a general explanation of how these work.

Profile keys

After joining a server, clients now send a profile key used for verifying a message's authenticity. This key and thus the whole signing process is optional, but by default, servers enforce secure profiles for clients to send chat messages. Whenever the player sends a chat message and has a key associated, the message will be signed using their own private key, which the server then verifies using the public key sent after join. Assuming signature, timestamp, and message contents line up, the message goes through.

On the other end, clients can also require all broadcasted player messages to be signed, disregarding the ones without sender verified signatures.

Message signatures

@kennytv
kennytv / ViaVersion-4.0.0-update-notes.md
Last active June 8, 2021 21:28
ViaVersion 4.0.0 update notes

In order to prepare for the next major ViaVersion update, you have to do the following things:

Update the dependency by changing

  • the group id to com.viaversion,
  • the version to 4.0.0,
  • the artifact id, depending on your needs, either to viaversion-api or viaversion.

Instead of reimporting or renaming each and every class used, it's easiest to just take a few minutes to do project wide replacements (e.g. Ctrl+Shift+R in IntelliJ).

Replace the base package:

@kennytv
kennytv / BBCodeConverter.java
Last active December 19, 2023 06:10
Simple BBCode -> Markdown converter written in Java
package eu.kennytv;
import java.util.HashMap;
import java.util.Map;
/**
* @author KennyTV on 07.10.2020
*/
public class BBCodeConverter {
@kennytv
kennytv / MatrixUtil.java
Created May 2, 2020 09:08
Java matrix multiplication and rotation util
package net.luminu.core.api.shared.util;
import com.google.common.base.Preconditions;
/**
* Methods for multiplying matrices and simple rotation methods.
* See https://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions for details on rotation.
*
* @author KennyTV
*/
@kennytv
kennytv / MappingsGenerator.java
Last active November 18, 2021 21:10
Via Mapping Utilities
import com.google.gson.*;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.util.Map;
public final class MappingsGenerator {
#!/bin/bash
VERSION="3.0.5" #Version of the Maintenance Build
URL="https://github.com/KennyTV/Maintenance/raw/master/MaintenanceAPI.jar"
FILENAME="MaintenanceAPI.jar"
confirm=true
if [ "$1" == "skip-input" ]; then
confirm=false
@kennytv
kennytv / config.yml
Last active April 11, 2022 07:46
Maintenance config files
###################################################################################################################
# __ __ _ _ _ _ _ #
# | \/ | __ _(_)_ __ | |_ ___ _ __ __ _ _ __ ___ ___ | |__ _ _ | | _____ _ __ _ __ _ _| |___ __ #
# | |\/| |/ _` | | '_ \| __/ _ \ '_ \ / _` | '_ \ / __/ _ \ | '_ \| | | | | |/ / _ \ '_ \| '_ \| | | | __\ \ / / #
# | | | | (_| | | | | | || __/ | | | (_| | | | | (_| __/ | |_) | |_| | | < __/ | | | | | | |_| | |_ \ V / #
# |_| |_|\__,_|_|_| |_|\__\___|_| |_|\__,_|_| |_|\___\___| |_.__/ \__, | |_|\_\___|_| |_|_| |_|\__, |\__| \_/ #
# |___/ |___/ #
###################################################################################################################
# You can report bugs here: https://github.com/kennytv/Maintenance/issues
# If you need any othe