mirror of
				https://e.coding.net/circlecloud/MiaoLobby.git
				synced 2025-11-03 17:36:01 +00:00 
			
		
		
		
	@@ -1,8 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<classpath>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="target/classes"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
							
								
								
									
										23
									
								
								.project
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								.project
									
									
									
									
									
								
							@@ -1,23 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<projectDescription>
 | 
					 | 
				
			||||||
	<name>MiaoLobby</name>
 | 
					 | 
				
			||||||
	<comment></comment>
 | 
					 | 
				
			||||||
	<projects>
 | 
					 | 
				
			||||||
	</projects>
 | 
					 | 
				
			||||||
	<buildSpec>
 | 
					 | 
				
			||||||
		<buildCommand>
 | 
					 | 
				
			||||||
			<name>org.eclipse.jdt.core.javabuilder</name>
 | 
					 | 
				
			||||||
			<arguments>
 | 
					 | 
				
			||||||
			</arguments>
 | 
					 | 
				
			||||||
		</buildCommand>
 | 
					 | 
				
			||||||
		<buildCommand>
 | 
					 | 
				
			||||||
			<name>org.eclipse.m2e.core.maven2Builder</name>
 | 
					 | 
				
			||||||
			<arguments>
 | 
					 | 
				
			||||||
			</arguments>
 | 
					 | 
				
			||||||
		</buildCommand>
 | 
					 | 
				
			||||||
	</buildSpec>
 | 
					 | 
				
			||||||
	<natures>
 | 
					 | 
				
			||||||
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
 | 
					 | 
				
			||||||
		<nature>org.eclipse.jdt.core.javanature</nature>
 | 
					 | 
				
			||||||
	</natures>
 | 
					 | 
				
			||||||
</projectDescription>
 | 
					 | 
				
			||||||
							
								
								
									
										20
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								pom.xml
									
									
									
									
									
								
							@@ -3,7 +3,7 @@
 | 
				
			|||||||
    <modelVersion>4.0.0</modelVersion>
 | 
					    <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
    <groupId>pw.yumc</groupId>
 | 
					    <groupId>pw.yumc</groupId>
 | 
				
			||||||
    <artifactId>MiaoLobby</artifactId>
 | 
					    <artifactId>MiaoLobby</artifactId>
 | 
				
			||||||
    <version>1.7</version>
 | 
					    <version>1.8</version>
 | 
				
			||||||
    <build>
 | 
					    <build>
 | 
				
			||||||
        <finalName>${project.name}</finalName>
 | 
					        <finalName>${project.name}</finalName>
 | 
				
			||||||
        <resources>
 | 
					        <resources>
 | 
				
			||||||
@@ -13,14 +13,6 @@
 | 
				
			|||||||
            </resource>
 | 
					            </resource>
 | 
				
			||||||
        </resources>
 | 
					        </resources>
 | 
				
			||||||
        <plugins>
 | 
					        <plugins>
 | 
				
			||||||
            <plugin>
 | 
					 | 
				
			||||||
                <artifactId>maven-compiler-plugin</artifactId>
 | 
					 | 
				
			||||||
                <version>3.3</version>
 | 
					 | 
				
			||||||
                <configuration>
 | 
					 | 
				
			||||||
                    <source>1.7</source>
 | 
					 | 
				
			||||||
                    <target>1.7</target>
 | 
					 | 
				
			||||||
                </configuration>
 | 
					 | 
				
			||||||
            </plugin>
 | 
					 | 
				
			||||||
            <plugin>
 | 
					            <plugin>
 | 
				
			||||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
					                <groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
                <artifactId>maven-shade-plugin</artifactId>
 | 
					                <artifactId>maven-shade-plugin</artifactId>
 | 
				
			||||||
@@ -77,8 +69,16 @@
 | 
				
			|||||||
        <url>http://ci.yumc.pw/job/${project.artifactId}/</url>
 | 
					        <url>http://ci.yumc.pw/job/${project.artifactId}/</url>
 | 
				
			||||||
    </ciManagement>
 | 
					    </ciManagement>
 | 
				
			||||||
    <properties>
 | 
					    <properties>
 | 
				
			||||||
 | 
					        <update.description>§a正式版本 §bv${project.version}</update.description>
 | 
				
			||||||
 | 
					        <update.changes>
 | 
				
			||||||
 | 
					            §617-07-03 §a新增: 传送前事件 PreLobbyTpEvent;
 | 
				
			||||||
 | 
					        </update.changes>
 | 
				
			||||||
 | 
					        <update.changelog>
 | 
				
			||||||
 | 
					        </update.changelog>
 | 
				
			||||||
        <env.GIT_COMMIT>DEV</env.GIT_COMMIT>
 | 
					        <env.GIT_COMMIT>DEV</env.GIT_COMMIT>
 | 
				
			||||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
					        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
				
			||||||
 | 
					        <maven.compiler.source>1.8</maven.compiler.source>
 | 
				
			||||||
 | 
					        <maven.compiler.target>1.8</maven.compiler.target>
 | 
				
			||||||
    </properties>
 | 
					    </properties>
 | 
				
			||||||
    <repositories>
 | 
					    <repositories>
 | 
				
			||||||
        <repository>
 | 
					        <repository>
 | 
				
			||||||
