mirror of
https://github.com/TotalFreedomMC/TF-Marriage.git
synced 2025-01-03 13:58:26 +00:00
Add home commands
This commit is contained in:
parent
06ce7d6d88
commit
1db17bbb21
5 changed files with 70 additions and 3 deletions
|
@ -8,7 +8,7 @@ import com.lenis0012.bukkit.marriage2.config.Message;
|
||||||
|
|
||||||
public class CommandDivorce extends Command {
|
public class CommandDivorce extends Command {
|
||||||
|
|
||||||
public CommandDivorce(Marriage marriage, String[] aliases) {
|
public CommandDivorce(Marriage marriage) {
|
||||||
super(marriage, "divorce");
|
super(marriage, "divorce");
|
||||||
setDescription("Divorce your current partner");
|
setDescription("Divorce your current partner");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.lenis0012.bukkit.marriage2.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import com.lenis0012.bukkit.marriage2.MData;
|
||||||
|
import com.lenis0012.bukkit.marriage2.MPlayer;
|
||||||
|
import com.lenis0012.bukkit.marriage2.Marriage;
|
||||||
|
import com.lenis0012.bukkit.marriage2.config.Message;
|
||||||
|
|
||||||
|
public class CommandHome extends Command {
|
||||||
|
|
||||||
|
public CommandHome(Marriage marriage) {
|
||||||
|
super(marriage, "home");
|
||||||
|
setDescription("Teleport to your marriage home");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
MPlayer mPlayer = marriage.getMPlayer(player.getUniqueId());
|
||||||
|
MData marriage = mPlayer.getMarriage();
|
||||||
|
if(marriage != null) {
|
||||||
|
Location home = marriage.getHome();
|
||||||
|
if(home != null) {
|
||||||
|
player.teleport(home);
|
||||||
|
reply(Message.HOME_TELEPORT);
|
||||||
|
} else {
|
||||||
|
reply(Message.HOME_NOT_SET);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reply(Message.NOT_MARRIED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.lenis0012.bukkit.marriage2.commands;
|
||||||
|
|
||||||
|
import com.lenis0012.bukkit.marriage2.MData;
|
||||||
|
import com.lenis0012.bukkit.marriage2.MPlayer;
|
||||||
|
import com.lenis0012.bukkit.marriage2.Marriage;
|
||||||
|
import com.lenis0012.bukkit.marriage2.config.Message;
|
||||||
|
|
||||||
|
public class CommandSethome extends Command {
|
||||||
|
|
||||||
|
public CommandSethome(Marriage marriage) {
|
||||||
|
super(marriage, "sethome");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
MPlayer mPlayer = marriage.getMPlayer(player.getUniqueId());
|
||||||
|
MData marriage = mPlayer.getMarriage();
|
||||||
|
if(marriage != null) {
|
||||||
|
marriage.setHome(player.getLocation().clone());
|
||||||
|
reply(Message.HOME_SET);
|
||||||
|
} else {
|
||||||
|
reply(Message.NOT_MARRIED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,10 +7,13 @@ public enum Message {
|
||||||
PLAYER_NOT_FOUND("&cNo player named %s was found!"),
|
PLAYER_NOT_FOUND("&cNo player named %s was found!"),
|
||||||
TARGET_ALREADY_MARRIED("&cPlayers %s is already married to someone!"),
|
TARGET_ALREADY_MARRIED("&cPlayers %s is already married to someone!"),
|
||||||
ALREADY_MARRIED("&cYou are already married to someone!"),
|
ALREADY_MARRIED("&cYou are already married to someone!"),
|
||||||
MARRIED("&a&lPlayer %s and %s are now officially married!"),
|
MARRIED("&a&lPlayer %s and %s have just married!"),
|
||||||
MARRIAGE_REQUESTED("&aPlayer %s has requested you to marry with them, use &e/marry %s &ato accept it."),
|
MARRIAGE_REQUESTED("&aPlayer %s has requested you to marry with them, use &e/marry %s &ato accept it."),
|
||||||
NOT_MARRIED("&cYou are currently not married with someone!"),
|
NOT_MARRIED("&cYou are currently not married with someone!"),
|
||||||
DIVORCED("&aPlayer %s and %s have divorced!");
|
DIVORCED("&aPlayer %s and %s have divorced!"),
|
||||||
|
HOME_TELEPORT("&aYou have been teleported to your marriage home!"),
|
||||||
|
HOME_NOT_SET("&cYou currently do not have a home set for your marriage!"),
|
||||||
|
HOME_SET("&aYou have set a home for your marriage!");
|
||||||
|
|
||||||
private final String defaultMessage;
|
private final String defaultMessage;
|
||||||
private String message;
|
private String message;
|
||||||
|
|
|
@ -6,7 +6,10 @@ import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.lenis0012.bukkit.marriage2.MPlayer;
|
import com.lenis0012.bukkit.marriage2.MPlayer;
|
||||||
|
import com.lenis0012.bukkit.marriage2.commands.CommandDivorce;
|
||||||
|
import com.lenis0012.bukkit.marriage2.commands.CommandHome;
|
||||||
import com.lenis0012.bukkit.marriage2.commands.CommandMarry;
|
import com.lenis0012.bukkit.marriage2.commands.CommandMarry;
|
||||||
|
import com.lenis0012.bukkit.marriage2.commands.CommandSethome;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Message;
|
import com.lenis0012.bukkit.marriage2.config.Message;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Settings;
|
import com.lenis0012.bukkit.marriage2.config.Settings;
|
||||||
import com.lenis0012.bukkit.marriage2.internal.data.DataManager;
|
import com.lenis0012.bukkit.marriage2.internal.data.DataManager;
|
||||||
|
@ -42,6 +45,9 @@ public class MarriageCore extends MarriageBase {
|
||||||
@Register(name = "commands", type = Register.Type.ENABLE)
|
@Register(name = "commands", type = Register.Type.ENABLE)
|
||||||
public void registerCommands() {
|
public void registerCommands() {
|
||||||
register(CommandMarry.class);
|
register(CommandMarry.class);
|
||||||
|
register(CommandHome.class);
|
||||||
|
register(CommandSethome.class);
|
||||||
|
register(CommandDivorce.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue