Initial commit
This commit is contained in:
commit
fcdd59efe3
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Project exclude paths
|
||||||
|
/target/
|
2
.idea/.gitignore
vendored
Normal file
2
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/workspace.xml
|
2
.idea/GreifPreventionQuickShopBridge.iml
Normal file
2
.idea/GreifPreventionQuickShopBridge.iml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4" />
|
14
.idea/compiler.xml
Normal file
14
.idea/compiler.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="GriefPreventionQuickShopBridge" />
|
||||||
|
<module name="GreifPreventionQuickShopBridge" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/encodings.xml
Normal file
8
.idea/encodings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
18
.idea/misc.xml
Normal file
18
.idea/misc.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<pattern value="com.github.judgetread.GriefPreventionQuickShopBridge.GriefPreventionQuickShopBridge" />
|
||||||
|
<pattern value="com.github.judgetread.GriefPreventionQuickShopBridge.GriefPreventionQuickShopBridge" method="reload" />
|
||||||
|
</component>
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
2
GriefPreventionQuickShopBridge.iml
Normal file
2
GriefPreventionQuickShopBridge.iml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4" />
|
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# GriefPreventionQuickShopBridge
|
||||||
|
|
||||||
|
#####A Simple Addon that intergrates GriefPrevention claims in the plugin QuickShop.
|
||||||
|
|
||||||
|
* Only allow QuickShop shop's to be created inside of grief prevention claims by the owner of the claim.
|
||||||
|
* Prevents QuickShop shop's from being created outside of grief prevention claims.
|
||||||
|
* Deletes QuickShop shop's when a grief prevention claim is deleted/removed or expires.
|
||||||
|
* By default, allows op to create QuickShop shop's anywhere.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
lib/QuickShop-Reremake.2.4.9.jar
Normal file
BIN
lib/QuickShop-Reremake.2.4.9.jar
Normal file
Binary file not shown.
151
pom.xml
Normal file
151
pom.xml
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.github.judgetread</groupId>
|
||||||
|
<artifactId>GriefPreventionQuickShopBridge</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>GPL v3 License</name>
|
||||||
|
<url>http://www.gnu.org/licenses/</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
<properties>
|
||||||
|
<package>com.github.judgetread.GriefPreventionQuickShopBridge</package>
|
||||||
|
<developer>Judgetread</developer>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<issueManagement>
|
||||||
|
<url>https://github.com/${developer}/${name}/issues</url>
|
||||||
|
<system>GitHub Issues</system>
|
||||||
|
</issueManagement>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<url>https://github.com/${developer}/${project.version}</url>
|
||||||
|
<connection>scm:git:git://github.com/${developer}/${project.version}.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:${developer}/${project.version}.git</developerConnection>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<!--Use this comments args when compiler is NullPointerException-->
|
||||||
|
<!--<forceJavacCompilerUse>true</forceJavacCompilerUse>-->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<!--<aggregate>true</aggregate>
|
||||||
|
<charmvnset>UTF-8</charmvnset>
|
||||||
|
<docencoding>UTF-8</docencoding>-->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<failOnError>false</failOnError>
|
||||||
|
<!--<additionalparam>-Xdoclint:none</additionalparam>-->
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>vault-repo</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.15-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.MilkBowl</groupId>
|
||||||
|
<artifactId>VaultAPI</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.10</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>18.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TechFortress</groupId>
|
||||||
|
<artifactId>GriefPrevention</artifactId>
|
||||||
|
<version>16.7.1</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.maxgamer</groupId>
|
||||||
|
<artifactId>QuickShop</artifactId>
|
||||||
|
<version>Reremake 2.4.9.1</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/lib/QuickShop-Reremake.2.4.9.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,145 @@
|
|||||||
|
package com.github.judgetread.GriefPreventionQuickShopBridge;
|
||||||
|
|
||||||
|
import com.github.judgetread.GriefPreventionQuickShopBridge.listeners.GriefPreventionListener;
|
||||||
|
import com.github.judgetread.GriefPreventionQuickShopBridge.listeners.QuickShopListener;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.experimental.FieldDefaults;
|
||||||
|
import lombok.experimental.NonFinal;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PUBLIC)
|
||||||
|
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
||||||
|
public class GriefPreventionQuickShopBridge extends JavaPlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The active instance of GriefPreventionQuickShopBridge
|
||||||
|
*/
|
||||||
|
private static GriefPreventionQuickShopBridge instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin GriefPrevention(null if not present)
|
||||||
|
*/
|
||||||
|
@Getter(AccessLevel.PUBLIC)
|
||||||
|
@Nullable
|
||||||
|
@NonFinal
|
||||||
|
private Plugin griefPrevention;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin QuickShop(null if not present)
|
||||||
|
*/
|
||||||
|
@Getter(AccessLevel.PUBLIC)
|
||||||
|
@Nullable
|
||||||
|
@NonFinal
|
||||||
|
private Plugin quickShop;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onLoad
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onEnable
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
Instant start = Instant.now();
|
||||||
|
saveDefaultConfig();
|
||||||
|
reloadConfig();
|
||||||
|
startup();
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Loaded! " + Duration.between(Instant.now(), start).toMillis() + "ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload this plugin.
|
||||||
|
*/
|
||||||
|
private void reload() {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Reloading " + getName());
|
||||||
|
unregisterListeners();
|
||||||
|
unloadHooks();
|
||||||
|
reloadConfig();
|
||||||
|
startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Startup procedures.
|
||||||
|
*/
|
||||||
|
private void startup() {
|
||||||
|
loadHooks();
|
||||||
|
registerListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register Listeners.
|
||||||
|
*/
|
||||||
|
private void registerListeners() {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Registering Listeners...");
|
||||||
|
Bukkit.getPluginManager().registerEvents(new GriefPreventionListener(this), this);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new QuickShopListener(this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister Listeners.
|
||||||
|
*/
|
||||||
|
private void unregisterListeners() {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Unregistering Listeners...");
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload config
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("EmptyMethod")
|
||||||
|
@Override
|
||||||
|
public void reloadConfig() {
|
||||||
|
super.reloadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load hooks.
|
||||||
|
*/
|
||||||
|
private void loadHooks() {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Loading Hooks...");
|
||||||
|
griefPrevention = hookPlugin(this.getName() + " GriefPrevention");
|
||||||
|
quickShop = hookPlugin(this.getName() + " QuickShop");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unload hooks
|
||||||
|
*/
|
||||||
|
private void unloadHooks() {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Unloading Hooks...");
|
||||||
|
this.griefPrevention = null;
|
||||||
|
this.quickShop = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plugin from plugin manager with the
|
||||||
|
* given name.
|
||||||
|
* <p>
|
||||||
|
* Returns null, if none found.
|
||||||
|
*
|
||||||
|
* @param pluginName String name of the plugin.
|
||||||
|
* @return Plugin
|
||||||
|
*/
|
||||||
|
private @Nullable Plugin hookPlugin(@NotNull @NonNull String pluginName) {
|
||||||
|
@Nullable Plugin thirdPlugin = Bukkit.getPluginManager().getPlugin(pluginName);
|
||||||
|
if (thirdPlugin != null) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(" Hooked: " + pluginName);
|
||||||
|
}
|
||||||
|
return thirdPlugin;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.github.judgetread.GriefPreventionQuickShopBridge.listeners;
|
||||||
|
|
||||||
|
import com.github.judgetread.GriefPreventionQuickShopBridge.GriefPreventionQuickShopBridge;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import me.ryanhamshire.GriefPrevention.Claim;
|
||||||
|
import me.ryanhamshire.GriefPrevention.events.ClaimDeletedEvent;
|
||||||
|
import me.ryanhamshire.GriefPrevention.events.ClaimExpirationEvent;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.maxgamer.quickshop.Event.ShopPreCreateEvent;
|
||||||
|
import org.maxgamer.quickshop.QuickShop;
|
||||||
|
import org.maxgamer.quickshop.Shop.ContainerShop;
|
||||||
|
import org.maxgamer.quickshop.Shop.Shop;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GriefPreventionListener implements Listener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance of GriefPreventionQuickShopBridge
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
private final GriefPreventionQuickShopBridge plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GriefPrevention Claim Delete Event
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onClaimDeleteEvent(ClaimDeletedEvent event) {
|
||||||
|
if(plugin.getConfig().getBoolean("delete-shops-when-claims-deleted", true)) {
|
||||||
|
deleteAllShopsInClaim(event.getClaim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GriefPrevention Claim Expire Event
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onClaimExpireEvent(ClaimExpirationEvent event) {
|
||||||
|
if(plugin.getConfig().getBoolean("delete-shops-when-claims-expires", true)) {
|
||||||
|
deleteAllShopsInClaim(event.getClaim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete any shop found inside the claim.
|
||||||
|
*
|
||||||
|
* @param claim A GriefPrevention claim
|
||||||
|
*/
|
||||||
|
private void deleteAllShopsInClaim(final Claim claim) {
|
||||||
|
Iterator<Shop> bIt = ((QuickShop) plugin.getQuickShop()).getShopManager().getShopIterator();
|
||||||
|
|
||||||
|
if (bIt == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Location loc = bIt.next().getLocation();
|
||||||
|
|
||||||
|
if (loc == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (claim.contains(loc, false, false)) {
|
||||||
|
final ContainerShop shop = (ContainerShop) ((QuickShop) plugin.getQuickShop()).getShopManager().getShop(loc);
|
||||||
|
|
||||||
|
if (shop == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try force saving of chunk ???
|
||||||
|
loc.getChunk().addPluginChunkTicket(plugin);
|
||||||
|
shop.delete(false);
|
||||||
|
loc.getChunk().removePluginChunkTicket(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.github.judgetread.GriefPreventionQuickShopBridge.listeners;
|
||||||
|
|
||||||
|
import com.github.judgetread.GriefPreventionQuickShopBridge.GriefPreventionQuickShopBridge;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import me.ryanhamshire.GriefPrevention.Claim;
|
||||||
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.maxgamer.quickshop.Event.ShopPreCreateEvent;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public final class QuickShopListener implements Listener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance of GriefPreventionQuickShopBridge
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
private final GriefPreventionQuickShopBridge plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QuickShop Remake ShopPreCreateEvent.
|
||||||
|
*
|
||||||
|
* <P>
|
||||||
|
* Check the location of when the shop is goinf to be placed,
|
||||||
|
* and if the shops location is not inside a claim cancel the shop creation.
|
||||||
|
*
|
||||||
|
* If the shops location is inside a claim, check that the player making the
|
||||||
|
* shop is the same player that owns the claim, if not cancel the shop creation.
|
||||||
|
* </P>
|
||||||
|
*
|
||||||
|
* @param event QuickShop ShopPreCreateEvent
|
||||||
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public final void onPreShopEvent(@NonNull ShopPreCreateEvent event) {
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Location location = event.getLocation();
|
||||||
|
final Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, false, null);
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if(plugin.getConfig().getBoolean("op-bypass-claim-checks", true) && player.isOp()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(claim == null){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(plugin.getConfig().getBoolean("only-claim-owner-can-create-shops", true) && !claim.ownerID.toString().equals(player.getUniqueId().toString())){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
src/main/resources/config.yml
Normal file
12
src/main/resources/config.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Only allow shops to be created in claims that player is owner of.
|
||||||
|
# --> If false anyone can create a shop in the any claim.
|
||||||
|
only-claim-owner-can-create-shops: true
|
||||||
|
|
||||||
|
# Ignore claim checks if player is op, allows op to create shop anywhere.
|
||||||
|
op-bypass-claim-checks: true
|
||||||
|
|
||||||
|
# Delete shops inside a claim if that claim is deleted/removed
|
||||||
|
delete-shops-when-claims-deleted: true
|
||||||
|
|
||||||
|
# Delete shops inside a claim if that claim expires
|
||||||
|
delete-shops-when-claims-expires: true
|
9
src/main/resources/plugin.yml
Normal file
9
src/main/resources/plugin.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
name: ${name}
|
||||||
|
main: ${package}.${name}
|
||||||
|
version: ${project.version}
|
||||||
|
authors: [Judgetread]
|
||||||
|
|
||||||
|
description: QuickShop Reremake GriefPrevtion Bridge
|
||||||
|
softdepend: [GriefPrevention, QuickShop]
|
||||||
|
|
||||||
|
api-version: 1.13
|
Loading…
Reference in New Issue
Block a user