-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action Bar Show Vote Details & Bug Fix
- Loading branch information
1 parent
7675193
commit f0aa215
Showing
11 changed files
with
80 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/top/mpt/huihui/answerit/scheduler/ShowVoteProcess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package top.mpt.huihui.answerit.scheduler; | ||
|
||
import net.md_5.bungee.api.ChatMessageType; | ||
import net.md_5.bungee.api.chat.BaseComponent; | ||
import net.md_5.bungee.api.chat.TextComponent; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.scheduler.BukkitRunnable; | ||
import top.mpt.huihui.answerit.Main; | ||
import top.mpt.huihui.answerit.utils.ChatUtils; | ||
import top.mpt.huihui.answerit.utils.i18N; | ||
|
||
public class ShowVoteProcess extends BukkitRunnable { | ||
@Override | ||
public void run() { | ||
// 计算剩余投票时间 | ||
double EndTime = ((double) (Main.voteEndTime - System.currentTimeMillis()) / 1000); | ||
|
||
Bukkit.getServer().getOnlinePlayers().forEach(p ->{ | ||
if (Main.voteEndTime == 0){ | ||
BaseComponent error = new TextComponent(ChatUtils.translateColor(i18N.getLang("action_bar.error"))); | ||
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, error); | ||
this.cancel(); | ||
} | ||
else if (EndTime <= 0.0D){ | ||
this.cancel(); | ||
} | ||
else { | ||
BaseComponent base = new TextComponent(ChatUtils.translateColor(i18N.getLang("action_bar.base") | ||
, String.valueOf(EndTime), Main.voteRight, Main.voteWrong)); | ||
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, base); | ||
} | ||
|
||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters