mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-11-05 18:31:40 +01:00
Fix a bug with the '/as settp' command not accepting arguments
The command would always try to detect regions at the location you are standing and would not consider the region argument.
This commit is contained in:
parent
715bbfd9e3
commit
40338b66df
@ -45,19 +45,28 @@ public class SetteleportCommand extends CommandAreaShop {
|
||||
plugin.message(sender, "onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
Player player = (Player)sender;
|
||||
GeneralRegion region = null;
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
if(args.length < 2) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
region = plugin.getFileManager().getRegion(args[1]);
|
||||
}
|
||||
|
||||
boolean owner = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user