adding tutorial sounds and flag for it.

This commit is contained in:
Sarah 2015-12-02 19:39:44 +01:00
parent e2cfcef55b
commit 27f335779a
3 changed files with 28 additions and 2 deletions

View File

@ -32,6 +32,7 @@ public abstract class GameTutorial
public boolean SetTutorialPositions = true;
public boolean TeleportOnEnd = true;
public boolean RunTasksSync = true;
public boolean PlayTutorialSounds = false;
public long TimeBetweenPhase = 0;
public long StartAfterTutorial = 5000;

View File

@ -4,6 +4,7 @@ import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilTextMiddle;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@ -121,6 +122,11 @@ public abstract class TutorialPhase
int i = 0;
for(Player player : _tutorial.getPlayers().keySet())
{
if(_tutorial.PlayTutorialSounds)
{
if(text.getSound() != null)
player.playSound(player.getLocation(), text.getSound(), 2f, 2f);
}
players[i] = player;
i++;
}

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.gametutorial;
import org.bukkit.Sound;
public class TutorialText
{
@ -7,17 +9,29 @@ public class TutorialText
private String _text;
private int _stayTime;
private int _id;
private Sound _sound;
public TutorialText(String text, int stayTime, int id)
public TutorialText(String text, int stayTime, int id, Sound sound)
{
_text = text;
_id = id;
_stayTime = stayTime;
_sound = sound;
}
public TutorialText(String text, int id)
{
this(text, (int) (Math.round(1.5 * text.length()) + 25), id);
this(text, (int) (Math.round(1.5 * text.length()) + 25), id, Sound.NOTE_PLING);
}
public TutorialText(String text, int id, Sound sound)
{
this(text, (int) (Math.round(1.5 * text.length()) + 25), id, sound);
}
public TutorialText(String text, int stayTime, int id)
{
this(text, stayTime, id, Sound.NOTE_PLING);
}
public String getText()
@ -30,6 +44,11 @@ public class TutorialText
return _id;
}
public Sound getSound()
{
return _sound;
}
public int getStayTime()
{
return _stayTime;