Problem with Plot registration

Discussion in 'Spigot Plugin Development' started by EllirionGames, May 29, 2015.

  1. Hey Spigot members

    Atm we are working on a plot system plugin. Currently we have the problem that the registration of the cords in + are working fine but. When we read out plots in the - cords. They make thme 4x times bigger then intended. We use 128x128 plots. So anyone knows a solution to this problem :O? Or is there away to change the 0, 0 cords in worldpainter or with a converter ???

    Cheers EllirionCrew
     
  2. Post your code
     
  3. The issue is that you are using static here while it shouldn't be used. Each time you get a plot, it will set the coordinates for every previous plot you requested. You should be creating a new Plot instance with a non static x and y coordinate.
     
  4. Uhm we dont really understand what u mean got any sample ?
     
  5. If you're going to be hostile against community users please leave this thread. If I was able to fix this where i don't have any knowledge of a plot system regarding this type of Java i'm asking nicely if someone could help. Like you've seen i tried everything i know. The only reason it was static was because i had to acces it in a other class. My eclipse said i should make it static. So please post something helpfull or go flame your little brother or the small kids around the corner.
     
  6. wow wow, calm down there for a second. His point was completely valid, you simply don't seem to know enough Java (and yes, this is not because you lack knowledge of plot systems).

    Take your time properly understanding Java and OO concepts before starting with the Spigot API, I can ensure you it will make your life a lot easier.
     
    • Agree Agree x 1
  7. I...think I provided you with excellent resources from which to learn. Is that what people call hostile nowadays?
     
  8. Nobody is trying to "flame" you. You simply are demonstrating that your not ready to do this kind of project. Understanding Static variables and how they work is essential in OOP (Object Oriented Programming) languages. Not knowing something as basic as that points to the fact that you don't know much about OOP and how code should be written. I really advise you to read those documents provided, they will help you actually understand what you are doing. I mean, you wouldn't go working on your car engine before at least knowing how it works right?

    But to respond to you, you wouldn't make something static because u simply want to access it in another class. Your variable should probably be private and you need to create a method that returns that variable when called. Now I am going to assume that you probably don't know what I mean and i'm going to do the same "flaming" the previous folks have done and advise you to go look it up. do some research and learn more about what you are doing before you do it because you are not ready to take on something like this.
     
  9. Okay, I pretty much know those methods though, but it's a mathematical problem. You see, the code pretty much works, but when it comes to negative values it turns out to be broken.

    this is actually bothering me:
    Code (Text):

    Coordinate of X:
    11 / 10 (plotsize) = 1
    23 / 10 = 2
    1 / 10 = 0
    -1 / 10 = 0
    -12 / 10 = -1
     
    When it turns to a negative co├Ârdinate it creates two plots with the same ID (int).
    It should be an easy fix but I can't understand how.
     
  10. I made it static cause i didn't know what else i could do. I tried so much to make this work but never wanted to make it static. I used an get method and set method first but it's the plot mathematical thing i explained above. If someone could please help me with that i can finish my plugin. It's the only part bugging since i ain't good at math.
     
  11. Hmm just to clear things up is there anyone that knows how the fix the registration error in the - cordinations. Or ????
     
  12. lets start with what u are doing. are you registering a plot or just seeing what plot a player is in?
     
  13. This basically tells the player in what plot he is. It should have an automatic registration using the math thingy i used above. It returns with these values in what plot he is.

    E.g if a player is in X: 11 and Z: 12 it returns 1;1
     
  14. The basic idea is that it generates an X plot ID and an Z plot ID
    then I was going to use a player movement listener to check if a player has moved from a plot to a new plot with different ID(s).
    Then I would save those ID's in a storage file and load them into a hashmap when the server would startup.
    That's the main idea. However the ID defining (the code above) doesn't work very well.
     
  15. The Idea:

    The idea is that we have 8 Races. Ea race starts with a plot that they own of 128x128.
    They need to get resources to take over plots that are lying next to there owned plots. Our maps is 12kx12k big so there are 8800 plots to take over. We want to make a scoreboard that a player can see in what plot they are. so thats why we need the return of the plot registration. Also a leader of a race need to be able to turn PVP on or off in specific plots or specific players.

    My idea aswell is to have assasin (8 assasins) this are played by mods. But ea 5 plots the assasins cross a chat shout will be made that says where the assasin is so players can hun them down.

    So mainly that is the idea and my and my dev are really trying our best on making this but this the only point we are getting stuck on so far. So any help is welcome.

    Cheers Ellirion
     
  16. Bumppppppppppppppppppppppp