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 / pom.xml
Created November 22, 2025 18:01
Filter for Maven Shade Plugin to remove unused 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 / add_name_to_pom.py
Created October 11, 2025 10:39
AI-generated script to add <name> to pom.xml based on its <artifactId>
#!/usr/bin/env python3
"""
Script to add <name> element in POM.xml based on artifactId.
Replaces a prefix in the artifactId with a new value and formats it as a proper name.
Automatically finds all pom.xml files in current directory and subdirectories.
Preserves XML formatting and indentation.
Only affects the root artifactId, not those in parent, dependencies, etc.
Skips files that already have a <name> tag.
"""
@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
Last active November 5, 2025 16:36
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"; 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;