Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gk0Wk committed Mar 26, 2021
1 parent 09a44f0 commit cc1a0b3
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 106 deletions.
104 changes: 1 addition & 103 deletions .gitignore
@@ -1,113 +1,11 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

target/

pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next

release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml

# Common working directory
run/
41 changes: 41 additions & 0 deletions MCron.iml
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.14-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" name="Maven: co.aikar:acf-paper:0.5.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.NewNanCity:Violet:1.0.5" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:20.1.0" level="project" />
<orderEntry type="library" name="Maven: me.lucko:helper:5.6.5" level="project" />
<orderEntry type="library" name="Maven: me.lucko:shadow-bukkit:1.6" level="project" />
<orderEntry type="library" name="Maven: me.lucko:shadow:1.3" level="project" />
<orderEntry type="library" name="Maven: com.flowpowered:flow-math:1.0.3" level="project" />
<orderEntry type="library" name="Maven: net.jodah:expiringmap:0.5.8" level="project" />
<orderEntry type="library" name="Maven: net.kyori:event-api:3.0.0" level="project" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.5.4" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
</component>
</module>
72 changes: 70 additions & 2 deletions README.md
@@ -1,2 +1,70 @@
# MCron
Command scheduler. Just works like cron on Linux.
# MCron [![](https://img.shields.io/badge/Join-NewNanCity-yellow)](https://www.newnan.city)

Command scheduler for minecraft server **(now only support Bukkit/Spigot/Paper)**. Just works like cron on Linux.

---

I made this wheel because bukkit's scheduler may not work in time for using tick for time. For instance, if TPS of the server always fails reaching 20.0, then the delay of tasks may take more time than expected.

Besides, many of current plugins are implemented with ticks counting.

I need some tool to help server managers to create schedule tasks in simple way. It should be punctual, and powerful. Then I think of cron, a schedule tool in linux.

I copied the syntax of cron, add a second part to support second-level schedule. The syntax looks like this:

```
[second] [minute] [hour] [dayOfMonth] [month] [dayOfWeek] (year)
```

## second

Example:

* `1` means run at second 1.
* `3,5,8-12` means `3,5,8,9,10,11,12`
* `*` means `0-59`
* `*/4` means `0,4,8,12,16,20,24,28,32,36,40,44,48,52,56`
* `*/2`, `*/3`, `*/4`, `*/5`, `*/6`, `*/10`, `*/12`, `*/15`, `*/20`, `*/30` is legal.

## minute

Same as second.

## hour

Familiar with second and minute.

## day of month

Familiar with second, minute and hour, but also support some special usage:

* `W` means the first weekday of this month.
* `L` means the last day of this month.

## month

Familiar with second, minute and hour, but also accept words along with numbers. For example:

* `jan`, `JAN`, `Jan`, `January`, `1` are same.

## day of week

Familiar with second, minute and hour, but also accept words along with numbers:

* `mon`, `MON`, `Mon`, `Monday`, `1` are same.
* `0` and `7` are both stand for Sunday.

Along with some special usage:

* `wed#3` means the third wednesday of this month.

## year (optional)

Year part is optional. If it doesn't exist, it means `*`.


# How it works

Mode 1: Virtual Wheels Tick. `tickOne` to find next available time.

Mode 2: Rapid Locate. Using when initializing.
6 changes: 5 additions & 1 deletion pom.xml
Expand Up @@ -75,6 +75,10 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -93,7 +97,7 @@
<dependency>
<groupId>com.github.NewNanCity</groupId>
<artifactId>Violet</artifactId>
<version>1.0.4</version>
<version>1.0.5</version>
</dependency>
</dependencies>
</project>

0 comments on commit cc1a0b3

Please sign in to comment.