94 lines
2.8 KiB
Java
94 lines
2.8 KiB
Java
/*
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
* Copyright (C) WorldEdit team and 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.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R3;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.network.protocol.game.ServerboundClientInformationPacket;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
import net.minecraft.stats.Stat;
|
|
import net.minecraft.world.MenuProvider;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
|
import net.minecraft.world.phys.Vec3;
|
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
|
|
import java.util.OptionalInt;
|
|
import java.util.UUID;
|
|
|
|
class PaperweightFakePlayer extends ServerPlayer {
|
|
private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]");
|
|
private static final Vec3 ORIGIN = new Vec3(0.0D, 0.0D, 0.0D);
|
|
|
|
PaperweightFakePlayer(ServerLevel world) {
|
|
super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE);
|
|
}
|
|
|
|
@Override
|
|
public Vec3 position() {
|
|
return ORIGIN;
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
}
|
|
|
|
@Override
|
|
public void die(DamageSource damagesource) {
|
|
}
|
|
|
|
@Override
|
|
public Entity changeDimension(ServerLevel worldserver, TeleportCause cause) {
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public OptionalInt openMenu(MenuProvider factory) {
|
|
return OptionalInt.empty();
|
|
}
|
|
|
|
@Override
|
|
public void updateOptions(ServerboundClientInformationPacket packet) {
|
|
}
|
|
|
|
@Override
|
|
public void displayClientMessage(Component message, boolean actionBar) {
|
|
}
|
|
|
|
@Override
|
|
public void awardStat(Stat<?> stat, int amount) {
|
|
}
|
|
|
|
@Override
|
|
public void awardStat(Stat<?> stat) {
|
|
}
|
|
|
|
@Override
|
|
public boolean isInvulnerableTo(DamageSource damageSource) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void openTextEdit(SignBlockEntity sign) {
|
|
}
|
|
}
|