Skip to content

Commit

Permalink
Merge pull request #7 from sebastianbinder/merge-API-into-repo
Browse files Browse the repository at this point in the history
Merge PowerfulPermsAPI into repo
  • Loading branch information
gustav9797 authored Oct 11, 2017
2 parents 2d335e9 + d40ded8 commit 6587b37
Show file tree
Hide file tree
Showing 110 changed files with 924 additions and 86 deletions.
100 changes: 100 additions & 0 deletions PowerfulPerms/pom.xml
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.
14 changes: 14 additions & 0 deletions PowerfulPermsAPI/pom.xml
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>
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;
}
}
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;
}
}
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));
}

}
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;
}
}
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);

}
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);

}
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;
}
}
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);
}
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;
}
}
Loading

0 comments on commit 6587b37

Please sign in to comment.