├── .gitignore ├── README.md ├── pom.xml └── src └── main ├── java └── me │ └── pvpb0t │ └── brogle │ ├── Brogle.java │ ├── NCPHandler.java │ ├── PlayerEventListener.java │ └── PlayerJoinListener.java └── resources ├── config.yml └── plugin.yml /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific stuff 2 | .idea/ 3 | 4 | *.iml 5 | *.ipr 6 | *.iws 7 | 8 | # IntelliJ 9 | out/ 10 | 11 | # Compiled class file 12 | *.class 13 | 14 | # Log file 15 | *.log 16 | 17 | # BlueJ files 18 | *.ctxt 19 | 20 | # Package Files # 21 | *.jar 22 | *.war 23 | *.nar 24 | *.ear 25 | *.zip 26 | *.tar.gz 27 | *.rar 28 | 29 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 30 | hs_err_pid* 31 | 32 | *~ 33 | 34 | # temporary files which can be created if a process still has a handle open of a deleted file 35 | .fuse_hidden* 36 | 37 | # KDE directory preferences 38 | .directory 39 | 40 | # Linux trash folder which might appear on any partition or disk 41 | .Trash-* 42 | 43 | # .nfs files are created when an open file is removed but is still being accessed 44 | .nfs* 45 | 46 | # General 47 | .DS_Store 48 | .AppleDouble 49 | .LSOverride 50 | 51 | # Icon must end with two \r 52 | Icon 53 | 54 | # Thumbnails 55 | ._* 56 | 57 | # Files that might appear in the root of a volume 58 | .DocumentRevisions-V100 59 | .fseventsd 60 | .Spotlight-V100 61 | .TemporaryItems 62 | .Trashes 63 | .VolumeIcon.icns 64 | .com.apple.timemachine.donotpresent 65 | 66 | # Directories potentially created on remote AFP share 67 | .AppleDB 68 | .AppleDesktop 69 | Network Trash Folder 70 | Temporary Items 71 | .apdisk 72 | 73 | # Windows thumbnail cache files 74 | Thumbs.db 75 | Thumbs.db:encryptable 76 | ehthumbs.db 77 | ehthumbs_vista.db 78 | 79 | # Dump file 80 | *.stackdump 81 | 82 | # Folder config file 83 | [Dd]esktop.ini 84 | 85 | # Recycle Bin used on file shares 86 | $RECYCLE.BIN/ 87 | 88 | # Windows Installer files 89 | *.cab 90 | *.msi 91 | *.msix 92 | *.msm 93 | *.msp 94 | 95 | # Windows shortcuts 96 | *.lnk 97 | 98 | target/ 99 | 100 | pom.xml.tag 101 | pom.xml.releaseBackup 102 | pom.xml.versionsBackup 103 | pom.xml.next 104 | 105 | release.properties 106 | dependency-reduced-pom.xml 107 | buildNumber.properties 108 | .mvn/timing.properties 109 | .mvn/wrapper/maven-wrapper.jar 110 | .flattened-pom.xml 111 | 112 | # Common working directory 113 | run/ 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NCP-Testing-Plugin 2 | A plugin to test modules/cheats on ncp. Made for bukkit but works on spigot 3 | 4 | Instead of kicked it displays: 5 | ![bild](https://user-images.githubusercontent.com/74259011/211204393-80b07d2c-efa9-4fe3-ac02-2fc38944fe7c.png) 6 | 7 | Show flags in chat: 8 | ![bild](https://user-images.githubusercontent.com/74259011/211204400-e3b01d51-ef95-4a3d-ab9b-e9eeded4bba7.png) 9 | 10 | Also takes a password so you can run the server offline to test features through ide 11 | 12 |

Add this in the ncp config to prevent kick

13 | 14 | ``` 15 | kickagainst: title [player] title "&c&l(!)&7 Invalid block placements." 16 | kickalive: title [player] title "&c&l(!)&7 Too many keep-alive packets." 17 | kickattackfrequency: title [player] title "&c&l(!)&7 Unlikely fast clicking." 18 | kickbow: title [player] title "&c&l(!)&7 Shooting arrows too quickly." 19 | kickbspeed: title [player] title "&c&l(!)&7 Too fast block interactions." 20 | kickcaptcha: title [player] title "&c&l(!)&7 Enter the captcha!" 21 | kickchat1: title [player] title "&c&l(!)&7 Do not spam the server chat (1 minute tempkick)" 22 | kickchat5: title [player] title "&c&l(!)&7 You are not allowed to spam the server chat (5 minutes tempkick)" 23 | kickchatfast: title [player] title "&c&l(!)&7 Stop spamming." 24 | kickchatnormal: title [player] title "&c&l(!)&7 Too many chat messages, take a break." 25 | kickcommands: title [player] title "&c&l(!)&7 Do not spam commands (1 minute tempkick)" 26 | kickcritical: title [player] title "&c&l(!)&7 Incorrect movements (Critical cheats?)" 27 | kickfastbreak: title [player] title "&c&l(!)&7 Breaking blocks too fast." 28 | kickfastclick: title [player] title "&c&l(!)&7 Unlikely inventory interactions." 29 | kickfastconsume: title [player] title "&c&l(!)&7 Using items too quickly." 30 | kickfastheal: title [player] title "&c&l(!)&7 Too fast health regeneration." 31 | kickfastplace: title [player] title "&c&l(!)&7 Placing blocks too quickly." 32 | kickfly: title [player] title "&c&l(!)&7 Moved unexpectedly." 33 | kickflyingfrequency: title [player] title "&c&l(!)&7 Kicked for packet spam." 34 | kickfrequency: title [player] title "&c&l(!)&7 Illegal block-breaking frequency." 35 | kickgod: title [player] title "&c&l(!)&7 GodMode?" 36 | kickillegalblockinteract: title [player] title "&c&l(!)&7 Illegal block interactions." 37 | kickillegalrotations: title [player] title "&c&l(!)&7 Invalid rotations." 38 | kickimprobable: title [player] title "&c&l(!)&7 Illegal client modifications." 39 | kickinvaliddata: title [player] title "&c&l(!)&7 Invalid book data." 40 | kickpacketfrequency: title [player] title "&c&l(!)&7 Too many packets." 41 | kickpackets: title [player] title "&c&l(!)&7 You sent too many moves (extreme lag?)" 42 | kickscaffold: title [player] title "&c&l(!)&7 Unnatural block placements." 43 | kickselfhit: title [player] title "&c&l(!)&7 You tried to hit yourself!" 44 | kicksuspiciouscombat: title [player] title "&c&l(!)&7 Illegal combat modifications." 45 | kickvehiclefly: title [player] title "&c&l(!)&7 Unexpected vehicle movement." 46 | kickwb: title [player] title "&c&l(!)&7 Block breaking out of sync." 47 | ``` 48 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | me.pvpb0t 8 | brogle 9 | 1.0-SNAPSHOT 10 | jar 11 | 12 | Brogle 13 | 14 | 15 | 1.8 16 | UTF-8 17 | 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-compiler-plugin 24 | 3.8.1 25 | 26 | ${java.version} 27 | ${java.version} 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-shade-plugin 33 | 3.2.4 34 | 35 | 36 | package 37 | 38 | shade 39 | 40 | 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | src/main/resources 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | spigotmc-repo 58 | https://hub.spigotmc.org/nexus/content/repositories/snapshots/ 59 | 60 | 61 | md_5-snapshots 62 | https://repo.md-5.net/content/repositories/snapshots/ 63 | 64 | 65 | md_5-releases 66 | https://repo.md-5.net/content/repositories/releases/ 67 | 68 | 69 | 70 | 71 | 72 | org.bukkit 73 | bukkit 74 | 1.12.2-R0.1-SNAPSHOT 75 | provided 76 | 77 | 78 | fr.neatmonster 79 | nocheatplus 80 | 3.16.1-SNAPSHOT 81 | provided 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/main/java/me/pvpb0t/brogle/Brogle.java: -------------------------------------------------------------------------------- 1 | package me.pvpb0t.brogle; 2 | 3 | import fr.neatmonster.nocheatplus.NCPAPIProvider; 4 | import fr.neatmonster.nocheatplus.checks.CheckType; 5 | import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI; 6 | import fr.neatmonster.nocheatplus.hooks.NCPHookManager; 7 | import org.bukkit.Bukkit; 8 | import org.bukkit.Location; 9 | import org.bukkit.command.Command; 10 | import org.bukkit.command.CommandExecutor; 11 | import org.bukkit.command.CommandSender; 12 | import org.bukkit.command.PluginCommand; 13 | import org.bukkit.entity.Player; 14 | import org.bukkit.plugin.java.JavaPlugin; 15 | 16 | import java.io.File; 17 | import java.util.HashSet; 18 | import java.util.Set; 19 | 20 | public final class Brogle extends JavaPlugin implements CommandExecutor { 21 | @Override 22 | public void onEnable() { 23 | // Plugin-startlogik 24 | System.out.println("Started brogle"); 25 | getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this); 26 | getServer().getPluginManager().registerEvents(new PlayerEventListener(this), this); 27 | // Registrera lösenordkommandot 28 | PluginCommand passwordCommand = getCommand("password"); 29 | passwordCommand.setExecutor(this); 30 | passwordCommand.setTabCompleter(this); 31 | 32 | PluginCommand LockPos = getCommand("setLockPos"); 33 | LockPos.setExecutor(this); 34 | LockPos.setTabCompleter(this); 35 | 36 | NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI(); 37 | NCPHookManager.addHook(CheckType.ALL,new NCPHandler(this)); 38 | // Skapa pluginens data-mapp om den inte redan finns 39 | if (!getDataFolder().exists()) { 40 | getDataFolder().mkdir(); 41 | } 42 | // Skapa konfigurationsfilen om den inte redan finns 43 | File configFile = new File(getDataFolder(), "config.yml"); 44 | if (!configFile.exists()) { 45 | saveDefaultConfig(); 46 | } 47 | } 48 | // Denna metod ger tillgång till en lista med autentiserade spelare. 49 | public Set getAuthPlayers() { 50 | return authPlayers; 51 | } 52 | // Detta är en lista över autentiserade spelare. 53 | private Set authPlayers = new HashSet<>(); 54 | // Denna metod hanterar kommandon som skickas till pluginen. 55 | @Override 56 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 57 | if (!(sender instanceof Player)) { 58 | sender.sendMessage("This command can only be run by a player."); 59 | return false; 60 | } 61 | Player player = (Player) sender; 62 | // Om kommandot är "password" 63 | if (command.getName().equalsIgnoreCase("password")) { 64 | // Kontrollera om avsändaren är en spelare. 65 | // Kontrollera om spelaren finns i listan över spelare som måste autentisera. 66 | if (!authPlayers.contains(player)) { 67 | String configPassword = this.getConfig().getString("password", "1234"); 68 | // Kontrollera om lösenordet är korrekt. 69 | if (args.length > 0 && args[0].equals(configPassword)) { 70 | // Ta bort spelaren från listan över spelare som måste autentisera. 71 | authPlayers.add(player); 72 | // Skicka ett meddelande till spelaren som bekräftar att autentiseringen lyckades. 73 | player.sendMessage("You have authenticated successfully."); 74 | } else { 75 | // Send an error message to the player 76 | player.sendMessage("Incorrect password. Please try again."); 77 | } 78 | } else { 79 | // Send an error message to the player 80 | player.sendMessage("You do not need to authenticate."); 81 | } 82 | return true; 83 | }else if(command.getName().equalsIgnoreCase("setLockPos")){ 84 | if(player.isOp()){ 85 | Location playerLocation = player.getLocation(); 86 | double x = playerLocation.getX(); 87 | double y = playerLocation.getY(); 88 | double z = playerLocation.getZ(); 89 | 90 | // Store the position in the configuration file 91 | this.getConfig().set("x", x); 92 | this.getConfig().set("y", y); 93 | this.getConfig().set("z", z); 94 | this.saveConfig(); 95 | player.sendMessage("Location has been saved to the configuration file"); 96 | 97 | }else{ 98 | player.sendMessage("You do not have the required permissions to use this command"); 99 | 100 | } 101 | } 102 | return false; 103 | } 104 | 105 | // Denna metod lägger till en spelare i listan över autentiserade spelare. 106 | public void addAuthPlayers(Player player) { 107 | authPlayers.add(player); 108 | } 109 | 110 | // När pluginen stängs av körs den här metoden. 111 | @Override 112 | public void onDisable() { 113 | // Plugin-avstängningslogik 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/me/pvpb0t/brogle/NCPHandler.java: -------------------------------------------------------------------------------- 1 | package me.pvpb0t.brogle; 2 | 3 | import fr.neatmonster.nocheatplus.checks.CheckType; 4 | import fr.neatmonster.nocheatplus.checks.access.IViolationInfo; 5 | import fr.neatmonster.nocheatplus.hooks.NCPHook; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | // Detta är en klass som implementerar NCPHook-gränssnittet. 😎 10 | public class NCPHandler implements NCPHook { 11 | // Konstruktorn tar emot en JavaPlugin-instans som argument. 🤔 12 | public NCPHandler(JavaPlugin plugin) { 13 | this.plugin = plugin; 14 | } 15 | 16 | // Denna metod returnerar namnet på hooken. 🌟 17 | @Override 18 | public String getHookName() { 19 | return "BrogleHook"; 20 | } 21 | // Detta är en fältvariabel för plugin-instansen. 😎 22 | private final JavaPlugin plugin; 23 | 24 | // Denna metod returnerar versionen av hooken. 🌟 25 | @Override 26 | public String getHookVersion() { 27 | return "1.0"; 28 | } 29 | 30 | // Denna metod körs när en kontroll misslyckas. 😢 31 | @Override 32 | public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo iViolationInfo) { 33 | // Skapa ett felmeddelande med spelarens namn och typen av kontroll som misslyckades. 😵 34 | String message = String.format("%s failed check %s", player.getName(), checkType); 35 | // Typomvandla plugin-instansen till Brogle. 🤔 36 | Brogle brogle = (Brogle) plugin; 37 | // Kontrollera om spelaren finns i listan över autentiserade spelare. 😎 38 | if (brogle.getAuthPlayers().contains(player)) { 39 | // Skicka felmeddelandet till spelaren. 😬 40 | player.sendMessage(message); 41 | } 42 | // Returnera false för att indikera att kontrollen misslyckades. 💔 43 | return false; 44 | } 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/me/pvpb0t/brogle/PlayerEventListener.java: -------------------------------------------------------------------------------- 1 | package me.pvpb0t.brogle; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.entity.Entity; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.EventHandler; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.player.PlayerMoveEvent; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import java.util.Set; 12 | 13 | public class PlayerEventListener implements Listener { 14 | // Detta är en fältvariabel för plugin-instansen. 15 | private final JavaPlugin plugin; 16 | // Konstruktorn tar emot en Brogle-instans som argument. 17 | public PlayerEventListener(Brogle plugin) { 18 | this.plugin = plugin; 19 | } 20 | 21 | // Denna metod körs när en spelare rör sig. 22 | @EventHandler 23 | public void onPlayerMove(PlayerMoveEvent event) { 24 | // Spara spelaren som en fältvariabel. 25 | Player player = event.getPlayer(); 26 | // Typomvandla plugin-instansen till Brogle. 27 | Brogle brogle = (Brogle) plugin; 28 | // Kontrollera om spelaren inte finns i listan över autentiserade spelare. 29 | if (!brogle.getAuthPlayers().contains(player)) { 30 | double x = brogle.getConfig().getDouble("x", 0); 31 | double y = brogle.getConfig().getDouble("y", 0); 32 | double z = brogle.getConfig().getDouble("z", 0); 33 | // Avbryt händelsen. 34 | Entity passenger = player.getPassenger(); 35 | if (passenger != null) { 36 | passenger.remove(); 37 | } 38 | if(player.isInsideVehicle()){ 39 | Entity vehicle = player.getVehicle(); 40 | player.leaveVehicle(); 41 | vehicle.remove(); 42 | } 43 | Location lockpos = new Location(player.getWorld(), x, y, z, 0f, 0f); 44 | player.teleport(lockpos); 45 | //event.setCancelled(true); 46 | } 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/me/pvpb0t/brogle/PlayerJoinListener.java: -------------------------------------------------------------------------------- 1 | package me.pvpb0t.brogle; 2 | 3 | import org.bukkit.event.EventHandler; 4 | import org.bukkit.event.Listener; 5 | import org.bukkit.event.player.PlayerJoinEvent; 6 | 7 | public class PlayerJoinListener implements Listener { 8 | @EventHandler 9 | public void onPlayerJoin(PlayerJoinEvent event) { 10 | // This method will be called every time a player joins the server 11 | event.getPlayer().sendMessage("Please enter a password using the '/password ' command."); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | # The password for the 'password' command 2 | password: 1234 3 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Brogle 2 | version: '${project.version}' 3 | main: me.pvpb0t.brogle.Brogle 4 | commands: 5 | password: 6 | description: Allows players to authenticate with a password. 7 | usage: /password 8 | setLockPos: 9 | description: Set the lock position of an operator on the server, they will be teleported back to this location if they try to move away from it. 10 | usage: /setLockPos 11 | softdepend: [NoCheatPlus] 12 | --------------------------------------------------------------------------------