Add Permission to Loader
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
d75fe24ebe
Commit
d70dda463c
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.bausystem.features.loader;
|
package de.steamwar.bausystem.features.loader;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.config.ColorConfig;
|
import de.steamwar.bausystem.config.ColorConfig;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
@ -58,100 +59,126 @@ public class LoaderCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register("setup")
|
@Register("setup")
|
||||||
public void setupLoader(Player p) {
|
public void setupLoader(Player p) {
|
||||||
if (Loader.getLoader(p) != null) {
|
if (permissionCheck(p)) {
|
||||||
Loader.getLoader(p).setup();
|
if (Loader.getLoader(p) != null) {
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Dein Loader ist nun wieder im Setup");
|
Loader.getLoader(p).setup();
|
||||||
} else {
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Dein Loader ist nun wieder im Setup");
|
||||||
Loader.newLoader(p);
|
} else {
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Belade und feuer einmal die Kanone ab, um den Loader zu initialisieren.");
|
Loader.newLoader(p);
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Führe dann /" + ColorConfig.HIGHLIGHT + "loader start" + ColorConfig.BASE + " um den Loader zu starten");
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Belade und feuer einmal die Kanone ab, um den Loader zu initialisieren.");
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Führe dann /" + ColorConfig.HIGHLIGHT + "loader start" + ColorConfig.BASE + " um den Loader zu starten");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("start")
|
@Register("start")
|
||||||
public void startLoader(Player p) {
|
public void startLoader(Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
if (permissionCheck(p)) {
|
||||||
if (loaderNullCheck(loader, p)) {
|
Loader loader = Loader.getLoader(p);
|
||||||
return;
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loader.start();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun aktiviert.");
|
||||||
}
|
}
|
||||||
loader.start();
|
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun aktiviert.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("stop")
|
@Register("stop")
|
||||||
public void stopLoader(Player p) {
|
public void stopLoader(Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
if (permissionCheck(p)) {
|
||||||
if (loaderNullCheck(loader, p)) {
|
Loader loader = Loader.getLoader(p);
|
||||||
return;
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loader.stop();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun gestoppt.");
|
||||||
}
|
}
|
||||||
loader.stop();
|
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun gestoppt.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("pause")
|
@Register("pause")
|
||||||
public void pauseLoader(Player p) {
|
public void pauseLoader(Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
if (permissionCheck(p)) {
|
||||||
if (loaderNullCheck(loader, p)) {
|
Loader loader = Loader.getLoader(p);
|
||||||
return;
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loader.pause();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun pausiert.");
|
||||||
}
|
}
|
||||||
loader.pause();
|
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader ist nun pausiert.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("resume")
|
@Register("resume")
|
||||||
public void resumeLoader(Player p) {
|
public void resumeLoader(Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
if (permissionCheck(p)) {
|
||||||
if (loaderNullCheck(loader, p)) {
|
Loader loader = Loader.getLoader(p);
|
||||||
return;
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loader.resume();
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader läuft nun weiter.");
|
||||||
}
|
}
|
||||||
loader.resume();
|
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Der Loader läuft nun weiter.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("wait")
|
@Register("wait")
|
||||||
public void shotDelayLoader(Player p, int delay) {
|
public void shotDelayLoader(Player p, int delay) {
|
||||||
if (delay < 1) {
|
if (permissionCheck(p)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Die Wartezeit ist zu klein");
|
if (delay < 1) {
|
||||||
return;
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Die Wartezeit ist zu klein");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Loader loader = Loader.getLoader(p);
|
||||||
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Die Schusswartezeit ist nun: " + delay + ", zuvor " + loader.getTicksBetweenShots());
|
||||||
|
loader.setTicksBetweenShots(delay);
|
||||||
}
|
}
|
||||||
Loader loader = Loader.getLoader(p);
|
|
||||||
if (loaderNullCheck(loader, p)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Die Schusswartezeit ist nun: " + delay + ", zuvor " + loader.getTicksBetweenShots());
|
|
||||||
loader.setTicksBetweenShots(delay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("speed")
|
@Register("speed")
|
||||||
public void speedLoader(Player p, int delay) {
|
public void speedLoader(Player p, int delay) {
|
||||||
if (delay < 1) {
|
if (permissionCheck(p)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Die Wartezeit ist zu klein");
|
if (delay < 1) {
|
||||||
return;
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Die Wartezeit ist zu klein");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Loader loader = Loader.getLoader(p);
|
||||||
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "die Setzwartezeit ist nun: " + delay + ", zuvor " + loader.getTicksBetweenBlocks());
|
||||||
|
loader.setTicksBetweenShots(delay);
|
||||||
}
|
}
|
||||||
Loader loader = Loader.getLoader(p);
|
|
||||||
if (loaderNullCheck(loader, p)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "die Setzwartezeit ist nun: " + delay + ", zuvor " + loader.getTicksBetweenBlocks());
|
|
||||||
loader.setTicksBetweenShots(delay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("undo")
|
@Register("undo")
|
||||||
public void undoLast(Player p) {
|
public void undoLast(Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
if (permissionCheck(p)) {
|
||||||
if (loaderNullCheck(loader, p)) {
|
Loader loader = Loader.getLoader(p);
|
||||||
return;
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Undo erfolgreich.");
|
||||||
|
loader.undo();
|
||||||
}
|
}
|
||||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.BASE + "Undo erfolgreich.");
|
|
||||||
loader.undo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("clear")
|
@Register("clear")
|
||||||
public void clearLoader(Player p) {
|
public void clearLoader(Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
if (permissionCheck(p)) {
|
||||||
if (loaderNullCheck(loader, p)) {
|
Loader loader = Loader.getLoader(p);
|
||||||
return;
|
if (loaderNullCheck(loader, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loader.clear();
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren