Merge remote-tracking branch 'origin/CommandFramework' into CommandFramework
Dieser Commit ist enthalten in:
Commit
00563e131a
@ -65,7 +65,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
Mapper.init();
|
Mapper.init();
|
||||||
|
|
||||||
|
|
||||||
new CommandTrace();
|
new CommandTrace();
|
||||||
new CommandTPSLimiter();
|
new CommandTPSLimiter();
|
||||||
new CommandNV();
|
new CommandNV();
|
||||||
@ -77,14 +76,14 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
new CommandClear();
|
new CommandClear();
|
||||||
new CommandTime();
|
new CommandTime();
|
||||||
new CommandTeleport();
|
new CommandTeleport();
|
||||||
getCommand("fire").setExecutor(new CommandFire());
|
new CommandFire();
|
||||||
getCommand("freeze").setExecutor(new CommandFreeze());
|
new CommandFreeze();
|
||||||
new CommandTestblock();
|
new CommandTestblock();
|
||||||
new CommandInfo();
|
new CommandInfo();
|
||||||
new CommandProtect();
|
new CommandProtect();
|
||||||
new CommandSkull();
|
new CommandSkull();
|
||||||
new CommandLoader();
|
new CommandLoader();
|
||||||
getCommand("lockschem").setExecutor(new CommandLockschem());
|
new CommandLockschem();
|
||||||
new CommandDebugStick();
|
new CommandDebugStick();
|
||||||
new CommandGills();
|
new CommandGills();
|
||||||
new CommandDetonator();
|
new CommandDetonator();
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -7,7 +26,6 @@ import de.steamwar.sql.BauweltMember;
|
|||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class CommandBau extends SWCommand {
|
public class CommandBau extends SWCommand {
|
||||||
|
|
||||||
public CommandBau() {
|
public CommandBau() {
|
||||||
@ -16,9 +34,9 @@ public class CommandBau extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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("§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("§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 toggleworld §8[§7Player§8] §8- §7Editiere die Werlt Rechte eines Spielers");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("info")
|
@Register("info")
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -8,7 +27,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class CommandClear extends SWCommand {
|
public class CommandClear extends SWCommand {
|
||||||
|
|
||||||
public CommandClear() {
|
public CommandClear() {
|
||||||
@ -17,8 +35,8 @@ public class CommandClear extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§eclear §8- §7Leere dein Inventar");
|
p.sendMessage("§8/§eclear §8- §7Leere dein Inventar");
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§ebau clear §8[§7Player§8] §8- §7Leere ein Spieler Inventar");
|
p.sendMessage("§8/§ebau clear §8[§7Player§8] §8- §7Leere ein Spieler Inventar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -7,7 +26,6 @@ import de.steamwar.command.SWCommand;
|
|||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class CommandDebugStick extends SWCommand {
|
public class CommandDebugStick extends SWCommand {
|
||||||
|
|
||||||
public CommandDebugStick() {
|
public CommandDebugStick() {
|
||||||
@ -16,7 +34,7 @@ public class CommandDebugStick extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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
|
@Register
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
@ -19,34 +19,66 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.commands;
|
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.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.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockSpreadEvent;
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
|
|
||||||
public class CommandFire extends RegionToggleCommand {
|
public class CommandFire extends SWCommand implements Listener {
|
||||||
|
|
||||||
@Override
|
public CommandFire() {
|
||||||
String getNoPermMessage() {
|
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";
|
return "§cDu darfst hier nicht Feuerschaden (de-)aktivieren";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String getEnableMessage() {
|
||||||
String getEnableMessage() {
|
return "§cRegions Feuerschaden deaktiviert";
|
||||||
return "§cFeuerschaden deaktiviert";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String getDisableMessage() {
|
||||||
String getDisableMessage() {
|
return "§aRegions Feuerschaden aktiviert";
|
||||||
return "§aFeuerschaden aktiviert";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean toggle(Region region) {
|
||||||
boolean toggle(Region region) {
|
|
||||||
region.setFire(!region.isFire());
|
region.setFire(!region.isFire());
|
||||||
return 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
|
@EventHandler
|
||||||
public void onFireDamage(BlockBurnEvent e) {
|
public void onFireDamage(BlockBurnEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).isFire()) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).isFire()) e.setCancelled(true);
|
||||||
|
@ -20,38 +20,70 @@
|
|||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.Region;
|
||||||
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
|
|
||||||
public class CommandFreeze extends RegionToggleCommand {
|
public class CommandFreeze extends SWCommand implements Listener {
|
||||||
|
|
||||||
@Override
|
public CommandFreeze() {
|
||||||
String getNoPermMessage() {
|
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";
|
return "§cDu darfst diese Welt nicht einfrieren";
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
String getEnableMessage(){
|
private String getEnableMessage(){
|
||||||
return "§cWelt eingefroren";
|
return "§cRegion eingefroren";
|
||||||
}
|
|
||||||
@Override
|
|
||||||
String getDisableMessage(){
|
|
||||||
return "§aWelt aufgetaut";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String getDisableMessage(){
|
||||||
boolean toggle(Region region) {
|
return "§aRegion aufgetaut";
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean toggle(Region region) {
|
||||||
region.setFreeze(!region.isFreeze());
|
region.setFreeze(!region.isFreeze());
|
||||||
return 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
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||||
if (!Region.getRegion(e.getLocation()).isFreeze()) return;
|
if (!Region.getRegion(e.getLocation()).isFreeze()) return;
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -46,8 +65,8 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§egui §8- §7Öffne die GUI");
|
p.sendMessage("§8/§egui §8- §7Öffne die GUI");
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§egui item §8- §7Gebe das GUI item");
|
p.sendMessage("§8/§egui item §8- §7Gebe das GUI item");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -6,7 +25,6 @@ import de.steamwar.sql.BauweltMember;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class CommandGamemode extends SWCommand {
|
public class CommandGamemode extends SWCommand {
|
||||||
|
|
||||||
public CommandGamemode() {
|
public CommandGamemode() {
|
||||||
@ -15,7 +33,7 @@ public class CommandGamemode extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void gamemodeHelp(Player p, String... args) {
|
public void gamemodeHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spielmodus");
|
p.sendMessage("§cUnbekannter Spielmodus");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -33,7 +33,7 @@ public class CommandGills extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§ewatervision §8- §7Toggle WaterBreathing");
|
p.sendMessage("§8/§ewatervision §8- §7Toggle WaterBreathing");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -40,7 +40,7 @@ public class CommandInfo extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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
|
@Register
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,55 +20,63 @@
|
|||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.steamwar.sql.UserGroup;
|
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;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandLockschem implements CommandExecutor {
|
public class CommandLockschem extends SWCommand {
|
||||||
|
|
||||||
@Override
|
public CommandLockschem() {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
super("lockschem");
|
||||||
if (!(sender instanceof Player))
|
}
|
||||||
return false;
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
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();
|
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||||
|
|
||||||
if (userGroup != UserGroup.Admin &&
|
if (userGroup != UserGroup.Admin &&
|
||||||
userGroup != UserGroup.Developer &&
|
userGroup != UserGroup.Developer &&
|
||||||
userGroup != UserGroup.Moderator &&
|
userGroup != UserGroup.Moderator &&
|
||||||
userGroup != UserGroup.Supporter)
|
userGroup != UserGroup.Supporter) {
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if (args.length != 2) {
|
|
||||||
sendHelp(player);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
if (schemOwner == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID());
|
Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID());
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
||||||
return false;
|
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() +
|
SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " von " + schematic.getSchemType().toString() +
|
||||||
" auf NORMAL zurückgesetzt!");
|
" auf NORMAL zurückgesetzt!");
|
||||||
schematic.setSchemType(SchematicType.Normal);
|
schematic.setSchemType(SchematicType.Normal);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHelp(Player player) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class CommandNV extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§enightvision §8- §7Toggle NightVision");
|
p.sendMessage("§8/§enightvision §8- §7Toggle NightVision");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -39,8 +39,8 @@ public class CommandProtect extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§eprotect §8- §7Schütze die Region");
|
p.sendMessage("§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[§7Schematic§8] §8- §7Schütze die Region mit einer Schematic");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -36,7 +36,7 @@ public class CommandRedstoneTester extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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
|
@Register
|
||||||
|
@ -39,8 +39,8 @@ public class CommandReset extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§ereset §8- §7Setzte die Region zurück");
|
p.sendMessage("§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[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -84,7 +83,7 @@ public class CommandScript extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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
|
@Register
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -17,10 +36,10 @@ public class CommandScriptVars extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§escriptvars §8- §7Zähle alle globalen Variablen auf");
|
p.sendMessage("§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("§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("§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[§7Variable§8] §8<§7remove§8|§7delete§8|§7clear§8> §8- §7Lösche eine Variable");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
@ -35,7 +34,7 @@ public class CommandSkull extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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
|
@Register
|
||||||
|
@ -36,7 +36,7 @@ public class CommandSpeed extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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"})
|
@Register({"default"})
|
||||||
|
@ -62,8 +62,8 @@ public class CommandTNT extends SWCommand implements Listener {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§etnt §8- §7Ändere das TNT verhalten");
|
p.sendMessage("§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[§7Mode§8] §8- §7Setzte das TNT verhalten auf einen Modus");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
@ -132,22 +132,22 @@ public class CommandTNT extends SWCommand implements Listener {
|
|||||||
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
|
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
|
||||||
if (requestedMode != null && region.hasTestblock()) {
|
if (requestedMode != null && region.hasTestblock()) {
|
||||||
region.setTntMode(requestedMode);
|
region.setTntMode(requestedMode);
|
||||||
RegionToggleCommand.actionBar(region, requestedMessage);
|
RegionUtils.actionBar(region, requestedMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (region.getTntMode()) {
|
switch (region.getTntMode()) {
|
||||||
case ON:
|
case ON:
|
||||||
case ONLY_TB:
|
case ONLY_TB:
|
||||||
region.setTntMode(TNTMode.OFF);
|
region.setTntMode(TNTMode.OFF);
|
||||||
RegionToggleCommand.actionBar(region, getDisableMessage());
|
RegionUtils.actionBar(region, getDisableMessage());
|
||||||
break;
|
break;
|
||||||
case OFF:
|
case OFF:
|
||||||
if (Region.buildAreaEnabled() && region.hasTestblock()) {
|
if (Region.buildAreaEnabled() && region.hasTestblock()) {
|
||||||
region.setTntMode(TNTMode.ONLY_TB);
|
region.setTntMode(TNTMode.ONLY_TB);
|
||||||
RegionToggleCommand.actionBar(region, getTestblockEnableMessage());
|
RegionUtils.actionBar(region, getTestblockEnableMessage());
|
||||||
} else {
|
} else {
|
||||||
region.setTntMode(TNTMode.ON);
|
region.setTntMode(TNTMode.ON);
|
||||||
RegionToggleCommand.actionBar(region, getEnableMessage());
|
RegionUtils.actionBar(region, getEnableMessage());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -159,11 +159,11 @@ public class CommandTNT extends SWCommand implements Listener {
|
|||||||
Region region = Region.getRegion(block.getLocation());
|
Region region = Region.getRegion(block.getLocation());
|
||||||
if (region.getTntMode() == TNTMode.ON) return false;
|
if (region.getTntMode() == TNTMode.ON) return false;
|
||||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
|
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 true;
|
||||||
}
|
}
|
||||||
return region.getTntMode() == TNTMode.OFF;
|
return region.getTntMode() == TNTMode.OFF;
|
||||||
|
@ -64,7 +64,7 @@ public class CommandTPSLimiter extends SWCommand {
|
|||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "Jetziges TPS limit: " + currentTPSLimit);
|
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"})
|
@Register({"default"})
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -6,13 +25,16 @@ import de.steamwar.sql.BauweltMember;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
|
||||||
|
|
||||||
public class CommandTeleport extends SWCommand {
|
public class CommandTeleport extends SWCommand {
|
||||||
|
|
||||||
public CommandTeleport() {
|
public CommandTeleport() {
|
||||||
super("teleport");
|
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
|
@Register
|
||||||
public void genericCommand(Player p, Player target) {
|
public void genericCommand(Player p, Player target) {
|
||||||
|
@ -39,8 +39,8 @@ public class CommandTestblock extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§etestblock §8- §7Setzte den Testblock zurück");
|
p.sendMessage("§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[§7Schematic§8] §8- §7Setzte den Testblock mit einer Schematic zurück");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
|
@ -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;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@ -21,7 +40,7 @@ public class CommandTime extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
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
|
@Register
|
||||||
|
@ -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);
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
name: BauSystem
|
name: BauSystem
|
||||||
authors: [Lixfel, YoyoNow, Chaoscaot]
|
authors: [Lixfel, YoyoNow, Chaoscaot, Zeanon]
|
||||||
version: "1.0"
|
version: "1.0"
|
||||||
depend: [WorldEdit, SpigotCore, ProtocolLib]
|
depend: [WorldEdit, SpigotCore, ProtocolLib]
|
||||||
load: POSTWORLD
|
load: POSTWORLD
|
||||||
@ -9,7 +9,3 @@ website: "https://steamwar.de"
|
|||||||
description: "So unseriös wie wir sind: BauSystem nur besser."
|
description: "So unseriös wie wir sind: BauSystem nur besser."
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
fire:
|
|
||||||
freeze:
|
|
||||||
aliases: stoplag
|
|
||||||
lockschem:
|
|
In neuem Issue referenzieren
Einen Benutzer sperren