Home›Java›Mods›KeyboardAPI » Add keyboards to your server
KeyboardAPI » Add keyboards to your server
ModsJava

KeyboardAPI » Add keyboards to your server

Java mod listed for Minecraft 1.8. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
keyboard_header.png

● EN » My new plugin 'KeyboardAPI' is a great way to insert keyboards to your server. It can be used for small inputs like a map name in a force map or friend search menu. The system offers a pre-defined keyboard layout with ASCII-Symbols, normal symbols and letters from the alphabet. The API is easy to use for developers.

● DE » Mein neues Plugin KeyboardAPI ist ein toller Weg, um Tastaturen zu deinem Server hinzuzufügen. Es kann benutzt werden, um kleinere Eingaben wie einen Mapnamen in einem ForceMap-System einzugeben oder eine Freundesuche zu starten. Das System bietet ein vordefiniertes Layout mit ASCII-Zeichen, normalen Satzzeichen und Buchstaben vom Alphabet. Die API ist für Programmierer einfach zu benutzen.





keyboard_features.png
● EN » Below you can see a list with some nice features of the plugin.
► available in threee different languages (more are coming!)
► More than 50 different keys with symbols and letters
► Easy to use API
► create unlimited keyboards

● DE » Die folgende Liste zeigt ein paar coole Features des Plugins.
► verfügbar in drei verschiedenen Sprachen (mehr kommt!)
► Mehr als 50 verschiedene Tasten mit Symbolen und Buchstaben
► Einfache API
► erstelle unendlich viele Tastaturen





keyboard_use.png

● EN » Now you know about the features but how to use this API now?
Actually it's really simple to use. I will list the steps for you.

1. SETUP
At first you need to setup the API to use it. Go to your onEnable() method of your plugin, which should implement the api and type:
Code (Java):
KeyboardAPI. getInstance ( ). setup ( "§7Test §8> §r" ) ;
The string as a parameter in the method setup is the prefix. You can access to this prefix later with:
Code (Java):
KeyboardAPI. getInstance ( ). getPrefix ( )

2. Create a new keyboard
To create a new keyboard you need to register a new one using the KeyboardHandler. I recomment to save this keyboard in a variable or constant to access to the keyboard.
Code (Java):
final Keyboard keyboard = KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). registerNewKeyboard (player, Language. ENGLISH ) ;
The first parameter is the player the keyboard should be assigned to. The second parameter is the language of the keyboard.
Now you have created a keyboard but nothing will happen to the player. You have to open the keyboard. If you saved the keyboard in a variable you can simply access with:
Code (Java):
keyboard. openKeyboard ( ) ;
Or if you don't have assigned it to a variable you can access to the keyboard via the KeyBoardHandler:
Code (Java):
KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getMatchingKeyboard (player ). openKeyboard ( ) ;
I created an example with the PlayerInteractEvent. It opens a new keyboard when a player interacts with a stick
Code (Java):
@EventHandler
    public void onPlayerInteract ( final PlayerInteractEvent event ) {
        final Player player = event. getPlayer ( ) ;
        if (event. getItem ( ) != null ) {
            if (event. getItem ( ). getType ( ) == Material. STICK ) {
                final Keyboard keyboard = KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). registerNewKeyboard (player, Language. ENGLISH ) ;
                keyboard. openKeyboard ( ) ;
                KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getMatchingKeyboard (player ). openKeyboard ( ) ; // only execute if you didn't use the method above!
            }
        }
    }



3. Work with events
The API calls events when an action occurs on the keyboard.

● KeyboardEnteredResultEvent
➥ This event occours when a player confirms his input in the keyboard.
It returns the player who clicked the confirm button and the keyboard
which the player used to type. You can get these values with:
getKeyboard() and getPlayer().
Event example:
Code (Java):
@EventHandler
    public void onKeyboardEnterResult ( final KeyboardEnteredResultEvent event ) {
        final Player player = event. getPlayer ( ) ;
        final Keyboard keyboard = event. getKeyboard ( ) ;

        player. sendMessage (KeyboardAPI. getInstance ( ). getPrefix ( ) + "§7Your input§8: §a" + keyboard. getTypeResult ( ) ) ;
    }
This code simply prints the text the player typed in his keyboard.

● KeyboardCanceledTypingEvent
➥ This event occurs when a player presses the cancel button on the keyboard or simply closes his inventory with the [ESC] or [E] key on his real keyboard. You can get the same values like in the KeyboardEnteredResultEvent. It's important to unregister the player's keyboard! Event example:

Code (Java):
@EventHandler
    public void onKeyboardCanceledTyping ( final KeyboardCanceledTypingEvent event ) {
        final Player player = event. getPlayer ( ) ;
        final Keyboard keyboard = event. getKeyboard ( ) ;

        // Important to unregister the keyboard of the player!
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). unregisterKeyboard (player ) ;
       
        player. sendMessage (KeyboardAPI. getInstance ( ). getPrefix ( ) + "§7You canceled typing!" ) ;
    }

4. Working with the KeyboardHandler
The KeyboardHandler is a class with essential methods.
Code (Java):
// Unregisters the keyboard of a player. So no inputs will be received anymore.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). unregisterKeyboard (player ) ;
       
        // Returns a Keyboard object. The keyboard which is assigned to a certain player.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getMatchingKeyboard (player ) ;
       
        // Returns a list with all keyboards which are currently in use.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getActiveKeyboards ( ) ;
       
        // Returns true if a player has got a keyboard and false if not.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). playerHasKeyboard (player ) ;
For more detail you can look at the Java-Docs above the methods in the KeyboardHandler class!




● DE » Jetzt kennst du die Funktionen dieses Plugins. Doch wie benutzt man jetzt die API? Es ist tatsächlich sehr einfach. Hier die Schritte:

1. EINRICHTUNG
Zuerst musst du die API einrichten, um sie zu benutzen. Gehe zur onEnable() Methode deines Plugins, in welches die API eingebaut werden soll.
Code (Java):
KeyboardAPI. getInstance ( ). setup ( "§7Test §8> §r" ) ;
Der Parameter ist der Prefix des Plugins. Du kannst später immer wieder auf den Prefix zugreifen. Das geht folgendermaßen:
Code (Java):
KeyboardAPI. getInstance ( ). getPrefix ( )

2. Eine neue Tastatur erstellen
Um eine neue Tastatur zu erstellen, musst du diese mit Hilfe des KeyboardHandlers registrieren. Ich empfehle eine Variable oder Konstante für das Keyboard anzulegen, um später einfacher darauf zuzugreifen.
Code (Java):
final Keyboard keyboard = KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). registerNewKeyboard (player, Language. ENGLISH ) ;
Der erste Parameter gibt an, welchem Spieler die Tastatur zugeordnet werden soll. Der zweite Parameter stellt die Sprache des Keyboards dar.
Jetzt hast du eine neue Tastatur erstellt, jedoch wird der Spieler davon nichts bemerken. Du musst sie noch öffnen. Wenn du die Tastatur ein einer Variable/Konstante gespeichtert hast geht das am einfachsten so:
Code (Java):
keyboard. openKeyboard ( ) ;
Und falls nicht kannst du auch problemlos über den KeyboardHandler auf die Tastatur zugreifen.
Code (Java):
KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getMatchingKeyboard (player ). openKeyboard ( ) ;
Ich habe hier ein Beispiel mit dem PlayerInteractEvent erstellt. Es öffnet ein neues Keyboard, wenn ein Spieler mit einem Stock interagiert.
Code (Java):
@EventHandler
    public void onPlayerInteract ( final PlayerInteractEvent event ) {
        final Player player = event. getPlayer ( ) ;
        if (event. getItem ( ) != null ) {
            if (event. getItem ( ). getType ( ) == Material. STICK ) {
                final Keyboard keyboard = KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). registerNewKeyboard (player, Language. ENGLISH ) ;
                keyboard. openKeyboard ( ) ;
                KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getMatchingKeyboard (player ). openKeyboard ( ) ; // only execute if you didn't use the method above!
            }
        }
    }



3. Events benutzen / Mit Events arbeiten
Die API löst Events aus, wenn eine Aktion auf der Tastatur geschieht.

