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"?>
|
<?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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>net.Indyuce</groupId>
|
<groupId>net.Indyuce</groupId>
|
||||||
<artifactId>MMOCore</artifactId>
|
<artifactId>MMOCore</artifactId>
|
||||||
<name>MMOCore</name>
|
<name>MMOCore</name>
|
||||||
<version>1.4.7</version>
|
<version>1.4.7</version>
|
||||||
<description>Offer your players a brand new RPG experience.</description>
|
<description>Offer your players a brand new RPG experience.</description>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
<directory>${basedir}/src/main/resources/</directory>
|
<directory>${basedir}/src/main/resources/</directory>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
<finalName>${project.name}-${project.version}</finalName>
|
<finalName>${project.name}-${project.version}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
<junitArtifactName>junit:junit</junitArtifactName>
|
<junitArtifactName>junit:junit</junitArtifactName>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
<inputEncoding>UTF-8</inputEncoding>
|
<inputEncoding>UTF-8</inputEncoding>
|
||||||
<outputEncoding>UTF-8</outputEncoding>
|
<outputEncoding>UTF-8</outputEncoding>
|
||||||
<argLine>-ea -Dfile.encoding=UTF-8</argLine>
|
<argLine>-ea -Dfile.encoding=UTF-8</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.4</version>
|
<version>3.2.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>io.papermc.lib</pattern>
|
<pattern>io.papermc.lib</pattern>
|
||||||
<shadedPattern>net.indyuce.mmocore.shaded.paperlib</shadedPattern>
|
<shadedPattern>net.indyuce.mmocore.shaded.paperlib</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>sk89q-repo</id>
|
<id>sk89q-repo</id>
|
||||||
<url>https://maven.enginehub.org/repo/</url>
|
<url>https://maven.enginehub.org/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>papermc</id>
|
<id>papermc</id>
|
||||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>19.0.0</version>
|
<version>19.0.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.MilkBowl</groupId>
|
<groupId>com.github.MilkBowl</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.7</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q.worldguard</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
<artifactId>worldguard-bukkit</artifactId>
|
<artifactId>worldguard-bukkit</artifactId>
|
||||||
<version>7.0.2-SNAPSHOT</version>
|
<version>7.0.2-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.12</version>
|
<version>1.18.12</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.Indyuce</groupId>
|
<groupId>net.Indyuce</groupId>
|
||||||
<artifactId>mmoitems</artifactId>
|
<artifactId>mmoitems</artifactId>
|
||||||
<version>6.1.2</version>
|
<version>6.1.2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/MMOItems.jar</systemPath>
|
<systemPath>${basedir}/lib/MMOItems.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.Indyuce</groupId>
|
<groupId>net.Indyuce</groupId>
|
||||||
<artifactId>MMOLib</artifactId>
|
<artifactId>MMOLib</artifactId>
|
||||||
<version>1.3</version>
|
<version>1.3</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/MMOLib.jar</systemPath>
|
<systemPath>${basedir}/lib/MMOLib.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.12-R1-1.16-R2</version>
|
<version>1.12-R1-1.16-R2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/spigot.jar</systemPath>
|
<systemPath>${basedir}/lib/spigot.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bekvon.bukkit</groupId>
|
<groupId>com.bekvon.bukkit</groupId>
|
||||||
<artifactId>Residence</artifactId>
|
<artifactId>Residence</artifactId>
|
||||||
<version>4.8.7.2</version>
|
<version>4.8.7.2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/Residence.jar</systemPath>
|
<systemPath>${basedir}/lib/Residence.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.Zrips</groupId>
|
<groupId>com.Zrips</groupId>
|
||||||
<artifactId>CMI</artifactId>
|
<artifactId>CMI</artifactId>
|
||||||
<version>8.6.5.0</version>
|
<version>8.6.5.0</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/CMI.jar</systemPath>
|
<systemPath>${basedir}/lib/CMI.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sainttx.holograms</groupId>
|
<groupId>com.sainttx.holograms</groupId>
|
||||||
<artifactId>holograms</artifactId>
|
<artifactId>holograms</artifactId>
|
||||||
<version>2.9.1</version>
|
<version>2.9.1</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/Holograms.jar</systemPath>
|
<systemPath>${basedir}/lib/Holograms.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.gmail.filoghost</groupId>
|
<groupId>com.gmail.filoghost</groupId>
|
||||||
<artifactId>HolographicDisplays</artifactId>
|
<artifactId>HolographicDisplays</artifactId>
|
||||||
<version>6.9.1</version>
|
<version>6.9.1</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/HolographicDisplays.jar</systemPath>
|
<systemPath>${basedir}/lib/HolographicDisplays.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.lumine.xikage</groupId>
|
<groupId>io.lumine.xikage</groupId>
|
||||||
<artifactId>MythicMobs</artifactId>
|
<artifactId>MythicMobs</artifactId>
|
||||||
<version>4.8.0</version>
|
<version>4.8.0</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/MythicMobs.jar</systemPath>
|
<systemPath>${basedir}/lib/MythicMobs.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens</artifactId>
|
<artifactId>citizens</artifactId>
|
||||||
<version>2.0.25-SNAPSHOT</version>
|
<version>2.0.25-SNAPSHOT</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/Citizens.jar</systemPath>
|
<systemPath>${basedir}/lib/Citizens.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.clip</groupId>
|
<groupId>me.clip</groupId>
|
||||||
<artifactId>placeholderapi</artifactId>
|
<artifactId>placeholderapi</artifactId>
|
||||||
<version>2.10.7</version>
|
<version>2.10.7</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/PlaceholderAPI.jar</systemPath>
|
<systemPath>${basedir}/lib/PlaceholderAPI.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>nexus</id>
|
<id>nexus</id>
|
||||||
<name>Lumine Releases</name>
|
<name>Lumine Releases</name>
|
||||||
<url>http://mvn.lumine.io/repository/maven-releases/</url>
|
<url>http://mvn.lumine.io/repository/maven-releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<snapshotRepository>
|
<snapshotRepository>
|
||||||
<id>nexus</id>
|
<id>nexus</id>
|
||||||
<name>Lumine Snapshots</name>
|
<name>Lumine Snapshots</name>
|
||||||
<url>http://mvn.lumine.io/repository/maven-snapshots/</url>
|
<url>http://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<properties>
|
<properties>
|
||||||
<downloadSources>false</downloadSources>
|
<downloadSources>false</downloadSources>
|
||||||
<downloadJavadocs>false</downloadJavadocs>
|
<downloadJavadocs>false</downloadJavadocs>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<build.number>SNAPSHOT</build.number>
|
<build.number>SNAPSHOT</build.number>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -46,7 +46,9 @@ public class BlockListener implements Listener {
|
|||||||
/*
|
/*
|
||||||
* If the block is a temporary block, immediately cancel the break event
|
* 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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -54,7 +56,6 @@ public class BlockListener implements Listener {
|
|||||||
/*
|
/*
|
||||||
* Check if the block has exp or drop tables
|
* Check if the block has exp or drop tables
|
||||||
*/
|
*/
|
||||||
BlockInfo info = MMOCore.plugin.mineManager.getInfo(block);
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -109,15 +110,6 @@ public class BlockListener implements Listener {
|
|||||||
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
|
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
|
||||||
PlayerData playerData = PlayerData.get(player);
|
PlayerData playerData = PlayerData.get(player);
|
||||||
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
|
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.
|
* Finally enable block regen.
|
||||||
*/
|
*/
|
||||||
if (info.hasRegen())
|
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)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
@ -30,22 +30,24 @@ import net.mmogroup.mmolib.api.MMOLineConfig;
|
|||||||
|
|
||||||
public class CustomBlockManager extends MMOManager {
|
public class CustomBlockManager extends MMOManager {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* registered block infos
|
* Registered block infos
|
||||||
*/
|
*/
|
||||||
private final Map<String, BlockInfo> map = new HashMap<>();
|
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
|
* server reloads or shuts down not to hurt the world map
|
||||||
*/
|
*/
|
||||||
private final Set<RegeneratingBlock> active = new HashSet<>();
|
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<>();
|
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
|
* currently breaking
|
||||||
*/
|
*/
|
||||||
private final List<Function<Block, Optional<BlockType>>> blockTypes = new ArrayList<>();
|
private final List<Function<Block, Optional<BlockType>>> blockTypes = new ArrayList<>();
|
||||||
@ -78,11 +80,23 @@ public class CustomBlockManager extends MMOManager {
|
|||||||
return new VanillaBlockType(block);
|
return new VanillaBlockType(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(RegeneratingBlock info) {
|
/**
|
||||||
// if (schedule) {
|
* Used when a block is being broken and MMOCore needs to regen it after X
|
||||||
active.add(info);
|
* seconds. Also places the temporary block at the block location
|
||||||
Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> regen(info, false), info.getRegeneratingBlock().getRegenerationInfo().getTime());
|
*
|
||||||
// }
|
* @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())
|
if (info.getRegeneratingBlock().getRegenerationInfo().hasTemporaryBlock())
|
||||||
info.getRegeneratingBlock().getRegenerationInfo().getTemporaryBlock().place(info.getLocation(), info);
|
info.getRegeneratingBlock().getRegenerationInfo().getTemporaryBlock().place(info.getLocation(), info);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user