Jump to content
  • 0

Server Mailcontroller


Question

Posted

No idea why , but seems i cant make it Start , or its not working.. but ive added one "check" to make sure its running , and no msg at all XD

 

Ive checked on gameserver.java , log.getinstance and import Is there..  ANY other idea? maybe the whole code is the problem? Im using Freya l2j And also Ive added javax.mail.jar on libs and on build.xml 9 Ive found it on Java

 

https://java.net/projects/javamail/pages/Home

	public Log()
	{
		System.out.println("log : Enabled 1st stage");
		Logger.loadConfigs();
		
		if(Logger.enabled)
		{
			checkemail = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new LogController(),/* 5 * 60000*/60000, /*5 * 60000*/60000);// Test 1 minute, live +-5 minutes
		}	
	}

    code by ^Wyatt

Index: dist/game/config/MailController.properties
===================================================================
--- dist/game/config/MailController.properties	(revision 0)
+++ dist/game/config/MailController.properties	(revision 0)
@@ -0,0 +1,43 @@
+# -----------------------------------------------------------------------------------------------------------
+# 	MailController
+# 	Developed by Mhoska & Wyatt
+# -----------------------------------------------------------------------------------------------------------
+# 	This tool it's used to land admin commands via e-mail
+# -----------------------------------------------------------------------------------------------------------
+# 	Available commands			Information										Target Status
+# -----------------------------------------------------------------------------------------------------------
+# 	Restart 120					Restart Time										-
+# 	Shutdown 120				Shutdown Time										-
+# 	Kick Wyatt					Kick PlayerName										-
+# 	Ban_Char Wyatt				Ban_Char PlayerName									Both
+# 	Ban_Acc L2jHidden			Ban_Acc PlayerName									Both
+# 	Unban_Char Wyatt			Unban_Char PlayerName								-
+# 	Unban_Acc L2jHidden			Unban_Acc PlayerName								-
+# 	Jail Wyatt	60				Jail PlayerName	Time								Both
+# 	UnJail Wyatt				UnJail PlayerName									Both
+# 	Announce blablabla			Announce Text Text...								-
+# 	Repair Wyatt				Repair PlayerName								Must be Offline
+# 	GiveItem Wyatt 57 10		GiveItem PlayerName ItemId ItemCount			Must be Online
+# 	GiveItemAll 57 10			GiveItemAll ItemId ItemCount					Must be Online
+#	GetOnlineCount				(Gives you a feedback of online players)			-
+# -----------------------------------------------------------------------------------------------------------
+# 	Configs
+# 	Note: Recommended to se a new e-mail that will only be used for this script.
+# -----------------------------------------------------------------------------------------------------------	
+# Enable/Disable the system.
+Enabled = True				
+
+# Here you must especify your GMAIL e-mail.
+Email = 123456@gmail.com
+
+# Here you must especify your GMAIL e-mail password.
+EmailPassword = 123456
+
+# IMPORTANT: Here you must especify your personal password that you'll have to put as Subject
+# in every e-mail that you send.
+SystemPassword = DumbHoe
+
+# Here you must especify your personal e-mail that will get a feedback after some commands use.
+# Just to get the feedback, you can use commands no matter which email you use.
+EmailSender = 654321@gmail.com
Index: java/com/l2jserver/gameserver/model/email/Logger.java
===================================================================
--- java/com/l2jserver/gameserver/model/email/Logger.java	(revision 0)
+++ java/com/l2jserver/gameserver/model/email/Logger.java	(revision 0)
@@ -0,0 +1,118 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.email;
+
+import java.io.*;
+import java.util.*;
+import javax.mail.*;
+import javax.mail.Flags.Flag;
+import javax.mail.search.AndTerm;
+import javax.mail.search.FlagTerm;
+import javax.mail.search.SearchTerm;
+import javax.mail.search.SubjectTerm;
+import com.sun.mail.imap.IMAPFolder;
+
+/**
+ * 
+ * @author Mhoska
+ * @rework Wyatt
+ * 
+ */
+
+public class Logger 
+{
+	public static String emailpass = "";
+	public static String email = "";
+	public static String pass = "";
+	public static String content = "";
+	public static String to = "";
+	public static boolean enabled = false;
+	
+    public static void main(String[] args) throws MessagingException, IOException 
+    {
+        IMAPFolder folder = null;
+        Store store = null;
+        @SuppressWarnings("unused")
+		String subject = null;
+        @SuppressWarnings("unused")
+		Flag flag = null;      
+        @SuppressWarnings("unused")
+		String nonsense = "restart";
+       
+        try 
+        {
+        	content = "";
+        	Properties props = System.getProperties();
+        	props.setProperty("mail.store.protocol", "imaps");
+        	Session session = Session.getDefaultInstance(props, null);
+        	store = session.getStore("imaps");
+          	store.connect("imap.googlemail.com", email, emailpass);
+          	folder = (IMAPFolder) store.getFolder("INBOX"); // This works for the whole inbox
+         
+          	if(!folder.isOpen())
+          	{
+          		folder.open(Folder.READ_WRITE);
+          	}
+          	Flags seen = new Flags(Flags.Flag.SEEN);
+          	FlagTerm unseenFlagTerm = new FlagTerm(seen, false);
+          	Flags recent = new Flags(Flags.Flag.RECENT);
+          	@SuppressWarnings("unused")
+          	FlagTerm recentFlagTerm = new FlagTerm(recent, true);       
+          	SearchTerm dumb = new SubjectTerm(pass); 
+          	SearchTerm searchTerm = new AndTerm(unseenFlagTerm, dumb);
+          	Message[] messages = folder.search(searchTerm);
+
+          	for (int i=0; i < messages.length;i++)   	  
+          	{
+        		 Message msg =  messages[i];
+        		 content = ""+msg.getContent();
+          	}
+        }
+        finally 
+        {
+        	if (folder != null && folder.isOpen()) 
+        	{
+        		folder.close(true); 
+        	}
+        	if (store != null) 
+        	{
+        		store.close(); 
+        	}
+        }
+        
+        if (!content.equals(""))
+        {
+        	Log.Load(content);
+        }
+    }
+    
+   public static void loadConfigs()
+	{
+		try
+		{
+			Properties prop = new Properties();
+			prop.load(new FileInputStream(new File("./config/MailController.properties")));
+			to = prop.getProperty("EmailSender", "123456@gmail.com");
+			emailpass = prop.getProperty("EmailPassword", "123456");
+			email = prop.getProperty("Email", "123456@gmail.com");
+			pass = prop.getProperty("SystemPassword", "DumbHoe");
+			enabled = Boolean.parseBoolean(prop.getProperty("Enabled", "True"));
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+	}	
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/GameServer.java
===================================================================
--- java/com/l2jserver/gameserver/GameServer.java	(revision 5822)
+++ java/com/l2jserver/gameserver/GameServer.java	(working copy)
@@ -117,8 +117,10 @@
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.PartyMatchRoomList;
 import com.l2jserver.gameserver.model.PartyMatchWaitingList;
+import com.l2jserver.gameserver.model.email.Log;
 import com.l2jserver.gameserver.model.entity.Hero;
 import com.l2jserver.gameserver.model.entity.TvTManager;
@@ -306,11 +308,13 @@
 		CursedWeaponsManager.getInstance();
 		
 		printSection("Scripts");
+		Log.getInstance();
 		QuestManager.getInstance();
 		TransformationManager.getInstance();
 		BoatManager.getInstance();
Index: java/com/l2jserver/gameserver/model/email/Packet.java
===================================================================
--- java/com/l2jserver/gameserver/model/email/Packet.java	(revision 0)
+++ java/com/l2jserver/gameserver/model/email/Packet.java	(revision 0)
@@ -0,0 +1,69 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.email;
+
+import java.util.Properties;
+import javax.mail.Address;
+import javax.mail.Message;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * 
+ * @author Wyatt
+ * 
+ */
+
+public class Packet
+{
+	   
+	public static void send()
+	{  
+		try
+		{
+			Properties props = new Properties();
+			props.put("mail.smtps.host", "smtp.gmail.com");
+			props.put("mail.smtps.auth", "true");
+			props.put("mail.transport.protocol", "smtp");
+			props.put("mail.debug", "false");
+			Session mailSession = Session.getDefaultInstance(props);
+			Transport transport = mailSession.getTransport("smtps");
+			InternetAddress fromAddress = new InternetAddress(Logger.email);
+			InternetAddress toAddress = new InternetAddress(Logger.to);
+			Message simpleMessage = new MimeMessage(mailSession);
+			simpleMessage.setFrom(fromAddress);
+			simpleMessage.setRecipient(Message.RecipientType.TO, toAddress);
+			simpleMessage.setSubject("Feedback Player Online Count Report");
+			String text = "Players Online("+L2World.getInstance().getAllPlayersCount()+"):";
+			
+			for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayers().values(new L2PcInstance[0]))
+			{
+				text = text+" "+onlinePlayer.getName()+",";
+			}
+			simpleMessage.setText(text);
+			transport.connect("smtp.gmail.com", Logger.email, Logger.emailpass);
+			transport.sendMessage(simpleMessage, new Address[] { toAddress });
+			transport.close();
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/email/Log.java
===================================================================
--- java/com/l2jserver/gameserver/model/email/Log.java	(revision 0)
+++ java/com/l2jserver/gameserver/model/email/Log.java	(revision 0)
@@ -0,0 +1,483 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.email;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.StringTokenizer;
+import java.util.concurrent.ScheduledFuture;
+import javax.mail.MessagingException;
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.LoginServerThread;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.Shutdown;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.items.L2Item;
+
+/**
+ * 
+ * @author Wyatt
+ * 
+ */
+
+public class Log 
+{
+	private static int time = 0;
+	private static String player = "";
+	private static String text = "";
+	private static L2PcInstance plyr = null;
+	private static L2PcInstance targetPlayer = null;
+	private static int itemid = 0;
+	private static int itemcount = 0;
+	private static ScheduledFuture<?> checkemail = null;
+	
+	public Log()
+	{
+		Logger.loadConfigs();
+		
+		if(Logger.enabled)
+		{
+			checkemail = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new LogController(),/* 5 * 60000*/60000, /*5 * 60000*/60000);// Test 1 minute, live +-5 minutes
+		}	
+	}
+	
+	private static void cancelTask()
+	{
+		if(checkemail != null)
+		{
+			checkemail.cancel(false);
+			checkemail = null;
+		}
+	}
+	
+	private static void intialize()
+	{
+		time = 0;
+		player = "";
+		text = "";
+		plyr = null;
+		targetPlayer = null;
+		itemid = 0;
+		itemcount = 0;
+	}
+	
+	public static void Load(String command)
+	{
+		intialize();
+		
+		if(command.toLowerCase().startsWith("restart"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			
+			if (st.hasMoreTokens())
+			{
+				st.nextToken();
+				time = Integer.parseInt(st.nextToken());
+				
+				if (time <= 0)
+				{
+					return;
+				}
+			}
+			else
+			{
+				return;
+			}
+			cancelTask();	
+			Shutdown.getInstance().startShutdown(null, time, true);
+		}
+		else if(command.toLowerCase().startsWith("shutdown"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			
+			if (st.hasMoreTokens())
+			{
+				st.nextToken();
+				time = Integer.parseInt(st.nextToken());
+				
+				if (time <= 0)
+				{
+					return;
+				}
+			}
+			else
+			{
+				return;
+			}
+			cancelTask();	
+			Shutdown.getInstance().startShutdown(null, time, false);
+		}
+		else if (command.toLowerCase().startsWith("kick"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			
+			if (st.countTokens() > 1)
+			{
+				st.nextToken();
+				player = st.nextToken();
+				plyr = L2World.getInstance().getPlayer(player);
+				
+				if (plyr != null)
+				{
+					plyr.logout();
+				}
+			}
+		}
+		else if (command.toLowerCase().startsWith("ban_char"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+			}
+			changeCharAccessLevel(targetPlayer, player, -100);
+		}
+		else if (command.toLowerCase().startsWith("ban_acc"))
+		{	
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+			}
+			
+			if (targetPlayer != null)
+			{
+				targetPlayer.setPunishLevel(L2PcInstance.PunishLevel.ACC, 0);
+				targetPlayer.logout();
+			}
+			else
+			{
+				LoginServerThread.getInstance().sendAccessLevel(player, -100);
+			}
+		}
+		else if (command.toLowerCase().startsWith("unban_char"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+			}
+			
+			if (targetPlayer == null)
+			{
+				LoginServerThread.getInstance().sendAccessLevel(player, 0);
+				changeCharAccessLevel(null, player, 0);
+			}
+		}
+		else if (command.toLowerCase().startsWith("unban_acc"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+			}
+			
+			if (targetPlayer == null)
+			{
+				LoginServerThread.getInstance().sendAccessLevel(player, 0);
+			}
+		}
+		else if (command.toLowerCase().startsWith("jail"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+				
+				if (st.hasMoreTokens())
+				{
+					try
+					{
+						time = Integer.parseInt(st.nextToken());
+					}
+					catch (NumberFormatException nfe)
+					{
+						nfe.printStackTrace();
+					}
+				}
+			}
+			
+			if (targetPlayer != null)
+			{
+				if (targetPlayer.isFlyingMounted())
+				{
+					targetPlayer.untransform();
+				}
+				targetPlayer.setPunishLevel(L2PcInstance.PunishLevel.JAIL, time);
+			}
+			else
+			{
+				jailOfflinePlayer(player, time);
+			}
+		}
+		else if (command.toLowerCase().startsWith("getonlinecount"))
+		{
+			Packet.send();
+		}
+		else if (command.toLowerCase().startsWith("unjail"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+			}
+
+			if (targetPlayer != null)
+			{
+				targetPlayer.setPunishLevel(L2PcInstance.PunishLevel.NONE, 0);
+			}
+			else
+			{
+				unjailOfflinePlayer(player);
+			}
+		}
+		else if (command.toLowerCase().startsWith("announce"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			while (st.hasMoreTokens())
+			{
+				text = text+" "+st.nextToken();
+			}
+			Announcements.getInstance().announceToAll(text, false);	
+		}
+		else if (command.toLowerCase().startsWith("giveitemall"))
+		{	
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				itemid = Integer.parseInt(st.nextToken());
+				itemcount = Integer.parseInt(st.nextToken());	
+			}
+			L2Item template = ItemTable.getInstance().getTemplate(itemid);
+			
+			for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayers().values(new L2PcInstance[0]))
+			{
+					onlinePlayer.addItem("Admin Reward", itemid, itemcount, onlinePlayer, true);
+					
+					if (template != null)
+					{
+						onlinePlayer.sendMessage("Admin rewarded you with "+itemcount+" "+template.getName()+" in your inventory.");
+					}
+			}
+			Announcements.getInstance().announceToAll("Admin rewarded all online players, check your inventory.", false);	
+		}
+		else if (command.toLowerCase().startsWith("giveitem"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				player = st.nextToken();
+				targetPlayer = L2World.getInstance().getPlayer(player);
+			}
+			
+			if (targetPlayer != null)
+			{
+				itemid = Integer.parseInt(st.nextToken());
+				itemcount = Integer.parseInt(st.nextToken());
+				targetPlayer.addItem("Admin Reward", itemid, itemcount, targetPlayer, true);
+				targetPlayer.sendMessage("Admin rewarded you, check your inventory.");
+			}	
+		}	
+		else if (command.toLowerCase().startsWith("repair"))
+		{
+			StringTokenizer st = new StringTokenizer(command);
+			st.nextToken();
+			
+			if (st.hasMoreTokens())
+			{
+				handleRepair(st.nextToken());
+			}
+		}
+	}
+	
+	private static void changeCharAccessLevel(L2PcInstance targetPlayer, String player, int lvl)
+	{
+		if (targetPlayer != null)
+		{
+			targetPlayer.setAccessLevel(lvl);
+			targetPlayer.sendMessage("Your character has been banned. Goodbye.");
+			targetPlayer.logout();
+			RegionBBSManager.getInstance().changeCommunityBoard();
+		}
+		else
+		{
+			try
+			{
+				Connection con = L2DatabaseFactory.getInstance().getConnection();
+				PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
+				statement.setInt(1, lvl);
+				statement.setString(2, player);
+				statement.execute();
+				statement.close();
+				con.close();
+			}
+			catch (SQLException se)
+			{
+				se.printStackTrace();
+			}
+		}
+		return;
+	}
+	
+	private static void jailOfflinePlayer(String name, int delay)
+	{
+		try
+		{
+			Connection con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
+			statement.setInt(1, -114356);
+			statement.setInt(2, -249645);
+			statement.setInt(3, -2984);
+			statement.setInt(4, L2PcInstance.PunishLevel.JAIL.value());
+			statement.setLong(5, (delay > 0 ? delay * 60000L : 0));
+			statement.setString(6, name);
+			statement.execute();
+			statement.close();
+			con.close();
+		}
+		catch (SQLException se)
+		{
+			se.printStackTrace();
+		}
+	}
+	
+	private static void unjailOfflinePlayer(String name)
+	{
+		try
+		{
+			Connection con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
+			statement.setInt(1, 17836);
+			statement.setInt(2, 170178);
+			statement.setInt(3, -3507);
+			statement.setInt(4, 0);
+			statement.setLong(5, 0);
+			statement.setString(6, name);
+			statement.execute();
+			statement.close();	
+			con.close();
+		}	
+		catch (SQLException se)
+		{
+			se.printStackTrace();
+		}
+	}
+	
+	private static void handleRepair(String charname)
+	{
+
+		String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
+		
+		try
+		{
+			Connection connection = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = connection.prepareStatement(cmd);
+			statement.setString(1, charname);
+			statement.execute();
+			statement.close();	
+			statement = connection.prepareStatement("SELECT charId FROM characters where char_name=?");
+			statement.setString(1, charname);
+			ResultSet rset = statement.executeQuery();
+			int objId = 0;
+			
+			if (rset.next())
+			{
+				objId = rset.getInt(1);
+			}	
+			rset.close();
+			statement.close();
+			
+			if (objId == 0)
+			{
+				connection.close();
+				return;
+			}
+			statement = connection.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
+			statement.setInt(1, objId);
+			statement.execute();
+			statement.close();	
+			statement = connection.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
+			statement.setInt(1, objId);
+			statement.execute();
+			statement.close();
+			connection.close();
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+	
+	public class LogController implements Runnable
+	{ 
+		@Override
+		public void run()
+		{ 
+			try 
+			{
+				Logger.main(null);
+			} 
+			catch (MessagingException e) 
+			{	
+				e.printStackTrace();
+			} 
+			catch (IOException e)
+			{
+				e.printStackTrace();
+			}
+		}
+	 }
+	 
+	 public static Log getInstance()
+	 {
+		 return SingletonHolder._instance;
+	 }
+	 
+	 public static class SingletonHolder
+	 {
+		 protected static final Log _instance = new Log();
+	 }
+}
\ No newline at end of file

 

 

 

 

 

 

http://www.maxcheaters.com/topic/166979-server-mailcontroller/

7 answers to this question

Recommended Posts

  • 0
Posted (edited)

So are you calling it from Gameserver or..? I mean... if u added the line there... should work.

Edited by ^Wyatt
  • 0
Posted (edited)

ive added this line

System.out.println("log : Enabled 1st stage");

Like this

public Log()
	{
		System.out.println("log : Enabled 1st stage");
		Logger.loadConfigs();
		
		if(Logger.enabled)
		{
			checkemail = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new LogController(),/* 5 * 60000*/60000, /*5 * 60000*/60000);// Test 1 minute, live +-5 minutes
		}	
	}

On Log.java

 

and and Rest like you did on your code ^^ include The gameserver.java part with import.. xD Like on your code you shared ^^

Edited by ČυяŞŀŅğ
  • 0
Posted

That has not much sense, if you're calling it like that, the "System.out.println("log : Enabled 1st stage");" should appear in GS.

  • 0
Posted (edited)

Yeap :D but why ? On gameserver.java is fine :/

No clue, dunno what you did.

You can always debug something above your Gameserver.java line to see if you added it fine or you placed it somewhere wrong and it's not loading.

 

PD: Maybe the filename "Log" is the same as another file and your import is wrong :s

Edited by ^Wyatt

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...