This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
2
How spawn moves
Post Body
@EventHandler(priority = EventPriority.HIGH)
public void spawnmove(PlayerRespawnEvent event) {
if (!event.isBedSpawn()) {
Location curloc = event.getRespawnLocation();
boolean look = true;
int lookcount = 0;
World wld = getServer().getWorld(this.getConfig().getString("worldName"));
while (look) {
Integer xloc = ((int) (rand.nextInt(230) - 100 curloc.getX()));
if (xloc > 2200){
xloc = xloc - 3400;
}
if (xloc < -1200){
xloc = xloc 3400;
}
Integer zloc = ((int) (rand.nextInt(300) - 100 curloc.getZ()));
if (zloc < -2400){
zloc = zloc 6000;
}
if (zloc > 3600){
zloc = zloc - 6000;
}
Integer yloc = wld.getHighestBlockYAt(xloc, zloc);
Material mat = wld.getBlockAt(xloc, (yloc - 1), zloc).getType();
if ((mat == Material.GRASS) || (mat == Material.SAND) || (mat == Material.HARD_CLAY)) {
look = false;
wld.setSpawnLocation(xloc, yloc, zloc);
this.getLogger().info(
"spawn moved " xloc.toString() ":" yloc.toString() ":" zloc.toString());
}
lookcount ;
if (lookcount > 100) {
this.getLogger().info("spawn not moved");
look = false;
}
}
}
}
EDIT: Made better by psygate
Author
Account Strength
90%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
2,249
Link Karma
70
Comment Karma
2,179
Profile updated: 1 day ago
Posts updated: 7 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 10 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/CivRealms/c...