use of net.kyori.violet.AbstractModule in project Almura by AlmuraDev.
the class FeatureModule method configure.
@Override
protected void configure() {
this.install(new HeadUpDisplayModule());
this.install(new NickModule());
this.install(new NotificationModule());
this.install(new TitleModule());
this.install(new GuideModule());
this.install(new ComplexContentModule());
this.install(new CacheModule());
this.install(new ExchangeModule());
this.install(new StoreModule());
this.install(new DeathModule());
this.install(new StorageModule());
this.install(new BiomeModule());
this.install(new FeaturesModule());
this.install(new AnimalModule());
this.facet().add(SignEditFeature.class);
this.facet().add(ItemReturnHelper.class);
this.nerfVanillaFood();
this.install(new ClaimModule());
this.install(new MembershipModule());
this.install(new SkillsModule());
if (SpongeImplHooks.isDeobfuscatedEnvironment()) {
// Force loading this because it will fail the Platform.Type checks below during normal startup.
this.loadServerSideModules();
}
this.on(Platform.Type.CLIENT, () -> {
final class ClientModule extends AbstractModule implements ClientBinder {
@SideOnly(Side.CLIENT)
@Override
protected void configure() {
this.facet().add(OffHandListener.class);
}
}
this.install(new ClientModule());
});
this.on(Platform.Type.SERVER, () -> {
// Dedicated Server Only!
final class ServerModule extends AbstractModule implements CommonBinder {
@SideOnly(Side.SERVER)
@Override
protected void configure() {
// This is never touched in single player / de-obfuscated environments.
loadServerSideModules();
}
}
this.install(new ServerModule());
});
}
use of net.kyori.violet.AbstractModule in project Almura by AlmuraDev.
the class ExchangeModule method configure.
@Override
protected void configure() {
this.requestStaticInjection(ExchangeCommandsCreator.class);
this.packet().bind(ClientboundExchangeRegistryPacket.class, binder -> binder.handler(ClientboundExchangesRegistryPacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundExchangeSpecificOfferRequestPacket.class, binder -> binder.handler(ServerboundExchangeSpecificOfferPacketHandler.class, Platform.Type.SERVER)).bind(ClientboundExchangeGuiResponsePacket.class, binder -> binder.handler(ClientboundExchangeGuiResponsePacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundModifyExchangePacket.class, binder -> binder.handler(ServerboundModifyExchangePacketHandler.class, Platform.Type.SERVER)).bind(ClientboundListItemsResponsePacket.class, binder -> binder.handler(ClientboundListItemsResponsePacketHandler.class, Platform.Type.CLIENT)).bind(ClientboundListItemsSaleStatusPacket.class, binder -> binder.handler(ClientboundListItemsSaleStatusPacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundListItemsRequestPacket.class, binder -> binder.handler(ServerboundListItemsRequestPacketHandler.class, Platform.Type.SERVER)).bind(ClientboundForSaleFilterRequestPacket.class, binder -> binder.handler(ClientboundForSaleFilterRequestPacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundForSaleFilterResponsePacket.class, binder -> binder.handler(ServerboundForSaleFilterResponsePacketHandler.class, Platform.Type.SERVER)).bind(ClientboundForSaleItemsResponsePacket.class, binder -> binder.handler(ClientboundForSaleItemsResponsePacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundModifyForSaleItemListStatusRequestPacket.class, binder -> binder.handler(ServerboundModifyForSaleItemListStatusRequestPacketHandler.class, Platform.Type.SERVER)).bind(ServerboundTransactionRequestPacket.class, binder -> binder.handler(ServerboundTransactionRequestPacketHandler.class, Platform.Type.SERVER)).bind(ClientboundTransactionCompletePacket.class, binder -> binder.handler(ClientboundTransactionCompletePacketHandler.class, Platform.Type.CLIENT));
this.facet().add(ServerExchangeManager.class);
this.command().child(ExchangeCommandsCreator.createCommand(), "exchange", "axs");
FilterRegistry.instance.<ListItem>registerFilter(ID + "_item_display_name", (target, value) -> target.asRealStack().getDisplayName().toLowerCase().contains(value.toLowerCase())).<ListItem>registerFilter(ID + "_seller_name", (target, value) -> target.getSellerName().isPresent() && target.getSellerName().get().toLowerCase().contains(value.toLowerCase())).<ListItem>registerComparator(ID + "_item_display_name", Comparator.comparing(k -> k.asRealStack().getDisplayName().toLowerCase())).<ListItem>registerComparator(ID + "_seller_name", Comparator.comparing(v -> v.getSellerName().orElse("").toLowerCase())).<ListItem>registerComparator(ID + "_price", Comparator.comparing(l -> {
final ForSaleItem item = l.getForSaleItem().orElse(null);
if (item == null) {
return null;
}
return item.getPrice();
})).<ListItem>registerComparator(ID + "_created", Comparator.comparing(l -> {
final ForSaleItem item = l.getForSaleItem().orElse(null);
if (item == null) {
return null;
}
return item.getCreated();
}));
this.on(Platform.Type.CLIENT, () -> {
@SideOnly(Side.CLIENT)
final class ClientModule extends AbstractModule implements ClientBinder {
@SideOnly(Side.CLIENT)
@Override
protected void configure() {
this.facet().add(ClientExchangeManager.class);
this.requestStaticInjection(ExchangeBuyQuantityScreen.class);
this.requestStaticInjection(ExchangeListPriceScreen.class);
this.requestStaticInjection(ExchangeOfferScreen.class);
this.requestStaticInjection(ExchangeManagementScreen.class);
this.requestStaticInjection(ExchangeScreen.class);
}
}
this.install(new ClientModule());
});
}
Aggregations