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

Commit 1f49293

Browse files
committed
Version 1.3
1 parent ec09af5 commit 1f49293

File tree

4 files changed

+101
-2
lines changed

4 files changed

+101
-2
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.2'
18+
version = '1.3'
1919

2020
repositories {
2121
mavenCentral()
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package me.asleepp.SkriptItemsAdder.elements.effects;
2+
3+
import ch.njol.skript.Skript;
4+
import ch.njol.skript.doc.Description;
5+
import ch.njol.skript.doc.Examples;
6+
import ch.njol.skript.doc.Name;
7+
import ch.njol.skript.doc.Since;
8+
import ch.njol.skript.lang.Effect;
9+
import ch.njol.skript.lang.Expression;
10+
import ch.njol.skript.lang.SkriptParser;
11+
import ch.njol.util.Kleenean;
12+
import org.bukkit.event.Event;
13+
import dev.lone.itemsadder.api.CustomFurniture;
14+
import org.bukkit.Location;
15+
16+
import javax.annotation.Nullable;
17+
18+
@Name("Place Custom Furniture")
19+
@Description({"Place a custom furniture at a location."})
20+
@Examples({"place custom furniture \"comfy_chair\" at player's location"})
21+
@Since("1.3")
22+
public class EffPlaceCustomFurniture extends Effect {
23+
24+
private Expression<String> furnitureId;
25+
private Expression<Location> location;
26+
27+
static {
28+
Skript.registerEffect(EffPlaceCustomFurniture.class, "(set|place) (custom|ia|itemsadder) furniture %string% at %location%");
29+
}
30+
31+
@Override
32+
protected void execute(Event e) {
33+
String id = furnitureId.getSingle(e);
34+
Location loc = location.getSingle(e);
35+
36+
if (id != null && loc != null) {
37+
CustomFurniture.spawn(id, loc.getBlock());
38+
}
39+
}
40+
41+
@Override
42+
public String toString(@Nullable Event e, boolean debug) {
43+
return "(set|place) (custom|ia|itemsadder) furniture " + furnitureId.toString(e, debug) + " at " + location.toString(e, debug);
44+
}
45+
46+
@Override
47+
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
48+
furnitureId = (Expression<String>) exprs[0];
49+
location = (Expression<Location>) exprs[1];
50+
return true;
51+
}
52+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package me.asleepp.SkriptItemsAdder.elements.effects;
2+
3+
import ch.njol.skript.Skript;
4+
import ch.njol.skript.lang.Effect;
5+
import ch.njol.skript.lang.Expression;
6+
import ch.njol.skript.lang.SkriptParser;
7+
import ch.njol.util.Kleenean;
8+
import dev.lone.itemsadder.api.CustomStack;
9+
import org.bukkit.event.Event;
10+
import org.bukkit.inventory.ItemStack;
11+
12+
import javax.annotation.Nullable;
13+
14+
public class EffSetToolUsages extends Effect {
15+
private Expression<ItemStack> tool;
16+
private Expression<Integer> usages;
17+
18+
19+
static {
20+
Skript.registerEffect(EffSetToolUsages.class, "set usages of %itemstack% to %integer%");
21+
}
22+
23+
@Override
24+
protected void execute(Event e) {
25+
ItemStack tool = this.tool.getSingle(e);
26+
Integer usages = this.usages.getSingle(e);
27+
28+
if (tool != null && usages != null) {
29+
CustomStack customStack = CustomStack.byItemStack(tool);
30+
if (customStack != null) {
31+
customStack.setUsages(usages);
32+
}
33+
}
34+
}
35+
36+
@Override
37+
public String toString(Event e, boolean debug) {
38+
return "set usages of " + tool.toString(e, debug) + " to " + usages.toString(e, debug);
39+
}
40+
41+
@Override
42+
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
43+
tool = (Expression<ItemStack>) exprs[0];
44+
usages = (Expression<Integer>) exprs[1];
45+
return true;
46+
}
47+
}

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.2
5+
version: 1.3
66
main: me.asleepp.SkriptItemsAdder.SkriptItemsAdder
77
depend: [Skript, ItemsAdder]

0 commit comments

Comments
 (0)