Merge remote-tracking branch 'origin/master'
Dieser Commit ist enthalten in:
Commit
bfe09582b9
@ -31,7 +31,7 @@ public enum Detoblock {
|
||||
WEIGHTED_PRESSURE_PLATE(20, "Druckplatte"),
|
||||
TRIPWIRE(30, "Tripwire"),
|
||||
NOTEBLOCK(1, "Noteblock"),
|
||||
REDSTONETORCH(0, true, "Redstonefackel"),
|
||||
DAYLIGHTSENSOR(0, true, "Tageslichtsensor"),
|
||||
POWERABLE(0, true, "Aktivierbarer Block"),
|
||||
INVALID(-1, "Invalider");
|
||||
|
||||
|
@ -31,10 +31,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Lightable;
|
||||
import org.bukkit.block.data.Openable;
|
||||
import org.bukkit.block.data.Powerable;
|
||||
import org.bukkit.block.data.*;
|
||||
import org.bukkit.block.data.type.DaylightDetector;
|
||||
import org.bukkit.block.data.type.Switch;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -105,7 +103,7 @@ public class Detonator {
|
||||
invalid.forEach(detonator::removeLocation);
|
||||
if (!invalid.isEmpty()) {
|
||||
int invalidPoints = invalid.size();
|
||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.DISABLE + invalid.size() + " Punkt" + (invalidPoints > 1 ? "e" : "") + "konnte" + (invalidPoints > 1 ? "n" : "") + " nicht ausgeführt werden und wurde" + (invalidPoints > 1 ? "e" : "") + " entfernt");
|
||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.DISABLE + invalid.size() + " Punkt" + (invalidPoints > 1 ? "e" : "") + " konnte" + (invalidPoints > 1 ? "n" : "") + " nicht ausgeführt werden und wurde" + (invalidPoints > 1 ? "n" : "") + " entfernt");
|
||||
detonator.write();
|
||||
}
|
||||
|
||||
@ -119,13 +117,18 @@ public class Detonator {
|
||||
public static void updateButton(Block block, Detoblock detoblock) {
|
||||
if (block.getBlockData() instanceof Switch) {
|
||||
Switch sw = (Switch) block.getBlockData();
|
||||
update(block.getRelative(sw.getFacing().getOppositeFace()));
|
||||
FaceAttachable.AttachedFace face = sw.getAttachedFace();
|
||||
if (face == FaceAttachable.AttachedFace.FLOOR) {
|
||||
update(block.getRelative(BlockFace.DOWN));
|
||||
} else if (face == FaceAttachable.AttachedFace.CEILING) {
|
||||
update(block.getRelative(BlockFace.UP));
|
||||
} else {
|
||||
update(block.getRelative(sw.getFacing().getOppositeFace()));
|
||||
}
|
||||
} else if (detoblock == Detoblock.TRIPWIRE) {
|
||||
update(block);
|
||||
} else if (detoblock == Detoblock.PRESSURE_PLATE || detoblock == Detoblock.WEIGHTED_PRESSURE_PLATE) {
|
||||
update(block.getRelative(BlockFace.DOWN));
|
||||
} else if (detoblock == Detoblock.REDSTONETORCH) {
|
||||
update(block.getRelative(BlockFace.UP));
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,9 +148,17 @@ public class Detonator {
|
||||
Openable openable = (Openable) data;
|
||||
openable.setOpen(state);
|
||||
}
|
||||
if (data instanceof Lightable) {
|
||||
Lightable lightable = (Lightable) data;
|
||||
lightable.setLit(state);
|
||||
if (data instanceof DaylightDetector) {
|
||||
DaylightDetector detector = (DaylightDetector) data;
|
||||
detector.setInverted(state);
|
||||
}
|
||||
if (data instanceof AnaloguePowerable) {
|
||||
AnaloguePowerable powerable = (AnaloguePowerable) data;
|
||||
if (block.getType() == Material.REDSTONE_WIRE) {
|
||||
powerable.setPower(state ? 15 : 0);
|
||||
} else {
|
||||
powerable.setPower(state ? 1 : 0);
|
||||
}
|
||||
}
|
||||
block.setBlockData(data);
|
||||
}
|
||||
@ -158,9 +169,13 @@ public class Detonator {
|
||||
Powerable pow = (Powerable) data;
|
||||
return pow.isPowered();
|
||||
}
|
||||
if (data instanceof Lightable) {
|
||||
Lightable lightable = (Lightable) data;
|
||||
return lightable.isLit();
|
||||
if (data instanceof DaylightDetector) {
|
||||
DaylightDetector detector = (DaylightDetector) data;
|
||||
return detector.isInverted();
|
||||
}
|
||||
if (data instanceof AnaloguePowerable) {
|
||||
AnaloguePowerable powerable = (AnaloguePowerable) data;
|
||||
return powerable.getPower() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -193,9 +208,8 @@ public class Detonator {
|
||||
return Detoblock.TRIPWIRE;
|
||||
case NOTE_BLOCK:
|
||||
return Detoblock.NOTEBLOCK;
|
||||
case REDSTONE_TORCH:
|
||||
case REDSTONE_WALL_TORCH:
|
||||
return Detoblock.REDSTONETORCH;
|
||||
case DAYLIGHT_DETECTOR:
|
||||
return Detoblock.DAYLIGHTSENSOR;
|
||||
default:
|
||||
if (block.getBlockData() instanceof Powerable) {
|
||||
return Detoblock.POWERABLE;
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2021 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.other;
|
||||
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.core.TPSWatcher;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class TpsCommand extends SWCommand {
|
||||
|
||||
protected TpsCommand() {
|
||||
super("tps");
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void genericCommand(Player p, String... args) {
|
||||
p.sendMessage(ColorConfig.BASE + "TPS:");
|
||||
p.sendMessage(ColorConfig.HIGHLIGHT.toString() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + ColorConfig.OTHER + ", " +
|
||||
ColorConfig.HIGHLIGHT + TPSWarpUtils.getTps(TPSWatcher.TPSType.TEN_SECONDS) + ColorConfig.OTHER + ", " +
|
||||
ColorConfig.HIGHLIGHT + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_MINUTE));
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player p, TPSWatcher.TPSType type) {
|
||||
p.sendMessage(ColorConfig.BASE + "TPS:");
|
||||
p.sendMessage(ColorConfig.HIGHLIGHT.toString() + TPSWarpUtils.getTps(type));
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -46,9 +47,10 @@ public class SignEdit implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void editSign(PlayerInteractEvent event) {
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK ||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK ||
|
||||
!event.getClickedBlock().getType().name().contains("SIGN") ||
|
||||
!event.getPlayer().isSneaking())
|
||||
!event.getPlayer().isSneaking() ||
|
||||
(event.getItem() != null && event.getItem().getType() != Material.AIR))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren