001package com.github.theholywaffle.teamspeak3.api.event; 002 003/* 004 * #%L 005 * TeamSpeak 3 Java API 006 * %% 007 * Copyright (C) 2014 Bert De Geyter 008 * %% 009 * Permission is hereby granted, free of charge, to any person obtaining a copy 010 * of this software and associated documentation files (the "Software"), to deal 011 * in the Software without restriction, including without limitation the rights 012 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 013 * copies of the Software, and to permit persons to whom the Software is 014 * furnished to do so, subject to the following conditions: 015 * 016 * The above copyright notice and this permission notice shall be included in 017 * all copies or substantial portions of the Software. 018 * 019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 020 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 021 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 022 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 023 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 024 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 025 * THE SOFTWARE. 026 * #L% 027 */ 028 029import com.github.theholywaffle.teamspeak3.api.ClientProperty; 030import com.github.theholywaffle.teamspeak3.api.wrapper.Wrapper; 031 032public class ClientJoinEvent extends BaseEvent { 033 034 public ClientJoinEvent(Wrapper wrapper) { 035 super(wrapper); 036 } 037 038 public int getClientFromId() { 039 return getInt("cfid"); 040 } 041 042 public int getClientTargetId() { 043 return getInt("ctid"); 044 } 045 046 public int getClientId() { 047 return getInt("clid"); 048 } 049 050 public String getUniqueClientIdentifier() { 051 return get(ClientProperty.CLIENT_UNIQUE_IDENTIFIER); 052 } 053 054 public String getClientNickname() { 055 return get(ClientProperty.CLIENT_NICKNAME); 056 } 057 058 public boolean isClientInputMuted() { 059 return getBoolean(ClientProperty.CLIENT_INPUT_MUTED); 060 } 061 062 public boolean isClientOutputMuted() { 063 return getBoolean(ClientProperty.CLIENT_OUTPUT_MUTED); 064 } 065 066 public boolean isClientOutputOnlyMuted() { 067 return getBoolean(ClientProperty.CLIENT_OUTPUTONLY_MUTED); 068 } 069 070 public boolean isClientUsingHardwareInput() { 071 return getBoolean(ClientProperty.CLIENT_INPUT_HARDWARE); 072 } 073 074 public boolean isClientUsingHardwareOutput() { 075 return getBoolean(ClientProperty.CLIENT_OUTPUT_HARDWARE); 076 } 077 078 public String getClientMetadata() { 079 return get(ClientProperty.CLIENT_META_DATA); 080 } 081 082 public boolean isClientRecording() { 083 return getBoolean(ClientProperty.CLIENT_IS_RECORDING); 084 } 085 086 public int getClientDatabaseId() { 087 return getInt(ClientProperty.CLIENT_DATABASE_ID); 088 } 089 090 public int getClientChannelGroupId() { 091 return getInt(ClientProperty.CLIENT_CHANNEL_GROUP_ID); 092 } 093 094 public int getAmountOfServerGroups() { 095 //getInt was turning the String 1,2,3,.. to a int which wasn't right. 096 //Now it gets the Amount even if the ID is <=10 097 String[] split = get(ClientProperty.CLIENT_SERVERGROUPS).split(","); 098 return split.length; 099 } 100 101 public String getClientServerGroups() { 102 //getClientServerGroups returns a string containing the server group ID for example 1,2,3,... 103 return get(ClientProperty.CLIENT_SERVERGROUPS); 104 } 105 106 public boolean isClientAway() { 107 return getBoolean(ClientProperty.CLIENT_AWAY); 108 } 109 110 public String getClientAwayMessage() { 111 return get(ClientProperty.CLIENT_AWAY_MESSAGE); 112 } 113 114 public int getClientType() { 115 return getInt(ClientProperty.CLIENT_TYPE); 116 } 117 118 public String getClientFlagAvatarId() { 119 return get(ClientProperty.CLIENT_FLAG_AVATAR); 120 } 121 122 public int getClientTalkPower() { 123 return getInt(ClientProperty.CLIENT_TALK_POWER); 124 } 125 126 public boolean isClientRequestingToTalk() { 127 return getBoolean(ClientProperty.CLIENT_TALK_REQUEST); 128 } 129 130 public String getClientTalkRequestMessage() { 131 return get(ClientProperty.CLIENT_TALK_REQUEST_MSG); 132 } 133 134 public String getClientDescription() { 135 return get(ClientProperty.CLIENT_DESCRIPTION); 136 } 137 138 public boolean isClientTalking() { 139 return getBoolean(ClientProperty.CLIENT_IS_TALKER); 140 } 141 142 public boolean isClientPrioritySpeaker() { 143 return getBoolean(ClientProperty.CLIENT_IS_PRIORITY_SPEAKER); 144 } 145 146 public int getClientUnreadMessages() { 147 return getInt(ClientProperty.CLIENT_UNREAD_MESSAGES); 148 } 149 150 public String getClientPhoneticNickname() { 151 return get(ClientProperty.CLIENT_NICKNAME_PHONETIC); 152 } 153 154 public int getClientNeededServerQueryViewPower() { 155 return getInt(ClientProperty.CLIENT_NEEDED_SERVERQUERY_VIEW_POWER); 156 } 157 158 public long getClientIconId() { 159 return getLong(ClientProperty.CLIENT_ICON_ID); 160 } 161 162 public boolean isClientChannelCommander() { 163 return getBoolean(ClientProperty.CLIENT_IS_CHANNEL_COMMANDER); 164 } 165 166 public String getClientCountry() { 167 return get(ClientProperty.CLIENT_COUNTRY); 168 } 169 170 public int getClientInheritedChannelGroupId() { 171 return getInt(ClientProperty.CLIENT_CHANNEL_GROUP_INHERITED_CHANNEL_ID); 172 } 173 174 @Override 175 public void fire(TS3Listener listener) { 176 listener.onClientJoin(this); 177 } 178}