Added command /gettime that returns the game time converted to real life time format.
This commit is contained in:
parent
6fc6fb67cf
commit
023106b3bc
6 changed files with 115 additions and 65 deletions
|
|
@ -7,6 +7,6 @@
|
|||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/tenkumaLib"/>
|
||||
<classpathentry kind="lib" path="E:/craftbukkit-1060.jar"/>
|
||||
<classpathentry kind="lib" path="/home/adrian/archive/minecraft-jar/craftbukkit-1060.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
14
ascii.txt
Normal file
14
ascii.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
XXXXXXXXX
|
||||
XXX XXX
|
||||
XX XX
|
||||
X XXX
|
||||
X XXX X X
|
||||
X X X XXX X
|
||||
X X X X
|
||||
X X X XXXX X
|
||||
X XXX XXXXXX XX X
|
||||
X XXXX X X
|
||||
XX XXXX XX XX
|
||||
XXX XXXX XXX
|
||||
XXXXXXXXX
|
||||
ghosts 'n stuff
|
||||
Binary file not shown.
11
plugin.yml
Normal file → Executable file
11
plugin.yml
Normal file → Executable file
|
|
@ -1,6 +1,13 @@
|
|||
author: tenkuma
|
||||
database: false
|
||||
main: gd.rf.adrianvictor.stuff.GhostsAndStuff
|
||||
name: GhostsAndStuff
|
||||
url: https://adrianvictor.rf.gd
|
||||
version: '1.1'
|
||||
version: '0.5'
|
||||
commands:
|
||||
gettime:
|
||||
description: Prints the time for the current world.
|
||||
usage: /gettime
|
||||
permissions:
|
||||
ghosts.gettime:
|
||||
description: Allows the player to use the gettime command"
|
||||
default: true
|
||||
2
src/gd/rf/adrianvictor/stuff/GhostsAndStuff.java
Normal file → Executable file
2
src/gd/rf/adrianvictor/stuff/GhostsAndStuff.java
Normal file → Executable file
|
|
@ -1,6 +1,7 @@
|
|||
package gd.rf.adrianvictor.stuff;
|
||||
|
||||
import gd.rf.adrianvictor.lib.ConfigurationEx;
|
||||
import gd.rf.adrianvictor.stuff.command.*;
|
||||
import gd.rf.adrianvictor.lib.Log;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Type;
|
||||
|
|
@ -25,6 +26,7 @@ public class GhostsAndStuff extends JavaPlugin {
|
|||
pm = this.getServer().getPluginManager();
|
||||
config = new ConfigurationEx(this, "config.yml", logger);
|
||||
config.loadConfig();
|
||||
this.getCommand("gettime").setExecutor(new GetTime());
|
||||
loadModules();
|
||||
logger.info("is starting.");
|
||||
}
|
||||
|
|
|
|||
27
src/gd/rf/adrianvictor/stuff/command/GetTime.java
Executable file
27
src/gd/rf/adrianvictor/stuff/command/GetTime.java
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
package gd.rf.adrianvictor.stuff.command;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import gd.rf.adrianvictor.lib.Color;
|
||||
public class GetTime implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("gettime")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
long totalTicks = player.getWorld().getTime();
|
||||
int totalMinutes = (int) (totalTicks * 1440 / 24000);
|
||||
int hours = (totalMinutes / 60) + 6;
|
||||
int minutes = totalMinutes % 60;
|
||||
|
||||
sender.sendMessage(Color.formatColors("The time for " + player.getWorld().getName() + " is &a" + hours + " hours &rand &a" + minutes + " minutes &r(&a" + player.getWorld().getTime() + " ticks&r)"));
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue