diff --git a/.idea/Minecraft-Marriage.iml b/.idea/Minecraft-Marriage.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Minecraft-Marriage.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..43031ee --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e356962 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Mariage/Mariage.iml b/Mariage/Mariage.iml new file mode 100644 index 0000000..bd3d5d8 --- /dev/null +++ b/Mariage/Mariage.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mariage/ressources/Spigot-v1_10_2.jar b/Mariage/ressources/Spigot-v1_10_2.jar new file mode 100644 index 0000000..06f9e04 Binary files /dev/null and b/Mariage/ressources/Spigot-v1_10_2.jar differ diff --git a/Mariage/src/config.yml b/Mariage/src/config.yml new file mode 100644 index 0000000..b9e19d2 --- /dev/null +++ b/Mariage/src/config.yml @@ -0,0 +1,22 @@ +config: + #time to let the player answer + timeout: 60 + +messages: + proposition: "Dear %receiver%, \nWould you like to marry me ? \nFrom %sender%. \n(You have %time% seconds to send your answer !) \n(use '/marry accept %player%' to accept the proposition)" +# don't touch under this !!! +partners: #each players have the sames infos ! + player: + married: false #is the player married ? + who: Aviortheking #name of the partner + home: # coords of the home + x: 0 + y: 0 + z: 0 + world: world + propositions: + otherplayer: #other player name + isblocked: true #if blocked the player won't receive a proposition ! + timeout: 60 # time before the proposition stop while at 0 the other player can reinvite if not blocked + + diff --git a/Mariage/src/net/DeltaWings/Minecraft/Marriage/Main.java b/Mariage/src/net/DeltaWings/Minecraft/Marriage/Main.java new file mode 100644 index 0000000..3c84768 --- /dev/null +++ b/Mariage/src/net/DeltaWings/Minecraft/Marriage/Main.java @@ -0,0 +1,23 @@ +package net.DeltaWings.Minecraft.Marriage; + +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +/** + * Created by Delta Wings on 19/12/2016 at.18:15 + */ +public class Main extends JavaPlugin implements Listener{ + + public void onEnable(){ + getCommand("Marry").setExecutor(new Marry(this)); + + //load the config + getConfig().options().copyDefaults(true); + saveConfig(); + } + + public void onDisable() { + + } + +} diff --git a/Mariage/src/net/DeltaWings/Minecraft/Marriage/Marriage.java b/Mariage/src/net/DeltaWings/Minecraft/Marriage/Marriage.java new file mode 100644 index 0000000..0d9b482 --- /dev/null +++ b/Mariage/src/net/DeltaWings/Minecraft/Marriage/Marriage.java @@ -0,0 +1,21 @@ +package net.DeltaWings.Minecraft.Marriage; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +/** + * Created by Floflo on 19/12/2016. + */ +public class Marriage implements CommandExecutor { + public Marriage(Main main) { + } + + + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + + return false; + } +} diff --git a/Mariage/src/net/DeltaWings/Minecraft/Marriage/Marry.java b/Mariage/src/net/DeltaWings/Minecraft/Marriage/Marry.java new file mode 100644 index 0000000..e1e24ec --- /dev/null +++ b/Mariage/src/net/DeltaWings/Minecraft/Marriage/Marry.java @@ -0,0 +1,55 @@ +package net.DeltaWings.Minecraft.Marriage; + +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import net.DeltaWings.Minecraft.Marriage.Main; + +/** + * Created by Floflo on 21/12/2016. + */ +public class Marry implements CommandExecutor { + + private FileConfiguration config; + + Marry(Main main) { + this.config = main.getConfig(); + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + if(sender instanceof Player) { + Player p = (Player)sender; + if(cmd.getName().equalsIgnoreCase("marry")) { + if(args.length == 1 && !args[0].equalsIgnoreCase("accept")) { + Boolean found = false; + for(Player player : Bukkit.getServer().getOnlinePlayers()) { + if(player.getName().equalsIgnoreCase(args[0])) { + found = true; + if(!config.getBoolean("partners."+player.getName()+".married")) { + //config messages.proposition + player.sendMessage(config.getString("messages.proposition".replace("%sender%",p.getName()).replace("%receiver%", player.getName()).replace("%time%",Integer.toString(config.getInt("config.timeout"))).replace("&", "ยง"))); + } + } + } + if(!found) { + //send message "Player isn't online or is not correctly typed" + p.sendMessage(args[0]+" isn't online or you haven't correctly typed his/her name !"); + } + } else if (args.length == 2 && args[0].equalsIgnoreCase("accept")) { + if(config.getInt("partners."+p.getName()+".propositions."+args[1]+".timeout", 0) > 0) { + //message you have accepted the proposition + //bd %couple has been married ! + } else { + //message the other player haven't send a proposition or the proposition is timed out ! + } + } + } + } + return true; + } +} diff --git a/Mariage/src/plugin.yml b/Mariage/src/plugin.yml new file mode 100644 index 0000000..d1b994d --- /dev/null +++ b/Mariage/src/plugin.yml @@ -0,0 +1,9 @@ +name: Marriage +version: 0.1.0 +author: Delta Wings +main: net.DeltaWings.Minecraft.Marriage.Main +website: http://delta-wings.net/ +commands: + marry: + description: Marriage Command + usage: /marry \ No newline at end of file diff --git a/Mariage/tests/Spigot-v1_10_2.jar b/Mariage/tests/Spigot-v1_10_2.jar new file mode 100644 index 0000000..06f9e04 Binary files /dev/null and b/Mariage/tests/Spigot-v1_10_2.jar differ diff --git a/Mariage/tests/eula.txt b/Mariage/tests/eula.txt new file mode 100644 index 0000000..c4a6cb1 --- /dev/null +++ b/Mariage/tests/eula.txt @@ -0,0 +1,3 @@ +#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula). +#Wed Dec 21 15:20:39 CET 2016 +eula=true