Improves button and material customization
Allows specifying a comma-separated list of materials and tags for a portal's button, open-material, closed-material and border blocks. A random value is used if more than one material is available.0 Uses the supplied button if any, instead of enforcing the specified button material. Always protects the button against block breaking. Fixes an incorrect permission result in the previous commit, which caused players stargate access to be inverted.
This commit is contained in:
@@ -27,6 +27,7 @@ import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static net.knarcraft.stargate.portal.PortalSignDrawer.markPortalWithInvalidGate;
|
||||
@@ -399,9 +400,15 @@ public final class PortalFileHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
Directional buttonData = (Directional) Bukkit.createBlockData(portal.getGate().getPortalButton());
|
||||
buttonData.setFacing(buttonFacing);
|
||||
button.getBlock().setBlockData(buttonData);
|
||||
if (!MaterialHelper.isButtonCompatible(button.getType())) {
|
||||
@NotNull List<Material> possibleMaterials = MaterialHelper.specifiersToMaterials(
|
||||
portal.getGate().getPortalButtonMaterials()).stream().toList();
|
||||
Material buttonType = ListHelper.getRandom(possibleMaterials);
|
||||
|
||||
Directional buttonData = (Directional) Bukkit.createBlockData(buttonType);
|
||||
buttonData.setFacing(buttonFacing);
|
||||
button.getBlock().setBlockData(buttonData);
|
||||
}
|
||||
portal.getStructure().setButton(button);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user