0.4.19: via april fools, 23w03a

This commit is contained in:
creeper123123321 2023-01-22 17:48:43 -03:00
parent 33d417c089
commit 0e7ef2034e
11 changed files with 55 additions and 318 deletions

View File

@ -40,7 +40,7 @@ compileKotlin.kotlinOptions.jvmTarget = "11"
val gitVersion: groovy.lang.Closure<String> by extra
group = "com.github.creeper123123321.viaaas"
version = "0.4.18+" + try {
version = "0.4.19+" + try {
gitVersion()
} catch (e: Exception) {
"unknown"
@ -52,6 +52,7 @@ repositories {
mavenCentral()
maven("https://repo.viaversion.com/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://maven.lenni0451.net/releases/")
maven("https://jitpack.io/")
}
@ -59,12 +60,13 @@ dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
val vvVer = "4.5.2-SNAPSHOT"
val vbVer = "4.5.2-SNAPSHOT"
val vvVer = "4.6.0-23w03a-SNAPSHOT"
val vbVer = "4.6.0-23w03a-SNAPSHOT"
val vrVer = "9e4ac93"
implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false }
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }
implementation("com.github.ViaVersion.ViaRewind:viarewind-all:$vrVer") { isTransitive = false }
implementation("net.raphimc:ViaAprilFools:2.0.1")
val nettyVer = "4.1.86.Final"
implementation("io.netty:netty-handler-proxy:$nettyVer")

View File

@ -0,0 +1,23 @@
package com.viaversion.aas.platform;
import net.raphimc.viaaprilfools.platform.ViaAprilFoolsPlatform;
import java.io.File;
import java.util.logging.Logger;
public class AspirinAprilFools implements ViaAprilFoolsPlatform {
private Logger logger = Logger.getLogger("ViaAprilFools");
@Override
public Logger getLogger() {
return logger;
}
public void init() {
init(getDataFolder());
}
@Override
public File getDataFolder() {
return new File("config/viaaprilfools");
}
}

View File

@ -12,6 +12,10 @@ public class AspirinBackwards implements ViaBackwardsPlatform {
return logger;
}
public void init() {
init(getDataFolder());
}
@Override
public void disable() {
}

View File

