001/* 002 * PlotSquared, a land and world management plugin for Minecraft. 003 * Copyright (C) IntellectualSites <https://intellectualsites.com> 004 * Copyright (C) IntellectualSites team and contributors 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 018 */ 019package com.plotsquared.core.inject.modules; 020 021import cloud.commandframework.services.ServicePipeline; 022import com.google.inject.AbstractModule; 023import com.plotsquared.core.PlotSquared; 024import com.plotsquared.core.configuration.file.YamlConfiguration; 025import com.plotsquared.core.inject.annotations.BackgroundPipeline; 026import com.plotsquared.core.inject.annotations.ConfigFile; 027import com.plotsquared.core.inject.annotations.ImpromptuPipeline; 028import com.plotsquared.core.inject.annotations.WorldConfig; 029import com.plotsquared.core.inject.annotations.WorldFile; 030import com.plotsquared.core.listener.PlotListener; 031import com.plotsquared.core.util.EventDispatcher; 032import com.plotsquared.core.uuid.UUIDPipeline; 033import com.sk89q.worldedit.WorldEdit; 034 035import java.io.File; 036 037public class PlotSquaredModule extends AbstractModule { 038 039 @Override 040 protected void configure() { 041 final PlotSquared plotSquared = PlotSquared.get(); 042 bind(ServicePipeline.class).toInstance(ServicePipeline.builder().build()); 043 bind(YamlConfiguration.class).annotatedWith(WorldConfig.class).toInstance(plotSquared.getWorldConfiguration()); 044 bind(File.class).annotatedWith(WorldFile.class).toInstance(plotSquared.getWorldsFile()); 045 bind(File.class).annotatedWith(ConfigFile.class).toInstance(plotSquared.getConfigFile()); 046 bind(PlotListener.class).toInstance(plotSquared.getPlotListener()); 047 bind(UUIDPipeline.class).annotatedWith(ImpromptuPipeline.class).toInstance(plotSquared.getImpromptuUUIDPipeline()); 048 bind(UUIDPipeline.class).annotatedWith(BackgroundPipeline.class).toInstance(plotSquared.getBackgroundUUIDPipeline()); 049 bind(WorldEdit.class).toInstance(WorldEdit.getInstance()); 050 bind(EventDispatcher.class).toInstance(plotSquared.getEventDispatcher()); 051 } 052 053}