Finished private Minecraft chat, lots of bug fixes #42
4 changed files with 118 additions and 34 deletions
18
pom.xml
18
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<build>
|
||||
<!-- <sourceDirectory>target/generated-sources/delombok</sourceDirectory>
|
||||
<testSourceDirectory>target/generated-test-sources/delombok</testSourceDirectory> -->
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
|
@ -131,6 +131,10 @@
|
|||
<id>projectlombok.org</id>
|
||||
<url>http://projectlombok.org/mavenrepo</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>pex-repo</id>
|
||||
<url>http://pex-repo.aoeu.xyz</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
@ -188,5 +192,17 @@
|
|||
<version>1.16.16</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.tehkode</groupId>
|
||||
<artifactId>PermissionsEx</artifactId>
|
||||
<version>1.23.1</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,31 +1,19 @@
|
|||
package buttondevteam.discordplugin.playerfaker;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.PistonMoveReaction;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.permissions.PermissibleBase;
|
||||
import org.bukkit.permissions.ServerOperator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import buttondevteam.discordplugin.DiscordSenderBase;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Delegate;
|
||||
import sx.blah.discord.handle.obj.IChannel;
|
||||
import sx.blah.discord.handle.obj.IUser;
|
||||
|
||||
|
@ -40,12 +28,7 @@ public abstract class DiscordEntity extends DiscordSenderBase implements Entity
|
|||
|
||||
private HashMap<String, MetadataValue> metadata = new HashMap<String, MetadataValue>();
|
||||
|
||||
@Delegate
|
||||
private PermissibleBase perm = new PermissibleBase(new ServerOperator() {
|
||||
private @Getter @Setter boolean op;
|
||||
});
|
||||
|
||||
private Location location;
|
||||
private Location location = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
|
||||
private Vector velocity;
|
||||
private final int entityId;
|
||||
private EntityDamageEvent lastDamageCause;
|
||||
|
|
|
@ -2,7 +2,6 @@ package buttondevteam.discordplugin.playerfaker;
|
|||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.advancement.Advancement;
|
||||
import org.bukkit.advancement.AdvancementProgress;
|
||||
|
@ -15,14 +14,23 @@ import org.bukkit.plugin.Plugin;
|
|||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import buttondevteam.discordplugin.DiscordPlugin;
|
||||
import lombok.experimental.Delegate;
|
||||
import sx.blah.discord.handle.obj.IChannel;
|
||||
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);
|
||||
}
|
||||
|
||||
@Delegate
|
||||
private VaultPermissibleBase perm;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return user.getName();
|
||||
|
@ -120,7 +128,7 @@ public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return user.getNicknameForGuild(DiscordPlugin.mainServer);
|
||||
return user.getDisplayName(DiscordPlugin.mainServer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -632,75 +640,64 @@ public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
|
|||
@Override
|
||||
public void spawnParticle(Particle particle, double x, double y, double z, int count) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, Location location, int count, T data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||
double offsetZ) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||
double offsetY, double offsetZ) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||
double offsetZ, T data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||
double offsetY, double offsetZ, T data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||
double offsetZ, double extra) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||
double offsetY, double offsetZ, double extra) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||
double offsetZ, double extra, T data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||
double offsetY, double offsetZ, double extra, T data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
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