forked from SteamWar/SteamWar
Add ExperimentalCommand
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 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.features.experimental;
|
||||||
|
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class ExperimentalCommand extends SWCommand {
|
||||||
|
|
||||||
|
public ExperimentalCommand() {
|
||||||
|
super("experimental", "experiment");
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
-7
@@ -21,8 +21,8 @@ package de.steamwar.bausystem.features.experimental.redstone_engine;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
|
import de.steamwar.command.AbstractSWCommand;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import io.papermc.paper.configuration.WorldConfiguration;
|
import io.papermc.paper.configuration.WorldConfiguration;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
@@ -37,18 +37,19 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Linked
|
@AbstractSWCommand.PartOf(RedstoneEngine.class)
|
||||||
public class RedstoneEngineCommand extends SWCommand implements Listener, ScoreboardElement {
|
public class RedstoneEngine extends SWCommand implements Listener, ScoreboardElement {
|
||||||
|
|
||||||
public RedstoneEngineCommand() {
|
public RedstoneEngine() {
|
||||||
super("redstoneengine");
|
super("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorldConfiguration.Misc getConfig() {
|
private WorldConfiguration.Misc getConfig() {
|
||||||
return ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle().paperConfig().misc;
|
return ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle().paperConfig().misc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register("redstone")
|
||||||
|
@Register("redstoneengine")
|
||||||
public void setRedstoneEngine(Player player, @StaticValue("alternate_current") String __, WorldConfiguration.Misc.AlternateCurrentUpdateOrder updateOrder) {
|
public void setRedstoneEngine(Player player, @StaticValue("alternate_current") String __, WorldConfiguration.Misc.AlternateCurrentUpdateOrder updateOrder) {
|
||||||
WorldConfiguration.Misc misc = getConfig();
|
WorldConfiguration.Misc misc = getConfig();
|
||||||
misc.redstoneImplementation = WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT;
|
misc.redstoneImplementation = WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT;
|
||||||
@@ -56,7 +57,8 @@ public class RedstoneEngineCommand extends SWCommand implements Listener, Scoreb
|
|||||||
broadcastTitle(Bukkit.getOnlinePlayers());
|
broadcastTitle(Bukkit.getOnlinePlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register("redstone")
|
||||||
|
@Register("redstoneengine")
|
||||||
public void setRedstoneEngine(Player player, WorldConfiguration.Misc.RedstoneImplementation implementation) {
|
public void setRedstoneEngine(Player player, WorldConfiguration.Misc.RedstoneImplementation implementation) {
|
||||||
getConfig().redstoneImplementation = implementation;
|
getConfig().redstoneImplementation = implementation;
|
||||||
broadcastTitle(Bukkit.getOnlinePlayers());
|
broadcastTitle(Bukkit.getOnlinePlayers());
|
||||||
Reference in New Issue
Block a user