Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Checkstyle fixes and warnings.
Should get 'working' builds now.
Dieser Commit ist enthalten in:
Ursprung
bb33897221
Commit
6192ba8dc1
@ -5,8 +5,9 @@
|
||||
<module name="Checker">
|
||||
<!-- Tabs are strictly banned -->
|
||||
<module name="FileTabCharacter"/>
|
||||
|
||||
<module name="SuppressWarningsFilter" />
|
||||
<module name="TreeWalker">
|
||||
<module name="SuppressWarningsHolder" /> <!-- allows for @SuppressWarnings annotation -->
|
||||
<!-- Important basics -->
|
||||
<!-- <module name="PackageDeclaration"/> Unlikely that we would miss this in a PR -->
|
||||
<module name="OuterTypeFilename"/> <!-- TypeName -> TypeName.java -->
|
||||
|
@ -53,6 +53,7 @@
|
||||
<allow pkg="org.lwjgl"/>
|
||||
<allow pkg="io.netty.buffer"/>
|
||||
<allow pkg="org.spongepowered.api" />
|
||||
<allow pkg="com.mojang.brigadier" />
|
||||
</subpackage>
|
||||
|
||||
<subpackage name="sponge">
|
||||
|
@ -24,12 +24,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.util.command.CommandMapping;
|
||||
import com.sk89q.worldedit.util.command.Parameter;
|
||||
import net.minecraft.command.CommandSource;
|
||||
@ -38,11 +33,12 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import java.util.LinkedList;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer;
|
||||
import static net.minecraft.command.Commands.argument;
|
||||
import static net.minecraft.command.Commands.literal;
|
||||
|
||||
public class CommandWrapper {
|
||||
public final class CommandWrapper {
|
||||
private CommandWrapper() {
|
||||
}
|
||||
|
||||
public static void register(CommandDispatcher<CommandSource> dispatcher, CommandMapping command) {
|
||||
LiteralArgumentBuilder<CommandSource> base = literal(command.getPrimaryAlias());
|
||||
|
@ -33,10 +33,11 @@ public class GuiReferenceCard extends GuiScreen {
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close") {
|
||||
this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2,
|
||||
(this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close") {
|
||||
@Override
|
||||
public void onClick(double p_194829_1_, double p_194829_3_) {
|
||||
super.onClick(p_194829_1_, p_194829_3_);
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
|
||||
mc.player.closeScreen();
|
||||
}
|
||||
|
@ -21,22 +21,25 @@ package com.sk89q.worldedit.forge.net.handler;
|
||||
|
||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||
import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage;
|
||||
import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage.Handler;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry.ChannelBuilder;
|
||||
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
||||
|
||||
public class InternalPacketHandler {
|
||||
public final class InternalPacketHandler {
|
||||
private static final String PROTOCOL_VERSION = Integer.toString(1);
|
||||
public static SimpleChannel HANDLER = NetworkRegistry.ChannelBuilder
|
||||
public static SimpleChannel HANDLER = ChannelBuilder
|
||||
.named(new ResourceLocation(ForgeWorldEdit.MOD_ID, "internal"))
|
||||
.clientAcceptedVersions(PROTOCOL_VERSION::equals)
|
||||
.serverAcceptedVersions(PROTOCOL_VERSION::equals)
|
||||
.networkProtocolVersion(() -> PROTOCOL_VERSION)
|
||||
.simpleChannel();
|
||||
|
||||
public static void init() {
|
||||
int disc = 0;
|
||||
private InternalPacketHandler() {
|
||||
}
|
||||
|
||||
HANDLER.registerMessage(disc++, LeftClickAirEventMessage.class, LeftClickAirEventMessage::encode, LeftClickAirEventMessage::decode, LeftClickAirEventMessage.Handler::handle);
|
||||
public static void init() {
|
||||
HANDLER.registerMessage(0, LeftClickAirEventMessage.class,
|
||||
LeftClickAirEventMessage::encode, LeftClickAirEventMessage::decode, Handler::handle);
|
||||
}
|
||||
}
|
||||
|
@ -26,18 +26,22 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.ThreadQuickExitException;
|
||||
import net.minecraft.network.play.server.SPacketCustomPayload;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.network.NetworkEvent.ClientCustomPayloadEvent;
|
||||
import net.minecraftforge.fml.network.NetworkEvent.ServerCustomPayloadEvent;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry.ChannelBuilder;
|
||||
import net.minecraftforge.fml.network.event.EventNetworkChannel;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer;
|
||||
|
||||
public class WECUIPacketHandler {
|
||||
public final class WECUIPacketHandler {
|
||||
private WECUIPacketHandler() {
|
||||
}
|
||||
|
||||
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
|
||||
private static final String PROTOCOL_VERSION = Integer.toString(1);
|
||||
public static EventNetworkChannel HANDLER = NetworkRegistry.ChannelBuilder
|
||||
public static EventNetworkChannel HANDLER = ChannelBuilder
|
||||
.named(new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL))
|
||||
.clientAcceptedVersions(PROTOCOL_VERSION::equals)
|
||||
.serverAcceptedVersions(PROTOCOL_VERSION::equals)
|
||||
@ -49,7 +53,7 @@ public class WECUIPacketHandler {
|
||||
HANDLER.addListener(WECUIPacketHandler::callProcessPacket);
|
||||
}
|
||||
|
||||
public static void onPacketData(NetworkEvent.ServerCustomPayloadEvent event) {
|
||||
public static void onPacketData(ServerCustomPayloadEvent event) {
|
||||
EntityPlayerMP player = event.getSource().get().getSender();
|
||||
LocalSession session = ForgeWorldEdit.inst.getSession(player);
|
||||
|
||||
@ -62,13 +66,13 @@ public class WECUIPacketHandler {
|
||||
session.describeCUI(adaptPlayer(player));
|
||||
}
|
||||
|
||||
public static void callProcessPacket(NetworkEvent.ClientCustomPayloadEvent event) {
|
||||
public static void callProcessPacket(ClientCustomPayloadEvent event) {
|
||||
try {
|
||||
new SPacketCustomPayload(
|
||||
new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL),
|
||||
event.getPayload()
|
||||
).processPacket(Minecraft.getInstance().player.connection);
|
||||
} catch (ThreadQuickExitException suppress) {
|
||||
} catch (ThreadQuickExitException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
@ -22,20 +22,20 @@ package com.sk89q.worldedit.forge.net.packet;
|
||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty;
|
||||
import net.minecraftforge.fml.network.NetworkEvent.Context;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@SuppressWarnings({"NonFinalUtilityClass", "checkstyle:hideutilityclassconstructor"})
|
||||
public class LeftClickAirEventMessage {
|
||||
|
||||
public static final class Handler {
|
||||
|
||||
public static void handle(final LeftClickAirEventMessage message, Supplier<NetworkEvent.Context> ctx) {
|
||||
NetworkEvent.Context context = ctx.get();
|
||||
context.enqueueWork(() -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(context.getSender())));
|
||||
public static void handle(final LeftClickAirEventMessage message, Supplier<Context> ctx) {
|
||||
Context context = ctx.get();
|
||||
context.enqueueWork(() -> ForgeWorldEdit.inst.onPlayerInteract(new LeftClickEmpty(Objects.requireNonNull(context.getSender()))));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static LeftClickAirEventMessage decode(ByteBuf buf) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren