Skip to content

Commit 8a2c27e

Browse files
committed
Added NONE option to click type
1 parent 3f572c1 commit 8a2c27e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/main/java/world/bentobox/aoneblock/Settings.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.bukkit.GameMode;
1414
import org.bukkit.block.Biome;
1515
import org.bukkit.entity.EntityType;
16-
import org.bukkit.event.inventory.ClickType;
1716

1817
import com.google.common.base.Enums;
1918

@@ -120,9 +119,9 @@ public class Settings implements WorldSettings {
120119

121120
@ConfigComment("Block identification appearance.")
122121
@ConfigComment("Click type that will make particles appear. Options are:")
123-
@ConfigComment("LEFT (default) or RIGHT")
122+
@ConfigComment("LEFT (default), RIGHT, or NONE")
124123
@ConfigEntry(path = "world.block-id.click-type")
125-
private String clickType = ClickType.LEFT.name();
124+
private String clickType = "LEFT";
126125

127126
@ConfigComment("Size of particles. Default is 0.5. Must be greater than 0.")
128127
@ConfigEntry(path = "world.block-id.particle-size")
@@ -2165,7 +2164,8 @@ public void setParticleDensity(Double particleDensity) {
21652164
* @return the clickType
21662165
*/
21672166
public String getClickType() {
2168-
if (clickType == null || (!clickType.equalsIgnoreCase("LEFT") && !clickType.equalsIgnoreCase("RIGHT"))) {
2167+
if (clickType == null || (!clickType.equalsIgnoreCase("LEFT") && !clickType.equalsIgnoreCase("RIGHT")
2168+
&& !clickType.equalsIgnoreCase("NONE"))) {
21692169
clickType = "LEFT";
21702170
}
21712171
return clickType;

src/main/java/world/bentobox/aoneblock/listeners/BlockProtect.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ public BlockProtect(AOneBlock addon) {
4747
*/
4848
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
4949
public void onBlockDamage(PlayerInteractEvent e) {
50-
if (!addon.inWorld(e.getPlayer().getWorld()) || e.getClickedBlock() == null) {
50+
Action action = e.getAction();
51+
String clickType = addon.getSettings().getClickType();
52+
53+
if (clickType.equalsIgnoreCase("NONE") || !addon.inWorld(e.getPlayer().getWorld())
54+
|| e.getClickedBlock() == null) {
5155
return;
5256
}
5357

54-
Action action = e.getAction();
55-
String clickType = addon.getSettings().getClickType();
5658
if ((action == Action.LEFT_CLICK_BLOCK && clickType.equalsIgnoreCase("LEFT"))
5759
|| (action == Action.RIGHT_CLICK_BLOCK && clickType.equalsIgnoreCase("RIGHT"))) {
5860

src/main/resources/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ world:
6464
block-id:
6565
# Block identification appearance.
6666
# Click type that will make particles appear. Options are:
67-
# LEFT (default) or RIGHT
67+
# LEFT (default), RIGHT, or NONE
6868
click-type: RIGHT
6969
# Size of particles. Default is 0.7. Must be greater than 0.
7070
particle-size: 0.5

0 commit comments

Comments
 (0)