|
| 1 | +package me.regadpole.plumbot.bukkit.listener; |
| 2 | + |
| 3 | +import me.regadpole.plumbot.bukkit.util.ServerManager; |
| 4 | +import org.bukkit.Bukkit; |
| 5 | +import org.bukkit.Server; |
| 6 | +import org.bukkit.command.ConsoleCommandSender; |
| 7 | +import org.bukkit.conversations.Conversation; |
| 8 | +import org.bukkit.conversations.ConversationAbandonedEvent; |
| 9 | +import org.bukkit.permissions.Permission; |
| 10 | +import org.bukkit.permissions.PermissionAttachment; |
| 11 | +import org.bukkit.permissions.PermissionAttachmentInfo; |
| 12 | +import org.bukkit.plugin.Plugin; |
| 13 | +import org.jetbrains.annotations.NotNull; |
| 14 | +import org.jetbrains.annotations.Nullable; |
| 15 | + |
| 16 | +import java.util.Set; |
| 17 | +import java.util.UUID; |
| 18 | + |
| 19 | +public class ConsoleSender implements ConsoleCommandSender { |
| 20 | + |
| 21 | + private final Server server = Bukkit.getServer(); |
| 22 | + |
| 23 | + public Server getServer() { |
| 24 | + return this.server; |
| 25 | + } |
| 26 | + |
| 27 | + public String getName() { |
| 28 | + return "CONSOLE"; |
| 29 | + } |
| 30 | + |
| 31 | + public void sendMessage(String message) { |
| 32 | + ServerManager.msgList.add(message); |
| 33 | + } |
| 34 | + |
| 35 | + public void sendMessage(String[] messages) { |
| 36 | + for (String msg : messages) |
| 37 | + sendMessage(msg); |
| 38 | + } |
| 39 | + |
| 40 | + public void sendMessage(@Nullable UUID sender, @NotNull String message) { |
| 41 | + ServerManager.msgList.add(message); |
| 42 | + } |
| 43 | + |
| 44 | + public void sendMessage(@Nullable UUID sender, @NotNull String[] messages) { |
| 45 | + for (String msg : messages) |
| 46 | + sendMessage(null, msg); |
| 47 | + } |
| 48 | + |
| 49 | + public boolean isPermissionSet(String s) { |
| 50 | + return false; |
| 51 | + } |
| 52 | + |
| 53 | + public boolean isPermissionSet(Permission permission) { |
| 54 | + return false; |
| 55 | + } |
| 56 | + |
| 57 | + public boolean hasPermission(String s) { |
| 58 | + return true; |
| 59 | + } |
| 60 | + |
| 61 | + public boolean hasPermission(Permission permission) { |
| 62 | + return true; |
| 63 | + } |
| 64 | + |
| 65 | + public boolean isOp() { |
| 66 | + return true; |
| 67 | + } |
| 68 | + |
| 69 | + public void setOp(boolean b) { |
| 70 | + throw new UnsupportedOperationException(); |
| 71 | + } |
| 72 | + |
| 73 | + public Spigot spigot() { |
| 74 | + throw new UnsupportedOperationException(); |
| 75 | + } |
| 76 | + |
| 77 | + public boolean isConversing() { |
| 78 | + throw new UnsupportedOperationException(); |
| 79 | + } |
| 80 | + |
| 81 | + public void acceptConversationInput(String s) { |
| 82 | + ServerManager.msgList.add(s); |
| 83 | + throw new UnsupportedOperationException(); |
| 84 | + } |
| 85 | + |
| 86 | + public boolean beginConversation(Conversation conversation) { |
| 87 | + throw new UnsupportedOperationException(); |
| 88 | + } |
| 89 | + |
| 90 | + public void abandonConversation(Conversation conversation) { |
| 91 | + throw new UnsupportedOperationException(); |
| 92 | + } |
| 93 | + |
| 94 | + public void abandonConversation(Conversation conversation, ConversationAbandonedEvent conversationAbandonedEvent) { |
| 95 | + throw new UnsupportedOperationException(); |
| 96 | + } |
| 97 | + |
| 98 | + public void sendRawMessage(String s) { |
| 99 | + ServerManager.msgList.add(s); |
| 100 | + } |
| 101 | + |
| 102 | + public void sendRawMessage(@Nullable UUID sender, @NotNull String message) { |
| 103 | + ServerManager.msgList.add(message); |
| 104 | + } |
| 105 | + |
| 106 | + public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b) { |
| 107 | + ServerManager.msgList.add(s); |
| 108 | + throw new UnsupportedOperationException(); |
| 109 | + } |
| 110 | + |
| 111 | + public PermissionAttachment addAttachment(Plugin plugin) { |
| 112 | + throw new UnsupportedOperationException(); |
| 113 | + } |
| 114 | + |
| 115 | + public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b, int i) { |
| 116 | + ServerManager.msgList.add(s); |
| 117 | + throw new UnsupportedOperationException(); |
| 118 | + } |
| 119 | + |
| 120 | + public PermissionAttachment addAttachment(Plugin plugin, int i) { |
| 121 | + throw new UnsupportedOperationException(); |
| 122 | + } |
| 123 | + |
| 124 | + public void removeAttachment(PermissionAttachment permissionAttachment) { |
| 125 | + throw new UnsupportedOperationException(); |
| 126 | + } |
| 127 | + |
| 128 | + public void recalculatePermissions() { |
| 129 | + throw new UnsupportedOperationException(); |
| 130 | + } |
| 131 | + |
| 132 | + public Set<PermissionAttachmentInfo> getEffectivePermissions() { |
| 133 | + throw new UnsupportedOperationException(); |
| 134 | + } |
| 135 | + |
| 136 | +} |
0 commit comments