SteamWar/BauSystem
Archiviert
13
0

Merge remote-tracking branch 'origin/CommandFramework' into CommandFramework

Dieser Commit ist enthalten in:
Zeanon 2021-04-01 23:12:31 +02:00
Commit 00563e131a
28 geänderte Dateien mit 335 neuen und 225 gelöschten Zeilen

Datei anzeigen

@ -65,7 +65,6 @@ public class BauSystem extends JavaPlugin implements Listener {
Mapper.init();
new CommandTrace();
new CommandTPSLimiter();
new CommandNV();
@ -77,14 +76,14 @@ public class BauSystem extends JavaPlugin implements Listener {
new CommandClear();
new CommandTime();
new CommandTeleport();
getCommand("fire").setExecutor(new CommandFire());
getCommand("freeze").setExecutor(new CommandFreeze());
new CommandFire();
new CommandFreeze();
new CommandTestblock();
new CommandInfo();
new CommandProtect();
new CommandSkull();
new CommandLoader();
getCommand("lockschem").setExecutor(new CommandLockschem());
new CommandLockschem();
new CommandDebugStick();
new CommandGills();
new CommandDetonator();

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -7,7 +26,6 @@ import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player;
public class CommandBau extends SWCommand {
public CommandBau() {
@ -16,9 +34,9 @@ public class CommandBau extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§ebau togglebuild §8[§7Player§8] §8- §7Editiere die Bau Rechte eines Spielers");
p.sendMessage(BauSystem.PREFIX + "§8/§ebau togglewe §8[§7Player§8] §8- §7Editiere die WorldEdit Rechte eines Spielers");
p.sendMessage(BauSystem.PREFIX + "§8/§ebau toggleworld §8[§7Player§8] §8- §7Editiere die Werlt Rechte eines Spielers");
p.sendMessage("§8/§ebau togglebuild §8[§7Player§8] §8- §7Editiere die Bau Rechte eines Spielers");
p.sendMessage("§8/§ebau togglewe §8[§7Player§8] §8- §7Editiere die WorldEdit Rechte eines Spielers");
p.sendMessage("§8/§ebau toggleworld §8[§7Player§8] §8- §7Editiere die Werlt Rechte eines Spielers");
}
@Register("info")

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -8,7 +27,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class CommandClear extends SWCommand {
public CommandClear() {
@ -17,8 +35,8 @@ public class CommandClear extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§eclear §8- §7Leere dein Inventar");
p.sendMessage(BauSystem.PREFIX + "§8/§ebau clear §8[§7Player§8] §8- §7Leere ein Spieler Inventar");
p.sendMessage("§8/§eclear §8- §7Leere dein Inventar");
p.sendMessage("§8/§ebau clear §8[§7Player§8] §8- §7Leere ein Spieler Inventar");
}
@Register

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -7,7 +26,6 @@ import de.steamwar.command.SWCommand;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.entity.Player;
public class CommandDebugStick extends SWCommand {
public CommandDebugStick() {
@ -16,7 +34,7 @@ public class CommandDebugStick extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§edebugstick §8- §7Erhalte einen DebugStick");
p.sendMessage("§8/§edebugstick §8- §7Erhalte einen DebugStick");
}
@Register

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;

Datei anzeigen

@ -19,34 +19,66 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.Region;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.command.SWCommand;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockSpreadEvent;
public class CommandFire extends RegionToggleCommand {
public class CommandFire extends SWCommand implements Listener {
@Override
String getNoPermMessage() {
public CommandFire() {
super("fire");
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§efire §8- §7Toggle Feuerschaden");
}
@Register
public void toggleCommand(Player p) {
if (!permissionCheck(p)) return;
Region region = Region.getRegion(p.getLocation());
if (toggle(region)) {
RegionUtils.actionBar(region, getEnableMessage());
} else {
RegionUtils.actionBar(region, getDisableMessage());
}
}
private String getNoPermMessage() {
return "§cDu darfst hier nicht Feuerschaden (de-)aktivieren";
}
@Override
String getEnableMessage() {
return "§cFeuerschaden deaktiviert";
private String getEnableMessage() {
return "§cRegions Feuerschaden deaktiviert";
}
@Override
String getDisableMessage() {
return "§aFeuerschaden aktiviert";
private String getDisableMessage() {
return "§aRegions Feuerschaden aktiviert";
}
@Override
boolean toggle(Region region) {
private boolean toggle(Region region) {
region.setFire(!region.isFire());
return region.isFire();
}
private boolean permissionCheck(Player player) {
if (Welt.noPermission(player, Permission.world)) {
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
return false;
}
return true;
}
@EventHandler
public void onFireDamage(BlockBurnEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).isFire()) e.setCancelled(true);

Datei anzeigen

@ -20,38 +20,70 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.Region;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.command.SWCommand;
import de.steamwar.core.Core;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
public class CommandFreeze extends RegionToggleCommand {
public class CommandFreeze extends SWCommand implements Listener {
@Override
String getNoPermMessage() {
public CommandFreeze() {
super("freeze", "stoplag");
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§efreeze §8- §7Toggle Freeze");
}
@Register
public void toggleCommand(Player p) {
if (!permissionCheck(p)) return;
Region region = Region.getRegion(p.getLocation());
if (toggle(region)) {
RegionUtils.actionBar(region, getEnableMessage());
} else {
RegionUtils.actionBar(region, getDisableMessage());
}
}
private String getNoPermMessage() {
return "§cDu darfst diese Welt nicht einfrieren";
}
@Override
String getEnableMessage(){
return "§cWelt eingefroren";
}
@Override
String getDisableMessage(){
return "§aWelt aufgetaut";
private String getEnableMessage(){
return "§cRegion eingefroren";
}
@Override
boolean toggle(Region region) {
private String getDisableMessage(){
return "§aRegion aufgetaut";
}
private boolean toggle(Region region) {
region.setFreeze(!region.isFreeze());
return region.isFreeze();
}
private boolean permissionCheck(Player player) {
if (Welt.noPermission(player, Permission.world)) {
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
return false;
}
return true;
}
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
if (!Region.getRegion(e.getLocation()).isFreeze()) return;

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -46,8 +65,8 @@ public class CommandGUI extends SWCommand implements Listener {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§egui §8- §7Öffne die GUI");
p.sendMessage(BauSystem.PREFIX + "§8/§egui item §8- §7Gebe das GUI item");
p.sendMessage("§8/§egui §8- §7Öffne die GUI");
p.sendMessage("§8/§egui item §8- §7Gebe das GUI item");
}
@Register

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -6,7 +25,6 @@ import de.steamwar.sql.BauweltMember;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
public class CommandGamemode extends SWCommand {
public CommandGamemode() {
@ -15,7 +33,7 @@ public class CommandGamemode extends SWCommand {
@Register(help = true)
public void gamemodeHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spielmodus");
p.sendMessage("§cUnbekannter Spielmodus");
}
@Register

Datei anzeigen

@ -33,7 +33,7 @@ public class CommandGills extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§ewatervision §8- §7Toggle WaterBreathing");
p.sendMessage("§8/§ewatervision §8- §7Toggle WaterBreathing");
}
@Register

Datei anzeigen

@ -40,7 +40,7 @@ public class CommandInfo extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§ebauinfo §8- §7Gebe Informationen über den Bau");
p.sendMessage("§8/§ebauinfo §8- §7Gibt Informationen über den Bau");
}
@Register

Datei anzeigen

@ -1,43 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.SimpleCommandMap;
import java.lang.reflect.Field;
public class CommandInjector {
private CommandInjector() {
}
private static final String PACKAGE_NAME = Bukkit.getServer().getClass().getPackage().getName();
private static final String VERSION = PACKAGE_NAME.substring(PACKAGE_NAME.lastIndexOf('.') + 1);
public static void injectCommand(Command cmd) throws Exception {
Class serverClass = Class.forName("org.bukkit.craftbukkit." + VERSION + ".CraftServer");
Field f1 = serverClass.getDeclaredField("commandMap");
f1.setAccessible(true);
SimpleCommandMap commandMap = (SimpleCommandMap) f1.get(Bukkit.getServer());
commandMap.register("BauSystem", cmd);
}
}

Datei anzeigen

@ -20,55 +20,63 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CommandLockschem implements CommandExecutor {
public class CommandLockschem extends SWCommand {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player))
return false;
Player player = (Player) sender;
public CommandLockschem() {
super("lockschem");
}
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
@Register(help = true)
public void genericHelp(Player p, String... args) {
SteamwarUser steamwarUser = SteamwarUser.get(p.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if (userGroup != UserGroup.Admin &&
userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Supporter)
return false;
if (args.length != 2) {
sendHelp(player);
return false;
userGroup != UserGroup.Supporter) {
return;
}
SteamwarUser schemOwner = SteamwarUser.get(args[0]);
sendHelp(p);
}
@Register
public void genericCommand(Player p, String owner, String schematicName) {
SteamwarUser steamwarUser = SteamwarUser.get(p.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if (userGroup != UserGroup.Admin &&
userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Supporter) {
return;
}
SteamwarUser schemOwner = SteamwarUser.get(owner);
if (schemOwner == null) {
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
return false;
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
return;
}
Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID());
Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID());
if (schematic == null) {
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
return false;
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
return;
}
player.sendMessage(BauSystem.PREFIX + "Schematic " + schematic.getSchemName() + " von " +
p.sendMessage(BauSystem.PREFIX + "Schematic " + schematic.getSchemName() + " von " +
SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " von " + schematic.getSchemType().toString() +
" auf NORMAL zurückgesetzt!");
schematic.setSchemType(SchematicType.Normal);
return false;
}
private void sendHelp(Player player) {
player.sendMessage(BauSystem.PREFIX + "/schemlock [OWNER] [SCHEM NAME]");
player.sendMessage("§8/§eschemlock §8[§7Owner§8] §8[§7Schematic§8] §8- §7 Sperre eine Schematic");
}
}

Datei anzeigen

@ -33,7 +33,7 @@ public class CommandNV extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§enightvision §8- §7Toggle NightVision");
p.sendMessage("§8/§enightvision §8- §7Toggle NightVision");
}
@Register

Datei anzeigen

@ -39,8 +39,8 @@ public class CommandProtect extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§eprotect §8- §7Schütze die Region");
p.sendMessage(BauSystem.PREFIX + "§8/§eprotect §8[§7Schematic§8] §8- §7Schütze die Region mit einer Schematic");
p.sendMessage("§8/§eprotect §8- §7Schütze die Region");
p.sendMessage("§8/§eprotect §8[§7Schematic§8] §8- §7Schütze die Region mit einer Schematic");
}
@Register

Datei anzeigen

@ -36,7 +36,7 @@ public class CommandRedstoneTester extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§eredstonetester §8- §7Gibt den RedstoneTester");
p.sendMessage("§8/§eredstonetester §8- §7Gibt den RedstoneTester");
}
@Register

Datei anzeigen

@ -39,8 +39,8 @@ public class CommandReset extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§ereset §8- §7Setzte die Region zurück");
p.sendMessage(BauSystem.PREFIX + "§8/§ereset §8[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück");
p.sendMessage("§8/§ereset §8- §7Setzte die Region zurück");
p.sendMessage("§8/§ereset §8[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück");
}
@Register

Datei anzeigen

@ -21,7 +21,6 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.command.SWCommand;
import org.bukkit.Material;
@ -84,7 +83,7 @@ public class CommandScript extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§escript §8- §7Gibt das Script Buch");
p.sendMessage("§8/§escript §8- §7Gibt das Script Buch");
}
@Register

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -17,10 +36,10 @@ public class CommandScriptVars extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§escriptvars §8- §7Zähle alle globalen Variablen auf");
p.sendMessage(BauSystem.PREFIX + "§8/§escriptvars §8[§7Variable§8] §8- §7Gebe den Wert der Variable zurück");
p.sendMessage(BauSystem.PREFIX + "§8/§escriptvars §8[§7Variable§8] §8[§7Value§8] §8- §7Setzte eine Variable auf einen Wert");
p.sendMessage(BauSystem.PREFIX + "§8/§escriptvars §8[§7Variable§8] §8<§7remove§8|§7delete§8|§7clear§8> §8- §7Lösche eine Variable");
p.sendMessage("§8/§escriptvars §8- §7Zähle alle globalen Variablen auf");
p.sendMessage("§8/§escriptvars §8[§7Variable§8] §8- §7Gebe den Wert der Variable zurück");
p.sendMessage("§8/§escriptvars §8[§7Variable§8] §8[§7Value§8] §8- §7Setzte eine Variable auf einen Wert");
p.sendMessage("§8/§escriptvars §8[§7Variable§8] §8<§7remove§8|§7delete§8|§7clear§8> §8- §7Lösche eine Variable");
}
@Register

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.command.SWCommand;
import de.steamwar.inventory.SWItem;
@ -35,7 +34,7 @@ public class CommandSkull extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8] §8- §7Gibt einen SpielerKopf");
p.sendMessage("§8/§eskull §8[§eSpieler§8] §8- §7Gibt einen SpielerKopf");
}
@Register

Datei anzeigen

@ -36,7 +36,7 @@ public class CommandSpeed extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§espeed §8[§7Geschwindigkeit§8] §8- §7Setzte deine Flug- und Gehgeschwindigkeit");
p.sendMessage("§8/§espeed §8[§7Geschwindigkeit§8] §8- §7Setzte deine Flug- und Gehgeschwindigkeit");
}
@Register({"default"})

Datei anzeigen

@ -62,8 +62,8 @@ public class CommandTNT extends SWCommand implements Listener {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§etnt §8- §7Ändere das TNT verhalten");
p.sendMessage(BauSystem.PREFIX + "§8/§etnt §8[§7Mode§8] §8- §7Setzte das TNT verhalten auf einen Modus");
p.sendMessage("§8/§etnt §8- §7Ändere das TNT verhalten");
p.sendMessage("§8/§etnt §8[§7Mode§8] §8- §7Setzte das TNT verhalten auf einen Modus");
}
@Register
@ -132,22 +132,22 @@ public class CommandTNT extends SWCommand implements Listener {
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
if (requestedMode != null && region.hasTestblock()) {
region.setTntMode(requestedMode);
RegionToggleCommand.actionBar(region, requestedMessage);
RegionUtils.actionBar(region, requestedMessage);
return;
}
switch (region.getTntMode()) {
case ON:
case ONLY_TB:
region.setTntMode(TNTMode.OFF);
RegionToggleCommand.actionBar(region, getDisableMessage());
RegionUtils.actionBar(region, getDisableMessage());
break;
case OFF:
if (Region.buildAreaEnabled() && region.hasTestblock()) {
region.setTntMode(TNTMode.ONLY_TB);
RegionToggleCommand.actionBar(region, getTestblockEnableMessage());
RegionUtils.actionBar(region, getTestblockEnableMessage());
} else {
region.setTntMode(TNTMode.ON);
RegionToggleCommand.actionBar(region, getEnableMessage());
RegionUtils.actionBar(region, getEnableMessage());
}
break;
}
@ -159,11 +159,11 @@ public class CommandTNT extends SWCommand implements Listener {
Region region = Region.getRegion(block.getLocation());
if (region.getTntMode() == TNTMode.ON) return false;
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
return true;
}
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
return true;
}
return region.getTntMode() == TNTMode.OFF;

Datei anzeigen

@ -64,7 +64,7 @@ public class CommandTPSLimiter extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "Jetziges TPS limit: " + currentTPSLimit);
p.sendMessage(BauSystem.PREFIX + "§8/§etpslimit §8[§7TPS§8|§edefault§8] §8- §7Setzte die TPS auf dem Bau");
p.sendMessage("§8/§etpslimit §8[§7TPS§8|§edefault§8] §8- §7Setzte die TPS auf dem Bau");
}
@Register({"default"})

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -6,13 +25,16 @@ import de.steamwar.sql.BauweltMember;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
public class CommandTeleport extends SWCommand {
public CommandTeleport() {
super("teleport");
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§etp §8[§7Player§8] §8- §7Teleportiere dich zu einem Spieler");
}
@Register
public void genericCommand(Player p, Player target) {

Datei anzeigen

@ -39,8 +39,8 @@ public class CommandTestblock extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§etestblock §8- §7Setzte den Testblock zurück");
p.sendMessage(BauSystem.PREFIX + "§8/§etestblock §8[§7Schematic§8] §8- §7Setzte den Testblock mit einer Schematic zurück");
p.sendMessage("§8/§etestblock §8- §7Setzte den Testblock zurück");
p.sendMessage("§8/§etestblock §8[§7Schematic§8] §8- §7Setzte den Testblock mit einer Schematic zurück");
}
@Register

Datei anzeigen

@ -1,3 +1,22 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
@ -21,7 +40,7 @@ public class CommandTime extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "§8/§etime §8<§7Zeit 0=Morgen§8, §76000=Mittag§8, §718000=Mitternacht§8> §8- §7Setzt die Zeit auf dem Bau");
p.sendMessage("§8/§etime §8<§7Zeit 0=Morgen§8, §76000=Mittag§8, §718000=Mitternacht§8> §8- §7Setzt die Zeit auf dem Bau");
}
@Register

Datei anzeigen

@ -1,82 +0,0 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* /
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.Region;
import de.steamwar.bausystem.world.Welt;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
public abstract class RegionToggleCommand implements CommandExecutor, Listener {
public RegionToggleCommand() {
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player))
return false;
Player player = (Player) sender;
if (Welt.noPermission(player, Permission.world)) {
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
return false;
}
Region region = Region.getRegion(player.getLocation());
if (toggle(region)) {
actionBar(region, getEnableMessage());
} else {
actionBar(region, getDisableMessage());
}
return false;
}
public static void actionBar(Region region, String s) {
if (Region.GlobalRegion.isGlobalRegion(region)) {
Bukkit.getOnlinePlayers().stream().filter(player -> Region.getRegion(player.getLocation()) == null).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
} else {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation())).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
}
}
abstract String getNoPermMessage();
abstract String getEnableMessage();
abstract String getDisableMessage();
/**
* {@code true} for {@link #getEnableMessage()}, {@code false} for {@link #getDisableMessage()}
*/
abstract boolean toggle(Region region);
}

Datei anzeigen

@ -1,5 +1,5 @@
name: BauSystem
authors: [Lixfel, YoyoNow, Chaoscaot]
authors: [Lixfel, YoyoNow, Chaoscaot, Zeanon]
version: "1.0"
depend: [WorldEdit, SpigotCore, ProtocolLib]
load: POSTWORLD
@ -9,7 +9,3 @@ website: "https://steamwar.de"
description: "So unseriös wie wir sind: BauSystem nur besser."
commands:
fire:
freeze:
aliases: stoplag
lockschem: