Skip to content

Commit 7b2f218

Browse files
committed
Added 1.14 support to setting the sellchest title. Eliminated annoying error. Should have fixed NPE when hooks are enabled in config but the plugin isn't loaded.
1 parent 2915a6d commit 7b2f218

22 files changed

Lines changed: 290 additions & 116 deletions

File tree

Abstraction/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>SellChestParent</artifactId>
7+
<groupId>codes.biscuit</groupId>
8+
<version>parent</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>Abstraction</artifactId>
13+
<version>Abstraction</version>
14+
<packaging>jar</packaging>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.spigotmc</groupId>
19+
<artifactId>spigot-api</artifactId>
20+
<version>1.8.8-R0.1-SNAPSHOT</version>
21+
<scope>provided</scope>
22+
</dependency>
23+
</dependencies>
24+
</project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package codes.biscuit.sellchest.hooks;
2+
3+
import org.bukkit.event.player.PlayerInteractEvent;
4+
5+
public interface MinecraftAbstraction {
6+
7+
boolean isCancelled(PlayerInteractEvent e);
8+
}

MC_1_14/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>SellChestParent</artifactId>
7+
<groupId>codes.biscuit</groupId>
8+
<version>parent</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>MC_1_14</artifactId>
13+
<version>MC_1_14</version>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.spigotmc</groupId>
18+
<artifactId>spigot-api</artifactId>
19+
<version>1.14.2-R0.1-SNAPSHOT</version>
20+
<scope>provided</scope>
21+
</dependency>
22+
<dependency>
23+
<artifactId>Abstraction</artifactId>
24+
<groupId>codes.biscuit</groupId>
25+
<version>Abstraction</version>
26+
</dependency>
27+
</dependencies>
28+
29+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package codes.biscuit.sellchest.hooks;
2+
3+
import org.bukkit.event.Event;
4+
import org.bukkit.event.player.PlayerInteractEvent;
5+
6+
public class Minecraft_1_14 implements MinecraftAbstraction {
7+
8+
public boolean isCancelled(PlayerInteractEvent e) {
9+
return e.useItemInHand() == Event.Result.DENY;
10+
}
11+
}