@ -1,7 +1,9 @@
package com.viaversion.aas.platform;
import de.gerrygames.viarewind.api.ViaRewindConfigImpl;
import de.gerrygames.viarewind.api.ViaRewindPlatform;
import java.io.File;
import java.util.logging.Logger;
public class AspirinRewind implements ViaRewindPlatform {
@ -10,4 +12,8 @@ public class AspirinRewind implements ViaRewindPlatform {
public Logger getLogger() {
return logger;
}
public void init() {
init(new ViaRewindConfigImpl(new File("config/viarewind.yml")));
}
}

View File

@ -1,143 +0,0 @@
/*
* Copyright (c) RK_01 2021.
*
* 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.
*
* ===================================
*
* Copyright (c) VIAaaS contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.viaversion.aas.protocol.sharewareto1_14;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
public enum ClientboundPacketsShareware implements ClientboundPacketType {
SPAWN_ENTITY, // 0x00
SPAWN_EXPERIENCE_ORB, // 0x01
SPAWN_GLOBAL_ENTITY, // 0x02
SPAWN_MOB, // 0x03
SPAWN_PAINTING, // 0x04
SPAWN_PLAYER, // 0x05
ENTITY_ANIMATION, // 0x06
STATISTICS, // 0x07
BLOCK_BREAK_ANIMATION, // 0x08
BLOCK_ENTITY_DATA, // 0x09
BLOCK_ACTION, // 0x0A
BLOCK_CHANGE, // 0x0B
BOSSBAR, // 0x0C
SERVER_DIFFICULTY, // 0x0D
CHAT_MESSAGE, // 0x0E
MULTI_BLOCK_CHANGE, // 0x0F
TAB_COMPLETE, // 0x10
DECLARE_COMMANDS, // 0x11
WINDOW_CONFIRMATION, // 0x12
CLOSE_WINDOW, // 0x13
OPEN_HORSE_WINDOW, // 0x14
WINDOW_ITEMS, // 0x15
WINDOW_PROPERTY, // 0x16
SET_SLOT, // 0x17
COOLDOWN, // 0x18
PLUGIN_MESSAGE, // 0x19
NAMED_SOUND, // 0x1A
DISCONNECT, // 0x1B
ENTITY_STATUS, // 0x1C
NBT_QUERY, // 0x1D
EXPLOSION, // 0x1E
UNLOAD_CHUNK, // 0x1F
GAME_EVENT, // 0x20
KEEP_ALIVE, // 0x21
CHUNK_DATA, // 0x22
EFFECT, // 0x23
SPAWN_PARTICLE, // 0x24
JOIN_GAME, // 0x25
MAP_DATA, // 0x26
ENTITY_MOVEMENT, // 0x27
ENTITY_POSITION, // 0x28
ENTITY_POSITION_AND_ROTATION, // 0x29
ENTITY_ROTATION, // 0x2A
VEHICLE_MOVE, // 0x2B
OPEN_BOOK, // 0x2C
OPEN_SIGN_EDITOR, // 0x2D
CRAFT_RECIPE_RESPONSE, // 0x2E
PLAYER_ABILITIES, // 0x2F
COMBAT_EVENT, // 0x30
PLAYER_INFO, // 0x31
FACE_PLAYER, // 0x32
PLAYER_POSITION, // 0x33
UNLOCK_RECIPES, // 0x34
DESTROY_ENTITIES, // 0x35
REMOVE_ENTITY_EFFECT, // 0x36
RESOURCE_PACK, // 0x37
RESPAWN, // 0x38
ENTITY_HEAD_LOOK, // 0x39
SELECT_ADVANCEMENTS_TAB, // 0x3A
WORLD_BORDER, // 0x3B
CAMERA, // 0x3C
HELD_ITEM_CHANGE, // 0x3D
DISPLAY_SCOREBOARD, // 0x3E
ENTITY_METADATA, // 0x3F
ATTACH_ENTITY, // 0x40
ENTITY_VELOCITY, // 0x41
ENTITY_EQUIPMENT, // 0x42
SET_EXPERIENCE, // 0x43
UPDATE_HEALTH, // 0x44
SCOREBOARD_OBJECTIVE, // 0x45
SET_PASSENGERS, // 0x46
TEAMS, // 0x47
UPDATE_SCORE, // 0x48
SPAWN_POSITION, // 0x49
TIME_UPDATE, // 0x4A
TITLE, // 0x4B
STOP_SOUND, // 0x4C
SOUND, // 0x4D
ENTITY_SOUND, // 0x4E
TAB_LIST, // 0x4F
COLLECT_ITEM, // 0x50
ENTITY_TELEPORT, // 0x51
ADVANCEMENTS, // 0x52
ENTITY_PROPERTIES, // 0x53
ENTITY_EFFECT, // 0x54
DECLARE_RECIPES, // 0x55
TAGS, // 0x56
UPDATE_LIGHT, // 0x57
OPEN_WINDOW, // 0x58
TRADE_LIST, // 0x59
UPDATE_VIEW_DISTANCE; // 0x5A
@Override
public int getId() {
return this.ordinal();
}
@Override
public String getName() {
return this.name();
}
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) RK_01 2021.
*
* 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.
*
* ===================================
*
* Copyright (c) VIAaaS contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.viaversion.aas.protocol.sharewareto1_14;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
// https://github.com/RaphiMC/ViaAprilFools/
public class ProtocolSharewareto1_14 extends AbstractProtocol<ClientboundPackets1_14, ClientboundPacketsShareware, ServerboundPackets1_14, ServerboundPacketsShareware> {
public ProtocolSharewareto1_14() {
super(ClientboundPackets1_14.class, ClientboundPacketsShareware.class, ServerboundPackets1_14.class, ServerboundPacketsShareware.class);
}
@Override
protected void registerPackets() {
this.cancelClientbound(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
this.cancelClientbound(ClientboundPackets1_14.ACKNOWLEDGE_PLAYER_DIGGING);
}
@Override
public void init(UserConnection userConnection) {
}
}

View File

@ -1,99 +0,0 @@
/*
* Copyright (c) RK_01 2021.
*
* 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.
*
* ===================================
*
* Copyright (c) VIAaaS contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.viaversion.aas.protocol.sharewareto1_14;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
public enum ServerboundPacketsShareware implements ServerboundPacketType {
TELEPORT_CONFIRM, // 0x00
QUERY_BLOCK_NBT, // 0x01
SET_DIFFICULTY, // 0x02
CHAT_MESSAGE, // 0x03
CLIENT_STATUS, // 0x04
CLIENT_SETTINGS, // 0x05
TAB_COMPLETE, // 0x06
WINDOW_CONFIRMATION, // 0x07
CLICK_WINDOW_BUTTON, // 0x08
CLICK_WINDOW, // 0x09
CLOSE_WINDOW, // 0x0A
PLUGIN_MESSAGE, // 0x0B
EDIT_BOOK, // 0x0C
ENTITY_NBT_REQUEST, // 0x0D
INTERACT_ENTITY, // 0x0E
LOCK_DIFFICULTY, // 0x0F
KEEP_ALIVE, // 0x10
PLAYER_MOVEMENT, // 0x11
PLAYER_POSITION, // 0x12
PLAYER_POSITION_AND_ROTATION, // 0x13
PLAYER_ROTATION, // 0x14
VEHICLE_MOVE, // 0x15
STEER_BOAT, // 0x16
PICK_ITEM, // 0x17
CRAFT_RECIPE_REQUEST, // 0x18
PLAYER_ABILITIES, // 0x19
PLAYER_DIGGING, // 0x1A
ENTITY_ACTION, // 0x1B
STEER_VEHICLE, // 0x1C
RECIPE_BOOK_DATA, // 0x1D
RENAME_ITEM, // 0x1E
RESOURCE_PACK_STATUS, // 0x1F
ADVANCEMENT_TAB, // 0x20
SELECT_TRADE, // 0x21
SET_BEACON_EFFECT, // 0x22
HELD_ITEM_CHANGE, // 0x23
UPDATE_COMMAND_BLOCK, // 0x24
UPDATE_COMMAND_BLOCK_MINECART, // 0x25
CREATIVE_INVENTORY_ACTION, // 0x26
UPDATE_JIGSAW_BLOCK, // 0x27
UPDATE_STRUCTURE_BLOCK, // 0x28
UPDATE_SIGN, // 0x29
ANIMATION, // 0x2A
SPECTATE, // 0x2B
PLAYER_BLOCK_PLACEMENT, // 0x2C
USE_ITEM; // 0x2D
@Override
public int getId() {
return ordinal();
}
@Override
public String getName() {
return name();
}
}

View File

@ -1,20 +1,19 @@
package com.viaversion.aas
import com.viaversion.aas.command.VIAaaSConsole
import com.viaversion.aas.platform.AspirinAprilFools
import com.viaversion.aas.platform.AspirinBackwards
import com.viaversion.aas.platform.AspirinPlatform
import com.viaversion.aas.platform.AspirinRewind
import com.viaversion.aas.protocol.registerAspirinProtocols
import com.viaversion.aas.web.ViaWebApp
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import de.gerrygames.viarewind.api.ViaRewindConfigImpl
import io.ktor.server.application.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.io.IoBuilder
import java.io.File
fun main(args: Array<String>) {
@ -54,9 +53,11 @@ private fun printSplash() {
}
private fun initVia() {
AspirinPlatform.initVia()
AspirinRewind().init(ViaRewindConfigImpl(File("config/viarewind.yml")))
AspirinBackwards().init(File("config/viabackwards"))
AspirinPlatform.initVia {
AspirinAprilFools().init()
}
AspirinBackwards().init()
AspirinRewind().init()
ProtocolVersion.register(-2, "AUTO")
registerAspirinProtocols()

View File

@ -30,6 +30,7 @@ import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPacke
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPackets1_19_1
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8
@ -89,7 +90,8 @@ object PacketRegistry {
ProtocolVersion.v1_18..ProtocolVersion.v1_18_2 to ClientboundPackets1_18.DISCONNECT.id,
ProtocolVersion.v1_19.singleton to ClientboundPackets1_19.DISCONNECT.id,
ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.DISCONNECT.id,
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.DISCONNECT.id
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.DISCONNECT.id,
ProtocolVersion.v1_19_4.singleton to ClientboundPackets1_19_4.DISCONNECT.id
)
)
register(
@ -105,7 +107,8 @@ object PacketRegistry {
ProtocolVersion.v1_18..ProtocolVersion.v1_18_2 to ClientboundPackets1_18.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19.singleton to ClientboundPackets1_19.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.PLUGIN_MESSAGE.id
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19_4.singleton to ClientboundPackets1_19_4.PLUGIN_MESSAGE.id
)
)
register(

View File

@ -34,7 +34,7 @@ object AspirinPlatform : ViaPlatform<UUID> {
eventLoop.execute(AspirinServer::waitMainStart)
}
fun initVia() {
fun initVia(enableListener: Runnable) {
Via.init(
ViaManagerImpl.builder()
.injector(AspirinInjector())
@ -45,8 +45,8 @@ object AspirinPlatform : ViaPlatform<UUID> {
conf = AspirinViaConfig()
MappingDataLoader.enableMappingsCache()
Via.getManager().addEnableListener(enableListener)
(Via.getManager() as ViaManagerImpl).init()
}
override fun sendMessage(p0: UUID, p1: String) = Unit
@ -61,7 +61,7 @@ object AspirinPlatform : ViaPlatform<UUID> {
override fun getDump() = JsonObject()
override fun kickPlayer(p0: UUID, p1: String) = false
override fun getApi() = AspirinApi()
override fun getDataFolder() = File("viaversion")
override fun getDataFolder() = File("config/viaversion")
override fun getConf() = conf
override fun runAsync(p0: Runnable) = FutureTask(CompletableFuture.runAsync(p0, executor))
override fun getLogger() = logger

View File

@ -1,17 +1,16 @@
package com.viaversion.aas.protocol
import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
import com.viaversion.aas.protocol.sharewareto1_14.ProtocolSharewareto1_14
import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion
// cursed 1.7 -> 1.8 from https://github.com/Gerrygames/ClientViaVersion
// + https://github.com/creeper123123321/ViaRewind/tree/17to18
val sharewareVersion = ProtocolVersion.register(1, "3D Shareware v1.34")
val sharewareVersion = AprilFoolsProtocolVersion.s3d_shareware
fun registerAspirinProtocols() {
// todo fix version checks for shareware
Via.getManager().protocolManager.maxPathDeltaIncrease = -1 // shareware id is weird
Via.getManager().protocolManager.registerProtocol(Protocol1_8To1_7_6, ProtocolVersion.v1_8, ProtocolVersion.v1_7_6)
// todo fix version checks
Via.getManager().protocolManager.registerProtocol(ProtocolSharewareto1_14(), sharewareVersion, ProtocolVersion.v1_14)
}