فهرست منبع

BETA: Cleanup and format:
* BaseGameServerRegister's JavaDocs, cleanup and formatting.
* Action packet cleanup and formatting.

Zoey76 13 سال پیش
والد
کامیت
611bb51e1b

+ 46 - 47
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/Action.java

@@ -17,27 +17,22 @@ package com.l2jserver.gameserver.network.clientpackets;
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2World;
-import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 
 /**
  * This class ...
- *
  * @version $Revision: 1.7.4.4 $ $Date: 2005/03/27 18:46:19 $
  */
+@SuppressWarnings("unused")
 public final class Action extends L2GameClientPacket
 {
 	private static final String __C__1F_ACTION = "[C] 1F Action";
 	
-	// cddddc
 	private int _objectId;
-	@SuppressWarnings("unused")
 	private int _originX;
-	@SuppressWarnings("unused")
 	private int _originY;
-	@SuppressWarnings("unused")
 	private int _originZ;
 	private int _actionId;
 	
@@ -55,84 +50,88 @@ public final class Action extends L2GameClientPacket
 	protected void runImpl()
 	{
 		if (Config.DEBUG)
-			_log.fine("Action:" + _actionId);
-		if (Config.DEBUG)
-			_log.fine("oid:" + _objectId);
+		{
+			_log.fine(getType() + ": Action:" + _actionId + " ObjId: " + _objectId);
+		}
 		
 		// Get the current L2PcInstance of the player
-		final L2PcInstance activeChar = getClient().getActiveChar();
-		
+		final L2PcInstance activeChar = getActiveChar();
 		if (activeChar == null)
+		{
 			return;
+		}
 		
 		if (activeChar.inObserverMode())
 		{
 			activeChar.sendPacket(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE);
-			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 		
 		final L2Object obj;
-		
 		if (activeChar.getTargetId() == _objectId)
+		{
 			obj = activeChar.getTarget();
-		else if (activeChar.isInAirShip()
-				&& activeChar.getAirShip().getHelmObjectId() == _objectId)
+		}
+		else if (activeChar.isInAirShip() && (activeChar.getAirShip().getHelmObjectId() == _objectId))
+		{
 			obj = activeChar.getAirShip();
+		}
 		else
+		{
 			obj = L2World.getInstance().findObject(_objectId);
+		}
 		
 		// If object requested does not exist, add warn msg into logs
 		if (obj == null)
 		{
 			// pressing e.g. pickup many times quickly would get you here
-			// _log.warning("Character: " + activeChar.getName() + " request action with non existent ObjectID:" + _objectId);
-			getClient().sendPacket(ActionFailed.STATIC_PACKET);
+			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 		
-		// Players can't interact with objects in the other instances
-		// except from multiverse
-		if (obj.getInstanceId() != activeChar.getInstanceId()
-				&& activeChar.getInstanceId() != -1)
+		// Players can't interact with objects in the other instances, except from multiverse
+		if ((obj.getInstanceId() != activeChar.getInstanceId()) && (activeChar.getInstanceId() != -1))
 		{
-			getClient().sendPacket(ActionFailed.STATIC_PACKET);
+			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 		
 		// Only GMs can directly interact with invisible characters
-		if (obj instanceof L2PcInstance
-				&& (((L2PcInstance)obj).getAppearance().getInvisible())
-				&& !activeChar.isGM())
+		if (obj.isPlayer() && obj.getActingPlayer().getAppearance().getInvisible() && !activeChar.isGM())
 		{
-			getClient().sendPacket(ActionFailed.STATIC_PACKET);
+			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 		
 		// Check if the target is valid, if the player haven't a shop or isn't the requester of a transaction (ex : FriendInvite, JoinAlly, JoinParty...)
-		if (activeChar.getActiveRequester() == null)
+		if (activeChar.getActiveRequester() != null)
 		{
-			switch (_actionId)
-			{
-				case 0:
-					obj.onAction(activeChar);
-					break;
-				case 1:
-					if (!activeChar.isGM() && !((obj instanceof L2Npc) && Config.ALT_GAME_VIEWNPC))
-						obj.onAction(activeChar, false);
-					else
-						obj.onActionShift(activeChar);
-					break;
-				default:
-					// Ivalid action detected (probably client cheating), log this
-					_log.warning("Character: " + activeChar.getName() + " requested invalid action: " + _actionId);
-					getClient().sendPacket(ActionFailed.STATIC_PACKET);
-					break;
-			}
-		}
-		else
 			// Actions prohibited when in trade
-			getClient().sendPacket(ActionFailed.STATIC_PACKET);
+			sendPacket(ActionFailed.STATIC_PACKET);
+		}
+		
+		switch (_actionId)
+		{
+			case 0:
+				obj.onAction(activeChar);
+				break;
+			case 1:
+				if (!activeChar.isGM() && !obj.isNpc() && Config.ALT_GAME_VIEWNPC)
+				{
+					obj.onAction(activeChar, false);
+				}
+				else
+				{
+					obj.onActionShift(activeChar);
+				}
+				break;
+			default:
+				// Invalid action detected (probably client cheating), log this
+				_log.warning(getType() + ": Character: " + activeChar.getName() + " requested invalid action: " + _actionId);
+				sendPacket(ActionFailed.STATIC_PACKET);
+				break;
+		}
 	}
 	
 	@Override

+ 167 - 137
L2J_Server_BETA/java/com/l2jserver/tools/gsregistering/BaseGameServerRegister.java

@@ -39,6 +39,7 @@ import com.l2jserver.tools.i18n.LanguageControl;
 import com.l2jserver.util.Util;
 
 /**
+ * The Class BaseGameServerRegister.
  * @author KenM
  */
 public abstract class BaseGameServerRegister
@@ -46,6 +47,10 @@ public abstract class BaseGameServerRegister
 	private boolean _loaded = false;
 	private ResourceBundle _bundle;
 	
+	/**
+	 * The main method.
+	 * @param args the arguments
+	 */
 	public static void main(String[] args)
 	{
 		Locale locale = null;
@@ -68,33 +73,27 @@ public abstract class BaseGameServerRegister
 		}
 		
 		String arg;
-		for (int i = 0 ; i < args.length; i++)
+		for (int i = 0; i < args.length; i++)
 		{
 			arg = args[i];
 			
-			/* --cmd : no gui */
+			// --cmd : no gui
 			if (arg.equals("-c") || arg.equals("--cmd"))
 			{
 				gui = false;
 			}
-			/* --force
-			 * Forces GameServer register operations to overwrite a server if necessary
-			 */
+			// --force : Forces GameServer register operations to overwrite a server if necessary
 			else if (arg.equals("-f") || arg.equals("--force"))
 			{
 				force = true;
 			}
-			/* --fallback
-			 * If an register operation fails due to ID already being in use it will then try to register first available ID
-			 */
+			// --fallback : If an register operation fails due to ID already being in use it will then try to register first available ID
 			else if (arg.equals("-b") || arg.equals("--fallback"))
 			{
 				fallback = true;
 			}
-			/* --register <id> <hexid_dest_dir>
-			 * Register GameServer with ID <id> and output hexid on <hexid_dest_dir>
-			 * Fails if <id> already in use, unless -force is used (overwrites)
-			 */
+			// --register <id> <hexid_dest_dir> : Register GameServer with ID <id> and output hexid on <hexid_dest_dir>
+			// Fails if <id> already in use, unless -force is used (overwrites)
 			else if (arg.equals("-r") || arg.equals("--register"))
 			{
 				gui = false;
@@ -104,9 +103,7 @@ public abstract class BaseGameServerRegister
 				
 				task = new RegisterTask(id, dir, force, fallback);
 			}
-			/* --unregister <id>
-			 * Removes GameServer denoted by <id>
-			 */
+			// --unregister <id> : Removes GameServer denoted by <id>
 			else if (arg.equals("-u") || arg.equals("--unregister"))
 			{
 				gui = false;
@@ -125,20 +122,18 @@ public abstract class BaseGameServerRegister
 					}
 					catch (NumberFormatException e)
 					{
-						System.out.printf(bundle.getString("wrongUnregisterArg")+'\n',gsId);
+						System.out.printf(bundle.getString("wrongUnregisterArg") + '\n', gsId);
 						System.exit(1);
 					}
 				}
 			}
-			/* --language <locale>
-			 * Sets the app to use the specified locale, overriding auto-detection
-			 */
+			// --language <locale> : Sets the app to use the specified locale, overriding auto-detection
 			else if (arg.equals("-l") || arg.equals("--language"))
 			{
 				String loc = args[++i];
 				Locale[] availableLocales = Locale.getAvailableLocales();
 				Locale l;
-				for (int j = 0; j < availableLocales.length && locale == null; j++)
+				for (int j = 0; (j < availableLocales.length) && (locale == null); j++)
 				{
 					l = availableLocales[j];
 					if (l.toString().equals(loc))
@@ -148,7 +143,7 @@ public abstract class BaseGameServerRegister
 				}
 				if (locale == null)
 				{
-					System.out.println("Specified locale '"+loc+"' was not found, using default behaviour.");
+					System.out.println("Specified locale '" + loc + "' was not found, using default behaviour.");
 				}
 				else
 				{
@@ -162,9 +157,7 @@ public abstract class BaseGameServerRegister
 					}
 				}
 			}
-			/* --help
-			 * Prints usage/arguments/credits
-			 */
+			// --help : Prints usage/arguments/credits
 			else if (arg.equals("-h") || arg.equals("--help"))
 			{
 				gui = false;
@@ -188,8 +181,7 @@ public abstract class BaseGameServerRegister
 				}
 				else
 				{
-					// if there is a task, do it
-					// else the app has already finished
+					// if there is a task, do it, else the app has already finished
 					if (task != null)
 					{
 						task.setBundle(bundle);
@@ -204,42 +196,37 @@ public abstract class BaseGameServerRegister
 		}
 	}
 	
+	/**
+	 * Prints the help.
+	 * @param bundle the bundle
+	 */
 	private static void printHelp(ResourceBundle bundle)
 	{
 		String[] help =
 		{
-				bundle.getString("purpose") ,
-				"",
-				bundle.getString("options"),
-				"-b, --fallback\t\t\t\t"+bundle.getString("fallbackOpt"),
-				"-c, --cmd\t\t\t\t"+bundle.getString("cmdOpt"),
-				"-f, --force\t\t\t\t"+bundle.getString("forceOpt"),
-				"-h, --help\t\t\t\t"+bundle.getString("helpOpt"),
-				"-l, --language\t\t\t\t"+bundle.getString("languageOpt"),
-				"-r, --register <id> <hexid_dest_dir>\t"+bundle.getString("registerOpt1"),
-				"\t\t\t\t\t"+bundle.getString("registerOpt2"),
-				"\t\t\t\t\t"+bundle.getString("registerOpt3"),
-				"",
-				"-u, --unregister <id>|all\t\t"+bundle.getString("unregisterOpt"),
-				"",
-				bundle.getString("credits"),
-				bundle.getString("bugReports")+" http://www.l2jserver.com"
-				
-				/*
-				"-b, --fallback\t\t\t\tIf an register operation fails due to ID already being in use it will then try to register first available ID",
-				"-c, --cmd\t\t\t\tForces application to run in command-line mode even if the GUI is supported.",
-				"-f, --force\t\t\t\tForces GameServer register operations to overwrite a server if necessary",
-				"-h, --help\t\t\t\tPrints this help message",
-				"-l, --language <locale>\t\t\t\tAsks the application to use the specified locale, overriding auto-detection",
-				"-r, --register <id> <hexid_dest_dir>\tRegister GameServer with ID <id> and output hexid on <hexid_dest_dir>",
-				"\t\t\t\t\tUse a negative value on <id> to register the first available ID",
-				"\t\t\t\t\tFails if <id> already in use, unless --force is used (overwrites)",
-				"",
-				"-u, --unregister <id>|all\t\tRemoves GameServer denoted by <id>, use \"all\" for removing all registered GameServers",
-				"",
-				"Copyright (C) L2J Team 2008-2009.",
-				"Report bugs: http://www.l2jserver.com"
-				 */
+			bundle.getString("purpose"),
+			"",
+			bundle.getString("options"),
+			"-b, --fallback\t\t\t\t" + bundle.getString("fallbackOpt"),
+			"-c, --cmd\t\t\t\t" + bundle.getString("cmdOpt"),
+			"-f, --force\t\t\t\t" + bundle.getString("forceOpt"),
+			"-h, --help\t\t\t\t" + bundle.getString("helpOpt"),
+			"-l, --language\t\t\t\t" + bundle.getString("languageOpt"),
+			"-r, --register <id> <hexid_dest_dir>\t" + bundle.getString("registerOpt1"),
+			"\t\t\t\t\t" + bundle.getString("registerOpt2"),
+			"\t\t\t\t\t" + bundle.getString("registerOpt3"),
+			"",
+			"-u, --unregister <id>|all\t\t" + bundle.getString("unregisterOpt"),
+			"",
+			bundle.getString("credits"),
+			bundle.getString("bugReports") + " http://www.l2jserver.com"
+		
+		/*
+		 * "-b, --fallback\t\t\t\tIf an register operation fails due to ID already being in use it will then try to register first available ID", "-c, --cmd\t\t\t\tForces application to run in command-line mode even if the GUI is supported.",
+		 * "-f, --force\t\t\t\tForces GameServer register operations to overwrite a server if necessary", "-h, --help\t\t\t\tPrints this help message", "-l, --language <locale>\t\t\t\tAsks the application to use the specified locale, overriding auto-detection",
+		 * "-r, --register <id> <hexid_dest_dir>\tRegister GameServer with ID <id> and output hexid on <hexid_dest_dir>", "\t\t\t\t\tUse a negative value on <id> to register the first available ID", "\t\t\t\t\tFails if <id> already in use, unless --force is used (overwrites)", "",
+		 * "-u, --unregister <id>|all\t\tRemoves GameServer denoted by <id>, use \"all\" for removing all registered GameServers", "", "Copyright (C) L2J Team 2008-2012.", "Report bugs: http://www.l2jserver.com"
+		 */
 		};
 		
 		for (String str : help)
@@ -248,6 +235,10 @@ public abstract class BaseGameServerRegister
 		}
 	}
 	
+	/**
+	 * Start the GUI.
+	 * @param bundle the bundle.
+	 */
 	private static void startGUI(final ResourceBundle bundle)
 	{
 		try
@@ -260,20 +251,21 @@ public abstract class BaseGameServerRegister
 			// couldn't care less
 		}
 		
-		SwingUtilities.invokeLater
-		(
-				new Runnable()
-				{
-					@Override
-					public void run()
-					{
-						GUserInterface gui = new GUserInterface(bundle);
-						gui.getFrame().setVisible(true);
-					}
-				}
-		);
+		SwingUtilities.invokeLater(new Runnable()
+		{
+			@Override
+			public void run()
+			{
+				GUserInterface gui = new GUserInterface(bundle);
+				gui.getFrame().setVisible(true);
+			}
+		});
 	}
 	
+	/**
+	 * Start the CMD.
+	 * @param bundle the bundle.
+	 */
 	private static void startCMD(final ResourceBundle bundle)
 	{
 		GameServerRegister cmdUi = new GameServerRegister(bundle);
@@ -287,29 +279,33 @@ public abstract class BaseGameServerRegister
 		}
 	}
 	
+	/**
+	 * Instantiates a new base game server register.
+	 * @param bundle the bundle.
+	 */
 	public BaseGameServerRegister(ResourceBundle bundle)
 	{
 		setBundle(bundle);
 	}
 	
+	/**
+	 * Load.
+	 */
 	public void load()
 	{
 		try
 		{
-			this.loadImp();
+			loadImp();
 		}
 		catch (Exception e)
 		{
-			this.showError(this.getBundle().getString("gsListRetrieveError"), e);
+			showError(getBundle().getString("gsListRetrieveError"), e);
 		}
 	}
 	
 	/**
-	 * Loads Configs and SQL.<BR>
-	 * This method must be invoked manually as to allow the given interface
-	 * to do in the most convenient way.<BR>
-	 * 
-	 * @throws Exception
+	 * Loads Configs and SQL.
+	 * @throws Exception the exception
 	 */
 	protected void loadImp() throws Exception
 	{
@@ -321,13 +317,18 @@ public abstract class BaseGameServerRegister
 		_loaded = true;
 	}
 	
+	/**
+	 * Checks if is loaded.
+	 * @return true, if is loaded
+	 */
 	public boolean isLoaded()
 	{
 		return _loaded;
 	}
 	
 	/**
-	 * @param bundle The bundle to set.
+	 * Sets the bundle.
+	 * @param bundle the bundle to set.
 	 */
 	public void setBundle(ResourceBundle bundle)
 	{
@@ -335,28 +336,33 @@ public abstract class BaseGameServerRegister
 	}
 	
 	/**
-	 * @return Returns the bundle.
+	 * Gets the bundle.
+	 * @return the bundle.
 	 */
 	public ResourceBundle getBundle()
 	{
 		return _bundle;
 	}
 	
+	/**
+	 * Show the error.
+	 * @param msg the msg.
+	 * @param t the t.
+	 */
 	public abstract void showError(String msg, Throwable t);
 	
 	/**
-	 * @param id
-	 * @throws SQLException
+	 * Unregister the game server.
+	 * @param id the game server id.
+	 * @throws SQLException the SQL exception.
 	 */
 	public static void unregisterGameServer(int id) throws SQLException
 	{
 		Connection con = null;
-		PreparedStatement statement = null;
-		
 		try
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
-			statement = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?");
+			final PreparedStatement statement = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?");
 			statement.setInt(1, id);
 			statement.executeUpdate();
 			GameServerTable.getInstance().getRegisteredGameServers().remove(id);
@@ -368,36 +374,33 @@ public abstract class BaseGameServerRegister
 		}
 	}
 	
+	/**
+	 * Unregister all game servers.
+	 * @throws SQLException the SQL exception
+	 */
 	public static void unregisterAllGameServers() throws SQLException
 	{
 		Connection con = null;
-		PreparedStatement statement = null;
-		
 		try
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
-			statement = con.prepareStatement("DELETE FROM gameservers");
+			final PreparedStatement statement = con.prepareStatement("DELETE FROM gameservers");
 			statement.executeUpdate();
+			statement.close();
 			GameServerTable.getInstance().getRegisteredGameServers().clear();
 		}
 		finally
 		{
-			try
-			{
-				statement.close();
-			}
-			catch (SQLException e)
-			{
-				// nothing
-			}
-			
-			if (con != null)
-			{
-				L2DatabaseFactory.close(con);
-			}
+			L2DatabaseFactory.close(con);
 		}
 	}
 	
+	/**
+	 * Register a game server.
+	 * @param id the id of the game server.
+	 * @param outDir the out dir.
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
 	public static void registerGameServer(int id, String outDir) throws IOException
 	{
 		byte[] hexId = Util.generateHex(16);
@@ -405,15 +408,21 @@ public abstract class BaseGameServerRegister
 		
 		Properties hexSetting = new Properties();
 		File file = new File(outDir, "hexid.txt");
-		//Create a new empty file only if it doesn't exist
+		// Create a new empty file only if it doesn't exist
 		file.createNewFile();
 		OutputStream out = new FileOutputStream(file);
-		hexSetting.setProperty("ServerID",String.valueOf(id));
+		hexSetting.setProperty("ServerID", String.valueOf(id));
 		hexSetting.setProperty("HexID", new BigInteger(hexId).toString(16));
-		hexSetting.store(out,"The HexId to Auth into LoginServer");
+		hexSetting.store(out, "The HexId to Auth into LoginServer");
 		out.close();
 	}
 	
+	/**
+	 * Register first available.
+	 * @param outDir the out dir
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
 	public static int registerFirstAvailable(String outDir) throws IOException
 	{
 		for (Entry<Integer, String> e : GameServerTable.getInstance().getServerNames().entrySet())
@@ -427,11 +436,15 @@ public abstract class BaseGameServerRegister
 		return -1;
 	}
 	
-	static abstract class BaseTask implements Runnable
+	/**
+	 * The Class BaseTask.
+	 */
+	private static abstract class BaseTask implements Runnable
 	{
 		private ResourceBundle _bundle;
 		
 		/**
+		 * Sets the bundle.
 		 * @param bundle The bundle to set.
 		 */
 		public void setBundle(ResourceBundle bundle)
@@ -440,6 +453,7 @@ public abstract class BaseGameServerRegister
 		}
 		
 		/**
+		 * Gets the bundle.
 		 * @return Returns the bundle.
 		 */
 		public ResourceBundle getBundle()
@@ -447,31 +461,45 @@ public abstract class BaseGameServerRegister
 			return _bundle;
 		}
 		
+		/**
+		 * Show the error.
+		 * @param msg the msg
+		 * @param t the t
+		 */
 		public void showError(String msg, Throwable t)
 		{
 			String title;
-			if (this.getBundle() != null)
+			if (getBundle() != null)
 			{
-				title = this.getBundle().getString("error");
-				msg += '\n'+this.getBundle().getString("reason")+' '+t.getLocalizedMessage();
+				title = getBundle().getString("error");
+				msg += '\n' + getBundle().getString("reason") + ' ' + t.getLocalizedMessage();
 			}
 			else
 			{
 				title = "Error";
-				msg += "\nCause: "+t.getLocalizedMessage();
+				msg += "\nCause: " + t.getLocalizedMessage();
 			}
-			System.out.println(title+": "+msg);
+			System.out.println(title + ": " + msg);
 		}
 	}
 	
-	static class RegisterTask extends BaseTask
+	/**
+	 * The Class RegisterTask.
+	 */
+	private static class RegisterTask extends BaseTask
 	{
-		
 		private final int _id;
 		private final String _outDir;
 		private boolean _force;
 		private boolean _fallback;
 		
+		/**
+		 * Instantiates a new register task.
+		 * @param id the id.
+		 * @param outDir the out dir.
+		 * @param force the force.
+		 * @param fallback the fallback.
+		 */
 		public RegisterTask(int id, String outDir, boolean force, boolean fallback)
 		{
 			_id = id;
@@ -480,15 +508,18 @@ public abstract class BaseGameServerRegister
 			_fallback = fallback;
 		}
 		
+		/**
+		 * Sets the actions.
+		 * @param force the force.
+		 * @param fallback the fallback.
+		 */
+		@SuppressWarnings("unused")
 		public void setActions(boolean force, boolean fallback)
 		{
 			_force = force;
 			_fallback = fallback;
 		}
 		
-		/**
-		 * @see java.lang.Runnable#run()
-		 */
 		@Override
 		public void run()
 		{
@@ -498,42 +529,40 @@ public abstract class BaseGameServerRegister
 				{
 					int registeredId = BaseGameServerRegister.registerFirstAvailable(_outDir);
 					
-					
 					if (registeredId < 0)
 					{
 						System.out.println(getBundle().getString("noFreeId"));
 					}
 					else
 					{
-						System.out.printf(getBundle().getString("registrationOk")+'\n', registeredId);
+						System.out.printf(getBundle().getString("registrationOk") + '\n', registeredId);
 					}
 				}
 				else
 				{
-					System.out.printf(getBundle().getString("checkingIdInUse")+'\n', _id);
+					System.out.printf(getBundle().getString("checkingIdInUse") + '\n', _id);
 					if (GameServerTable.getInstance().hasRegisteredGameServerOnId(_id))
 					{
 						System.out.println(getBundle().getString("yes"));
 						if (_force)
 						{
-							System.out.printf(getBundle().getString("forcingRegistration")+'\n', _id);
+							System.out.printf(getBundle().getString("forcingRegistration") + '\n', _id);
 							BaseGameServerRegister.unregisterGameServer(_id);
 							BaseGameServerRegister.registerGameServer(_id, _outDir);
-							System.out.printf(getBundle().getString("registrationOk")+'\n', _id);
+							System.out.printf(getBundle().getString("registrationOk") + '\n', _id);
 						}
 						else if (_fallback)
 						{
 							System.out.println(getBundle().getString("fallingBack"));
 							int registeredId = BaseGameServerRegister.registerFirstAvailable(_outDir);
 							
-							
 							if (registeredId < 0)
 							{
 								System.out.println(getBundle().getString("noFreeId"));
 							}
 							else
 							{
-								System.out.printf(getBundle().getString("registrationOk")+'\n', registeredId);
+								System.out.printf(getBundle().getString("registrationOk") + '\n', registeredId);
 							}
 						}
 						else
@@ -550,50 +579,52 @@ public abstract class BaseGameServerRegister
 			}
 			catch (SQLException e)
 			{
-				this.showError(getBundle().getString("sqlErrorRegister"), e);
+				showError(getBundle().getString("sqlErrorRegister"), e);
 			}
 			catch (IOException e)
 			{
-				this.showError(getBundle().getString("ioErrorRegister"), e);
+				showError(getBundle().getString("ioErrorRegister"), e);
 			}
 		}
-		
 	}
 	
-	static class UnregisterTask extends BaseTask
+	/**
+	 * The Class UnregisterTask.
+	 */
+	private static class UnregisterTask extends BaseTask
 	{
 		private final int _id;
 		
+		/**
+		 * Instantiates a new unregister task.
+		 * @param id the task id.
+		 */
 		public UnregisterTask(int id)
 		{
 			_id = id;
 			
 		}
 		
-		/**
-		 * @see java.lang.Runnable#run()
-		 */
 		@Override
 		public void run()
 		{
-			System.out.printf(getBundle().getString("removingGsId")+'\n', _id);
+			System.out.printf(getBundle().getString("removingGsId") + '\n', _id);
 			try
 			{
 				BaseGameServerRegister.unregisterGameServer(_id);
 			}
 			catch (SQLException e)
 			{
-				this.showError(getBundle().getString("sqlErrorRegister"), e);
+				showError(getBundle().getString("sqlErrorRegister"), e);
 			}
 		}
-		
 	}
 	
-	static class UnregisterAllTask extends BaseTask
+	/**
+	 * The Class UnregisterAllTask.
+	 */
+	private static class UnregisterAllTask extends BaseTask
 	{
-		/**
-		 * @see java.lang.Runnable#run()
-		 */
 		@Override
 		public void run()
 		{
@@ -603,9 +634,8 @@ public abstract class BaseGameServerRegister
 			}
 			catch (SQLException e)
 			{
-				this.showError(getBundle().getString("sqlErrorUnregisterAll"), e);
+				showError(getBundle().getString("sqlErrorUnregisterAll"), e);
 			}
 		}
-		
 	}
 }