-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
365 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ compileJava { | |
} | ||
|
||
group = 'me.Asleepp' | ||
version = '1.3' | ||
version = '1.4' | ||
|
||
repositories { | ||
mavenCentral() | ||
|
49 changes: 49 additions & 0 deletions
49
src/main/java/me/asleepp/SkriptItemsAdder/elements/conditions/CondGetAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package me.asleepp.SkriptItemsAdder.elements.conditions; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Examples; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.doc.Since; | ||
import ch.njol.skript.lang.Condition; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.event.Event; | ||
import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent; | ||
import org.bukkit.event.block.Action; | ||
|
||
import javax.annotation.Nullable; | ||
@Name("Is Action") | ||
@Description({"This condition checks if the player has interacted with a custom block with either a left or a right click."}) | ||
@Examples({"on interact with custom block: /tif interact action is right click: /t/tkill event-player "}) | ||
@Since("1.4") | ||
public class CondGetAction extends Condition { | ||
|
||
static { | ||
Skript.registerCondition(CondGetAction.class, "[custom|ia|itemsadder] [interact] action is (:right|:left) click"); | ||
} | ||
|
||
private boolean isLeft; | ||
|
||
@Override | ||
public boolean check(Event e) { | ||
CustomBlockInteractEvent event = (CustomBlockInteractEvent) e; | ||
if (isLeft) { | ||
return event.getAction() == Action.LEFT_CLICK_BLOCK; | ||
} else { | ||
return event.getAction() == Action.RIGHT_CLICK_BLOCK; | ||
} | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event e, boolean debug) { | ||
return "interact action is " + (isLeft ? "left" : "right") + " click"; | ||
} | ||
|
||
@Override | ||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { | ||
isLeft = parseResult.hasTag("left"); | ||
return true; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/me/asleepp/SkriptItemsAdder/elements/conditions/CondGetBlockClicked.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package me.asleepp.SkriptItemsAdder.elements.conditions; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Examples; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.doc.Since; | ||
import ch.njol.skript.lang.Condition; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.event.Event; | ||
import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent; | ||
|
||
import javax.annotation.Nullable; | ||
@Name("Is Block Clicked") | ||
@Description({"This condition checks what block the player clicked."}) | ||
@Examples({"on interact with custom block: /tif clicked block is \"diamond_tiles\" /t/tsend \"That's quite valuable.\" "}) | ||
@Since("1.4") | ||
public class CondGetBlockClicked extends Condition { | ||
|
||
private Expression<String> block; | ||
|
||
static { | ||
Skript.registerCondition(CondGetBlockClicked.class, "[the] block clicked is %strings%"); | ||
} | ||
|
||
@Override | ||
public boolean check(Event e) { | ||
if (e instanceof CustomBlockInteractEvent) { | ||
CustomBlockInteractEvent event = (CustomBlockInteractEvent) e; | ||
String clickedBlock = event.getBlockClicked().getType().toString(); | ||
return clickedBlock.equals(block.getSingle(e)); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event e, boolean debug) { | ||
return "[the] block clicked is " + block.toString(e, debug); | ||
} | ||
|
||
@Override | ||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { | ||
block = (Expression<String>) exprs[0]; | ||
return true; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/me/asleepp/SkriptItemsAdder/elements/conditions/CondGetBlockFace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package me.asleepp.SkriptItemsAdder.elements.conditions; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Examples; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.doc.Since; | ||
import ch.njol.skript.lang.Condition; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent; | ||
import org.bukkit.block.BlockFace; | ||
import org.bukkit.event.Event; | ||
|
||
import javax.annotation.Nullable; | ||
@Name("Is Block Face") | ||
@Description({"This condition checks what face of a block the player has interacted with."}) | ||
@Examples({"on interact with custom block: /tif clicked block face is south: /t/tsend \"Why are you doing that?\" "}) | ||
@Since("1.4") | ||
public class CondGetBlockFace extends Condition { | ||
|
||
static { | ||
Skript.registerCondition(CondGetBlockFace.class, "[clicked] block face is (:down|:north|:south|:east|:west|:up)"); | ||
} | ||
|
||
private BlockFace face; | ||
|
||
@Override | ||
public boolean check(Event e) { | ||
CustomBlockInteractEvent event = (CustomBlockInteractEvent) e; | ||
return event.getBlockFace() == face; | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event e, boolean debug) { | ||
return "clicked block face is " + face.toString(); | ||
} | ||
|
||
@Override | ||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { | ||
if (parseResult.hasTag("north")) { | ||
face = BlockFace.NORTH; | ||
} else if (parseResult.hasTag("south")) { | ||
face = BlockFace.SOUTH; | ||
} else if (parseResult.hasTag("east")) { | ||
face = BlockFace.EAST; | ||
} else if (parseResult.hasTag("west")) { | ||
face = BlockFace.WEST; | ||
} else if (parseResult.hasTag("up")) { | ||
face = BlockFace.UP; | ||
} else if (parseResult.hasTag("down")) { | ||
face = BlockFace.DOWN; | ||
} | ||
return true; | ||
} | ||
} |
56 changes: 0 additions & 56 deletions
56
src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffPlayBreakEffect.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/me/asleepp/SkriptItemsAdder/elements/effects/EffRemoveCustomFurniture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package me.asleepp.SkriptItemsAdder.elements.effects; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Examples; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.doc.Since; | ||
import ch.njol.skript.lang.Effect; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import dev.lone.itemsadder.api.CustomBlock; | ||
import dev.lone.itemsadder.api.CustomFurniture; | ||
import org.bukkit.Location; | ||
import org.bukkit.event.Event; | ||
|
||
import javax.annotation.Nullable; | ||
@Name("Remove Custom Furniture") | ||
@Description({"If there is furniture at a location, this effect will remove it."}) | ||
@Examples({"remove custom furniture at player's location"}) | ||
@Since("1.4") | ||
public class EffRemoveCustomFurniture extends Effect { | ||
|
||
static { | ||
Skript.registerEffect(EffRemoveCustomFurniture.class, "(remove|delete) (custom|ia|itemsadder) furniture [%string%] at %locations%"); | ||
} | ||
|
||
private Expression<String> furnitureId; | ||
private Expression<Location> locations; | ||
|
||
@Override | ||
protected void execute(Event e) { | ||
Location[] locs = locations.getAll(e); | ||
String id = furnitureId != null ? furnitureId.getSingle(e) : null; | ||
|
||
for (Location loc : locs) { | ||
if (id != null && loc != null) { | ||
CustomFurniture existingFurniture = CustomFurniture.byAlreadySpawned(loc.getBlock()); | ||
|
||
if (existingFurniture != null) { | ||
existingFurniture.remove(false); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event e, boolean debug) { | ||
return "remove custom furniture " + (furnitureId != null ? furnitureId.toString(e, debug) : "") + " at " + locations.toString(e, debug); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { | ||
furnitureId = (Expression<String>) exprs[0]; | ||
locations = (Expression<Location>) exprs[1]; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.