Added DC user mention tabcomplete...
But only for commands, because that's how it works now apparently #16 Also might have made it 1.14 ready, though I switched the dependency back to 1.12 Oh it's 1.12.2...
This commit is contained in:
parent
4082c2abbf
commit
5a5f653b86
5 changed files with 49 additions and 22 deletions
4
pom.xml
4
pom.xml
|
@ -148,7 +148,7 @@
|
||||||
</repository> -->
|
</repository> -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>Essentials</id>
|
<id>Essentials</id>
|
||||||
<url>http://repo.ess3.net/content/repositories/essrel/</url>
|
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>projectlombok.org</id>
|
<id>projectlombok.org</id>
|
||||||
|
@ -174,7 +174,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.12-R0.1-SNAPSHOT</version>
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -302,10 +302,6 @@ public class DiscordPlayerSender extends DiscordSenderBase implements IMCPlayer<
|
||||||
return player.addAttachment(plugin);
|
return player.addAttachment(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance) {
|
|
||||||
return player.getTargetBlock(transparent, maxDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return player.getWorld();
|
return player.getWorld();
|
||||||
}
|
}
|
||||||
|
@ -354,10 +350,6 @@ public class DiscordPlayerSender extends DiscordSenderBase implements IMCPlayer<
|
||||||
player.setCompassTarget(loc);
|
player.setCompassTarget(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance) {
|
|
||||||
return player.getLastTwoTargetBlocks(transparent, maxDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getCompassTarget() {
|
public Location getCompassTarget() {
|
||||||
return player.getCompassTarget();
|
return player.getCompassTarget();
|
||||||
}
|
}
|
||||||
|
@ -1096,11 +1088,21 @@ public class DiscordPlayerSender extends DiscordSenderBase implements IMCPlayer<
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hidePlayer(Player player) {
|
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) {
|
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) {
|
public boolean canSee(Player player) {
|
||||||
|
|
|
@ -18,10 +18,13 @@ import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.PlayerCommandSendEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||||
import org.bukkit.event.server.BroadcastMessageEvent;
|
import org.bukkit.event.server.BroadcastMessageEvent;
|
||||||
|
import org.bukkit.event.server.TabCompleteEvent;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -154,4 +157,26 @@ class MCListener implements Listener {
|
||||||
public void onNickChange(NickChangeEvent event) {
|
public void onNickChange(NickChangeEvent event) {
|
||||||
MCChatUtils.updatePlayerList();
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,10 +552,20 @@ public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
|
||||||
public void hidePlayer(Player player) {
|
public void hidePlayer(Player player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hidePlayer(Plugin plugin, Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showPlayer(Player player) {
|
public void showPlayer(Player player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showPlayer(Plugin plugin, Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSee(Player player) { // Nobody can see them
|
public boolean canSee(Player player) { // Nobody can see them
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -126,21 +126,11 @@ public abstract class DiscordLivingEntity extends DiscordEntity implements Livin
|
||||||
return Arrays.asList();
|
return Arrays.asList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block getTargetBlock(Set<Material> transparent, int maxDistance) {
|
public Block getTargetBlock(Set<Material> transparent, int maxDistance) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance) {
|
|
||||||
return Arrays.asList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance) {
|
public List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance) {
|
||||||
return Arrays.asList();
|
return Arrays.asList();
|
||||||
|
|
Loading…
Reference in a new issue