Search in sources :

Example 1 with PacketSSetPassword

use of net.geforcemods.securitycraft.network.packets.PacketSSetPassword in project SecurityCraft by Geforce132.

the class GuiSetPassword method actionPerformed.

@Override
protected void actionPerformed(GuiButton guibutton) {
    switch(guibutton.id) {
        case 0:
            if (keycodeTextbox.getText().isEmpty()) {
                flag = true;
                updateButtonText();
                return;
            }
            ((IPasswordProtected) tileEntity).setPassword(keycodeTextbox.getText());
            SecurityCraft.network.sendToServer(new PacketSSetPassword(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ(), keycodeTextbox.getText()));
            ClientUtils.closePlayerScreen();
            Minecraft.getMinecraft().thePlayer.openGui(SecurityCraft.instance, GuiHandler.INSERT_PASSWORD_ID, tileEntity.getWorld(), tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ());
    }
}
Also used : PacketSSetPassword(net.geforcemods.securitycraft.network.packets.PacketSSetPassword) IPasswordProtected(net.geforcemods.securitycraft.api.IPasswordProtected)

Example 2 with PacketSSetPassword

use of net.geforcemods.securitycraft.network.packets.PacketSSetPassword in project SecurityCraft by Geforce132.

the class GuiKeyChanger method actionPerformed.

@Override
protected void actionPerformed(GuiButton guibutton) {
    switch(guibutton.id) {
        case 0:
            ((IPasswordProtected) tileEntity).setPassword(textboxNewPasscode.getText());
            SecurityCraft.network.sendToServer(new PacketSSetPassword(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ(), textboxNewPasscode.getText()));
            ClientUtils.closePlayerScreen();
            PlayerUtils.sendMessageToPlayer(Minecraft.getMinecraft().thePlayer, StatCollector.translateToLocal("item.universalKeyChanger.name"), StatCollector.translateToLocal("messages.universalKeyChanger.passcodeChanged"), EnumChatFormatting.GREEN);
    }
}
Also used : PacketSSetPassword(net.geforcemods.securitycraft.network.packets.PacketSSetPassword) IPasswordProtected(net.geforcemods.securitycraft.api.IPasswordProtected)

Aggregations

IPasswordProtected (net.geforcemods.securitycraft.api.IPasswordProtected)2 PacketSSetPassword (net.geforcemods.securitycraft.network.packets.PacketSSetPassword)2