Disable MCStats messages + Respect opt-out
This commit is contained in:
		@@ -238,6 +238,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
 | 
				
			|||||||
			public void run() {
 | 
								public void run() {
 | 
				
			||||||
				try {
 | 
									try {
 | 
				
			||||||
					Metrics metrics = new Metrics(plugin);
 | 
										Metrics metrics = new Metrics(plugin);
 | 
				
			||||||
 | 
										if (metrics.isOptOut()) { return; }
 | 
				
			||||||
					Graph playersPlayingBlockHunt = metrics
 | 
										Graph playersPlayingBlockHunt = metrics
 | 
				
			||||||
							.createGraph("Players playing BlockHunt");
 | 
												.createGraph("Players playing BlockHunt");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -275,13 +276,13 @@ public class BlockHunt extends JavaPlugin implements Listener {
 | 
				
			|||||||
					metrics.start();
 | 
										metrics.start();
 | 
				
			||||||
					FileConfiguration metrics_fc = new YamlConfiguration();
 | 
										FileConfiguration metrics_fc = new YamlConfiguration();
 | 
				
			||||||
					metrics_fc.load(metrics.getConfigFile());
 | 
										metrics_fc.load(metrics.getConfigFile());
 | 
				
			||||||
					if (!metrics_fc.getBoolean("opt-out", false)) {
 | 
										/*if (!metrics_fc.getBoolean("opt-out", false)) {
 | 
				
			||||||
						MessageM.sendMessage(null,
 | 
											MessageM.sendMessage(null,
 | 
				
			||||||
								"%TAG%NSending %AMCStats%N to the server...");
 | 
													"%TAG%NSending %AMCStats%N to the server...");
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						MessageM.sendMessage(null,
 | 
											MessageM.sendMessage(null,
 | 
				
			||||||
								"%TAG%EUnable to send %AMCStats %Eto the server. %AMCStats%E is disabled?");
 | 
													"%TAG%EUnable to send %AMCStats %Eto the server. %AMCStats%E is disabled?");
 | 
				
			||||||
					}
 | 
										}*/
 | 
				
			||||||
				} catch (IOException e) {
 | 
									} catch (IOException e) {
 | 
				
			||||||
					MessageM.sendMessage(null,
 | 
										MessageM.sendMessage(null,
 | 
				
			||||||
							"%TAG%EUnable to send %AMCStats %Eto the server. Something went wrong ;(!");
 | 
												"%TAG%EUnable to send %AMCStats %Eto the server. Something went wrong ;(!");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user