2
2
3
3
import java .util .UUID ;
4
4
5
+ import org .bukkit .Location ;
5
6
import org .bukkit .entity .Player ;
6
7
import org .bukkit .event .EventHandler ;
7
8
import org .bukkit .event .EventPriority ;
12
13
import com .volmit .volume .bukkit .VolumePlugin ;
13
14
import com .volmit .volume .bukkit .command .CommandTag ;
14
15
import com .volmit .volume .bukkit .pawn .Async ;
16
+ import com .volmit .volume .bukkit .pawn .Start ;
15
17
import com .volmit .volume .bukkit .task .A ;
16
18
import com .volmit .volume .bukkit .util .data .Edgy ;
17
19
import com .volmit .volume .lang .format .F ;
20
22
@ CommandTag ("&8[&5GCB&8]:&7 " )
21
23
public class GlossChatBubbles extends VolumePlugin
22
24
{
25
+ @ Start
26
+ public void loadConf ()
27
+ {
28
+ try
29
+ {
30
+ Config .read ();
31
+ }
32
+
33
+ catch (Exception e )
34
+ {
35
+ System .out .println ("Failed to read gloss chat bubbles config." );
36
+ e .printStackTrace ();
37
+ }
38
+ }
39
+
23
40
@ Async
24
41
@ EventHandler (priority = EventPriority .LOWEST , ignoreCancelled = true )
25
42
public void on (AsyncPlayerChatEvent e )
26
43
{
27
44
int m = 0 ;
28
45
29
- for (String i : F .wrapWords (e .getMessage (), 32 ).split ("\n " ))
46
+ for (String i : F .wrapWords (e .getMessage (), Config . wordWrapThreshold ).split ("\n " ))
30
47
{
31
48
new A (5 * m )
32
49
{
@@ -44,7 +61,8 @@ public void run()
44
61
@ Async
45
62
private void bubble (String msg , Player p )
46
63
{
47
- TemporaryDescriptor d = GLOSS .getSourceLibrary ().createTemporaryDescriptor ("chat-" + p .getUniqueId () + "-" + M .ms () + UUID .randomUUID ().toString (), p .getEyeLocation ().clone ().add (0 , 1 , 0 ), 5000 );
64
+ Location l = p .getEyeLocation ().clone ().add (0 , 1 , 0 );
65
+ TemporaryDescriptor d = GLOSS .getSourceLibrary ().createTemporaryDescriptor ("chat-" + p .getUniqueId () + "-" + M .ms () + UUID .randomUUID ().toString (), l , Config .messageBubbleMaxTimeAlive );
48
66
d .addLine ("&s&7" + msg );
49
67
int trk = GLOSS .getContextLibrary ().getView (p ).getTrackedBubbles ();
50
68
@@ -59,14 +77,14 @@ private void bubble(String msg, Player p)
59
77
double j = Math .max ((m ) - (((m / 2D ) - ((h + g ) / 2D )) + (f * 2D )), 0 );
60
78
double v = d .getHealth () < 2000 ? (Math .pow (1D - ((double ) d .getHealth () / 2000D ), 16 ) * 10D ) : 0 ;
61
79
62
- return p .getEyeLocation ().clone ().add (0 , 0.86 + j + v , 0 );
80
+ return ( Config . followPlayers ? p .getEyeLocation () : l ).clone ().add (0 , 0.86 + j + v , 0 );
63
81
});
64
82
65
83
d .setLocation (p .getEyeLocation ());
66
84
67
85
GLOSS .getContextLibrary ().getView (p ).setTrackedBubbles (GLOSS .getContextLibrary ().getView (p ).getTrackedBubbles () + 1 );
68
86
69
- new A (20 * 5 )
87
+ new A (Config . messageDisplayTicks )
70
88
{
71
89
@ Override
72
90
public void run ()
0 commit comments