mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-29 03:39:08 +00:00
Add javadocs, clean up code a bit
This commit is contained in:
23
build.gradle
23
build.gradle
@@ -32,14 +32,14 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT'
|
||||
implementation 'co.aikar:acf-paper:0.5.0-SNAPSHOT'
|
||||
implementation 'co.aikar:idb-core:1.0.0-SNAPSHOT'
|
||||
implementation 'com.zaxxer:HikariCP:2.4.1'
|
||||
implementation 'org.apache.commons:commons-lang3:3.6'
|
||||
implementation 'mysql:mysql-connector-java:5.1.33'
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.2-SNAPSHOT'
|
||||
compileOnly name: 'languagy-1.2.6'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT' // spigot
|
||||
implementation 'co.aikar:acf-paper:0.5.0-SNAPSHOT' // commands
|
||||
implementation 'co.aikar:idb-core:1.0.0-SNAPSHOT' // database
|
||||
implementation 'com.zaxxer:HikariCP:2.4.1' // database
|
||||
implementation 'org.apache.commons:commons-lang3:3.6' // apache commons
|
||||
implementation 'com.github.stefvanschie.inventoryframework:IF:0.5.17' // inventory framework
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.2-SNAPSHOT' // worldguard
|
||||
compileOnly name: 'languagy-1.2.6' // languagy
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
@@ -47,6 +47,13 @@ shadowJar {
|
||||
relocate 'co.aikar.idb', 'net.islandearth.rpgmap.libs.idb'
|
||||
}
|
||||
|
||||
javadoc {
|
||||
exclude 'net/islandearth/rpgregions/translation/**'
|
||||
exclude 'net/islandearth/rpgregions/listener/**'
|
||||
exclude 'net/islandearth/rpgregions/gson/**'
|
||||
exclude 'net/islandearth/rpgregions/commands/**'
|
||||
}
|
||||
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
processResources {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.islandearth.rpgregions;
|
||||
|
||||
import co.aikar.commands.PaperCommandManager;
|
||||
import co.aikar.idb.DB;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -7,6 +8,7 @@ import net.islandearth.languagy.language.LanguagyImplementation;
|
||||
import net.islandearth.languagy.language.LanguagyPluginHook;
|
||||
import net.islandearth.languagy.language.Translator;
|
||||
import net.islandearth.rpgregions.api.RPGRegionsAPI;
|
||||
import net.islandearth.rpgregions.commands.RPGRegionsCommand;
|
||||
import net.islandearth.rpgregions.gson.AbstractAdapter;
|
||||
import net.islandearth.rpgregions.listener.ConnectionListener;
|
||||
import net.islandearth.rpgregions.listener.MoveListener;
|
||||
@@ -42,6 +44,7 @@ public final class RPGRegions extends JavaPlugin implements RPGRegionsAPI, Langu
|
||||
this.generateLang();
|
||||
this.managers = new RPGRegionsManagers(this);
|
||||
this.registerListeners();
|
||||
this.registerCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,6 +111,11 @@ public final class RPGRegions extends JavaPlugin implements RPGRegionsAPI, Langu
|
||||
pm.registerEvents(new MoveListener(this), this);
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
PaperCommandManager manager = new PaperCommandManager(this);
|
||||
manager.registerCommand(new RPGRegionsCommand(this));
|
||||
}
|
||||
|
||||
public static RPGRegionsAPI getAPI() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@@ -4,5 +4,9 @@ import net.islandearth.rpgregions.managers.RPGRegionsManagers;
|
||||
|
||||
public interface RPGRegionsAPI {
|
||||
|
||||
/**
|
||||
* Gets the class handling managers.
|
||||
* @return class handling managers
|
||||
*/
|
||||
RPGRegionsManagers getManagers();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,17 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public interface IntegrationManager {
|
||||
|
||||
/**
|
||||
* Checks if the specified location is within a region.
|
||||
* @param location location to check
|
||||
* @return true if location is within a region, false otherwise
|
||||
*/
|
||||
boolean isInRegion(Location location);
|
||||
|
||||
/**
|
||||
* Handles a move event to perform related region checks.
|
||||
* @param pme PlayerMoveEvent
|
||||
*/
|
||||
void handleMove(PlayerMoveEvent pme);
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,18 @@ public class RPGRegionsCommand extends BaseCommand {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("edit")
|
||||
public void onEdit(Player player, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1: {
|
||||
//TODO gui
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
player.sendMessage(ChatColor.RED + "Usage: /rpgregions edit <region>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,32 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public interface StorageManager {
|
||||
|
||||
/**
|
||||
* Gets a player's account from the storage.
|
||||
* This will return an account stored in the cache.
|
||||
* If no account is found in the cache a new account will be fetched and added to the cache.
|
||||
* @param uuid player's UUID
|
||||
* @return player's account
|
||||
*/
|
||||
CompletableFuture<RPGRegionsAccount> getAccount(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a map of currently cached accounts.
|
||||
* @return map of cached accounts
|
||||
*/
|
||||
ConcurrentMap<UUID, RPGRegionsAccount> getCachedAccounts();
|
||||
|
||||
/**
|
||||
* Removes an account from the storage cache and saves its data.
|
||||
* @param uuid player's UUID
|
||||
*/
|
||||
void removeCachedAccount(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a UUID safe to use in databases.
|
||||
* @param uuid player's UUID
|
||||
* @return new string uuid to use in databases
|
||||
*/
|
||||
default String getDatabaseUuid(UUID uuid) {
|
||||
return uuid.toString().replace("-", "");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,16 @@ package net.islandearth.rpgregions.managers.data.region;
|
||||
import java.util.Date;
|
||||
|
||||
public interface Discovery {
|
||||
|
||||
/**
|
||||
* Gets the date this discovery was made.
|
||||
* @return date of discovery
|
||||
*/
|
||||
Date getDate();
|
||||
|
||||
/**
|
||||
* Gets the name of the region that was discovered.
|
||||
* @return name of region discovered
|
||||
*/
|
||||
String getRegion();
|
||||
}
|
||||
|
||||
@@ -26,11 +26,7 @@ public class YamlStorage implements StorageManager {
|
||||
|
||||
public YamlStorage(RPGRegions plugin) {
|
||||
File dataFile = new File(plugin.getDataFolder() + "/accounts/");
|
||||
if (!dataFile.exists()) {
|
||||
if (!dataFile.mkdirs()) {
|
||||
plugin.getLogger().warning("Could not create " + plugin.getDataFolder() + "/accounts/ folder!");
|
||||
}
|
||||
}
|
||||
dataFile.mkdirs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,8 +3,16 @@ package net.islandearth.rpgregions.rewards;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class DiscoveryReward {
|
||||
|
||||
|
||||
/**
|
||||
* Awards this reward to the specified player
|
||||
* @param player
|
||||
*/
|
||||
public abstract void award(Player player);
|
||||
|
||||
/**
|
||||
* User friendly name of this reward.
|
||||
* @return name of reward
|
||||
*/
|
||||
public abstract String getName();
|
||||
}
|
||||
|
||||
@@ -88,18 +88,16 @@ public enum Translations {
|
||||
|
||||
public static void generateLang(RPGRegions plugin) {
|
||||
File lang = new File(plugin.getDataFolder() + "/lang/");
|
||||
if (!lang.exists()) lang.mkdirs();
|
||||
lang.mkdirs();
|
||||
|
||||
for (Language language : Language.values()) {
|
||||
File file = new File(plugin.getDataFolder() + "/lang/" + language.getCode() + ".yml");
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
config.options().copyDefaults(true);
|
||||
for (Translations key : values()) {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
name: RPGRegions
|
||||
version: @version@
|
||||
main: net.islandearth.rpgregions.RPGRegions
|
||||
api-version: 1.13
|
||||
api-version: '1.13'
|
||||
depend: [Languagy]
|
||||
softdepend: [WorldGuard, RedProtect]
|
||||
softdepend: [WorldGuard]
|
||||
authors: [SamB440]
|
||||
description: Discoverable regions
|
||||
website: https://www.islandearth.net
|
||||
commands:
|
||||
rpgregions:
|
||||
usage: /rpgregions
|
||||
description: Base RPGRegions command
|
||||
|
||||
Reference in New Issue
Block a user