mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Added Spout sounds
This commit is contained in:
parent
affbe91352
commit
7c978bab0c
@ -3,6 +3,9 @@ package com.dre.dungeonsxl.game;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.getspout.spoutapi.Spout;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.dre.dungeonsxl.DPlayer;
|
||||
import com.dre.dungeonsxl.P;
|
||||
@ -17,12 +20,14 @@ public class GameMessage {
|
||||
public String msg;
|
||||
public GameWorld gworld;
|
||||
public int radius;
|
||||
public boolean isSpoutSoundMsg;
|
||||
|
||||
public GameMessage(Block block, int msgid,GameWorld gworld,int radius){
|
||||
public GameMessage(Block block, int msgid,GameWorld gworld,int radius,boolean isSpoutSoundMsg){
|
||||
this.block=block;
|
||||
this.msg=gworld.config.getMsg(msgid);
|
||||
this.gworld=gworld;
|
||||
this.radius=radius;
|
||||
this.isSpoutSoundMsg=isSpoutSoundMsg;
|
||||
|
||||
if(this.msg!=null){
|
||||
gmessages.add(this);
|
||||
@ -37,8 +42,18 @@ public class GameMessage {
|
||||
for(DPlayer dplayer:DPlayer.get(gmessage.gworld.world)){
|
||||
if(!gmessage.playerDone.contains(dplayer)){
|
||||
if(dplayer.player.getLocation().distance(gmessage.block.getLocation())<gmessage.radius+1){
|
||||
P.p.msg(dplayer.player, gmessage.msg);
|
||||
gmessage.playerDone.add(dplayer);
|
||||
|
||||
if(gmessage.isSpoutSoundMsg){
|
||||
if(P.p.isSpoutEnabled){
|
||||
SpoutPlayer sPlayer = Spout.getServer().getPlayer(dplayer.player.getName());
|
||||
if(sPlayer.isSpoutCraftEnabled()){
|
||||
SpoutManager.getSoundManager().playCustomMusic(P.p, sPlayer, gmessage.msg, false, gmessage.block.getLocation());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
P.p.msg(dplayer.player, gmessage.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,13 @@ public class GameWorld {
|
||||
}
|
||||
if(lines[1].equalsIgnoreCase("msg")){
|
||||
if(lines[2]!=""&&lines[3]!=""){
|
||||
new GameMessage(block,p.parseInt(lines[2]),this,p.parseInt(lines[3]));
|
||||
new GameMessage(block,p.parseInt(lines[2]),this,p.parseInt(lines[3]),false);
|
||||
block.setTypeId(0);
|
||||
}
|
||||
}
|
||||
if(lines[1].equalsIgnoreCase("soundmsg")){
|
||||
if(lines[2]!=""&&lines[3]!=""){
|
||||
new GameMessage(block,p.parseInt(lines[2]),this,p.parseInt(lines[3]),true);
|
||||
block.setTypeId(0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user