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>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/tenkumaLib"/>
|
<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"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</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.
19
plugin.yml
Normal file → Executable file
19
plugin.yml
Normal file → Executable file
|
|
@ -1,6 +1,13 @@
|
||||||
author: tenkuma
|
author: tenkuma
|
||||||
database: false
|
main: gd.rf.adrianvictor.stuff.GhostsAndStuff
|
||||||
main: gd.rf.adrianvictor.stuff.GhostsAndStuff
|
name: GhostsAndStuff
|
||||||
name: GhostsAndStuff
|
url: https://adrianvictor.rf.gd
|
||||||
url: https://adrianvictor.rf.gd
|
version: '0.5'
|
||||||
version: '1.1'
|
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
|
||||||
118
src/gd/rf/adrianvictor/stuff/GhostsAndStuff.java
Normal file → Executable file
118
src/gd/rf/adrianvictor/stuff/GhostsAndStuff.java
Normal file → Executable file
|
|
@ -1,58 +1,60 @@
|
||||||
package gd.rf.adrianvictor.stuff;
|
package gd.rf.adrianvictor.stuff;
|
||||||
|
|
||||||
import gd.rf.adrianvictor.lib.ConfigurationEx;
|
import gd.rf.adrianvictor.lib.ConfigurationEx;
|
||||||
import gd.rf.adrianvictor.lib.Log;
|
import gd.rf.adrianvictor.stuff.command.*;
|
||||||
import org.bukkit.event.Event.Priority;
|
import gd.rf.adrianvictor.lib.Log;
|
||||||
import org.bukkit.event.Event.Type;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.Event.Type;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import java.util.List;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import java.util.List;
|
||||||
public class GhostsAndStuff extends JavaPlugin {
|
|
||||||
ConfigurationEx config;
|
public class GhostsAndStuff extends JavaPlugin {
|
||||||
PluginManager pm;
|
ConfigurationEx config;
|
||||||
Log logger;
|
PluginManager pm;
|
||||||
|
Log logger;
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
@Override
|
||||||
logger.info("is being disabled.");
|
public void onDisable() {
|
||||||
}
|
logger.info("is being disabled.");
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
@Override
|
||||||
logger = new Log(this);
|
public void onEnable() {
|
||||||
pm = this.getServer().getPluginManager();
|
logger = new Log(this);
|
||||||
config = new ConfigurationEx(this, "config.yml", logger);
|
pm = this.getServer().getPluginManager();
|
||||||
config.loadConfig();
|
config = new ConfigurationEx(this, "config.yml", logger);
|
||||||
loadModules();
|
config.loadConfig();
|
||||||
logger.info("is starting.");
|
this.getCommand("gettime").setExecutor(new GetTime());
|
||||||
}
|
loadModules();
|
||||||
public void loadModules() {
|
logger.info("is starting.");
|
||||||
|
}
|
||||||
// AntiSpam
|
public void loadModules() {
|
||||||
if (this.getConfiguration().getBoolean("antiSpam", true)) {
|
|
||||||
PlayerListener antiSpam = new AntiSpam(this);
|
// AntiSpam
|
||||||
pm.registerEvent(Type.PLAYER_CHAT, antiSpam, Priority.High, this);
|
if (this.getConfiguration().getBoolean("antiSpam", true)) {
|
||||||
}
|
PlayerListener antiSpam = new AntiSpam(this);
|
||||||
|
pm.registerEvent(Type.PLAYER_CHAT, antiSpam, Priority.High, this);
|
||||||
// RainbowChat
|
}
|
||||||
if (this.getConfiguration().getBoolean("rainbowChat", true)) {
|
|
||||||
PlayerListener rainbowChat = new RainbowChat(this);
|
// RainbowChat
|
||||||
logger.info("Loading module RainbowChat");
|
if (this.getConfiguration().getBoolean("rainbowChat", true)) {
|
||||||
pm.registerEvent(Type.PLAYER_CHAT, rainbowChat, Priority.High, this);
|
PlayerListener rainbowChat = new RainbowChat(this);
|
||||||
}
|
logger.info("Loading module RainbowChat");
|
||||||
|
pm.registerEvent(Type.PLAYER_CHAT, rainbowChat, Priority.High, this);
|
||||||
// SkibidiBlocker
|
}
|
||||||
if (this.getConfiguration().getBoolean("skibidiBlocker", true)) {
|
|
||||||
logger.info("Loading module SkibidiBlocker");
|
// SkibidiBlocker
|
||||||
List<String> words = this.getConfiguration().getStringList("skibidiBlockerWords", null);
|
if (this.getConfiguration().getBoolean("skibidiBlocker", true)) {
|
||||||
if (words == null || words.isEmpty()) {
|
logger.info("Loading module SkibidiBlocker");
|
||||||
logger.warning("SkibidiBlocker is enabled, but no words were provided. Disabling.");
|
List<String> words = this.getConfiguration().getStringList("skibidiBlockerWords", null);
|
||||||
} else {
|
if (words == null || words.isEmpty()) {
|
||||||
PlayerListener verboseWorldChange = new SkibidiBlocker(this, logger);
|
logger.warning("SkibidiBlocker is enabled, but no words were provided. Disabling.");
|
||||||
pm.registerEvent(Type.PLAYER_CHAT, verboseWorldChange, Priority.High, this);
|
} else {
|
||||||
}
|
PlayerListener verboseWorldChange = new SkibidiBlocker(this, logger);
|
||||||
}
|
pm.registerEvent(Type.PLAYER_CHAT, verboseWorldChange, Priority.High, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
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