I'm not sure but there is an f coordinate in minecraft that checks direction. Maybe you can first check if the two players are close by comparing their X Y Z coords. After that you can compare their f coordinate. Honestly, I really don't know; this is just something that popped up in my head.
This problem requires a lot of trigonometry to solve. Ignoring that there may be structure in the way (which I would check for by looping over all coordinates between the two players and checking that the block at each point was empty), and assuming that this f coordinate (that admittedly, I've never used) sits an integer distance away from the player in the direction of their line of sight (as would make sense), here's how I'd do it. 1. Find the distance between player A and player B. 2. Find the point, that distance away, along player A's line of sight, given by A + d*(Fa - A), where A is player A's location, d is the distance between the two players and Fa is the location of player A's f coordinate. Call that point C 3. Find the distance between point C and player B, and call that l 4. Use the cosine rule to find the angle of player B to Player A's f coordinate, given by the inverse cosine of 1 - ((l^2)/(2*(d^2))) 5. If that angle is less than the angle of the player's cone of vision (which you'd have to find out), and there aren't any blocks in the way, player B is in player A's line of sight
You could have titled the thread better... Anyways, what EgyptianKing says is probably the easiest way. I'm not sure how you would use the f property to achieve it, but you can always go Trig style like toCoda
Plo124 AdamQpzm That method doesn't seem to work. I did hitter.hasLineOfSite(hit); with forcefield on and it always returns true
Heirteir Well yeah... If they manage to hit someone (assuming from variable names and guessing at context), then they also trick the server into thinking that they're facing that way. Otherwise I'd assume that there would be an automatic check for it (i.e. similar to the 'player moved too quickly' but different)
AdamQpzm Is there anyway that I could get all the blocks in a straight line from the targets line of sight and see if the Player is on 1 of those blocks?
Heirteir You can, but I'd imagine you'd run into the same problem you're currently facing... Think about it, if it was really that simple to stop people with forcefield ("hey, are they facing the player they're attacking?") then how comes nobody has made a perfect fix already?
AdamQpzm Thanks dude I just created the most accurate version of anti ff I think is possible thanks to you man THANKS A BUNCH!
Heirteir It is not blackmail all codename_B said was that you are trying to get him to buy a plugin that you just got help on.
Well its his plugin, he can do what he wants with it; but to sell a plugin in which he had part of the work handed to him while he can fill in the simple parts is a bit of a cheap way to do it. There is also the fact of this being only an Anti-ForceFeild plugin that costs money when you can get a great Anti-ForceFeild plugin for free(with more anti-cheat measures and assurance of no malicious code) on dev.bukkit.org with NCP+.
PolarCraft He is sending me messages on skype.. Also this is a small part of my plugin that is even the main detection of the plugin infact I later found a better method and I no longer use this one. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
He's not talking about me obviously, I blocked him on skype. Whoever is blackmailing him isn't me, and is a seperate issue I guess.
codename_B Seems to be so. But whoever is trying to blackmail you Heirteir just block them. And i can tell you that it is not codename_B he would not do such a thing.
BlackMail is holding something above another's head to get them to do something for you for personal gain(ie. threatening to read from someone's personal diary to get them to do your chores for you). I don't see codename_B trying to get Heirteir to do something for his gain, I don't really see what "gain" codename_B would be getting out of this even if he was.
(not talking about anything, just trying to solve the thread's purpose if not solved) What hack client does is send a packet hitting the player with his face looking + hitting the player (I can tell that since I had a server with a lot of hacks, and if you go on his back and /v with vanish, his head will go crazy and he will be hitting you) Try checking a tick or 2 later if hasLifeOfSight is false again (and don't auto-ban them for that, just... Don't know, try using hacked clients and see the pattern until you get something that don't ban legit players - example, one with a new high speed mouse)
Locking this thread before it gets any weirder. This is not a forum for accusing other users of blackmail. ... or for blackmailing. But I figure you guys knew that one.