1.14 support, better error handling #108

Merged
NorbiPeti merged 22 commits from dev into master 2019-10-30 18:43:31 +00:00
5 changed files with 49 additions and 22 deletions
Showing only changes of commit 5a5f653b86 - Show all commits

View file

@ -148,7 +148,7 @@
</repository> -->
<repository>
<id>Essentials</id>
<url>http://repo.ess3.net/content/repositories/essrel/</url>
<url>https://ci.ender.zone/plugin/repository/everything/</url>
</repository>
<repository>
<id>projectlombok.org</id>
@ -174,7 +174,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View file

@ -302,10 +302,6 @@ public class DiscordPlayerSender extends DiscordSenderBase implements IMCPlayer<
return player.addAttachment(plugin);
}
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance) {
return player.getTargetBlock(transparent, maxDistance);
}
public World getWorld() {
return player.getWorld();
}
@ -354,10 +350,6 @@ public class DiscordPlayerSender extends DiscordSenderBase implements IMCPlayer<
player.setCompassTarget(loc);
}
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance) {
return player.getLastTwoTargetBlocks(transparent, maxDistance);
}
public Location getCompassTarget() {
return player.getCompassTarget();
}
@ -1096,11 +1088,21 @@ public class DiscordPlayerSender extends DiscordSenderBase implements IMCPlayer<
}
public void hidePlayer(Player player) {
player.hidePlayer(player);
this.player.hidePlayer(player);
}
@Override
public void hidePlayer(Plugin plugin, Player player) {
this.player.hidePlayer(plugin, player);
}
public void showPlayer(Player player) {
player.showPlayer(player);
this.player.showPlayer(player);
}
@Override
public void showPlayer(Plugin plugin, Player player) {
this.player.showPlayer(plugin, player);
}
public boolean canSee(Player player) {

View file

@ -18,10 +18,13 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerCommandSendEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.server.BroadcastMessageEvent;
import org.bukkit.event.server.TabCompleteEvent;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Objects;
@ -154,4 +157,26 @@ class MCListener implements Listener {
public void onNickChange(NickChangeEvent event) {
MCChatUtils.updatePlayerList();
}
@EventHandler
public void onTabComplete(TabCompleteEvent event) {
int i = event.getBuffer().lastIndexOf(' ');
String t = event.getBuffer().substring(i + 1); //0 if not found
//System.out.println("Last token: " + t);
if (!t.startsWith("@"))
return;
String token = t.substring(1);
//System.out.println("Token: " + token);
val x = DiscordPlugin.mainServer.getMembers()
.flatMap(m -> Flux.just(m.getUsername(), m.getNickname().orElse("")))
.filter(s -> s.startsWith(token))
.map(s -> "@" + s)
.doOnNext(event.getCompletions()::add).blockLast();
//System.out.println("Finished - last: " + x);
}
@EventHandler
public void onCommandSend(PlayerCommandSendEvent event) {
event.getCommands().add("g");
}
}

View file

@ -552,10 +552,20 @@ public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
public void hidePlayer(Player player) {
}
@Override
public void hidePlayer(Plugin plugin, Player player) {
}
@Override
public void showPlayer(Player player) {
}
@Override
public void showPlayer(Plugin plugin, Player player) {
}
@Override
public boolean canSee(Player player) { // Nobody can see them
return false;

View file

@ -126,21 +126,11 @@ public abstract class DiscordLivingEntity extends DiscordEntity implements Livin
return Arrays.asList();
}
@Override
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance) {
return null;
}
@Override
public Block getTargetBlock(Set<Material> transparent, int maxDistance) {
return null;
}
@Override
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance) {
return Arrays.asList();
}
@Override
public List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance) {
return Arrays.asList();