-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from sebastianbinder/merge-API-into-repo
Merge PowerfulPermsAPI into repo
- Loading branch information
Showing
110 changed files
with
924 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>PowerfulPerms-Parent</artifactId> | ||
<groupId>com.github.cheesesoftware</groupId> | ||
<version>4.5.2</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>PowerfulPerms</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.cheesesoftware</groupId> | ||
<artifactId>PowerfulPermsAPI</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<targetPath>.</targetPath> | ||
<filtering>true</filtering> | ||
<directory>PowerfulPerms/src/main/resources</directory> | ||
<includes> | ||
<include>plugin.yml</include> | ||
<include>bungee.yml</include> | ||
<include>config.yml</include> | ||
<include>data.yml</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.2</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<artifactSet> | ||
<includes> | ||
<include>org.apache.commons:commons-pool2</include> | ||
<include>redis.clients:jedis</include> | ||
<include>com.github.cheesesoftware:PowerfulPermsAPI</include> | ||
<include>com.googlecode.json-simple:json-simple</include> | ||
<include>com.sk89q:worldedit</include> | ||
</includes> | ||
</artifactSet> | ||
<filters> | ||
<filter> | ||
<artifact>com.sk89q:worldedit</artifact> | ||
<includes> | ||
<include>com/sk89q/wepif/**</include> | ||
</includes> | ||
</filter> | ||
</filters> | ||
<relocations> | ||
<relocation> | ||
<pattern>redis.clients</pattern> | ||
<shadedPattern>com.github.cheesesoftware.PowerfulPerms.shaded.redis.clients</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.apache</pattern> | ||
<shadedPattern>com.github.cheesesoftware.PowerfulPerms.shaded.org.apache</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.json</pattern> | ||
<shadedPattern>com.github.cheesesoftware.PowerfulPerms.shaded.org.json</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>com.sk89q.wepif</pattern> | ||
<shadedPattern>com.github.cheesesoftware.PowerfulPerms.shaded.com.sk89q.wepif</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.mongodb</pattern> | ||
<shadedPattern>com.github.cheesesoftware.PowerfulPerms.shaded.org.mongodb</shadedPattern> | ||
</relocation> | ||
</relocations> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>PowerfulPerms-Parent</artifactId> | ||
<groupId>com.github.cheesesoftware</groupId> | ||
<version>4.5.2</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>PowerfulPermsAPI</artifactId> | ||
|
||
</project> |
50 changes: 50 additions & 0 deletions
50
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/CachedGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
import java.util.Date; | ||
|
||
public class CachedGroup { | ||
private int id; | ||
private int groupId; | ||
private boolean negated; | ||
private Date expires; | ||
private int expireTaskId = -1; | ||
|
||
public CachedGroup(int id, int groupId, boolean negated, Date expires) { | ||
this.id = id; | ||
this.groupId = groupId; | ||
this.negated = negated; | ||
this.expires = expires; | ||
} | ||
|
||
public int getId() { | ||
return this.id; | ||
} | ||
|
||
public int getGroupId() { | ||
return this.groupId; | ||
} | ||
|
||
public boolean isNegated() { | ||
return this.negated; | ||
} | ||
|
||
public Date getExpirationDate() { | ||
return expires; | ||
} | ||
|
||
public boolean willExpire() { | ||
return expires != null; | ||
} | ||
|
||
public boolean hasExpired() { | ||
return willExpire() && getExpirationDate().before(new Date()); | ||
} | ||
|
||
public int getExpireTaskId() { | ||
return expireTaskId; | ||
} | ||
|
||
public void setExpireTaskId(int taskId) { | ||
this.expireTaskId = taskId; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/DBDocument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
import java.sql.Timestamp; | ||
import java.util.Calendar; | ||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
public class DBDocument { | ||
|
||
protected Map<String, Object> data; | ||
|
||
public DBDocument(Map<String, Object> data) { | ||
this.data = data; | ||
} | ||
|
||
public Object get(String key) { | ||
return data.get(key); | ||
} | ||
|
||
public String getString(String key) { | ||
return (String) data.get(key); | ||
} | ||
|
||
public int getInt(String key) { | ||
Object input = data.get(key); | ||
if (input instanceof Long) { | ||
return ((Long) input).intValue(); | ||
} | ||
return (Integer) input; | ||
} | ||
|
||
public boolean getBoolean(String key) { | ||
return (Boolean) data.get(key); | ||
} | ||
|
||
public Timestamp getTimeStamp(String key) { | ||
return (Timestamp) data.get(key); | ||
} | ||
|
||
public Date getDate(String key) { | ||
if (getTimeStamp(key) != null) { | ||
Calendar start = Calendar.getInstance(); | ||
start.setTimeInMillis(getTimeStamp(key).getTime()); | ||
return start.getTime(); | ||
} | ||
return null; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...API/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/DefaultPermissionPlayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
import java.util.UUID; | ||
|
||
import com.google.common.base.Charsets; | ||
|
||
// ONLY!! set [default] to this! | ||
public class DefaultPermissionPlayer { | ||
|
||
public static UUID getUUID() { | ||
return java.util.UUID.nameUUIDFromBytes(("[default]").getBytes(Charsets.UTF_8)); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/Event.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
public class Event { | ||
protected String name; | ||
|
||
public String getEventName() { | ||
if (name == null) { | ||
name = getClass().getSimpleName(); | ||
} | ||
return name; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/EventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
public interface EventHandler { | ||
|
||
public void registerListener(PowerfulPermsListener listener); | ||
|
||
public void unregisterListener(PowerfulPermsListener listener); | ||
|
||
public void fireEvent(Event event); | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/Group.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
public interface Group { | ||
|
||
public int getId(); | ||
|
||
public String getName(); | ||
|
||
public List<Group> getParents(); | ||
|
||
public String getPrefix(String server); | ||
|
||
public String getSuffix(String server); | ||
|
||
public HashMap<String, String> getPrefixes(); | ||
|
||
public HashMap<String, String> getSuffixes(); | ||
|
||
public List<Permission> getOwnPermissions(); | ||
|
||
public List<Permission> getPermissions(); | ||
|
||
public String getLadder(); | ||
|
||
public int getRank(); | ||
|
||
public void setParents(List<Integer> parents); | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/GroupPermissionExpiredEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
public class GroupPermissionExpiredEvent extends Event { | ||
private final Group group; | ||
private final Permission permission; | ||
|
||
public GroupPermissionExpiredEvent(Group group, Permission permission) { | ||
this.group = group; | ||
this.permission = permission; | ||
} | ||
|
||
public Group getGroup() { | ||
return this.group; | ||
} | ||
|
||
public Permission getPermission() { | ||
return this.permission; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/IScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
import java.util.Date; | ||
|
||
public interface IScheduler { | ||
public void runAsync(Runnable runnable, boolean sameThread); | ||
|
||
/* | ||
* Note: Bungee can't run sync tasks, all of them are asynchronous. | ||
*/ | ||
public void runSync(Runnable runnable, boolean sameThread); | ||
|
||
/* | ||
* Note: Bungee can't run sync tasks, all of them are asynchronous. | ||
*/ | ||
public void runSync(Runnable runnable); | ||
|
||
public int runRepeating(Runnable runnable, int seconds); | ||
|
||
public void stopRepeating(int taskId); | ||
|
||
public int runDelayed(Runnable runnable, Date when); | ||
|
||
public int runDelayed(Runnable runnable, long seconds); | ||
} |
49 changes: 49 additions & 0 deletions
49
PowerfulPermsAPI/src/main/java/com/github/cheesesoftware/PowerfulPermsAPI/Pair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.github.cheesesoftware.PowerfulPermsAPI; | ||
|
||
public class Pair<A, B> { | ||
private A first; | ||
private B second; | ||
|
||
public Pair(A first, B second) { | ||
super(); | ||
this.first = first; | ||
this.second = second; | ||
} | ||
|
||
public int hashCode() { | ||
int hashFirst = first != null ? first.hashCode() : 0; | ||
int hashSecond = second != null ? second.hashCode() : 0; | ||
|
||
return (hashFirst + hashSecond) * hashSecond + hashFirst; | ||
} | ||
|
||
public boolean equals(Object other) { | ||
if (other instanceof Pair<?, ?>) { | ||
Pair<?, ?> otherPair = (Pair<?, ?>) other; | ||
return ((this.first == otherPair.first || (this.first != null && otherPair.first != null && this.first.equals(otherPair.first))) && (this.second == otherPair.second || (this.second != null | ||
&& otherPair.second != null && this.second.equals(otherPair.second)))); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public String toString() { | ||
return "(" + first + ", " + second + ")"; | ||
} | ||
|
||
public A getFirst() { | ||
return first; | ||
} | ||
|
||
public void setFirst(A first) { | ||
this.first = first; | ||
} | ||
|
||
public B getSecond() { | ||
return second; | ||
} | ||
|
||
public void setSecond(B second) { | ||
this.second = second; | ||
} | ||
} |
Oops, something went wrong.