mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
25 files changed
+51
-54
No files matched your search
@@ -24,7 +24,7 @@ public class DelWarpCommand extends SavedPositionCommand<Warp> {
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull CommandUser executor, @NotNull Warp warp, @NotNull String[] args) {
|
||||
if (plugin.getSettings().isPermissionRestrictWarps() && !executor.hasPermission(warp.getPermission())
|
||||
if (plugin.getSettings().doPermissionRestrictWarps() && !executor.hasPermission(warp.getPermission())
|
||||
&& !executor.hasPermission(Warp.getWildcardPermission())) {
|
||||
plugin.getLocales().getLocale("error_no_permission")
|
||||
.ifPresent(executor::sendMessage);
|
||||
|
||||
@@ -227,13 +227,12 @@ public class EditHomeCommand extends SavedPositionCommand<Home> {
|
||||
|
||||
if (home.getMeta().getDescription().length() > 0) {
|
||||
plugin.getLocales().getLocale("edit_home_menu_description",
|
||||
home.getMeta().getDescription().length() > 50
|
||||
? home.getMeta().getDescription().substring(0, 49).trim() + "…" : home.getMeta().getDescription(),
|
||||
plugin.getLocales().truncateText(home.getMeta().getDescription(), 50),
|
||||
plugin.getLocales().wrapText(home.getMeta().getDescription(), 40))
|
||||
.ifPresent(this::add);
|
||||
}
|
||||
|
||||
if (!plugin.getSettings().isCrossServer()) {
|
||||
if (!plugin.getSettings().doCrossServer()) {
|
||||
plugin.getLocales().getLocale("edit_home_menu_world", home.getWorld().getName())
|
||||
.ifPresent(this::add);
|
||||
} else {
|
||||
|
||||
@@ -135,13 +135,12 @@ public class EditWarpCommand extends SavedPositionCommand<Warp> {
|
||||
|
||||
if (warp.getMeta().getDescription().length() > 0) {
|
||||
plugin.getLocales().getLocale("edit_warp_menu_description",
|
||||
warp.getMeta().getDescription().length() > 50
|
||||
? warp.getMeta().getDescription().substring(0, 49).trim() + "…" : warp.getMeta().getDescription(),
|
||||
plugin.getLocales().truncateText(warp.getMeta().getDescription(), 50),
|
||||
plugin.getLocales().wrapText(warp.getMeta().getDescription(), 40))
|
||||
.ifPresent(this::add);
|
||||
}
|
||||
|
||||
if (!plugin.getSettings().isCrossServer()) {
|
||||
if (!plugin.getSettings().doCrossServer()) {
|
||||
plugin.getLocales().getLocale("edit_warp_menu_world", warp.getWorld().getName()).ifPresent(this::add);
|
||||
} else {
|
||||
plugin.getLocales().getLocale("edit_warp_menu_world_server", warp.getWorld().getName(), warp.getServer()).ifPresent(this::add);
|
||||
|
||||
@@ -97,9 +97,8 @@ public class HuskHomesCommand extends Command implements TabProvider {
|
||||
.filter(command -> user.hasPermission(command.getPermission()))
|
||||
.map(command -> plugin.getLocales().getRawLocale("command_list_item",
|
||||
Locales.escapeText(command.getName()),
|
||||
Locales.escapeText(command.getDescription().length() > 50
|
||||
? command.getDescription().substring(0, 49).trim() + "…"
|
||||
: command.getDescription()),
|
||||
Locales.escapeText(plugin.getLocales()
|
||||
.truncateText(command.getDescription(), 50)),
|
||||
Locales.escapeText(plugin.getLocales()
|
||||
.wrapText(command.getUsage() + "\n" + command.getDescription(), 40)))
|
||||
.orElse(command.getName()))
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class SavedPositionCommand<T extends SavedPosition> extends Comm
|
||||
|
||||
private Optional<Warp> resolveWarp(@NotNull CommandUser executor, @NotNull String warpName) {
|
||||
final Optional<Warp> warp = plugin.getDatabase().getWarp(warpName);
|
||||
if (warp.isPresent() && executor instanceof OnlineUser user && plugin.getSettings().isPermissionRestrictWarps()
|
||||
if (warp.isPresent() && executor instanceof OnlineUser user && plugin.getSettings().doPermissionRestrictWarps()
|
||||
&& (!user.hasPermission(Warp.getWildcardPermission()) && !user.hasPermission(Warp.getPermission(warpName)))) {
|
||||
plugin.getLocales().getLocale("error_warp_invalid", warpName)
|
||||
.ifPresent(executor::sendMessage);
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SetSpawnCommand extends InGameCommand {
|
||||
public void execute(@NotNull OnlineUser executor, @NotNull String[] args) {
|
||||
final Position position = executor.getPosition();
|
||||
try {
|
||||
if (plugin.getSettings().isCrossServer() && plugin.getSettings().isGlobalSpawn()) {
|
||||
if (plugin.getSettings().doCrossServer() && plugin.getSettings().isGlobalSpawn()) {
|
||||
final String warpName = plugin.getSettings().getGlobalSpawnName();
|
||||
plugin.getManager().warps().createWarp(warpName, position, true);
|
||||
plugin.getLocales().getRawLocale("spawn_warp_default_description")
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TpAllCommand extends InGameCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getSettings().isCrossServer()) {
|
||||
if (plugin.getSettings().doCrossServer()) {
|
||||
Message.builder()
|
||||
.target(Message.TARGET_ALL)
|
||||
.type(Message.Type.TELEPORT_TO_POSITION)
|
||||
|
||||
@@ -27,7 +27,7 @@ public class WarpCommand extends SavedPositionCommand<Warp> {
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull CommandUser executor, @NotNull Warp warp, @NotNull String[] args) {
|
||||
if (plugin.getSettings().isPermissionRestrictWarps()) {
|
||||
if (plugin.getSettings().doPermissionRestrictWarps()) {
|
||||
if (!executor.hasPermission(warp.getPermission()) && !executor.hasPermission(Warp.getWildcardPermission())) {
|
||||
plugin.getLocales().getLocale("error_no_permission")
|
||||
.ifPresent(executor::sendMessage);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class WarpListCommand extends ListCommand {
|
||||
@NotNull
|
||||
private List<Warp> getItems(@NotNull CommandUser executor) {
|
||||
List<Warp> warps = plugin.getDatabase().getWarps();
|
||||
if (plugin.getSettings().isPermissionRestrictWarps() && !executor.hasPermission(Warp.getWildcardPermission())) {
|
||||
if (plugin.getSettings().doPermissionRestrictWarps() && !executor.hasPermission(Warp.getWildcardPermission())) {
|
||||
warps = warps.stream()
|
||||
.filter(warp -> executor.hasPermission(getPermission(warp.getPermission())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Reference in new issue
Block a user