Skip to content

Commit 6c985c9

Browse files
authored
Merge pull request #129 from weaves7/master
Permissions bug fix and more loading info
2 parents 78f9872 + 4f2d812 commit 6c985c9

6 files changed

Lines changed: 32 additions & 12 deletions

File tree

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
<url>https://ci.ender.zone/plugin/repository/everything/</url>
3030
</repository>
3131
<repository>
32-
<id>rutger-repo</id>
33-
<url>http://www.rutgerkok.nl/repo</url>
32+
<id>codemc-repo</id>
33+
<url>https://repo.codemc.org/repository/maven-public/</url>
3434
</repository>
3535
</repositories>
3636
<dependencies>
@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>org.jetbrains</groupId>
4545
<artifactId>annotations-java5</artifactId>
46-
<version>RELEASE</version>
46+
<version>22.0.0</version>
4747
<scope>provided</scope>
4848
</dependency>
4949
<dependency>

src/main/java/org/wargamer2010/signshop/configuration/SignShopConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public static void setupOperations(Map<String, String> allSignOperations, String
332332
boolean failedOp = false;
333333
List<String> tempCheckedSignOperation = new LinkedList<>();
334334

335-
for (String tempOperationString : allSignOperations.get(sKey).split(",")) {
335+
for (String tempOperationString : allSignOperations.get(sKey).split("(,(?![^{]*}))")) { //Matches commas outside of curly braces
336336
List<String> bits = signshopUtil.getParameters(tempOperationString.trim());
337337
String op = bits.get(0);
338338
Object opinstance = getInstance(packageName + "." + op.trim());
@@ -875,8 +875,8 @@ private enum LanguageSpelling {
875875
RUSSIAN("russian", "ru_RU"),
876876
SPANISH("spanish", "es_ES");
877877

878-
String oldName;
879-
String localeName;
878+
final String oldName;
879+
final String localeName;
880880

881881
LanguageSpelling(String oldName, String localeName) {
882882
this.oldName = oldName;

src/main/java/org/wargamer2010/signshop/configuration/Storage.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ private Storage(File ymlFile) {
5959

6060
// Load into memory, this also removes invalid signs (hence the backup)
6161
Boolean needToSave = Load();
62+
6263
if(needToSave) {
6364
File backupTo = new File(ymlFile.getPath()+".bak");
6465
if(backupTo.exists())
@@ -216,11 +217,13 @@ private boolean loadSellerFromSettings(String key, HashMap<String,List<String>>
216217
}
217218

218219
private Boolean Load() {
220+
SignShop.log("Loading and validating shops, please wait...",Level.INFO);
219221
FileConfiguration yml = YamlConfiguration.loadConfiguration(ymlfile);
220222
ConfigurationSection sellersection = yml.getConfigurationSection("sellers");
221-
if(sellersection == null)
223+
if(sellersection == null) {
224+
SignShop.log("There are no shops available. This is likely your first startup with SignShop.",Level.INFO);
222225
return false;
223-
226+
}
224227
Map<String,HashMap<String,List<String>>> tempSellers = configUtil.fetchHashmapInHashmapwithList("sellers", yml);
225228
if(tempSellers == null) {
226229
SignShop.log("Invalid sellers.yml format detected. Old sellers format is no longer supported."
@@ -229,6 +232,7 @@ private Boolean Load() {
229232
return false;
230233
}
231234
if (tempSellers.isEmpty()) {
235+
SignShop.log("Loaded zero valid shops.",Level.INFO);
232236
return false;
233237
}
234238

@@ -240,6 +244,7 @@ private Boolean Load() {
240244
}
241245

242246
Bukkit.getPluginManager().registerEvents(this, SignShop.getInstance());
247+
SignShop.log("Loaded " + shopCount() + " valid shops.", Level.INFO);
243248
return needSave;
244249
}
245250

src/main/java/org/wargamer2010/signshop/player/SignShopPlayer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public boolean isOp(World world, String perm) {
148148
if (isOpRaw())
149149
return true;
150150
String fullperm = (perm.isEmpty() ? "SignShop.SuperAdmin" : "SignShop.SuperAdmin." + perm);
151-
return SignShop.usePermissions() && Vault.getPermission().playerHas(world.toString(), getOfflinePlayer(), fullperm.toLowerCase());
151+
return SignShop.usePermissions() && Vault.getPermission().playerHas(world.getName(), getOfflinePlayer(), fullperm.toLowerCase());
152152
}
153153

154154
private boolean isOpRaw() {
@@ -188,7 +188,7 @@ public boolean hasPerm(String perm, World world, Boolean OPOperation) {
188188
setOp(false);
189189
// Having Signshop.Superadmin while Permissions are in use should allow you to do everything with SignShop
190190
// And since the node is explicitly given to a player, the OPOverride setting is not relevant
191-
if (SignShop.usePermissions() && Vault.getPermission().playerHas(world.toString(), getOfflinePlayer(), "signshop.superadmin")) {
191+
if (SignShop.usePermissions() && Vault.getPermission().playerHas(world.getName(), getOfflinePlayer(), "signshop.superadmin")) {
192192
setOp(isOP);
193193
return true;
194194
}
@@ -197,7 +197,7 @@ public boolean hasPerm(String perm, World world, Boolean OPOperation) {
197197
if (SignShop.usePermissions() && OPOverride && isOP)
198198
return true;
199199
// Using Permissions so check his permissions and restore his OP if he has it
200-
else if (SignShop.usePermissions() && Vault.getPermission().playerHas(world.toString(), getOfflinePlayer(), perm.toLowerCase())) {
200+
else if (SignShop.usePermissions() && Vault.getPermission().playerHas(world.getName(), getOfflinePlayer(), perm.toLowerCase())) {
201201
setOp(isOP);
202202
return true;
203203
// Not using Permissions but he is OP, so he's allowed

0 commit comments

Comments
 (0)