mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-27 18:01:33 +01:00
[Safety commit] Prepare better mod support for blockbreak (slowly).
Not yet in place, but setting up new package structure to split off some things from BlockProperties. Likely not final.
This commit is contained in:
parent
43d1c4aad0
commit
8d0751fa64
@ -0,0 +1,12 @@
|
||||
package fr.neatmonster.nocheatplus.compat;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
|
||||
/**
|
||||
* @deprecated Will be removed, use instead: fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public interface BlockPopertiesSetup extends BlockPropertiesSetup{
|
||||
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
package fr.neatmonster.nocheatplus.compat;
|
||||
package fr.neatmonster.nocheatplus.compat.blocks;
|
||||
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
|
||||
/**
|
||||
* Provide a setup method for additional BlockProperties initialization.<br>
|
||||
* Typically MCAccess can implement it. TODO: An extra factory for Bukkit level.
|
||||
* <hr>
|
||||
* NOTE: This might not be the final location for this class, in addition this might get split/changed into other classes with adding better mod support.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
@ -0,0 +1,42 @@
|
||||
package fr.neatmonster.nocheatplus.compat.blocks.blockbreak;
|
||||
|
||||
/**
|
||||
* NOT YET IN USE.
|
||||
* <hr>
|
||||
* This class will contain block breaking properties for blocks and tools combinations. It will allow for generic definitions as well as overriding specific entries.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public class BlockBreakDurations {
|
||||
|
||||
// TODO: 1. most specific one 2. general one (depth first).
|
||||
|
||||
/**
|
||||
* One entry for a specific block+tool combination.
|
||||
* <hr>
|
||||
* TODO: Name.
|
||||
*
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public static interface BlockBreakEntry{
|
||||
|
||||
/**
|
||||
* TODO: Arguments.
|
||||
* @return
|
||||
*/
|
||||
public long getBreakingDuration(); // Player player);
|
||||
|
||||
}
|
||||
|
||||
// TODO: abstract class DefaultBLockBreakEntry (sub method for using only relevant stuff). + notBreak(tool-id / tool-type) method
|
||||
// Could use a default provider (change once change all!?)
|
||||
|
||||
public static final BlockBreakEntry INSTANT_BREAK = new BlockBreakEntry() {
|
||||
@Override
|
||||
public long getBreakingDuration() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package fr.neatmonster.nocheatplus.compat.blocks;
|
||||
package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockFlags;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
@ -20,9 +20,9 @@ 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.compat.blocks.BlocksMC1_5;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.vanilla.BlocksMC1_5;
|
||||
import fr.neatmonster.nocheatplus.config.RawConfigFile;
|
||||
import fr.neatmonster.nocheatplus.config.RootConfPaths;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
@ -37,6 +37,12 @@ import fr.neatmonster.nocheatplus.logging.LogUtil;
|
||||
*
|
||||
*/
|
||||
public class BlockProperties {
|
||||
|
||||
/**
|
||||
* @deprecated Will be replaced by a generic way to define tools.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public static enum ToolType{
|
||||
NONE,
|
||||
SWORD,
|
||||
@ -46,6 +52,12 @@ public class BlockProperties {
|
||||
PICKAXE,
|
||||
// HOE,
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Will be replaced by a generic way to define tools.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public static enum MaterialBase{
|
||||
NONE(0, 1f),
|
||||
WOOD(1, 2f),
|
||||
@ -67,7 +79,12 @@ public class BlockProperties {
|
||||
throw new IllegalArgumentException("Bad id: " + id);
|
||||
}
|
||||
}
|
||||
/** Properties of a tool. */
|
||||
|
||||
/**
|
||||
* Properties of a tool.
|
||||
*
|
||||
* @deprecated Will be replaced by a generic way to define tools.
|
||||
*/
|
||||
public static class ToolProps{
|
||||
public final ToolType toolType;
|
||||
public final MaterialBase materialBase;
|
||||
@ -83,7 +100,12 @@ public class BlockProperties {
|
||||
if (materialBase == null) throw new IllegalArgumentException("MaterialBase must not be null");
|
||||
}
|
||||
}
|
||||
/** Properties of a block. */
|
||||
|
||||
/**
|
||||
* Properties of a block.
|
||||
*
|
||||
* @deprecated Will be replaced by a generic way to define tools.
|
||||
*/
|
||||
public static class BlockProps{
|
||||
public final ToolProps tool;
|
||||
public final long[] breakingTimes;
|
||||
|
@ -17,8 +17,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
||||
|
Loading…
Reference in New Issue
Block a user