Implement basic standalone base, working towards #9
This commit is contained in:
parent
1e72f9d8fe
commit
fa9324bda8
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -62,6 +62,24 @@ public interface LPConfiguration {
|
|||||||
*/
|
*/
|
||||||
boolean getIncludeGlobalPerms();
|
boolean getIncludeGlobalPerms();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if the users on this server will have their global world permissions applied
|
||||||
|
* @since 2.9
|
||||||
|
*/
|
||||||
|
boolean getIncludeGlobalWorldPerms();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the platform is applying global groups
|
||||||
|
* @since 2.9
|
||||||
|
*/
|
||||||
|
boolean getApplyGlobalGroups();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the platform is applying global world groups
|
||||||
|
* @since 2.9
|
||||||
|
*/
|
||||||
|
boolean getApplyGlobalWorldGroups();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the online mode setting in the config
|
* @return the online mode setting in the config
|
||||||
*/
|
*/
|
||||||
@ -88,6 +106,12 @@ public interface LPConfiguration {
|
|||||||
*/
|
*/
|
||||||
boolean getLogNotify();
|
boolean getLogNotify();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if permission checks are being recorded / debugged
|
||||||
|
* @since 2.9
|
||||||
|
*/
|
||||||
|
boolean getDebugPermissionChecks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the vanilla op system is enabled
|
* @return true if the vanilla op system is enabled
|
||||||
* @since 2.8
|
* @since 2.8
|
||||||
@ -100,6 +124,12 @@ public interface LPConfiguration {
|
|||||||
*/
|
*/
|
||||||
boolean getCommandsAllowOp();
|
boolean getCommandsAllowOp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if auto op is enabled
|
||||||
|
* @since 2.9
|
||||||
|
*/
|
||||||
|
boolean getAutoOp();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name of the server used within Vault operations
|
* @return the name of the server used within Vault operations
|
||||||
* @since 2.7
|
* @since 2.7
|
||||||
|
@ -187,7 +187,7 @@ public interface LuckPermsApi {
|
|||||||
Track getTrack(String name);
|
Track getTrack(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a wrapped tracj object from the track storage. This method does not return null, unlike {@link #getTrack}
|
* Gets a wrapped track object from the track storage. This method does not return null, unlike {@link #getTrack}
|
||||||
* @param name the name of the track to get
|
* @param name the name of the track to get
|
||||||
* @return an optional {@link Track} object
|
* @return an optional {@link Track} object
|
||||||
* @throws NullPointerException if the name is null
|
* @throws NullPointerException if the name is null
|
||||||
|
@ -30,7 +30,12 @@ public enum PlatformType {
|
|||||||
|
|
||||||
BUKKIT("Bukkit"),
|
BUKKIT("Bukkit"),
|
||||||
BUNGEE("Bungee"),
|
BUNGEE("Bungee"),
|
||||||
SPONGE("Sponge");
|
SPONGE("Sponge"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.9
|
||||||
|
*/
|
||||||
|
STANDALONE("Standalone");
|
||||||
|
|
||||||
private final String friendlyName;
|
private final String friendlyName;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class ApiProvider implements LuckPermsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getApiVersion() {
|
public double getApiVersion() {
|
||||||
return 2.8;
|
return 2.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,6 +61,21 @@ public class LPConfigurationLink implements LPConfiguration {
|
|||||||
return master.getIncludeGlobalPerms();
|
return master.getIncludeGlobalPerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getIncludeGlobalWorldPerms() {
|
||||||
|
return master.getIncludeGlobalWorldPerms();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getApplyGlobalGroups() {
|
||||||
|
return master.getApplyGlobalGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getApplyGlobalWorldGroups() {
|
||||||
|
return master.getApplyGlobalWorldGroups();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getOnlineMode() {
|
public boolean getOnlineMode() {
|
||||||
return master.getOnlineMode();
|
return master.getOnlineMode();
|
||||||
@ -86,6 +101,11 @@ public class LPConfigurationLink implements LPConfiguration {
|
|||||||
return master.getLogNotify();
|
return master.getLogNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getDebugPermissionChecks() {
|
||||||
|
return master.getDebugPermissionChecks();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getEnableOps() {
|
public boolean getEnableOps() {
|
||||||
return master.getEnableOps();
|
return master.getEnableOps();
|
||||||
@ -96,6 +116,11 @@ public class LPConfigurationLink implements LPConfiguration {
|
|||||||
return master.getCommandsAllowOp();
|
return master.getCommandsAllowOp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getAutoOp() {
|
||||||
|
return master.getAutoOp();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVaultServer() {
|
public String getVaultServer() {
|
||||||
return master.getVaultServer();
|
return master.getVaultServer();
|
||||||
|
5
pom.xml
5
pom.xml
@ -6,10 +6,11 @@
|
|||||||
|
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>common</module>
|
<module>common</module>
|
||||||
<module>api</module>
|
<module>api</module>
|
||||||
|
<module>standalone</module>
|
||||||
<module>bukkit</module>
|
<module>bukkit</module>
|
||||||
<module>bukkit-legacy</module>
|
<module>bukkit-legacy</module>
|
||||||
<module>bukkit-placeholders</module>
|
<module>bukkit-placeholders</module>
|
||||||
@ -38,7 +39,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<release.version>2.8</release.version>
|
<release.version>2.9</release.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.8-SNAPSHOT</version>
|
<version>2.9-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
145
standalone/pom.xml
Normal file
145
standalone/pom.xml
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?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>luckperms</artifactId>
|
||||||
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
|
<version>2.9-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>luckperms-standalone</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
|
<finalName>LuckPermsStandalone-${release.version}.${git.closest.tag.commit.count}</finalName>
|
||||||
|
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>me.lucko.luckperms.LPStandaloneApp</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>2.4.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>false</minimizeJar>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.slf4j</pattern>
|
||||||
|
<shadedPattern>me.lucko.luckperms.lib.slf4j</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.zaxxer.hikari</pattern>
|
||||||
|
<shadedPattern>me.lucko.luckperms.lib.hikari</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.mongodb</pattern>
|
||||||
|
<shadedPattern>me.lucko.luckperms.lib.mongodb</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.bson</pattern>
|
||||||
|
<shadedPattern>me.lucko.luckperms.lib.bson</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.h2</pattern>
|
||||||
|
<shadedPattern>me.lucko.luckperms.lib.h2</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.sqlite</pattern>
|
||||||
|
<shadedPattern>me.lucko.luckperms.lib.sqlite</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>pl.project13.maven</groupId>
|
||||||
|
<artifactId>git-commit-id-plugin</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>revision</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<injectAllReactorProjects>true</injectAllReactorProjects>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- LuckPerms Common -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
|
<artifactId>luckperms-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- LuckPerms API -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
|
<artifactId>luckperms-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.16.10</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- gson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- guava -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>19.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.internal.StandaloneBase;
|
||||||
|
|
||||||
|
public class LPStandaloneApp {
|
||||||
|
private StandaloneBase standaloneBase;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new LPStandaloneApp().start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
standaloneBase = new StandaloneBase(this);
|
||||||
|
LuckPerms.registerProvider(standaloneBase.getApiProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
standaloneBase.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.gui;
|
||||||
|
|
||||||
|
public class InterfaceManager {
|
||||||
|
// TODO
|
||||||
|
}
|
@ -0,0 +1,220 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.internal;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import me.lucko.luckperms.LPStandaloneApp;
|
||||||
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
|
import me.lucko.luckperms.api.Logger;
|
||||||
|
import me.lucko.luckperms.api.PlatformType;
|
||||||
|
import me.lucko.luckperms.api.implementation.ApiProvider;
|
||||||
|
import me.lucko.luckperms.commands.ConsecutiveExecutor;
|
||||||
|
import me.lucko.luckperms.commands.Sender;
|
||||||
|
import me.lucko.luckperms.constants.Constants;
|
||||||
|
import me.lucko.luckperms.constants.Message;
|
||||||
|
import me.lucko.luckperms.constants.Permission;
|
||||||
|
import me.lucko.luckperms.core.LPConfiguration;
|
||||||
|
import me.lucko.luckperms.core.UuidCache;
|
||||||
|
import me.lucko.luckperms.data.Importer;
|
||||||
|
import me.lucko.luckperms.groups.GroupManager;
|
||||||
|
import me.lucko.luckperms.storage.Datastore;
|
||||||
|
import me.lucko.luckperms.tracks.TrackManager;
|
||||||
|
import me.lucko.luckperms.users.StandaloneUserManager;
|
||||||
|
import me.lucko.luckperms.users.UserManager;
|
||||||
|
import me.lucko.luckperms.utils.LogFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class StandaloneBase implements LuckPermsPlugin {
|
||||||
|
private final ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
|
private final java.util.logging.Logger logger;
|
||||||
|
|
||||||
|
private final UserManager userManager;
|
||||||
|
private final GroupManager groupManager;
|
||||||
|
private final TrackManager trackManager;
|
||||||
|
private final LPConfiguration configuration;
|
||||||
|
private final Datastore datastore;
|
||||||
|
private final Logger log;
|
||||||
|
private final UuidCache uuidCache;
|
||||||
|
private final ApiProvider apiProvider;
|
||||||
|
|
||||||
|
public StandaloneBase(LPStandaloneApp app) {
|
||||||
|
logger = java.util.logging.Logger.getGlobal();
|
||||||
|
log = LogFactory.wrap(logger);
|
||||||
|
|
||||||
|
configuration = new StandaloneConfiguration(this);
|
||||||
|
|
||||||
|
// TODO datastore
|
||||||
|
datastore = null;
|
||||||
|
// Load everything, including all users.
|
||||||
|
|
||||||
|
uuidCache = new UuidCache(true);
|
||||||
|
userManager = new StandaloneUserManager(this);
|
||||||
|
groupManager = new GroupManager(this);
|
||||||
|
trackManager = new TrackManager();
|
||||||
|
|
||||||
|
apiProvider = new ApiProvider(this);
|
||||||
|
|
||||||
|
// TODO callback to the app, start gui stuff?
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
datastore.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
return "2.9.0"; // TODO set dynamically
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlatformType getType() {
|
||||||
|
return PlatformType.STANDALONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getMainDir() {
|
||||||
|
return null; // Is this needed? TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getDataFolder() {
|
||||||
|
return null; // Is this needed? TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runUpdateTask() {
|
||||||
|
// Is this needed?? TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAsync(Runnable r) {
|
||||||
|
threadPool.execute(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSync(Runnable r) {
|
||||||
|
threadPool.execute(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Methods below are only required in plugins.
|
||||||
|
* They're just left empty / default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Importer getImporter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsecutiveExecutor getConsecutiveExecutor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Message getPlayerStatus(UUID uuid) {
|
||||||
|
return Message.PLAYER_OFFLINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlayerCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getPlayerList() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Sender> getNotifyListeners() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Sender getConsoleSender() {
|
||||||
|
return new Sender() {
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return Constants.getConsoleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getUuid() {
|
||||||
|
return Constants.getConsoleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMessage(String s) {
|
||||||
|
getLogger().info(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(Permission permission) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getPossiblePermissions() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<UUID> getIgnoringLogs() {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getPlugin(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getService(Class clazz) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getUUID(String playerName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPluginLoaded(String name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.internal;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.core.LPConfiguration;
|
||||||
|
|
||||||
|
public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> {
|
||||||
|
public StandaloneConfiguration(StandaloneBase plugin) {
|
||||||
|
super(plugin, "global", true, "null");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void set(String path, Object value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getString(String path, String def) {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getInt(String path, int def) {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean getBoolean(String path, boolean def) {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.users;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class StandaloneUser extends User {
|
||||||
|
|
||||||
|
StandaloneUser(UUID uuid, LuckPermsPlugin plugin) {
|
||||||
|
super(uuid, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
StandaloneUser(UUID uuid, String username, LuckPermsPlugin plugin) {
|
||||||
|
super(uuid, username, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refreshPermissions() {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.users;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class StandaloneUserManager extends UserManager {
|
||||||
|
private final LuckPermsPlugin plugin;
|
||||||
|
|
||||||
|
public StandaloneUserManager(LuckPermsPlugin plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cleanup(User user) {
|
||||||
|
// unload(user);
|
||||||
|
// never unload????? TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User make(UUID id) {
|
||||||
|
return new StandaloneUser(id, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User make(UUID uuid, String username) {
|
||||||
|
return new StandaloneUser(uuid, username, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAllUsers() {
|
||||||
|
getAll().values().forEach(u -> plugin.getDatastore().loadUser(u.getUuid(), u.getName()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user