SellChestPlugin/pom.xml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>codes.biscuit</groupId>
8+
<artifactId>SellChestPlugin</artifactId>
9+
<packaging>jar</packaging>
10+
<name>SellChestPlugin</name>
11+
<version>1.1.1-B1</version>
12+
13+
<repositories>
14+
<repository>
15+
<id>spigotmc-repo</id>
16+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
17+
</repository>
18+
<repository>
19+
<id>vault-repo</id>
20+
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
21+
</repository>
22+
<repository>
23+
<id>ess-repo</id>
24+
<url>http://repo.ess3.net/content/groups/essentials</url>
25+
</repository>
26+
<repository>
27+
<id>bintray-tastybento-maven-repo</id>
28+
<name>bintray</name>
29+
<url>http://dl.bintray.com/tastybento/maven-repo</url>
30+
</repository>
31+
</repositories>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>org.spigotmc</groupId>
36+
<artifactId>spigot-api</artifactId>
37+
<version>1.8.8-R0.1-SNAPSHOT</version>
38+
<scope>provided</scope>
39+
</dependency>
40+
<!--<dependency>-->
41+
<!--<groupId>org.spigotmc</groupId>-->
42+
<!--<artifactId>spigot-api</artifactId>-->
43+
<!--<version>1.14.1-R0.1-SNAPSHOT</version>-->
44+
<!--<scope>provided</scope>-->
45+
<!--</dependency>-->
46+
<!--<dependency>-->
47+
<!--<groupId>org.spigotmc</groupId>-->
48+
<!--<artifactId>spigot</artifactId>-->
49+
<!--<version>1.14.1-R0.1-SNAPSHOT</version>-->
50+
<!--<scope>provided</scope>-->
51+
<!--</dependency>-->
52+
<!--<dependency>-->
53+
<!--<groupId>org.spigotmc</groupId>-->
54+
<!--<artifactId>paperspigot</artifactId>-->
55+
<!--<version>1.8.8</version>-->
56+
<!--<scope>provided</scope>-->
57+
<!--</dependency>-->
58+
<dependency>
59+
<groupId>net.milkbowl.vault</groupId>
60+
<artifactId>VaultAPI</artifactId>
61+
<version>1.6</version>
62+
<scope>provided</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>net.brcdev</groupId>
66+
<artifactId>ShopGUIPlus</artifactId>
67+
<version>1.19.0</version>
68+
<scope>provided</scope>
69+
</dependency>
70+
<dependency>
71+
<groupId>net.ess3</groupId>
72+
<artifactId>Essentials</artifactId>
73+
<version>Pre2.14.1.3</version>
74+
<scope>provided</scope>
75+
</dependency>
76+
<dependency>
77+
<groupId>com.massivecraft</groupId>
78+
<artifactId>savage-factions</artifactId>
79+
<version>1.4-BETA-6</version>
80+
<scope>provided</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>com.massivecraft.factions</groupId>
84+
<artifactId>Factions</artifactId>
85+
<version>2.14.0</version>
86+
<scope>provided</scope>
87+
</dependency>
88+
<dependency>
89+
<groupId>com.massivecraft.massivecore</groupId>
90+
<artifactId>MassiveCore</artifactId>
91+
<version>2.14.0</version>
92+
<scope>provided</scope>
93+
</dependency>
94+
<dependency>
95+
<groupId>com.wasteofplastic</groupId>
96+
<artifactId>askyblock</artifactId>
97+
<version>3.0.9.4</version>
98+
<scope>provided</scope>
99+
</dependency>
100+
<dependency>
101+
<groupId>com.plotsquared</groupId>
102+
<artifactId>PlotSquared</artifactId>
103+
<version>19.02.21</version>
104+
<scope>provided</scope>
105+
</dependency>
106+
<dependency>
107+
<artifactId>Abstraction</artifactId>
108+
<groupId>codes.biscuit</groupId>
109+
<version>Abstraction</version>
110+
<scope>compile</scope>
111+
</dependency>
112+
<dependency>
113+
<artifactId>MC_1_14</artifactId>
114+
<groupId>codes.biscuit</groupId>
115+
<version>MC_1_14</version>
116+
<scope>compile</scope>
117+
</dependency>
118+
</dependencies>
119+
120+
<build>
121+
<directory>../target</directory>
122+
<finalName>SellChest-${version}</finalName>
123+
<resources>
124+
<resource>
125+
<targetPath>.</targetPath>
126+
<filtering>true</filtering>
127+
<directory>src/main/resources</directory>
128+
</resource>
129+
</resources>
130+
<plugins>
131+
<plugin>
132+
<groupId>org.apache.maven.plugins</groupId>
133+
<artifactId>maven-compiler-plugin</artifactId>
134+
<version>3.8.0</version>
135+
<configuration>
136+
<source>1.8</source>
137+
<target>1.8</target>
138+
</configuration>
139+
</plugin>
140+
<plugin>
141+
<groupId>org.apache.maven.plugins</groupId>
142+
<artifactId>maven-shade-plugin</artifactId>
143+
<version>3.2.1</version>
144+
<executions>
145+
<execution>
146+
<phase>package</phase>
147+
<goals>
148+
<goal>shade</goal>
149+
</goals>
150+
<configuration>
151+
<filters>
152+
<filter>
153+
<artifact>*:*</artifact>
154+
<excludes>
155+
<exclude>META-INF/**</exclude>
156+
</excludes>
157+
</filter>
158+
</filters>
159+
</configuration>
160+
</execution>
161+
</executions>
162+
</plugin>
163+
</plugins>
164+
</build>
165+
166+
</project>

src/main/java/codes/biscuit/sellchest/SellChest.java renamed to SellChestPlugin/src/main/java/codes/biscuit/sellchest/SellChest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
import org.bukkit.Bukkit;
1010
import org.bukkit.plugin.java.JavaPlugin;
1111

12+
import java.util.regex.Pattern;
13+
1214
public class SellChest extends JavaPlugin {
1315

1416
private ConfigValues configValues;
1517
private Utils utils;
1618
private HookUtils hookUtils;
19+
private int minecraftVersion = -1;
1720

1821
@Override
1922
public void onEnable() {
@@ -26,6 +29,9 @@ public void onEnable() {
2629
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
2730
configValues.setupSellChests();
2831
new MetricsLite(this);
32+
if (minecraftVersion == -1) {
33+
minecraftVersion = Integer.valueOf(Bukkit.getBukkitVersion().split(Pattern.quote("-"))[0].split(Pattern.quote("."))[1]);
34+
}
2935
}
3036

3137
@Override
@@ -45,4 +51,8 @@ public Utils getUtils() {
4551
public HookUtils getHookUtils() {
4652
return hookUtils;
4753
}
54+
55+
public int getMinecraftVersion() {
56+
return minecraftVersion;
57+
}
4858
}

src/main/java/codes/biscuit/sellchest/commands/SellChestCommand.java renamed to SellChestPlugin/src/main/java/codes/biscuit/sellchest/commands/SellChestCommand.java

File renamed without changes.

src/main/java/codes/biscuit/sellchest/hooks/ASkyblockHook.java renamed to SellChestPlugin/src/main/java/codes/biscuit/sellchest/hooks/ASkyblockHook.java

File renamed without changes.

src/main/java/codes/biscuit/sellchest/hooks/EssentialsHook.java renamed to SellChestPlugin/src/main/java/codes/biscuit/sellchest/hooks/EssentialsHook.java

File renamed without changes.

src/main/java/codes/biscuit/sellchest/hooks/FactionsUUIDHook.java renamed to SellChestPlugin/src/main/java/codes/biscuit/sellchest/hooks/FactionsUUIDHook.java

File renamed without changes.

0 commit comments

Comments
 (0)