File tree 3 files changed +71
-0
lines changed
src/main/java/pl/betoncraft/flier
3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 4
4
/.project
5
5
6
6
* .html
7
+ /dependency-reduced-pom.xml
Original file line number Diff line number Diff line change 41
41
<artifactId >maven-jar-plugin</artifactId >
42
42
<version >2.4</version >
43
43
</plugin >
44
+ <plugin >
45
+ <groupId >org.apache.maven.plugins</groupId >
46
+ <artifactId >maven-shade-plugin</artifactId >
47
+ <version >2.4.3</version >
48
+ <executions >
49
+ <execution >
50
+ <phase >package</phase >
51
+ <goals >
52
+ <goal >shade</goal >
53
+ </goals >
54
+ <configuration >
55
+ <artifactSet >
56
+ <includes >
57
+ <include >org.bstats:*</include >
58
+ </includes >
59
+ </artifactSet >
60
+ <relocations >
61
+ <relocation >
62
+ <pattern >org.bstats</pattern >
63
+ <shadedPattern >pl.betoncraft.flier.bstats</shadedPattern >
64
+ </relocation >
65
+ </relocations >
66
+ <minimizeJar >${minimize} </minimizeJar >
67
+ </configuration >
68
+ </execution >
69
+ </executions >
70
+ </plugin >
44
71
</plugins >
45
72
</build >
46
73
<repositories >
52
79
<id >betonquest-repo</id >
53
80
<url >http://betonquest.betoncraft.pl/mvn</url >
54
81
</repository >
82
+ <repository >
83
+ <id >bstats-repo</id >
84
+ <url >http://repo.bstats.org/content/repositories/releases/</url >
85
+ </repository >
55
86
</repositories >
56
87
<dependencies >
57
88
<dependency >
75
106
<artifactId >BetonQuest</artifactId >
76
107
<version >1.9</version >
77
108
</dependency >
109
+ <dependency >
110
+ <groupId >org.bstats</groupId >
111
+ <artifactId >bstats-bukkit</artifactId >
112
+ <version >1.1</version >
113
+ </dependency >
78
114
</dependencies >
79
115
</project >
Original file line number Diff line number Diff line change 9
9
import java .util .Collections ;
10
10
import java .util .HashMap ;
11
11
import java .util .Map ;
12
+ import java .util .Set ;
12
13
import java .util .UUID ;
13
14
15
+ import org .bstats .Metrics ;
14
16
import org .bukkit .Bukkit ;
15
17
import org .bukkit .configuration .ConfigurationSection ;
16
18
import org .bukkit .entity .Entity ;
@@ -167,6 +169,38 @@ public void onChunkUnload(ChunkUnloadEvent event) {
167
169
// schedule loading after all plugins are enabled
168
170
Bukkit .getScheduler ().runTask (this , () -> reload ());
169
171
172
+ // start metrics
173
+ Metrics metrics = new Metrics (this );
174
+ metrics .addCustomChart (new Metrics .SingleLineChart ("ingame_players" ) {
175
+ @ Override
176
+ public int getValue () {
177
+ return players .size ();
178
+ }
179
+ });
180
+ metrics .addCustomChart (new Metrics .AdvancedPie ("game_types" ) {
181
+ @ Override
182
+ public HashMap <String , Integer > getValues (HashMap <String , Integer > map ) {
183
+ for (Lobby lobby : lobbies .values ()) {
184
+ for (Set <Game > set : lobby .getGames ().values ()) {
185
+ for (Game game : set ) {
186
+ String name ;
187
+ if (game instanceof DeathMatchGame ) {
188
+ name = "DeathMatch" ;
189
+ } else if (game instanceof TeamDeathMatch ) {
190
+ name = "Team DeathMatch" ;
191
+ } else {
192
+ name = "Custom" ;
193
+ }
194
+ int amount = map .computeIfAbsent (name , key -> 0 );
195
+ amount ++;
196
+ map .put (name , amount );
197
+ }
198
+ }
199
+ }
200
+ return map ;
201
+ }
202
+ });
203
+
170
204
getLogger ().info ("Flier enabled!" );
171
205
}
172
206
You can’t perform that action at this time.
0 commit comments