mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Requested patches
This commit is contained in:
parent
8070b211ab
commit
d56a63e712
@ -15,7 +15,7 @@ import org.bukkit.Location;
|
||||
@Snippet("command")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Desc("Represents a color")
|
||||
@Desc("Represents a set of Iris commands")
|
||||
@Data
|
||||
public class IrisCommand {
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Snippet("command-registry")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Desc("Represents a casting location for a command")
|
||||
@Data
|
||||
public class IrisCommandRegistry {
|
||||
@ArrayType(min = 1, type = IrisCommand.class)
|
||||
@Desc("Run commands, at the exact location of the player")
|
||||
private KList<IrisCommand> rawCommands = new KList<>();
|
||||
@DependsOn({"rawCommands"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetX = 0;
|
||||
@DependsOn({"rawCommands"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetY = 0;
|
||||
@DependsOn({"rawCommands"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetZ = 0;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize the altX from -altX to altX")
|
||||
private boolean commandRandomAltX = true;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize the altY from -altY to altY")
|
||||
private boolean commandRandomAltY = false;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize the altZ from -altZ to altZ")
|
||||
private boolean commandRandomAltZ = true;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize location for all separate commands (true), or run all on the same location (false)")
|
||||
private boolean commandAllRandomLocations = true;
|
||||
|
||||
public void run(Player p) {
|
||||
if (rawCommands.isNotEmpty()) {
|
||||
Location part = p.getLocation().clone().add(
|
||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
||||
for (IrisCommand rawCommand : rawCommands) {
|
||||
rawCommand.run(part);
|
||||
if (commandAllRandomLocations) {
|
||||
part = p.getLocation().clone().add(
|
||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -147,36 +147,10 @@ public class IrisEffect {
|
||||
@MinNumber(1)
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
private int chance = 50;
|
||||
@ArrayType(min = 1, type = IrisCommand.class)
|
||||
@Desc("Run commands, at the exact location of the player")
|
||||
private KList<IrisCommand> rawCommands = new KList<>();
|
||||
@DependsOn({"rawCommands"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetX = 0;
|
||||
@DependsOn({"rawCommands"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetY = 0;
|
||||
@DependsOn({"rawCommands"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetZ = 0;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize the altX from -altX to altX")
|
||||
private boolean commandRandomAltX = true;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize the altY from -altY to altY")
|
||||
private boolean commandRandomAltY = false;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize the altZ from -altZ to altZ")
|
||||
private boolean commandRandomAltZ = true;
|
||||
@DependsOn({"rawCommands"})
|
||||
@Desc("Randomize location for all separate commands (true), or run all on the same location (false)")
|
||||
private boolean commandAllRandomLocations = true;
|
||||
@ArrayType(min = 1, type = IrisCommandRegistry.class)
|
||||
@Desc("Run commands, with configurable location parameters")
|
||||
private IrisCommandRegistry commandRegistry = null;
|
||||
|
||||
|
||||
public boolean canTick() {
|
||||
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
||||
@ -247,20 +221,8 @@ public class IrisEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (rawCommands.isNotEmpty()) {
|
||||
Location part = p.getLocation().clone().add(
|
||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
||||
for (IrisCommand rawCommand : rawCommands) {
|
||||
rawCommand.run(part);
|
||||
if (commandAllRandomLocations) {
|
||||
part = p.getLocation().clone().add(
|
||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
||||
}
|
||||
}
|
||||
if (commandRegistry != null) {
|
||||
commandRegistry.run(p);
|
||||
}
|
||||
|
||||
if (potionStrength > -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user