-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
168 additions
and
35 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
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
65 changes: 65 additions & 0 deletions
65
...in/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprBottomRightSchematic.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,65 @@ | ||
package net.rayfall.eyesniper2.skRayFall.CitizenExpressions; | ||
|
||
import net.citizensnpcs.api.CitizensAPI; | ||
import net.citizensnpcs.api.npc.NPC; | ||
import net.citizensnpcs.api.npc.NPCRegistry; | ||
import net.jrbudda.builder.BuilderTrait; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.event.Event; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser.ParseResult; | ||
import ch.njol.skript.lang.util.SimpleExpression; | ||
import ch.njol.util.Kleenean; | ||
|
||
public class ExprBottomRightSchematic extends SimpleExpression<Location>{ | ||
|
||
//for builder %number% get the location of the bottom right of schematic centered at %location% | ||
|
||
private Expression<Number> id; | ||
private Expression<Location> loc; | ||
|
||
@Override | ||
public Class<? extends Location> getReturnType() { | ||
return Location.class; | ||
} | ||
|
||
@Override | ||
public boolean isSingle() { | ||
return true; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, | ||
ParseResult arg3) { | ||
id = (Expression<Number>) e[0]; | ||
loc = (Expression<Location>) e[1]; | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event evt, boolean arg1) { | ||
return null; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
protected Location[] get(Event evt) { | ||
NPCRegistry registry = CitizensAPI.getNPCRegistry(); | ||
NPC npc = registry.getById(id.getSingle(evt).intValue()); | ||
BuilderTrait bt = npc.getTrait(BuilderTrait.class); | ||
if (bt.schematic != null){ | ||
Location bottomRight = loc.getSingle(evt).add((-1 * Math.floor(bt.schematic.width() / 2)), -1, (-1 * Math.floor(bt.schematic.length() / 2))); | ||
return new Location[] {bottomRight}; | ||
} | ||
else{ | ||
Skript.error("A schematic has yet to be loaded for this Builder"); | ||
return new Location[] {loc.getSingle(evt)}; | ||
} | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprTopLeftSchematic.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,65 @@ | ||
package net.rayfall.eyesniper2.skRayFall.CitizenExpressions; | ||
|
||
import net.citizensnpcs.api.CitizensAPI; | ||
import net.citizensnpcs.api.npc.NPC; | ||
import net.citizensnpcs.api.npc.NPCRegistry; | ||
import net.jrbudda.builder.BuilderTrait; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.event.Event; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser.ParseResult; | ||
import ch.njol.skript.lang.util.SimpleExpression; | ||
import ch.njol.util.Kleenean; | ||
|
||
public class ExprTopLeftSchematic extends SimpleExpression<Location>{ | ||
|
||
private Expression<Number> id; | ||
private Expression<Location> loc; | ||
|
||
//for builder %number% get the location of the top left of schematic centered at %location% | ||
|
||
@Override | ||
public Class<? extends Location> getReturnType() { | ||
return Location.class; | ||
} | ||
|
||
@Override | ||
public boolean isSingle() { | ||
return true; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, | ||
ParseResult arg3) { | ||
id = (Expression<Number>) e[0]; | ||
loc = (Expression<Location>) e[1]; | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event evt, boolean arg1) { | ||
return null; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
protected Location[] get(Event evt) { | ||
NPCRegistry registry = CitizensAPI.getNPCRegistry(); | ||
NPC npc = registry.getById(id.getSingle(evt).intValue()); | ||
BuilderTrait bt = npc.getTrait(BuilderTrait.class); | ||
if (bt.schematic != null){ | ||
Location topLeft = loc.getSingle(evt).add((Math.round(bt.schematic.width() / 2)), bt.schematic.height() - 1, (Math.round(bt.schematic.length() / 2))); | ||
return new Location[] {topLeft}; | ||
} | ||
else{ | ||
Skript.error("A schematic has yet to be loaded for this Builder"); | ||
return new Location[] {loc.getSingle(evt)}; | ||
} | ||
} | ||
|
||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.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
8 changes: 4 additions & 4 deletions
8
src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffActionBar.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
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
12 changes: 6 additions & 6 deletions
12
src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTitle.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/rayfall/eyesniper2/skRayFall/utli/PacketParticleGetter.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
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