Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<version>3.0.0</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public abstract class ServerTutorialPoint{
protected List<String> commands;
protected List<FireWorkInfo> fireworks;
protected String message_actionBar;
protected double actionbar_show_after;
protected double actionbar_hide_after;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the java naming conventions (even though I messed up the message_actionBar variable).
So actionbarShowAfter and actionbarHideAfter.

protected PlayerTitle titleInfo;
protected PlayerSound soundInfo;
protected List<PotionEffect> pointionEffects;
Expand Down Expand Up @@ -151,9 +153,23 @@ protected void playDefault(Player player, OldValuesPlayer oldValuesPlayer, boole
//endregion

//region actionbar
if (message_actionBar != null) {
//NeedsReflection.sendActionBar(player, PluginUtils.replaceVariables(plugin.placeholderAPI, player, message_actionBar));
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(PluginUtils.replaceVariables(plugin.placeholderAPI, player, message_actionBar)));
if (message_actionBar != null && actionbar_hide_after > actionbar_show_after) {
new BukkitRunnable() {
final double showAfterTicks = actionbar_show_after * 20;
final double hideAfterTicks = actionbar_hide_after * 20;
int ticksPassed = 0;
@Override
public void run() {
if (ticksPassed >= showAfterTicks && ticksPassed < hideAfterTicks) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
new TextComponent(PluginUtils.replaceVariables(plugin.placeholderAPI, player, message_actionBar)));
} else if (ticksPassed > hideAfterTicks || ticksPassed > time * 20) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(""));
this.cancel();
}
ticksPassed += 2;
}
}.runTaskTimer(plugin, 0, 2);
}
//endregion

Expand Down Expand Up @@ -197,7 +213,9 @@ public void readSaveData(Config tutorialSaves, String ID, String i) {
message_chat = tutorialSaves.getStringList("tutorials." + ID + ".points." + i + ".messages");
commands = tutorialSaves.getStringList("tutorials." + ID + ".points." + i + ".commands");

message_actionBar = tutorialSaves.getString("tutorials." + ID + ".points." + i + ".actionbar");
message_actionBar = tutorialSaves.getString("tutorials." + ID + ".points." + i + ".actionbar.message");
actionbar_show_after = tutorialSaves.getDouble("tutorials." + ID + ".points." + i + ".actionbar.show-after", 0);
actionbar_hide_after = tutorialSaves.getDouble("tutorials." + ID + ".points." + i + ".actionbar.hide-after", time);
lockPlayer = tutorialSaves.getBoolean("tutorials." + ID + ".points." + i + ".locplayer");
lockView = tutorialSaves.getBoolean("tutorials." + ID + ".points." + i + ".locview");
flying = tutorialSaves.getBoolean("tutorials." + ID + ".points." + i + ".setFly");
Expand Down Expand Up @@ -263,7 +281,9 @@ public void saveData(Config tutorialSaves, String key, String i){
tutorialSaves.set("tutorials." + key + ".points." + i + ".locplayer", lockPlayer);
tutorialSaves.set("tutorials." + key + ".points." + i + ".locview", lockView);
tutorialSaves.set("tutorials." + key + ".points." + i + ".messages", message_chat);
tutorialSaves.set("tutorials." + key + ".points." + i + ".actionbar", message_actionBar);
tutorialSaves.set("tutorials." + key + ".points." + i + ".actionbar.message", message_actionBar);
tutorialSaves.set("tutorials." + key + ".points." + i + ".actionbar.show-after", actionbar_show_after);
tutorialSaves.set("tutorials." + key + ".points." + i + ".actionbar.hide-after", actionbar_hide_after);
tutorialSaves.set("tutorials." + key + ".points." + i + ".commands", commands);
if(flying) tutorialSaves.set("tutorials." + key + ".points." + i + ".setFly", flying);

Expand Down