mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 10:30:53 +00:00
Compare commits
39 Commits
2.3.14-1.1
...
2.4.2-1.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ec2f8fb7b | ||
|
|
6c5fac154e | ||
|
|
540ab8f0d2 | ||
|
|
17d2ac8d70 | ||
|
|
a6ebdead19 | ||
|
|
aa7631ecd0 | ||
|
|
4e138cad9f | ||
|
|
7e55b5fcee | ||
|
|
e19e5278b4 | ||
|
|
dfcd2dc83e | ||
|
|
8775f842e6 | ||
|
|
7b07a4ba6c | ||
|
|
d78e5973e9 | ||
|
|
110d296184 | ||
|
|
23cd5c117b | ||
|
|
131c4692bc | ||
|
|
f6571367db | ||
|
|
f5c64c7480 | ||
|
|
085f63a915 | ||
|
|
3e022e1931 | ||
|
|
0dba3725ae | ||
|
|
8bb409df4e | ||
|
|
603168a147 | ||
|
|
2a95edd860 | ||
|
|
e94406fb45 | ||
|
|
e5a7b5d0c6 | ||
|
|
d6f816fe2f | ||
|
|
c15d4a349f | ||
|
|
3ce832583c | ||
|
|
5514fd2645 | ||
|
|
66d07dcaca | ||
|
|
c1cf8e88ee | ||
|
|
684bd739b9 | ||
|
|
d4c0e07b1d | ||
|
|
a6ea6fcfb2 | ||
|
|
c366ec0c40 | ||
|
|
8d715e2e4e | ||
|
|
dea3ec80ac | ||
|
|
4053f05ba9 |
@@ -24,7 +24,7 @@ plugins {
|
||||
id "de.undercouch.download" version "5.0.1"
|
||||
}
|
||||
|
||||
version '2.3.14-1.19.3' // Needs to be version specific
|
||||
version '2.4.1-1.19.3'
|
||||
def nmsVersion = "1.19.3" //[NMS]
|
||||
def apiVersion = '1.19'
|
||||
def specialSourceVersion = '1.11.0' //[NMS]
|
||||
@@ -37,7 +37,7 @@ def main = 'com.volmit.iris.Iris'
|
||||
registerCustomOutputTask('Cyberpwn', 'C://Users/cyberpwn/Documents/development/server/plugins')
|
||||
registerCustomOutputTask('Psycho', 'C://Dan/MinecraftDevelopment/Server/plugins')
|
||||
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins')
|
||||
registerCustomOutputTask('Coco', 'D://Documents/MC/plugins')
|
||||
registerCustomOutputTask('Coco', 'D://mcsm/plugins')
|
||||
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.3/plugins')
|
||||
// ========================== UNIX ==============================
|
||||
@@ -75,7 +75,7 @@ repositories {
|
||||
}
|
||||
}
|
||||
maven { url "https://arcanearts.jfrog.io/artifactory/archives" }
|
||||
|
||||
maven { url "https://mvn.lumine.io/repository/maven-public/" }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,6 +134,7 @@ dependencies {
|
||||
implementation "net.kyori:adventure-text-minimessage:4.11.0"
|
||||
implementation 'net.kyori:adventure-platform-bukkit:4.1.0'
|
||||
implementation 'net.kyori:adventure-api:4.11.0'
|
||||
implementation 'io.lumine:Mythic-Dist:5.2.1'
|
||||
|
||||
// Dynamically Loaded
|
||||
implementation 'io.timeandspace:smoothie-map:2.0.2'
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.object.IrisEntity;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.decree.DecreeContext;
|
||||
@@ -40,7 +41,9 @@ import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -325,7 +328,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
C.YELLOW + " - Caves not lining up",
|
||||
C.YELLOW + " - Terrain layers not lining up",
|
||||
C.RED + "Now that you are aware of the risks, and have made a back-up:",
|
||||
C.RED + "/iris ^world <world> <pack> confirm=true"
|
||||
C.RED + "/iris ^world " + world.getName() + " " + pack.getLoadKey() + " confirm=true"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -464,19 +464,16 @@ public class CommandStudio implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "Done! " + report.getPath());
|
||||
}
|
||||
|
||||
@Decree(description = "Summon an Iris Entity", origin = DecreeOrigin.PLAYER)
|
||||
public void summon(
|
||||
@Param(description = "The Iris Entity to spawn")
|
||||
@Decree(description = "Spawn an Iris entity", aliases = "summon", origin = DecreeOrigin.PLAYER)
|
||||
public void spawn(
|
||||
@Param(description = "The entity to spawn")
|
||||
IrisEntity entity,
|
||||
@Param(description = "The location at which to spawn the entity", defaultValue = "self")
|
||||
@Param(description = "The location to spawn the entity at", contextual = true)
|
||||
Vector location
|
||||
) {
|
||||
if (!sender().isPlayer()) {
|
||||
sender().sendMessage(C.RED + "Players only (this is a config error. Ask support to add DecreeOrigin.PLAYER to the command you tried to run)");
|
||||
return;
|
||||
if (!IrisToolbelt.isIrisWorld(player().getWorld())) {
|
||||
sender().sendMessage(C.RED + "You have to be in an Iris world to spawn entities properly. Trying to spawn the best we can do.");
|
||||
}
|
||||
|
||||
sender().sendMessage(C.GREEN + "Spawning entity");
|
||||
entity.spawn(engine(), new Location(world(), location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package com.volmit.iris.core.gui.components;
|
||||
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisBiomeGeneratorLink;
|
||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -49,6 +51,23 @@ public class IrisRenderer {
|
||||
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
||||
case HEIGHT ->
|
||||
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
||||
case CONTINENT ->
|
||||
colorFunction = (x, z) -> {
|
||||
IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z));
|
||||
IrisBiomeGeneratorLink g = b.getGenerators().get(0);
|
||||
Color c;
|
||||
if (g.getMax() <= 0) {
|
||||
// Max is below water level, so it is most likely an ocean biome
|
||||
c = Color.BLUE;
|
||||
} else if (g.getMin() < 0) {
|
||||
// Min is below water level, but max is not, so it is most likely a shore biome
|
||||
c = Color.YELLOW;
|
||||
} else {
|
||||
// Both min and max are above water level, so it is most likely a land biome
|
||||
c = Color.GREEN;
|
||||
}
|
||||
return c.getRGB();
|
||||
};
|
||||
}
|
||||
|
||||
double x, z;
|
||||
|
||||
@@ -19,5 +19,5 @@
|
||||
package com.volmit.iris.core.gui.components;
|
||||
|
||||
public enum RenderType {
|
||||
BIOME, BIOME_LAND, BIOME_SEA, REGION, CAVE_LAND, HEIGHT, OBJECT_LOAD, DECORATOR_LOAD, LAYER_LOAD
|
||||
BIOME, BIOME_LAND, BIOME_SEA, REGION, CAVE_LAND, HEIGHT, OBJECT_LOAD, DECORATOR_LOAD, CONTINENT, LAYER_LOAD
|
||||
}
|
||||
|
||||
@@ -18,23 +18,17 @@
|
||||
|
||||
package com.volmit.iris.core.link;
|
||||
|
||||
import io.lumine.mythic.bukkit.MythicBukkit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class MythicMobsLink {
|
||||
|
||||
private Collection<String> mobs;
|
||||
private BiFunction<String, Location, Entity> spawnMobFunction;
|
||||
|
||||
public MythicMobsLink() {
|
||||
|
||||
}
|
||||
@@ -56,59 +50,10 @@ public class MythicMobsLink {
|
||||
*/
|
||||
public @Nullable
|
||||
Entity spawnMob(String mob, Location location) {
|
||||
if (!isEnabled()) return null;
|
||||
|
||||
if (spawnMobFunction != null) {
|
||||
return spawnMobFunction.apply(mob, location);
|
||||
}
|
||||
|
||||
try {
|
||||
Class<?> mythicMobClass = Class.forName("io.lumine.mythic.bukkit.MythicBukkit");
|
||||
Method getInst = mythicMobClass.getDeclaredMethod("inst");
|
||||
Object inst = getInst.invoke(null);
|
||||
Method getAPIHelper = mythicMobClass.getDeclaredMethod("getAPIHelper");
|
||||
Object apiHelper = getAPIHelper.invoke(inst);
|
||||
Method spawnMobMethod = apiHelper.getClass().getDeclaredMethod("spawnMythicMob", String.class, Location.class);
|
||||
|
||||
spawnMobFunction = (str, loc) -> {
|
||||
try {
|
||||
return (Entity) spawnMobMethod.invoke(apiHelper, str, loc);
|
||||
} catch (InvocationTargetException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
return spawnMobFunction.apply(mob, location);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
return null;
|
||||
return isEnabled() ? MythicBukkit.inst().getMobManager().spawnMob(mob, location).getEntity().getBukkitEntity() : null;
|
||||
}
|
||||
|
||||
public Collection<String> getMythicMobTypes() {
|
||||
if (mobs != null) {
|
||||
return mobs;
|
||||
}
|
||||
|
||||
if (isEnabled()) {
|
||||
|
||||
try {
|
||||
Class<?> mythicMobClass = Class.forName("io.lumine.xikage.mythicmobs.MythicMobs");
|
||||
Method getInst = mythicMobClass.getDeclaredMethod("inst");
|
||||
Object inst = getInst.invoke(null);
|
||||
Method getMobManager = mythicMobClass.getDeclaredMethod("getMobManager");
|
||||
Object mobManager = getMobManager.invoke(inst);
|
||||
Method getMobNames = mobManager.getClass().getDeclaredMethod("getMobNames");
|
||||
mobs = (Collection<String>) getMobNames.invoke(mobManager);
|
||||
return mobs;
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
|
||||
IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
return isEnabled() ? MythicBukkit.inst().getMobManager().getMobNames() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,6 @@ public class IrisComplex implements DataProvider {
|
||||
return seaBiomeStream;
|
||||
case SHORE:
|
||||
return shoreBiomeStream;
|
||||
case DEFER:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,5 @@ public enum InferredType {
|
||||
SEA,
|
||||
|
||||
@Desc("Represents any cave biome type")
|
||||
CAVE,
|
||||
|
||||
@Desc("Defers the type to whatever another biome type that already exists is.")
|
||||
DEFER
|
||||
CAVE
|
||||
}
|
||||
|
||||
@@ -484,11 +484,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
});
|
||||
}
|
||||
|
||||
public IrisBiome infer(InferredType t, InferredType type) {
|
||||
setInferredType(t.equals(InferredType.DEFER) ? type : t);
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||
KList<BlockData> data = new KList<>();
|
||||
|
||||
|
||||
@@ -154,6 +154,9 @@ public class IrisEntity extends IrisRegistrant {
|
||||
@Desc("Create a mob from another plugin, such as Mythic Mobs. Should be in the format of a namespace of PluginName:MobName")
|
||||
private String specialType = "";
|
||||
|
||||
@Desc("Set to true if you want to apply all of the settings here to the mob, even though an external plugin has already done so. Scripts are always applied.")
|
||||
private boolean applySettingsToCustomMobAnyways = false;
|
||||
|
||||
@Desc("Set the entity type to UNKNOWN, then define a script here which ends with the entity variable (the result). You can use Iris.getLocation() to find the target location. You can spawn any entity this way.")
|
||||
@RegistryListResource(IrisScript.class)
|
||||
private String spawnerScript = "";
|
||||
@@ -211,6 +214,10 @@ public class IrisEntity extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
|
||||
if (isSpecialType() && !applySettingsToCustomMobAnyways) {
|
||||
return ee;
|
||||
}
|
||||
|
||||
if (ee == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -413,7 +420,7 @@ public class IrisEntity extends IrisRegistrant {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (type.equals(EntityType.UNKNOWN)) {
|
||||
if (type.equals(EntityType.UNKNOWN) && !isSpecialType()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("carving")
|
||||
@Snippet("image-map")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@@ -68,6 +68,7 @@ public class IrisImageMap {
|
||||
IrisImage i = imageCache.aquire(() -> data.getImageLoader().load(image));
|
||||
if (i == null) {
|
||||
Iris.error("NULL IMAGE FOR " + image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IrisInterpolation.getNoise(interpolationMethod, x, z, coordinateScale, (xx, zz) -> rawNoise(i, xx, zz));
|
||||
@@ -76,11 +77,27 @@ public class IrisImageMap {
|
||||
private double rawNoise(IrisImage i, double x, double z) {
|
||||
x /= coordinateScale;
|
||||
z /= coordinateScale;
|
||||
x = isCentered() ? x + ((i.getWidth() / 2D) * coordinateScale) : x;
|
||||
z = isCentered() ? z + ((i.getHeight() / 2D) * coordinateScale) : z;
|
||||
x = isTiled() ? x % i.getWidth() : x;
|
||||
z = isTiled() ? z % i.getHeight() : z;
|
||||
|
||||
// X and Z are now scaled to the image
|
||||
|
||||
// Add half the image width & height if centered
|
||||
if (isCentered()) {
|
||||
x += i.getWidth() / 2D;
|
||||
z += i.getHeight() / 2D;
|
||||
}
|
||||
|
||||
// If tiled modulo over width and height
|
||||
if (isTiled()) {
|
||||
x = x % i.getWidth();
|
||||
x = x < 0 ? x + i.getWidth() : x; // Fix java's negative modulo shit
|
||||
z = z % i.getHeight();
|
||||
z = z < 0 ? z + i.getHeight() : z; // Fix java's negative modulo shit
|
||||
}
|
||||
|
||||
// Retrieve value from image
|
||||
double v = i.getValue(getChannel(), (int) x, (int) z);
|
||||
|
||||
// Return value, or 1 - value if inverted (value is in double set [0, 1] so this will return [0, 1])
|
||||
return isInverted() ? 1D - v : v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,16 +30,14 @@ import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.math.AxisAlignedBB;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.math.*;
|
||||
import com.volmit.iris.util.matter.MatterMarker;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.IrisLock;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import com.volmit.iris.util.stream.ProceduralStream;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -496,6 +494,30 @@ public class IrisObject extends IrisRegistrant {
|
||||
public int place(int x, int yv, int z, IObjectPlacer oplacer, IrisObjectPlacement config, RNG rng, BiConsumer<BlockPosition, BlockData> listener, CarveResult c, IrisData rdata) {
|
||||
IObjectPlacer placer = (config.getHeightmap() != null) ? new HeightmapObjectPlacer(oplacer.getEngine() == null ? IrisContext.get().getEngine() : oplacer.getEngine(), rng, x, yv, z, config, oplacer) : oplacer;
|
||||
|
||||
// Rotation calculation
|
||||
int slopeRotationY = 0;
|
||||
ProceduralStream<Double> heightStream = rdata.getEngine().getComplex().getHeightStream();
|
||||
if (config.isRotateTowardsSlope()) {
|
||||
// Whichever side of the rectangle that bounds the object is lowest is the 'direction' of the slope (simply said).
|
||||
double hNorth = heightStream.get(x, z + ((float)d) / 2);
|
||||
double hEast = heightStream.get(x + ((float)w) / 2, z);
|
||||
double hSouth = heightStream.get(x, z - ((float)d) / 2);
|
||||
double hWest = heightStream.get(x - ((float)w) / 2, z);
|
||||
double min = Math.min(Math.min(hNorth, hEast), Math.min(hSouth, hWest));
|
||||
if (min == hNorth) {
|
||||
slopeRotationY = 0;
|
||||
} else if (min == hEast) {
|
||||
slopeRotationY = 90;
|
||||
} else if (min == hSouth) {
|
||||
slopeRotationY = 180;
|
||||
} else if (min == hWest) {
|
||||
slopeRotationY = 270;
|
||||
}
|
||||
}
|
||||
double newRotation = config.getRotation().getYAxis().getMin() + slopeRotationY;
|
||||
config.getRotation().setYAxis(new IrisAxisRotationClamp(true, false, newRotation, newRotation, 360));
|
||||
config.getRotation().setEnabled(true);
|
||||
|
||||
if (config.isSmartBore()) {
|
||||
ensureSmartBored(placer.isDebugSmartBore());
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ public class IrisObjectPlacement {
|
||||
private double snow = 0;
|
||||
@Desc("Whether or not this object can be targeted by a dolphin.")
|
||||
private boolean isDolphinTarget = false;
|
||||
@Desc("Set to true to add the rotation of the direction of the slope of the terrain (wherever the slope is going down) to the y-axis rotation of the object." +
|
||||
"Rounded to 90 degrees. Adds the *min* rotation of the y axis as well (to still allow you to rotate objects nicely). Discards *max* and *interval* on *yaxis*")
|
||||
private boolean rotateTowardsSlope = false;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
|
||||
|
||||
@@ -76,17 +76,17 @@ public class IrisSpawner extends IrisRegistrant {
|
||||
public boolean isValid(IrisBiome biome) {
|
||||
return switch (group) {
|
||||
case NORMAL -> switch (biome.getInferredType()) {
|
||||
case SHORE, SEA, CAVE, DEFER -> false;
|
||||
case SHORE, SEA, CAVE -> false;
|
||||
case LAND -> true;
|
||||
};
|
||||
case CAVE -> true;
|
||||
case UNDERWATER -> switch (biome.getInferredType()) {
|
||||
case SHORE, LAND, CAVE, DEFER -> false;
|
||||
case SHORE, LAND, CAVE -> false;
|
||||
case SEA -> true;
|
||||
};
|
||||
case BEACH -> switch (biome.getInferredType()) {
|
||||
case SHORE -> true;
|
||||
case LAND, CAVE, SEA, DEFER -> false;
|
||||
case LAND, CAVE, SEA -> false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.decree.context;
|
||||
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.util.decree.DecreeContextHandler;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class VectorContextHandler implements DecreeContextHandler<Vector> {
|
||||
public Class<Vector> getType() {
|
||||
return Vector.class;
|
||||
}
|
||||
|
||||
public Vector handle(VolmitSender sender) {
|
||||
if (sender.isPlayer()) {
|
||||
return sender.player().getLocation().toVector();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class DimensionHandler implements DecreeParameterHandler<IrisDimension> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).toList().get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Dimension \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Entity \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class GeneratorHandler implements DecreeParameterHandler<IrisGenerator> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Generator \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PlayerHandler implements DecreeParameterHandler<Player> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Player \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class RegionHandler implements DecreeParameterHandler<IrisRegion> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Region \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ScriptHandler implements DecreeParameterHandler<IrisScript> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Script \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class WorldHandler implements DecreeParameterHandler<World> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which World \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ObjectHandler implements DecreeParameterHandler<String> {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
|
||||
throw new DecreeParsingException("Unable to filter which Object \"" + in + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,7 @@ import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.decree.DecreeContext;
|
||||
import com.volmit.iris.util.decree.DecreeContextHandler;
|
||||
import com.volmit.iris.util.decree.DecreeNode;
|
||||
import com.volmit.iris.util.decree.DecreeParameter;
|
||||
import com.volmit.iris.util.decree.*;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.C;
|
||||
@@ -381,6 +378,12 @@ public class VirtualDecreeCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
DecreeOrigin origin = type.getDeclaredAnnotation(Decree.class).origin();
|
||||
if (!origin.validFor(sender)) {
|
||||
sender.sendMessage(C.RED + "This command has to be sent from another origin: " + C.GOLD + origin);
|
||||
return false;
|
||||
}
|
||||
|
||||
Iris.debug("@ " + getPath() + " with " + args.toString(", "));
|
||||
if (isNode()) {
|
||||
Iris.debug("Invoke " + getPath() + "(" + args.toString(",") + ") at ");
|
||||
|
||||
Reference in New Issue
Block a user