mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
stupid git
This commit is contained in:
parent
3dc3d80045
commit
7f35b64d93
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-present RedisBungee contributors
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
*
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.imaginarycode.minecraft.redisbungee;
|
|
||||||
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This platform class exposes some internal RedisBungee functions. You obtain an instance of this object by invoking {@link RedisBungeeAPI#getRedisBungeeApi()}
|
|
||||||
* or somehow you got the Plugin instance by you can call the api using {@link RedisBungeePlugin#getAbstractRedisBungeeApi()}.
|
|
||||||
*
|
|
||||||
* @author tuxed
|
|
||||||
* @since 0.2.3 | updated 0.8.0
|
|
||||||
*/
|
|
||||||
public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
|
||||||
|
|
||||||
private static RedisBungeeAPI redisBungeeApi;
|
|
||||||
|
|
||||||
public RedisBungeeAPI(RedisBungeePlugin<?> plugin) {
|
|
||||||
super(plugin);
|
|
||||||
if (redisBungeeApi == null) {
|
|
||||||
redisBungeeApi = this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the server where the specified player is playing. This function also deals with the case of local players
|
|
||||||
* as well, and will return local information on them.
|
|
||||||
*
|
|
||||||
* @param player a player uuid
|
|
||||||
* @return {@link ServerInfo} Can be null if proxy can't find it.
|
|
||||||
* @see #getServerNameFor(UUID)
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
public final ServerInfo getServerFor(@NonNull UUID player) {
|
|
||||||
String serverName = this.getServerNameFor(player);
|
|
||||||
if (serverName == null) return null;
|
|
||||||
return ((Plugin) this.plugin).getProxy().getServerInfo(serverName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Api instance
|
|
||||||
*
|
|
||||||
* @return the API instance.
|
|
||||||
* @since 0.6.5
|
|
||||||
*/
|
|
||||||
public static RedisBungeeAPI getRedisBungeeApi() {
|
|
||||||
return redisBungeeApi;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-present RedisBungee contributors
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
*
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.imaginarycode.minecraft.redisbungee.events;
|
|
||||||
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Event;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This event is sent when a player connects to a new server. RedisBungee sends the event only when
|
|
||||||
* the proxy the player has been connected to is different than the local proxy.
|
|
||||||
* <p>
|
|
||||||
* This event corresponds to {@link net.md_5.bungee.api.event.ServerConnectedEvent}, and is fired
|
|
||||||
* asynchronously.
|
|
||||||
*
|
|
||||||
* @since 0.3.4
|
|
||||||
*/
|
|
||||||
public class PlayerChangedServerNetworkEvent extends Event implements IPlayerChangedServerNetworkEvent {
|
|
||||||
private final UUID uuid;
|
|
||||||
private final String previousServer;
|
|
||||||
private final String server;
|
|
||||||
|
|
||||||
public PlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
this.previousServer = previousServer;
|
|
||||||
this.server = server;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getServer() {
|
|
||||||
return server;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPreviousServer() {
|
|
||||||
return previousServer;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-present RedisBungee contributors
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
*
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.imaginarycode.minecraft.redisbungee.events;
|
|
||||||
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Event;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This event is sent when a player joins the network. RedisBungee sends the event only when
|
|
||||||
* the proxy the player has been connected to is different than the local proxy.
|
|
||||||
* <p>
|
|
||||||
* This event corresponds to {@link net.md_5.bungee.api.event.PostLoginEvent}, and is fired
|
|
||||||
* asynchronously.
|
|
||||||
*
|
|
||||||
* @since 0.3.4
|
|
||||||
*/
|
|
||||||
public class PlayerJoinedNetworkEvent extends Event implements IPlayerJoinedNetworkEvent {
|
|
||||||
private final UUID uuid;
|
|
||||||
|
|
||||||
public PlayerJoinedNetworkEvent(UUID uuid) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-present RedisBungee contributors
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
*
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.imaginarycode.minecraft.redisbungee.events;
|
|
||||||
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Event;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This event is sent when a player disconnects. RedisBungee sends the event only when
|
|
||||||
* the proxy the player has been connected to is different than the local proxy.
|
|
||||||
* <p>
|
|
||||||
* This event corresponds to {@link net.md_5.bungee.api.event.PlayerDisconnectEvent}, and is fired
|
|
||||||
* asynchronously.
|
|
||||||
*
|
|
||||||
* @since 0.3.4
|
|
||||||
*/
|
|
||||||
public class PlayerLeftNetworkEvent extends Event implements IPlayerLeftNetworkEvent {
|
|
||||||
private final UUID uuid;
|
|
||||||
|
|
||||||
public PlayerLeftNetworkEvent(UUID uuid) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-present RedisBungee contributors
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
*
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.imaginarycode.minecraft.redisbungee.events;
|
|
||||||
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This event is posted when a PubSub message is received.
|
|
||||||
* <p>
|
|
||||||
* <strong>Warning</strong>: This event is fired in a separate thread!
|
|
||||||
*
|
|
||||||
* @since 0.2.6
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PubSubMessageEvent extends Event implements IPubSubMessageEvent {
|
|
||||||
private final String channel;
|
|
||||||
private final String message;
|
|
||||||
|
|
||||||
public PubSubMessageEvent(String channel, String message) {
|
|
||||||
this.channel = channel;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getChannel() {
|
|
||||||
return channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user