The Meaning of Life, the Universe, and Everything.
Join Date:
3/15/2015
Posts:
43
Member Details
I'm trying to create an anti-lag system on my server (It's 1.9 snapshot, so I have access to repeat and chain command blocks) which will test for the amount of certain types of entities and remove them if they exceed the desired amount.
-Example-
A player is spamming boats all over the map. The anti-lag system is constantly using the /execute command to test for how many entities are within a certain radius around a player, and if it's higher than the amount I specify it will start killing them until the amount is back under the limit. This means if a player is trying to overload the server with boats, it will only remove the boats that specific player placed rather than every single boat on the entire server, which would be annoying for rule-abiding players.
I know how to set everything up but I'm having trouble figuring out how it would be possible for me to count all of the entities in the easiest possible way. I feel like there should be a way to do this with /testfor since it seems like the kind of useful thing they would've added to the game, but no solution has come up yet.
Again, what I'm looking to do is test for how many entities of a certain kind are loaded in the world. Preferably with the /testfor command, but any other solution is welcome too.
The /stats command is what you're looking for. Let's say the maximum amount of boat allowed around a 64 blocks area is 16. Start with creating an objective:
Change the radius, the number allowed and the entity to your liking. If all regulated entities should apply to the same radius and number, you can start the clock with giving every regulated entity an AntiLag score then target by score instead of type, then add 'type=!Player'.
Thanks! That's one of the few scoreboard commands I had never really used before, I feel like it must be fairly new as well. I think you actually killed two birds with one stone because I believe I'll be able to use that command to give all players an ascending score as they log in. Then I can use that to set up a tpa and tpahere system on my (vanilla) server. I should be able to do a home/sethome system using the numbers as well. The vanilla /spawnpoint command is limited to one location, and it requires you to teleport players through two end portals, which is currently not possible since the end is broken in the 1.9 snapshot.
The Meaning of Life, the Universe, and Everything.
Join Date:
3/15/2015
Posts:
43
Member Details
Thanks everyone, I've managed to get the command figured out now. The only thing I'm questioning is if it's possible to set it up to track more than one object at once (Two entities or two blocks being tracked at the same time) since with the way it seems to work I'm wondering if it's even possible because I feel like the scores would get messed up, however I haven't really tried to test it out at all yet.
Say I'm testing for cobble and emeralds at the same time, couldn't the cobble score cross over to the emerald score since they are both being updated? Or am I overthinking this?
I'm trying to create an anti-lag system on my server (It's 1.9 snapshot, so I have access to repeat and chain command blocks) which will test for the amount of certain types of entities and remove them if they exceed the desired amount.
-Example-
A player is spamming boats all over the map. The anti-lag system is constantly using the /execute command to test for how many entities are within a certain radius around a player, and if it's higher than the amount I specify it will start killing them until the amount is back under the limit. This means if a player is trying to overload the server with boats, it will only remove the boats that specific player placed rather than every single boat on the entire server, which would be annoying for rule-abiding players.
I know how to set everything up but I'm having trouble figuring out how it would be possible for me to count all of the entities in the easiest possible way. I feel like there should be a way to do this with /testfor since it seems like the kind of useful thing they would've added to the game, but no solution has come up yet.
Again, what I'm looking to do is test for how many entities of a certain kind are loaded in the world. Preferably with the /testfor command, but any other solution is welcome too.
Thanks in advance for any help!
Thanks! That's one of the few scoreboard commands I had never really used before, I feel like it must be fairly new as well. I think you actually killed two birds with one stone because I believe I'll be able to use that command to give all players an ascending score as they log in. Then I can use that to set up a tpa and tpahere system on my (vanilla) server. I should be able to do a home/sethome system using the numbers as well. The vanilla /spawnpoint command is limited to one location, and it requires you to teleport players through two end portals, which is currently not possible since the end is broken in the 1.9 snapshot.
This'll do the same thing with less command blocks:
Thanks everyone, I've managed to get the command figured out now. The only thing I'm questioning is if it's possible to set it up to track more than one object at once (Two entities or two blocks being tracked at the same time) since with the way it seems to work I'm wondering if it's even possible because I feel like the scores would get messed up, however I haven't really tried to test it out at all yet.
Say I'm testing for cobble and emeralds at the same time, couldn't the cobble score cross over to the emerald score since they are both being updated? Or am I overthinking this?