Skip to content

Commit

Permalink
라이브러리 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Nov 19, 2021
0 parents commit 7247c94
Show file tree
Hide file tree
Showing 20 changed files with 1,706 additions and 0 deletions.
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

target/

pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next

release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml

# Common working directory
run/
87 changes: 87 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?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>me.else_junsuk</groupId>
<artifactId>JunSecLibrary</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>JunSecLibrary</name>

<description>JunSuk이 개발한 전 마인크래프트 플러그인에 첨가되어 있는 유용한 라이브러리.</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>D:\Minecraft Servers\Version 1.17.1\[ 21.11.17 ] Development Server\plugins\JunSecLibrary.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
46 changes: 46 additions & 0 deletions src/main/java/me/else_junsuk/junseclibrary/JunSecLibrary.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package me.else_junsuk.junseclibrary;

import lombok.Getter;
import me.else_junsuk.junseclibrary.inventoryapi.InventoryManager;
import me.else_junsuk.junseclibrary.listeners.PlayerChatListener;
import me.else_junsuk.junseclibrary.stringsapi.F;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

public class JunSecLibrary extends JavaPlugin {

@Getter
public static JunSecLibrary main;

private static InventoryManager invManager;

@Override
public void onEnable() {
main = this;
F.sendConsole("&2[ JUNSEC LIBRARY ] &f라이브러리를 활성화합니다.");

invManager = new InventoryManager(this);
invManager.init();
F.sendConsole("&2[ JUNSEC LIBRARY ] &f라이브러리의 CustomInventoryAPI를 불러옵니다.");
F.sendConsole("&2[ JUNSEC LIBRARY ] &f라이브러리의 StringManagerAPI를 불러옵니다.");

registerEvents();
}

private void registerEvents() {
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new PlayerChatListener(), this);

getServer().getConsoleSender().sendMessage("§2[ JUNSEC LIBRARY ] §f라이브러리의 모든 이벤트를 호출했습니다.");
}

@Override
public void onDisable() {

getServer().getConsoleSender().sendMessage("§c[ JUNSEC LIBRARY ] §f라이브러리를 종료합니다..");
F.log.warning("§c* 주의하세요! 서버가 불안정해질 수 있습니다.");
}

public static InventoryManager manager() { return invManager; }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package me.else_junsuk.junseclibrary.config;

import me.else_junsuk.junseclibrary.JunSecLibrary;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

import java.io.File;
import java.io.IOException;

public class Configuration {

private File customConfigFile;
private FileConfiguration customConfig;

public FileConfiguration getCustomConfig() {
return this.customConfig;
}

public File getCustomFile() {
return this.customConfigFile;
}

public void createCustomConfig(String fileName) {
customConfigFile = new File(JunSecLibrary.getMain().getDataFolder(), fileName);
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
JunSecLibrary.main.saveResource(fileName, false);
}

customConfig = new YamlConfiguration();
try {
customConfig.load(customConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package me.else_junsuk.junseclibrary.inventoryapi;

import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;

import java.util.function.Consumer;

public class ClickableItem {

private ItemStack item;
private Consumer<InventoryClickEvent> consumer;

private ClickableItem(ItemStack item, Consumer<InventoryClickEvent> consumer) {
this.item = item;
this.consumer = consumer;
}

public static ClickableItem empty(ItemStack item) {
return of(item, e -> {});
}

public static ClickableItem of(ItemStack item, Consumer<InventoryClickEvent> consumer) {
return new ClickableItem(item, consumer);
}

public void run(InventoryClickEvent e) { consumer.accept(e); }

public ItemStack getItem() { return item; }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.else_junsuk.junseclibrary.inventoryapi;

import java.util.function.Consumer;

public class InventoryListener<T> {

private Class<T> type;
private Consumer<T> consumer;

public InventoryListener(Class<T> type, Consumer<T> consumer) {
this.type = type;
this.consumer = consumer;
}

public void accept(T t) { consumer.accept(t); }

public Class<T> getType() { return type; }

}
Loading

0 comments on commit 7247c94

Please sign in to comment.