mirror of
https://github.com/JamesPeters98/ChestsPlusPlus.git
synced 2025-01-25 09:41:32 +01:00
API Specific Implementations
This commit is contained in:
parent
73c51d81da
commit
c90abd1688
40
ChestsPlusPlus_1_15/ChestsPlusPlus_1_15.iml
Normal file
40
ChestsPlusPlus_1_15/ChestsPlusPlus_1_15.iml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="ChestsPlusPlus" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.15-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.spigotmc:plugin-annotations:1.2.3-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: fr.minuskube.inv:smart-invs:1.3.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" />
|
||||
<orderEntry type="module" module-name="ChestsPlusPlus_1_16" />
|
||||
</component>
|
||||
</module>
|
39
ChestsPlusPlus_1_15/pom.xml
Normal file
39
ChestsPlusPlus_1_15/pom.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?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>ChestsPlusPlus</artifactId>
|
||||
<groupId>com.jamesdpeters.chests</groupId>
|
||||
<version>1.5-BETA-3</version>
|
||||
<relativePath>../ChestsPlusPlus_Main/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>ChestsPlusPlus_1_15</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jamesdpeters.chests</groupId>
|
||||
<artifactId>ChestsPlusPlus</artifactId>
|
||||
<version>1.5-BETA-3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,26 @@
|
||||
package com.jamesdpeters.minecraft.chests;
|
||||
|
||||
import com.jamesdpeters.minecraft.chests.api_interfaces.MaterialChecker;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MaterialChecker_1_15 extends MaterialChecker {
|
||||
|
||||
private List<Material> materials;
|
||||
|
||||
MaterialChecker_1_15(){
|
||||
materials = new ArrayList<>();
|
||||
materials.addAll(DEFAULT_ITEMS);
|
||||
materials.addAll(Arrays.asList(
|
||||
// Material.DIRT
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Material> graphically2DList() {
|
||||
return materials;
|
||||
}
|
||||
}
|
41
ChestsPlusPlus_1_16/ChestsPlusPlus_1_16.iml
Normal file
41
ChestsPlusPlus_1_16/ChestsPlusPlus_1_16.iml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="ChestsPlusPlus_1_16 (1)" />
|
||||
<orderEntry type="module" module-name="ChestsPlusPlus" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.spigotmc:plugin-annotations:1.2.3-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: fr.minuskube.inv:smart-invs:1.3.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" />
|
||||
<orderEntry type="module" module-name="ChestsPlusPlus_1_15" />
|
||||
</component>
|
||||
</module>
|
40
ChestsPlusPlus_1_16/pom.xml
Normal file
40
ChestsPlusPlus_1_16/pom.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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>ChestsPlusPlus</artifactId>
|
||||
<groupId>com.jamesdpeters.chests</groupId>
|
||||
<version>1.5-BETA-3</version>
|
||||
<relativePath>../ChestsPlusPlus_Main/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>ChestsPlusPlus_1_16</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jamesdpeters.chests</groupId>
|
||||
<artifactId>ChestsPlusPlus</artifactId>
|
||||
<version>1.5-BETA-3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,29 @@
|
||||
package com.jamesdpeters.minecraft.chests;
|
||||
|
||||
import com.jamesdpeters.minecraft.chests.api_interfaces.MaterialChecker;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MaterialChecker_1_16 extends MaterialChecker {
|
||||
|
||||
private List<Material> materials;
|
||||
|
||||
MaterialChecker_1_16(){
|
||||
materials = new ArrayList<>();
|
||||
materials.addAll(DEFAULT_ITEMS);
|
||||
//Add previous API additions.
|
||||
materials.addAll(new MaterialChecker_1_15().graphically2DList());
|
||||
materials.addAll(Arrays.asList(
|
||||
// Material.DIRT
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Material> graphically2DList() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
}
|
@ -86,6 +86,20 @@
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jamesdpeters.chests</groupId>
|
||||
<artifactId>ChestsPlusPlus_1_16</artifactId>
|
||||
<version>1.5-BETA-3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jamesdpeters.chests</groupId>
|
||||
<artifactId>ChestsPlusPlus_1_15</artifactId>
|
||||
<version>1.5-BETA-3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!--Tell maven how to prepare and build our jar file from our source and dependancies-->
|
||||
@ -158,11 +172,6 @@
|
||||
<version>3.0.0-M1</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<!--Tell maven to enable resource filtering so we can use macros like '${project.version}' inside of our plugin.yml-->
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.jamesdpeters.minecraft.chests.api_interfaces;
|
||||
|
||||
import com.jamesdpeters.minecraft.chests.MaterialChecker_1_15;
|
||||
import com.jamesdpeters.minecraft.chests.MaterialChecker_1_16;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class APISpecific {
|
||||
|
||||
private static MaterialChecker materialChecker;
|
||||
private static Version version;
|
||||
|
||||
static {
|
||||
version = getVersion();
|
||||
}
|
||||
|
||||
enum Version {
|
||||
API_1_16,
|
||||
API_1_15,
|
||||
API_1_14;
|
||||
}
|
||||
|
||||
private static Version getVersion(){
|
||||
String version = Bukkit.getBukkitVersion().split("-")[0];
|
||||
switch (version){
|
||||
//Assume default API is latest.
|
||||
default: return Version.API_1_16;
|
||||
case "1.15": return Version.API_1_15;
|
||||
case "1.14": return Version.API_1_14;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private MaterialChecker getMaterialChecker(Version version){
|
||||
switch (version){
|
||||
case API_1_16: return new MaterialChecker_1_16();
|
||||
case API_1_15: return new MaterialChecker_1_15();
|
||||
default: return MaterialChecker.DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.jamesdpeters.minecraft.chests.api_interfaces;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class MaterialChecker {
|
||||
|
||||
public static List<Material> DEFAULT_ITEMS = Arrays.asList(
|
||||
//Signs
|
||||
Material.ACACIA_SIGN,
|
||||
Material.ACACIA_WALL_SIGN,
|
||||
Material.BIRCH_SIGN,
|
||||
Material.BIRCH_WALL_SIGN,
|
||||
Material.DARK_OAK_SIGN,
|
||||
Material.DARK_OAK_WALL_SIGN,
|
||||
Material.JUNGLE_SIGN,
|
||||
Material.JUNGLE_WALL_SIGN,
|
||||
Material.OAK_SIGN,
|
||||
Material.OAK_WALL_SIGN,
|
||||
Material.SPRUCE_SIGN,
|
||||
Material.SPRUCE_WALL_SIGN,
|
||||
//Doors
|
||||
Material.ACACIA_DOOR,
|
||||
Material.BIRCH_DOOR,
|
||||
Material.DARK_OAK_DOOR,
|
||||
Material.JUNGLE_DOOR,
|
||||
Material.OAK_DOOR,
|
||||
Material.SPRUCE_DOOR,
|
||||
Material.IRON_DOOR,
|
||||
//Saplings
|
||||
Material.SPRUCE_SAPLING,
|
||||
Material.ACACIA_SAPLING,
|
||||
Material.BAMBOO_SAPLING,
|
||||
Material.BIRCH_SAPLING,
|
||||
Material.DARK_OAK_SAPLING,
|
||||
Material.JUNGLE_SAPLING,
|
||||
Material.OAK_SAPLING
|
||||
);
|
||||
|
||||
public static MaterialChecker DEFAULT = new MaterialChecker() {
|
||||
@Override
|
||||
protected List<Material> graphically2DList() {
|
||||
return DEFAULT_ITEMS;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* API-Specific implementation for materials checks.
|
||||
* Should return a list of materials where the texture for this item is displayed as 2D rather than a 3D model.
|
||||
* @return
|
||||
* List of Materials.
|
||||
*/
|
||||
protected abstract List<Material> graphically2DList();
|
||||
|
||||
/**
|
||||
* Used to test if an item is graphically a block (e.g a sign is a block but is held like an item.)
|
||||
* @param itemStack
|
||||
* @return
|
||||
*/
|
||||
public boolean isGraphically2D(ItemStack itemStack){
|
||||
return graphically2DList().contains(itemStack.getType());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user