Merge branch 'development'

This commit is contained in:
Brianna 2021-01-19 12:25:25 -06:00
commit d71bf5aa5a
27 changed files with 171 additions and 84 deletions

24
.github/workflows/maven.yml vendored Normal file
View File

@ -0,0 +1,24 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build SongodaCore
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="GoogleStyle" />
</state>
</component>

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="private" />
<option name="name" value="private" />
<option name="url" value="https://repo.songoda.com/artifactory/private/" />
</remote-repository>
<remote-repository>
<option name="id" value="spigot-repo" />
<option name="name" value="spigot-repo" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="private" />
<option name="name" value="private" />
<option name="url" value="https://repo.songoda.com/repository/private/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jitpack.io" />
<option name="name" value="jitpack.io" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="public" />
<option name="name" value="public" />
<option name="url" value="https://repo.songoda.com/repository/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="public" />
<option name="name" value="public" />
<option name="url" value="https://repo.songoda.com/artifactory/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../</relativePath>
</parent>
@ -368,6 +368,12 @@
<version>0.96.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>1.15.5</version>
<scope>provided</scope>
</dependency>
<!-- End Plugin Hooks -->
<dependency>

View File

@ -53,7 +53,7 @@ public class SongodaCore {
/**
* This has been added as of Rev 6
*/
private final static String coreVersion = "2.4.37";
private final static String coreVersion = "2.4.38";
/**
* This is specific to the website api

View File

@ -45,6 +45,7 @@ public final class PluginHook<T extends Class> {
public static final PluginHook PROTECTION_REDPROTECT = new PluginHook(Protection.class, "RedProtect", RedProtectProtection.class);
public static final PluginHook PROTECTION_ULTIMATECLAIMS = new PluginHook(Protection.class, "UltimateClaims", UltimateClaimsProtection.class);
public static final PluginHook PROTECTION_TOWNY = new PluginHook(Protection.class, "Towny", TownyProtection.class);
public static final PluginHook PROTECTION_BENTOBOX = new PluginHook(Protection.class, "BentoBox", BentoBoxProtection.class);
/******* Start Manager stuff *******/

View File

@ -0,0 +1,64 @@
package com.songoda.core.hooks.protection;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.managers.IslandsManager;
import java.util.Optional;
public class BentoBoxProtection extends Protection {
private final IslandsManager islandsManager;
public BentoBoxProtection(Plugin plugin) {
super(plugin);
this.islandsManager = BentoBox.getInstance().getIslands();
}
@Override
public boolean canPlace(Player player, Location location) {
return hasPerms(player, location, Flags.PLACE_BLOCKS);
}
@Override
public boolean canBreak(Player player, Location location) {
return hasPerms(player, location, Flags.BREAK_BLOCKS);
}
@Override
public boolean canInteract(Player player, Location location) {
return hasPerms(player, location, Flags.CONTAINER);
}
private boolean hasPerms(Player player, Location location, Flag flag) {
if (!BentoBox.getInstance().getIWM().inWorld(location)) {
return true;
}
Optional<Island> optional = islandsManager.getIslandAt(location);
if (!optional.isPresent()) {
return flag.isSetForWorld(location.getWorld());
}
Island island = optional.get();
User user = User.getInstance(player);
return island.isAllowed(user, flag);
}
@Override
public String getName() {
return "BentoBox";
}
@Override
public boolean isEnabled() {
return false;
}
}

View File

@ -18,17 +18,29 @@ public class GriefPreventionProtection extends Protection {
@Override
public boolean canPlace(Player player, Location location) {
return getClaim(location).allowBuild(player, location.getBlock().getType()) == null;
Claim claim = getClaim(location);
if (claim == null) {
return true;
}
return claim.allowBuild(player, location.getBlock().getType()) == null;
}
@Override
public boolean canBreak(Player player, Location location) {
return getClaim(location).allowBreak(player, location.getBlock().getType()) == null;
Claim claim = getClaim(location);
if (claim == null) {
return true;
}
return claim.allowBreak(player, location.getBlock().getType()) == null;
}
@Override
public boolean canInteract(Player player, Location location) {
return getClaim(location).allowContainers(player) == null;
Claim claim = getClaim(location);
if (claim == null) {
return true;
}
return claim.allowContainers(player) == null;
}
private Claim getClaim(Location location) {

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -1 +1,42 @@
SongodaUpdater
SongodaCore ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/Songoda/SongodaCore/Build%20SongodaCore/master) ![GitHub Workflow Status (branch)](https://img.shields.io/discord/293212540723396608)
===========
An elaborate multi functional general Spigot plugin compatibility core and general use API.
Maven Information
------
* Repository
```xml
<repository>
<id>Songoda</id>
<url>https://repo.songoda.com/repository/public/</url>
</repository>
```
* Artifact Information:
```xml
<dependency>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<version>2.4.38</version>
<scope>provided</scope>
</dependency>
```
Gradle Information
------
* Repository:
```groovy
repositories {
maven {
url 'https://repo.songoda.com/repository/public/'
}
}
```
* Artifact:
```groovy
dependencies {
compileOnly 'com.songoda:SongodaCore:2.4.38'
}
```

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.4.37</version>
<version>2.4.38</version>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>