Skip to content

Commit 74019de

Browse files
committed
build(Plugin) -> Initial commit
feat(PlaceholderAPI) -> Added PlaceholderAPI Support
0 parents  commit 74019de

11 files changed

Lines changed: 600 additions & 0 deletions

File tree

.gitignore

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
11+
# Compiled class file
12+
*.class
13+
14+
# Log file
15+
*.log
16+
17+
# BlueJ files
18+
*.ctxt
19+
20+
# Package Files #
21+
*.jar
22+
*.war
23+
*.nar
24+
*.ear
25+
*.zip
26+
*.tar.gz
27+
*.rar
28+
29+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
30+
hs_err_pid*
31+
32+
*~
33+
34+
# temporary files which can be created if a process still has a handle open of a deleted file
35+
.fuse_hidden*
36+
37+
# KDE directory preferences
38+
.directory
39+
40+
# Linux trash folder which might appear on any partition or disk
41+
.Trash-*
42+
43+
# .nfs files are created when an open file is removed but is still being accessed
44+
.nfs*
45+
46+
# General
47+
.DS_Store
48+
.AppleDouble
49+
.LSOverride
50+
51+
# Icon must end with two \r
52+
Icon
53+
54+
# Thumbnails
55+
._*
56+
57+
# Files that might appear in the root of a volume
58+
.DocumentRevisions-V100
59+
.fseventsd
60+
.Spotlight-V100
61+
.TemporaryItems
62+
.Trashes
63+
.VolumeIcon.icns
64+
.com.apple.timemachine.donotpresent
65+
66+
# Directories potentially created on remote AFP share
67+
.AppleDB
68+
.AppleDesktop
69+
Network Trash Folder
70+
Temporary Items
71+
.apdisk
72+
73+
# Windows thumbnail cache files
74+
Thumbs.db
75+
Thumbs.db:encryptable
76+
ehthumbs.db
77+
ehthumbs_vista.db
78+
79+
# Dump file
80+
*.stackdump
81+
82+
# Folder config file
83+
[Dd]esktop.ini
84+
85+
# Recycle Bin used on file shares
86+
$RECYCLE.BIN/
87+
88+
# Windows Installer files
89+
*.cab
90+
*.msi
91+
*.msix
92+
*.msm
93+
*.msp
94+
95+
# Windows shortcuts
96+
*.lnk
97+
98+
target/
99+
100+
pom.xml.tag
101+
pom.xml.releaseBackup
102+
pom.xml.versionsBackup
103+
pom.xml.next
104+
105+
release.properties
106+
dependency-reduced-pom.xml
107+
buildNumber.properties
108+
.mvn/timing.properties
109+
.mvn/wrapper/maven-wrapper.jar
110+
.flattened-pom.xml
111+
112+
# Common working directory
113+
run/

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# MyCustomCommands
2+
3+
___
4+
5+
* Create custom commands so fast and without problems!
6+
* Support from 1.8.X to 1.19.X and future versions
7+
* Reload command (/MyCustomCommands) (permission: mycustomcommands.reload)
8+
9+
---

pom.xml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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>dev.justjustin.socialmedialinks</groupId>
8+
<artifactId>MyCustomCommands</artifactId>
9+
<version>0.1</version>
10+
<packaging>jar</packaging>
11+
12+
<name>MyCustomCommands</name>
13+
14+
<description>Show your social medias using specified commands</description>
15+
<properties>
16+
<java.version>1.8</java.version>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
</properties>
19+
20+
<build>
21+
<plugins>
22+
<plugin>
23+
<groupId>org.apache.maven.plugins</groupId>
24+
<artifactId>maven-compiler-plugin</artifactId>
25+
<version>3.8.1</version>
26+
<configuration>
27+
<source>${java.version}</source>
28+
<target>${java.version}</target>
29+
</configuration>
30+
</plugin>
31+
<plugin>
32+
<groupId>org.apache.maven.plugins</groupId>
33+
<artifactId>maven-shade-plugin</artifactId>
34+
<version>3.2.4</version>
35+
<executions>
36+
<execution>
37+
<phase>package</phase>
38+
<goals>
39+
<goal>shade</goal>
40+
</goals>
41+
<configuration>
42+
<createDependencyReducedPom>false</createDependencyReducedPom>
43+
</configuration>
44+
</execution>
45+
</executions>
46+
</plugin>
47+
</plugins>
48+
<resources>
49+
<resource>
50+
<directory>src/main/resources</directory>
51+
<filtering>true</filtering>
52+
</resource>
53+
</resources>
54+
</build>
55+
56+
<repositories>
57+
<repository>
58+
<id>spigotmc-repo</id>
59+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
60+
</repository>
61+
<repository>
62+
<id>jitpack.io</id>
63+
<url>https://jitpack.io</url>
64+
</repository>
65+
<repository>
66+
<id>sonatype</id>
67+
<url>https://oss.sonatype.org/content/groups/public/</url>
68+
</repository>
69+
<!-- PlaceholderAPI Repo -->
70+
<repository>
71+
<id>placeholderapi</id>
72+
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
73+
</repository>
74+
</repositories>
75+
76+
<dependencies>
77+
<dependency>
78+
<groupId>org.spigotmc</groupId>
79+
<artifactId>spigot-api</artifactId>
80+
<version>1.16.5-R0.1-SNAPSHOT</version>
81+
<scope>provided</scope>
82+
</dependency>
83+
<!-- SLIME LIB FROM MrUniverse -->
84+
<dependency>
85+
<groupId>com.github.MrUniverse44</groupId>
86+
<artifactId>SlimeLIB</artifactId>
87+
<version>1.0.8</version>
88+
<scope>compile</scope>
89+
</dependency>
90+
<!-- PLACEHOLDERS -->
91+
<dependency>
92+
<groupId>me.clip</groupId>
93+
<artifactId>placeholderapi</artifactId>
94+
<version>2.10.9</version>
95+
<scope>provided</scope>
96+
</dependency>
97+
</dependencies>
98+
</project>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package dev.justjustin.mycustomcommands;
2+
3+
import dev.justjustin.mycustomcommands.commands.PluginCommand;
4+
import dev.justjustin.mycustomcommands.commands.CustomCommand;
5+
import dev.justjustin.mycustomcommands.utils.PluginUtils;
6+
import dev.mruniverse.slimelib.SlimePlugin;
7+
import dev.mruniverse.slimelib.SlimePluginInformation;
8+
import dev.mruniverse.slimelib.loader.BaseSlimeLoader;
9+
import dev.mruniverse.slimelib.loader.DefaultSlimeLoader;
10+
import dev.mruniverse.slimelib.logs.SlimeLogger;
11+
import dev.mruniverse.slimelib.logs.SlimeLogs;
12+
import org.bukkit.plugin.java.JavaPlugin;
13+
14+
import java.util.ArrayList;
15+
import java.util.List;
16+
17+
public final class MyCustomCommands extends JavaPlugin implements SlimePlugin<JavaPlugin> {
18+
19+
private final SlimePluginInformation information = new SlimePluginInformation(
20+
getServerType(),
21+
this
22+
);
23+
24+
private final DefaultSlimeLoader<JavaPlugin> loader = new DefaultSlimeLoader<>(
25+
this
26+
);
27+
28+
private final List<CustomCommand> commandList = new ArrayList<>();
29+
30+
private final SlimeLogs logs = SlimeLogger.createLogs(
31+
getServerType(),
32+
this
33+
);
34+
35+
private boolean hasPAPI;
36+
37+
@Override
38+
public void onEnable() {
39+
PluginUtils.setupLogger(
40+
logs
41+
);
42+
43+
loader.setFiles(SlimeFile.class);
44+
45+
loader.init();
46+
47+
int pId = 0;
48+
49+
for (String id : getConfigurationHandler(SlimeFile.COMMANDS).getContent("commands", false)) {
50+
commandList.add(
51+
new CustomCommand(
52+
this,
53+
id,
54+
"sls" + pId
55+
)
56+
);
57+
pId++;
58+
}
59+
60+
for (CustomCommand command : commandList) {
61+
getCommands().register(
62+
command
63+
);
64+
}
65+
66+
getCommands().register(
67+
new PluginCommand(
68+
this
69+
)
70+
);
71+
72+
hasPAPI = getServer().getPluginManager().isPluginEnabled("PlaceholderAPI");
73+
}
74+
75+
public boolean hasPlaceholdersAPI() {
76+
return hasPAPI;
77+
}
78+
79+
@Override
80+
public void onDisable() {
81+
logs.info("Disabling plugin, thanks for using it!");
82+
}
83+
84+
@Override
85+
public SlimePluginInformation getPluginInformation() {
86+
return information;
87+
}
88+
89+
@Override
90+
public BaseSlimeLoader<JavaPlugin> getLoader() {
91+
return loader;
92+
}
93+
94+
@Override
95+
public SlimeLogs getLogs() {
96+
return logs;
97+
}
98+
99+
@Override
100+
public JavaPlugin getPlugin() {
101+
return this;
102+
}
103+
104+
@Override
105+
public void reload() {
106+
loader.reload();
107+
}
108+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package dev.justjustin.mycustomcommands;
2+
3+
import dev.mruniverse.slimelib.SlimeFiles;
4+
import dev.mruniverse.slimelib.SlimePlatform;
5+
6+
public enum SlimeFile implements SlimeFiles {
7+
COMMANDS("commands.yml");
8+
private final boolean differentFolder;
9+
10+
private final String file;
11+
12+
private final String folder;
13+
14+
private final String resource;
15+
16+
SlimeFile(String file) {
17+
this.file = file;
18+
this.resource = file;
19+
this.differentFolder = false;
20+
this.folder = "";
21+
}
22+
23+
SlimeFile(String file, String folder, String resource) {
24+
this.file = file;
25+
this.resource = resource;
26+
this.differentFolder = true;
27+
this.folder = folder;
28+
}
29+
30+
@Override
31+
public String getFileName() {
32+
return this.file;
33+
}
34+
35+
@Override
36+
public String getFolderName() {
37+
return this.folder;
38+
}
39+
40+
@Override
41+
public String getResourceFileName(SlimePlatform platform) {
42+
if (platform == SlimePlatform.VELOCITY || platform == SlimePlatform.SPONGE) {
43+
return "/" + this.resource;
44+
}
45+
return this.resource;
46+
}
47+
48+
@Override
49+
public boolean isInDifferentFolder() {
50+
return this.differentFolder;
51+
}
52+
}

0 commit comments

Comments
 (0)