Skip to content

Commit

Permalink
If plugin is already joined to the channel, joining is skipping.
Browse files Browse the repository at this point in the history
  • Loading branch information
estintax committed Feb 12, 2020
1 parent 0baa7b0 commit c3d1c36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/in/pinig/ttvmc/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package in.pinig.ttvmc;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
Expand All @@ -10,6 +11,7 @@ public class Main extends JavaPlugin {
public static FileConfiguration config;
public static HashMap<String, Boolean> state;
public static HashMap<String, String> channels;
public static ArrayList<String> joinedChannels;
@Override
public void onEnable() {
// config
Expand All @@ -18,6 +20,7 @@ public void onEnable() {

state = new HashMap<String, Boolean>();
channels = new HashMap<String, String>();
joinedChannels = new ArrayList<String>();

Utils.loadChannelsFromConfig();

Expand Down
2 changes: 2 additions & 0 deletions src/in/pinig/ttvmc/TMI.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public void run() {
out.println("NICK justinfan35815\n");
for(Map.Entry<String, String> e: Main.channels.entrySet()) {
String channel = e.getValue();
if(Main.joinedChannels.contains(channel)) continue;
System.out.println("Joining to #" + channel + " just for " + e.getKey());
out.println("JOIN #" + channel + "\n");
Main.joinedChannels.add(channel);
}

for (;;) {
Expand Down

0 comments on commit c3d1c36

Please sign in to comment.