diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 3a08d45..0c761da 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -17,8 +17,8 @@ jobs:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn --settings settings.xml deploy
- - name: Upload Artifact
- uses: actions/upload-artifact@v2-preview
- with:
- name: Harbor
- path: target/
\ No newline at end of file
+ #- name: Upload Artifact
+ # uses: actions/upload-artifact@v2-preview
+ # with:
+ # name: Harbor
+ # path: target/
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0a632aa..02a0c96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@
/.idea
*.iml
/target
+settings.json
dependency-reduced-pom.xml
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..c95e196
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,80 @@
+
+
+
+
+ Harbor - A Sleep Enhancement Plugin for Spigot
+
+
+
+
+
+
+
+
+
Harbor
+
Beta Builds
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a674310..4381109 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
xyz.nkomarn
Harbor
- 1.6.2
+ 1.6.2-SNAPSHOT
UTF-8
diff --git a/src/main/java/xyz/nkomarn/Harbor/Harbor.java b/src/main/java/xyz/nkomarn/Harbor/Harbor.java
index 3334129..fe47737 100644
--- a/src/main/java/xyz/nkomarn/Harbor/Harbor.java
+++ b/src/main/java/xyz/nkomarn/Harbor/Harbor.java
@@ -2,6 +2,7 @@ package xyz.nkomarn.Harbor;
import com.earth2me.essentials.Essentials;
import org.bukkit.Bukkit;
+import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import xyz.nkomarn.Harbor.command.HarborCommand;
import xyz.nkomarn.Harbor.listener.AfkListener;
@@ -22,9 +23,10 @@ public class Harbor extends JavaPlugin {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this,
new Checker(), 0L, Config.getInteger("values.timer") * 20);
+ final PluginManager pluginManager = getServer().getPluginManager();
getCommand("harbor").setExecutor(new HarborCommand());
- getServer().getPluginManager().registerEvents(new JoinListener(), this);
- getServer().getPluginManager().registerEvents(new BedListener(), this);
+ pluginManager.registerEvents(new JoinListener(), this);
+ pluginManager.registerEvents(new BedListener(), this);
// bStats
new Metrics(this);
diff --git a/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java b/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java
index 2e112dd..5200124 100644
--- a/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java
+++ b/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java
@@ -2,15 +2,10 @@ package xyz.nkomarn.Harbor.command;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.World;
-import org.bukkit.boss.BarColor;
-import org.bukkit.boss.BarStyle;
-import org.bukkit.boss.BossBar;
import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
@@ -33,11 +28,6 @@ public class HarborCommand implements TabExecutor {
if (args.length < 1) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + "&7Harbor version "
+ Harbor.version + " by TechToolbox (@nkomarn)."));
-
- BossBar bar = Bukkit.createBossBar("AAAAAAAAAAAA", BarColor.BLUE, BarStyle.SOLID);
- bar.setProgress(1);
- bar.addPlayer((Player) sender); // TODO remove
-
return true;
}
@@ -46,7 +36,8 @@ public class HarborCommand implements TabExecutor {
+ Config.getString("messages.miscellaneous.permission")));
return true;
}
- else if (args[0].equalsIgnoreCase("reload")) {
+
+ if (args[0].equalsIgnoreCase("reload")) {
Harbor.instance.reloadConfig();
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix
+ "&7Reloaded configuration."));
@@ -69,8 +60,6 @@ public class HarborCommand implements TabExecutor {
return true;
}
else if (args[0].equalsIgnoreCase("update")) {
-
- // Fancy actionbar stuff
if (sender instanceof Player) {
Player player = (Player) sender;
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0f, 1.0f);
diff --git a/src/main/java/xyz/nkomarn/Harbor/task/AccelerateNightTask.java b/src/main/java/xyz/nkomarn/Harbor/task/AccelerateNightTask.java
index 6bab556..90b71a7 100644
--- a/src/main/java/xyz/nkomarn/Harbor/task/AccelerateNightTask.java
+++ b/src/main/java/xyz/nkomarn/Harbor/task/AccelerateNightTask.java
@@ -16,8 +16,11 @@ public class AccelerateNightTask extends BukkitRunnable {
@Override
public void run() {
final long time = world.getTime();
- if (!(time >= 450 && time <= 1000)) {
- world.setTime(time + Config.getInteger("values.interval"));
+ final int interval = Config.getInteger("values.interval");
+ final int dayTime = Config.getInteger("values.day-time");
+
+ if (!(time >= (dayTime - interval * 2) && time <= dayTime)) {
+ world.setTime(time + interval);
} else {
// Announce night skip and clear queue
Messages.sendRandomChatMessage(world, "messages.chat.skipped");
diff --git a/src/main/java/xyz/nkomarn/Harbor/task/Checker.java b/src/main/java/xyz/nkomarn/Harbor/task/Checker.java
index b60cf1c..b3a2b78 100644
--- a/src/main/java/xyz/nkomarn/Harbor/task/Checker.java
+++ b/src/main/java/xyz/nkomarn/Harbor/task/Checker.java
@@ -4,8 +4,6 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.boss.BarColor;
-import org.bukkit.boss.BarStyle;
-import org.bukkit.boss.BossBar;
import org.bukkit.entity.Player;
import xyz.nkomarn.Harbor.Harbor;
diff --git a/src/main/java/xyz/nkomarn/Harbor/util/Afk.java b/src/main/java/xyz/nkomarn/Harbor/util/Afk.java
index c851722..20eed90 100644
--- a/src/main/java/xyz/nkomarn/Harbor/util/Afk.java
+++ b/src/main/java/xyz/nkomarn/Harbor/util/Afk.java
@@ -1,6 +1,5 @@
package xyz.nkomarn.Harbor.util;
-import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import xyz.nkomarn.Harbor.Harbor;
diff --git a/src/main/java/xyz/nkomarn/Harbor/util/Messages.java b/src/main/java/xyz/nkomarn/Harbor/util/Messages.java
index 0177852..076f2fd 100644
--- a/src/main/java/xyz/nkomarn/Harbor/util/Messages.java
+++ b/src/main/java/xyz/nkomarn/Harbor/util/Messages.java
@@ -8,7 +8,6 @@ import org.bukkit.World;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
-import org.bukkit.entity.Player;
import xyz.nkomarn.Harbor.Harbor;
import xyz.nkomarn.Harbor.task.Checker;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 1ad234d..3cdb3fa 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -12,6 +12,7 @@ values:
timer: 2 # How often (in seconds) to run the clock task (used to detect sleep, AFK players, time actionbar, etc.)
percent: 50 # Percent of players that need to sleep to skip night (must be between 0 to 100)
interval: 60 # Time skip interval that is added when the night is accelerated.
+ day-time: 1000 # Time (in ticks) that Harbor considers as day
timeout: 15 # Time (in minutes) until a player is considered AFK (for internal AFK detection system only- when Essentials isn't present)
features:
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index a53ff98..30cebb4 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,7 +1,7 @@
name: Harbor
description: Harbor is a Spigot plugin that redefines how sleep works in your server, making it easier for all the online players to get in bed quickly and skip through the night!
main: xyz.nkomarn.Harbor.Harbor
-version: 1.6.2
+version: 1.6.2-SNAPSHOT
author: TechToolbox (@nkomarn)
website: https://nkomarn.xyz
softdepend: [Essentials, PlaceholderAPI]