SteamWar/BauSystem2.0
Archiviert
12
0

Update TraceCommand to new CommandFramework stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-25 23:03:40 +01:00
Ursprung b8e2dd2250
Commit 8d63bea4a3

Datei anzeigen

@ -38,7 +38,6 @@ import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.NonNull;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
@ -298,33 +297,16 @@ public class TraceCommand extends SWCommand {
} }
@Register({"show"}) @Register({"show"})
public void showCommand(Player p) { public void showCommand(Player p, @OptionalValue("entity") ShowModeType showModeType, ShowModeParameterType... showModeParameterTypes) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
TraceShowManager.show(p, new TraceEntityShowMode(p, new ShowModeParameter())); ShowModeParameter showModeParameter = new ShowModeParameter();
for (ShowModeParameterType showModeParameterType : showModeParameterTypes) {
showModeParameterType.getShowModeParameterConsumer().accept(showModeParameter);
}
TraceShowManager.show(p, showModeType.showModeBiFunction.apply(p, showModeParameter));
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p);
} }
@Register({"show"})
@Register({"show", "entity"})
public void showEntityCommand(Player p, ShowModeParameterType... showModeParameterTypes) {
internalShow(p, ShowModeType.ENTITY, showModeParameterTypes);
}
@Register({"show", "block"})
public void showBlockCommand(Player p, ShowModeParameterType... showModeParameterTypes) {
internalShow(p, ShowModeType.BLOCK, showModeParameterTypes);
}
@Register({"show", "particle"})
public void showParticleCommand(Player p, ShowModeParameterType... showModeParameterTypes) {
internalShow(p, ShowModeType.PARTICLE, showModeParameterTypes);
}
@Register({"show", "raw"})
public void rawShowEntityCommand(Player p, ShowModeParameterType... showModeParameterTypes) {
internalShow(p, ShowModeType.RAW, showModeParameterTypes);
}
@AllArgsConstructor @AllArgsConstructor
private enum ShowModeType { private enum ShowModeType {
ENTITY(TraceEntityShowMode::new), ENTITY(TraceEntityShowMode::new),
@ -335,16 +317,6 @@ public class TraceCommand extends SWCommand {
private BiFunction<Player, ShowModeParameter, ShowMode<TNTPosition>> showModeBiFunction; private BiFunction<Player, ShowModeParameter, ShowMode<TNTPosition>> showModeBiFunction;
} }
private void internalShow(Player p, @NonNull ShowModeType showModeType, ShowModeParameterType... showModeParameterTypes) {
if (!permissionCheck(p)) return;
ShowModeParameter showModeParameter = new ShowModeParameter();
for (ShowModeParameterType showModeParameterType : showModeParameterTypes) {
showModeParameterType.getShowModeParameterConsumer().accept(showModeParameter);
}
TraceShowManager.show(p, showModeType.showModeBiFunction.apply(p, showModeParameter));
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p);
}
@Register({"show", "gui"}) @Register({"show", "gui"})
public void showGuiCommand(Player p) { public void showGuiCommand(Player p) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;