Skip to content

Commit 3ea3c0e

Browse files
authored
Merge pull request #39 from lumi-git/develop
Develop
2 parents 7168034 + 23f2492 commit 3ea3c0e

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>fr</groupId>
88
<artifactId>AutoCommand</artifactId>
9-
<version>1.5.8</version>
9+
<version>1.5.9</version>
1010
<packaging>jar</packaging>
1111

1212
<repositories>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package fr.lumi.Commandes;
2+
3+
import fr.lumi.Main;
4+
import org.bukkit.Bukkit;
5+
import org.bukkit.command.Command;
6+
import org.bukkit.command.CommandExecutor;
7+
import org.bukkit.command.CommandSender;
8+
9+
import java.time.ZoneId;
10+
import java.util.Date;
11+
12+
public class CommandRunnerTime implements CommandExecutor {
13+
14+
Main plugin;
15+
16+
public CommandRunnerTime(Main plg) {
17+
18+
plugin = plg;
19+
}
20+
21+
@Override
22+
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
23+
Date dateInput = new Date();
24+
int Hours = dateInput.toInstant().atZone(ZoneId.systemDefault()).getHour();
25+
int minutes = dateInput.toInstant().atZone(ZoneId.systemDefault()).getMinute();
26+
String hour;
27+
String minute;
28+
if (Hours < 10) hour = "0" + Hours;
29+
else hour = "" + Hours;
30+
if (minutes < 10) minute = "0" + minutes;
31+
else minute = "" + minutes;
32+
String HourString = hour + "H" + minute;
33+
Bukkit.getConsoleSender().sendMessage(plugin.getUt().replacePlaceHoldersForConsolePlgVar("It is " + HourString));
34+
sender.sendMessage(plugin.getUt().replacePlaceHoldersForPlayerPlgVar("It is " + HourString));
35+
return true;
36+
}
37+
}

src/main/java/fr/lumi/Main.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
import com.google.gson.JsonElement;
55
import com.google.gson.JsonObject;
66
import fr.lumi.CommandPatternObject.Command;
7-
import fr.lumi.Commandes.CommandRunnerCommand;
8-
import fr.lumi.Commandes.CommandRunnerEditor;
9-
import fr.lumi.Commandes.CommandRunnerHelp;
7+
import fr.lumi.Commandes.*;
108
import fr.lumi.Metrics.Metrics;
11-
import fr.lumi.Commandes.CommandRunnerReload;
129
import fr.lumi.FileVerifiers.ConfigFileVerification;
1310
import fr.lumi.FileVerifiers.LangFileVerification;
1411
import fr.lumi.Util.*;
@@ -278,7 +275,7 @@ public boolean Load() {
278275
Objects.requireNonNull(this.getCommand("acmdhelp")).setExecutor(new CommandRunnerHelp(this));
279276
Objects.requireNonNull(this.getCommand("acmd")).setExecutor(new CommandRunnerCommand(this));
280277
Objects.requireNonNull(this.getCommand("acmdreload")).setExecutor(new CommandRunnerReload(this));
281-
278+
Objects.requireNonNull(this.getCommand("acmdTime")).setExecutor(new CommandRunnerTime(this));
282279
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("ConsolePrefix") + "&e-Loading " + getCommandsConfig().getKeys(false).size() + " AutoComands-"));
283280

284281
//loading the commands in the plugin

src/main/java/fr/lumi/Util/autocommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public autocommand(Main plg) {
4141

4242
public void setRunning(boolean state, FileConfiguration config) {
4343
m_running = state;
44-
config.set(ID + ".running", m_running);
44+
config.set(ID + ".TaskParameters.running", m_running);
4545

4646
saveInConfig(config);
4747
addToScheduler();

src/main/resources/plugin.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
name: AutoCommands
2-
version: 1.5.8
2+
version: 1.5.9
33
main: fr.lumi.Main
44
api-version: 1.15
55
authors:
66
- Lumi_
77
- Adi_
8-
prefix: AutoCommands 1.5.8
9-
loadbefore:
10-
- PlaceholderAPI
11-
- essentials
12-
softdepend: [PlaceholderAPI]
8+
prefix: AutoCommands 1.5.9
9+
depends: [PlaceholderAPI]
1310
permissions:
1411
acmd.*:
1512
description: give access to all the plugin
@@ -52,3 +49,11 @@ commands:
5249
main command of the plugin
5350
permission: acmd.admin
5451
permission-message: Sorry, you dont are not allowed to do this
52+
53+
acmdTime:
54+
usage:
55+
Bad usage of this command, please verify your command ID or your syntax.
56+
description:
57+
Gives you the real server time
58+
permission: acmd.admin
59+
permission-message: Sorry, you dont are not allowed to do this

0 commit comments

Comments
 (0)