This commit is contained in:
ZeroEpoch1969 2019-09-09 22:18:46 -07:00
parent da383026e5
commit 3e57ef87bf
No known key found for this signature in database
GPG key ID: A7BAB4E14F089CF3
5 changed files with 25 additions and 12 deletions

14
pom.xml
View file

@ -39,13 +39,18 @@
<id>spigot</id> <id>spigot</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url> <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository> </repository>
<repository>
<id>maven-central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.12-pre5-SNAPSHOT</version> <version>1.14.4-R0.1-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -63,6 +68,13 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View file

@ -1,10 +1,12 @@
package me.totalfreedom.bukkittelnet.api; package me.totalfreedom.bukkittelnet.api;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
public class TelnetCommandEvent extends TelnetEvent implements Cancellable public class TelnetCommandEvent extends Event implements Cancellable
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -15,6 +17,7 @@ public class TelnetCommandEvent extends TelnetEvent implements Cancellable
public TelnetCommandEvent(CommandSender sender, String command) public TelnetCommandEvent(CommandSender sender, String command)
{ {
super(!Bukkit.getServer().isPrimaryThread());
this.cancelled = false; this.cancelled = false;
this.sender = sender; this.sender = sender;
this.command = command; this.command = command;

View file

@ -1,8 +0,0 @@
package me.totalfreedom.bukkittelnet.api;
import org.bukkit.event.server.ServerEvent;
public abstract class TelnetEvent extends ServerEvent
{
}

View file

@ -2,8 +2,10 @@ package me.totalfreedom.bukkittelnet.api;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.Bukkit;
import org.bukkit.event.Event;
public class TelnetPreLoginEvent extends TelnetEvent implements Cancellable public class TelnetPreLoginEvent extends Event implements Cancellable
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -15,6 +17,7 @@ public class TelnetPreLoginEvent extends TelnetEvent implements Cancellable
public TelnetPreLoginEvent(String ip, String name, boolean bypassPassword) public TelnetPreLoginEvent(String ip, String name, boolean bypassPassword)
{ {
super(!Bukkit.getServer().isPrimaryThread());
this.ip = ip; this.ip = ip;
this.name = name; this.name = name;
this.bypassPassword = bypassPassword; this.bypassPassword = bypassPassword;
@ -26,6 +29,7 @@ public class TelnetPreLoginEvent extends TelnetEvent implements Cancellable
return cancelled; return cancelled;
} }
@Override @Override
public void setCancelled(boolean cancel) public void setCancelled(boolean cancel)
{ {

View file

@ -4,9 +4,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
public class TelnetRequestDataTagsEvent extends TelnetEvent public class TelnetRequestDataTagsEvent extends Event
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -14,6 +15,7 @@ public class TelnetRequestDataTagsEvent extends TelnetEvent
public TelnetRequestDataTagsEvent() public TelnetRequestDataTagsEvent()
{ {
super(!Bukkit.getServer().isPrimaryThread());
for (final Player player : Bukkit.getServer().getOnlinePlayers()) for (final Player player : Bukkit.getServer().getOnlinePlayers())
{ {
dataTags.put(player, new HashMap<String, Object>()); dataTags.put(player, new HashMap<String, Object>());