mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-28 11:28:11 +01:00
Add ability to run extra BlockProperties setup if MCAccess implements
the interface.
This commit is contained in:
parent
ee1f410dae
commit
835ae9cb26
@ -0,0 +1,14 @@
|
||||
package fr.neatmonster.nocheatplus.compat;
|
||||
|
||||
/**
|
||||
* Provide a setup method for additional BlockProperties initialization.<br>
|
||||
* Typically MCAccess can implement it. TODO: An extra factory for Bukkit level.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public interface BlockPropertiesSetup {
|
||||
/**
|
||||
* Additional initialization.
|
||||
*/
|
||||
public void setupBlockProperties();
|
||||
}
|
@ -12,8 +12,9 @@ import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
* Compatibility interface to get properties for Bukkit instances that need access of CraftBukkit or Minecraft classes.<br>
|
||||
* NOTE: All methods returning AlmostBoolean must never return null, unless stated otherwise.<br>
|
||||
* NOTE: Expect API changes in the near future!<br>
|
||||
* NOTE: If an instance implements BlockPropertiesSetup, the setup method will be called after basic initialization but before configuration is applied.<br>
|
||||
* <hr>
|
||||
* TODO: Make minimal (do we need WorldServer yet)?
|
||||
* TODO: Make minimal.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.config.RawConfigFile;
|
||||
import fr.neatmonster.nocheatplus.config.RootConfPaths;
|
||||
@ -277,6 +278,9 @@ public class BlockProperties {
|
||||
try{
|
||||
initTools(mcAccess);
|
||||
initBlocks(mcAccess);
|
||||
if (mcAccess instanceof BlockPropertiesSetup){
|
||||
((BlockPropertiesSetup) mcAccess).setupBlockProperties();
|
||||
}
|
||||
}
|
||||
catch(Throwable t){
|
||||
LogUtil.logSevere(t);
|
||||
|
Loading…
Reference in New Issue
Block a user