Skip to content

Commit 07b0db8

Browse files
committed
Add default max homes, enable base functionality by default
1 parent 5c7ee3b commit 07b0db8

File tree

5 files changed

+32
-25
lines changed

5 files changed

+32
-25
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>simplexity</groupId>
88
<artifactId>SimpleHomes</artifactId>
9-
<version>1.2.2</version>
9+
<version>1.3.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SimpleHomes</name>

src/main/java/simplexity/simplehomes/commands/CommandUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public static Home getHomeFromList(List<Home> homes, String homeName) {
3232
public static boolean hasMoreHomesThanAllowed(Player player){
3333
UUID playerUUID = player.getUniqueId();
3434
List<Home> playerHomeList = SQLHandler.getInstance().getHomes(playerUUID);
35+
int maxHomes = maxHomesPermission(player);
36+
if (maxHomes < 0) return false;
3537
return playerHomeList.size() > maxHomesPermission(player);
3638
}
3739

@@ -50,6 +52,9 @@ public static int maxHomesPermission(Player player) {
5052
SimpleHomes.getInstance().getLogger().warning("Found homes permission with invalid number format: " + permission);
5153
}
5254
}
55+
if (maxHomes == 0) {
56+
return ConfigHandler.getInstance().getDefaultMaxHomeCount();
57+
}
5358
return maxHomes;
5459
}
5560

src/main/java/simplexity/simplehomes/configs/ConfigHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ConfigHandler {
1515
private boolean creativeBypass, invulnerableBypass, mysql, lockoutEnabled, disableHome, disableHomeList,
1616
disableDeleteHome, delayEnabled, cancelOnMove, bedHomesEnabled;
1717
private String ip, name, username, password, bedHomesName, defaultHomeName;
18-
private int timeInSeconds;
18+
private int timeInSeconds, defaultMaxHomeCount;
1919
private double bufferMovement;
2020

2121
public static ConfigHandler getInstance() {
@@ -40,6 +40,7 @@ public void loadConfigValues() {
4040
bedHomesEnabled = config.getBoolean("bed-home.enabled", false);
4141
bedHomesName = config.getString("bed-home.name", "bed");
4242
defaultHomeName = config.getString("default-home-name", "home");
43+
defaultMaxHomeCount = config.getInt("default-max-home-count", 3);
4344
fillList(blockList);
4445
mysql = config.getBoolean("mysql.enabled", false);
4546
ip = config.getString("mysql.ip");
@@ -135,4 +136,8 @@ public String getBedHomesName() {
135136
public String getDefaultHomeName() {
136137
return defaultHomeName;
137138
}
139+
140+
public int getDefaultMaxHomeCount() {
141+
return defaultMaxHomeCount;
142+
}
138143
}

src/main/resources/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ bed-home: #set a home when interacting with a bed
2828
enabled: false
2929
name: "bed" #this will be reserved and not able to be used on /sethome
3030
default-home-name: "home"
31+
# 0 for no default homes, -1 for infinite default homes
32+
#if you set someone's max homes lower than the default, their max homes will be what their permission is, not the default
33+
default-max-home-count: 3

src/main/resources/plugin.yml

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,38 @@ commands:
2525
description: Console only command for importing from other plugins.
2626
permissions:
2727
homes:
28-
default: op
28+
default: true
2929
description: allows base plugin functionality
3030
homes.commands:
31-
default: op
31+
default: true
3232
description: allows player to use commands
33+
children:
34+
homes.commands.sethome: true
35+
homes.commands.delhome: true
36+
homes.commands.home: true
37+
homes.commands.list: true
38+
homes.bed: true
39+
homes.bed:
40+
default: true
41+
description: sets a home at your bed when you interact with it
3342
homes.commands.sethome:
34-
default: op
43+
default: true
3544
description: allows player to set home
36-
children:
37-
homes.commands: true
3845
homes.commands.delhome:
39-
default: op
46+
default: true
4047
description: allows player to delete home
41-
children:
42-
homes.commands: true
4348
homes.commands.home:
44-
default: op
49+
default: true
4550
description: allows player to teleport to home
46-
children:
47-
homes.commands: true
51+
homes.commands.list:
52+
default: true
53+
description: allows you to list your own homes
4854
homes.count:
4955
default: op
5056
description: base for permission on number of homes you can have
5157
homes.count.bypass:
5258
default: op
5359
description: allows for setting infinite homes regardless of how many you have set as the max
54-
children:
55-
homes.count: true
56-
homes.commands.list:
57-
default: op
58-
description: allows you to list your own homes
59-
children:
60-
homes.commands: true
61-
homes.bed:
62-
default: op
63-
description: sets a home at your bed when you interact with it
64-
children:
65-
homes.commands: true
6660
homes.safety.bypass:
6761
default: false
6862
description: allows bypassing the safety checks

0 commit comments

Comments
 (0)