Makes it easier to use any compatible block as a button
This commit is contained in:
parent
7b9f5a6de5
commit
095e59c65e
13
README.md
13
README.md
@ -138,11 +138,21 @@ X*.X
|
||||
XX
|
||||
```
|
||||
The keys `portal-open` and `portal-closed` are used to define the material in the gate when it is open or closed.
|
||||
The key `button` is used to define the type of button that is generated for this gate. It must be a button material.
|
||||
The key `button` is used to define the type of button that is generated for this gate. It can be a button (of any type),
|
||||
a type of wall coral (dead or alive), a type of shulker box or a chest.
|
||||
`X` and `-` are used to define block types for the layout (Any single-character can be used, such as `#`).
|
||||
In the gate format, you can see we use `X` to show where obsidian must be, `-` where the controls (Button/sign) are.
|
||||
You will also notice a `*` in the gate layout, this is the "exit point" of the gate, the block at which the player will teleport in front of.
|
||||
|
||||
# Underwater Portals
|
||||
You can add a custom portal which will work underwater. You need to use `WATER`, not `AIR`, for the `portal-closed` material.
|
||||
|
||||
The button must be a type of wall coral, like `BRAIN_CORAL_WALL_FAN` or `DEAD_BRAIN_CORAL_WALL_FAN`.
|
||||
|
||||
Using `KELP_PLANT` as `portal-open` looks the part, but there are no particular restrictions.
|
||||
|
||||
Any solid block can be used for the frame.
|
||||
|
||||
# Configuration
|
||||
```
|
||||
default-gate-network - The default gate network
|
||||
@ -228,6 +238,7 @@ bungeeSign=Teleport to
|
||||
- Uses text from the language files in more places
|
||||
- Changes how backup language works, causing english strings to be shown if not available from the chosen language
|
||||
- Removes some pre-UUID code
|
||||
- Adds underwater portals
|
||||
#### \[Version 0.8.0.3] PseudoKnight fork
|
||||
- Fix economy
|
||||
- Add custom buttons
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.knarcraft.stargate;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
@ -399,7 +398,7 @@ public class Gate {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Tag.BUTTONS.isTagged(gate.button) && !MaterialHelper.isWallCoral(gate.button)) {
|
||||
if (!MaterialHelper.isButtonCompatible(gate.button)) {
|
||||
Stargate.log.log(Level.SEVERE, "Could not load Gate " + file.getName() + " - Gate button must be a type of button.");
|
||||
return null;
|
||||
}
|
||||
|
@ -22,4 +22,14 @@ public class MaterialHelper {
|
||||
material.equals(Material.DEAD_TUBE_CORAL_WALL_FAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given material can be used as a button
|
||||
* @param material <p>The material to check</p>
|
||||
* @return <p>True if the material can be used as a button</p>
|
||||
*/
|
||||
public static boolean isButtonCompatible(Material material) {
|
||||
return Tag.BUTTONS.isTagged(material) || isWallCoral(material) || Tag.SHULKER_BOXES.isTagged(material) ||
|
||||
material == Material.CHEST;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.knarcraft.stargate;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.WallSign;
|
||||
@ -230,7 +229,7 @@ public class PlayerEventsListener implements Listener {
|
||||
}
|
||||
|
||||
// Implement right-click to toggle a stargate, gets around spawn protection problem.
|
||||
if (Tag.BUTTONS.isTagged(block.getType()) || MaterialHelper.isWallCoral(block.getType())) {
|
||||
if (MaterialHelper.isButtonCompatible(block.getType())) {
|
||||
|
||||
if (MaterialHelper.isWallCoral(block.getType())) {
|
||||
if (previousEvent != null &&
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.EndGateway;
|
||||
@ -846,7 +845,7 @@ public class Stargate extends JavaPlugin {
|
||||
// Handle keeping portal material and buttons around
|
||||
if (block.getType() == Material.NETHER_PORTAL) {
|
||||
portal = Portal.getByEntrance(block);
|
||||
} else if (Tag.BUTTONS.isTagged(block.getType()) || MaterialHelper.isWallCoral(block.getType())) {
|
||||
} else if (MaterialHelper.isButtonCompatible(block.getType())) {
|
||||
portal = Portal.getByControl(block);
|
||||
}
|
||||
if (portal != null) event.setCancelled(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user