Compare commits
No commits in common. "a29f0473af9fbef1f568c25616e5352d3ecf1a25" and "c372c0ae297ebf0c6dc1f57923c6856c945364bb" have entirely different histories.
a29f0473af
...
c372c0ae29
20
pom.xml
20
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.mmlsystem</groupId>
|
<groupId>com.mmlsystem</groupId>
|
||||||
<artifactId>StatusSystem</artifactId>
|
<artifactId>StatusSystem</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>1.1.1</version>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
@ -18,18 +18,6 @@
|
|||||||
<url>https://jitpack.io/</url>
|
<url>https://jitpack.io/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>9</source>
|
|
||||||
<target>9</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -50,11 +38,5 @@
|
|||||||
<version>24.1.0</version>
|
<version>24.1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.mmlsystem</groupId>
|
|
||||||
<artifactId>PlayerExpSystem</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -8,16 +8,9 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scoreboard.*;
|
import org.bukkit.scoreboard.*;
|
||||||
import com.mmlsystem.PlayerExpSystem.Foundation;
|
|
||||||
import com.mmlsystem.PlayerExpSystem.ExpAPI;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
public class Foundation extends JavaPlugin {
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class StatusFoundation extends JavaPlugin {
|
|
||||||
public static Economy econ;
|
public static Economy econ;
|
||||||
public static ExpAPI api;
|
|
||||||
public int totalTime;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -30,8 +23,6 @@ public class StatusFoundation extends JavaPlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
|
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
|
||||||
Foundation foundation = (Foundation) Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("PlayerExpSystem"));
|
|
||||||
api = new ExpAPI(foundation);
|
|
||||||
getLogger().info("插件启用成功。");
|
getLogger().info("插件启用成功。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,15 +50,11 @@ public class StatusFoundation extends JavaPlugin {
|
|||||||
Objective objective = board.registerNewObjective("info", "dummy", ChatColor.GOLD + "✦ 统计数据 ✦");
|
Objective objective = board.registerNewObjective("info", "dummy", ChatColor.GOLD + "✦ 统计数据 ✦");
|
||||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
|
|
||||||
objective.getScore(ChatColor.AQUA + "金币").setScore(10);
|
objective.getScore(ChatColor.AQUA + "金币").setScore(7);
|
||||||
objective.getScore(ChatColor.RED + " " + econ.getBalance(player) ).setScore(9);
|
objective.getScore(ChatColor.RED + " " + econ.getBalance(player) ).setScore(6);
|
||||||
objective.getScore(" ").setScore(8);
|
|
||||||
objective.getScore(ChatColor.AQUA + "当前在线人数").setScore(7);
|
|
||||||
objective.getScore(ChatColor.GREEN + " " + Bukkit.getOnlinePlayers().size()).setScore(6);
|
|
||||||
objective.getScore(" ").setScore(5);
|
objective.getScore(" ").setScore(5);
|
||||||
getTime(player);
|
objective.getScore(ChatColor.AQUA + "当前在线人数").setScore(4);
|
||||||
objective.getScore(ChatColor.AQUA + "在线时长").setScore(4);
|
objective.getScore(ChatColor.GREEN + " " + Bukkit.getOnlinePlayers().size()).setScore(3);
|
||||||
objective.getScore(ChatColor.GREEN + " " + getTimeString()).setScore(3);
|
|
||||||
objective.getScore("").setScore(2);
|
objective.getScore("").setScore(2);
|
||||||
objective.getScore(ChatColor.GRAY + "mymc.life").setScore(1);
|
objective.getScore(ChatColor.GRAY + "mymc.life").setScore(1);
|
||||||
|
|
||||||
@ -85,31 +72,9 @@ public class StatusFoundation extends JavaPlugin {
|
|||||||
board.resetScores(entry);
|
board.resetScores(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objective.getScore(ChatColor.RED + " " + econ.getBalance(player) ).setScore(9);
|
objective.getScore(ChatColor.RED + " " + econ.getBalance(player) ).setScore(6);
|
||||||
objective.getScore(ChatColor.GREEN + " " + Bukkit.getOnlinePlayers().size()).setScore(6);
|
objective.getScore(ChatColor.GREEN + " " + Bukkit.getOnlinePlayers().size()).setScore(3);
|
||||||
getTime(player);
|
|
||||||
objective.getScore(ChatColor.GREEN + " " + getTimeString()).setScore(3);
|
|
||||||
}
|
}
|
||||||
}.runTaskTimer(this, 0L, 100L);
|
}.runTaskTimer(this, 0L, 100L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(int time) {
|
|
||||||
this.totalTime = time / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getTime(Player player) {
|
|
||||||
api.getPlayerOnlineTime(player, this::setTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTimeString() {
|
|
||||||
if (totalTime == -1) {
|
|
||||||
return "未知错误";
|
|
||||||
}
|
|
||||||
long hour;
|
|
||||||
long minute;
|
|
||||||
Duration duration = Duration.ofSeconds(totalTime);
|
|
||||||
hour = duration.toHours();
|
|
||||||
minute = duration.toMinutesPart();
|
|
||||||
return String.format("%d:%02d", hour, minute);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -5,9 +5,9 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
public class PlayerJoinListener implements Listener {
|
public class PlayerJoinListener implements Listener {
|
||||||
private final StatusFoundation plugin;
|
private final Foundation plugin;
|
||||||
|
|
||||||
public PlayerJoinListener(StatusFoundation plugin) {
|
public PlayerJoinListener(Foundation plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
name: StatusSystem
|
name: StatusSystem
|
||||||
main: com.mmlsystem.StatusSystem.StatusFoundation
|
main: com.mmlsystem.StatusSystem.Foundation
|
||||||
version: 1.2.1
|
version: 1.1
|
||||||
api-version: 1.21
|
api-version: 1.21
|
||||||
author: 杏川铭心
|
author: 杏川铭心
|
||||||
description: 提供服务器计分板UI功能。
|
description: 提供服务器计分板UI功能。
|
||||||
depend: [PlayerExpSystem, Vault]
|
|
||||||
Loading…
x
Reference in New Issue
Block a user