Skip to content

Commit

Permalink
Updated Kickall Command. (Removed comments)
Browse files Browse the repository at this point in the history
Updated version number to 1.1.1
  • Loading branch information
xSehrMotiviert committed Apr 27, 2022
1 parent f509d2d commit a938f42
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>eu.prellberg.nick</groupId>
<artifactId>velocityplus</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
28 changes: 16 additions & 12 deletions src/main/java/eu/prellberg/nick/velocityplus/VelocityPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;

@Plugin(id = "velocityplus", name = "VelocityPlus", version = "1.1.0", authors = {"Nick Prellberg"}, url = "https://github.com/xsehrmotiviert/velocityplus")
@Plugin(id = "velocityplus", name = "VelocityPlus", version = "1.1.1", authors = {"Nick Prellberg"}, url = "https://github.com/xsehrmotiviert/velocityplus")
public class VelocityPlus {

private final ProxyServer server;
Expand Down Expand Up @@ -47,17 +47,21 @@ public void onProxyInitialize(ProxyInitializeEvent event) {

}

logger.info("\n\n /$$ /$$ /$$ /$$ /$$ \n" +
"| $$ | $$ | $$ |__/ | $$ /$$ \n" +
"| $$ | $$ /$$$$$$ | $$ /$$$$$$ /$$$$$$$ /$$ /$$$$$$ /$$ /$$ | $$ \n" +
"| $$ / $$//$$__ $$| $$ /$$__ $$ /$$_____/| $$|_ $$_/ | $$ | $$ /$$$$$$$$\n" +
" \\ $$ $$/| $$$$$$$$| $$| $$ \\ $$| $$ | $$ | $$ | $$ | $$|__ $$__/\n" +
" \\ $$$/ | $$_____/| $$| $$ | $$| $$ | $$ | $$ /$$| $$ | $$ | $$ \n" +
" \\ $/ | $$$$$$$| $$| $$$$$$/| $$$$$$$| $$ | $$$$/| $$$$$$$ |__/ \n" +
" \\_/ \\_______/|__/ \\______/ \\_______/|__/ \\___/ \\____ $$ \n" +
" /$$ | $$ \n" +
" | $$$$$$/ \n" +
" \\______/ \nVersion: 1.1.0");
logger.info("""
/$$ /$$ /$$ /$$ /$$ \s
| $$ | $$ | $$ |__/ | $$ /$$ \s
| $$ | $$ /$$$$$$ | $$ /$$$$$$ /$$$$$$$ /$$ /$$$$$$ /$$ /$$ | $$ \s
| $$ / $$//$$__ $$| $$ /$$__ $$ /$$_____/| $$|_ $$_/ | $$ | $$ /$$$$$$$$
\\ $$ $$/| $$$$$$$$| $$| $$ \\ $$| $$ | $$ | $$ | $$ | $$|__ $$__/
\\ $$$/ | $$_____/| $$| $$ | $$| $$ | $$ | $$ /$$| $$ | $$ | $$ \s
\\ $/ | $$$$$$$| $$| $$$$$$/| $$$$$$$| $$ | $$$$/| $$$$$$$ |__/ \s
\\_/ \\_______/|__/ \\______/ \\_______/|__/ \\___/ \\____ $$ \s
/$$ | $$ \s
| $$$$$$/ \s
\\______/ \s
Version: 1.1.1""");

new SendCommand(server, this, logger);
new KickallCommand(server, this, logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ public class KickallCommand implements SimpleCommand {

private final ProxyServer proxyServer;
private final VelocityPlus velocityPlus;
private final Logger logger;

public KickallCommand(ProxyServer proxyServer, VelocityPlus velocityPlus, Logger logger) {
this.proxyServer = proxyServer;
this.velocityPlus = velocityPlus;
this.logger = logger;
CommandManager manager = proxyServer.getCommandManager();
manager.register(manager.metaBuilder("kickall").build(), this);
}
Expand All @@ -33,10 +31,7 @@ public KickallCommand(ProxyServer proxyServer, VelocityPlus velocityPlus, Logger
public void execute(Invocation invocation) {
CommandSource source = invocation.source();

// if(source instanceof ConsoleCommandSource) {return;}

if (invocation.arguments().length < 1 || Objects.equals(invocation.arguments()[0], "--force")) {
// Check permissions for kickall with no arguments
if (!source.hasPermission("vplus.kickall.all")) {
source.sendMessage(Component.text(String.join(" ", velocityPlus.getConfig().getString("general.prefix"), velocityPlus.getConfig().getString("general.missingPermissions"))));
return;
Expand All @@ -47,20 +42,20 @@ public void execute(Invocation invocation) {
}
proxyServer.getAllPlayers()
.forEach(player -> {
// Return, wenn Sender = Spieler
if (source == player) return;
// Return, wenn Spieler hat bypass, sender hat keine Force Permission und Argument ist nicht vorhanden

if (player.hasPermission("vplus.kickall.bypass") && !source.hasPermission("vplus.kickall.force") && invocation.arguments().length == 0)
return;
// Return, wenn Spieler hat bypass, sender hat Force Permission, Argument ist aber nicht vorhanden

if (player.hasPermission("vplus.kickall.bypass") && source.hasPermission("vplus.kickall.force") && invocation.arguments().length == 0)
return;
// Return, wenn Spieler hat bypass, sender hat Force Permission, Argument 0 ist aber nicht --force

if (player.hasPermission("vplus.kickall.bypass") && source.hasPermission("vplus.kickall.force") && !Objects.equals(invocation.arguments()[0], "--force"))
return;
// Return, wenn Spieler hat bypass, sender, hat keine Force Permission und Argument ist --force

if (player.hasPermission("vplus.kickall.bypass") && !source.hasPermission("vplus.kickall.force") && Objects.equals(invocation.arguments()[0], "--force"))
return;

player.disconnect(
Component.text(String.join(" ", velocityPlus.getConfig().getString("general.prefix"), velocityPlus.getConfig().getString("kickall.command.kicked")))
);
Expand All @@ -70,7 +65,7 @@ public void execute(Invocation invocation) {
}

Optional<RegisteredServer> server = proxyServer.getServer(invocation.arguments()[0].toLowerCase(Locale.ROOT));
// Check for Permissions for single Server (Should work)

if (!source.hasPermission("vplus.kickall." + invocation.arguments()[0].toLowerCase(Locale.ROOT))) {
if (!source.hasPermission("vplus.kickall.all")) {
source.sendMessage(Component.text(String.join(" ", velocityPlus.getConfig().getString("general.prefix"), velocityPlus.getConfig().getString("general.missingPermissions"))));
Expand All @@ -89,20 +84,21 @@ public void execute(Invocation invocation) {

server.get().getPlayersConnected()
.forEach(player -> {
// Return, wenn Sender = Spieler

if (source == player) return;
// Return, wenn Spieler hat bypass, sender hat keine Force Permission und Argument ist nicht vorhanden

if (player.hasPermission("vplus.kickall.bypass") && !source.hasPermission("vplus.kickall.force") && invocation.arguments().length == 1)
return;
// Return, wenn Spieler hat bypass, sender hat Force Permission, Argument ist aber nicht vorhanden

if (player.hasPermission("vplus.kickall.bypass") && source.hasPermission("vplus.kickall.force") && invocation.arguments().length == 1)
return;
// Return, wenn Spieler hat bypass, sender hat Force Permission, Argument 0 ist aber nicht --force

if (player.hasPermission("vplus.kickall.bypass") && source.hasPermission("vplus.kickall.force") && invocation.arguments().length >= 2 && !Objects.equals(invocation.arguments()[1], "--force"))
return;
// Return, wenn Spieler hat bypass, sender, hat keine Force Permission und Argument ist --force

if (player.hasPermission("vplus.kickall.bypass") && !source.hasPermission("vplus.kickall.force") && invocation.arguments().length >= 2 && Objects.equals(invocation.arguments()[1], "--force"))
return;

player.disconnect(
Component.text(String.join(" ", velocityPlus.getConfig().getString("general.prefix"), velocityPlus.getConfig().getString("kickall.command.kicked")))
);
Expand Down

0 comments on commit a938f42

Please sign in to comment.