Pull command descriptions from Bukkit and Sponge versions when listing commands

This allows the description of the commands to display when listing the commands in bedrock by tab-completing. This is currently only available on Sponge and Bukkit versions as there is no support in BungeeCord and Velocity to get these values. This data is also not sent in any packet, so we cannot retrieve that from standalone either.
This commit is contained in:
RednedEpic 2020-04-19 18:08:14 -05:00
parent 672024c718
commit bab2b4a420
22 changed files with 340 additions and 23 deletions

View file

@ -33,7 +33,9 @@ import net.md_5.bungee.config.YamlConfiguration;
import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.common.bootstrap.IGeyserBootstrap;
import org.geysermc.connector.command.CommandManager;
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandExecutor;
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager;
import java.io.File;
import java.io.IOException;
@ -44,6 +46,7 @@ import java.util.logging.Level;
public class GeyserBungeePlugin extends Plugin implements IGeyserBootstrap {
private GeyserBungeeCommandManager geyserCommandManager;
private GeyserBungeeConfiguration geyserConfig;
private GeyserBungeeLogger geyserLogger;
@ -91,6 +94,8 @@ public class GeyserBungeePlugin extends Plugin implements IGeyserBootstrap {
this.geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode());
this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this);
this.geyserCommandManager = new GeyserBungeeCommandManager(connector);
this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor(connector));
}
@ -108,4 +113,9 @@ public class GeyserBungeePlugin extends Plugin implements IGeyserBootstrap {
public GeyserBungeeLogger getGeyserLogger() {
return geyserLogger;
}
@Override
public CommandManager getGeyserCommandManager() {
return this.geyserCommandManager;
}
}

View file

@ -71,6 +71,6 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor
}
private GeyserCommand getCommand(String label) {
return connector.getCommandMap().getCommands().get(label);
return connector.getCommandManager().getCommands().get(label);
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2019-2020 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.platform.bungeecord.command;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.CommandManager;
public class GeyserBungeeCommandManager extends CommandManager {
public GeyserBungeeCommandManager(GeyserConnector connector) {
super(connector);
}
@Override
public String getDescription(String command) {
return ""; // no support for command descriptions in bungee
}
}