Add unmoveable flag for MaterialCommand
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
566c612327
Commit
9275fd552c
@ -918,6 +918,7 @@ MATERIAL_SEARCH_INTERACTEABLE=§eInteractable
|
|||||||
MATERIAL_SEARCH_FLAMMABLE=§eFlammable
|
MATERIAL_SEARCH_FLAMMABLE=§eFlammable
|
||||||
MATERIAL_SEARCH_BURNABLE=§eBurnable
|
MATERIAL_SEARCH_BURNABLE=§eBurnable
|
||||||
MATERIAL_SEARCH_WATERLOGGABLE=§eWaterloggable
|
MATERIAL_SEARCH_WATERLOGGABLE=§eWaterloggable
|
||||||
|
MATERIAL_SEARCH_UNMOVEABLE=§eUnmoveable
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast resistance
|
MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast resistance
|
||||||
MATERIAL_SEARCH_VALUE=§8: §e{0}
|
MATERIAL_SEARCH_VALUE=§8: §e{0}
|
||||||
MATERIAL_BLAST_RESISTANCE=§8- §eBlast resistance§8: §7{0}
|
MATERIAL_BLAST_RESISTANCE=§8- §eBlast resistance§8: §7{0}
|
||||||
@ -932,6 +933,7 @@ MATERIAL_INTERACTABLE=§8- §eInteractable block
|
|||||||
MATERIAL_FLAMMABLE=§8- §eFlammable block
|
MATERIAL_FLAMMABLE=§8- §eFlammable block
|
||||||
MATERIAL_BURNABLE=§8- §eBurnable block
|
MATERIAL_BURNABLE=§8- §eBurnable block
|
||||||
MATERIAL_WATERLOGGABLE=§8- §eWaterloggable block
|
MATERIAL_WATERLOGGABLE=§8- §eWaterloggable block
|
||||||
|
MATERIAL_UNMOVABLE=§8- §eUnmovable block
|
||||||
# Redstonetester
|
# Redstonetester
|
||||||
RT_HELP=§8/§eredstonetester §8-§7 Gives you the redstone tester
|
RT_HELP=§8/§eredstonetester §8-§7 Gives you the redstone tester
|
||||||
RT_GIVEN=§7Measure the time between activation of components
|
RT_GIVEN=§7Measure the time between activation of components
|
||||||
|
@ -63,6 +63,7 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
SearchType flammable = SearchType.IGNORE;
|
SearchType flammable = SearchType.IGNORE;
|
||||||
SearchType burnable = SearchType.IGNORE;
|
SearchType burnable = SearchType.IGNORE;
|
||||||
SearchType waterloggable = SearchType.IGNORE;
|
SearchType waterloggable = SearchType.IGNORE;
|
||||||
|
SearchType unmoveable = SearchType.IGNORE;
|
||||||
|
|
||||||
String blastResistance = ">=0";
|
String blastResistance = ">=0";
|
||||||
String name = "";
|
String name = "";
|
||||||
@ -110,6 +111,7 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
elements.put("-flammable", (search, searchType) -> search.flammable = searchType);
|
elements.put("-flammable", (search, searchType) -> search.flammable = searchType);
|
||||||
elements.put("-burnable", (search, searchType) -> search.burnable = searchType);
|
elements.put("-burnable", (search, searchType) -> search.burnable = searchType);
|
||||||
elements.put("-waterloggable", (search, searchType) -> search.waterloggable = searchType);
|
elements.put("-waterloggable", (search, searchType) -> search.waterloggable = searchType);
|
||||||
|
elements.put("-unmoveable", (search, searchType) -> search.unmoveable = searchType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
@ -235,7 +237,11 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
search.waterloggable = search.waterloggable.next();
|
search.waterloggable = search.waterloggable.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(30, new SWItem(Material.NETHER_BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistance), clickType -> {
|
swInventory.setItem(29, new SWItem(Material.PISTON, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_UNMOVEABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.unmoveable.getChatValue(), p)), clickType -> {
|
||||||
|
search.unmoveable = search.unmoveable.next();
|
||||||
|
searchGUI(p);
|
||||||
|
}));
|
||||||
|
swInventory.setItem(34, new SWItem(Material.NETHER_BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistance), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistance);
|
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistance);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
if (s.isEmpty() || s.matches("((([><]=?)|!|=)\\d+(\\.|,\\d+)?)( ((([><]=?)|!|=)\\d+(\\.|,\\d+)?))*")) {
|
if (s.isEmpty() || s.matches("((([><]=?)|!|=)\\d+(\\.|,\\d+)?)( ((([><]=?)|!|=)\\d+(\\.|,\\d+)?))*")) {
|
||||||
|
@ -22,7 +22,11 @@ package de.steamwar.bausystem.features.util;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -62,6 +66,7 @@ public class MaterialLazyInit {
|
|||||||
private boolean flammable;
|
private boolean flammable;
|
||||||
private boolean burnable;
|
private boolean burnable;
|
||||||
private boolean waterloggable;
|
private boolean waterloggable;
|
||||||
|
private boolean unmoveable;
|
||||||
|
|
||||||
public MaterialData(Material material) {
|
public MaterialData(Material material) {
|
||||||
this.originalMaterial = material;
|
this.originalMaterial = material;
|
||||||
@ -78,6 +83,11 @@ public class MaterialLazyInit {
|
|||||||
burnable = material.isBurnable();
|
burnable = material.isBurnable();
|
||||||
BlockData blockData = material.createBlockData();
|
BlockData blockData = material.createBlockData();
|
||||||
waterloggable = blockData instanceof Waterlogged;
|
waterloggable = blockData instanceof Waterlogged;
|
||||||
|
if (material.isBlock()) {
|
||||||
|
Block block = Bukkit.getWorlds().get(0).getBlockAt(0, 0, 0);
|
||||||
|
block.setType(material);
|
||||||
|
unmoveable = block.getPistonMoveReaction() == PistonMoveReaction.BLOCK || block.getPistonMoveReaction() == PistonMoveReaction.IGNORE || block.getState() instanceof TileState;
|
||||||
|
}
|
||||||
|
|
||||||
if (material.isItem() && material != Material.AIR) {
|
if (material.isItem() && material != Material.AIR) {
|
||||||
this.material = material;
|
this.material = material;
|
||||||
@ -115,6 +125,9 @@ public class MaterialLazyInit {
|
|||||||
if (waterloggable) {
|
if (waterloggable) {
|
||||||
lore.add(BauSystem.MESSAGE.parse("MATERIAL_WATERLOGGABLE", p));
|
lore.add(BauSystem.MESSAGE.parse("MATERIAL_WATERLOGGABLE", p));
|
||||||
}
|
}
|
||||||
|
if (unmoveable) {
|
||||||
|
lore.add(BauSystem.MESSAGE.parse("MATERIAL_UNMOVABLE", p));
|
||||||
|
}
|
||||||
return new SWListInv.SWListEntry<>(new SWItem(material, "§e" + name, lore, false, clickType -> {
|
return new SWListInv.SWListEntry<>(new SWItem(material, "§e" + name, lore, false, clickType -> {
|
||||||
}), originalMaterial);
|
}), originalMaterial);
|
||||||
}
|
}
|
||||||
@ -129,6 +142,7 @@ public class MaterialLazyInit {
|
|||||||
result &= search.flammable.test(flammable);
|
result &= search.flammable.test(flammable);
|
||||||
result &= search.burnable.test(burnable);
|
result &= search.burnable.test(burnable);
|
||||||
result &= search.waterloggable.test(waterloggable);
|
result &= search.waterloggable.test(waterloggable);
|
||||||
|
result &= search.unmoveable.test(unmoveable);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren