Jump to content

Recommended Posts

Posted (edited)

Hello I'm sharing something that made some simple changes and build some parts of a clean and well written system of an event.

 

Initial Messages:

 

DNcAHw7.png

pu35UsI.png

9jQftEJ.png

ynh5ZEN.png

 

Search for commandname-e in your system and add at the end of it

115	114	register
116	115	unregister

 

Code https://pastebin.com/YRaCbU9T

 

Author for the new event Williams

Author of the original code DnR

Edited by Williams
  • Like 1

Share this post


Link to post
Share on other sites

it looks like it still needs updates for acis maybe ask some advices how to update it fully, also many it has many uneeded calls and 2 types of schedules but thank you for trying

Share this post


Link to post
Share on other sites
9 hours ago, DenArt Designs said:

it looks like it still needs updates for acis maybe ask some advices how to update it fully, also many it has many uneeded calls and 2 types of schedules but thank you for trying

Reward 6393,5 

Reward 57,10000

  • Like 1

Share this post


Link to post
Share on other sites
On 15/07/2019 at 03:58, DenArt Designs said:

Parece que ainda precisa de atualizações para acis talvez pedir alguns conselhos como atualizá-lo totalmente, também muitos tem muitas chamadas não atendidas e 2 tipos de horários, mas obrigado por tentar

what can i improve?

Share this post


Link to post
Share on other sites
19 minutes ago, Williams said:

what can i improve?

 

To name few, after some look :

 

* eventTimer(int time) should be handled with a Future<?> task and ThreadPool.

* _originalCoordinates is (probably) redundant with _savedLocation, and the use of it is wrong (see _savedLocation usage to see correct)

* CopyOnWriteArrayList container should be avoid for performance reason, use ConcurrentHashMap.newKeySet instead.

+                   if (reward == null)
+                       continue;

can never be null, since you manipulate it from A TO Z.

* TVT_DOOR_LIST doesn't seem to be used and can use getProperty(final String name, final int[] defaultValue, final String delimiter) instead of self coded array manipulation.

  • Upvote 1

Share this post


Link to post
Share on other sites
Thread.sleep(1);

I want add this in my signature and that it was shown to everyone in a forced manner.

 

P.S. This style of coding the guys with red eyes from C/C++. If you really likes this style then please use delay, at least 100 ms. Give for other processes more free time.

Share this post


Link to post
Share on other sites
12 minutes ago, Tryskell said:

 

To name few, after some look :

 

 

 

Since you got bored developing the project you created why you even care replying everytime someone refers it's name  ? Just curious spoon guy

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Dev said:

 

Since you got bored developing the project you created why you even care replying everytime someone refers it's name  ? Just curious spoon guy

 

Care about your own shit, maybe ? It seems you got some brown left in your pants.

 

It's not because I don't do public release that it means I don't develop.I'm almost 100 commits ahead current public latest release - which is, in my world, almost 1.5 revision.

 

16m3mvs.png

Edited by Tryskell
  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Tryskell said:

 

Para citar alguns, depois de alguma olhada :

 

* eventTimer (int time) deve ser tratado com uma tarefa Future <?> e ThreadPool.

* _originalCoordinates é (provavelmente) redundante com _savedLocation e o uso dele está errado (consulte Uso de _savedLocation para ver correto)

* O contêiner CopyOnWriteArrayList deve ser evitado por motivos de desempenho, use ConcurrentHashMap.newKeySet.


                    
                       

nunca pode ser nulo, desde que você o manipule de A para Z.

* TVT_DOOR_LIST não parece ser usado e pode usar getProperty (final String name, int final [] defaultValue, final String delimiter) ao invés de auto manipulação de array codificada.

 

thank you very much, i will try to do what you say.

You do a great job with aCis.

Share this post


Link to post
Share on other sites

a lot to redo so I did this makeover.

 

I removed

for (Player blue : _blueTeam)
		{
			if (blue == null)
				continue;
			
			// Give rewards
			if (_state != EventState.INITIAL && (_blueTeamKills > _redTeamKills || _blueTeamKills == _redTeamKills && Config.REWARD_DIE))
			{
				for (IntIntHolder reward : Config.TVT_REWARDS)
				{
					if (reward == null)
						continue;
					
					blue.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
				}
				if (blue.isDead())
					blue.doRevive();
				
				removePlayer(blue);
				blue.teleportTo(blue.getOriginalCoordinates(), 0);
			}
		}
		
		for (Player red : _redTeam)
		{
			if (red == null)
				continue;
			
			// Give rewards
			if (_state != EventState.INITIAL && (_blueTeamKills < _redTeamKills || _blueTeamKills == _redTeamKills && Config.REWARD_DIE))
			{
				for (IntIntHolder reward : Config.TVT_REWARDS)
				{
					if (reward == null)
						continue;
					
					red.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
				}
				if (red.isDead())
					red.doRevive();
				
				removePlayer(red);
				red.teleportTo(red.getOriginalCoordinates(), 0);
			}
		}
		
		// Event ended in a tie and no rewards will be given
		if (_blueTeamKills == _redTeamKills && !Config.REWARD_DIE)
			World.announceToOnlinePlayers("TvT Event: Event ended in a Tie. No rewards will be given!", true);
		
		_blueTeam.clear();
		_redTeam.clear();
		_redTeamKills = 0;
		_blueTeamKills = 0;

I did like this:

 

// Check the winning team.
		TeamType teamWinner = TeamType.NONE;
		
		if (_state != EventState.INITIAL)
		{
			// Tied teams
			if (_blueTeamKills == _redTeamKills && !Config.REWARD_DIE)
				World.announceToOnlinePlayers("TvT Event: Event ended in a Tie. No rewards will be given!", true);
			else if (_blueTeamKills > _redTeamKills)
				teamWinner = TeamType.BLUE;
			else
				teamWinner = TeamType.RED;
			
			if (teamWinner == TeamType.NONE)
				World.announceToOnlinePlayers("TvT Event: The event ends in a draw!");
			else
			{
				for (Player player : World.getInstance().getPlayers())
				{
					if (player == null)
						continue;
					
					// Prizes are awarded to the winning team.
					if (player.getTeam() == teamWinner)
					{
						for (IntIntHolder reward : Config.TVT_REWARDS)
							player.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
						
						if (player.isDead())
							player.doRevive();
						
						removePlayer(player);
						player.teleToLocation(player.getOriginalCoordinates());
					}
				}
			}
		}
		
		_blueTeam.clear();
		_redTeam.clear();
		_blueTeamKills = 0;
		_redTeamKills = 0;

 

I will remove _redTeamKills, _blueTeamKills and move to Player.java etc...

 

about threadpool execution i don't know how i will do i will do more research on.

Share this post


Link to post
Share on other sites
On 8/6/2019 at 9:30 PM, Williams said:

a lot to redo so I did this makeover.

 

I removed


for (Player blue : _blueTeam)
		{
			if (blue == null)
				continue;
			
			// Give rewards
			if (_state != EventState.INITIAL && (_blueTeamKills > _redTeamKills || _blueTeamKills == _redTeamKills && Config.REWARD_DIE))
			{
				for (IntIntHolder reward : Config.TVT_REWARDS)
				{
					if (reward == null)
						continue;
					
					blue.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
				}
				if (blue.isDead())
					blue.doRevive();
				
				removePlayer(blue);
				blue.teleportTo(blue.getOriginalCoordinates(), 0);
			}
		}
		
		for (Player red : _redTeam)
		{
			if (red == null)
				continue;
			
			// Give rewards
			if (_state != EventState.INITIAL && (_blueTeamKills < _redTeamKills || _blueTeamKills == _redTeamKills && Config.REWARD_DIE))
			{
				for (IntIntHolder reward : Config.TVT_REWARDS)
				{
					if (reward == null)
						continue;
					
					red.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
				}
				if (red.isDead())
					red.doRevive();
				
				removePlayer(red);
				red.teleportTo(red.getOriginalCoordinates(), 0);
			}
		}
		
		// Event ended in a tie and no rewards will be given
		if (_blueTeamKills == _redTeamKills && !Config.REWARD_DIE)
			World.announceToOnlinePlayers("TvT Event: Event ended in a Tie. No rewards will be given!", true);
		
		_blueTeam.clear();
		_redTeam.clear();
		_redTeamKills = 0;
		_blueTeamKills = 0;

I did like this:

 


// Check the winning team.
		TeamType teamWinner = TeamType.NONE;
		
		if (_state != EventState.INITIAL)
		{
			// Tied teams
			if (_blueTeamKills == _redTeamKills && !Config.REWARD_DIE)
				World.announceToOnlinePlayers("TvT Event: Event ended in a Tie. No rewards will be given!", true);
			else if (_blueTeamKills > _redTeamKills)
				teamWinner = TeamType.BLUE;
			else
				teamWinner = TeamType.RED;
			
			if (teamWinner == TeamType.NONE)
				World.announceToOnlinePlayers("TvT Event: The event ends in a draw!");
			else
			{
				for (Player player : World.getInstance().getPlayers())
				{
					if (player == null)
						continue;
					
					// Prizes are awarded to the winning team.
					if (player.getTeam() == teamWinner)
					{
						for (IntIntHolder reward : Config.TVT_REWARDS)
							player.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
						
						if (player.isDead())
							player.doRevive();
						
						removePlayer(player);
						player.teleToLocation(player.getOriginalCoordinates());
					}
				}
			}
		}
		
		_blueTeam.clear();
		_redTeam.clear();
		_blueTeamKills = 0;
		_redTeamKills = 0;

 

I will remove _redTeamKills, _blueTeamKills and move to Player.java etc...

 

about threadpool execution i don't know how i will do i will do more research on.

 

Tem um pequeno erro nesse código que faz com que somente o time ganhador seja teleportado de volta e removido do evento. 

 

Correção:

// Check the winning team.
		TeamType teamWinner = TeamType.NONE;
		
		if (_state != EventState.INITIAL)
		{
			// Tied teams
			if (_blueTeamKills == _redTeamKills && !Config.REWARD_DIE)
				World.announceToOnlinePlayers("TvT Event: Event ended in a Tie. No rewards will be given!", true);
			else if (_blueTeamKills > _redTeamKills)
				teamWinner = TeamType.BLUE;
			else
				teamWinner = TeamType.RED;
			
			if (teamWinner == TeamType.NONE)
				World.announceToOnlinePlayers("TvT Event: The event ends in a draw!");
			else
			{
				for (Player player : World.getInstance().getPlayers())
				{
					if (player == null)
						continue;
					
					// Prizes are awarded to the winning team.
					if (player.getTeam() == teamWinner)
					{
						for (IntIntHolder reward : Config.TVT_REWARDS)
							player.addItem("TvTReward", reward.getId(), reward.getValue(), null, true);
					}
				}
			}
			
			for (Player player : World.getInstance().getPlayers())
			{
				if (player.isDead())
					player.doRevive();
				
				removePlayer(player);
				player.teleToLocation(player.getOriginalCoordinates());
			}
		}
	
	_blueTeam.clear();
	_redTeam.clear();
	_blueTeamKills = 0;
	_redTeamKills = 0;
	}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   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.


  • Recently Browsing   0 members

    No registered users viewing this page.



×