mirror of
				https://e.coding.net/circlecloud/MiaoLobby.git
				synced 2025-11-04 09:56:02 +00:00 
			
		
		
		
	
							
								
								
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							@@ -111,5 +111,11 @@
 | 
				
			|||||||
			<type>jar</type>
 | 
								<type>jar</type>
 | 
				
			||||||
			<version>1.0</version>
 | 
								<version>1.0</version>
 | 
				
			||||||
		</dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>cn.citycraft</groupId>
 | 
				
			||||||
 | 
								<artifactId>AuthMe</artifactId>
 | 
				
			||||||
 | 
								<type>jar</type>
 | 
				
			||||||
 | 
								<version>6.1</version>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
	</dependencies>
 | 
						</dependencies>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										21
									
								
								src/main/java/pw/yumc/MiaoLobby/AuthMeHook.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/main/java/pw/yumc/MiaoLobby/AuthMeHook.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					package pw.yumc.MiaoLobby;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
 | 
					import org.bukkit.event.EventHandler;
 | 
				
			||||||
 | 
					import org.bukkit.event.Listener;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import fr.xephi.authme.events.LoginEvent;
 | 
				
			||||||
 | 
					import pw.yumc.YumCore.bukkit.P;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class AuthMeHook implements Listener {
 | 
				
			||||||
 | 
					    MiaoLobby plugin = P.getPlugin();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AuthMeHook() {
 | 
				
			||||||
 | 
					        Bukkit.getPluginManager().registerEvents(this, P.instance);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @EventHandler
 | 
				
			||||||
 | 
					    public void onLogin(final LoginEvent e) {
 | 
				
			||||||
 | 
					        plugin.random(e.getPlayer());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -16,4 +16,5 @@ public class Config extends InjectConfig {
 | 
				
			|||||||
    public String Message;
 | 
					    public String Message;
 | 
				
			||||||
    public String TimeOut;
 | 
					    public String TimeOut;
 | 
				
			||||||
    public String Unavailable;
 | 
					    public String Unavailable;
 | 
				
			||||||
 | 
					    public Boolean AuthMeAutoTP;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ import pw.yumc.YumCore.commands.CommandArgument;
 | 
				
			|||||||
import pw.yumc.YumCore.commands.CommandExecutor;
 | 
					import pw.yumc.YumCore.commands.CommandExecutor;
 | 
				
			||||||
import pw.yumc.YumCore.commands.CommandManager;
 | 
					import pw.yumc.YumCore.commands.CommandManager;
 | 
				
			||||||
import pw.yumc.YumCore.commands.annotation.Cmd;
 | 
					import pw.yumc.YumCore.commands.annotation.Cmd;
 | 
				
			||||||
 | 
					import pw.yumc.YumCore.commands.annotation.Cmd.Executor;
 | 
				
			||||||
import pw.yumc.YumCore.commands.annotation.Help;
 | 
					import pw.yumc.YumCore.commands.annotation.Help;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MiaoLobby extends JavaPlugin implements CommandExecutor {
 | 
					public class MiaoLobby extends JavaPlugin implements CommandExecutor {
 | 
				
			||||||
@@ -35,10 +36,33 @@ public class MiaoLobby extends JavaPlugin implements CommandExecutor {
 | 
				
			|||||||
        p.sendPluginMessage(this, "BungeeCord", out.toByteArray());
 | 
					        p.sendPluginMessage(this, "BungeeCord", out.toByteArray());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Cmd(permission = "MiaoLobby.default")
 | 
					    @Cmd(permission = "MiaoLobby.default", executor = Executor.PLAYER)
 | 
				
			||||||
    @Help("进行随机服务器传送")
 | 
					    @Help("进行随机服务器传送")
 | 
				
			||||||
    public boolean def(final CommandArgument e) {
 | 
					    public boolean def(final CommandArgument e) {
 | 
				
			||||||
        final Player player = (Player) e.getSender();
 | 
					        random((Player) e.getSender());
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public FileConfiguration getConfig() {
 | 
				
			||||||
 | 
					        return config.getConfig();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onEnable() {
 | 
				
			||||||
 | 
					        new CommandManager("MiaoLobby", this);
 | 
				
			||||||
 | 
					        Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
 | 
				
			||||||
 | 
					        if (config.AuthMeAutoTP && Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
 | 
				
			||||||
 | 
					            new AuthMeHook();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onLoad() {
 | 
				
			||||||
 | 
					        config = new Config();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void random(final Player player) {
 | 
				
			||||||
        new BukkitRunnable() {
 | 
					        new BukkitRunnable() {
 | 
				
			||||||
            List<String> servers = new ArrayList<>(config.Servers);
 | 
					            List<String> servers = new ArrayList<>(config.Servers);
 | 
				
			||||||
            int i = 0;
 | 
					            int i = 0;
 | 
				
			||||||
@@ -58,23 +82,6 @@ public class MiaoLobby extends JavaPlugin implements CommandExecutor {
 | 
				
			|||||||
                cancel();
 | 
					                cancel();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }.runTaskTimerAsynchronously(this, 0, config.WaitTime);
 | 
					        }.runTaskTimerAsynchronously(this, 0, config.WaitTime);
 | 
				
			||||||
        return true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public FileConfiguration getConfig() {
 | 
					 | 
				
			||||||
        return config.getConfig();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void onEnable() {
 | 
					 | 
				
			||||||
        new CommandManager("MiaoLobby", this);
 | 
					 | 
				
			||||||
        Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void onLoad() {
 | 
					 | 
				
			||||||
        config = new Config();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Cmd(permission = "MiaoLobby.reload")
 | 
					    @Cmd(permission = "MiaoLobby.reload")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,8 @@ Servers:
 | 
				
			|||||||
- lobby2
 | 
					- lobby2
 | 
				
			||||||
#传送超时时间(单位: Tick)
 | 
					#传送超时时间(单位: Tick)
 | 
				
			||||||
WaitTime: 20
 | 
					WaitTime: 20
 | 
				
			||||||
 | 
					#AuthMe自动传送
 | 
				
			||||||
 | 
					AuthMeAutoTP: true
 | 
				
			||||||
#传送提示
 | 
					#传送提示
 | 
				
			||||||
Message: '&a请稍候 正在传送至服务器 %s ...'
 | 
					Message: '&a请稍候 正在传送至服务器 %s ...'
 | 
				
			||||||
TimeOut: '&c传送超时 正在切换到服务器 %s ...'
 | 
					TimeOut: '&c传送超时 正在切换到服务器 %s ...'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,8 @@ main: ${project.groupId}.${project.artifactId}.${project.artifactId}
 | 
				
			|||||||
version: ${project.version}-git-${env.GIT_COMMIT}
 | 
					version: ${project.version}-git-${env.GIT_COMMIT}
 | 
				
			||||||
author: 喵♂呜
 | 
					author: 喵♂呜
 | 
				
			||||||
website: ${ciManagement.url}
 | 
					website: ${ciManagement.url}
 | 
				
			||||||
 | 
					softdepend:
 | 
				
			||||||
 | 
					- AuthMe
 | 
				
			||||||
commands:
 | 
					commands:
 | 
				
			||||||
  ${project.artifactId}:
 | 
					  ${project.artifactId}:
 | 
				
			||||||
    description: ${project.artifactId} - ${project.description}
 | 
					    description: ${project.artifactId} - ${project.description}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user