Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 11f543d

Browse files
committed
Version 1.4.1
1 parent ad52806 commit 11f543d

File tree

9 files changed

+36
-60
lines changed

9 files changed

+36
-60
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ compileJava {
1515
}
1616

1717
group = 'me.Asleepp'
18-
version = '1.4'
18+
version = '1.4.1'
1919

2020
repositories {
2121
mavenCentral()

src/main/java/me/asleepp/SkriptItemsAdder/elements/conditions/CondGetAction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class CondGetAction extends Condition {
2828

2929
@Override
3030
public boolean check(Event e) {
31+
if (!(e instanceof CustomBlockInteractEvent)) {
32+
return false;
33+
}
3134
CustomBlockInteractEvent event = (CustomBlockInteractEvent) e;
3235
if (isLeft) {
3336
return event.getAction() == Action.LEFT_CLICK_BLOCK;
@@ -36,14 +39,20 @@ public boolean check(Event e) {
3639
}
3740
}
3841

42+
3943
@Override
4044
public String toString(@Nullable Event e, boolean debug) {
4145
return "interact action is " + (isLeft ? "left" : "right") + " click";
4246
}
4347

4448
@Override
4549
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
50+
if (!getParser().isCurrentEvent(CustomBlockInteractEvent.class)) {
51+
Skript.error("You can't use 'interact action is (:right|:left) click' outside of a custom block interact event!");
52+
return false;
53+
}
4654
isLeft = parseResult.hasTag("left");
4755
return true;
4856
}
57+
4958
}

src/main/java/me/asleepp/SkriptItemsAdder/elements/conditions/CondGetBlockClicked.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ public String toString(@Nullable Event e, boolean debug) {
4242

4343
@Override
4444
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
45+
if (!getParser().isCurrentEvent(CustomBlockInteractEvent.class)) {
46+
Skript.error("You can't use 'the block clicked is ...' outside of a custom block interact event!");
47+
return false;
48+
}
4549
block = (Expression<String>) exprs[0];
4650
return true;
4751
}
52+
4853
}

src/main/java/me/asleepp/SkriptItemsAdder/elements/conditions/CondGetBlockFace.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,25 @@ public class CondGetBlockFace extends Condition {
2828

2929
@Override
3030
public boolean check(Event e) {
31+
if (!(e instanceof CustomBlockInteractEvent)) {
32+
return false;
33+
}
3134
CustomBlockInteractEvent event = (CustomBlockInteractEvent) e;
3235
return event.getBlockFace() == face;
3336
}
3437

38+
3539
@Override
3640
public String toString(@Nullable Event e, boolean debug) {
3741
return "clicked block face is " + face.toString();
3842
}
3943

4044
@Override
4145
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
46+
if (!getParser().isCurrentEvent(CustomBlockInteractEvent.class)) {
47+
Skript.error("You can't use 'clicked block face is (:down|:north|:south|:east|:west|:up)' outside of a custom block interact event!");
48+
return false;
49+
}
4250
if (parseResult.hasTag("north")) {
4351
face = BlockFace.NORTH;
4452
} else if (parseResult.hasTag("south")) {

src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffReplaceCustomFurniture.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ protected void execute(Event e) {
3434
Location loc = location.getSingle(e);
3535
if (id != null && loc != null) {
3636
CustomFurniture existingFurniture = CustomFurniture.byAlreadySpawned(loc.getBlock());
37-
if (existingFurniture != null) {
38-
existingFurniture.replaceFurniture(id);
37+
if (existingFurniture != null) {
38+
existingFurniture.replaceFurniture(id);
3939
}
4040
}
4141
}

src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffSetToolUsages.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/main/java/me/asleepp/SkriptItemsAdder/elements/events/EvtCustomBlockInteract.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import dev.lone.itemsadder.api.CustomBlock;
1414
import dev.lone.itemsadder.api.Events.CustomBlockBreakEvent;
1515
import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent;
16+
import org.bukkit.block.Block;
1617
import org.bukkit.event.Event;
1718

1819
import javax.annotation.Nullable;
@@ -26,14 +27,15 @@ public class EvtCustomBlockInteract extends SkriptEvent {
2627

2728
static {
2829
Skript.registerEvent("Custom Block Interact", EvtCustomBlockInteract.class, CustomBlockInteractEvent.class, "interact with (custom|ia|itemsadder) block [%string%]");
29-
EventValues.registerEventValue(CustomBlockBreakEvent.class, CustomBlock.class, new Getter<CustomBlock, CustomBlockBreakEvent>() {
30+
EventValues.registerEventValue(CustomBlockInteractEvent.class, Block.class, new Getter<Block, CustomBlockInteractEvent>() {
3031
@Override
31-
public CustomBlock get(CustomBlockBreakEvent event) {
32-
return CustomBlock.byAlreadyPlaced(event.getBlock());
32+
public Block get(CustomBlockInteractEvent event) {
33+
return event.getBlockClicked();
3334
}
3435
}, 0);
3536
}
3637

38+
3739
@SuppressWarnings("unchecked")
3840
@Override
3941
public boolean init(Literal<?>[] args, int matchedPattern, SkriptParser.ParseResult parseResult) {

src/main/java/me/asleepp/SkriptItemsAdder/elements/expressions/ExprGetCustomBlockItem.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public String toString(@Nullable Event e, boolean debug) {
5151

5252
@Override
5353
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
54+
if (!getParser().isCurrentEvent(CustomBlockInteractEvent.class)) {
55+
Skript.error("You can't use 'the item linked/associated with the block' outside of a custom block interact event!");
56+
return false;
57+
}
5458
return true;
5559
}
60+
5661
}

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: skript-itemsadder
22
authors: [Asleepp]
33
description: A Skript Addon that adds useful syntax to be used in conjunction with ItemsAdder
44
api-version: 1.13
5-
version: 1.4
5+
version: 1.4.1
66
main: me.asleepp.SkriptItemsAdder.SkriptItemsAdder
77
depend: [Skript, ItemsAdder]

0 commit comments

Comments
 (0)