mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-04-08 16:10:26 +00:00
setup velocity, ValioBungee api
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2026 ValioBungee contributors
|
||||
*
|
||||
* This file is part of ValioBungee.
|
||||
*
|
||||
* ValioBungee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ValioBungee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ValioBungee. If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
|
||||
*/
|
||||
package net.limework.valiobungee.core;
|
||||
|
||||
public abstract class PlayerManager {}
|
||||
@@ -18,7 +18,10 @@
|
||||
*/
|
||||
package net.limework.valiobungee.core;
|
||||
|
||||
public interface ValioBungeePlatform {
|
||||
import net.limework.valiobungee.api.ValioBungeeAPIProvider;
|
||||
import net.limework.valiobungee.core.api.entities.NetworkEntitiesProvider;
|
||||
|
||||
public interface ValioBungeePlatform extends NetworkEntitiesProvider, ValioBungeeAPIProvider {
|
||||
|
||||
int localOnlinePlayers();
|
||||
|
||||
@@ -29,4 +32,14 @@ public interface ValioBungeePlatform {
|
||||
String proxyId();
|
||||
|
||||
ProxyManager proxyManager();
|
||||
|
||||
@Override
|
||||
default String getGitCommit() {
|
||||
return ConstantVariables.GIT_COMMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
default String getVersion() {
|
||||
return ConstantVariables.VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2026 ValioBungee contributors
|
||||
*
|
||||
* This file is part of ValioBungee.
|
||||
*
|
||||
* ValioBungee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ValioBungee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ValioBungee. If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
|
||||
*/
|
||||
package net.limework.valiobungee.core.api;
|
||||
|
||||
import net.limework.valiobungee.api.ValioBungeeAPI;
|
||||
|
||||
public class AbstractValioBungeeAPI implements ValioBungeeAPI {}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2026 ValioBungee contributors
|
||||
*
|
||||
* This file is part of ValioBungee.
|
||||
*
|
||||
* ValioBungee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ValioBungee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ValioBungee. If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
|
||||
*/
|
||||
package net.limework.valiobungee.core.api.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.limework.valiobungee.api.entity.NetworkPlayer;
|
||||
import net.limework.valiobungee.api.entity.NetworkProxy;
|
||||
import net.limework.valiobungee.core.ValioBungeePlatform;
|
||||
|
||||
public abstract class AbstractNetworkPlayer implements NetworkPlayer {
|
||||
|
||||
private final ValioBungeePlatform platform;
|
||||
private final UUID uuid;
|
||||
private final NetworkProxy proxy;
|
||||
|
||||
public AbstractNetworkPlayer(ValioBungeePlatform platform, UUID uuid, NetworkProxy proxy) {
|
||||
this.platform = platform;
|
||||
this.uuid = uuid;
|
||||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkProxy getProxy() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof AbstractNetworkPlayer that)) return false;
|
||||
return Objects.equals(uuid, that.uuid) && Objects.equals(proxy, that.proxy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(uuid, proxy);
|
||||
}
|
||||
}
|
||||
@@ -16,18 +16,19 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ValioBungee. If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
|
||||
*/
|
||||
package net.limework.valiobungee.core.api.impl;
|
||||
package net.limework.valiobungee.core.api.entities;
|
||||
|
||||
import net.limework.valiobungee.api.NetworkProxy;
|
||||
import java.util.Objects;
|
||||
import net.limework.valiobungee.api.entity.NetworkProxy;
|
||||
import net.limework.valiobungee.core.ValioBungeePlatform;
|
||||
|
||||
public class ImplNetworkProxy implements NetworkProxy {
|
||||
public abstract class AbstractNetworkProxy implements NetworkProxy {
|
||||
|
||||
private final ValioBungeePlatform platform;
|
||||
|
||||
private final String proxyId;
|
||||
|
||||
public ImplNetworkProxy(ValioBungeePlatform platform, String proxyId) {
|
||||
public AbstractNetworkProxy(ValioBungeePlatform platform, String proxyId) {
|
||||
this.platform = platform;
|
||||
this.proxyId = proxyId;
|
||||
}
|
||||
@@ -38,7 +39,7 @@ public class ImplNetworkProxy implements NetworkProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onlinePlayers() {
|
||||
public int onlinePlayersCount() {
|
||||
return this.platform.proxyManager().onlinePlayersCount(this.proxyId);
|
||||
}
|
||||
|
||||
@@ -46,4 +47,15 @@ public class ImplNetworkProxy implements NetworkProxy {
|
||||
public boolean isMe() {
|
||||
return this.platform.proxyId().equals(proxyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof AbstractNetworkProxy that)) return false;
|
||||
return Objects.equals(proxyId, that.proxyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(proxyId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2026 ValioBungee contributors
|
||||
*
|
||||
* This file is part of ValioBungee.
|
||||
*
|
||||
* ValioBungee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ValioBungee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ValioBungee. If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
|
||||
*/
|
||||
package net.limework.valiobungee.core.api.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.limework.valiobungee.api.entity.NetworkPlayer;
|
||||
import net.limework.valiobungee.api.entity.NetworkProxy;
|
||||
|
||||
public interface NetworkEntitiesProvider {
|
||||
|
||||
NetworkPlayer getNetworkPlayer(UUID uuid);
|
||||
|
||||
NetworkProxy getNetworkProxy(String id);
|
||||
|
||||
NetworkProxy getSelfProxy();
|
||||
}
|
||||
Reference in New Issue
Block a user