mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Close #115, Add option to disable /back in config
This commit is contained in:
1 parent
207ab33c66
commit
82878092e3
3 files changed
+20
-7
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package me.william278.huskhomes2.commands;
|
||||
|
||||
import me.william278.huskhomes2.HuskHomes;
|
||||
import me.william278.huskhomes2.MessageManager;
|
||||
import me.william278.huskhomes2.teleport.TeleportManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -16,12 +17,16 @@ public class BackCommand extends CommandBase {
|
||||
|
||||
@Override
|
||||
protected void onCommand(Player p, Command command, String label, String[] args) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
TeleportManager.queueBackTeleport(p, connection);
|
||||
} catch (SQLException e) {
|
||||
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting you back");
|
||||
}
|
||||
});
|
||||
if (HuskHomes.getSettings().getDoBackCommand()) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
TeleportManager.queueBackTeleport(p, connection);
|
||||
} catch (SQLException e) {
|
||||
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting you back");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageManager.sendMessage(p, "error_command_disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,9 @@ public class Settings {
|
||||
private int teleportWarmupTime;
|
||||
private DisplayStyle teleportWarmupDisplayStyle;
|
||||
|
||||
// Back command
|
||||
private boolean doBackCommand;
|
||||
|
||||
// Sounds
|
||||
private Sound teleportationCompleteSound;
|
||||
private Sound teleportWarmupSound;
|
||||
@@ -254,6 +257,8 @@ public class Settings {
|
||||
this.rtpRange = config.getInt("random_teleport_command.range", 5000);
|
||||
this.rtpCoolDown = config.getInt("random_teleport_command.cooldown", 30);
|
||||
|
||||
this.doBackCommand = config.getBoolean("general.enable_back_command", true);
|
||||
|
||||
this.privateHomesPerPage = config.getInt("general.lists.private_homes_per_page", 10);
|
||||
this.publicHomesPerPage = config.getInt("general.lists.public_homes_per_page", 10);
|
||||
this.warpsPerPage = config.getInt("general.lists.warps_per_page", 10);
|
||||
@@ -504,6 +509,8 @@ public class Settings {
|
||||
return redisPassword;
|
||||
}
|
||||
|
||||
public boolean getDoBackCommand() { return doBackCommand; }
|
||||
|
||||
public int getHikariMaximumPoolSize() {
|
||||
return hikariMaximumPoolSize;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ general:
|
||||
teleport_warmup_display: ACTION_BAR
|
||||
teleport_request_expiry_time: 60
|
||||
allow_unicode_descriptions: true
|
||||
enable_back_command: true
|
||||
sounds:
|
||||
teleportation_complete: 'ENTITY_ENDERMAN_TELEPORT'
|
||||
teleportation_warmup: 'BLOCK_NOTE_BLOCK_BANJO'
|
||||
|
||||
Reference in new issue
Block a user