mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 02:11:22 +01:00
[BLEEDING] Some missing parts [might still be missing some].
Set to bleeding, because the last commits are. Bukkit-API-only access shortly tested. There will be issues, but this might help over the darkest of days.
This commit is contained in:
parent
4c6798b979
commit
762ae9174d
@ -14,25 +14,29 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||||
|
import fr.neatmonster.nocheatplus.compat.BlockPropertiesSetup;
|
||||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
|
||||||
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
||||||
|
|
||||||
public class MCAccessBukkit implements MCAccess{
|
public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to let it fail.
|
* Constructor to let it fail.
|
||||||
*/
|
*/
|
||||||
public MCAccessBukkit(){
|
public MCAccessBukkit(){
|
||||||
// TODO: ...
|
// TODO: Add more that might fail if not supported ?
|
||||||
|
Material.AIR.isSolid();
|
||||||
|
Material.AIR.isOccluding();
|
||||||
|
// TODO: Deactivate checks that might not work. => MCAccess should have availability method, NCP deactivates check on base of that.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMCVersion() {
|
public String getMCVersion() {
|
||||||
// Bukkit API.
|
// Bukkit API.
|
||||||
// TODO: maybe output something else.
|
// TODO: maybe output something else.
|
||||||
return "?";
|
return "1.4.6|1.4.7|?";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -146,5 +150,15 @@ public class MCAccessBukkit implements MCAccess{
|
|||||||
player.setHealth(0);
|
player.setHealth(0);
|
||||||
player.damage(1);
|
player.damage(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupBlockProperties() {
|
||||||
|
// TODO Set some generic properties matching what BlockCache.getShape returns.
|
||||||
|
for (Material mat : Material.values()){
|
||||||
|
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()){
|
||||||
|
BlockProperties.setBlockFlags(mat.getId(), BlockProperties.getBLockFlags(mat.getId()) | BlockProperties.F_IGN_PASSABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -445,12 +445,18 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
TickTask.cancel();
|
TickTask.cancel();
|
||||||
TickTask.reset();
|
TickTask.reset();
|
||||||
|
|
||||||
|
// Reset MCAccess.
|
||||||
|
mcAccess = null;
|
||||||
|
|
||||||
// Read the configuration files.
|
// Read the configuration files.
|
||||||
ConfigManager.init(this);
|
ConfigManager.init(this);
|
||||||
|
|
||||||
// Setup file logger.
|
// Setup file logger.
|
||||||
StaticLogFile.setupLogger(new File(getDataFolder(), ConfigManager.getConfigFile().getString(ConfPaths.LOGGING_FILENAME)));
|
StaticLogFile.setupLogger(new File(getDataFolder(), ConfigManager.getConfigFile().getString(ConfPaths.LOGGING_FILENAME)));
|
||||||
|
|
||||||
|
// Set up BlockProperties.
|
||||||
|
BlockProperties.init(getMCAccess());
|
||||||
|
|
||||||
// Allow entries to TickTask (just in case).
|
// Allow entries to TickTask (just in case).
|
||||||
TickTask.setLocked(false);
|
TickTask.setLocked(false);
|
||||||
|
|
||||||
@ -472,6 +478,22 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
addComponent(nameSetPerms);
|
addComponent(nameSetPerms);
|
||||||
addListener(getCoreListener());
|
addListener(getCoreListener());
|
||||||
for (final Object obj : new Object[]{
|
for (final Object obj : new Object[]{
|
||||||
|
// Put ReloadListener first, because Checks could also listen to it.
|
||||||
|
new INotifyReload() {
|
||||||
|
// Only for reloading, not INeedConfig.
|
||||||
|
@Override
|
||||||
|
public void onReload() {
|
||||||
|
// Reset MCAccess.
|
||||||
|
mcAccess = null;
|
||||||
|
// Reset BlockProperties.
|
||||||
|
BlockProperties.init(getMCAccess());
|
||||||
|
final ConfigFile config = ConfigManager.getConfigFile();
|
||||||
|
BlockProperties.applyConfig(config, ConfPaths.COMPATIBILITY_BLOCKS);
|
||||||
|
// Reset Command protection.
|
||||||
|
undoCommandChanges();
|
||||||
|
if (config.getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS)) setupCommandProtection();
|
||||||
|
}
|
||||||
|
},
|
||||||
NCPExemptionManager.getListener(),
|
NCPExemptionManager.getListener(),
|
||||||
dataMan,
|
dataMan,
|
||||||
new BlockBreakListener(),
|
new BlockBreakListener(),
|
||||||
@ -483,17 +505,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
new FightListener(),
|
new FightListener(),
|
||||||
new InventoryListener(),
|
new InventoryListener(),
|
||||||
new MovingListener(),
|
new MovingListener(),
|
||||||
new INotifyReload() {
|
|
||||||
@Override
|
|
||||||
public void onReload() {
|
|
||||||
// Only for reloading, not INeedConfig.
|
|
||||||
BlockProperties.init(getMCAccess());
|
|
||||||
final ConfigFile config = ConfigManager.getConfigFile();
|
|
||||||
BlockProperties.applyConfig(config, ConfPaths.COMPATIBILITY_BLOCKS);
|
|
||||||
undoCommandChanges();
|
|
||||||
if (config.getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS)) setupCommandProtection();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}){
|
}){
|
||||||
addComponent(obj);
|
addComponent(obj);
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,8 @@ public class MCAccessFactory {
|
|||||||
else{
|
else{
|
||||||
msg = "[NoCheatPlus] Could not set up native access for your specific Minecraft + server-mod version.";
|
msg = "[NoCheatPlus] Could not set up native access for your specific Minecraft + server-mod version.";
|
||||||
}
|
}
|
||||||
LogUtil.logWarning("[NoCheatPlus] Some features will likely not function properly, performance might suffer.");
|
|
||||||
LogUtil.logWarning(msg);
|
LogUtil.logWarning(msg);
|
||||||
|
LogUtil.logWarning("[NoCheatPlus] Some features will likely not function properly, performance might suffer.");
|
||||||
for (String uMsg : updateLocs){
|
for (String uMsg : updateLocs){
|
||||||
LogUtil.logWarning(uMsg);
|
LogUtil.logWarning(uMsg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user