mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-02-16 19:51:27 +01:00
Merge branch 'development'
This commit is contained in:
commit
6547cd0181
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>skyblock</artifactId>
|
<artifactId>skyblock</artifactId>
|
||||||
<version>2.3.25</version>
|
<version>2.3.26</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -4,9 +4,16 @@ import com.songoda.core.compatibility.CompatibleSound;
|
|||||||
import com.songoda.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
import com.songoda.skyblock.confirmation.Confirmation;
|
import com.songoda.skyblock.confirmation.Confirmation;
|
||||||
|
import com.songoda.skyblock.cooldown.Cooldown;
|
||||||
|
import com.songoda.skyblock.cooldown.CooldownManager;
|
||||||
|
import com.songoda.skyblock.cooldown.CooldownPlayer;
|
||||||
|
import com.songoda.skyblock.cooldown.CooldownType;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
|
import com.songoda.skyblock.message.MessageManager;
|
||||||
import com.songoda.skyblock.playerdata.PlayerData;
|
import com.songoda.skyblock.playerdata.PlayerData;
|
||||||
|
import com.songoda.skyblock.sound.SoundManager;
|
||||||
import com.songoda.skyblock.structure.Structure;
|
import com.songoda.skyblock.structure.Structure;
|
||||||
|
import com.songoda.skyblock.utils.NumberUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
@ -19,6 +26,9 @@ public class PreviewCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommandByPlayer(Player player, String[] args) {
|
public void onCommandByPlayer(Player player, String[] args) {
|
||||||
|
CooldownManager cooldownManager = plugin.getCooldownManager();
|
||||||
|
MessageManager messageManager = plugin.getMessageManager();
|
||||||
|
SoundManager soundManager = plugin.getSoundManager();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLang = config.getFileConfiguration();
|
FileConfiguration configLang = config.getFileConfiguration();
|
||||||
@ -61,6 +71,33 @@ public class PreviewCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Do not preview if cooldown is still active
|
||||||
|
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||||
|
.getFileConfiguration().getBoolean("Island.Preview.Cooldown.Enable")
|
||||||
|
&& cooldownManager.hasPlayer(CooldownType.Preview, player)) {
|
||||||
|
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Preview, player);
|
||||||
|
Cooldown cooldown = cooldownPlayer.getCooldown();
|
||||||
|
|
||||||
|
if (cooldown.getTime() < 60) {
|
||||||
|
messageManager.sendMessage(player,
|
||||||
|
config.getFileConfiguration().getString("Island.Preview.Cooldown.Message")
|
||||||
|
.replace("%time", cooldown.getTime() + " " + config.getFileConfiguration()
|
||||||
|
.getString("Island.Preview.Cooldown.Word.Second")));
|
||||||
|
} else {
|
||||||
|
long[] durationTime = NumberUtil.getDuration(cooldown.getTime());
|
||||||
|
messageManager.sendMessage(player,
|
||||||
|
config.getFileConfiguration().getString("Island.Preview.Cooldown.Message")
|
||||||
|
.replace("%time", durationTime[2] + " "
|
||||||
|
+ config.getFileConfiguration()
|
||||||
|
.getString("Island.Preview.Cooldown.Word.Minute")
|
||||||
|
+ " " + durationTime[3] + " " + config.getFileConfiguration()
|
||||||
|
.getString("Island.Preview.Cooldown.Word.Second")));
|
||||||
|
}
|
||||||
|
|
||||||
|
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Do not preview if user has an island
|
// Do not preview if user has an island
|
||||||
if (island != null) {
|
if (island != null) {
|
||||||
plugin.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Island.Message"));
|
plugin.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Island.Message"));
|
||||||
|
@ -48,17 +48,8 @@ public class FileChecker {
|
|||||||
public void compareFiles() {
|
public void compareFiles() {
|
||||||
for (File.Type fileType : File.Type.values()) {
|
for (File.Type fileType : File.Type.values()) {
|
||||||
File file = loadedFiles.get(fileType);
|
File file = loadedFiles.get(fileType);
|
||||||
FileConfiguration configLoad = file.getFileConfiguration();
|
|
||||||
|
|
||||||
if (fileType == File.Type.CREATED) {
|
if (fileType == File.Type.RESOURCE) {
|
||||||
File resourceFile = loadedFiles.get(File.Type.RESOURCE);
|
|
||||||
|
|
||||||
for (String configKeyList : file.getKeys().keySet()) {
|
|
||||||
if (!resourceFile.getKeys().containsKey(configKeyList)) {
|
|
||||||
configLoad.set(configKeyList, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (fileType == File.Type.RESOURCE) {
|
|
||||||
File createdFile = loadedFiles.get(File.Type.CREATED);
|
File createdFile = loadedFiles.get(File.Type.CREATED);
|
||||||
FileConfiguration createdConfigLoad = createdFile.getFileConfiguration();
|
FileConfiguration createdConfigLoad = createdFile.getFileConfiguration();
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class CooldownManager {
|
|||||||
|
|
||||||
int time = 0;
|
int time = 0;
|
||||||
|
|
||||||
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
|
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion || cooldownType == CooldownType.Preview) {
|
||||||
time = this.plugin.getConfiguration()
|
time = this.plugin.getConfiguration()
|
||||||
.getInt("Island." + cooldownType.name() + ".Cooldown.Time");
|
.getInt("Island." + cooldownType.name() + ".Cooldown.Time");
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public enum CooldownType {
|
|||||||
Biome,
|
Biome,
|
||||||
Creation,
|
Creation,
|
||||||
Deletion,
|
Deletion,
|
||||||
|
Preview,
|
||||||
Levelling,
|
Levelling,
|
||||||
Ownership,
|
Ownership,
|
||||||
Teleport;
|
Teleport;
|
||||||
|
@ -397,6 +397,13 @@ public class IslandManager {
|
|||||||
data.setConfirmation(Confirmation.Preview);
|
data.setConfirmation(Confirmation.Preview);
|
||||||
data.setConfirmationTime(configMain.getInt("Island.Preview.Time"));
|
data.setConfirmationTime(configMain.getInt("Island.Preview.Time"));
|
||||||
|
|
||||||
|
|
||||||
|
FileConfiguration configLoad = this.plugin.getConfiguration();
|
||||||
|
if (configLoad.getBoolean("Island.Preview.Cooldown.Enable") && !player.hasPermission("fabledskyblock.bypass.cooldown")
|
||||||
|
&& !player.hasPermission("fabledskyblock.bypass.*") && !player.hasPermission("fabledskyblock.*")) {
|
||||||
|
plugin.getCooldownManager().createPlayer(CooldownType.Preview, player);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,6 +570,7 @@ public class IslandManager {
|
|||||||
|
|
||||||
boolean cooldownCreationEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable");
|
boolean cooldownCreationEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable");
|
||||||
boolean cooldownDeletionEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Deletion.Enable");
|
boolean cooldownDeletionEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Deletion.Enable");
|
||||||
|
boolean cooldownPreviewEnabled = configLoad.getBoolean("Island.Preview.Cooldown.Enable");
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if ((island.hasRole(IslandRole.Member, player.getUniqueId()) ||
|
if ((island.hasRole(IslandRole.Member, player.getUniqueId()) ||
|
||||||
@ -597,6 +605,11 @@ public class IslandManager {
|
|||||||
plugin.getCooldownManager().createPlayer(CooldownType.Deletion, player);
|
plugin.getCooldownManager().createPlayer(CooldownType.Deletion, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cooldownPreviewEnabled) {
|
||||||
|
if (!player.hasPermission("fabledskyblock.bypass.cooldown") && !player.hasPermission("fabledskyblock.bypass.*") && !player.hasPermission("fabledskyblock.*")) {
|
||||||
|
plugin.getCooldownManager().createPlayer(CooldownType.Preview, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InviteManager inviteManager = plugin.getInviteManager();
|
InviteManager inviteManager = plugin.getInviteManager();
|
||||||
|
@ -139,7 +139,7 @@ public class WorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ChunkGenerator getWorldGenerator(String mapName, String worldGeneratorName, IslandWorld islandWorld) {
|
private ChunkGenerator getWorldGenerator(String mapName, String worldGeneratorName, IslandWorld islandWorld) {
|
||||||
if (worldGeneratorName == null || worldGeneratorName == "default" || worldGeneratorName.length() == 0) {
|
if (worldGeneratorName == null || worldGeneratorName.equalsIgnoreCase("default") || worldGeneratorName.length() == 0) {
|
||||||
return new VoidGenerator(islandWorld);
|
return new VoidGenerator(islandWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +172,12 @@ Island:
|
|||||||
# open the Island Visit menu.
|
# open the Island Visit menu.
|
||||||
Bans: false
|
Bans: false
|
||||||
Preview:
|
Preview:
|
||||||
|
# [!] You are adviced to keep these options both enabled to prevent any issues.
|
||||||
|
Cooldown:
|
||||||
|
# When enabled, cooldown will start when a player previews an Island.
|
||||||
|
Enable: true
|
||||||
|
Time: 60
|
||||||
|
# Time until confirmation expires for island preview confirmation.
|
||||||
Time: 10
|
Time: 10
|
||||||
Visitor:
|
Visitor:
|
||||||
# When an Island is unloaded if enabled players won't be able to visit the Island
|
# When an Island is unloaded if enabled players won't be able to visit the Island
|
||||||
|
@ -3633,6 +3633,11 @@ Island:
|
|||||||
Preview:
|
Preview:
|
||||||
Timeout:
|
Timeout:
|
||||||
Message: '&bSkyBlock &8| &aInfo&8: &eYour time to preview island has expired.'
|
Message: '&bSkyBlock &8| &aInfo&8: &eYour time to preview island has expired.'
|
||||||
|
Cooldown:
|
||||||
|
Word:
|
||||||
|
Minute: minute(s)
|
||||||
|
Second: second(s)
|
||||||
|
Message: '&bSkyBlock &8| &cError&8: &eYou must wait &c&o%time &ebefore previewing an Island.'
|
||||||
Hologram:
|
Hologram:
|
||||||
Leaderboard:
|
Leaderboard:
|
||||||
Votes:
|
Votes:
|
||||||
|
Loading…
Reference in New Issue
Block a user