Loop through ObjectHandler.globalObjects to check if there's an object at your players position.
|
This is my createAnObject method, what do I need to change to make it check for an object before placing one.Code:public void createAnObject(Client c, int id, int x, int y) { Objects OBJECT = new Objects(id, x, y, 0, 0, 10, 0); if(id == -1) { removeObject(OBJECT); } else { addObject(OBJECT); } Server.objectHandler.placeObject(OBJECT); }
https://pastebin.com/raw/2LBjwhhf
this is my objecthandler class.
Loop through ObjectHandler.globalObjects to check if there's an object at your players position.
what do u mean
Either develop a system that stores spawned objects (to do this you could load the object defs that the client uses when spawning map objects) or like Flash said loop through all spawned objects via server side
Keep in mind that your code may be different from what example I have shown.Code:for(int i = 0; i < OBJECT_COUNT; i++){ Object o = Server.objectHandler.globalObjects[i]; //do stuff with o object }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |