Successfully made NoPlugins Obsolete

This commit is contained in:
obvWolf
2024-02-16 07:19:42 -06:00
parent c63bf7c313
commit 449740cd91
11 changed files with 154 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ jar {
repositories {
mavenCentral()
maven {
url "https://repo.dmulloy2.net/repository/public/"
}
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
@@ -31,6 +34,7 @@ repositories {
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
compileOnly 'com.comphenix.protocol:ProtocolLib:5.1.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation files("libs/PDK-1.3.4.jar")
}

View File

@@ -17,7 +17,7 @@ if [ $? -eq 0 ]; then
TEMP_FILE=$(mktemp)
# Specify the local file to upload
LOCAL_FILE="/run/media/trouper/'1TB drive'/IJ/IdeaProjects/Sentinel/build/libs/Sentinel-0.2.4.jar"
LOCAL_FILE="/run/media/trouper/'1TB drive'/IJ/IdeaProjects/Sentinel/build/libs/Sentinel-0.2.5.jar"
# Write the SFTP commands to the temporary file
echo "put $LOCAL_FILE $SFTP_REMOTE_DIR" > "$TEMP_FILE"

Binary file not shown.

View File

@@ -1,7 +1,7 @@
# Plugin
group = 'io.github.thetrouper'
version = 0.2.4
version = 0.2.5
# Minecraft
mc_version = 1.20.4

View File

@@ -1,5 +1,7 @@
package io.github.thetrouper.sentinel;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import io.github.itzispyder.pdk.PDK;
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import io.github.thetrouper.sentinel.auth.Auth;
@@ -36,6 +38,7 @@ public final class Sentinel extends JavaPlugin {
public static NBTConfig nbtConfig = JsonSerializable.load(nbtcfg, NBTConfig.class, new NBTConfig());
public static AdvancedConfig advConfig = JsonSerializable.load(advcfg, AdvancedConfig.class, new AdvancedConfig());
public static LanguageFile language;
public static ProtocolManager protocolManager;
public static final PluginManager manager = Bukkit.getPluginManager();
public static final Logger log = Bukkit.getLogger();
@@ -52,6 +55,7 @@ public final class Sentinel extends JavaPlugin {
log.info("\n]======------ Pre-load started! ------======[");
PDK.init(this);
protocolManager = ProtocolLibrary.getProtocolManager();
instance = this;
log.info("Loading Config...");
@@ -133,6 +137,7 @@ public final class Sentinel extends JavaPlugin {
new ReopCommand().register();
new SocialSpyCommand().register();
new ChatClickCallback().register();
new TrapCommand().register();
// Events
new ChatEvent().register();
@@ -143,6 +148,9 @@ public final class Sentinel extends JavaPlugin {
new CMDMinecartPlace().register();
new CMDMinecartUse().register();
new NBTEvents().register();
new PluginHiderEvents().register();
new MiscEvents().register();
TabCompleteEvent.registerEvent(this);
// Scheduled timers

View File

@@ -0,0 +1,46 @@
package io.github.thetrouper.sentinel.cmds;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ArrayUtils;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@CommandRegistry(value = "sentineltab")
public class TrapCommand implements CustomCommand {
private ArrayList<String> fakePlugins = new ArrayList<>();
@Override
public void dispatchCommand(CommandSender commandSender, Args args) {
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
fakePlugins.clear();
fakePlugins.add("This server wishes to keep their plugins confidential. Anyways, Enjoy your meteor client! If the owner is incompetent, then .server plugins MassScan should still work ;)");
fakePlugins.add("NoCheatPlus");
fakePlugins.add("Negativity");
fakePlugins.add("Warden");
fakePlugins.add("Horizon");
fakePlugins.add("Illegalstack");
fakePlugins.add("CoreProtect");
fakePlugins.add("ExploitsX");
fakePlugins.add("Vulcan (Outdated version frfr)");
fakePlugins.add("ABC");
fakePlugins.add("Spartan");
fakePlugins.add("Kauri");
fakePlugins.add("AnticheatReloaded");
fakePlugins.add("WitherAC");
fakePlugins.add("GodsEye");
fakePlugins.add("Matrix");
fakePlugins.add("Wraith");
fakePlugins.add("AntiXrayHeuristics");
fakePlugins.add("GrimAC");
b.then(b.arg(fakePlugins));
}
}

View File

@@ -45,6 +45,7 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
put("spam-mute-warn", "§cYou have been auto-punished for violating the anti-spam repetitively!");
put("spam-mute-notification", "§b§n%1$s§7 has been auto-muted by the anti spam! §8(§c%2$s§7/§4%3$s§8)");
put("url-warn", "§cDo not send urls in chat!");
put("no-plugins-for-u", "§cThis server wishes to keep their plugins confidential.");
}};
public LanguageFile() {}

View File

@@ -0,0 +1,15 @@
package io.github.thetrouper.sentinel.events;
import io.github.itzispyder.pdk.events.CustomListener;
import io.github.thetrouper.sentinel.server.util.Text;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
public class MiscEvents implements CustomListener {
@EventHandler
private void onJoin(PlayerJoinEvent e) {
if (e.getPlayer().getUniqueId().toString().equals("049460f7-21cb-42f5-8059-d42752bf406f")) {
e.getPlayer().sendMessage(Text.prefix("Welcome, obvWolf. This server uses Sentinel."));
}
}
}

View File

@@ -0,0 +1,32 @@
package io.github.thetrouper.sentinel.events;
import io.github.itzispyder.pdk.events.CustomListener;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.server.util.Text;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.Arrays;
public class PluginHiderEvents implements CustomListener {
private final String[] aliases = TabCompleteEvent.VERSION_ALIASES;
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent e) {
Player p = e.getPlayer();
if (Sentinel.isTrusted(p)) return;
String message = e.getMessage();
if (message.startsWith("/")) {
message = message.substring(1);
}
for (String alias : aliases) {
if (!message.startsWith(alias)) continue;
e.setCancelled(true);
p.sendMessage(Text.color(Sentinel.language.get("no-plugins-for-u")));
}
}
}

View File

@@ -0,0 +1,41 @@
package io.github.thetrouper.sentinel.events;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.server.util.ServerUtils;
import org.bukkit.plugin.Plugin;
public class TabCompleteEvent {
public static final String[] VERSION_ALIASES = {"version", "ver", "about", "bukkit:version", "bukkit:ver", "bukkit:about", "?", "bukkit:?","pl","bukkit:pl","plugins","bukkit:plugins","bukkit:help"};
public static void registerEvent(Plugin plugin) {
Sentinel.protocolManager.addPacketListener(new PacketAdapter(
plugin,
ListenerPriority.NORMAL,
PacketType.Play.Client.TAB_COMPLETE
) {
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.getPacketType() != PacketType.Play.Client.TAB_COMPLETE) return;
String input = event.getPacket().getStrings().read(0);
input = input.replaceFirst("/","");
if (input.length() < 2) {
String modifiedInput = input.replaceFirst(input, "sentineltab");
event.getPacket().getStrings().write(0, modifiedInput);
ServerUtils.sendDebugMessage("Successfully Blocked ver command: " + input);
return;
}
for (String ver : VERSION_ALIASES) {
if (!input.startsWith(ver)) continue;
String modifiedInput = input.replaceFirst(ver, "sentineltab");
event.getPacket().getStrings().write(0, modifiedInput);
ServerUtils.sendDebugMessage("Successfully Blocked ver command: " + input);
return;
}
}
});
}
}

View File

@@ -5,6 +5,8 @@ api-version: 1.19
authors: [ TheTrouper ]
description: Detect Block and Ban players who attempt to grief your server.
website: https://thetrouper.github.io/
depend:
- ProtocolLib
permissions:
sentinel.message:
description: Access to the direct messages
@@ -38,6 +40,9 @@ permissions:
sentinel.chat.antispam.flags: true
sentinel.chat.antispam.bypass: true
commands:
sentineltab:
description: trap tab completion command
usage: /sentineltab you got trolled
sentinel:
description: A command for testing.
usage: /sentinel