11/**
22 * The MIT License
33 * Copyright (c) 2015 Techcable
4- *
4+ * <p>
55 * Permission is hereby granted, free of charge, to any person obtaining a copy
66 * of this software and associated documentation files (the "Software"), to deal
77 * in the Software without restriction, including without limitation the rights
88 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99 * copies of the Software, and to permit persons to whom the Software is
1010 * furnished to do so, subject to the following conditions:
11- *
11+ * <p>
1212 * The above copyright notice and this permission notice shall be included in
1313 * all copies or substantial portions of the Software.
14- *
14+ * <p>
1515 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2727import java .io .IOException ;
2828import java .lang .reflect .Constructor ;
2929import java .lang .reflect .InvocationTargetException ;
30+ import java .util .List ;
3031import java .util .Set ;
3132import java .util .UUID ;
3233import java .util .logging .Level ;
3334import java .util .stream .Collector ;
35+ import java .util .stream .Collectors ;
3436
3537import com .google .common .collect .ImmutableList ;
3638
@@ -77,7 +79,8 @@ protected void startup() {
7779 Plugin providingPlugin = JavaPlugin .getProvidingPlugin (plugin .getClass ());
7880 getLogger ().info (i + ") " + plugin .getPlugin ().getName ());
7981 if (providingPlugin != plugin .getPlugin ()) {
80- getLogger ().info ("\t - this is provided by " + providingPlugin .getName () + " not implemented in " + plugin .getPlugin ().getName () + " itself" );;
82+ getLogger ().info ("\t - this is provided by " + providingPlugin .getName () + " not implemented in " + plugin .getPlugin ().getName () + " itself" );
83+ ;
8184 getLogger ().info ("\t - therefore report bugs with the integration to " + Utils .getAuthors (providingPlugin ) + ", not to " + Utils .getAuthors (plugin .getPlugin ()));
8285 }
8386 }
@@ -104,9 +107,18 @@ public int getValue() {
104107 mode .addPlotter (new Metrics .Plotter ("Teleport" ) {
105108 @ Override
106109 public int getValue () {
107- return getSettings ().getMode () == BlockMode .KNOCKBACK ? 1 : 0 ;
110+ return getSettings ().getMode () == BlockMode .TELEPORT ? 1 : 0 ;
108111 }
109112 });
113+ Metrics .Graph pluginGraph = metrics .createGraph ("Combat Plugin" );
114+ for (CombatTagPlugin plugin : getCombatTagPlugins ()) { // Get all plugins, even uninstalled ones
115+ pluginGraph .addPlotter (new Metrics .Plotter (plugin .getPlugin ().getName ()) {
116+ @ Override
117+ public int getValue () {
118+ return 1 ;
119+ }
120+ });
121+ }
110122 metrics .start ();
111123 } catch (IOException e ) {
112124 getLogger ().warning ("Unable to run metrics" );
@@ -132,19 +144,19 @@ public int getValue() {
132144 }
133145 getCommand ("spawnshield" ).setExecutor (new SpawnShieldExecutor (this ));
134146 switch (settings .getMode ()) {
135- case FORCEFIELD :
147+ case FORCEFIELD :
136148 this .forceFieldListener = new ForceFieldListener (this );
137149 registerListener (forceFieldListener );
138150 break ;
139- case TELEPORT :
151+ case TELEPORT :
140152 teleportSafezoningTask = new TeleportSafezoningTask (this );
141153 teleportSafezoningTask .runTaskTimer (this , 5 , 5 ); //Every 1/4 of a tick
142154 break ;
143- case KNOCKBACK :
155+ case KNOCKBACK :
144156 knockbackTask = new KnockbackTask (this );
145157 knockbackTask .runTaskTimer (this , 5 , 5 ); //Every 1/4 of a tick
146158 break ;
147- default :
159+ default :
148160 getLogger ().severe ("[SpawnShield] Unknown Plugin Mode" );
149161 setEnabled (false );
150162 return ;
@@ -191,12 +203,7 @@ public ImmutableList<CombatTagPlugin> getCombatTagPlugins() {
191203 return getServer ().getServicesManager ().getRegistrations (CombatTagPlugin .class ).stream ()
192204 .map (RegisteredServiceProvider ::getProvider )
193205 .filter (CombatTagPlugin ::isInstalled ) // Only return installed plugins :)
194- .collect (Collector .<CombatTagPlugin , ImmutableList .Builder <CombatTagPlugin >, ImmutableList <CombatTagPlugin >>of (
195- ImmutableList ::builder ,
196- ImmutableList .Builder ::add ,
197- (builder1 , builder2 ) -> builder1 .addAll (builder2 .build ()),
198- ImmutableList .Builder ::build
199- ));
206+ .collect (Utils .immutableListCollector ());
200207 }
201208
202209 @ Override
0 commit comments