Skip to content

Commit 586d4eb

Browse files
author
Lee Zheng Han
committed
Initial commit
0 parents  commit 586d4eb

File tree

80 files changed

+3145
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3145
-0
lines changed

.classpath

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="src" path="target/generated-sources/annotations">
32+
<attributes>
33+
<attribute name="optional" value="true"/>
34+
<attribute name="maven.pomderived" value="true"/>
35+
<attribute name="ignore_optional_problems" value="true"/>
36+
<attribute name="m2e-apt" value="true"/>
37+
</attributes>
38+
</classpathentry>
39+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
40+
<attributes>
41+
<attribute name="optional" value="true"/>
42+
<attribute name="maven.pomderived" value="true"/>
43+
<attribute name="ignore_optional_problems" value="true"/>
44+
<attribute name="m2e-apt" value="true"/>
45+
<attribute name="test" value="true"/>
46+
</attributes>
47+
</classpathentry>
48+
<classpathentry kind="output" path="target/classes"/>
49+
</classpath>

.project

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ColorBundles</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
<filteredResources>
24+
<filter>
25+
<id>1623426112870</id>
26+
<name></name>
27+
<type>30</type>
28+
<matcher>
29+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
30+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31+
</matcher>
32+
</filter>
33+
</filteredResources>
34+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
5+
encoding/<project>=UTF-8
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.apt.aptEnabled=false

.settings/org.eclipse.jdt.core.prefs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.processAnnotations=disabled
8+
org.eclipse.jdt.core.compiler.release=disabled
9+
org.eclipse.jdt.core.compiler.source=1.8

.settings/org.eclipse.m2e.core.prefs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

pom.xml

