-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
330f85e
commit e094286
Showing
33 changed files
with
1,284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?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>PAPER</platformType> | ||
<platformType>ADVENTURE</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" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="paper-1.8.8-445" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.decentsoftware-eu:decentholograms:2.7.5" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:3.0.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-base:3.0.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.palmergames.bukkit.towny:towny:0.98.2.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.9" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.6" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.33" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.5.6" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.8.0-beta4" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-api:4.11.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-key:4.11.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-api:1.3.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-string:1.3.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:23.0.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-minimessage:4.11.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson:4.11.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-legacy:4.11.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-plain:4.11.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-logger-slf4j:4.11.0" level="project" /> | ||
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:3.21.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:9.2" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:9.2" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:9.2" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:9.2" level="project" /> | ||
<orderEntry type="library" name="Maven: com.mojang:authlib:1.5.25" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:2.0.1" level="project" /> | ||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" /> | ||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.8.1" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?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.none030</groupId> | ||
<artifactId>MortisSupplyCrates</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>MortisSupplyCrates</name> | ||
|
||
<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> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
<repository> | ||
<id>glaremasters repo</id> | ||
<url>https://repo.glaremasters.me/repository/towny/</url> | ||
</repository> | ||
<repository> | ||
<id>papermc-repo</id> | ||
<url>https://repo.papermc.io/repository/maven-public/</url> | ||
</repository> | ||
<repository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/content/groups/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.decentsoftware-eu</groupId> | ||
<artifactId>decentholograms</artifactId> | ||
<version>2.7.5</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.palmergames.bukkit.towny</groupId> | ||
<artifactId>towny</artifactId> | ||
<version>0.98.2.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.papermc.paper</groupId> | ||
<artifactId>paper-api</artifactId> | ||
<version>1.19.2-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.mojang</groupId> | ||
<artifactId>authlib</artifactId> | ||
<version>1.5.25</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
46 changes: 46 additions & 0 deletions
46
src/main/java/me/none030/mortissupplycrates/MortisSupplyCrates.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package me.none030.mortissupplycrates; | ||
|
||
import eu.decentsoftware.holograms.api.holograms.Hologram; | ||
import me.none030.mortissupplycrates.commands.Commands; | ||
import me.none030.mortissupplycrates.events.Events; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.plugin.Plugin; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import static me.none030.mortissupplycrates.methods.SpawningCrates.Holograms; | ||
import static me.none030.mortissupplycrates.methods.SpawningCrates.SupplyCrates; | ||
import static me.none030.mortissupplycrates.methods.StoringFiles.StoreFiles; | ||
|
||
public final class MortisSupplyCrates extends JavaPlugin { | ||
|
||
public static Plugin plugin; | ||
public static boolean towny = false; | ||
@Override | ||
public void onEnable() { | ||
// Plugin startup logic | ||
plugin = this; | ||
getServer().getPluginCommand("crates").setExecutor(new Commands()); | ||
getServer().getPluginManager().registerEvents(new Events(), this); | ||
StoreFiles(); | ||
if (getServer().getPluginManager().getPlugin("Towny") != null) { | ||
towny = true; | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
// Plugin shutdown logic | ||
for (Location location : SupplyCrates.keySet()) { | ||
location.getChunk().load(); | ||
location.getBlock().setType(Material.AIR); | ||
SupplyCrates.remove(location); | ||
} | ||
for (Location location : Holograms.keySet()) { | ||
Hologram hologram = Holograms.get(location); | ||
hologram.delete(); | ||
Holograms.remove(location); | ||
} | ||
} | ||
} |
135 changes: 135 additions & 0 deletions
135
src/main/java/me/none030/mortissupplycrates/commands/Commands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package me.none030.mortissupplycrates.commands; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabExecutor; | ||
import org.bukkit.configuration.ConfigurationSection; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static me.none030.mortissupplycrates.methods.SpawningCrates.*; | ||
|
||
public class Commands implements TabExecutor { | ||
|
||
@Override | ||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||
|
||
if (!(sender instanceof Player)) { | ||
if (args[0].equalsIgnoreCase("stop")) { | ||
if (args.length == 2) { | ||
CratesToStop.add(args[1]); | ||
return true; | ||
} else { | ||
System.out.println("Usage: /crate stop <crate-id>"); | ||
} | ||
} | ||
if (args[0].equalsIgnoreCase("spawn")) { | ||
if (args.length == 2) { | ||
SpawnSupplyCrate(args[1]); | ||
return true; | ||
} else { | ||
System.out.println("Usage: /crate spawn <crate-id>"); | ||
} | ||
} | ||
if (args[0].equalsIgnoreCase("give")) { | ||
if (args.length == 3) { | ||
Player target = Bukkit.getPlayer(args[1]); | ||
if (target != null) { | ||
String crate = args[2]; | ||
GiveCrate(target, crate); | ||
} else { | ||
System.out.println("Player Not Found"); | ||
} | ||
return true; | ||
} else { | ||
System.out.println("Usage: crates give <player_name> <crate-id>"); | ||
} | ||
} | ||
} else { | ||
Player player = (Player) sender; | ||
if (player.hasPermission("crates.commands")) { | ||
if (args[0].equalsIgnoreCase("stop")) { | ||
if (args.length == 2) { | ||
CratesToStop.add(args[1]); | ||
return true; | ||
} else { | ||
player.sendMessage("§cUsage: /crate stop <crate-id>"); | ||
} | ||
} | ||
if (args[0].equalsIgnoreCase("spawn")) { | ||
if (args.length == 2) { | ||
SpawnSupplyCrate(args[1]); | ||
return true; | ||
} else { | ||
player.sendMessage("§cUsage: /crate spawn <crate-id>"); | ||
} | ||
} | ||
if (args[0].equalsIgnoreCase("give")) { | ||
if (args.length == 3) { | ||
Player target = Bukkit.getPlayer(args[1]); | ||
if (target != null) { | ||
String crate = args[2]; | ||
GiveCrate(target, crate); | ||
} else { | ||
player.sendMessage("§cPlayer Not Found"); | ||
} | ||
return true; | ||
} else { | ||
player.sendMessage("§cUsage: /crates give <player_name> <crate-id>"); | ||
} | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||
|
||
File file = new File("plugins/MortisSupplyCrates/", "crates.yml"); | ||
FileConfiguration crates = YamlConfiguration.loadConfiguration(file); | ||
File file2 = new File("plugins/MortisSupplyCrates/", "config.yml"); | ||
FileConfiguration config = YamlConfiguration.loadConfiguration(file2); | ||
|
||
if (args.length == 1) { | ||
List<String> arguments = new ArrayList<>(); | ||
arguments.add("spawn"); | ||
arguments.add("give"); | ||
return arguments; | ||
} | ||
if (args[0].equalsIgnoreCase("spawn")) { | ||
if (args.length == 2) { | ||
ConfigurationSection section = config.getConfigurationSection("supply-crates"); | ||
assert section != null; | ||
|
||
return new ArrayList<>(section.getKeys(false)); | ||
} | ||
} | ||
if (args[0].equalsIgnoreCase("give")) { | ||
if (args.length == 3) { | ||
ConfigurationSection section = crates.getConfigurationSection("crates"); | ||
assert section != null; | ||
|
||
return new ArrayList<>(section.getKeys(false)); | ||
} | ||
} | ||
if (args[0].equalsIgnoreCase("stop")) { | ||
if (args.length == 2) { | ||
ConfigurationSection section = config.getConfigurationSection("supply-crates"); | ||
assert section != null; | ||
|
||
return new ArrayList<>(section.getKeys(false)); | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.