Finished private Minecraft chat, lots of bug fixes #42
2 changed files with 10 additions and 94 deletions
|
@ -9,11 +9,16 @@ import org.bukkit.conversations.Conversation;
|
|||
import org.bukkit.conversations.ConversationAbandonedEvent;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.permissions.PermissibleBase;
|
||||
import org.bukkit.permissions.ServerOperator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import buttondevteam.discordplugin.DiscordPlugin;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Delegate;
|
||||
import sx.blah.discord.handle.obj.IChannel;
|
||||
import sx.blah.discord.handle.obj.IUser;
|
||||
|
@ -21,15 +26,14 @@ import sx.blah.discord.handle.obj.IUser;
|
|||
public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
|
||||
protected DiscordFakePlayer(IUser user, IChannel channel, int entityId, UUID uuid) {
|
||||
super(user, channel, entityId, uuid);
|
||||
/*
|
||||
* try { perm = new PEXPermissible(this, (PermissionsExPlugin) Bukkit.getPluginManager().getPlugin("PermissionsEx")); } catch (ExecutionException | InterruptedException e) {
|
||||
* e.printStackTrace(); }
|
||||
*/
|
||||
perm = new VaultPermissibleBase(this);
|
||||
perm = new PermissibleBase(new ServerOperator() {
|
||||
private @Getter @Setter boolean op;
|
||||
});
|
||||
Bukkit.getPluginManager().callEvent(new PlayerJoinEvent(this, "Discord fake player joined"));
|
||||
}
|
||||
|
||||
@Delegate
|
||||
private VaultPermissibleBase perm;
|
||||
private PermissibleBase perm;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
package buttondevteam.discordplugin.playerfaker;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import buttondevteam.discordplugin.DiscordPlugin;
|
||||
|
||||
public class VaultPermissibleBase implements Permissible {
|
||||
private Player player;
|
||||
private OfflinePlayer op;
|
||||
|
||||
public VaultPermissibleBase(Player player) {
|
||||
this.player = player;
|
||||
op = Bukkit.getOfflinePlayer(player.getUniqueId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(String name) {
|
||||
return DiscordPlugin.perms.playerHas(player, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(Permission perm) {
|
||||
return DiscordPlugin.perms.playerHas(player, perm.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String inName) {
|
||||
return DiscordPlugin.perms.playerHas(player, inName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Permission perm) {
|
||||
return DiscordPlugin.perms.playerHas(player, perm.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return op.isOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value) {
|
||||
op.setOp(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttachment(PermissionAttachment attachment) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculatePermissions() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue