ok actually done this time + jar

This commit is contained in:
ayunami2000 2022-04-21 15:15:35 -04:00
parent f450a2de5b
commit e37f74136e
3 changed files with 22 additions and 10 deletions

View File

@ -13,8 +13,8 @@ import org.bukkit.util.Vector;
public class Main extends JavaPlugin implements CommandExecutor, Listener {
//todo: add queue command + store audio loc world & dont send to players in other worlds???
//todo: or like detect where map is placed in world via entities and then per player play audio from the nearest one to them??
//todo: also when holding video map play audio at player location for that player
//todo: reload config command
public static Main plugin;
@ -36,13 +36,7 @@ public class Main extends JavaPlugin implements CommandExecutor, Listener {
public void onEnable(){
MessageHandler.initMessages();
this.saveDefaultConfig();
audioLoc.setX(this.getConfig().getDouble("audio.x"));
audioLoc.setY(this.getConfig().getDouble("audio.y"));
audioLoc.setZ(this.getConfig().getDouble("audio.z"));
mapSizeCap = this.getConfig().getInt("size.cap");
mapOffset = this.getConfig().getInt("offset");
setSize(this.getConfig().getInt("size.width"), this.getConfig().getInt("size.height"));
url = this.getConfig().getString("url");
this.rlConfig();
syncTask = this.getServer().getScheduler().scheduleSyncRepeatingTask(this, this::syncToAllPlayers, 10000, 10000); // sync every 10 seconds
this.getCommand("ayunvid").setExecutor(this);
this.getServer().getPluginManager().registerEvents(this, this);
@ -54,6 +48,16 @@ public class Main extends JavaPlugin implements CommandExecutor, Listener {
sendToAllPlayers(videoMapCodec.disableVideoBukkit());
}
private void rlConfig() {
audioLoc.setX(this.getConfig().getDouble("audio.x"));
audioLoc.setY(this.getConfig().getDouble("audio.y"));
audioLoc.setZ(this.getConfig().getDouble("audio.z"));
mapSizeCap = this.getConfig().getInt("size.cap");
mapOffset = this.getConfig().getInt("offset");
setSize(this.getConfig().getInt("size.width"), this.getConfig().getInt("size.height"));
url = this.getConfig().getString("url");
}
private void syncToPlayer(Player player) {
videoMapCodec.syncPlaybackWithPlayersBukkit().send(player);
}
@ -95,6 +99,12 @@ public class Main extends JavaPlugin implements CommandExecutor, Listener {
return true;
}
switch (args[0].toLowerCase()) {
case "rl":
case "reload":
this.reloadConfig();
this.rlConfig();
MessageHandler.sendPrefixedMessage(sender, "reloaded");
break;
case "h":
case "help":
MessageHandler.sendPrefixedMessage(sender, "usage");

View File

@ -6,6 +6,7 @@ usage:
- "&7&o/ayunvid <l|loc|location> [x y z] &3- Specify the location that the audio will come from. If no arguments are supplied, this will default to the sender's position."
- "&7&o/ayunvid <p|play|pause> &3- Toggle playback of the video. This also loads the new video after the video URL is changed."
- "&7&o/ayunvid <s|size> [<width> <height>] &3- Sets or gets the size of video, in maps. E.g., a width of 2 and a height of 3 would result in a video using 6 maps."
- "&7&o/ayunvid <rl|reload> &3- Reloads the configuration file."
currentUrl: "&3Current URL: {0}"
setUrl: "&3Successfully set URL."
locFromConsole: "&cError: You must specify the coordinates when running this command from the console!"
@ -20,3 +21,4 @@ pausing: "&3Pausing video..."
currentSize: "&3Current size: {0} maps wide by {1} maps tall ({2} maps total)"
setSize: "&3Set size to {0} maps wide by {1} maps tall ({2} maps total)"
invalidUsage: "&cError: That is not a valid subcommand! Try &n/ayunvid&c help for usage."
reloaded: "&3Successfully reloaded configuration!"