Hotfix AttributesCopyCommand and AttributesPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
6a52a319ab
Commit
3a28f5c42f
@ -63,7 +63,7 @@ public class AttributesCopyCommand extends SWCommand {
|
||||
BlockData blockData = block.getBlockData();
|
||||
List<String> attributesToCopy = new ArrayList<>();
|
||||
if (needsType(block)) {
|
||||
attributesToCopy.add("§8-§7 type " + block.getType().name().toLowerCase());
|
||||
attributesToCopy.add("§8-§7 material " + block.getType().name().toLowerCase());
|
||||
}
|
||||
for (BlockAttribute blockAttribute : blockAttributeList) {
|
||||
if (blockAttribute.type().isInstance(blockData)) {
|
||||
|
@ -65,10 +65,16 @@ public class AttributesPlaceListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
Material material = strings.stream()
|
||||
.filter(s -> s.startsWith("§8-§7 type "))
|
||||
.map(s -> s.replace("§8-§7 type ", ""))
|
||||
.filter(s -> s.startsWith("§8-§7 material "))
|
||||
.map(s -> s.replace("§8-§7 material ", ""))
|
||||
.map(String::toUpperCase)
|
||||
.map(Material::valueOf)
|
||||
.map(s -> {
|
||||
try {
|
||||
return Material.valueOf(s.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(type);
|
||||
event.getBlock().setType(material, false);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren