Skip to content

Commit

Permalink
Merge pull request #6 from BentoBoxWorld/develop
Browse files Browse the repository at this point in the history
Prepare release
  • Loading branch information
BONNe authored May 18, 2022
2 parents 506bf58 + 3fcb9c7 commit d064aba
Show file tree
Hide file tree
Showing 27 changed files with 1,870 additions and 593 deletions.
58 changes: 50 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,31 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java.version>16</java.version>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.15.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.17.1-SNAPSHOT</bentobox.version>
<level.version>1.5.0</level.version>
<!-- SPIGOT API version -->
<spigot.version>1.16.4-R0.1-SNAPSHOT</spigot.version>
<!-- Vault API version -->
<vault.version>1.7</vault.version>

<!-- BentoBox API version -->
<bentobox.version>1.20.0</bentobox.version>
<!-- Warps addon version -->
<warps.version>1.7.0</warps.version>
<!-- Visit addon version -->
<visit.version>1.5.0-SNAPSHOT</visit.version>
<!-- Level addon version -->
<level.version>2.9.0</level.version>
<!-- Likes addon version -->
<likes.version>2.1.1</likes.version>
<!-- Panel Utils version -->
<panelutils.version>1.0.0</panelutils.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<!-- This allows to change between versions and snapshots. -->
<build.version>1.1.0</build.version>
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.0.3</build.version>
</properties>

<!-- Profiles will allow to automatically change build version. -->
Expand Down Expand Up @@ -134,6 +146,12 @@
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>plugin-annotations</artifactId>
<version>1.2.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Mockito (Unit testing) -->
<dependency>
<groupId>org.mockito</groupId>
Expand All @@ -159,6 +177,30 @@
<version>${bentobox.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>level</artifactId>
<version>${level.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>likes</artifactId>
<version>${likes.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>visit</artifactId>
<version>${visit.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>warps</artifactId>
<version>${warps.version}</version>
<scope>provided</scope>
</dependency>
<!-- Static analysis -->
<!-- We are using Eclipse's annotations. If you're using IDEA, update
your project settings to take these into account for in real time static
Expand Down
147 changes: 128 additions & 19 deletions src/main/java/world/bentobox/checkmeout/CheckMeOut.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.configuration.Config;
import world.bentobox.bentobox.util.Util;
import world.bentobox.checkmeout.commands.CMOAdminCommand;
import world.bentobox.checkmeout.commands.CheckMeOutCommand;
import world.bentobox.checkmeout.commands.admin.AdminSubmissionCommand;
import world.bentobox.checkmeout.commands.island.IslandSubmissionCommand;
import world.bentobox.checkmeout.config.Settings;
import world.bentobox.checkmeout.listeners.IslandDeleteListener;
import world.bentobox.checkmeout.managers.SubmissionsManager;
import world.bentobox.level.Level;
import world.bentobox.likes.LikesAddon;
import world.bentobox.visit.VisitAddon;
import world.bentobox.warps.Warp;


/**
* Addon to BentoBox that enables island submissions
Expand All @@ -23,11 +30,6 @@ public class CheckMeOut extends Addon {
// Section: Variables
// ---------------------------------------------------------------------

/**
* Submissions panel Manager
*/
private SubmissionPanelManager submissionsPanelManager;

/**
* Submissions manager.
*/
Expand All @@ -53,6 +55,27 @@ public class CheckMeOut extends Addon {
*/
private Config<Settings> settingsConfig;

/**
* Level addon instance.
*/
private Level levelAddon;

/**
* Likes addon instance.
*/
private LikesAddon likesAddon;

/**
* Visit addon instance.
*/
private VisitAddon visitAddon;

/**
* Warp addon instance.
*/
private Warp warpAddon;


// ---------------------------------------------------------------------
// Section: Methods
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -108,8 +131,8 @@ public void onEnable() {
{
this.registeredWorlds.add(gameModeAddon.getOverWorld());

new CMOAdminCommand(this, gameModeAddon.getAdminCommand().get());
new CheckMeOutCommand(this, gameModeAddon.getPlayerCommand().get());
new AdminSubmissionCommand(this, gameModeAddon.getAdminCommand().get());
new IslandSubmissionCommand(this, gameModeAddon.getPlayerCommand().get());
this.hooked = true;
}
});
Expand All @@ -118,9 +141,8 @@ public void onEnable() {
{
// Start managers
submissionsManager = new SubmissionsManager(this, this.getPlugin());
submissionsPanelManager = new SubmissionPanelManager(this);
// Load the listener

this.registerListener(new IslandDeleteListener(this));
} else {
logWarning("Addon did not hook into any game modes - disabling");
this.setState(State.DISABLED);
Expand All @@ -132,7 +154,56 @@ public void onEnable() {
public void onDisable(){
// Save the submissions
if (submissionsManager != null)
{
submissionsManager.saveSubmissions();
}
}


/**
* Check addon hooks.
*/
public void allLoaded()
{
// Try to find Level addon and if it does not exist, display a warning
this.getAddonByName("Level").ifPresentOrElse(addon ->
{
this.levelAddon = (Level) addon;
this.log("CheckMeOut Addon hooked into Level addon.");
}, () ->
{
this.levelAddon = null;
});

// Try to find Likes addon and if it does not exist, display a warning
this.getAddonByName("Likes").ifPresentOrElse(addon ->
{
this.likesAddon = (LikesAddon) addon;
this.log("CheckMeOut Addon hooked into Likes addon.");
}, () ->
{
this.likesAddon = null;
});

// Try to find Visit addon and if it does not exist, display a warning
this.getAddonByName("Visit").ifPresentOrElse(addon ->
{
this.visitAddon = (VisitAddon) addon;
this.log("CheckMeOut Addon hooked into Visit addon.");
}, () ->
{
this.visitAddon = null;
});

// Try to find Warps addon and if it does not exist, display a warning
this.getAddonByName("Warps").ifPresentOrElse(addon ->
{
this.warpAddon = (Warp) addon;
this.log("CheckMeOut Addon hooked into Warps addon.");
}, () ->
{
this.warpAddon = null;
});
}


Expand All @@ -143,25 +214,21 @@ private void loadSettings() {
if (settingsConfig == null) {
settingsConfig = new Config<>(this, Settings.class);
}

this.settings = settingsConfig.loadConfigObject();

if (this.settings == null) {
// Disable
this.logError("CheckMeOut settings could not load! Addon disabled.");
this.setState(State.DISABLED);
return;
}
settingsConfig.saveConfigObject(settings);
}


/**
* Get submissions panel manager
* @return Submissions Panel Manager
*/
public SubmissionPanelManager getSubmissionsPanelManager() {
return submissionsPanelManager;
this.saveResource("panels/view_panel.yml", false);
}


public SubmissionsManager getSubmissionsManager() {
return submissionsManager;
}
Expand All @@ -187,4 +254,46 @@ public Settings getSettings() {
}


/**
* Gets level addon.
*
* @return the level addon
*/
public Level getLevelAddon()
{
return levelAddon;
}


/**
* Gets likes addon.
*
* @return the likes addon
*/
public LikesAddon getLikesAddon()
{
return likesAddon;
}


/**
* Gets visit addon.
*
* @return the visit addon
*/
public VisitAddon getVisitAddon()
{
return visitAddon;
}


/**
* Gets warp addon.
*
* @return the warp addon
*/
public Warp getWarpAddon()
{
return warpAddon;
}
}
24 changes: 24 additions & 0 deletions src/main/java/world/bentobox/checkmeout/CheckMeOutPladdon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package world.bentobox.checkmeout;

import org.bukkit.plugin.java.annotation.dependency.Dependency;
import org.bukkit.plugin.java.annotation.plugin.ApiVersion;
import org.bukkit.plugin.java.annotation.plugin.Plugin;

import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.Pladdon;


/**
*
* @author BONNe
*/
@Plugin(name="Pladdon", version="1.0")
@ApiVersion(ApiVersion.Target.v1_16)
@Dependency(value = "BentoBox")
public class CheckMeOutPladdon extends Pladdon {

@Override
public Addon getAddon() {
return new CheckMeOut();
}
}
Loading

0 comments on commit d064aba

Please sign in to comment.