First Commit

This commit is contained in:
2016-12-31 01:18:15 +01:00
parent 91dec66aff
commit 99baa00706
13 changed files with 211 additions and 0 deletions

13
Mariage/Mariage.iml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/ressources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

22
Mariage/src/config.yml Normal file
View File

@ -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

View File

@ -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() {
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

9
Mariage/src/plugin.yml Normal file
View File

@ -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

Binary file not shown.

3
Mariage/tests/eula.txt Normal file
View File

@ -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