mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2025-02-22 02:41:23 +01:00
Remove unnecessary copied proxy logic
This commit is contained in:
parent
aaa2b322ff
commit
37011ab7b8
@ -19,22 +19,22 @@
|
||||
package com.discordsrv.fabric.console;
|
||||
|
||||
import com.discordsrv.fabric.FabricDiscordSRV;
|
||||
import com.discordsrv.fabric.console.executor.FabricCommandExecutorProvider;
|
||||
import com.discordsrv.fabric.command.game.sender.FabricCommandSender;
|
||||
import com.discordsrv.common.command.game.abstraction.executor.CommandExecutorProvider;
|
||||
import com.discordsrv.common.core.logging.backend.LoggingBackend;
|
||||
import com.discordsrv.common.core.logging.backend.impl.Log4JLoggerImpl;
|
||||
import com.discordsrv.common.feature.console.Console;
|
||||
import com.discordsrv.fabric.console.executor.FabricCommandExecutor;
|
||||
|
||||
public class FabricConsole extends FabricCommandSender implements Console {
|
||||
|
||||
private final LoggingBackend loggingBackend;
|
||||
private final FabricCommandExecutorProvider executorProvider;
|
||||
private final CommandExecutorProvider executorProvider;
|
||||
|
||||
public FabricConsole(FabricDiscordSRV discordSRV) {
|
||||
super(discordSRV, discordSRV.getServer().getCommandSource());
|
||||
this.loggingBackend = Log4JLoggerImpl.getRoot();
|
||||
this.executorProvider = new FabricCommandExecutorProvider(discordSRV);
|
||||
this.executorProvider = consumer -> new FabricCommandExecutor(discordSRV);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,24 +19,17 @@
|
||||
package com.discordsrv.fabric.console.executor;
|
||||
|
||||
import com.discordsrv.fabric.FabricDiscordSRV;
|
||||
import com.discordsrv.common.command.game.abstraction.executor.AdventureCommandExecutorProxy;
|
||||
import com.discordsrv.common.command.game.abstraction.executor.CommandExecutor;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class FabricCommandExecutor implements CommandExecutor {
|
||||
|
||||
private final FabricDiscordSRV discordSRV;
|
||||
private final ServerCommandSource source;
|
||||
|
||||
public FabricCommandExecutor(FabricDiscordSRV discordSRV, Consumer<Component> componentConsumer) {
|
||||
public FabricCommandExecutor(FabricDiscordSRV discordSRV) {
|
||||
this.discordSRV = discordSRV;
|
||||
this.source = (ServerCommandSource) new AdventureCommandExecutorProxy(
|
||||
discordSRV.getServer().getCommandSource(),
|
||||
componentConsumer
|
||||
).getProxy();
|
||||
this.source = discordSRV.getServer().getCommandSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of DiscordSRV, licensed under the GPLv3 License
|
||||
* Copyright (c) 2016-2025 Austin "Scarsz" Shapiro, Henri "Vankka" Schubin and DiscordSRV contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.fabric.console.executor;
|
||||
|
||||
import com.discordsrv.fabric.FabricDiscordSRV;
|
||||
import com.discordsrv.common.command.game.abstraction.executor.CommandExecutor;
|
||||
import com.discordsrv.common.command.game.abstraction.executor.CommandExecutorProvider;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class FabricCommandExecutorProvider implements CommandExecutorProvider {
|
||||
|
||||
private final FabricDiscordSRV discordSRV;
|
||||
|
||||
public FabricCommandExecutorProvider(FabricDiscordSRV discordSRV) {
|
||||
this.discordSRV = discordSRV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutor getConsoleExecutor(Consumer<Component> componentConsumer) {
|
||||
return new FabricCommandExecutor(discordSRV, componentConsumer);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user