+202
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
<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/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>solarrabbit</groupId>
4+
<artifactId>ColorBundles</artifactId>
5+
<version>1.0</version>
6+
<properties>
7+
<maven.compiler.source>1.8</maven.compiler.source>
8+
<maven.compiler.target>1.8</maven.compiler.target>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
<junit.version>5.6.0</junit.version>
11+
<maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
12+
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
13+
<checkstyle.version>8.29</checkstyle.version>
14+
<checkstyle-rules.version>4.0.1</checkstyle-rules.version>
15+
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
16+
<jacoco-maven-plugin.version>0.8.6</jacoco-maven-plugin.version>
17+
<maven-javadoc-plugin.version>3.0.0</maven-javadoc-plugin.version>
18+
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
19+
<!-- JaCoCo thresholds. Increase gradually as you add tests. -->
20+
<jacoco.unit-tests.limit.instruction-ratio>0%</jacoco.unit-tests.limit.instruction-ratio>
21+
<jacoco.unit-tests.limit.branch-ratio>0%</jacoco.unit-tests.limit.branch-ratio>
22+
<jacoco.unit-tests.limit.class-complexity>20</jacoco.unit-tests.limit.class-complexity>
23+
<jacoco.unit-tests.limit.method-complexity>5</jacoco.unit-tests.limit.method-complexity>
24+
</properties>
25+
<repositories>
26+
<repository>
27+
<id>spigot-repo</id>
28+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
29+
</repository>
30+
</repositories>
31+
<dependencies>
32+
<dependency>
33+
<groupId>org.spigotmc</groupId>
34+
<artifactId>spigot-api</artifactId>
35+
<version>1.17-R0.1-SNAPSHOT</version>
36+
<scope>provided</scope>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.junit.jupiter</groupId>
40+
<artifactId>junit-jupiter-api</artifactId>
41+
<version>${junit.version}</version>
42+
<scope>test</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.junit.jupiter</groupId>
46+
<artifactId>junit-jupiter-engine</artifactId>
47+
<version>${junit.version}</version>
48+
<scope>test</scope>
49+
</dependency>
50+
</dependencies>
51+
<build>
52+
<finalName>${project.name}</finalName>
53+
<plugins>
54+
<plugin>
55+
<groupId>org.apache.maven.plugins</groupId>
56+
<artifactId>maven-enforcer-plugin</artifactId>
57+
<version>${maven-enforcer-plugin.version}</version>
58+
<executions>
59+
<execution>
60+
<goals>
61+
<goal>enforce</goal>
62+
</goals>
63+
<configuration>
64+
<rules>
65+
<requireMavenVersion>
66+
<version>3.6.3</version>
67+
</requireMavenVersion>
68+
</rules>
69+
<fail>true</fail>
70+
</configuration>
71+
</execution>
72+
</executions>
73+
</plugin>
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-surefire-plugin</artifactId>
77+
<version>${maven-surefire-plugin.version}</version>
78+
</plugin>
79+
<plugin>
80+
<groupId>org.jacoco</groupId>
81+
<artifactId>jacoco-maven-plugin</artifactId>
82+
<version>${jacoco-maven-plugin.version}</version>
83+
<executions>
84+
<execution>
85+
<id>pre-unit-test</id>
86+
<goals>
87+
<goal>prepare-agent</goal>
88+
</goals>
89+
</execution>
90+
<execution>
91+
<id>post-unit-test</id>
92+
<phase>test</phase>
93+
<goals>
94+
<goal>report</goal>
95+
</goals>
96+
</execution>
97+
<execution>
98+
<id>check-unit-test</id>
99+
<phase>test</phase>
100+
<goals>
101+
<goal>check</goal>
102+
</goals>
103+
<configuration>
104+
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
105+
<rules>
106+
<rule>
107+
<element>BUNDLE</element>
108+
<limits>
109+
<limit>
110+
<counter>INSTRUCTION</counter>
111+
<value>COVEREDRATIO</value>
112+
<minimum>${jacoco.unit-tests.limit.instruction-ratio}</minimum>
113+
</limit>
114+
<limit>
115+
<counter>BRANCH</counter>
116+
<value>COVEREDRATIO</value>
117+
<minimum>${jacoco.unit-tests.limit.branch-ratio}</minimum>
118+
</limit>
119+
</limits>
120+
</rule>
121+
<rule>
122+
<element>CLASS</element>
123+
<limits>
124+
<limit>
125+
<counter>COMPLEXITY</counter>
126+
<value>TOTALCOUNT</value>
127+
<maximum>${jacoco.unit-tests.limit.class-complexity}</maximum>
128+
</limit>
129+
</limits>
130+
</rule>
131+
<rule>
132+
<element>METHOD</element>
133+
<limits>
134+
<limit>
135+
<counter>COMPLEXITY</counter>
136+
<value>TOTALCOUNT</value>
137+
<maximum>${jacoco.unit-tests.limit.method-complexity}</maximum>
138+
</limit>
139+
</limits>
140+
</rule>
141+
</rules>
142+
</configuration>
143+
</execution>
144+
</executions>
145+
</plugin>
146+
</plugins>
147+
<resources>
148+
<resource>
149+
<directory>${project.basedir}/src/main/resources</directory>
150+
<filtering>true</filtering>
151+
<includes>
152+
<include>plugin.yml</include>
153+
<include>config.yml</include>
154+
</includes>
155+
</resource>
156+
</resources>
157+
</build>
158+
<reporting>
159+
<plugins>
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-javadoc-plugin</artifactId>
163+
<version>${maven-javadoc-plugin.version}</version>
164+
</plugin>
165+
</plugins>
166+
</reporting>
167+
<profiles>
168+
<!-- Publish coverage report to Coveralls, only when running in Travis. -->
169+
<profile>
170+
<id>travis</id>
171+
<activation>
172+
<property>
173+
<name>env.TRAVIS</name>
174+
</property>
175+
</activation>
176+
<build>
177+
<plugins>
178+
<plugin>
179+
<groupId>org.eluder.coveralls</groupId>
180+
<artifactId>coveralls-maven-plugin</artifactId>
181+
<version>${coveralls-maven-plugin.version}</version>
182+
</plugin>
183+
</plugins>
184+
</build>
185+
</profile>
186+
<profile>
187+
<id>conf</id>
188+
<build>
189+
<plugins>
190+
<plugin>
191+
<groupId>org.apache.maven.plugins</groupId>
192+
<artifactId>maven-jar-plugin</artifactId>
193+
<version>2.4</version>
194+
<configuration>
195+
<outputDirectory>${project.basedir}/../test_servers</outputDirectory>
196+
</configuration>
197+
</plugin>
198+
</plugins>
199+
</build>
200+
</profile>
201+
</profiles>
202+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package com.paratopiamc.colorbundles;
2+
3+
import org.bukkit.Bukkit;
4+
import org.bukkit.Material;
5+
import org.bukkit.NamespacedKey;
6+
import org.bukkit.inventory.ItemStack;
7+
import org.bukkit.inventory.ShapedRecipe;
8+
import org.bukkit.inventory.meta.ItemMeta;
9+
import org.bukkit.plugin.java.JavaPlugin;
10+
import net.md_5.bungee.api.ChatColor;
11+
12+
public final class ColorBundles extends JavaPlugin {
13+
private static enum Dyes {
14+
BLACK("black"), BLUE("blue"), BROWN("brown"), CYAN("cyan"), GRAY("gray"), GREEN("green"),
15+
LIGHT_BLUE("light_blue"), LIGHT_GRAY("light_gray"), LIME("lime"), MAGENTA("magenta"), ORANGE("orange"),
16+
PINK("pink"), PURPLE("purple"), RED("red"), WHITE("white"), YELLOW("yellow");
17+
18+
private Material dye;
19+
private String name;
20+
21+
Dyes(String name) {
22+
this.dye = Material.matchMaterial(name.toUpperCase() + "_DYE");
23+
this.name = name;
24+
}
25+
26+
@Override
27+
public String toString() {
28+
return this.name;
29+
}
30+
31+
private Material getDye() {
32+
return this.dye;
33+
}
34+
}
35+
36+
@Override
37+
public void onEnable() {
38+
if (!this.getDataFolder().exists()) {
39+
try {
40+
this.getDataFolder().mkdir();
41+
} catch (Exception e) {
42+
e.printStackTrace();
43+
}
44+
}
45+
saveDefaultConfig();
46+
47+
for (Dyes dye : Dyes.values()) {
48+
ItemStack item = new ItemStack(Material.BUNDLE);
49+
ItemMeta meta = item.getItemMeta();
50+
51+
int modelData = getConfig().getInt(dye.toString());
52+
meta.setCustomModelData(modelData);
53+
54+
item.setItemMeta(meta);
55+
NamespacedKey key = new NamespacedKey(this, dye + "_bundle");
56+
ShapedRecipe recipe = new ShapedRecipe(key, item);
57+
58+
recipe.shape("BD");
59+
recipe.setIngredient('B', Material.BUNDLE);
60+
recipe.setIngredient('D', dye.getDye());
61+
62+
Bukkit.addRecipe(recipe);
63+
64+
getServer().getConsoleSender()
65+
.sendMessage(ChatColor.GREEN + "[ColorBundles] Loaded recipes: " + dye + "_bundle");
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)