Push old code

This commit is contained in:
mathiascode 2019-09-22 04:58:53 +03:00
parent e24206932b
commit d3902cbc8b
3 changed files with 117 additions and 2 deletions

View file

@ -52,7 +52,6 @@ class CommandSkin implements CommandExecutor {
skinStream.close();
final PlayerProfile textureProfile = player.getPlayerProfile();
textureProfile.clearProperties();
textureProfile.setProperty(new ProfileProperty("textures", texture, signature));
player.sendMessage("Successfully set your skin to " + name + "'s");

View file

@ -2,6 +2,7 @@ package pw.kaboom.extras;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -13,6 +14,116 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.Server;
import org.bukkit.plugin.Plugin;
import java.util.Set;
class WrappedSender implements CommandSender {
private final CommandSender sender;
public WrappedSender(CommandSender sender) {
this.sender = sender;
}
@Override
public void sendMessage(String message) {
sender.sendMessage(message);/*.substring(0, Math.min(256, message.length())));*/
}
@Override
public void sendMessage(String[] messages) {
sender.sendMessage(messages);
}
@Override
public Server getServer() {
return sender.getServer();
}
@Override
public String getName() {
return sender.getName();
}
@Override
public boolean isPermissionSet(String name) {
return sender.isPermissionSet(name);
}
@Override
public boolean isPermissionSet(Permission perm) {
return sender.isPermissionSet(perm);
}
@Override
public boolean hasPermission(String name) {
return sender.hasPermission(name);
}
@Override
public boolean hasPermission(Permission perm) {
return sender.hasPermission(perm);
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
return sender.addAttachment(plugin, name, value);
}
@Override
public PermissionAttachment addAttachment(Plugin plugin) {
return sender.addAttachment(plugin);
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
return sender.addAttachment(plugin, name, value, ticks);
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
return sender.addAttachment(plugin, ticks);
}
@Override
public void removeAttachment(PermissionAttachment attachment) {
sender.removeAttachment(attachment);
}
@Override
public void recalculatePermissions() {
sender.recalculatePermissions();
}
@Override
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
return sender.getEffectivePermissions();
}
@Override
public boolean isOp() {
return sender.isOp();
}
@Override
public void setOp(boolean value) {
sender.setOp(value);
}
@Override
public Spigot spigot() {
return null;
}
}
class PlayerCommand implements Listener {
private Main main;
public PlayerCommand(Main main) {
@ -122,5 +233,11 @@ class PlayerCommand implements Listener {
event.setCancelled(true);
Command.broadcastCommandMessage(event.getPlayer(), "Stopping the server");
}
/*if (!event.isCancelled()) {
WrappedSender wrapped = new WrappedSender(event.getPlayer());
Bukkit.getServer().dispatchCommand(wrapped, event.getMessage().substring(1));
event.setCancelled(true);
}*/
}
}

View file

@ -141,7 +141,6 @@ class PlayerConnection implements Listener {
skinStream.close();
final PlayerProfile textureProfile = player.getPlayerProfile();
textureProfile.clearProperties();
textureProfile.setProperty(new ProfileProperty("textures", texture, signature));
new BukkitRunnable() {