001package net.tnemc.plugincore.sponge.impl; 002/* 003 * The New Plugin Core 004 * Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU Affero 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 Affero General Public License for more details. 015 * 016 * You should have received a copy of the GNU Affero General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019 020import net.tnemc.plugincore.core.compatibility.ProxyProvider; 021import net.tnemc.plugincore.sponge.SpongePluginCore; 022import org.spongepowered.api.Sponge; 023import org.spongepowered.api.network.channel.Channel; 024 025import java.util.Optional; 026 027/** 028 * SpongeProxyProvider 029 * 030 * @author creatorfromhell 031 * @since 0.1.2.0 032 */ 033public class SpongeProxyProvider implements ProxyProvider { 034 035 /** 036 * Used to register a plugin message channel. 037 * 038 * @param channel The channel to register. 039 */ 040 @Override 041 public void registerChannel(String channel) { 042 final Optional<Channel> spongeChannel = Sponge.game().channelManager().get(SpongePluginCore.key(channel)); 043 044 if(spongeChannel.isPresent()) { 045 046 //TODO: Figure out what sponge did with this 047 } 048 } 049 050 /** 051 * Used to send a message through a specific plugin message channel. 052 * 053 * @param channel The channel to send the message through. 054 * @param bytes The byte data to send. 055 */ 056 @Override 057 public void send(String channel, byte[] bytes) { 058 059 final Optional<Channel> spongeChannel = Sponge.game().channelManager().get(SpongePluginCore.key(channel)); 060 061 if(spongeChannel.isPresent()) { 062 063 //TODO: Figure out what sponge did with this 064 } 065 } 066}