mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-22 10:15:43 +01:00
Add missing link and item deletion when removing hoppers
This commit is contained in:
parent
16c0da830e
commit
44e5060c6a
@ -10,6 +10,7 @@ import com.craftaro.epichoppers.hopper.HopperImpl;
|
|||||||
import com.craftaro.epichoppers.hopper.HopperBuilder;
|
import com.craftaro.epichoppers.hopper.HopperBuilder;
|
||||||
import com.craftaro.epichoppers.hopper.levels.Level;
|
import com.craftaro.epichoppers.hopper.levels.Level;
|
||||||
import com.craftaro.epichoppers.settings.Settings;
|
import com.craftaro.epichoppers.settings.Settings;
|
||||||
|
import com.craftaro.epichoppers.utils.DataHelper;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -175,6 +176,8 @@ public class BlockListeners implements Listener {
|
|||||||
|
|
||||||
this.plugin.getHopperManager().removeHopper(block.getLocation());
|
this.plugin.getHopperManager().removeHopper(block.getLocation());
|
||||||
this.plugin.getDataManager().delete(hopper);
|
this.plugin.getDataManager().delete(hopper);
|
||||||
|
DataHelper.deleteLinks(hopper);
|
||||||
|
DataHelper.deleteItems(hopper);
|
||||||
|
|
||||||
this.plugin.getPlayerDataManager().getPlayerData(player).setSyncType(null);
|
this.plugin.getPlayerDataManager().getPlayerData(player).setSyncType(null);
|
||||||
}
|
}
|
||||||
|
@ -104,4 +104,12 @@ public class DataHelper {
|
|||||||
.execute();
|
.execute();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void deleteItems(HopperImpl hopper) {
|
||||||
|
EpicHoppers.getPlugin(EpicHoppers.class).getDataManager().getDatabaseConnector().connectDSL(dslContext -> {
|
||||||
|
dslContext.deleteFrom(DSL.table(EpicHoppers.getPlugin(EpicHoppers.class).getDataManager().getTablePrefix() + "items"))
|
||||||
|
.where(DSL.field("hopper_id").eq(hopper.getId()))
|
||||||
|
.execute();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user