mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 09:05:47 +00:00
added a player parameter to locations command
This commit is contained in:
parent
e31194c5b3
commit
b6e42c1277
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>3.1.0-3</version>
|
||||
<version>3.1.0-4</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
@ -23,7 +23,7 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
|
||||
return "location";
|
||||
}
|
||||
|
||||
//rtp location <location name>
|
||||
//rtp location <location name> [player]
|
||||
public void execute(CommandSender sendi, String label, String[] args) {
|
||||
if (args.length == 2) {
|
||||
if (sendi instanceof Player) {
|
||||
@ -38,6 +38,21 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
|
||||
usage(sendi, label);
|
||||
} else
|
||||
sendi.sendMessage("Console is not able to execute this command! Try '/rtp help'");
|
||||
} else if (args.length == 3 && BetterRTP.getInstance().getPerms().getRtpOther(sendi)) {
|
||||
Player p = Bukkit.getPlayer(args[2]);
|
||||
if (p != null && p.isOnline()) {
|
||||
for (String location_name : getLocations().keySet()) {
|
||||
if (location_name.equalsIgnoreCase(args[1].toLowerCase())) {
|
||||
BetterRTP.getInstance().getCmd().tp(p, sendi, null, null, RTP_TYPE.COMMAND,
|
||||
false, false, (WorldLocations) getLocations().get(location_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
usage(sendi, label);
|
||||
} else if (p != null)
|
||||
getCmd().playerNotOnline(sendi, args[1]);
|
||||
else
|
||||
usage(sendi, label);
|
||||
} else
|
||||
usage(sendi, label);
|
||||
}
|
||||
@ -48,6 +63,10 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
|
||||
for (String location_name : getLocations().keySet())
|
||||
if (location_name.toLowerCase().startsWith(args[1].toLowerCase()))
|
||||
list.add(location_name);
|
||||
} else if (args.length == 3 && BetterRTP.getInstance().getPerms().getRtpOther(sendi)) {
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
if (p.getName().toLowerCase().startsWith(args[2].toLowerCase()))
|
||||
list.add(p.getName());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -64,6 +83,10 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
|
||||
return BetterRTP.getInstance().getRTP().worldLocations;
|
||||
}
|
||||
|
||||
private Commands getCmd() {
|
||||
return BetterRTP.getInstance().getCmd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return BetterRTP.getInstance().getText().getHelpLocation();
|
||||
|
@ -1,5 +1,5 @@
|
||||
main: me.SuperRonanCraft.BetterRTP.BetterRTP
|
||||
version: '3.1.0-3'
|
||||
version: '3.1.0-4'
|
||||
name: BetterRTP
|
||||
author: SuperRonanCraft
|
||||
softdepend:
|
||||
|
Loading…
x
Reference in New Issue
Block a user