● KeyboardEnteredResultEvent
➥ Dieses Event wird ausgelöst, wenn ein Spieler seine Eingabe auf der Tastatur bestätigt.
Es übergibt einen Spieler, der den Knopf gedrückt hat und das Keyboard-Objekt, welches der Spieler benutzt hat. Du kannst diese Werte folgendermaßen bekommen:
getKeyboard() and getPlayer().
Code Beispiel:
Code (Java):
@EventHandler
    public void onKeyboardEnterResult ( final KeyboardEnteredResultEvent event ) {
        final Player player = event. getPlayer ( ) ;
        final Keyboard keyboard = event. getKeyboard ( ) ;

        player. sendMessage (KeyboardAPI. getInstance ( ). getPrefix ( ) + "§7Your input§8: §a" + keyboard. getTypeResult ( ) ) ;
    }
Diese Code sendet dem Spieler eine Nachricht mit dem Text, den er eingegeben hat.

● KeyboardCanceledTypingEvent
➥ Dieses Event wird aufgerufen, wenn ein Spieler sein Tastaturinventar entweder mit den dafür vorgesehenen Items oder mit seiner echten Tastatur ([ESC] und/oder [E]) schließt. Du kannst die selben Werte wie beim KeyboardEnteredResultEvent getten. Es ist jedoch sehr wichtig die Tastatur wieder zu "entregistrieren".

Code (Java):
@EventHandler
    public void onKeyboardCanceledTyping ( final KeyboardCanceledTypingEvent event ) {
        final Player player = event. getPlayer ( ) ;
        final Keyboard keyboard = event. getKeyboard ( ) ;

        // Important to unregister the keyboard of the player!
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). unregisterKeyboard (player ) ;
       
        player. sendMessage (KeyboardAPI. getInstance ( ). getPrefix ( ) + "§7You canceled typing!" ) ;
    }

4. Mit dem KeyboardHandler arbeiten
Der KeyboardHandler ist eine Klasse, in der essentielle Methoden für die Verwaltung der Tastaturen vorhanden sind.
Code (Java):
// Unregisters the keyboard of a player. So no inputs will be received anymore.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). unregisterKeyboard (player ) ;
       
        // Returns a Keyboard object. The keyboard which is assigned to a certain player.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getMatchingKeyboard (player ) ;
       
        // Returns a list with all keyboards which are currently in use.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). getActiveKeyboards ( ) ;
       
        // Returns true if a player has got a keyboard and false if not.
        KeyboardAPI. getInstance ( ). getKeyboardHandler ( ). playerHasKeyboard (player ) ;
Für mehr Details kannst du dir auch die ausführlichen Java-Docs über den Methoden im SourceCode durchlesen.

keyboard_important.png

● EN » This plugin was a lot of work but I hope you like it. If you download the plugin you need to accept these following terms of use:
1. You are not allowed to (re-)sell this plugin.
2. You are not allowed to claim this as your own
3. You are allowed to look inside the source code
4. You are allowed to sell plugins using this API if you don't send this plugin together with your product. You need to link to this resource!

If you want to report a bug or an error, don't use the review section! These reports will be ignored. Please use the discussion or if you don't want other people to see your message you can also start a private conversation with me c:

If you have a YouTube channel or something like this you can make a video about this API and I will link it here ;)


● DE »
Dieses Plugin war sehr viel Arbeit, aber ich hoffe, dass es euch gefällt. Wenn du dieses Plugin herunterlädst, akzeptierst du die Folgenden Regeln der Benutzung:
1. Du darfst das Plugin nicht (weiter-)verkaufen.
2. Du darfst das Plugin nicht als dein eigenes ausgeben
3. Du darfst in den Quellcode des Plugins hereinschauen.
4. Du darfst Plugins verkaufen, die diese API benutzen, jedoch darfst du diese dann nicht mit deinem Produkt versenden, sondern musst einen Link zum herunterladen anbieten.

Wenn du einen Bug melden möchtest, dann benutze bitte nicht die Reviewfunktion! Diese Meldungen werden ignoriert werden. Bitte benutze die Diskussion oder wenn du nicht möchtest, dass andere deine Nachricht sehen, die Privatnachricht-Funktion c:

Wenn du einen YouTube-Kanal hast, kannst du gerne ein Video zu diesem Plugin machen und ich werde es in diesem Post verlinken ;)

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

KeyboardAPI » Add keyboards to your server is a free Minecraft Java mod. Compatible with Minecraft 1.8. Downloaded 206 times (via Spigot). Download it and open it directly in the game.

Explore more