Initial commit.

Captures block place and sapling grow events and prints info to the console. Initial configuration options are in place, definitions will be added.
This commit is contained in:
CocoTheOwner 2021-07-16 17:28:28 +02:00
parent c2e1ecf5b1
commit 16324e16c7
4 changed files with 55 additions and 0 deletions

View File

@ -77,6 +77,7 @@ public class Iris extends VolmitPlugin implements Listener {
public static BKLink linkBK;
public static MultiverseCoreLink linkMultiverseCore;
public static MythicMobsLink linkMythicMobs;
public static SaplingManager saplingManager;
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
public static boolean customModels = doesSupportCustomModels();
public static boolean awareEntities = doesSupportAwareness();
@ -232,6 +233,7 @@ public class Iris extends VolmitPlugin implements Listener {
linkMultiverseCore = new MultiverseCoreLink();
linkBK = new BKLink();
linkMythicMobs = new MythicMobsLink();
saplingManager = new SaplingManager();
edit = new EditManager();
configWatcher = new FileWatcher(getDataFile("settings.json"));
J.a(() -> IO.delete(getTemp()));

View File

@ -0,0 +1,29 @@
package com.volmit.iris.core;
import com.volmit.iris.Iris;
import org.bukkit.TreeType;
import org.bukkit.block.data.type.Sapling;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.world.StructureGrowEvent;
import java.util.Objects;
public class SaplingManager implements Listener {
public SaplingManager() {
Iris.instance.registerListener(this);
}
@EventHandler
public void onStructureGrowEvent(StructureGrowEvent event) {
if (event.getSpecies() == TreeType.JUNGLE)
Iris.info("Sapling grew @ " + event.getLocation() + " for " + event.getSpecies().name() + " bonemealed is " + event.isFromBonemeal() + " by player " + Objects.requireNonNull(event.getPlayer()).getName());
}
@EventHandler
public void onBlockPlaceEvent(BlockPlaceEvent event) {
Iris.info("Placed " + event.getBlock().getBlockData().getMaterial().name() + " @ " + event.getBlock().getLocation());
}
}

View File

@ -79,6 +79,12 @@ public class IrisRegion extends IrisRegistrant implements IRare {
@ArrayType(min = 1, type = IrisEntityInitialSpawn.class)
private KList<IrisEntityInitialSpawn> entityInitialSpawns = new KList<>();
@Desc("Sapling override settings")
private IrisSaplings saplings = new IrisSaplings();
@Desc("Enable sapling overrides")
private boolean useSaplings = false;
@MinNumber(1)
@MaxNumber(128)
@Desc("The rarity of the region")

View File

@ -0,0 +1,18 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.Desc;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Sapling override settings")
@Data
public class IrisSaplings {
}