SteamWar/BauSystem2.0
Archiviert
12
0

Commits vergleichen

...
Dieses Repository wurde am 2024-08-05 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.

8 Commits
master ... QOL

Autor SHA1 Nachricht Datum
yoyosource
f94ed415a4 Fix AutoDustCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-14 13:47:59 +02:00
yoyosource
bbe7edc55a Merge branch 'master' into QOL
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-14 13:38:03 +02:00
zOnlyKroks
5555da69aa Actionbar Message
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-07 17:08:41 +02:00
zOnlyKroks
fa9f5792ea Message
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-07 17:04:47 +02:00
zOnlyKroks
9faa238f7d Yeet validator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-07 16:05:46 +02:00
zOnlyKroks
d9f0ca901d temp yeet dsc
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-07 16:01:15 +02:00
zOnlyKroks
701667ab29 Fix typo
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-07 15:59:41 +02:00
zOnlyKroks
6d09635a38 AutodustCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-07 15:58:03 +02:00
3 geänderte Dateien mit 99 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -741,6 +741,9 @@ NIGHT_VISION_OFF=§eNightvision deactivated
NIGHT_VISION_ON=§eNightvision activated
NIGHT_VISION_ITEM_ON = §7Nightvision: §eActivated
NIGHT_VISION_ITEM_OFF = §7Nightvision: §eDeactivated
#Autodust
AUTODUST_ENABLE=§eAutodust was enabled.
AUTODUST_DISABLE=§eAutodust was disabled.
#Navigation Wand
NAVIGATION_WAND=§eNavigation Wand

Datei anzeigen

@ -706,6 +706,9 @@ NIGHT_VISION_OFF=§eNightvision deaktiviert
NIGHT_VISION_ON=§eNightvision aktiviert
NIGHT_VISION_ITEM_ON = §7Nightvision: §eAktiviert
NIGHT_VISION_ITEM_OFF = §7Nightvision: §eDeaktiviert
#Autodust
AUTODUST_ENABLE=§eAutodust wurde aktiviert.
AUTODUST_DISABLE=§eAutodust wurde deaktiviert.
#Navigation Wand
NAVIGATION_WAND=§eNavigation Wand

Datei anzeigen

@ -0,0 +1,93 @@
/*
* 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.bausystem.features.autodust;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.region.Color;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import java.util.regex.Pattern;
@Linked
public class AutoDustCommand extends SWCommand implements Listener {
private static final Pattern COLORED_BLOCK_REGEX = Pattern.compile(
"^(\\w+?)_(wool|stained_glass|concrete_powder|concrete|glazed_terracotta|terracotta)$"
);
public AutoDustCommand() {
super("autodust", "dust");
}
@Register
public void genericCommand(Player p) {
boolean autoDust = Config.getInstance().get(p).getPlainValueOrDefault("autodust", false);
Config.getInstance().get(p).put("autodust", !autoDust);
if(!autoDust) {
BauSystem.MESSAGE.send("AUTODUST_ENABLE",p);
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("AUTODUST_ENABLE", p));
}else {
BauSystem.MESSAGE.send("AUTODUST_DISABLE",p);
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("AUTODUST_DISABLE", p));
}
}
@EventHandler
public void onPlayerInteract(BlockPlaceEvent event) {
Player p = event.getPlayer();
if(!Config.getInstance().get(p).getPlainValueOrDefault("autodust", false)) return;
Block placed = event.getBlockPlaced();
if (!placed.getType().isBlock() || !placed.getType().isSolid()) {
return;
}
String type = placed.getType().name();
boolean isColored = false;
for (Color color : Color.values()) {
if (type.startsWith(color.name() + "_")) {
isColored = true;
break;
}
}
if (!isColored) {
return;
}
Block above = placed.getRelative(BlockFace.UP);
if (!above.isEmpty()) {
return;
}
above.setType(Material.REDSTONE_WIRE);
}
}