Skip to content

Instantly share code, notes, and snippets.

View HSGamer's full-sized avatar
🙂
Just smile

Huynh Tien HSGamer

🙂
Just smile
View GitHub Profile
@HSGamer
HSGamer / update_pom_names.py
Created June 16, 2025 02:14
Python script to automatically set project name based on artifact id
import os
import xml.etree.ElementTree as ET
# Define the root directory to search for pom.xml files
root_dir = "/home/hsgamer/IdeaProjects/Topper"
# Function to convert kebab-case to Pascal Case with spaces
def kebab_to_pascal_with_spaces(s):
return ' '.join(word.capitalize() for word in s.split('-'))
@HSGamer
HSGamer / RemappedBukkitLibraryManager.java
Created May 3, 2025 00:16
Load and remap libraries at runtime with libby and PaperMC's PluginRemapper
import net.byteflux.libby.BukkitLibraryManager;
import net.byteflux.libby.Library;
import org.bukkit.plugin.Plugin;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Path;
@HSGamer
HSGamer / update_maven_versions.sh
Created February 5, 2025 09:29
The Bash script to update versions of all modules in a multi-module Maven projects
#!/bin/bash
MODULE_DIRS=()
# Function to recursively find valid pom.xml files
find_modules() {
local dir="$1"
POM_FILE="$dir/pom.xml"
if [[ -f "$POM_FILE" && $(grep -q '<packaging>pom</packaging>' "$POM_FILE")$? -eq 0 ]]; then
MODULE_DIRS+=("$dir")
@HSGamer
HSGamer / ClasspathDependency.pom.xml
Created June 4, 2024 19:20
Dependency Folder and Lib Classpath with Maven
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
@HSGamer
HSGamer / FilterCronUtils.pom.xml
Created May 30, 2024 18:36
Maven Shade Filter to only keep necessary files in cron-utils
<filters>
<filter>
<artifact>com.cronutils:cron-utils</artifact>
<excludes>
<exclude>com/cronutils/descriptor/**</exclude>
<exclude>com/cronutils/validation/**</exclude>
<exclude>com/cronutils/converter/**</exclude>
<exclude>com/cronutils/CronUtilsI18N**</exclude>
</excludes>
</filter>
@HSGamer
HSGamer / DisablePaperMCRemapper.pom.xml
Last active May 30, 2024 18:34
Maven Shade Transformer to Disable PaperMC's PluginRemapper
<!-- Disable PaperMC's PluginRemapper -->
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</transformer>
</transformers>
@HSGamer
HSGamer / PerInstanceInstanceViewHook.java
Last active August 20, 2024 20:23
Minestom - Per-Instance Tablist
import net.minestom.server.MinecraftServer;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.PlayerSkin;
import net.minestom.server.event.Event;
import net.minestom.server.event.EventNode;
import net.minestom.server.event.instance.RemoveEntityFromInstanceEvent;
import net.minestom.server.event.player.PlayerSpawnEvent;
import net.minestom.server.instance.Instance;
import net.minestom.server.network.packet.server.play.PlayerInfoPacket;
import net.minestom.server.tag.Tag;