Java Code Examples for protocolsupport.api.ProtocolSupportAPI#getProtocolVersion()

The following examples show how to use protocolsupport.api.ProtocolSupportAPI#getProtocolVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldResourcepacks.java    From ResourcepacksPlugins with GNU General Public License v3.0 6 votes vote down vote up
@Override
public int getPlayerProtocol(UUID playerId) {
    Player player = getServer().getPlayer(playerId);
    if (player != null) {
        int protocol = serverProtocolVersion;
        if (viaApi != null) {
            protocol = viaApi.getPlayerVersion(playerId);
        }
        if (protocolSupportApi && protocol == serverProtocolVersion) { // if still same format test if player is using previous version
            ProtocolVersion version = ProtocolSupportAPI.getProtocolVersion(player);
            if (version.getProtocolType() == ProtocolType.PC) {
                protocol = version.getId();
            }
        }
        return protocol;
    }
    return -1;
}
 
Example 2
Source File: ProtocolSupportVersionProvider.java    From BungeeTabListPlus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean has18OrLater(ProxiedPlayer player) {
    ProtocolVersion protocolVersion = ProtocolSupportAPI.getProtocolVersion(player);
    if (psb12) {
        switch (protocolVersion) {
            case MINECRAFT_1_8:
                return true;
            default:
                return false;
        }
    } else {
        return protocolVersion.isAfterOrEq(ProtocolVersion.MINECRAFT_1_8);
    }
}
 
Example 3
Source File: ProtocolSupportVersionProvider.java    From BungeeTabListPlus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean has113OrLater(ProxiedPlayer player) {
    ProtocolVersion protocolVersion = ProtocolSupportAPI.getProtocolVersion(player);
    if (psb12) {
        return false;
    } else {
        return protocolVersion.getId() >= 393;
    }
}
 
Example 4
Source File: ProtocolSupportVersionProvider.java    From BungeeTabListPlus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean is18(ProxiedPlayer player) {
    ProtocolVersion protocolVersion = ProtocolSupportAPI.getProtocolVersion(player);
    return protocolVersion == ProtocolVersion.MINECRAFT_1_8;
}