Skip to content

Instantly share code, notes, and snippets.

View SNWCreations's full-sized avatar
🤔
Working

ZX夏夜之风 SNWCreations

🤔
Working
View GitHub Profile
@SNWCreations
SNWCreations / FindActualPawn.cs
Last active May 18, 2025 09:47
A piece of C# code which could find the player pawn which is actually controlled by the given player. This will consider bots which are controlled by players. Using CounterStrikeSharp API.
// Author: SNWCreations (GitHub: @SNWCreations)
// Licensed under CC0 License, feel free to use this anywhere.
/**
* Find the player pawn which is actually controlled by the given player.
* This will consider bots which are controlled by players.
*/
public static CCSPlayerPawn? FindActualPawn(CCSPlayerController player)
{
// Better solution after some research:
@SNWCreations
SNWCreations / dependency_getter.groovy
Created October 6, 2024 07:21
Get files of all dependencies in your Java project which is using Gradle
// The code below is tested with Gradle 8.5, it works well in my project.
// This Gist is licensed under MIT license. Feel free to copy it and use them.
static Collection<File> getAllDependencyFiles(Project project) {
var container = project.configurations
List<Configuration> toScan = [
container.compileClasspath,
container.runtimeClasspath
]
Set<File> result = new HashSet<>()
import com.google.common.hash.Hashing
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
// All codes are hand-written and translated from Python code at
// https://github.com/chris3torek/scripts/blob/master/githash.py
@SNWCreations
SNWCreations / PaperOnHighJava.md
Last active May 3, 2022 05:44
A method to let Paper run on higher Java versions!

Writing time of this article: 2022/5/3

Recently I was trying to access CommandAPI (see JorelAli/CommandAPI repository) for my plugin (see SNWCreations/RunForMoney repository).

But I'm having issues trying to get Paper 1.16.5 to run on Java 17.

Paper refuses to start with: "Unsupported Java detected (61.0). Only up to Java 16 is supported."

I'm worried, but I think that the Java version detection takes precedence over the server startup, so if I look at the org.bukkit.craftbukkit.Main.main method, will there be a way?