parent
dd7e87d890
commit
15c9b89fae
3
pom.xml
3
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>MiaoLobby</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.2</version>
|
||||
|
||||
<parent>
|
||||
<groupId>pw.yumc</groupId>
|
||||
|
@ -24,6 +24,7 @@
|
|||
<properties>
|
||||
<update.description>§a正式版本 §bv${project.version}</update.description>
|
||||
<update.changes>
|
||||
§621-04-02 §a新增: 优化命令传送逻辑;
|
||||
§621-04-01 §a新增: 重复传送限制 离线清理数据;
|
||||
</update.changes>
|
||||
<update.changelog>
|
||||
|
|
|
@ -20,7 +20,7 @@ import pw.yumc.YumCore.statistic.Statistics;
|
|||
import pw.yumc.YumCore.update.SubscribeTask;
|
||||
|
||||
public class MiaoLobby extends JavaPlugin implements Executor, Listener {
|
||||
Config config;
|
||||
private Config config;
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent e) {
|
||||
|
@ -29,8 +29,8 @@ public class MiaoLobby extends JavaPlugin implements Executor, Listener {
|
|||
|
||||
@Cmd(permission = "MiaoLobby.default", executor = Cmd.Executor.PLAYER)
|
||||
@Help("进行随机服务器传送")
|
||||
public boolean def(final Player player) {
|
||||
Util.delayTp(player);
|
||||
public boolean ml(final Player player) {
|
||||
Util.delayTp(player, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,10 @@ public class MiaoLobby extends JavaPlugin implements Executor, Listener {
|
|||
return config.getConfig();
|
||||
}
|
||||
|
||||
public Config getMiaoLobbyConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
new CommandSub("MiaoLobby", this);
|
||||
|
|
|
@ -23,24 +23,28 @@ import java.util.Map;
|
|||
* @since 2016/12/25 0025
|
||||
*/
|
||||
public class Util {
|
||||
private final static SecureRandom random = new SecureRandom();
|
||||
private static MiaoLobby plugin = P.getPlugin();
|
||||
private static Config config = plugin.config;
|
||||
private static Map<String, BukkitTask> tasks = new HashMap<>();
|
||||
private static final SecureRandom random = new SecureRandom();
|
||||
private static final MiaoLobby plugin = P.getPlugin();
|
||||
private static final Config config = P.getInjectConfig();
|
||||
private static final Map<String, BukkitTask> tasks = new HashMap<>();
|
||||
|
||||
public static void delayTp(final Player player) {
|
||||
Util.delayTp(player, config.AutoTPDelay);
|
||||
}
|
||||
|
||||
public static void delayTp(final Player player, int autoTPDelay) {
|
||||
if (tasks.containsKey(player.getName())) {
|
||||
Log.sender(player, config.TPing);
|
||||
return;
|
||||
}
|
||||
tasks.put(player.getName(), new BukkitRunnable() {
|
||||
int delay = config.AutoTPDelay;
|
||||
int delay = autoTPDelay;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline()) {
|
||||
if (delay > 0) {
|
||||
C.ActionBar.send(player, String.format(plugin.config.TPDelay, delay));
|
||||
C.ActionBar.send(player, String.format(config.TPDelay, delay));
|
||||
delay--;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue