mirror of
https://github.com/TotalFreedomMC/TF-Marriage.git
synced 2024-12-28 11:04:24 +00:00
Fixed seen command & added priest permission
This commit is contained in:
parent
a4417a1af5
commit
f7a3e012cc
5 changed files with 69 additions and 42 deletions
4
pom.xml
4
pom.xml
|
@ -4,7 +4,7 @@
|
|||
|
||||
<groupId>me.lenis0012.mr</groupId>
|
||||
<artifactId>Marriage</artifactId>
|
||||
<version>1.11</version>
|
||||
<version>1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Marriage</name>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.6.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.6.2-R0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
|
|
|
@ -39,5 +39,4 @@ public class MarryCMD implements CommandExecutor {
|
|||
command.execute(sender, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package me.lenis0012.mr.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -13,45 +14,71 @@ public class MarryCommand extends CommandBase {
|
|||
|
||||
@Override
|
||||
public void perform(CommandSender sender, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
Player op = plugin.getPlayer(args[0]);
|
||||
if(op != null) {
|
||||
if(op.isOnline()) {
|
||||
MPlayer mp = plugin.getMPlayer(player);
|
||||
MPlayer tp = plugin.getMPlayer(op);
|
||||
|
||||
if(op.getName().equals(player.getName())) {
|
||||
error(player, Messages.NOT_YOURSELF);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mp.isMarried()) {
|
||||
error(player, Messages.ALREADY_MARRIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if(tp.isMarried()) {
|
||||
String msg = Messages.HAS_PARTNER.replace("{USER}", op.getName());
|
||||
error(player, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if(plugin.eco) {
|
||||
double a = EcoUtil.getPriceFromConfig("marry");
|
||||
if(a != 0.0) {
|
||||
if(EcoUtil.withrawMoneyIfEnough(player, a)) {
|
||||
return;
|
||||
if(args.length <= 1) {
|
||||
Player player = (Player) sender;
|
||||
Player op = plugin.getPlayer(args[0]);
|
||||
if(op != null) {
|
||||
if(op.isOnline()) {
|
||||
MPlayer mp = plugin.getMPlayer(player);
|
||||
MPlayer tp = plugin.getMPlayer(op);
|
||||
|
||||
if(op.getName().equals(player.getName())) {
|
||||
error(player, Messages.NOT_YOURSELF);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mp.isMarried()) {
|
||||
error(player, Messages.ALREADY_MARRIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if(tp.isMarried()) {
|
||||
String msg = Messages.HAS_PARTNER.replace("{USER}", op.getName());
|
||||
error(player, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if(plugin.eco) {
|
||||
double a = EcoUtil.getPriceFromConfig("marry");
|
||||
if(a != 0.0) {
|
||||
if(EcoUtil.withrawMoneyIfEnough(player, a)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inform(player, Messages.REQUEST_SENT);
|
||||
String cmd = ChatColor.LIGHT_PURPLE + "/marry accept" + ChatColor.GREEN;
|
||||
String msg = Messages.REQUEST_RECEIVED.replace("{USER}", player.getName()).replace("{COMMAND}", cmd);
|
||||
inform(op, msg);
|
||||
plugin.req.put(op.getName(), player.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
inform(player, Messages.REQUEST_SENT);
|
||||
String cmd = ChatColor.LIGHT_PURPLE + "/marry accept" + ChatColor.GREEN;
|
||||
String msg = Messages.REQUEST_RECEIVED.replace("{USER}", player.getName()).replace("{COMMAND}", cmd);
|
||||
inform(op, msg);
|
||||
plugin.req.put(op.getName(), player.getName());
|
||||
}
|
||||
} else {
|
||||
Player priest = (Player) sender;
|
||||
Player p1 = plugin.getPlayer(args[0]);
|
||||
Player p2 = plugin.getPlayer(args[2]);
|
||||
MPlayer mp1 = plugin.getMPlayer(p1);
|
||||
MPlayer mp2 = plugin.getMPlayer(p2);
|
||||
if(!priest.hasPermission("marry.priest")) {
|
||||
error(priest, Messages.NO_PERMISSION);
|
||||
return;
|
||||
}
|
||||
|
||||
if(p1 == null || !p1.isOnline() || p2 == null || !p2.isOnline()) {
|
||||
error(priest, Messages.INVALID_PLAYER);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mp1.isMarried() || mp2.isMarried()) {
|
||||
error(priest, Messages.ALREADY_MARRIED);
|
||||
return;
|
||||
}
|
||||
|
||||
mp1.setPartner(p2.getName());
|
||||
String msg = Messages.MARRIED.replace("{USER1}", p1.getName()).replace("{USER2}", p2.getName());
|
||||
Bukkit.getServer().broadcastMessage(ChatColor.GREEN + msg);
|
||||
}
|
||||
|
||||
error(sender, Messages.INVALID_PLAYER);
|
||||
|
|
|
@ -37,8 +37,8 @@ public class Messages {
|
|||
public static final String PARTNERS = lang.getWordWithDefault("partners", "Partners");
|
||||
public static final String TELEPORTING = lang.getWordWithDefault("teleporting", "Teleporting");
|
||||
public static final String SECONDS = lang.getWordWithDefault("seconds", "sec");
|
||||
public static final String MINUTES = lang.getWordWithDefault("seconds", "min");
|
||||
public static final String HOURS = lang.getWordWithDefault("seconds", "hours");
|
||||
public static final String MINUTES = lang.getWordWithDefault("minutes", "min");
|
||||
public static final String HOURS = lang.getWordWithDefault("hours", "hours");
|
||||
public static final String DAYS = lang.getWordWithDefault("days", "days");
|
||||
public static final String WEEKS = lang.getWordWithDefault("weeks", "weeks");
|
||||
public static final String MONTHS = lang.getWordWithDefault("months", "months");
|
||||
|
|
|
@ -17,8 +17,9 @@ permissions:
|
|||
description: Allows all admin commands
|
||||
children:
|
||||
marry.reload:
|
||||
description:
|
||||
Allows to reload the config files
|
||||
description: Allows to reload the config files
|
||||
marry.priest:
|
||||
description: Allows player to marry 2 orther players.
|
||||
marry.default:
|
||||
description: Allows default player commands
|
||||
children:
|
||||
|
|
Loading…
Reference in a new issue