Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/me/ryanhamshire/GriefPrevention/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ synchronized private CreateClaimResult createClaim(World world, int x1, int x2,
CreateClaimResult result = new CreateClaimResult();
WorldConfig wc = GriefPrevention.instance.getWorldCfg(world);
int smallx, bigx, smally, bigy, smallz, bigz;
boolean setID = false;

Player gotplayer = Bukkit.getPlayer(ownerName);
// determine small versus big inputs
Expand Down Expand Up @@ -277,6 +278,12 @@ synchronized private CreateClaimResult createClaim(World world, int x1, int x2,
smally = 2;
}

// set the ID so it can be retrieved by a plugin listening to the ClaimBeforeCreateEvent
if (id == null) {
id = this.nextClaimID;
setID = true;
}

// create a new claim instance (but don't save it, yet)
Claim newClaim = new Claim(new Location(world, smallx, smally, smallz), new Location(world, bigx, bigy, bigz), ownerName, new String[] {}, new String[] {}, new String[] {}, new String[] {}, id, false);

Expand Down Expand Up @@ -332,6 +339,12 @@ synchronized private CreateClaimResult createClaim(World world, int x1, int x2,
* CreateClaimResult.Result.Canceled; return result; }
*/
}

// increment the ID because it was originally null
if (setID) {
this.incrementNextClaimID();
}

// otherwise add this new claim to the data store to make it effective
this.addClaim(newClaim);

Expand Down