Skip to content

Commit

Permalink
Added island min-size check on login
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohron committed Sep 7, 2019
1 parent b96c84f commit 5ecdfb1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Change Log

# Planned Features, Changes & Bugfixes
- Add Void World Generation capabilities (blocked by https://github.com/SpongePowered/SpongeCommon/issues/1506)

# Beta 28 - SNAPSHOT
# Beta 28
### NOTE: Sponge Forge `1.12.2-2825-7.1.6-RC3697` adds entity and biome support for schematics
**REQUIRED: Sponge API 7.1 (SF 3682+); GP 1.12.2-4.3.0.622+; Permissions Plugin (ie. LuckPerms)**
**OPTIONAL: Nucleus 1.9.0-S7.1+**
Expand All @@ -18,7 +15,7 @@
- `/is schematic setheight <schematic> <height>` - set the generation height of a schematic
- `/is schematic setname <schematic> <name>` - set an in-game name for a schematic that supports formatting code
- `/is schematic seticon <schematic> <icon>` - set an icon for a schematic to be used by the chest GUI
- `/is schematic setpreset <schematic> <preset>` - set a flat world preset for a schematic _*see flat world preset support_
- `/is schematic setpreset <schematic> <preset>` - set a flat world preset for a schematic *_see flat world preset support_
- `skyclaims.default-schematic` now defaults to empty which will list valid schematics
- Removed `Misc-List-Schematics` config
- Added `Misc > Text-Schematic-List` config to disable new chest UI
Expand Down Expand Up @@ -60,6 +57,7 @@
- Removed outdated schematics:
- Garden of Glass
- SkyExchange
- Added island `min-size` check when an island owner logs in and if necessary, the island will be expanded
- Fixed schematics sometimes not generating at the intended height. The height set will be the height the player is at when standing on the lowest block of a schematic.
- Fixed Nucleus Integration commands not registering after a reload
- Fixed admin island expansion (`/is info`) bug where old clickable text can be used to expand outside the region
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ major=0
minor=28
patch=0
api=S7.1
suffix=SNAPSHOT
suffix=BETA
## Dependencies
spongeapi=7.1.0
spongeforge=1.12.2-2768-7.1.4
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/net/mohron/skyclaims/listener/ClientJoinHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void onClientJoin(ClientConnectionEvent.Join event, @Root Player player)
createIslandOnJoin(player);
}
deliverInvites(player);
checkIslandSize(player);
}

private void createIslandOnJoin(Player player) {
Expand Down Expand Up @@ -87,4 +88,16 @@ private void deliverInvites(Player player) {

SkyClaimsTimings.DELIVER_INVITES.stopTimingIfSync();
}

private void checkIslandSize(Player player) {
IslandManager.getByOwner(player.getUniqueId()).ifPresent(island -> {
final int width = island.getWidth();
int minWidth = Options.getMinSize(player.getUniqueId()) * 2;

if (width < minWidth) {
PLUGIN.getLogger().info("{} will be expanded from {} to {}.", island.getName().toPlain(), width, minWidth);
island.setWidth(minWidth);
}
});
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/mohron/skyclaims/world/Island.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public int getWidth() {
return getClaim().isPresent() ? getClaim().get().getWidth() : 512;
}

private boolean setWidth(int width) {
public boolean setWidth(int width) {
if (width < 0 || width > 512) {
return false;
}
Expand Down

0 comments on commit 5ecdfb1

Please sign in to comment.