mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-26 18:39:17 +00:00
use new lib
This commit is contained in:
@@ -20,6 +20,7 @@ package net.momirealms.customcrops;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.momirealms.antigrieflib.AntiGriefLib;
|
||||
import net.momirealms.customcrops.api.CustomCropsAPIImpl;
|
||||
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.object.basic.ConfigManager;
|
||||
@@ -43,7 +44,6 @@ import net.momirealms.customcrops.helper.LibraryLoader;
|
||||
import net.momirealms.customcrops.helper.VersionHelper;
|
||||
import net.momirealms.customcrops.integration.IntegrationManager;
|
||||
import net.momirealms.customcrops.util.AdventureUtils;
|
||||
import net.momirealms.protectionlib.ProtectionLib;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
@@ -73,13 +73,16 @@ public final class CustomCrops extends CustomCropsPlugin {
|
||||
private HologramManager hologramManager;
|
||||
private VersionHelper versionHelper;
|
||||
private Scheduler scheduler;
|
||||
private AntiGriefLib antiGriefLib;
|
||||
|
||||
@Override
|
||||
public void onLoad(){
|
||||
plugin = this;
|
||||
instance = this;
|
||||
this.loadLibs();
|
||||
ProtectionLib.initialize(this);
|
||||
this.antiGriefLib = AntiGriefLib.builder(this)
|
||||
.ignoreOP(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +103,6 @@ public final class CustomCrops extends CustomCropsPlugin {
|
||||
if (!this.loadPlatform()) return;
|
||||
this.registerCommands();
|
||||
AdventureUtils.consoleMessage("[CustomCrops] Running on <white>" + Bukkit.getVersion());
|
||||
ProtectionLib.hook();
|
||||
|
||||
this.scheduler = new Scheduler(this);
|
||||
this.configManager = new ConfigManager(this);
|
||||
@@ -126,6 +128,8 @@ public final class CustomCrops extends CustomCropsPlugin {
|
||||
AdventureUtils.consoleMessage("[CustomCrops] Plugin Enabled!");
|
||||
if (ConfigManager.enableBStats) new Metrics(this, 16593);
|
||||
if (ConfigManager.checkUpdate) this.versionHelper.checkUpdate();
|
||||
|
||||
antiGriefLib.init();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
@@ -290,4 +294,8 @@ public final class CustomCrops extends CustomCropsPlugin {
|
||||
public Scheduler getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
public AntiGriefLib getAntiGriefLib() {
|
||||
return antiGriefLib;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,8 @@ import net.momirealms.customcrops.api.object.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.object.world.SimpleLocation;
|
||||
import net.momirealms.customcrops.customplugin.itemsadder.ItemsAdderHandler;
|
||||
import net.momirealms.customcrops.customplugin.oraxen.OraxenHandler;
|
||||
import net.momirealms.customcrops.helper.Log;
|
||||
import net.momirealms.customcrops.util.AdventureUtils;
|
||||
import net.momirealms.customcrops.util.RotationUtils;
|
||||
import net.momirealms.protectionlib.ProtectionLib;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -402,7 +400,7 @@ public class PlatformManager extends Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ProtectionLib.canPlace(player, location)) {
|
||||
if (!plugin.getAntiGriefLib().canPlace(player, location)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -530,7 +528,7 @@ public class PlatformManager extends Function {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ProtectionLib.canPlace(player, location)) {
|
||||
if (!plugin.getAntiGriefLib().canPlace(player, location)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -567,7 +565,7 @@ public class PlatformManager extends Function {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ProtectionLib.canBreak(player, location)) {
|
||||
if (!plugin.getAntiGriefLib().canBreak(player, location)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -678,9 +676,9 @@ public class PlatformManager extends Function {
|
||||
if (inAc != null) {
|
||||
for (Action action : inAc) {
|
||||
action.doOn(
|
||||
player,
|
||||
SimpleLocation.getByBukkitLocation(location),
|
||||
cropConfig.getCropMode()
|
||||
player,
|
||||
SimpleLocation.getByBukkitLocation(location),
|
||||
cropConfig.getCropMode()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -700,7 +698,7 @@ public class PlatformManager extends Function {
|
||||
if (potConfig == null)
|
||||
return false;
|
||||
|
||||
if (!ProtectionLib.canPlace(player, location))
|
||||
if (!plugin.getAntiGriefLib().canPlace(player, location))
|
||||
return true;
|
||||
|
||||
PotInteractEvent potInteractEvent = new PotInteractEvent(player, item_in_hand, location, pot_id);
|
||||
@@ -1065,7 +1063,7 @@ public class PlatformManager extends Function {
|
||||
|
||||
outer: {
|
||||
if (id != null && location != null) {
|
||||
if (!ProtectionLib.canPlace(player, location))
|
||||
if (!plugin.getAntiGriefLib().canPlace(player, location))
|
||||
return true;
|
||||
if (!wateringCanConfig.canUse(player, location))
|
||||
return true;
|
||||
@@ -1099,7 +1097,7 @@ public class PlatformManager extends Function {
|
||||
for (String blockId : blockIds) {
|
||||
if (positiveFillMethod.getId().equals(blockId)) {
|
||||
Block block = lineOfSight.get(index);
|
||||
if (!ProtectionLib.canPlace(player, block.getLocation()))
|
||||
if (!plugin.getAntiGriefLib().canPlace(player, block.getLocation()))
|
||||
return true;
|
||||
if (!wateringCanConfig.canUse(player, location))
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user