mirror of
https://github.com/itHotL/PlayerStats.git
synced 2024-11-25 12:25:36 +01:00
Designed a logo and added a template for the README.md (#36)
This commit is contained in:
parent
519a13f9aa
commit
1ef75ad451
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
![PlayerStats_Logo](src/main/resources/images/logo.png)
|
||||||
|
## About
|
||||||
|
|
||||||
|
## First Time Use
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
## Author Info
|
||||||
|
I am a relatively new programmer, and this is one of my first projects. I greatly enjoyed making it,
|
||||||
|
and I tried to make it as efficient as I could. If you have any questions, remarks, or suggestions,
|
||||||
|
please let me know! You can find me on [GitHub](https://github.com/Artemis-the-gr8)
|
||||||
|
or reach me by email: artemis.the.gr8@gmail.com
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
RegenAssist is licenced under the MIT licence. Please see [LICENCE](LICENSE) for more information.
|
||||||
|
|
@ -48,7 +48,7 @@ public class Main extends JavaPlugin {
|
|||||||
if (reloadcmd != null) reloadcmd.setExecutor(new ReloadCommand(threadManager));
|
if (reloadcmd != null) reloadcmd.setExecutor(new ReloadCommand(threadManager));
|
||||||
|
|
||||||
//register the listener
|
//register the listener
|
||||||
Bukkit.getPluginManager().registerEvents(new JoinListener(offlinePlayerHandler), this);
|
Bukkit.getPluginManager().registerEvents(new JoinListener(threadManager), this);
|
||||||
logTimeTaken("onEnable", "time taken", time);
|
logTimeTaken("onEnable", "time taken", time);
|
||||||
this.getLogger().info("Enabled PlayerStats!");
|
this.getLogger().info("Enabled PlayerStats!");
|
||||||
}
|
}
|
||||||
@ -62,8 +62,7 @@ public class Main extends JavaPlugin {
|
|||||||
this.getLogger().info("Disabled PlayerStats!");
|
this.getLogger().info("Disabled PlayerStats!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public long logTimeTaken(String className, String methodName, long previousTime) {
|
public void logTimeTaken(String className, String methodName, long previousTime) {
|
||||||
getLogger().info(className + ", " + methodName + ": " + (System.currentTimeMillis() - previousTime) + "ms");
|
getLogger().info(className + ", " + methodName + ": " + (System.currentTimeMillis() - previousTime) + "ms");
|
||||||
return System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.artemis.the.gr8.playerstats.commands;
|
package com.gmail.artemis.the.gr8.playerstats.commands;
|
||||||
|
|
||||||
import com.gmail.artemis.the.gr8.playerstats.Main;
|
|
||||||
import com.gmail.artemis.the.gr8.playerstats.ThreadManager;
|
import com.gmail.artemis.the.gr8.playerstats.ThreadManager;
|
||||||
import com.gmail.artemis.the.gr8.playerstats.filehandlers.ConfigHandler;
|
|
||||||
import com.gmail.artemis.the.gr8.playerstats.utils.EnumHandler;
|
import com.gmail.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||||
import com.gmail.artemis.the.gr8.playerstats.statistic.StatRequest;
|
import com.gmail.artemis.the.gr8.playerstats.statistic.StatRequest;
|
||||||
import com.gmail.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
import com.gmail.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.artemis.the.gr8.playerstats.filehandlers;
|
package com.gmail.artemis.the.gr8.playerstats.filehandlers;
|
||||||
|
|
||||||
import com.gmail.artemis.the.gr8.playerstats.Main;
|
import com.gmail.artemis.the.gr8.playerstats.Main;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.artemis.the.gr8.playerstats.listeners;
|
package com.gmail.artemis.the.gr8.playerstats.listeners;
|
||||||
|
|
||||||
import com.gmail.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
import com.gmail.artemis.the.gr8.playerstats.ThreadManager;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
@ -8,15 +8,16 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
|
|
||||||
public class JoinListener implements Listener {
|
public class JoinListener implements Listener {
|
||||||
|
|
||||||
private final OfflinePlayerHandler offlinePlayerHandler;
|
private final ThreadManager threadManager;
|
||||||
public JoinListener(OfflinePlayerHandler o) {
|
|
||||||
offlinePlayerHandler = o;
|
public JoinListener(ThreadManager t) {
|
||||||
|
threadManager = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent joinEvent) {
|
public void onPlayerJoin(PlayerJoinEvent joinEvent) {
|
||||||
if (!joinEvent.getPlayer().hasPlayedBefore()) {
|
if (!joinEvent.getPlayer().hasPlayedBefore()) {
|
||||||
offlinePlayerHandler.updateOfflinePlayerList();
|
threadManager.startReloadThread(null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,16 +142,6 @@ public class EnumHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//checks whether a subStatEntry is of the type that the statistic requires
|
//checks whether a subStatEntry is of the type that the statistic requires
|
||||||
public static boolean isValidStatEntry(@NotNull String statName, String subStatEntry) {
|
|
||||||
try {
|
|
||||||
return isValidStatEntry(getStatType(statName), subStatEntry);
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isValidStatEntry(Statistic.Type statType, String subStatEntry) {
|
public static boolean isValidStatEntry(Statistic.Type statType, String subStatEntry) {
|
||||||
return (statType != null) && isMatchingSubStatEntry(statType, subStatEntry);
|
return (statType != null) && isMatchingSubStatEntry(statType, subStatEntry);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class MessageFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent stillReloading() {
|
public TextComponent stillReloading() {
|
||||||
return text(getPluginPrefix()).append(text("The plugin is reloading, your request will be processed when it is done!").color(msgColor));
|
return text(getPluginPrefix()).append(text("The plugin is still (re)loading, your request will be processed when it is done!").color(msgColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent waitAMoment(boolean longWait) {
|
public TextComponent waitAMoment(boolean longWait) {
|
||||||
|
@ -13,7 +13,6 @@ public class OfflinePlayerHandler {
|
|||||||
|
|
||||||
public OfflinePlayerHandler(ConfigHandler c) {
|
public OfflinePlayerHandler(ConfigHandler c) {
|
||||||
config = c;
|
config = c;
|
||||||
//updateOfflinePlayerList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOfflinePlayerName(String playerName) {
|
public boolean isOfflinePlayerName(String playerName) {
|
||||||
@ -40,15 +39,12 @@ public class OfflinePlayerHandler {
|
|||||||
offlinePlayerUUIDs.clear();
|
offlinePlayerUUIDs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i <100; i++) {
|
|
||||||
int finalI = i;
|
|
||||||
Arrays.stream(Bukkit.getOfflinePlayers()).filter(offlinePlayer ->
|
Arrays.stream(Bukkit.getOfflinePlayers()).filter(offlinePlayer ->
|
||||||
offlinePlayer.getName() != null &&
|
offlinePlayer.getName() != null &&
|
||||||
(!excludeBanned || !offlinePlayer.isBanned()) &&
|
(!excludeBanned || !offlinePlayer.isBanned()) &&
|
||||||
(!whitelistOnly || offlinePlayer.isWhitelisted()) &&
|
(!whitelistOnly || offlinePlayer.isWhitelisted()) &&
|
||||||
(lastPlayedLimit == 0 || UnixTimeHandler.hasPlayedSince(lastPlayedLimit, offlinePlayer.getLastPlayed())))
|
(lastPlayedLimit == 0 || UnixTimeHandler.hasPlayedSince(lastPlayedLimit, offlinePlayer.getLastPlayed())))
|
||||||
.forEach(offlinePlayer -> offlinePlayerUUIDs.put((offlinePlayer.getName() + finalI), offlinePlayer.getUniqueId()));
|
.forEach(offlinePlayer -> offlinePlayerUUIDs.put((offlinePlayer.getName()), offlinePlayer.getUniqueId()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OfflinePlayer getOfflinePlayer(String playerName) {
|
public OfflinePlayer getOfflinePlayer(String playerName) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.artemis.the.gr8.playerstats.utils;
|
package com.gmail.artemis.the.gr8.playerstats.utils;
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
|
|
||||||
public class UnixTimeHandler {
|
public class UnixTimeHandler {
|
||||||
|
|
||||||
|
BIN
src/main/resources/images/logo.png
Normal file
BIN
src/main/resources/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user