Dieser Commit ist enthalten in:
Ursprung
37fcdd02f2
Commit
ae48985aa6
@ -37,6 +37,7 @@ repositories {
|
||||
dependencies {
|
||||
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
|
||||
compileOnly swdep("SpigotCore")
|
||||
compileOnly swdep("WorldEdit-1.15")
|
||||
}
|
||||
|
||||
steamwar {
|
||||
|
@ -44,6 +44,7 @@ public final class Builder extends JavaPlugin {
|
||||
new GamemodeCommand();
|
||||
new SpeedCommand();
|
||||
new FreezeCommand();
|
||||
new ArenaconfigCommand();
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerChange(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new FreezeListener(), this);
|
||||
|
@ -55,4 +55,7 @@ MATERIAL_OCCLUDING=
|
||||
MATERIAL_INTERACT-ABLE=§8- §eInterargierbarer Block
|
||||
MATERIAL_FLAMMABLE=§8- §eFlammbarer Block
|
||||
MATERIAL_BURNABLE=§8- §eBrennbarer Block
|
||||
MATERIAL_WATERLOGGABLE=§8- §eWasserspeicherbarer Block
|
||||
MATERIAL_WATERLOGGABLE=§8- §eWasserspeicherbarer Block
|
||||
|
||||
ARENACONFIG_HELP=§8/§7arenaconfig §8[§eUntere Spielergrenze§8] (WE-Pos1: Kleinste blaue Schemkoordinate, WE-Pos2: Kleinste Rote Schemkoordinate)
|
||||
ARENACONFIG_SELECTION=§cKeine WE-SAuswahl,
|
89
src/de/steamwar/teamserver/command/ArenaconfigCommand.java
Normale Datei
89
src/de/steamwar/teamserver/command/ArenaconfigCommand.java
Normale Datei
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 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.teamserver.command;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.teamserver.Builder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ArenaconfigCommand extends SWCommand {
|
||||
|
||||
public ArenaconfigCommand() {
|
||||
super("arenaconfig");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericHelp(Player p, String... args) {
|
||||
Builder.MESSAGE.send("ARENACONFIG_HELP", p);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void config(Player p, int lowerPlayerBorder) throws IOException {
|
||||
CuboidRegion region = getSelection(p);
|
||||
if(region == null)
|
||||
return;
|
||||
|
||||
BlockVector3 pos1 = region.getPos1();
|
||||
BlockVector3 pos2 = region.getPos2();
|
||||
|
||||
File file = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
config.set("UnderBorder", lowerPlayerBorder);
|
||||
|
||||
ConfigurationSection blueCorner = config.getConfigurationSection("BlueCorner");
|
||||
blueCorner.set("x", pos1.getX());
|
||||
blueCorner.set("y", pos1.getY());
|
||||
blueCorner.set("z", pos1.getZ());
|
||||
|
||||
ConfigurationSection blueToRed = config.getConfigurationSection("BlueToRed");
|
||||
blueToRed.set("x", pos2.getX() - pos1.getX());
|
||||
blueToRed.set("y", pos2.getY() - pos1.getY());
|
||||
blueToRed.set("z", pos2.getZ() - pos1.getZ());
|
||||
|
||||
config.save(file);
|
||||
}
|
||||
|
||||
private CuboidRegion getSelection(Player player) {
|
||||
RegionSelector regionSelector = WorldEdit.getInstance()
|
||||
.getSessionManager()
|
||||
.get(BukkitAdapter.adapt(player))
|
||||
.getRegionSelector(BukkitAdapter.adapt(player.getWorld()));
|
||||
|
||||
try {
|
||||
return (CuboidRegion)regionSelector.getRegion();
|
||||
} catch (IncompleteRegionException e) {
|
||||
Builder.MESSAGE.send("ARENACONFIG_SELECTION", player);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,6 @@ version: 1.0
|
||||
main: de.steamwar.teamserver.Builder
|
||||
api-version: 1.15
|
||||
prefix: Teamserver
|
||||
depend: [ SpigotCore ]
|
||||
depend: [SpigotCore, WorldEdit]
|
||||
authors: [ YoyoNow ]
|
||||
description: Teamserver
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren