init commit
This commit is contained in:
commit
44691d0ae6
113
.gitignore
vendored
Normal file
113
.gitignore
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
# User-specific stuff
|
||||
.idea/
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
target/
|
||||
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.flattened-pom.xml
|
||||
|
||||
# Common working directory
|
||||
run/
|
0
HowToUse/README.md
Normal file
0
HowToUse/README.md
Normal file
83
pom.xml
Normal file
83
pom.xml
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.frontleaves</groupId>
|
||||
<artifactId>BungeeCross</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>BungeeCross</name>
|
||||
|
||||
<description>BungeeCord - 跨服</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<url>https://maven.aliyun.com/repository/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.20-R0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.28</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>23.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
44
src/main/java/com/frontleaves/bungeecross/BungeeCross.java
Normal file
44
src/main/java/com/frontleaves/bungeecross/BungeeCross.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package com.frontleaves.bungeecross;
|
||||
|
||||
import com.frontleaves.bungeecross.commands.PluginInfoCommand;
|
||||
import com.frontleaves.bungeecross.commands.ProxyServerListCommand;
|
||||
import com.frontleaves.bungeecross.commands.ReturnHubCommand;
|
||||
import com.frontleaves.bungeecross.commands.SendToServerCommand;
|
||||
import com.frontleaves.bungeecross.configuration.ServerEnable;
|
||||
import com.frontleaves.bungeecross.configuration.VariableStorage;
|
||||
import com.frontleaves.bungeecross.events.PlayerJoinProxyEvent;
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* @version 见 final VERSION 变量
|
||||
* @author 筱锋xiao_lfeng
|
||||
*/
|
||||
public final class BungeeCross extends Plugin {
|
||||
@Getter
|
||||
private final static String VERSION = "v1.0-SNAPSHOT";
|
||||
@Getter
|
||||
private final static String AUTHOR = "筱锋xiao_lfeng";
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// 加载配置文件
|
||||
ServerEnable serverEnable = new ServerEnable(this);
|
||||
serverEnable.serverStart();
|
||||
// 注册指令
|
||||
getProxy().getPluginManager().registerCommand(this, new PluginInfoCommand("bungeecross"));
|
||||
getProxy().getPluginManager().registerCommand(this, new ProxyServerListCommand("server-list"));
|
||||
getProxy().getPluginManager().registerCommand(this, new ReturnHubCommand("hub", this));
|
||||
getProxy().getPluginManager().registerCommand(this, new SendToServerCommand("serverTo", this));
|
||||
// 注册监听器
|
||||
getProxy().getPluginManager().registerListener(this, new PlayerJoinProxyEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
VariableStorage.setLobbyServer(null);
|
||||
VariableStorage.setLoginServer(null);
|
||||
VariableStorage.setPrefix(null);
|
||||
VariableStorage.setProxyServer(null);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.frontleaves.bungeecross.commands;
|
||||
|
||||
import com.frontleaves.bungeecross.BungeeCross;
|
||||
import com.frontleaves.bungeecross.configuration.VariableStorage;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
/**
|
||||
* 输出插件基本信息
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
*/
|
||||
public class PluginInfoCommand extends Command {
|
||||
|
||||
public PluginInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender commandSender, String[] strings) {
|
||||
commandSender.sendMessage("§9§l§m=]=======§2 Bungee§aCross §9§l§m========[=");
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "蹦极插件:§2Bungee§aCross");
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "作者:" + BungeeCross.getAUTHOR());
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "版本:" + BungeeCross.getVERSION());
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "§b您的版本为最新的");
|
||||
commandSender.sendMessage("§9§l§m=]=======§2 Bungee§aCross §9§l§m========[=");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.frontleaves.bungeecross.commands;
|
||||
|
||||
import com.frontleaves.bungeecross.configuration.VariableStorage;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
/**
|
||||
* 查询服务器列表
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @version v1.0-SNAPSHOT
|
||||
* @since v1.0-SNAPSHOT
|
||||
*/
|
||||
public class ProxyServerListCommand extends Command {
|
||||
private StringBuilder serverList = null;
|
||||
|
||||
public ProxyServerListCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender commandSender, String[] strings) {
|
||||
// 整理数据
|
||||
serverList = null;
|
||||
VariableStorage.getProxyServer().forEach((key, serverInfo) -> {
|
||||
if (serverList == null) {
|
||||
serverList = new StringBuilder("\t" + serverInfo.getName());
|
||||
} else {
|
||||
serverList.append(", ").append(serverInfo.getName());
|
||||
}
|
||||
});
|
||||
// 返回列表信息
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "当前服务器如下:");
|
||||
commandSender.sendMessage(serverList.toString());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.frontleaves.bungeecross.commands;
|
||||
|
||||
import com.frontleaves.bungeecross.BungeeCross;
|
||||
import com.frontleaves.bungeecross.configuration.VariableStorage;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* 返回大厅指令
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.0-SNAPSHOT
|
||||
* @version v1.0-SNAPSHOT
|
||||
*/
|
||||
public class ReturnHubCommand extends Command {
|
||||
private final BungeeCross plugin;
|
||||
public ReturnHubCommand(String name, BungeeCross bungeeCross) {
|
||||
super(name);
|
||||
plugin = bungeeCross;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull CommandSender commandSender, String[] strings) {
|
||||
// 检查玩家所属服务器
|
||||
String playerName = commandSender.getName();
|
||||
ServerInfo serverInfo = plugin.getProxy().getPlayer(playerName).getServer().getInfo();
|
||||
if (VariableStorage.getLoginServer().contains(serverInfo.getName())) {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "登录服无权限传送");
|
||||
} else {
|
||||
plugin.getProxy().getPlayer(playerName).connect(plugin.getProxy().getServerInfo("登陆大厅"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.frontleaves.bungeecross.commands;
|
||||
|
||||
import com.frontleaves.bungeecross.BungeeCross;
|
||||
import com.frontleaves.bungeecross.configuration.VariableStorage;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* 传送到服务器
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @version v1.0-SNAPSHOT
|
||||
* @since v1.0-SNAPSHOT
|
||||
*/
|
||||
public class SendToServerCommand extends Command {
|
||||
private final BungeeCross plugin;
|
||||
public SendToServerCommand(String name, BungeeCross bungeeCross) {
|
||||
super(name);
|
||||
plugin = bungeeCross;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender commandSender, String @NotNull [] strings) {
|
||||
switch (strings.length) {
|
||||
case 1: {
|
||||
// 权限检查
|
||||
if (commandSender.hasPermission("bungeecross.server.jump")) {
|
||||
if (commandSender instanceof ProxiedPlayer) {
|
||||
// 获取内容是否与服务器匹配
|
||||
try {
|
||||
ServerInfo serverInfo = plugin.getProxy().getServers().get(strings[0]);
|
||||
// 检查是否在登录区
|
||||
ServerInfo serverName = plugin.getProxy().getPlayer(commandSender.getName()).getServer().getInfo();
|
||||
if (!VariableStorage.getLoginServer().contains(serverName.getName())) {
|
||||
if (serverName != serverInfo) {
|
||||
plugin.getProxy().getPlayer(commandSender.getName()).connect(serverInfo);
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "跳转到服务器:" + serverInfo.getName());
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "您正处于 " + serverInfo.getName() + " 服务器中");
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "登录服禁止进行服务器跳转");
|
||||
}
|
||||
} catch (NullPointerException ignore) {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "服务器不存在");
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "该指令只允许玩家进行操作");
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "您没有权限");
|
||||
}
|
||||
}
|
||||
break;
|
||||
// 管理员操作
|
||||
case 2: {
|
||||
// 获取内容是否与
|
||||
if (commandSender.hasPermission("bungeecross.admin")) {
|
||||
ServerInfo serverInfo = plugin.getProxy().getServers().get(strings[0]);
|
||||
if (serverInfo != null) {
|
||||
ProxiedPlayer player = plugin.getProxy().getPlayer(strings[1]);
|
||||
// 玩家是否已链接
|
||||
if (player != null) {
|
||||
if (player.isConnected()) {
|
||||
ServerInfo playerServer = player.getServer().getInfo();
|
||||
if (playerServer != serverInfo) {
|
||||
player.connect(serverInfo);
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "已将 " + player.getName() + " 用户传送到 " + serverInfo.getName() + " 服务器");
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "玩家 " + player.getName() + " 正处于 " + playerServer.getName() + " 服务器中");
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "玩家 " + player.getName() + " 不在线");
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "玩家 " + strings[1] + " 不在线");
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "服务器不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
commandSender.sendMessage(VariableStorage.getPrefix() + "参数无效");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package com.frontleaves.bungeecross.configuration;
|
||||
|
||||
import com.frontleaves.bungeecross.BungeeCross;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* 服务器启动执行操作
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class ServerEnable {
|
||||
private final BungeeCross plugin;
|
||||
|
||||
/**
|
||||
* 服务器启动内容
|
||||
*/
|
||||
public void serverStart() {
|
||||
this.getConfig();
|
||||
this.getProxyServer();
|
||||
System.out.println(VariableStorage.getPrefix() + "§c配置文件加载完毕");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置文件,如果没有则自动创建
|
||||
*/
|
||||
private void checkConfigFile() {
|
||||
if (!plugin.getDataFolder().exists()) {
|
||||
if (plugin.getDataFolder().mkdir()) {
|
||||
plugin.getLogger().info("文件夹创建成功");
|
||||
} else {
|
||||
plugin.getLogger().info("文件夹创建失败");
|
||||
}
|
||||
}
|
||||
File configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
if (!configFile.exists()) {
|
||||
saveDefaultConfig(configFile);
|
||||
plugin.getLogger().info("配置文件创建成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置文件
|
||||
*/
|
||||
private void getConfig() {
|
||||
this.checkConfigFile();
|
||||
Configuration config;
|
||||
File configFile;
|
||||
// 读取文件信息
|
||||
try {
|
||||
configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// 读取配置文件
|
||||
if (config.getString("server_prefix") != null && !config.getString("server_prefix").isEmpty()) {
|
||||
VariableStorage.setPrefix(config.getString("server_prefix"));
|
||||
} else {
|
||||
VariableStorage.setPrefix("§7[§2Bungee§aCross§7] §r");
|
||||
}
|
||||
// 读取登录服务器
|
||||
if (config.getList("server_login").isEmpty()) {
|
||||
this.reloadTheDefaultConfig(configFile);
|
||||
return;
|
||||
} else {
|
||||
VariableStorage.setLoginServer(config.getList("server_login"));
|
||||
}
|
||||
// 读取大厅服务器
|
||||
if (config.getList("server_lobby").isEmpty()) {
|
||||
this.reloadTheDefaultConfig(configFile);
|
||||
} else {
|
||||
VariableStorage.setLobbyServer(config.getList("server_login"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部服务器
|
||||
*/
|
||||
private void getProxyServer() {
|
||||
VariableStorage.setProxyServer(plugin.getProxy().getServers());
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制默认配置文件到配置项
|
||||
*
|
||||
* @param configFile File
|
||||
*/
|
||||
private void saveDefaultConfig(@NotNull File configFile) {
|
||||
// 将默认配置文件从资源中复制到插件目录
|
||||
try (InputStream inputStream = plugin.getResourceAsStream("config.yml")) {
|
||||
Files.copy(inputStream, configFile.toPath());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新载入新的配置文件
|
||||
*
|
||||
* @param configFile File
|
||||
*/
|
||||
private void reloadTheDefaultConfig(@NotNull File configFile) {
|
||||
File newConfigFile = new File(plugin.getDataFolder(), "config.old.yml");
|
||||
try {
|
||||
Files.copy(configFile.toPath(), newConfigFile.toPath());
|
||||
if (configFile.delete()) {
|
||||
this.saveDefaultConfig(configFile);
|
||||
plugin.getLogger().warning("配置文件错误,已重新生成新的文件");
|
||||
plugin.getLogger().info("旧配置文件已生成 config.old.yml");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.frontleaves.bungeecross.configuration;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 变量存储
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
*/
|
||||
public class VariableStorage {
|
||||
@Getter
|
||||
@Setter
|
||||
private static String prefix;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private static Map<String, ServerInfo> proxyServer;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private static List<?> loginServer;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private static List<?> lobbyServer;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.frontleaves.bungeecross.events;
|
||||
|
||||
import com.frontleaves.bungeecross.configuration.VariableStorage;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* 玩家登录服务器事件
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @version v1.0-SNAPSHOT
|
||||
* @since v1.0-SNAPSHOT
|
||||
*/
|
||||
public class PlayerJoinProxyEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoinProxy(@NotNull ServerConnectedEvent event) {
|
||||
event.getPlayer().connect(VariableStorage.getProxyServer().get("login_1"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.frontleaves.bungeecross.events;
|
||||
|
||||
import net.md_5.bungee.api.event.ServerDisconnectEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* 玩家离开服务器事件
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @version v1.0-SNAPSHOT
|
||||
* @since v1.0-SNAPSHOT
|
||||
*/
|
||||
public class PlayerLeaveProxyEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDisconnectEvent(@NotNull ServerDisconnectEvent event) {
|
||||
|
||||
}
|
||||
}
|
5
src/main/resources/bungee.yml
Normal file
5
src/main/resources/bungee.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
name: BungeeCross
|
||||
version: '${project.version}'
|
||||
main: com.frontleaves.bungeecross.BungeeCross
|
||||
author: xiao_lfeng
|
||||
description: BungeeCord - 跨服
|
15
src/main/resources/config.yml
Normal file
15
src/main/resources/config.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
# BungeeCross
|
||||
# Author: 筱锋xiao_lfeng
|
||||
# Version: v1.0-SNAPSHOT
|
||||
|
||||
# 显示前缀
|
||||
server_prefix: "§7[§2Bungee§aCross§7] §r"
|
||||
|
||||
# 登录服务器列表
|
||||
server_login:
|
||||
- login_1
|
||||
- login_2
|
||||
|
||||
# 大厅服务器列表
|
||||
server_lobby:
|
||||
- 登陆大厅
|
Loading…
Reference in New Issue
Block a user