commit f677c3040a992d27dd161647e6bfa1d382a3cb4c
Author: Aviortheking <2bazert@gmail.com>
Date: Sun Mar 19 01:47:09 2017 +0100
Initial commit
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..991d088
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+BetterTP
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..419d939
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..b26911b
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
new file mode 100644
index 0000000..4533c1b
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_guava_guava_17_0.xml b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml
new file mode 100644
index 0000000..2a9069c
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml
new file mode 100644
index 0000000..f3f3738
--- /dev/null
+++ b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
new file mode 100644
index 0000000..2ec8376
--- /dev/null
+++ b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
new file mode 100644
index 0000000..e60370e
--- /dev/null
+++ b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_10.xml b/.idea/libraries/Maven__junit_junit_4_10.xml
new file mode 100644
index 0000000..ed8bf5f
--- /dev/null
+++ b/.idea/libraries/Maven__junit_junit_4_10.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_10_SNAPSHOT.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_10_SNAPSHOT.xml
new file mode 100644
index 0000000..88ae130
--- /dev/null
+++ b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_10_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
new file mode 100644
index 0000000..91f161a
--- /dev/null
+++ b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml
new file mode 100644
index 0000000..acdf443
--- /dev/null
+++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_11_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_11_R0_1_SNAPSHOT.xml
new file mode 100644
index 0000000..bebbe2f
--- /dev/null
+++ b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_11_R0_1_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml
new file mode 100644
index 0000000..20e2920
--- /dev/null
+++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..bf6c7e6
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7ddb7d9
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BetterTP.iml b/BetterTP.iml
new file mode 100644
index 0000000..1771554
--- /dev/null
+++ b/BetterTP.iml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ SPIGOT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..97ceb86
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,72 @@
+
+
+ 4.0.0
+
+ Delta-Wings
+ BetterTP
+ 0.0.1
+ jar
+
+ BetterTP
+
+ The best teleportation plugin
+
+ UTF-8
+
+ https://delta-wings.net
+
+
+ clean package
+
+
+ 3.1
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.3
+
+
+ package
+
+ shade
+
+
+ true
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/groups/public/
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.11-R0.1-SNAPSHOT
+ provided
+
+
+
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Bettertp.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Bettertp.java
new file mode 100644
index 0000000..e589c92
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Bettertp.java
@@ -0,0 +1,34 @@
+package net.DeltaWings.Minecraft.BetterTP.Commands;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+
+/**
+ * Created by Delta Wings on 19/03/2017 at.01:40
+ */
+public class Bettertp implements CommandExecutor {
+ @Override
+ public boolean onCommand(CommandSender s, Command c, String l, String[] a) {
+ if(a.length == 2) {
+ if(a[0].equalsIgnoreCase("set")) {
+ if(a[1].equalsIgnoreCase("spawn")) {
+
+ } else if(a[1].equalsIgnoreCase("lobby")) {
+
+ }
+ } else if(a[0].equalsIgnoreCase("del") || a[0].equalsIgnoreCase("delete")) {
+ if(a[1].equalsIgnoreCase("spawn")) {
+
+ } else if(a[1].equalsIgnoreCase("lobby")) {
+
+ }
+ }
+ } else if(a.length == 1) {
+ if(a[0].equalsIgnoreCase("help")) {
+
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Delhome.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Delhome.java
new file mode 100644
index 0000000..d177d56
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Delhome.java
@@ -0,0 +1,9 @@
+package net.DeltaWings.Minecraft.BetterTP.Commands;
+
+import org.bukkit.command.CommandExecutor;
+
+/**
+ * Created by Delta Wings on 19/03/2017 at.01:37
+ */
+public class Delhome implements CommandExecutor {
+}
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Home.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Home.java
new file mode 100644
index 0000000..b148def
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Home.java
@@ -0,0 +1,9 @@
+package net.DeltaWings.Minecraft.BetterTP.Commands;
+
+import org.bukkit.command.CommandExecutor;
+
+/**
+ * Created by Delta Wings on 19/03/2017 at.01:37
+ */
+public class Home implements CommandExecutor {
+}
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Lobby.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Lobby.java
new file mode 100644
index 0000000..822436c
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Lobby.java
@@ -0,0 +1,15 @@
+package net.DeltaWings.Minecraft.BetterTP.Commands;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+
+/**
+ * Created by Delta Wings on 18/03/2017 at.15:24
+ */
+public class Lobby implements CommandExecutor {
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ return false;
+ }
+}
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Sethome.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Sethome.java
new file mode 100644
index 0000000..4ece7ed
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Sethome.java
@@ -0,0 +1,9 @@
+package net.DeltaWings.Minecraft.BetterTP.Commands;
+
+import org.bukkit.command.CommandExecutor;
+
+/**
+ * Created by Delta Wings on 19/03/2017 at.01:37
+ */
+public class Sethome implements CommandExecutor {
+}
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Spawn.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Spawn.java
new file mode 100644
index 0000000..369af01
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Commands/Spawn.java
@@ -0,0 +1,34 @@
+package net.DeltaWings.Minecraft.BetterTP.Commands;
+
+import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
+import net.DeltaWings.Minecraft.BetterTP.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class Spawn implements CommandExecutor {
+ Config m = new Config("", "messages");
+
+ @Override
+ public boolean onCommand(CommandSender s, Command abdoulila, String l, String[] a) {
+ if(s instanceof Player) {
+ if(s.hasPermission("bettertp.spawn")) {
+ Config c = new Config("data/spawn", "config");
+ if(c.exist()) {
+ Double y = c.getDouble("x", (double) -1);
+ if(!(y == -1)) {
+ String[] sl = new String[2];
+ sl[0] = "spawn";
+ Main.getInstance().tp(sl, (Player) s );
+ }
+ }
+ } else s.sendMessage(m.getString("global.permission"));
+ } else {
+ s.sendMessage(m.getString("global.not-console"));
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Custom/Config.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Custom/Config.java
new file mode 100644
index 0000000..cea483b
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Custom/Config.java
@@ -0,0 +1,118 @@
+package net.DeltaWings.Minecraft.BetterTP.Custom;
+
+import net.DeltaWings.Minecraft.BetterTP.Main;
+
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Config {
+ private final FileConfiguration config;
+ private final File root = Main.getInstance().getDataFolder();
+ private final File folder;
+ private final File file;
+ private final FileManager fm = new FileManager();
+
+ public Config(String folder, String file) {
+ this.folder = new File(folder);
+ this.file = new File(root.toString() + File.separator + this.folder.toString() + File.separator + file + ".yml");
+ config = YamlConfiguration.loadConfiguration(this.file);
+ }
+
+ public Boolean exist() {
+ return file.exists();
+ }
+
+ public void set(String path, Object value) {
+ config.set(path, value);
+ }
+
+ public void set(String path) {
+ config.createSection(path);
+ }
+
+ public void header(String header) {
+ config.options().header(header);
+ }
+
+ public int getInt(String path, Integer def) {
+ return config.getInt(path, def);
+ }
+
+ public int getInt(String path) {
+ return config.getInt(path);
+ }
+
+ public Double getDouble(String path, Double def) {
+ return config.getDouble(path, def);
+ }
+
+ public Double getDouble(String path) {
+ return config.getDouble(path);
+ }
+
+ public String getString(String path, String def) {
+ return config.getString(path, def);
+ }
+
+ public String getString(String path) {
+ return config.getString(path);
+ }
+
+ public Long getLong(String path) {
+ return config.getLong(path);
+ }
+
+ public Long getLong(String path, Long def) {
+ return config.getLong(path, def);
+ }
+
+ public void save() {
+ try {
+ config.save(file);
+ } catch ( IOException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public ArrayList getSection(String path) {
+ return new ArrayList<>(config.getConfigurationSection(path).getKeys(false));
+ }
+
+ public List getStringList(String path) {
+ return config.getStringList(path);
+ }
+
+ public void create() {
+ if(!exist()) {
+ if(!root.exists()) root.mkdirs();
+ File rfolder = new File(root.toString() + File.separator + folder.toString());
+ if(!rfolder.exists()) rfolder.mkdirs();
+ try {
+ file.createNewFile();
+ } catch ( IOException e ) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public boolean isSet(String path) {
+ return config.isSet(path);
+ }
+
+ public boolean getBoolean(String path, Boolean def) {
+ return config.getBoolean(path, def);
+ }
+
+ public boolean getBoolean(String path) {
+ return config.getBoolean(path);
+ }
+
+ public void delete() {
+ fm.delete(file);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Custom/FileManager.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Custom/FileManager.java
new file mode 100644
index 0000000..f02adec
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Custom/FileManager.java
@@ -0,0 +1,55 @@
+package net.DeltaWings.Minecraft.BetterTP.Custom;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class FileManager {
+
+
+ public List listFiles(String path) {
+ String[] t = new File(path).list();
+ if(t == null) return null;
+ else return Arrays.asList(t);
+ }
+
+ public List listFiles(File path) {
+ String[] t = path.list();
+ if(t == null) return null;
+ else return Arrays.asList(t);
+ }
+
+ public void delete(File path) {
+ path.delete();
+ }
+
+ public void delete(String path) {
+ File file = new File(path);
+ file.delete();
+ }
+
+ public void createFile(String path) {
+ try {
+ new File(path).createNewFile();
+ } catch ( IOException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public void createFile(File path) {
+ try {
+ path.createNewFile();
+ } catch ( IOException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public void createFolder(File path) {
+ path.mkdirs();
+ }
+
+ public void createFolder(String path) {
+ new File(path).mkdirs();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/DeltaWings/Minecraft/BetterTP/Main.java b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Main.java
new file mode 100644
index 0000000..d6911c0
--- /dev/null
+++ b/src/main/java/net/DeltaWings/Minecraft/BetterTP/Main.java
@@ -0,0 +1,70 @@
+package net.DeltaWings.Minecraft.BetterTP;
+
+import net.DeltaWings.Minecraft.BetterTP.Commands.*;
+import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.util.logging.Level;
+
+public final class Main extends JavaPlugin {
+
+ public void log(String Message) {
+ Bukkit.getLogger().log(Level.INFO, Message);
+ }
+
+ public Boolean tp(String[] Type, Player Player) {
+ if(Type[0].equals("spawn")) {
+ Config c = new Config("data/spawn", "config");
+ return Player.teleport(new Location(Bukkit.getServer().getWorld(c.getString("world")), c.getDouble("x"), c.getDouble("y"), c.getDouble("z")));
+ } else {
+ Config c = new Config("data", Player.getName());
+ String t = Type[1];
+ return Player.teleport(new Location(Bukkit.getServer().getWorld(c.getString(t+"world")), c.getDouble(t+"x"), c.getDouble(t+"y"), c.getDouble(t+"z")));
+ }
+ }
+
+ private static Main instance;
+ public static Main getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void onEnable() {
+ instance = this;
+ getCommand("Spawn").setExecutor(new Spawn());
+ getCommand("Lobby").setExecutor(new Lobby());
+ getCommand("Home").setExecutor(new Home());
+ getCommand("Bettertp").setExecutor(new Bettertp());
+ getCommand("Sethome").setExecutor(new Sethome());
+ getCommand("Delhome").setExecutor(new Delhome());
+
+ config();
+
+ log("Plugin Loaded !");
+ }
+
+ @Override
+ public void onDisable() {
+ log("Plugin Unloaded !");
+ }
+
+ private void config() {
+ Config messages = new Config("", "messages");
+ if(!messages.exist()) {
+ messages.create();
+ messages.set("global.permission", "&8 > &cYou do not have the permission to do thats !");
+ messages.set("global.not-console", "This Command cannot be send throught console");
+ messages.set("spawn.set", "&8 >&c The Spawn was set");
+ messages.set("spawn.teleported", "&8 >&c You have benn teleported to the spawn");
+ messages.set("home.teleported", "&8 >&c You have benn teleported to you home : [home]");
+ messages.set("home.set", "&8 >&c Your home [home] has been set");
+ messages.save();
+ }
+
+
+ }
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
new file mode 100644
index 0000000..5c9e55f
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,29 @@
+name: BetterTP
+version: ${project.version}
+main: net.DeltaWings.Minecraft.BetterTP.Main
+prefix: BetterTP
+authors: [Aviortheking, LePhoenixArdent, Aipsyllone]
+description: The best teleportation plugin
+website: https://delta-wings.net
+commands:
+ spawn:
+ description: Teleport to the spawn
+ usage: Usage /spawn
+ lobby:
+ description: Teleport to the lobby
+ usage: Usage /lobby
+ bettertp:
+ description: Manage the plugin
+ usage: Usage /bettertp help
+ aliases: [btp,bt]
+ home:
+ description: Teleport to your homes
+ usage: Usage /home [home]
+ sethome:
+ description: Set your homes
+ usage: Usage /sethome [home]
+ aliases: [shome]
+ delhome:
+ description: Delete your homes
+ usage: Usage /delhome [home]
+ aliases: [dhome]