SteamWar/BauSystem2.0
Archiviert
12
0

Add Permission to Loader

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-05-24 12:17:42 +02:00
Ursprung d75fe24ebe
Commit d70dda463c

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
@ -58,6 +59,7 @@ public class LoaderCommand extends SWCommand {
@Register("setup")
public void setupLoader(Player p) {
if (permissionCheck(p)) {
if (Loader.getLoader(p) != null) {
Loader.getLoader(p).setup();
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Dein Loader ist nun wieder im Setup");
@ -67,9 +69,11 @@ public class LoaderCommand extends SWCommand {
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Führe dann /" + ColorConfig.HIGHLIGHT + "loader start" + ColorConfig.BASE + " um den Loader zu starten");
}
}
}
@Register("start")
public void startLoader(Player p) {
if (permissionCheck(p)) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) {
return;
@ -77,9 +81,11 @@ public class LoaderCommand extends SWCommand {
loader.start();
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun aktiviert.");
}
}
@Register("stop")
public void stopLoader(Player p) {
if (permissionCheck(p)) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) {
return;
@ -87,9 +93,11 @@ public class LoaderCommand extends SWCommand {
loader.stop();
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun gestoppt.");
}
}
@Register("pause")
public void pauseLoader(Player p) {
if (permissionCheck(p)) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) {
return;
@ -97,9 +105,11 @@ public class LoaderCommand extends SWCommand {
loader.pause();
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun pausiert.");
}
}
@Register("resume")
public void resumeLoader(Player p) {
if (permissionCheck(p)) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) {
return;
@ -107,9 +117,11 @@ public class LoaderCommand extends SWCommand {
loader.resume();
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader läuft nun weiter.");
}
}
@Register("wait")
public void shotDelayLoader(Player p, int delay) {
if (permissionCheck(p)) {
if (delay < 1) {
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Die Wartezeit ist zu klein");
return;
@ -121,9 +133,11 @@ public class LoaderCommand extends SWCommand {
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Die Schusswartezeit ist nun: " + delay + ", zuvor " + loader.getTicksBetweenShots());
loader.setTicksBetweenShots(delay);
}
}
@Register("speed")
public void speedLoader(Player p, int delay) {
if (permissionCheck(p)) {
if (delay < 1) {
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Die Wartezeit ist zu klein");
return;
@ -135,9 +149,11 @@ public class LoaderCommand extends SWCommand {
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "die Setzwartezeit ist nun: " + delay + ", zuvor " + loader.getTicksBetweenBlocks());
loader.setTicksBetweenShots(delay);
}
}
@Register("undo")
public void undoLast(Player p) {
if (permissionCheck(p)) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) {
return;
@ -145,13 +161,24 @@ public class LoaderCommand extends SWCommand {
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Undo erfolgreich.");
loader.undo();
}
}
@Register("clear")
public void clearLoader(Player p) {
if (permissionCheck(p)) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) {
return;
}
loader.clear();
}
}
private boolean permissionCheck(Player player) {
if (!Permission.hasPermission(player, Permission.WORLD)) {
player.sendMessage(BauSystem.PREFIX + ColorConfig.DISABLE + "Du darfst hier nicht den Detonator nutzen");
return false;
}
return true;
}
}