Jump to content
  • 0

Spawn Protecion Effect


kingmert

Question

Recommended Posts

  • 0

 

if (protect) {
    ThreadPoolManager.getInstance().scheduleGeneral(new TeleportProtectionFinalizer(this), (Config.PLAYER_SPAWN_PROTECTION - 1) * 1000);
    startAbnormalEffect(L2Character.ABNORMAL_EFFECT_IMPRISIONING_2);
}
This "{" and "}" are called a brackets (or curly brackets)...

I think he cant find the right place to put the code..

Link to comment
Share on other sites

  • 0

// Hate Mode ON

 

Look at this shit...

	/**
	 * Set _protectEndTime according settings.
	 * @param protect the new protection
	 */
	public void setProtection(final boolean protect)
	{
		if (Config.DEVELOPER && (protect || _protectEndTime > 0))
			LOGGER.info(getName() + ": Protection " + (protect ? "ON " + (GameTimeController.getGameTicks() + Config.PLAYER_SPAWN_PROTECTION * GameTimeController.TICKS_PER_SECOND) : "OFF") + " (currently " + GameTimeController.getGameTicks() + ")");
		
		if (isInOlympiadMode())
			return;
		
		_protectEndTime = protect ? GameTimeController.getGameTicks() + Config.PLAYER_SPAWN_PROTECTION * GameTimeController.TICKS_PER_SECOND : 0;
		
		if (protect)
			ThreadPoolManager.getInstance().scheduleGeneral(new TeleportProtectionFinalizer(this), (Config.PLAYER_SPAWN_PROTECTION - 1) * 1000);
	}
	
	/**
	 * Set _teleportProtectEndTime according settings.
	 * @param protect the new protection
	 */
	public void setTeleportProtection(final boolean protect)
	{
		if (Config.DEVELOPER && (protect || _teleportProtectEndTime > 0))
			LOGGER.warn(getName() + ": Tele Protection " + (protect ? "ON " + (GameTimeController.getGameTicks() + Config.PLAYER_TELEPORT_PROTECTION * GameTimeController.TICKS_PER_SECOND) : "OFF") + " (currently " + GameTimeController.getGameTicks() + ")");
		
		_teleportProtectEndTime = protect ? GameTimeController.getGameTicks() + Config.PLAYER_TELEPORT_PROTECTION * GameTimeController.TICKS_PER_SECOND : 0;
		
		if (protect)
			ThreadPoolManager.getInstance().scheduleGeneral(new TeleportProtectionFinalizer(this), (Config.PLAYER_TELEPORT_PROTECTION - 1) * 1000);
	}
	
	static class TeleportProtectionFinalizer implements Runnable
	{
		private final L2PcInstance _activeChar;
		
		TeleportProtectionFinalizer(final L2PcInstance activeChar)
		{
			_activeChar = activeChar;
		}
		
		@Override
		public void run()
		{
			try
			{
				if (_activeChar.isSpawnProtected())
					_activeChar.sendMessage("The effect of Spawn Protection has been removed.");
				else if (_activeChar.isTeleportProtected())
					_activeChar.sendMessage("The effect of Teleport Spawn Protection has been removed.");
				
				if (Config.PLAYER_SPAWN_PROTECTION > 0)
					_activeChar.setProtection(false);
				
				if (Config.PLAYER_TELEPORT_PROTECTION > 0)
					_activeChar.setTeleportProtection(false);
			}
			catch (final Throwable e)
			{
				if (Config.ENABLE_ALL_EXCEPTIONS)
					e.printStackTrace();
			}
		}
	}

Who the hell is the author of this piece of crap? And what's more important, who the hell will want to use such a crappy platform?

 

First: Two methods, doing exactly the same thing. These are probably used in different conditions, but... if you don't want to use something somewhere, simply don't use it there.

 

Second: Two completely useless if statements...

				if (Config.PLAYER_SPAWN_PROTECTION > 0)
					_activeChar.setProtection(false);
				
				if (Config.PLAYER_TELEPORT_PROTECTION > 0)
					_activeChar.setTeleportProtection(false);

If you are currently in this thread, you obviously use WHATEVER_PROTECTION > 0...

 

 

And finaly: This thing is probably written by an idiot...

			catch (final Throwable e)
			{
				if (Config.ENABLE_ALL_EXCEPTIONS)
					e.printStackTrace();
			}

// Hate Mode OFF

 

Don't use L2JFrozen, pls!

Link to comment
Share on other sites

  • 0

// Hate Mode ON

 

Look at this shit...

 

/**
	 * Set _protectEndTime according settings.
	 * @param protect the new protection
	 */
	public void setProtection(final boolean protect)
	{
		if (Config.DEVELOPER && (protect || _protectEndTime > 0))
			LOGGER.info(getName() + ": Protection " + (protect ? "ON " + (GameTimeController.getGameTicks() + Config.PLAYER_SPAWN_PROTECTION * GameTimeController.TICKS_PER_SECOND) : "OFF") + " (currently " + GameTimeController.getGameTicks() + ")");
		
		if (isInOlympiadMode())
			return;
		
		_protectEndTime = protect ? GameTimeController.getGameTicks() + Config.PLAYER_SPAWN_PROTECTION * GameTimeController.TICKS_PER_SECOND : 0;
		
		if (protect)
			ThreadPoolManager.getInstance().scheduleGeneral(new TeleportProtectionFinalizer(this), (Config.PLAYER_SPAWN_PROTECTION - 1) * 1000);
	}
	
	/**
	 * Set _teleportProtectEndTime according settings.
	 * @param protect the new protection
	 */
	public void setTeleportProtection(final boolean protect)
	{
		if (Config.DEVELOPER && (protect || _teleportProtectEndTime > 0))
			LOGGER.warn(getName() + ": Tele Protection " + (protect ? "ON " + (GameTimeController.getGameTicks() + Config.PLAYER_TELEPORT_PROTECTION * GameTimeController.TICKS_PER_SECOND) : "OFF") + " (currently " + GameTimeController.getGameTicks() + ")");
		
		_teleportProtectEndTime = protect ? GameTimeController.getGameTicks() + Config.PLAYER_TELEPORT_PROTECTION * GameTimeController.TICKS_PER_SECOND : 0;
		
		if (protect)
			ThreadPoolManager.getInstance().scheduleGeneral(new TeleportProtectionFinalizer(this), (Config.PLAYER_TELEPORT_PROTECTION - 1) * 1000);
	}
	
	static class TeleportProtectionFinalizer implements Runnable
	{
		private final L2PcInstance _activeChar;
		
		TeleportProtectionFinalizer(final L2PcInstance activeChar)
		{
			_activeChar = activeChar;
		}
		
		@Override
		public void run()
		{
			try
			{
				if (_activeChar.isSpawnProtected())
					_activeChar.sendMessage("The effect of Spawn Protection has been removed.");
				else if (_activeChar.isTeleportProtected())
					_activeChar.sendMessage("The effect of Teleport Spawn Protection has been removed.");
				
				if (Config.PLAYER_SPAWN_PROTECTION > 0)
					_activeChar.setProtection(false);
				
				if (Config.PLAYER_TELEPORT_PROTECTION > 0)
					_activeChar.setTeleportProtection(false);
			}
			catch (final Throwable e)
			{
				if (Config.ENABLE_ALL_EXCEPTIONS)
					e.printStackTrace();
			}
		}
	}
Who the hell is the author of this piece of crap? And what's more important, who the hell will want to use such a crappy platform?

 

First: Two methods, doing exactly the same thing. These are probably used in different conditions, but... if you don't want to use something somewhere, simply don't use it there.

 

Second: Two completely useless if statements...

if (Config.PLAYER_SPAWN_PROTECTION > 0)
					_activeChar.setProtection(false);
				
				if (Config.PLAYER_TELEPORT_PROTECTION > 0)
					_activeChar.setTeleportProtection(false);
If you are currently in this thread, you obviously use WHATEVER_PROTECTION > 0...

 

 

And finaly: This thing is probably written by an idiot...

catch (final Throwable e)
			{
				if (Config.ENABLE_ALL_EXCEPTIONS)
					e.printStackTrace();
			}
// Hate Mode OFF

 

Don't use L2JFrozen, pls!

And just he could use && idk nothink from frozen :p

 

P.s i will help him when i go home with team viewer just lock the topic

Link to comment
Share on other sites

  • 0

And just he could use && idk nothink from frozen :p

P.s i will help him when i go home with team viewer just lock the topic

I'm not talking about his problem... it's all about how bad the whole L2JFrozen project is designed (I'm not sure if they actually know how to design a project), and why using it is a bad idea. Seriously, it lacks basic programming principles... just read something about coupling and cohesion, and then look at L2JFrozen's source.
Link to comment
Share on other sites

  • 0

I'm not talking about his problem... it's all about how bad the whole L2JFrozen project is designed (I'm not sure if they actually know how to design a project), and why using it is a bad idea. Seriously, it lacks basic programming principles... just read something about coupling and cohesion, and then look at L2JFrozen's source.

Im using l2jacis so i dont care about frozen..but i mean about this 2 checks about spawn protection...can be done with a better way or drop once

Link to comment
Share on other sites

  • 0

it's all about how bad the whole L2JFrozen project is designed

That's mostly russian style and Shyla/Nefer coding style is also.. ugly m5TqppM.png

 

People don't care about quality, is it working? I take it  :happyforever:

Link to comment
Share on other sites

  • 0

That's mostly russian style and Shyla/Nefer coding style is also.. ugly m5TqppM.png

 

People don't care about quality, is it working? I take it  :happyforever:

As i have read thats true :p

Sweets you can lock this topic i will help him later..we have already speak on skype

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • rename the l2.bin into l2.exe
    • L2LIVE.PRO- Dynamic Mid-rates Essence Seven Signs GRAND OPENING - July 5, 20:00 GMT+3 (EEST) TEST SERVER IS OPEN - COME AND CHECK IT OUT TODAY! Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu   Server description * EXP/SP: Dynamic (x1- x100 based on your level, *before* Sayha and EXP buffs * Adena: x50 / Item Drop: x10 / Fishing EXP increased / Attribute EXP increased * Simplified gameplay to stay in the loop while not spending hours and hours farming * Starter Pack containing very useful items for beginners * MP replenishing potions with auto-consumption * No overpowered donations L2LIVE shop * All spellbook coupons, pet spellbook coupons and master books are sold via Game Assistant * Additionally you can buy SP pouches, enchanted talismans, pet training guides and various other consumables for Adena and L-Coin * More items such as cloaks, more talismans, agathions, belts, pendants, enchantment scrolls of various grades, evolution stones, etc will be added! Shop server as a shortcut, and all retail-like ways of earning items are still here! L-Coins * Drops with small change and in random amounts from Lv60+ monsters  * All raidbosses drop random amount of L-Coin Pouches generating up to 420 Lcoin per unit. **Grand Olympiad and Events** * Grand Olympiad is held week day * Format is 1v1, unlimited weekly fights  * Heroes are declared weekly at Sunday * There are three automated events - TvT, CTF and Deathmatch, running at evenings * Orc Fortress, Battle with Balok, Keber Hunter, Archievements Box, Daily Gift Calendar provisional events are active too Custom user commands * .offlineplay command, your character will keep playing till death or server restart * .offlineshop command, keeps your shop sitting until all items are purchased * .apon / .apoff - enable/disable HP/MP autoconsume And lots of other small improvements are waiting for you!   Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu
    • I can use this folder system for High Five offline server?   The folder does not have a l2.exe file.   Thank you very much if anyone can help me.   https://drive.google.com/file/d/13kU-g_4JJ-sP-kg2F7pqkUOVKmQdubFm/view
  • Topics

×
×
  • Create New...