forked from Upstream/mmocore
!Fixed custom block chains
This commit is contained in:
parent
8cf6f057d2
commit
d55c0affe2
@ -1,185 +1,185 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<name>MMOCore</name>
|
||||
<version>1.4.7</version>
|
||||
<description>Offer your players a brand new RPG experience.</description>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
<encoding>UTF-8</encoding>
|
||||
<inputEncoding>UTF-8</inputEncoding>
|
||||
<outputEncoding>UTF-8</outputEncoding>
|
||||
<argLine>-ea -Dfile.encoding=UTF-8</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>net.indyuce.mmocore.shaded.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>19.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>mmoitems</artifactId>
|
||||
<version>6.1.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MMOItems.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOLib</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MMOLib.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12-R1-1.16-R2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/spigot.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>4.8.7.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Residence.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.Zrips</groupId>
|
||||
<artifactId>CMI</artifactId>
|
||||
<version>8.6.5.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/CMI.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sainttx.holograms</groupId>
|
||||
<artifactId>holograms</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Holograms.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.filoghost</groupId>
|
||||
<artifactId>HolographicDisplays</artifactId>
|
||||
<version>6.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/HolographicDisplays.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lumine.xikage</groupId>
|
||||
<artifactId>MythicMobs</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MythicMobs.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizens</artifactId>
|
||||
<version>2.0.25-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Citizens.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.7</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/PlaceholderAPI.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>http://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>http://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<build.number>SNAPSHOT</build.number>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<name>MMOCore</name>
|
||||
<version>1.4.7</version>
|
||||
<description>Offer your players a brand new RPG experience.</description>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
<encoding>UTF-8</encoding>
|
||||
<inputEncoding>UTF-8</inputEncoding>
|
||||
<outputEncoding>UTF-8</outputEncoding>
|
||||
<argLine>-ea -Dfile.encoding=UTF-8</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>net.indyuce.mmocore.shaded.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>19.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>mmoitems</artifactId>
|
||||
<version>6.1.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MMOItems.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOLib</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MMOLib.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12-R1-1.16-R2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/spigot.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>4.8.7.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Residence.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.Zrips</groupId>
|
||||
<artifactId>CMI</artifactId>
|
||||
<version>8.6.5.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/CMI.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sainttx.holograms</groupId>
|
||||
<artifactId>holograms</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Holograms.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.filoghost</groupId>
|
||||
<artifactId>HolographicDisplays</artifactId>
|
||||
<version>6.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/HolographicDisplays.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lumine.xikage</groupId>
|
||||
<artifactId>MythicMobs</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MythicMobs.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizens</artifactId>
|
||||
<version>2.0.25-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Citizens.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.7</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/PlaceholderAPI.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>http://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>http://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<build.number>SNAPSHOT</build.number>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -46,7 +46,9 @@ public class BlockListener implements Listener {
|
||||
/*
|
||||
* If the block is a temporary block, immediately cancel the break event
|
||||
*/
|
||||
if (MMOCore.plugin.mineManager.isTemporaryBlock(block)) {
|
||||
BlockInfo info = MMOCore.plugin.mineManager.getInfo(block);
|
||||
boolean temporaryBlock = MMOCore.plugin.mineManager.isTemporaryBlock(block);
|
||||
if (temporaryBlock && info == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -54,7 +56,6 @@ public class BlockListener implements Listener {
|
||||
/*
|
||||
* Check if the block has exp or drop tables
|
||||
*/
|
||||
BlockInfo info = MMOCore.plugin.mineManager.getInfo(block);
|
||||
if (info == null) {
|
||||
|
||||
/*
|
||||
@ -109,15 +110,6 @@ public class BlockListener implements Listener {
|
||||
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
|
||||
PlayerData playerData = PlayerData.get(player);
|
||||
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
|
||||
/**
|
||||
* if (!block.hasMetadata("player_placed") && info.hasExperience()
|
||||
* && MMOCore.plugin.hasHolograms())
|
||||
* MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5,
|
||||
* 1.5, .5),
|
||||
* MMOCore.plugin.configManager.getSimpleMessage("exp-hologram",
|
||||
* "exp", "" + called.getGainedExperience().getValue()).message(),
|
||||
* player);
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
@ -135,7 +127,7 @@ public class BlockListener implements Listener {
|
||||
* Finally enable block regen.
|
||||
*/
|
||||
if (info.hasRegen())
|
||||
MMOCore.plugin.mineManager.initialize(info.startRegeneration(Bukkit.createBlockData(savedData), block.getLocation()));
|
||||
MMOCore.plugin.mineManager.initialize(info.startRegeneration(Bukkit.createBlockData(savedData), block.getLocation()), !temporaryBlock);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
|
@ -30,22 +30,24 @@ import net.mmogroup.mmolib.api.MMOLineConfig;
|
||||
|
||||
public class CustomBlockManager extends MMOManager {
|
||||
|
||||
/*
|
||||
* registered block infos
|
||||
/**
|
||||
* Registered block infos
|
||||
*/
|
||||
private final Map<String, BlockInfo> map = new HashMap<>();
|
||||
|
||||
/*
|
||||
* blocks that are regenerating and that must be refreshed whenever the
|
||||
/**
|
||||
* Blocks that are regenerating and that must be refreshed whenever the
|
||||
* server reloads or shuts down not to hurt the world map
|
||||
*/
|
||||
private final Set<RegeneratingBlock> active = new HashSet<>();
|
||||
|
||||
/* list in which both block regen and block permissions are enabled. */
|
||||
/**
|
||||
* Stores conditions which must be met to apply custom mining
|
||||
*/
|
||||
private final List<Condition> customMineConditions = new ArrayList<>();
|
||||
|
||||
/*
|
||||
* list of functions which let MMOCore recognize what block a player is
|
||||
/**
|
||||
* List of functions which let MMOCore recognize what block a player is
|
||||
* currently breaking
|
||||
*/
|
||||
private final List<Function<Block, Optional<BlockType>>> blockTypes = new ArrayList<>();
|
||||
@ -78,11 +80,23 @@ public class CustomBlockManager extends MMOManager {
|
||||
return new VanillaBlockType(block);
|
||||
}
|
||||
|
||||
public void initialize(RegeneratingBlock info) {
|
||||
// if (schedule) {
|
||||
active.add(info);
|
||||
Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> regen(info, false), info.getRegeneratingBlock().getRegenerationInfo().getTime());
|
||||
// }
|
||||
/**
|
||||
* Used when a block is being broken and MMOCore needs to regen it after X
|
||||
* seconds. Also places the temporary block at the block location
|
||||
*
|
||||
* @param info
|
||||
* Block info
|
||||
* @param scheduleRegen
|
||||
* If block regeneration should be scheduled or not. If the block
|
||||
* broken is a temporary block and is part of a "block chain", no
|
||||
* regen should be scheduled as there is already one
|
||||
*/
|
||||
public void initialize(RegeneratingBlock info, boolean scheduleRegen) {
|
||||
if (scheduleRegen) {
|
||||
active.add(info);
|
||||
Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> regen(info, false), info.getRegeneratingBlock().getRegenerationInfo().getTime());
|
||||
}
|
||||
|
||||
if (info.getRegeneratingBlock().getRegenerationInfo().hasTemporaryBlock())
|
||||
info.getRegeneratingBlock().getRegenerationInfo().getTemporaryBlock().place(info.getLocation(), info);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user