Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ dependencies {
proxyPlugin(project(path = ":plugins:civproxy-velocity", configuration = "shadow"))
proxyPlugin(project(path = ":plugins:announcements-velocity", configuration = "shadow"))
proxyPlugin(project(path = ":plugins:kiragateway-velocity", configuration = "shadow"))
proxyPlugin(project(path = ":plugins:banstick-velocity", configuration = "shadow"))
}

val copyPaperPlugins = tasks.register<Copy>("copyPaperPlugins") {
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ services:
CIV_GAMMA_HOSTNAME: 'mini.localhost'
CIV_HOSTNAME: 'main.localhost'

JVM_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5008
CIV_FORWARDING_SECRET: '1234'

CIV_MYSQL_HOST: mariadb
CIV_MYSQL_USERNAME: mariadb
CIV_MYSQL_PASSWORD: mariadb
ports:
- "25565:25577"
- "5008:5008"
volumes:
- ./containers/data/proxy:/server
- ./ansible/files/proxy-config:/config
Expand Down
9 changes: 8 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ junit = "5.8.2"
nuotifier = "2.7.2"
velocity = "3.4.0-SNAPSHOT"
configurate = "4.2.0"
adventure = "4.25.0"

[plugins]
paper-userdev = { id = "io.papermc.paperweight.userdev", version = "2.0.0-beta.17" }
Expand All @@ -17,7 +18,7 @@ velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.r
aikar-acf = { group = "co.aikar", name = "acf-paper", version = "0.5.1-SNAPSHOT" }
aikar-taskchain = { group = "co.aikar", name = "taskchain-bukkit", version = "3.7.2" }

commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version = "3.12.0" }
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version = "3.19.0" }
commons-collections4 = { group = "org.apache.commons", name = "commons-collections4", version = "4.4" }
commons-math3 = { group = "org.apache.commons", name = "commons-math3", version = "3.6.1" }

Expand Down Expand Up @@ -46,7 +47,13 @@ jsoup = { group = "org.jsoup", name = "jsoup", version = "1.18.3" }
junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" }
junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" }

mariadb-java-client = { group = "org.mariadb.jdbc", name = "mariadb-java-client", version = "3.3.3" }
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version = "2.0.17" }
google-guava = { group = "com.google.guava", name = "guava", version = "33.5.0-jre" }

adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
adventure-text-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
adventure-text-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }

[bundles]
junit = ["junit-api", "junit-engine"]
Expand Down
21 changes: 21 additions & 0 deletions libraries/banstick-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id("java")
}

group = "xyz.huskydog"
version = "1.0.0"

dependencies {
implementation(libs.hikaricp)
implementation(libs.ipaddress)
implementation(libs.jsoup)
implementation(libs.mariadb.java.client)
implementation(libs.configurate.yaml)
implementation(libs.slf4j.api)
implementation(libs.commons.lang3)
implementation(libs.commons.collections4)
implementation(libs.google.guava)
implementation(libs.adventure.api)
implementation(libs.adventure.text.minimessage)
implementation(libs.adventure.text.serializer.plain)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.programmerdan.minecraft.banstick.containers;

import com.programmerdan.minecraft.banstick.data.BSBan;
import com.programmerdan.minecraft.banstick.data.BSPlayer;
import java.util.HashSet;
import java.util.Set;

/**
* Used to store bans issued and then transmit the results to various parties.
* Basically a logic wrapper.
*
* @author <a href="mailto:programmerdan@gmail.com">ProgrammerDan</a>
*/
public class BanResult {

private Set<BSPlayer> playerBans;
private Set<BSBan> bans;

public BanResult() {
playerBans = new HashSet<>();
bans = new HashSet<>();
}

// TODO: make this a utility in the velocity plugin
// /**
// * Let the command sender know the result of the ban(s) and player(s).
// *
// * @param sender the sender of commands.
// */
// public void informCommandSender(CommandSender sender) {
// if (bans.isEmpty() && playerBans.isEmpty()) {
// sender.sendMessage("No bans issued.");
// }
// StringBuilder sb = new StringBuilder();
// if (playerBans.size() > 1) {
// sb.append(playerBans.size()).append(" player bans issued.\n");
// }
// for (BSPlayer banned : playerBans) {
// BSBan ban = banned.getBan();
// sb.append(" Banned ").append(banned.getName()).append(" for ").append(ban.getMessage());
// if (ban.getBanEndTime() != null) {
// sb.append(" until ").append(DateUtils.getDateFormat().format(ban.getBanEndTime())).append("\n");
// } else {
// sb.append(" forever\n");
// }
// }
// if (bans.size() > 1) {
// sb.append(bans.size()).append(" other bans issued.\n");
// }
// for (BSBan banned : bans) {
// sb.append(" Banned ");
// BSIP bip = banned.getIPBan();
// if (bip != null) {
// sb.append(" IP ").append(bip.toFullString(sender.hasPermission("banstick.ips")));
// }
// BSIPData vip = banned.getProxyBan();
// if (vip != null) {
// sb.append(" VPN ").append(vip.toFullString(sender.hasPermission("banstick.ips")));
// }
// BSShare sid = banned.getShareBan();
// if (sid != null) {
// sb.append(" Share ").append(sid.toFullString(sender.hasPermission("banstick.ips")));
// }
// if (banned.getBanEndTime() != null) {
// sb.append(" until ").append(DateUtils.getDateFormat().format(banned.getBanEndTime())).append("\n");
// } else {
// sb.append(" forever\n");
// }
// }
// sender.sendMessage(sb.toString());
// }

public void addPlayer(BSPlayer player) {
playerBans.add(player);
}

public void addBan(BSBan ban) {
bans.add(ban);
}
}
Loading
Loading