9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-22 16:39:36 +00:00
This commit is contained in:
Xiao-MoMi
2022-10-06 02:44:52 +08:00
parent 7bb18a4925
commit 680c1119a8
17 changed files with 423 additions and 81 deletions

View File

@@ -89,19 +89,27 @@ public class CropManager extends Function {
//Custom Plugin
if (MainConfig.customPlugin.equals("itemsadder")) {
customInterface = new ItemsAdderHook();
if (MainConfig.cropMode) this.handler = new ItemsAdderWireHandler(this);
else this.handler = new ItemsAdderFrameHandler(this);
if (MainConfig.cropMode) {
this.handler = new ItemsAdderWireHandler(this);
this.cropMode = new ItemsAdderWireCropImpl(this);
}
else {
this.handler = new ItemsAdderFrameHandler(this);
this.cropMode = new ItemsAdderFrameCropImpl(this);
}
}
else if (MainConfig.customPlugin.equals("oraxen")){
customInterface = new OraxenHook();
if (MainConfig.cropMode) this.handler = new OraxenWireHandler(this);
else this.handler = new OraxenFrameHandler(this);
if (MainConfig.cropMode) {
this.handler = new OraxenWireHandler(this);
this.cropMode = new OraxenWireCropImpl(this);
}
else {
this.handler = new OraxenFrameHandler(this);
this.cropMode = new OraxenFrameCropImpl(this);
}
}
//Crop mode
if (MainConfig.cropMode) this.cropMode = new WireCropImpl(this);
else this.cropMode = new FrameCropImpl(this);
//new Time Check task
this.timerTask = new TimerTask(this);
this.timerTask.runTaskTimerAsynchronously(CustomCrops.plugin, 1,100);
@@ -125,14 +133,12 @@ public class CropManager extends Function {
HandlerList.unregisterAll(this.itemSpawnListener);
HandlerList.unregisterAll(this.worldListener);
if (this.handler != null) handler.unload();
this.timerTask.cancel();
if (this.timerTask != null) this.timerTask.cancel();
for (CustomWorld customWorld : customWorlds.values()) {
customWorld.unload(true);
}
customWorlds.clear();
if (this.seasonInterface != null) {
seasonInterface.unload();
}
if (this.seasonInterface != null) seasonInterface.unload();
}
public void onItemSpawn(Item item) {
@@ -148,7 +154,7 @@ public class CropManager extends Function {
CustomWorld customWorld = new CustomWorld(world, this);
customWorlds.put(world, customWorld);
if (MainConfig.autoGrow && MainConfig.enableCompensation) {
if (world.getTime() < 24000 - MainConfig.timeToWork - MainConfig.timeToDry - 1200 && world.getTime() > 1500) {
if (world.getTime() < 24000 - MainConfig.timeToWork - MainConfig.timeToDry - 1200 && world.getTime() > 1200) {
Bukkit.getScheduler().runTaskLaterAsynchronously(CustomCrops.plugin, () -> grow(world, MainConfig.timeToGrow, MainConfig.timeToWork, MainConfig.timeToDry, true), 100);
}
}