Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-04 23:30:17 +01:00
Initial api draft
Dieser Commit ist enthalten in:
Ursprung
2c663e0ee5
Commit
83ddbd7d1a
27
api/base/pom.xml
Normale Datei
27
api/base/pom.xml
Normale Datei
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>geyser-parent</artifactId>
|
||||
<groupId>org.geysermc</groupId>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>base-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.checkerframework</groupId>
|
||||
<artifactId>checker-qual</artifactId>
|
||||
<version>3.19.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
79
api/base/src/main/java/org/geysermc/api/Api.java
Normale Datei
79
api/base/src/main/java/org/geysermc/api/Api.java
Normale Datei
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2021 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.api;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.api.session.Session;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The base API class.
|
||||
*
|
||||
* @param <S> the session type
|
||||
*/
|
||||
public interface Api<S extends Session> {
|
||||
|
||||
/**
|
||||
* Gets the session from the given
|
||||
* UUID, if applicable.
|
||||
*
|
||||
* @param uuid the UUID of the session
|
||||
* @return the session from the given UUID, if applicable
|
||||
*/
|
||||
@Nullable
|
||||
S sessionByUuid(@NonNull UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets the session from the given
|
||||
* XUID, if applicable.
|
||||
*
|
||||
* @param xuid the XUID of the session
|
||||
* @return the session from the given UUID, if applicable
|
||||
*/
|
||||
@Nullable
|
||||
S sessionByXuid(@NonNull String xuid);
|
||||
|
||||
/**
|
||||
* Gets the session from the given
|
||||
* name, if applicable.
|
||||
*
|
||||
* @param name the uuid of the session
|
||||
* @return the session from the given name, if applicable
|
||||
*/
|
||||
@Nullable
|
||||
S sessionByName(@NonNull String name);
|
||||
|
||||
/**
|
||||
* Gets all the online sessions.
|
||||
*
|
||||
* @return all the online sessions
|
||||
*/
|
||||
@NonNull
|
||||
List<S> onlineSessions();
|
||||
}
|
94
api/base/src/main/java/org/geysermc/api/Geyser.java
Normale Datei
94
api/base/src/main/java/org/geysermc/api/Geyser.java
Normale Datei
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2021 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.api;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* General API class for Geyser.
|
||||
*/
|
||||
@NonNull
|
||||
public class Geyser {
|
||||
private static Api<?> api;
|
||||
|
||||
/**
|
||||
* Returns the base api.
|
||||
*
|
||||
* @return the base api
|
||||
*/
|
||||
public static Api<?> api() {
|
||||
if (api == null) {
|
||||
throw new RuntimeException("Api has not been registered yet!");
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the api of the given type.
|
||||
*
|
||||
* @param apiClass the api class
|
||||
* @param <T> the type
|
||||
* @return the api of the given type
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Api<?>> T api(@NonNull Class<T> apiClass) {
|
||||
if (apiClass.isInstance(api)) {
|
||||
return (T) api;
|
||||
}
|
||||
|
||||
if (api == null) {
|
||||
throw new RuntimeException("Api has not been registered yet!");
|
||||
} else {
|
||||
throw new RuntimeException("Api was not an instance of " + apiClass + "! Was " + api.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given api type. The api cannot be
|
||||
* registered if {@link #registered()} is true as
|
||||
* an api has already been specified.
|
||||
*
|
||||
* @param api the api
|
||||
*/
|
||||
public static void set(@NonNull Api<?> api) {
|
||||
if (Geyser.api != null) {
|
||||
throw new RuntimeException("Cannot redefine already registered api!");
|
||||
}
|
||||
|
||||
Geyser.api = api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the api has been registered and
|
||||
* is ready for usage.
|
||||
*
|
||||
* @return if the api has been registered
|
||||
*/
|
||||
public static boolean registered() {
|
||||
return api != null;
|
||||
}
|
||||
}
|
@ -23,37 +23,36 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.api;
|
||||
package org.geysermc.api.session;
|
||||
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* General API class for Geyser.
|
||||
* Represents a player session.
|
||||
*/
|
||||
public abstract class Geyser {
|
||||
private static Geyser instance;
|
||||
@NonNull
|
||||
public interface Session {
|
||||
|
||||
/**
|
||||
* Gets the logger used by Geyser.
|
||||
* Gets the name of the session.
|
||||
*
|
||||
* @return the logger used by Geyser
|
||||
* @return the name of the session
|
||||
*/
|
||||
public abstract GeyserLogger getLogger();
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Returns the current {@link Geyser} instance.
|
||||
* Gets the {@link UUID} of the session.
|
||||
*
|
||||
* @return the current Geyser instance
|
||||
* @return the UUID of the session
|
||||
*/
|
||||
public static Geyser getInstance() {
|
||||
return instance;
|
||||
}
|
||||
UUID uuid();
|
||||
|
||||
protected static void setInstance(Geyser instance) {
|
||||
if (Geyser.instance != null) {
|
||||
throw new RuntimeException("Cannot redefine singleton Geyser!");
|
||||
}
|
||||
|
||||
Geyser.instance = instance;
|
||||
}
|
||||
/**
|
||||
* Gets the XUID of the session.
|
||||
*
|
||||
* @return the XUID of the session
|
||||
*/
|
||||
String xuid();
|
||||
}
|
27
api/geyser/pom.xml
Normale Datei
27
api/geyser/pom.xml
Normale Datei
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>geyser-parent</artifactId>
|
||||
<groupId>org.geysermc</groupId>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>geyser-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.geysermc</groupId>
|
||||
<artifactId>base-api</artifactId>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
63
api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java
Normale Datei
63
api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java
Normale Datei
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2021 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.geyser.api;
|
||||
|
||||
import org.geysermc.api.Api;
|
||||
import org.geysermc.api.Geyser;
|
||||
import org.geysermc.geyser.api.session.GeyserSession;
|
||||
|
||||
/**
|
||||
* Represents the API used in Geyser.
|
||||
*/
|
||||
public interface GeyserApi extends Api<GeyserSession> {
|
||||
|
||||
/**
|
||||
* Shuts down the current Geyser instance.
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* Reloads the current Geyser instance.
|
||||
*/
|
||||
void reload();
|
||||
|
||||
/**
|
||||
* Gets if this Geyser instance is running in an IDE. This only needs to be used in cases where files
|
||||
* expected to be in a jarfile are not present.
|
||||
*
|
||||
* @return true if the version number is not 'DEV'.
|
||||
*/
|
||||
boolean productionEnvironment();
|
||||
|
||||
/**
|
||||
* Gets the {@link GeyserApi}.
|
||||
*
|
||||
* @return the Geyser API
|
||||
*/
|
||||
static GeyserApi api() {
|
||||
return Geyser.api(GeyserApi.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2021 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.geyser.api.session;
|
||||
|
||||
import org.geysermc.api.session.Session;
|
||||
|
||||
/**
|
||||
* Represents a player session used in Geyser.
|
||||
*/
|
||||
public interface GeyserSession extends Session {
|
||||
}
|
@ -9,11 +9,16 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>api</artifactId>
|
||||
<artifactId>api-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>base</module>
|
||||
<module>geyser</module>
|
||||
</modules>
|
||||
</project>
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.platform.bungeecord;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
@ -41,7 +41,7 @@ public class BungeeCommandSender implements CommandSender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return handle.getName();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ import net.md_5.bungee.api.plugin.TabExecutor;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandExecutor;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -50,7 +50,7 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
BungeeCommandSender commandSender = new BungeeCommandSender(sender);
|
||||
GeyserSession session = this.commandExecutor.getGeyserSession(commandSender);
|
||||
GeyserSessionImpl session = this.commandExecutor.getGeyserSession(commandSender);
|
||||
|
||||
if (args.length > 0) {
|
||||
GeyserCommand command = this.commandExecutor.getCommand(args[0]);
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.spigot;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
@ -32,7 +32,7 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandExecutor;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -48,7 +48,7 @@ public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabE
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
SpigotCommandSender commandSender = new SpigotCommandSender(sender);
|
||||
GeyserSession session = getGeyserSession(commandSender);
|
||||
GeyserSessionImpl session = getGeyserSession(commandSender);
|
||||
|
||||
if (args.length > 0) {
|
||||
GeyserCommand geyserCommand = getCommand(args[0]);
|
||||
|
@ -54,7 +54,7 @@ public class SpigotCommandSender implements CommandSender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return handle.getName();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ import org.bukkit.event.block.BlockPistonEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.session.cache.PistonCache;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity;
|
||||
@ -88,12 +88,12 @@ public class GeyserPistonListener implements Listener {
|
||||
Object2IntMap<Vector3i> attachedBlocks = new Object2IntOpenHashMap<>();
|
||||
boolean blocksFilled = false;
|
||||
|
||||
for (Map.Entry<UUID, GeyserSession> entry : geyser.getSessionManager().getSessions().entrySet()) {
|
||||
for (Map.Entry<UUID, GeyserSessionImpl> entry : geyser.getSessionManager().getSessions().entrySet()) {
|
||||
Player player = Bukkit.getPlayer(entry.getKey());
|
||||
if (player == null || !player.getWorld().equals(world)) {
|
||||
continue;
|
||||
}
|
||||
GeyserSession session = entry.getValue();
|
||||
GeyserSessionImpl session = entry.getValue();
|
||||
|
||||
int dX = Math.abs(location.getBlockX() - player.getLocation().getBlockX()) >> 4;
|
||||
int dZ = Math.abs(location.getBlockZ() - player.getLocation().getBlockZ()) >> 4;
|
||||
|
@ -48,7 +48,7 @@ import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
|
||||
import org.geysermc.geyser.util.InventoryUtils;
|
||||
|
||||
@ -79,9 +79,9 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
GeyserSession session = null;
|
||||
for (GeyserSession otherSession : geyser.getSessionManager().getSessions().values()) {
|
||||
if (otherSession.getName().equals(event.getPlayer().getName())) {
|
||||
GeyserSessionImpl session = null;
|
||||
for (GeyserSessionImpl otherSession : geyser.getSessionManager().getSessions().values()) {
|
||||
if (otherSession.name().equals(event.getPlayer().getName())) {
|
||||
session = otherSession;
|
||||
break;
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
|
||||
sendServerRecipes(session);
|
||||
}
|
||||
|
||||
public void sendServerRecipes(GeyserSession session) {
|
||||
public void sendServerRecipes(GeyserSessionImpl session) {
|
||||
int netId = InventoryUtils.LAST_RECIPE_NET_ID;
|
||||
|
||||
CraftingDataPacket craftingDataPacket = new CraftingDataPacket();
|
||||
@ -161,7 +161,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private Pair<ItemStack, ItemData> translateToBedrock(GeyserSession session, org.bukkit.inventory.ItemStack itemStack) {
|
||||
private Pair<ItemStack, ItemData> translateToBedrock(GeyserSessionImpl session, org.bukkit.inventory.ItemStack itemStack) {
|
||||
if (itemStack != null && itemStack.getData() != null) {
|
||||
if (itemStack.getType().getId() == 0) {
|
||||
return new Pair<>(null, ItemData.AIR);
|
||||
|
@ -33,7 +33,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager;
|
||||
@ -45,7 +45,7 @@ public class GeyserSpigotBlockPlaceListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void place(final BlockPlaceEvent event) {
|
||||
GeyserSession session = geyser.getPlayerByUuid(event.getPlayer().getUniqueId());
|
||||
GeyserSessionImpl session = geyser.sessionByUuid(event.getPlayer().getUniqueId());
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockSto
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
|
||||
import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter;
|
||||
@ -48,7 +48,7 @@ public class GeyserSpigot1_12NativeWorldManager extends GeyserSpigot1_12WorldMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) {
|
||||
Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername());
|
||||
if (player == null) {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
|
@ -36,7 +36,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
import java.util.List;
|
||||
@ -66,7 +66,7 @@ public class GeyserSpigot1_12WorldManager extends GeyserSpigotWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) {
|
||||
Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername());
|
||||
if (player == null) {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
|
@ -26,11 +26,11 @@
|
||||
package org.geysermc.geyser.platform.spigot.world.manager;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
/**
|
||||
* Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)}
|
||||
* Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSessionImpl, int, int, int)}
|
||||
* cannot be accurate. Typically, this is when ViaVersion is not installed but a client still manages to connect.
|
||||
* If this occurs to you somehow, please let us know!!
|
||||
*/
|
||||
@ -40,7 +40,7 @@ public class GeyserSpigotFallbackWorldManager extends GeyserSpigotWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin;
|
||||
|
||||
import java.util.List;
|
||||
@ -66,7 +66,7 @@ public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorl
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) {
|
||||
int nativeBlockId = super.getBlockAt(session, x, y, z);
|
||||
return oldToNewBlockId.getOrDefault(nativeBlockId, nativeBlockId);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.spigot.world.manager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
|
||||
import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter;
|
||||
@ -42,7 +42,7 @@ public class GeyserSpigotNativeWorldManager extends GeyserSpigotWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) {
|
||||
Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername());
|
||||
if (player == null) {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
|
@ -39,7 +39,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
||||
import org.geysermc.geyser.level.GeyserWorldManager;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
@ -66,7 +66,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) {
|
||||
Player bukkitPlayer;
|
||||
if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
@ -90,7 +90,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad) {
|
||||
public NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad) {
|
||||
// Run as a task to prevent async issues
|
||||
Runnable lecternInfoGet = () -> {
|
||||
Player bukkitPlayer;
|
||||
@ -158,7 +158,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Boolean getGameRuleBool(GeyserSession session, GameRule gameRule) {
|
||||
public Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule) {
|
||||
String value = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getGameRuleValue(gameRule.getJavaID());
|
||||
if (!value.isEmpty()) {
|
||||
return Boolean.parseBoolean(value);
|
||||
@ -167,7 +167,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGameRuleInt(GeyserSession session, GameRule gameRule) {
|
||||
public int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule) {
|
||||
String value = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getGameRuleValue(gameRule.getJavaID());
|
||||
if (!value.isEmpty()) {
|
||||
return Integer.parseInt(value);
|
||||
@ -176,7 +176,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(GeyserSession session, String permission) {
|
||||
public boolean hasPermission(GeyserSessionImpl session, String permission) {
|
||||
return Bukkit.getPlayer(session.getPlayerEntity().getUsername()).hasPermission(permission);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.sponge;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@AllArgsConstructor
|
||||
|
@ -30,7 +30,7 @@ import org.geysermc.geyser.command.CommandExecutor;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.spongepowered.api.command.CommandCallable;
|
||||
import org.spongepowered.api.command.CommandResult;
|
||||
@ -54,7 +54,7 @@ public class GeyserSpongeCommandExecutor extends CommandExecutor implements Comm
|
||||
@Override
|
||||
public CommandResult process(CommandSource source, String arguments) {
|
||||
CommandSender commandSender = new SpongeCommandSender(source);
|
||||
GeyserSession session = getGeyserSession(commandSender);
|
||||
GeyserSessionImpl session = getGeyserSession(commandSender);
|
||||
|
||||
String[] args = arguments.split(" ");
|
||||
if (args.length > 0) {
|
||||
|
@ -38,7 +38,7 @@ public class SpongeCommandSender implements CommandSender {
|
||||
private CommandSource handle;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return handle.getName();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ import net.minecrell.terminalconsole.SimpleTerminalConsole;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
|
||||
@ -97,7 +97,7 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return "CONSOLE";
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.platform.standalone.gui;
|
||||
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.geysermc.geyser.platform.standalone.GeyserStandaloneLogger;
|
||||
import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager;
|
||||
@ -306,7 +306,7 @@ public class GeyserStandaloneGUI {
|
||||
// Update player table
|
||||
playerTableModel.getDataVector().removeAllElements();
|
||||
|
||||
for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) {
|
||||
for (GeyserSessionImpl player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) {
|
||||
Vector<String> row = new Vector<>();
|
||||
row.add(player.getSocketAddress().getHostName());
|
||||
row.add(player.getPlayerEntity().getUsername());
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.velocity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@AllArgsConstructor
|
||||
|
@ -31,7 +31,7 @@ import org.geysermc.geyser.command.CommandExecutor;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -47,7 +47,7 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si
|
||||
@Override
|
||||
public void execute(Invocation invocation) {
|
||||
CommandSender sender = new VelocityCommandSender(invocation.source());
|
||||
GeyserSession session = getGeyserSession(sender);
|
||||
GeyserSessionImpl session = getGeyserSession(sender);
|
||||
|
||||
if (invocation.arguments().length > 0) {
|
||||
GeyserCommand command = getCommand(invocation.arguments()[0]);
|
||||
|
@ -45,7 +45,7 @@ public class VelocityCommandSender implements CommandSender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String name() {
|
||||
if (handle instanceof Player) {
|
||||
return ((Player) handle).getUsername();
|
||||
} else if (handle instanceof ConsoleCommandSource) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geysermc</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<artifactId>geyser-api</artifactId>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.BedrockServer;
|
||||
import org.geysermc.common.PlatformType;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.Geyser;
|
||||
import org.geysermc.api.Geyser;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -73,14 +73,14 @@ public class GeyserConnector {
|
||||
}
|
||||
|
||||
public GeyserSession getPlayerByXuid(String xuid) {
|
||||
return new GeyserSession(GeyserImpl.getInstance().getPlayerByXuid(xuid));
|
||||
return new GeyserSession(GeyserImpl.getInstance().sessionByXuid(xuid));
|
||||
}
|
||||
|
||||
public GeyserSession getPlayerByUuid(UUID uuid) {
|
||||
return new GeyserSession(GeyserImpl.getInstance().getPlayerByUuid(uuid));
|
||||
return new GeyserSession(GeyserImpl.getInstance().sessionByUuid(uuid));
|
||||
}
|
||||
|
||||
public boolean isProductionEnvironment() {
|
||||
return GeyserImpl.getInstance().isProductionEnvironment();
|
||||
return GeyserImpl.getInstance().productionEnvironment();
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ package org.geysermc.connector.network.session;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
||||
import org.geysermc.connector.network.session.auth.AuthData;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
/**
|
||||
* Deprecated, legacy code. Serves as a wrapper around
|
||||
@ -37,9 +38,9 @@ import org.geysermc.connector.network.session.auth.AuthData;
|
||||
*/
|
||||
@Deprecated
|
||||
public class GeyserSession {
|
||||
private final org.geysermc.geyser.session.GeyserSession handle;
|
||||
private final GeyserSessionImpl handle;
|
||||
|
||||
public GeyserSession(org.geysermc.geyser.session.GeyserSession handle) {
|
||||
public GeyserSession(GeyserSessionImpl handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
@ -128,7 +129,7 @@ public class GeyserSession {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.handle.getName();
|
||||
return this.handle.name();
|
||||
}
|
||||
|
||||
public boolean isConsole() {
|
||||
|
@ -41,14 +41,14 @@ public class AuthData {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.handle.getName();
|
||||
return this.handle.name();
|
||||
}
|
||||
|
||||
public UUID getUUID() {
|
||||
return this.handle.getUuid();
|
||||
return this.handle.uuid();
|
||||
}
|
||||
|
||||
public String getXboxUUID() {
|
||||
return this.handle.getXuid();
|
||||
return this.handle.xuid();
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.geyser;
|
||||
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.geysermc.geyser.session.auth.AuthType;
|
||||
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser;
|
||||
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.geysermc.geyser.command.CommandManager;
|
||||
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
||||
import org.geysermc.geyser.level.GeyserWorldManager;
|
||||
|
@ -39,9 +39,12 @@ import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import io.netty.util.internal.SystemPropertyUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.common.PlatformType;
|
||||
import org.geysermc.geyser.api.Geyser;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.api.Geyser;
|
||||
import org.geysermc.geyser.api.GeyserApi;
|
||||
import org.geysermc.geyser.api.session.GeyserSession;
|
||||
import org.geysermc.geyser.command.CommandManager;
|
||||
import org.geysermc.geyser.session.auth.AuthType;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
@ -52,7 +55,7 @@ import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.geysermc.geyser.text.MinecraftLocale;
|
||||
import org.geysermc.geyser.util.Metrics;
|
||||
import org.geysermc.geyser.network.ConnectorServerEventHandler;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
|
||||
import org.geysermc.geyser.level.WorldManager;
|
||||
@ -67,7 +70,6 @@ import org.geysermc.floodgate.crypto.Base64Topping;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.news.NewsItemAction;
|
||||
import org.geysermc.floodgate.time.TimeSyncer;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
import javax.naming.directory.Attribute;
|
||||
import javax.naming.directory.InitialDirContext;
|
||||
@ -77,6 +79,7 @@ import java.net.UnknownHostException;
|
||||
import java.security.Key;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
@ -86,7 +89,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Getter
|
||||
public class GeyserImpl extends Geyser {
|
||||
public class GeyserImpl implements GeyserApi {
|
||||
public static final ObjectMapper JSON_MAPPER = new ObjectMapper()
|
||||
.enable(JsonParser.Feature.IGNORE_UNDEFINED)
|
||||
.enable(JsonParser.Feature.ALLOW_COMMENTS)
|
||||
@ -128,13 +131,17 @@ public class GeyserImpl extends Geyser {
|
||||
|
||||
private final Metrics metrics;
|
||||
|
||||
private static GeyserImpl instance;
|
||||
|
||||
private GeyserImpl(PlatformType platformType, GeyserBootstrap bootstrap) {
|
||||
long startupTime = System.currentTimeMillis();
|
||||
|
||||
Geyser.setInstance(this);
|
||||
|
||||
this.bootstrap = bootstrap;
|
||||
|
||||
instance = this;
|
||||
|
||||
Geyser.set(this);
|
||||
|
||||
GeyserLogger logger = bootstrap.getGeyserLogger();
|
||||
GeyserConfiguration config = bootstrap.getGeyserConfig();
|
||||
|
||||
@ -217,7 +224,7 @@ public class GeyserImpl extends Geyser {
|
||||
|
||||
String branch = "unknown";
|
||||
int buildNumber = -1;
|
||||
if (this.isProductionEnvironment()) {
|
||||
if (this.productionEnvironment()) {
|
||||
try {
|
||||
Properties gitProperties = new Properties();
|
||||
gitProperties.load(FileUtils.getResource("git.properties"));
|
||||
@ -290,7 +297,7 @@ public class GeyserImpl extends Geyser {
|
||||
metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION));
|
||||
metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> {
|
||||
Map<String, Integer> valueMap = new HashMap<>();
|
||||
for (GeyserSession session : sessionManager.getAllSessions()) {
|
||||
for (GeyserSessionImpl session : sessionManager.getAllSessions()) {
|
||||
if (session == null) continue;
|
||||
if (session.getClientData() == null) continue;
|
||||
String os = session.getClientData().getDeviceOs().toString();
|
||||
@ -304,7 +311,7 @@ public class GeyserImpl extends Geyser {
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> {
|
||||
Map<String, Integer> valueMap = new HashMap<>();
|
||||
for (GeyserSession session : sessionManager.getAllSessions()) {
|
||||
for (GeyserSessionImpl session : sessionManager.getAllSessions()) {
|
||||
if (session == null) continue;
|
||||
if (session.getClientData() == null) continue;
|
||||
String version = session.getClientData().getGameVersion();
|
||||
@ -395,6 +402,40 @@ public class GeyserImpl extends Geyser {
|
||||
newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable GeyserSessionImpl sessionByName(@NonNull String name) {
|
||||
for (GeyserSessionImpl session : sessionManager.getAllSessions()) {
|
||||
if (session.name().equals(name) || session.getProtocol().getProfile().getName().equals(name)) {
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public @NonNull List<GeyserSession> onlineSessions() {
|
||||
return (List<GeyserSession>) (List<? extends GeyserSession>) this.sessionManager.getAllSessions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable GeyserSessionImpl sessionByUuid(@NonNull UUID uuid) {
|
||||
return this.sessionManager.getSessions().get(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable GeyserSessionImpl sessionByXuid(@NonNull String xuid) {
|
||||
for (GeyserSessionImpl session : sessionManager.getAllSessions()) {
|
||||
if (session.xuid().equals(xuid)) {
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown"));
|
||||
shuttingDown = true;
|
||||
@ -419,47 +460,28 @@ public class GeyserImpl extends Geyser {
|
||||
bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.done"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a player by their current UUID
|
||||
*
|
||||
* @param uuid the uuid
|
||||
* @return the player or <code>null</code> if there is no player online with this UUID
|
||||
*/
|
||||
@Contract("null -> null")
|
||||
public GeyserSession getPlayerByUuid(UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return sessionManager.getSessions().get(uuid);
|
||||
@Override
|
||||
public void reload() {
|
||||
shutdown();
|
||||
bootstrap.onEnable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a player by their Xbox user identifier
|
||||
* Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files
|
||||
* expected to be in a jarfile are not present.
|
||||
*
|
||||
* @param xuid the Xbox user identifier
|
||||
* @return the player or <code>null</code> if there is no player online with this xuid
|
||||
* @return true if the version number is not 'DEV'.
|
||||
*/
|
||||
@SuppressWarnings("unused") // API usage
|
||||
public GeyserSession getPlayerByXuid(String xuid) {
|
||||
for (GeyserSession session : sessionManager.getAllSessions()) {
|
||||
if (session.getAuthData().getXuid().equals(xuid)) {
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@Override
|
||||
public boolean productionEnvironment() {
|
||||
//noinspection ConstantConditions - changes in production
|
||||
return !"DEV".equals(GeyserImpl.VERSION);
|
||||
}
|
||||
|
||||
public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) {
|
||||
return new GeyserImpl(platformType, bootstrap);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
shutdown();
|
||||
bootstrap.onEnable();
|
||||
}
|
||||
|
||||
public GeyserLogger getLogger() {
|
||||
return bootstrap.getGeyserLogger();
|
||||
}
|
||||
@ -480,18 +502,7 @@ public class GeyserImpl extends Geyser {
|
||||
return timeSyncer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files
|
||||
* expected to be in a jarfile are not present.
|
||||
*
|
||||
* @return true if the version number is not 'DEV'.
|
||||
*/
|
||||
public boolean isProductionEnvironment() {
|
||||
//noinspection ConstantConditions - changes in production
|
||||
return !"DEV".equals(GeyserImpl.VERSION);
|
||||
}
|
||||
|
||||
public static GeyserImpl getInstance() {
|
||||
return (GeyserImpl) Geyser.getInstance();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.api.logger;
|
||||
package org.geysermc.geyser;
|
||||
|
||||
public interface GeyserLogger {
|
||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.command;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@ -48,13 +48,13 @@ public class CommandExecutor {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public GeyserSession getGeyserSession(CommandSender sender) {
|
||||
public GeyserSessionImpl getGeyserSession(CommandSender sender) {
|
||||
if (sender.isConsole()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (GeyserSession session : geyser.getSessionManager().getSessions().values()) {
|
||||
if (sender.getName().equals(session.getPlayerEntity().getUsername())) {
|
||||
for (GeyserSessionImpl session : geyser.getSessionManager().getSessions().values()) {
|
||||
if (sender.name().equals(session.getPlayerEntity().getUsername())) {
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import lombok.Getter;
|
||||
import org.geysermc.common.PlatformType;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.defaults.*;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.*;
|
||||
@ -93,8 +93,8 @@ public abstract class CommandManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender instanceof GeyserSession) {
|
||||
cmd.execute((GeyserSession) sender, sender, args);
|
||||
if (sender instanceof GeyserSessionImpl) {
|
||||
cmd.execute((GeyserSessionImpl) sender, sender, args);
|
||||
} else {
|
||||
if (!cmd.isBedrockOnly()) {
|
||||
cmd.execute(null, sender, args);
|
||||
|
@ -33,7 +33,7 @@ import org.geysermc.geyser.text.GeyserLocale;
|
||||
*/
|
||||
public interface CommandSender {
|
||||
|
||||
String getName();
|
||||
String name();
|
||||
|
||||
default void sendMessage(String[] messages) {
|
||||
for (String message : messages) {
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.command;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@ -49,7 +49,7 @@ public abstract class GeyserCommand {
|
||||
@Setter
|
||||
private List<String> aliases = new ArrayList<>();
|
||||
|
||||
public abstract void execute(@Nullable GeyserSession session, CommandSender sender, String[] args);
|
||||
public abstract void execute(@Nullable GeyserSessionImpl session, CommandSender sender, String[] args);
|
||||
|
||||
/**
|
||||
* If false, hides the command from being shown on the Geyser Standalone GUI.
|
||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.command.defaults;
|
||||
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
public class AdvancementsCommand extends GeyserCommand {
|
||||
public AdvancementsCommand(String name, String description, String permission) {
|
||||
@ -35,7 +35,7 @@ public class AdvancementsCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
if (session != null) {
|
||||
session.getAdvancementsCache().buildAndShowMenuForm();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||
import org.geysermc.geyser.dump.DumpInfo;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.geysermc.geyser.util.WebUtils;
|
||||
|
||||
@ -58,7 +58,7 @@ public class DumpCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
// Only allow the console to create dumps on Geyser Standalone
|
||||
if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) {
|
||||
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale()));
|
||||
@ -137,7 +137,7 @@ public class DumpCommand extends GeyserCommand {
|
||||
|
||||
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl);
|
||||
if (!sender.isConsole()) {
|
||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl));
|
||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.commands.dump.created", sender.name(), uploadedDumpUrl));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -53,7 +53,7 @@ public class HelpCommand extends GeyserCommand {
|
||||
* @param args Not used.
|
||||
*/
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
int page = 1;
|
||||
int maxPage = 1;
|
||||
String header = GeyserLocale.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage);
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
@ -44,10 +44,10 @@ public class ListCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
String message = GeyserLocale.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(),
|
||||
geyser.getSessionManager().size(),
|
||||
geyser.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" ")));
|
||||
geyser.getSessionManager().getAllSessions().stream().map(GeyserSessionImpl::name).collect(Collectors.joining(" ")));
|
||||
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.util.BlockUtils;
|
||||
|
||||
public class OffhandCommand extends GeyserCommand {
|
||||
@ -41,7 +41,7 @@ public class OffhandCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import org.geysermc.common.PlatformType;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
public class ReloadCommand extends GeyserCommand {
|
||||
@ -42,7 +42,7 @@ public class ReloadCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) {
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.util.SettingsUtils;
|
||||
|
||||
public class SettingsCommand extends GeyserCommand {
|
||||
@ -37,7 +37,7 @@ public class SettingsCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
if (session != null) {
|
||||
session.sendForm(SettingsUtils.buildForm(session));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCl
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
public class StatisticsCommand extends GeyserCommand {
|
||||
|
||||
@ -39,7 +39,7 @@ public class StatisticsCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
if (session == null) return;
|
||||
|
||||
session.setWaitingForStatistics(true);
|
||||
|
@ -29,7 +29,7 @@ import org.geysermc.common.PlatformType;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -46,7 +46,7 @@ public class StopCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) {
|
||||
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale()));
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ import org.geysermc.geyser.command.CommandSender;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.util.FileUtils;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.geysermc.geyser.util.WebUtils;
|
||||
@ -54,7 +54,7 @@ public class VersionCommand extends GeyserCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) {
|
||||
String bedrockVersions;
|
||||
List<BedrockPacketCodec> supportedCodecs = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS;
|
||||
if (supportedCodecs.size() > 1) {
|
||||
@ -67,7 +67,7 @@ public class VersionCommand extends GeyserCommand {
|
||||
GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions));
|
||||
|
||||
// Disable update checking in dev mode and for players in Geyser Standalone
|
||||
if (GeyserImpl.getInstance().isProductionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) {
|
||||
if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) {
|
||||
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale()));
|
||||
try {
|
||||
Properties gitProp = new Properties();
|
||||
|
@ -26,7 +26,7 @@
|
||||
package org.geysermc.geyser.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.geysermc.geyser.api.logger.GeyserLogger;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.geysermc.geyser.session.auth.AuthType;
|
||||
import org.geysermc.geyser.network.CIDRMatcher;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
@ -39,7 +39,7 @@ import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.util.FileUtils;
|
||||
import org.geysermc.geyser.util.WebUtils;
|
||||
import org.geysermc.floodgate.util.DeviceOs;
|
||||
@ -113,7 +113,7 @@ public class DumpInfo {
|
||||
}
|
||||
|
||||
this.userPlatforms = new Object2IntOpenHashMap<>();
|
||||
for (GeyserSession session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) {
|
||||
for (GeyserSessionImpl session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) {
|
||||
DeviceOs device = session.getClientData().getDeviceOs();
|
||||
userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import org.geysermc.geyser.entity.type.living.animal.horse.HorseEntity;
|
||||
import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity;
|
||||
import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity;
|
||||
import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@ -62,7 +62,7 @@ public class InteractiveTagManager {
|
||||
* @param session the Bedrock client session
|
||||
* @param interactEntity the entity that the client is currently facing.
|
||||
*/
|
||||
public static void updateTag(GeyserSession session, Entity interactEntity) {
|
||||
public static void updateTag(GeyserSessionImpl session, Entity interactEntity) {
|
||||
ItemMapping mapping = session.getPlayerInventory().getItemInHand().getMapping(session);
|
||||
String javaIdentifierStripped = mapping.getJavaIdentifier().replace("minecraft:", "");
|
||||
EntityType entityType = interactEntity.getDefinition().entityType();
|
||||
|
@ -28,12 +28,12 @@ package org.geysermc.geyser.entity.factory;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface BaseEntityFactory<T extends Entity> extends EntityFactory<T> {
|
||||
|
||||
T create(GeyserSession session, long javaId, long bedrockId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw);
|
||||
T create(GeyserSessionImpl session, long javaId, long bedrockId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw);
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ package org.geysermc.geyser.entity.factory;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.type.ExpOrbEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ExperienceOrbEntityFactory extends EntityFactory<ExpOrbEntity> {
|
||||
|
||||
ExpOrbEntity create(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position);
|
||||
ExpOrbEntity create(GeyserSessionImpl session, int amount, long entityId, long geyserId, Vector3f position);
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ package org.geysermc.geyser.entity.factory;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.type.PaintingEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.PaintingType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface PaintingEntityFactory extends EntityFactory<PaintingEntity> {
|
||||
|
||||
PaintingEntity create(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction);
|
||||
PaintingEntity create(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction);
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AbstractArrowEntity extends Entity {
|
||||
|
||||
public AbstractArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public AbstractArrowEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
|
||||
// Set the correct texture if using the resource pack
|
||||
|
@ -32,14 +32,14 @@ import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AreaEffectCloudEntity extends Entity {
|
||||
|
||||
public AreaEffectCloudEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public AreaEffectCloudEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -65,7 +65,7 @@ public class BoatEntity extends Entity {
|
||||
// Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it
|
||||
private final float ROWING_SPEED = 0.05f;
|
||||
|
||||
public BoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public BoatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
// Initial rotation is incorrect
|
||||
super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90);
|
||||
|
||||
@ -154,7 +154,7 @@ public class BoatEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLeftPaddle(GeyserSession session, Entity rower) {
|
||||
private void updateLeftPaddle(GeyserSessionImpl session, Entity rower) {
|
||||
if (isPaddlingLeft) {
|
||||
paddleTimeLeft += ROWING_SPEED;
|
||||
sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_LEFT, paddleTimeLeft);
|
||||
@ -167,7 +167,7 @@ public class BoatEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRightPaddle(GeyserSession session, Entity rower) {
|
||||
private void updateRightPaddle(GeyserSessionImpl session, Entity rower) {
|
||||
if (isPaddlingRight) {
|
||||
paddleTimeRight += ROWING_SPEED;
|
||||
sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_RIGHT, paddleTimeRight);
|
||||
@ -180,7 +180,7 @@ public class BoatEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) {
|
||||
private void sendAnimationPacket(GeyserSessionImpl session, Entity rower, AnimatePacket.Action action, float rowTime) {
|
||||
AnimatePacket packet = new AnimatePacket();
|
||||
packet.setRuntimeEntityId(rower.getGeyserId());
|
||||
packet.setAction(action);
|
||||
|
@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity {
|
||||
|
||||
public CommandBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public CommandBlockMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -43,7 +43,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
|
||||
public int customBlockOffset = 0;
|
||||
public boolean showCustomBlock = false;
|
||||
|
||||
public DefaultBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public DefaultBlockMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
|
||||
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1);
|
||||
|
@ -32,14 +32,14 @@ import com.nukkitx.math.vector.Vector3i;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EnderCrystalEntity extends Entity {
|
||||
|
||||
public EnderCrystalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public EnderCrystalEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ import lombok.Setter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.GeyserDirtyMetadata;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
import org.geysermc.geyser.util.MathUtils;
|
||||
|
||||
@ -55,7 +55,7 @@ import java.util.UUID;
|
||||
@Getter
|
||||
@Setter
|
||||
public class Entity {
|
||||
protected final GeyserSession session;
|
||||
protected final GeyserSessionImpl session;
|
||||
|
||||
protected long entityId;
|
||||
protected final long geyserId;
|
||||
@ -108,7 +108,7 @@ public class Entity {
|
||||
@Setter(AccessLevel.PROTECTED) // For players
|
||||
private boolean flagsDirty = false;
|
||||
|
||||
public Entity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public Entity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
this.session = session;
|
||||
|
||||
this.entityId = entityId;
|
||||
|
@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
public class ExpOrbEntity extends Entity {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public ExpOrbEntity(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position) {
|
||||
public ExpOrbEntity(GeyserSessionImpl session, int amount, long entityId, long geyserId, Vector3f position) {
|
||||
super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0);
|
||||
|
||||
this.amount = amount;
|
||||
|
@ -30,14 +30,14 @@ import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class FallingBlockEntity extends Entity {
|
||||
private final int javaId;
|
||||
|
||||
public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) {
|
||||
public FallingBlockEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) {
|
||||
super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f);
|
||||
this.javaId = javaId;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.FireworkColor;
|
||||
import org.geysermc.geyser.util.MathUtils;
|
||||
import org.geysermc.floodgate.util.DeviceOs;
|
||||
@ -50,7 +50,7 @@ import java.util.UUID;
|
||||
|
||||
public class FireworkEntity extends Entity {
|
||||
|
||||
public FireworkEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public FireworkEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.physics.BoundingBox;
|
||||
import org.geysermc.geyser.translator.collision.BlockCollision;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
@ -56,7 +56,7 @@ public class FishingHookEntity extends ThrowableEntity {
|
||||
|
||||
private final BoundingBox boundingBox;
|
||||
|
||||
public FishingHookEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) {
|
||||
public FishingHookEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) {
|
||||
super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f);
|
||||
|
||||
this.boundingBox = new BoundingBox(0.125, 0.125, 0.125, 0.25, 0.25, 0.25);
|
||||
@ -140,7 +140,7 @@ public class FishingHookEntity extends ThrowableEntity {
|
||||
}
|
||||
}
|
||||
|
||||
private void sendSplashSound(GeyserSession session) {
|
||||
private void sendSplashSound(GeyserSessionImpl session) {
|
||||
if (!getFlag(EntityFlag.SILENT)) {
|
||||
float volume = (float) (0.2f * Math.sqrt(0.2 * (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) + motion.getY() * motion.getY()));
|
||||
if (volume > 1) {
|
||||
|
@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -37,7 +37,7 @@ import java.util.UUID;
|
||||
public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity {
|
||||
private boolean hasFuel = false;
|
||||
|
||||
public FurnaceMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public FurnaceMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
@ -46,7 +46,7 @@ public class ItemEntity extends ThrowableEntity {
|
||||
|
||||
private int waterLevel = -1;
|
||||
|
||||
public ItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public ItemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
|
||||
import com.nukkitx.protocol.bedrock.v465.Bedrock_v465;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
||||
@ -77,7 +77,7 @@ public class ItemFrameEntity extends Entity {
|
||||
*/
|
||||
private boolean changed = true;
|
||||
|
||||
public ItemFrameEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) {
|
||||
public ItemFrameEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 0f);
|
||||
|
||||
NbtMapBuilder blockBuilder = NbtMap.builder()
|
||||
@ -214,7 +214,7 @@ public class ItemFrameEntity extends Entity {
|
||||
* @param session GeyserSession.
|
||||
* @return Java entity ID or -1 if not found.
|
||||
*/
|
||||
public static ItemFrameEntity getItemFrameEntity(GeyserSession session, Vector3i position) {
|
||||
public static ItemFrameEntity getItemFrameEntity(GeyserSessionImpl session, Vector3i position) {
|
||||
return session.getItemFrameCache().get(position);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -39,7 +39,7 @@ public class ItemedFireballEntity extends ThrowableEntity {
|
||||
*/
|
||||
protected int futureTicks = 3;
|
||||
|
||||
public ItemedFireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public ItemedFireballEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw);
|
||||
|
||||
float magnitude = motion.length();
|
||||
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class LeashKnotEntity extends Entity {
|
||||
|
||||
public LeashKnotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public LeashKnotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
// Position is incorrect by default
|
||||
super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class LightningEntity extends Entity {
|
||||
|
||||
public LightningEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public LightningEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.util.AttributeUtils;
|
||||
import org.geysermc.geyser.util.ChunkUtils;
|
||||
@ -79,7 +79,7 @@ public class LivingEntity extends Entity {
|
||||
*/
|
||||
private boolean isMaxFrozenState = false;
|
||||
|
||||
public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public LivingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ public class LivingEntity extends Entity {
|
||||
return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, (float) Math.ceil(this.health), this.maxHealth);
|
||||
}
|
||||
|
||||
public void updateArmor(GeyserSession session) {
|
||||
public void updateArmor(GeyserSessionImpl session) {
|
||||
if (!valid) return;
|
||||
|
||||
ItemData helmet = this.helmet;
|
||||
@ -194,7 +194,7 @@ public class LivingEntity extends Entity {
|
||||
session.sendUpstreamPacket(armorEquipmentPacket);
|
||||
}
|
||||
|
||||
public void updateMainHand(GeyserSession session) {
|
||||
public void updateMainHand(GeyserSessionImpl session) {
|
||||
if (!valid) return;
|
||||
|
||||
MobEquipmentPacket handPacket = new MobEquipmentPacket();
|
||||
@ -207,7 +207,7 @@ public class LivingEntity extends Entity {
|
||||
session.sendUpstreamPacket(handPacket);
|
||||
}
|
||||
|
||||
public void updateOffHand(GeyserSession session) {
|
||||
public void updateOffHand(GeyserSessionImpl session) {
|
||||
if (!valid) return;
|
||||
|
||||
MobEquipmentPacket offHandPacket = new MobEquipmentPacket();
|
||||
@ -226,7 +226,7 @@ public class LivingEntity extends Entity {
|
||||
*
|
||||
* @param attributes the Java list of attributes sent from the server
|
||||
*/
|
||||
public void updateBedrockAttributes(GeyserSession session, List<Attribute> attributes) {
|
||||
public void updateBedrockAttributes(GeyserSessionImpl session, List<Attribute> attributes) {
|
||||
if (!valid) return;
|
||||
|
||||
List<AttributeData> newAttributes = new ArrayList<>();
|
||||
|
@ -30,13 +30,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class MinecartEntity extends Entity {
|
||||
|
||||
public MinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public MinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.PaintingType;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -38,7 +38,7 @@ public class PaintingEntity extends Entity {
|
||||
private final PaintingType paintingName;
|
||||
private final int direction;
|
||||
|
||||
public PaintingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) {
|
||||
public PaintingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) {
|
||||
super(session, entityId, geyserId, uuid, EntityDefinitions.PAINTING, position, Vector3f.ZERO, 0f, 0f, 0f);
|
||||
this.paintingName = paintingName;
|
||||
this.direction = direction;
|
||||
|
@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity {
|
||||
|
||||
public SpawnerMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public SpawnerMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class TNTEntity extends Entity implements Tickable {
|
||||
private int currentTick;
|
||||
|
||||
public TNTEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public TNTEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -44,7 +44,7 @@ public class ThrowableEntity extends Entity implements Tickable {
|
||||
|
||||
protected Vector3f lastJavaPosition;
|
||||
|
||||
public ThrowableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public ThrowableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
this.lastJavaPosition = position;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -42,7 +42,7 @@ public class ThrowableItemEntity extends ThrowableEntity {
|
||||
private int age;
|
||||
private boolean invisible;
|
||||
|
||||
public ThrowableItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public ThrowableItemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
setFlag(EntityFlag.INVISIBLE, true);
|
||||
invisible = false;
|
||||
|
@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.inventory.item.Potion;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
||||
@ -44,7 +44,7 @@ import java.util.UUID;
|
||||
public class ThrownPotionEntity extends ThrowableItemEntity {
|
||||
private static final EnumSet<Potion> NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD);
|
||||
|
||||
public ThrownPotionEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public ThrownPotionEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
import org.geysermc.geyser.inventory.item.TippedArrowPotion;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -39,7 +39,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public class TippedArrowEntity extends AbstractArrowEntity {
|
||||
|
||||
public TippedArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public TippedArrowEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class TridentEntity extends AbstractArrowEntity {
|
||||
|
||||
public TridentEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public TridentEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
}
|
||||
|
@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class WitherSkullEntity extends ItemedFireballEntity {
|
||||
private boolean isCharged;
|
||||
|
||||
public WitherSkullEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public WitherSkullEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
|
||||
this.futureTicks = 1;
|
||||
|
@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AbstractFishEntity extends WaterEntity {
|
||||
|
||||
public AbstractFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public AbstractFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
|
||||
setFlag(EntityFlag.CAN_SWIM, true);
|
||||
|
@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AgeableEntity extends CreatureEntity {
|
||||
|
||||
public AgeableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public AgeableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AmbientEntity extends MobEntity {
|
||||
|
||||
public AmbientEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public AmbientEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.entity.type.LivingEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
@ -78,7 +78,7 @@ public class ArmorStandEntity extends LivingEntity {
|
||||
*/
|
||||
private boolean positionUpdateRequired = false;
|
||||
|
||||
public ArmorStandEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public ArmorStandEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BatEntity extends AmbientEntity {
|
||||
|
||||
public BatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public BatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CreatureEntity extends MobEntity {
|
||||
|
||||
public CreatureEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public CreatureEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class FlyingEntity extends MobEntity {
|
||||
|
||||
public FlyingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public FlyingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ package org.geysermc.geyser.entity.type.living;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GlowSquidEntity extends SquidEntity {
|
||||
public GlowSquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public GlowSquidEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living;
|
||||
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GolemEntity extends CreatureEntity {
|
||||
|
||||
public GolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public GolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,13 @@ import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class IronGolemEntity extends GolemEntity {
|
||||
|
||||
public IronGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public IronGolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
// Indicate that we should show cracks through a resource pack
|
||||
setFlag(EntityFlag.BRIBED, true);
|
||||
|
@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class MagmaCubeEntity extends SlimeEntity {
|
||||
|
||||
public MagmaCubeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public MagmaCubeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.type.LivingEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -43,7 +43,7 @@ public class MobEntity extends LivingEntity {
|
||||
@Getter
|
||||
private long leashHolderBedrockId;
|
||||
|
||||
public MobEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public MobEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.GeyserSessionImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class SlimeEntity extends MobEntity {
|
||||
|
||||
public SlimeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
public SlimeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||
}
|
||||
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren