Add command to forcefully send player to f home from #478.
Functionality: /f ahome <target> - sends a player to their f home as long as they have an f home and are online. Permission node is and given to factions.admin and factions.*
This commit is contained in:
parent
d916e97d0d
commit
c5571ba8ee
52
src/main/java/com/massivecraft/factions/cmd/CmdAHome.java
Normal file
52
src/main/java/com/massivecraft/factions/cmd/CmdAHome.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
|
||||||
|
public class CmdAHome extends FCommand {
|
||||||
|
|
||||||
|
public CmdAHome() {
|
||||||
|
super();
|
||||||
|
this.aliases.add("ahome");
|
||||||
|
|
||||||
|
this.requiredArgs.add("player name");
|
||||||
|
|
||||||
|
this.permission = Permission.AHOME.node;
|
||||||
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
senderMustBePlayer = false;
|
||||||
|
senderMustBeMember = false;
|
||||||
|
senderMustBeModerator = false;
|
||||||
|
senderMustBeAdmin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform() {
|
||||||
|
FPlayer target = argAsBestFPlayerMatch(0);
|
||||||
|
if (target == null) {
|
||||||
|
msg(TL.GENERIC_NOPLAYERMATCH, argAsString(0));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target.isOnline()) {
|
||||||
|
Faction faction = target.getFaction();
|
||||||
|
if (faction.hasHome()) {
|
||||||
|
target.getPlayer().teleport(faction.getHome(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
|
msg(TL.COMMAND_AHOME_SUCCESS, target.getName());
|
||||||
|
target.msg(TL.COMMAND_AHOME_TARGET);
|
||||||
|
} else {
|
||||||
|
msg(TL.COMMAND_AHOME_NOHOME, target.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
msg(TL.COMMAND_AHOME_OFFLINE, target.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_AHOME_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,7 @@ public class FCmdRoot extends FCommand {
|
|||||||
public CmdLogins cmdLogins = new CmdLogins();
|
public CmdLogins cmdLogins = new CmdLogins();
|
||||||
public CmdClaimLine cmdClaimLine = new CmdClaimLine();
|
public CmdClaimLine cmdClaimLine = new CmdClaimLine();
|
||||||
public CmdTop cmdTop = new CmdTop();
|
public CmdTop cmdTop = new CmdTop();
|
||||||
|
public CmdAHome cmdAHome = new CmdAHome();
|
||||||
|
|
||||||
public FCmdRoot() {
|
public FCmdRoot() {
|
||||||
super();
|
super();
|
||||||
@ -149,6 +150,7 @@ public class FCmdRoot extends FCommand {
|
|||||||
this.addSubCommand(this.cmdLogins);
|
this.addSubCommand(this.cmdLogins);
|
||||||
this.addSubCommand(this.cmdClaimLine);
|
this.addSubCommand(this.cmdClaimLine);
|
||||||
this.addSubCommand(this.cmdTop);
|
this.addSubCommand(this.cmdTop);
|
||||||
|
this.addSubCommand(this.cmdAHome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,7 @@ public enum Permission {
|
|||||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||||
ADMIN("admin"),
|
ADMIN("admin"),
|
||||||
ADMIN_ANY("admin.any"),
|
ADMIN_ANY("admin.any"),
|
||||||
|
AHOME("ahome"),
|
||||||
ANNOUNCE("announce"),
|
ANNOUNCE("announce"),
|
||||||
AUTOCLAIM("autoclaim"),
|
AUTOCLAIM("autoclaim"),
|
||||||
BYPASS("bypass"),
|
BYPASS("bypass"),
|
||||||
|
@ -59,6 +59,12 @@ public enum TL {
|
|||||||
COMMAND_ADMIN_PROMOTED("%1$s<i> gave %2$s<i> the leadership of %3$s<i>."),
|
COMMAND_ADMIN_PROMOTED("%1$s<i> gave %2$s<i> the leadership of %3$s<i>."),
|
||||||
COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"),
|
COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"),
|
||||||
|
|
||||||
|
COMMAND_AHOME_DESCRIPTION("Send a player to their f home no matter what."),
|
||||||
|
COMMAND_AHOME_NOHOME("%1$s doesn't have an f home."),
|
||||||
|
COMMAND_AHOME_SUCCESS("$1%s was sent to their f home."),
|
||||||
|
COMMAND_AHOME_OFFLINE("%1$s is offline."),
|
||||||
|
COMMAND_AHOME_TARGET("You were sent to your f home."),
|
||||||
|
|
||||||
COMMAND_ANNOUNCE_DESCRIPTION("Announce a message to players in faction."),
|
COMMAND_ANNOUNCE_DESCRIPTION("Announce a message to players in faction."),
|
||||||
|
|
||||||
COMMAND_AUTOCLAIM_ENABLED("<i>Now auto-claiming land for <h>%1$s<i>."),
|
COMMAND_AUTOCLAIM_ENABLED("<i>Now auto-claiming land for <h>%1$s<i>."),
|
||||||
|
@ -17,6 +17,7 @@ permissions:
|
|||||||
factions.reload: true
|
factions.reload: true
|
||||||
factions.save: true
|
factions.save: true
|
||||||
factions.modifypower: true
|
factions.modifypower: true
|
||||||
|
factions.ahome: true
|
||||||
factions.*:
|
factions.*:
|
||||||
description: This is just an alias for factions.kit.admin
|
description: This is just an alias for factions.kit.admin
|
||||||
children:
|
children:
|
||||||
@ -259,4 +260,6 @@ permissions:
|
|||||||
factions.togglealliancechat:
|
factions.togglealliancechat:
|
||||||
description: toggle alliance chat on and off
|
description: toggle alliance chat on and off
|
||||||
factions.dontlosepoweroffline:
|
factions.dontlosepoweroffline:
|
||||||
description: Don't lose power for being offline.
|
description: Don't lose power for being offline.
|
||||||
|
factions.ahome:
|
||||||
|
description: Ability to send players to their faction home.
|
Loading…
Reference in New Issue
Block a user