use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.
the class GuiSelectChannelPopup method actionPerformed.
@Override
protected void actionPerformed(GuiButton guibutton) throws IOException {
if (guibutton.id == 0) {
// Select
int selected = textList.getSelected();
if (selected >= 0) {
ChannelInformation info = channelList.get(selected);
if (info != null) {
handleResult.accept(info);
}
exitGui();
}
} else {
super.actionPerformed(guibutton);
}
}
use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.
the class EditChannelPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
Optional<ChannelInformation> channelOpt = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(channelIdentifier)).findFirst();
if (channelOpt.isPresent()) {
ChannelInformation channel = channelOpt.get();
if (!channel.getName().equals(getName())) {
manager.updateChannelName(channelIdentifier, getName());
}
if (!channel.getRights().equals(getRights()) || (channel.getResponsibleSecurityID() != null && getSecurityStationID() != null && !channel.getResponsibleSecurityID().equals(getSecurityStationID())) || channel.getResponsibleSecurityID() != getSecurityStationID()) {
manager.updateChannelRights(channelIdentifier, getRights(), getSecurityStationID());
}
}
}
use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.
the class OpenEditChannelGUIPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
TileEntity tile = player.getEntityWorld().getTileEntity(new BlockPos(getPosX(), getPosY(), getPosZ()));
UUID securityID = null;
if (tile instanceof LogisticsSecurityTileEntity) {
LogisticsSecurityTileEntity security = (LogisticsSecurityTileEntity) tile;
securityID = security.getSecId();
}
UUID finalSecurityID = securityID;
IChannelManager channelManager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
Optional<ChannelInformation> match = channelManager.getChannels().stream().filter(channel -> channel.getChannelIdentifier().toString().equals(getIdentifier())).findFirst();
match.ifPresent(channel -> NewGuiHandler.getGui(EditChannelGuiProvider.class).setResponsibleSecurityID(finalSecurityID).setChannel(channel).open(player));
}
use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.
the class PipeItemsInvSysConnector method guiOpenedByPlayer.
@Override
public void guiOpenedByPlayer(EntityPlayer player) {
localGuiWatchers.add(player);
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(InvSysConResistance.class).setInteger(this.resistance).setBlockPos(this.getPos()), player);
IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(this.getWorld());
Optional<ChannelInformation> channel = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(getConnectionUUID())).findFirst();
channel.ifPresent(chan -> MainProxy.sendPacketToPlayer(PacketHandler.getPacket(ChannelInformationPacket.class).setInformation(chan).setTargeted(true), player));
}
use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.
the class PipeItemsInvSysConnector method sendChannelInformationToPlayers.
private void sendChannelInformationToPlayers() {
IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(this.getWorld());
Optional<ChannelInformation> channel = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(getConnectionUUID())).findFirst();
channel.ifPresent(chan -> MainProxy.sendToPlayerList(PacketHandler.getPacket(ChannelInformationPacket.class).setInformation(chan).setTargeted(true), localGuiWatchers));
}
Aggregations