mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 02:29:14 +00:00
Compare commits
4 Commits
2.1.1-1.18
...
2.1.2-1.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3d4c32d03 | ||
|
|
9cd5c39bbe | ||
|
|
a1fbf25465 | ||
|
|
ec74037f05 |
@@ -24,7 +24,7 @@ plugins {
|
||||
id "de.undercouch.download" version "5.0.1"
|
||||
}
|
||||
|
||||
version '2.1.1-1.18.2' // Needs to be version specific
|
||||
version '2.1.2-1.18.2' // Needs to be version specific
|
||||
def nmsVersion = "1.18.2"
|
||||
def apiVersion = '1.18'
|
||||
def spigotJarVersion = '1.18.2-R0.1-SNAPSHOT'
|
||||
@@ -74,6 +74,7 @@ repositories {
|
||||
}
|
||||
}
|
||||
maven { url "https://dl.cloudsmith.io/public/arcane/archive/maven/" }
|
||||
maven { url "https://maven.enginehub.org/repo/" }
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven { url "https://jitpack.io"}
|
||||
@@ -128,6 +129,7 @@ dependencies {
|
||||
implementation 'io.th0rgal:oraxen:1.94.0'
|
||||
implementation 'org.bukkit:craftbukkit:1.18.2-R0.1-SNAPSHOT:remapped-mojang'
|
||||
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
|
||||
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.9'
|
||||
|
||||
// Shaded
|
||||
implementation 'com.dfsek:Paralithic:0.4.0'
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.link.WorldEditLink;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.service.ObjectSVC;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
@@ -41,12 +43,7 @@ import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.math.Direction;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.scheduling.Queue;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.HeightMap;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
@@ -426,6 +423,24 @@ public class CommandObject implements DecreeExecutor {
|
||||
sender().sendMessage("Reverted " + actualReverts + " pastes!");
|
||||
}
|
||||
|
||||
@Decree(description = "Gets an object wand and grabs the current WorldEdit selection.", aliases = "we", origin = DecreeOrigin.PLAYER, studio = true)
|
||||
public void we() {
|
||||
if(!Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
sender().sendMessage(C.RED + "You can't get a WorldEdit selection without WorldEdit, you know.");
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<Location, Location> locs = WorldEditLink.getSelection(sender().player());
|
||||
if(locs.getFirst() == null)
|
||||
sender().sendMessage(C.RED + "You don't have a WorldEdit selection!");
|
||||
else if(locs.getSecond() == null)
|
||||
sender().sendMessage(C.RED + "You need a valid WorldRegion selection in the current world!");
|
||||
else {
|
||||
sender().player().getInventory().addItem(WandSVC.createWand(locs.getFirst(), locs.getSecond()));
|
||||
sender().sendMessage(C.GREEN + "A fresh wand with your current WorldEdit selection on it!");
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "Get an object wand", sync = true)
|
||||
public void wand() {
|
||||
player().getInventory().addItem(WandSVC.createWand());
|
||||
|
||||
32
src/main/java/com/volmit/iris/core/link/WorldEditLink.java
Normal file
32
src/main/java/com/volmit/iris/core/link/WorldEditLink.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.volmit.iris.core.link;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.MissingSessionException;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WorldEditLink {
|
||||
|
||||
public static Pair<Location, Location> getSelection(Player p) {
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().getIfPresent(BukkitAdapter.adapt(p));
|
||||
try {
|
||||
if(session == null)
|
||||
throw new MissingSessionException();
|
||||
Region r = session.getSelection(BukkitAdapter.adapt(p.getWorld()));
|
||||
BlockVector3 p1 = r.getMinimumPoint();
|
||||
BlockVector3 p2 = r.getMaximumPoint();
|
||||
return new Pair<>(new Location(p.getWorld(), p1.getX(), p1.getY(), p1.getZ()), new Location(p.getWorld(), p2.getX(), p2.getY(), p2.getZ()));
|
||||
} catch(MissingSessionException e) {
|
||||
return new Pair<>(null, new Location(null, 0, 0, 0));
|
||||
} catch(IncompleteRegionException e) {
|
||||
return new Pair<>(new Location(null, 0, 0, 0), null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -233,20 +233,17 @@ public class IrisToolbelt {
|
||||
return isIrisWorld(i) && access(i).isStudio();
|
||||
}
|
||||
|
||||
public static void retainMantleDataForSlice(String className)
|
||||
{
|
||||
public static void retainMantleDataForSlice(String className) {
|
||||
toolbeltConfiguration.put("retain.mantle." + className, true);
|
||||
}
|
||||
|
||||
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of)
|
||||
{
|
||||
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of) {
|
||||
PlatformChunkGenerator e = access(world);
|
||||
if(e == null) {return null;}
|
||||
return e.getEngine().getMantle().getMantle().get(x, y - world.getMinHeight(), z, of);
|
||||
}
|
||||
|
||||
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of)
|
||||
{
|
||||
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of) {
|
||||
PlatformChunkGenerator e = access(world);
|
||||
if(e == null) {return;}
|
||||
e.getEngine().getMantle().getMantle().remove(x, y - world.getMinHeight(), z, of);
|
||||
|
||||
@@ -79,7 +79,6 @@ import java.util.stream.Stream;
|
||||
public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
private final Looper looper;
|
||||
private final int id;
|
||||
private final KMap<Long, Long> chunkCooldowns;
|
||||
private final KList<Runnable> updateQueue = new KList<>();
|
||||
private final ChronoLatch cl;
|
||||
private final ChronoLatch clw;
|
||||
@@ -99,7 +98,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
ecl = null;
|
||||
cln = null;
|
||||
clw = null;
|
||||
chunkCooldowns = null;
|
||||
looper = null;
|
||||
chunkUpdater = null;
|
||||
id = -1;
|
||||
@@ -112,7 +110,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
cl = new ChronoLatch(3000);
|
||||
ecl = new ChronoLatch(250);
|
||||
clw = new ChronoLatch(1000, true);
|
||||
chunkCooldowns = new KMap<>();
|
||||
id = engine.getCacheID();
|
||||
energy = 25;
|
||||
looper = new Looper() {
|
||||
@@ -255,14 +252,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
}
|
||||
}
|
||||
|
||||
int chunkCooldownSeconds = 60;
|
||||
|
||||
for(Long i : chunkCooldowns.k()) {
|
||||
if(M.ms() - chunkCooldowns.get(i) > TimeUnit.SECONDS.toMillis(chunkCooldownSeconds)) {
|
||||
chunkCooldowns.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
int spawnBuffer = RNG.r.i(2, 12);
|
||||
|
||||
Chunk[] cc = getEngine().getWorld().realWorld().getLoadedChunks();
|
||||
@@ -279,7 +268,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
}
|
||||
|
||||
spawnIn(c, false);
|
||||
chunkCooldowns.put(Cache.key(c), M.ms());
|
||||
}
|
||||
|
||||
energy -= (actuallySpawned / 2D);
|
||||
|
||||
@@ -22,4 +22,4 @@ commands:
|
||||
aliases: [ ir, irs ]
|
||||
api-version: ${apiversion}
|
||||
hotload-dependencies: false
|
||||
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller"]
|
||||
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit"]
|
||||
Reference in New Issue
Block a user