mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2025-01-06 18:47:52 +01:00
added day night time, storm, rain, sun commands
This commit is contained in:
parent
32f5619fe9
commit
cdda7436db
@ -43,6 +43,17 @@ public class CommandRegistry implements CommandExecutor {
|
|||||||
case "tp":
|
case "tp":
|
||||||
return ws.tpCommand(sender, command, label, args);
|
return ws.tpCommand(sender, command, label, args);
|
||||||
//Admin Command
|
//Admin Command
|
||||||
|
case "day":
|
||||||
|
return admin.setTime(sender,0);
|
||||||
|
case "night":
|
||||||
|
return admin.setTime(sender,14000);
|
||||||
|
case "time":
|
||||||
|
return admin.setTime(sender, args[1]);
|
||||||
|
case "rain":
|
||||||
|
case "storm":
|
||||||
|
return admin.setStorm(sender,true);
|
||||||
|
case "sun":
|
||||||
|
return admin.setStorm(sender, false);
|
||||||
case "delmember":
|
case "delmember":
|
||||||
return admin.delMemberCommand(sender, command, label, args);
|
return admin.delMemberCommand(sender, command, label, args);
|
||||||
case "delete":
|
case "delete":
|
||||||
@ -66,6 +77,7 @@ public class CommandRegistry implements CommandExecutor {
|
|||||||
return settings.resetCommand(sender, command, label, args);
|
return settings.resetCommand(sender, command, label, args);
|
||||||
case "sethome":
|
case "sethome":
|
||||||
sender.sendMessage("Disabled For Major Error and Rework");
|
sender.sendMessage("Disabled For Major Error and Rework");
|
||||||
|
return false;
|
||||||
/*
|
/*
|
||||||
if (sender.hasPermission("ws.sethome")) {
|
if (sender.hasPermission("ws.sethome")) {
|
||||||
return settings.setHomeCommand(sender, command, label, args);
|
return settings.setHomeCommand(sender, command, label, args);
|
||||||
|
@ -25,6 +25,71 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class WorldAdministrateCommand {
|
public class WorldAdministrateCommand {
|
||||||
|
|
||||||
|
public boolean setTime(CommandSender sender, String ticks) {
|
||||||
|
switch (ticks) {
|
||||||
|
case "day":
|
||||||
|
return setTime(sender, 0);
|
||||||
|
case "night":
|
||||||
|
return setTime(sender, 14000);
|
||||||
|
case "dawn":
|
||||||
|
return setTime(sender, 23000);
|
||||||
|
default:
|
||||||
|
try {
|
||||||
|
return setTime(sender, Long.parseLong(ticks));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
sender.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws time [day/night/dawn/0-24000]"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setStorm(CommandSender sender, boolean storm) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("Command has to be executed as a player!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = (Player) sender;
|
||||||
|
DependenceConfig dc = new DependenceConfig(p);
|
||||||
|
if (!dc.hasWorld()) {
|
||||||
|
p.sendMessage(MessageConfig.getNoWorldOwn());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dc.getWorldname().equals(p.getWorld().getName())) {
|
||||||
|
p.getWorld().setStorm(storm);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
p.sendMessage(MessageConfig.getNoMemberOwn());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setTime(CommandSender sender, long ticks) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("Command has to be executed as a player!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = (Player) sender;
|
||||||
|
DependenceConfig dc = new DependenceConfig(p);
|
||||||
|
if (!dc.hasWorld()) {
|
||||||
|
p.sendMessage(MessageConfig.getNoWorldOwn());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dc.getWorldname().equals(p.getWorld().getName())) {
|
||||||
|
p.getWorld().setTime(ticks);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
p.sendMessage(MessageConfig.getNoMemberOwn());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean delMemberCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean delMemberCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
|
Loading…
Reference in New Issue
Block a user