Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Various fixes. Closes #1970
Browse files Browse the repository at this point in the history
* Update POM to be able to compile

! Fix rank ladder fetching

! Fix when swapping group, the position of group changed unexpectedly
  • Loading branch information
PikachuEXE authored and zml2008 committed Apr 18, 2015
1 parent bbb76e1 commit cf58beb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<dependency>
<groupId>com.zachsthings</groupId>
<artifactId>netevents</artifactId>
<version>1.0</version>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ru/tehkode/permissions/PermissionGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void setRank(int rank) {
* @return Name of rank ladder as String
*/
public String getRankLadder() {
return this.getOwnOption("rank-ladder", "", "default");
return this.getOwnOption("rank-ladder", null, "default");
}

/**
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/ru/tehkode/permissions/PermissionUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package ru.tehkode.permissions;

import com.google.common.collect.Maps;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import ru.tehkode.permissions.events.PermissionEntityEvent;
Expand Down Expand Up @@ -487,10 +488,15 @@ protected int getPromoterRankAndCheck(PermissionUser promoter, String ladderName
}

protected void swapGroups(PermissionGroup src, PermissionGroup dst) {
Validate.notNull(src);
Validate.notNull(dst);

List<PermissionGroup> groups = new ArrayList<>(this.getParents());
int indexOfSrcGroup = groups.indexOf(src);

Validate.isTrue(indexOfSrcGroup != -1);

groups.remove(src);
groups.add(dst);
groups.set(indexOfSrcGroup, dst);

this.setParents(groups);
}
Expand Down

0 comments on commit cf58beb

Please sign in to comment.