-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed a small bug (temp) added StackedEvents & Admin greeting ion Join prepared the next step ahead
- Loading branch information
1 parent
9b56bc8
commit 249a27f
Showing
6 changed files
with
193 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ AdminBot/auth.app | |
AdminBot/auth.app | ||
*.log | ||
*.lck | ||
AdminBot/auth.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package de.crackscout.Commands; | ||
|
||
import com.github.theholywaffle.teamspeak3.TS3Api; | ||
import com.github.theholywaffle.teamspeak3.api.TextMessageTargetMode; | ||
import com.github.theholywaffle.teamspeak3.api.event.TS3EventAdapter; | ||
import com.github.theholywaffle.teamspeak3.api.event.TS3EventType; | ||
import com.github.theholywaffle.teamspeak3.api.event.TextMessageEvent; | ||
|
||
import de.crackscout.AdminBot.Main; | ||
import de.crackscout.Managers.Utils; | ||
|
||
public class Clear { | ||
|
||
static TS3Api api = Main.api; | ||
|
||
public static void load(){ | ||
// Get our own client ID by running the "whoami" command | ||
int clientId = api.whoAmI().getId(); | ||
|
||
// Listen to chat in the channel the query is currently in | ||
// As we never changed the channel, this will be the default channel of the server | ||
api.registerEvent(TS3EventType.TEXT_PRIVATE, 0); | ||
|
||
// Register the event listener | ||
api.addTS3Listeners(new TS3EventAdapter() { | ||
|
||
@Override | ||
public void onTextMessage(TextMessageEvent e) { | ||
// Only react to private messages not sent by the query itself | ||
if (e.getTargetMode() != TextMessageTargetMode.SERVER && e.getInvokerId() != clientId) { | ||
String message = e.getMessage().toLowerCase(); | ||
|
||
if (message.equals("!clear")) { | ||
int kickSize = Utils.kickMeList.size(); | ||
int whitelistSize = Utils.whitelistedUsers.size(); | ||
|
||
api.sendPrivateMessage(e.getInvokerId(), "\nArray<> kickMe has a total size of: " +kickSize +"." | ||
+ "\nArray<> whitelist has a total size of: " +whitelistSize+"." | ||
+ "\n Both are going to be cleared."); | ||
Utils.kickMeList.clear(); | ||
Utils.whitelistedUsers.clear(); | ||
api.sendPrivateMessage(e.getInvokerId(), "done."); | ||
|
||
} | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
/** | ||
* | ||
* @author Joel Rzepka - crackscout.de | ||
* | ||
* @date 30.03.2023 - 03:11:54 | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package de.crackscout.Events; | ||
|
||
import com.github.theholywaffle.teamspeak3.TS3Api; | ||
import com.github.theholywaffle.teamspeak3.api.event.ChannelCreateEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ChannelDeletedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ChannelDescriptionEditedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ChannelEditedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ChannelMovedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ChannelPasswordChangedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ClientJoinEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ClientLeaveEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ClientMovedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.PrivilegeKeyUsedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.ServerEditedEvent; | ||
import com.github.theholywaffle.teamspeak3.api.event.TS3Listener; | ||
import com.github.theholywaffle.teamspeak3.api.event.TextMessageEvent; | ||
import com.github.theholywaffle.teamspeak3.api.wrapper.Client; | ||
|
||
import de.crackscout.AdminBot.Main; | ||
import de.crackscout.Managers.AuthManager; | ||
import de.crackscout.Managers.Debug; | ||
|
||
public class StackedEvents { | ||
|
||
static TS3Api api = Main.api; | ||
|
||
public static void load(){ | ||
|
||
api.registerAllEvents(); | ||
api.addTS3Listeners(new TS3Listener() { | ||
|
||
|
||
@Override | ||
public void onClientJoin(ClientJoinEvent e) { | ||
|
||
Client client = api.getClientByUId(e.getUniqueClientIdentifier()); | ||
|
||
if(AuthManager.auth(client)) { | ||
api.sendPrivateMessage(client.getId(), "\nWelcome Admin" | ||
+ "\n!stay - Ignore AFK" | ||
+ "\n!kickme - Self kick" | ||
+ "\n!clear - Clear the Array cache" | ||
+ "\n!ping - Ping"); | ||
}else { | ||
|
||
Debug.err("no auth"); | ||
} | ||
} | ||
|
||
@Override | ||
public void onTextMessage(TextMessageEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onServerEdit(ServerEditedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onClientMoved(ClientMovedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onClientLeave(ClientLeaveEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onChannelEdit(ChannelEditedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onChannelDescriptionChanged(ChannelDescriptionEditedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onChannelCreate(ChannelCreateEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onChannelDeleted(ChannelDeletedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onChannelMoved(ChannelMovedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onChannelPasswordChanged(ChannelPasswordChangedEvent e) { | ||
// ... | ||
} | ||
|
||
@Override | ||
public void onPrivilegeKeyUsed(PrivilegeKeyUsedEvent e) { | ||
// ... | ||
} | ||
}); | ||
} | ||
} | ||
|
||
|
||
|
||
/** | ||
* | ||
* @author Joel Rzepka - crackscout.de | ||
* | ||
* @date 30.03.2023 - 02:38:34 | ||
* | ||
*/ |