@@ -98,7 +98,7 @@
 | 
				
			|||||||
            <groupId>pw.yumc</groupId>
 | 
					            <groupId>pw.yumc</groupId>
 | 
				
			||||||
            <artifactId>YumCore</artifactId>
 | 
					            <artifactId>YumCore</artifactId>
 | 
				
			||||||
            <type>jar</type>
 | 
					            <type>jar</type>
 | 
				
			||||||
            <version>1.5</version>
 | 
					            <version>[1.7,)</version>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>cn.citycraft</groupId>
 | 
					            <groupId>cn.citycraft</groupId>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,19 +47,19 @@ public class MiaoLobby extends JavaPlugin implements Executor, Listener {
 | 
				
			|||||||
        Bukkit.getPluginManager().registerEvents(this, this);
 | 
					        Bukkit.getPluginManager().registerEvents(this, this);
 | 
				
			||||||
        if (config.AutoTP) {
 | 
					        if (config.AutoTP) {
 | 
				
			||||||
            new LoginHook();
 | 
					            new LoginHook();
 | 
				
			||||||
            Log.info("已配置为自动传送模式!");
 | 
					            Log.i("已配置为自动传送模式!");
 | 
				
			||||||
        } else if (config.LoginAutoTP) {
 | 
					        } else if (config.LoginAutoTP) {
 | 
				
			||||||
            if (Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
 | 
					            if (Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
 | 
				
			||||||
                new AuthMeHook();
 | 
					                new AuthMeHook();
 | 
				
			||||||
                Log.info("已配置为AuthMe登录传送模式!");
 | 
					                Log.i("已配置为AuthMe登录传送模式!");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (Bukkit.getPluginManager().isPluginEnabled("VBossAuth")) {
 | 
					            if (Bukkit.getPluginManager().isPluginEnabled("VBossAuth")) {
 | 
				
			||||||
                new VBossAuthHook();
 | 
					                new VBossAuthHook();
 | 
				
			||||||
                Log.info("已配置为VBossAuth登录传送模式!");
 | 
					                Log.i("已配置为VBossAuth登录传送模式!");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        new Statistics();
 | 
					        new Statistics();
 | 
				
			||||||
        new SubscribeTask(true, true);
 | 
					        new SubscribeTask(true, SubscribeTask.UpdateType.MAVEN);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,7 @@ import java.util.HashMap;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
import org.bukkit.scheduler.BukkitRunnable;
 | 
					import org.bukkit.scheduler.BukkitRunnable;
 | 
				
			||||||
import org.bukkit.scheduler.BukkitTask;
 | 
					import org.bukkit.scheduler.BukkitTask;
 | 
				
			||||||
@@ -13,6 +14,7 @@ import org.bukkit.scheduler.BukkitTask;
 | 
				
			|||||||
import com.google.common.io.ByteArrayDataOutput;
 | 
					import com.google.common.io.ByteArrayDataOutput;
 | 
				
			||||||
import com.google.common.io.ByteStreams;
 | 
					import com.google.common.io.ByteStreams;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import pw.yumc.MiaoLobby.event.PreLobbyTpEvent;
 | 
				
			||||||
import pw.yumc.YumCore.bukkit.P;
 | 
					import pw.yumc.YumCore.bukkit.P;
 | 
				
			||||||
import pw.yumc.YumCore.bukkit.compatible.C;
 | 
					import pw.yumc.YumCore.bukkit.compatible.C;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -45,6 +47,14 @@ public class Util {
 | 
				
			|||||||
        }.runTaskTimerAsynchronously(plugin, 0, 20));
 | 
					        }.runTaskTimerAsynchronously(plugin, 0, 20));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void delayTpTargetEvent(final Player player) {
 | 
				
			||||||
 | 
					        PreLobbyTpEvent event = new PreLobbyTpEvent(player);
 | 
				
			||||||
 | 
					        Bukkit.getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					        if (!event.isCancelled()) {
 | 
				
			||||||
 | 
					            delayTp(player);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void cancel(Player player) {
 | 
					    public static void cancel(Player player) {
 | 
				
			||||||
        if (player != null) {
 | 
					        if (player != null) {
 | 
				
			||||||
            BukkitTask task = tasks.get(player.getName());
 | 
					            BukkitTask task = tasks.get(player.getName());
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										45
									
								
								src/main/java/pw/yumc/MiaoLobby/event/PreLobbyTpEvent.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/main/java/pw/yumc/MiaoLobby/event/PreLobbyTpEvent.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
				
			|||||||
 | 
					package pw.yumc.MiaoLobby.event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					import org.bukkit.event.Cancellable;
 | 
				
			||||||
 | 
					import org.bukkit.event.Event;
 | 
				
			||||||
 | 
					import org.bukkit.event.HandlerList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Created with IntelliJ IDEA
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author 喵♂呜
 | 
				
			||||||
 | 
					 *         Created on 2017/7/3 18:58.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class PreLobbyTpEvent extends Event implements Cancellable {
 | 
				
			||||||
 | 
					    private static final HandlerList handlers = new HandlerList();
 | 
				
			||||||
 | 
					    private final Player player;
 | 
				
			||||||
 | 
					    private boolean cancel = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static HandlerList getHandlerList() {
 | 
				
			||||||
 | 
					        return handlers;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PreLobbyTpEvent(final Player player) {
 | 
				
			||||||
 | 
					        this.player = player;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public HandlerList getHandlers() {
 | 
				
			||||||
 | 
					        return handlers;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Player getPlayer() {
 | 
				
			||||||
 | 
					        return this.player;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean isCancelled() {
 | 
				
			||||||
 | 
					        return cancel;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void setCancelled(boolean cancel) {
 | 
				
			||||||
 | 
					        this.cancel = cancel;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -9,7 +9,7 @@ public class AuthMeHook extends Hook {
 | 
				
			|||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onLogin(final LoginEvent e) {
 | 
					    public void onLogin(final LoginEvent e) {
 | 
				
			||||||
        if (e.isLogin()) {
 | 
					        if (e.isLogin()) {
 | 
				
			||||||
            Util.delayTp(e.getPlayer());
 | 
					            Util.delayTpTargetEvent(e.getPlayer());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
package pw.yumc.MiaoLobby.hook;
 | 
					package pw.yumc.MiaoLobby.hook;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.event.EventHandler;
 | 
				
			||||||
import org.bukkit.event.player.PlayerJoinEvent;
 | 
					import org.bukkit.event.player.PlayerJoinEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import pw.yumc.MiaoLobby.Util;
 | 
					import pw.yumc.MiaoLobby.Util;
 | 
				
			||||||
@@ -9,7 +10,8 @@ import pw.yumc.MiaoLobby.Util;
 | 
				
			|||||||
 * @since 2016/12/25 0025
 | 
					 * @since 2016/12/25 0025
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class LoginHook extends Hook {
 | 
					public class LoginHook extends Hook {
 | 
				
			||||||
 | 
					    @EventHandler
 | 
				
			||||||
    public void onJoin(PlayerJoinEvent e) {
 | 
					    public void onJoin(PlayerJoinEvent e) {
 | 
				
			||||||
        Util.delayTp(e.getPlayer());
 | 
					        Util.delayTpTargetEvent(e.getPlayer());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,12 +10,12 @@ public class VBossAuthHook extends Hook {
 | 
				
			|||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onLogin(LoginEvent e) {
 | 
					    public void onLogin(LoginEvent e) {
 | 
				
			||||||
        if (e.isLogin()) {
 | 
					        if (e.isLogin()) {
 | 
				
			||||||
            Util.delayTp(e.getPlayer());
 | 
					            Util.delayTpTargetEvent(e.getPlayer());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onRegister(RegisterEvent e) {
 | 
					    public void onRegister(RegisterEvent e) {
 | 
				
			||||||
        Util.delayTp(e.getPlayer());
 | 
					        Util.delayTpTargetEvent(e.getPlayer());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user