mirror of
https://github.com/nkomarn/harbor.git
synced 2024-11-16 07:05:22 +01:00
🌓 Day time configurable in ticks
This commit is contained in:
parent
3166780468
commit
ebdfb175ca
10
.github/workflows/maven.yml
vendored
10
.github/workflows/maven.yml
vendored
@ -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/
|
||||
#- name: Upload Artifact
|
||||
# uses: actions/upload-artifact@v2-preview
|
||||
# with:
|
||||
# name: Harbor
|
||||
# path: target/
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,4 +5,5 @@
|
||||
/.idea
|
||||
*.iml
|
||||
/target
|
||||
settings.json
|
||||
dependency-reduced-pom.xml
|
80
docs/index.html
Normal file
80
docs/index.html
Normal file
@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Harbor - A Sleep Enhancement Plugin for Spigot</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
|
||||
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css?family=Karla:400,700&display=swap');
|
||||
|
||||
* {
|
||||
font-family: 'Karla', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #F5F5F5;
|
||||
padding: 4em 0;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 7em;
|
||||
padding-right: 1em;
|
||||
padding-bottom: 1em;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.beta-builds {
|
||||
font-weight: 700;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.heading {
|
||||
padding-bottom: 4em;
|
||||
}
|
||||
|
||||
.code-block {
|
||||
padding: 1em;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="heading">
|
||||
<img class="logo" src="https://github.com/nkomarn/SpigotImages/blob/master/Harbor/Icon.png?raw=true">
|
||||
<h3 style="padding: 0; margin: 0; padding-top: 0.3em;">Harbor</h3>
|
||||
<h3 class="beta-builds">Beta Builds</h3>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Build</th>
|
||||
<th scope="col">Released</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://pkg.githubusercontent.com/150201575/13dfbd80-618b-11ea-89f4-eed0e81592cf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200308%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200308T225714Z&X-Amz-Expires=300&X-Amz-Signature=62046650b9a50d50e3dd5a0cf48c076a44bebe3924e226fd0eae839dd3611e25&X-Amz-SignedHeaders=host&actor_id=22900187&response-content-disposition=filename%3DHarbor-1.6.2.jar&response-content-type=application%2Foctet-stream">Harbor 1.6.2 Beta 2</a></td>
|
||||
<td>3/8/2020</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
|
||||
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
|
||||
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
|
||||
crossorigin="anonymous"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>xyz.nkomarn</groupId>
|
||||
<artifactId>Harbor</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<version>1.6.2-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package xyz.nkomarn.Harbor.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import xyz.nkomarn.Harbor.Harbor;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user