Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

edit to log only Player-Time

  • Loading branch information...
commit 98ba41b6c910fe14a928be20cb796c3c9e62fe6a 1 parent 6b2fb76
@sirkarpfen sirkarpfen authored
View
20 de/secretcraft/statistik/Statistik.java
@@ -45,6 +45,9 @@
private StatistikCommand statistikCommand;
private RankCommand rankCommand;
+ // default: true
+ private Boolean onlyPlayerTime;
+
// DB
Connection connection;
@@ -60,14 +63,21 @@ public void onEnable() {
settingsManager = new SettingsManager();
connectToDB();
+ onlyPlayerTime = settingsManager.getOnlyPlayerTime();
+
statistikManager = new StatistikManager();
taskManager = new TaskManager();
rankManager = new RankManager();
// Listener
- playerListener = new PlayerListener();
- blockListener = new BlockListener();
- entityListener = new EntityListener();
+ if(onlyPlayerTime) {
+ playerListener = new PlayerListener();
+ } else {
+ playerListener = new PlayerListener();
+ blockListener = new BlockListener();
+ entityListener = new EntityListener();
+ }
+
// Chat for Ranks
setupChat();
@@ -166,6 +176,10 @@ public Connection getConnection() {
return connection;
}
+ public Boolean getOnlyPlayerTime() {
+ return onlyPlayerTime;
+ }
+
public Chat getChat() {
return chat;
}
View
15 de/secretcraft/statistik/command/StatistikCommand.java
@@ -47,12 +47,21 @@ public void execute( Player player, String[] args) {
stats = statistikManger.getPlayer(player);
}
- player.sendMessage( ChatColor.BLUE + "-----------------------------------------------------");
+ if(plugin.getOnlyPlayerTime()) {
+
+ player.sendMessage( ChatColor.BLUE + "-------------------------------------------");
+ player.sendMessage( ChatColor.WHITE + "Spielzeit : " + ChatColor.GOLD + secondsToString( stats.getPlayTime() ) );
+ player.sendMessage( ChatColor.BLUE + "-------------------------------------------");
+
+ return;
+
+ }
+
+ player.sendMessage( ChatColor.BLUE + "-------------------------------------------");
// Play Time
player.sendMessage( ChatColor.WHITE + "Spielzeit : " + ChatColor.GOLD + secondsToString( stats.getPlayTime() ) );
-
// Blšcke
player.sendMessage( ChatColor.WHITE + "Blšcke Zerstšrt : " + ChatColor.GOLD + stats.getBlockBreak() );
player.sendMessage( ChatColor.WHITE + "Blšcke Plaziert : " + ChatColor.GOLD + stats.getBlockPlace() );
@@ -75,7 +84,7 @@ public void execute( Player player, String[] args) {
player.sendMessage( ChatColor.WHITE + "Punkte Gesamt : " + ChatColor.GOLD + stats.getPoints() );
- player.sendMessage( ChatColor.BLUE + "-----------------------------------------------------");
+ player.sendMessage( ChatColor.BLUE + "-------------------------------------------");
}
View
11 de/secretcraft/statistik/manager/SettingsManager.java
@@ -10,6 +10,7 @@
private Configuration config;
private Boolean debug;
+ private Boolean logPlayerTime;
private String host;
private String database;
@@ -59,6 +60,7 @@ public SettingsManager() {
public void addDeafaults() {
config.addDefault("Settings.Debug", false);
+ config.addDefault("Settings.Log.OnlyPlayerTime", true);
config.addDefault("Settings.MySQL.Host", "localhost");
config.addDefault("Settings.MySQL.Database", "stats");
@@ -152,6 +154,7 @@ public void load() {
plugin.reloadConfig();
setDebug( config.getBoolean("Settings.Debug") );
+ setOnlyPlayerTime( config.getBoolean("Settings.Log.OnlyPlayerTime") );
setHost( config.getString("Settings.MySQL.Host") );
setDatabase( config.getString("Settings.MySQL.Database") );
@@ -207,6 +210,14 @@ public Boolean getDebug() {
public void setDebug(Boolean debug) {
this.debug = debug;
}
+
+ public Boolean getOnlyPlayerTime() {
+ return logPlayerTime;
+ }
+
+ public void setOnlyPlayerTime(Boolean logPlayerTime) {
+ this.logPlayerTime = logPlayerTime;
+ }
public String getHost() {
return host;
Please sign in to comment.
Something went wrong with that request. Please try again.