mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Remove bungee module
This commit is contained in:
parent
b8e8c97b3e
commit
e036074af5
@ -1,54 +0,0 @@
|
|||||||
<?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">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<artifactId>quests-parent</artifactId>
|
|
||||||
<groupId>me.blackvein.quests</groupId>
|
|
||||||
<version>4.2.4</version>
|
|
||||||
</parent>
|
|
||||||
<artifactId>quests-bungee</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>bungeecord-repo</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-api</artifactId>
|
|
||||||
<version>1.16-R0.5-SNAPSHOT</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-api</artifactId>
|
|
||||||
<version>1.16-R0.5-SNAPSHOT</version>
|
|
||||||
<type>javadoc</type>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>Quests-Bungee-${project.version}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
||||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
|
||||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package me.blackvein.quests;
|
|
||||||
|
|
||||||
import me.blackvein.quests.listeners.BungeePlayerListener;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class QuestsBungee extends Plugin {
|
|
||||||
private static final String CHANNEL = "quests:update";
|
|
||||||
|
|
||||||
private BungeePlayerListener playerListener;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
playerListener = new BungeePlayerListener(this);
|
|
||||||
getProxy().registerChannel(CHANNEL);
|
|
||||||
getProxy().getPluginManager().registerListener(this, playerListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
getProxy().unregisterChannel(CHANNEL);
|
|
||||||
getProxy().getPluginManager().unregisterListener(playerListener);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
||||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
|
||||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package me.blackvein.quests.listeners;
|
|
||||||
|
|
||||||
import me.blackvein.quests.QuestsBungee;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
|
||||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
|
||||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
|
||||||
import net.md_5.bungee.event.EventHandler;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class BungeePlayerListener implements Listener {
|
|
||||||
private static final String CHANNEL = "quests:update";
|
|
||||||
|
|
||||||
private final QuestsBungee plugin;
|
|
||||||
|
|
||||||
public BungeePlayerListener(QuestsBungee plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerLoginOrSwitch(ServerSwitchEvent evt) {
|
|
||||||
ProxyServer.getInstance().getScheduler().schedule(plugin, () -> {
|
|
||||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
||||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
|
||||||
try {
|
|
||||||
dataOutputStream.writeUTF("LoadData:" + evt.getPlayer().getUniqueId());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
dispatchMessage(byteArrayOutputStream.toByteArray());
|
|
||||||
}, 2, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerDisconnect(PlayerDisconnectEvent evt) {
|
|
||||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
||||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
|
||||||
try {
|
|
||||||
dataOutputStream.writeUTF("SaveData:" + evt.getPlayer().getUniqueId());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
dispatchMessage(byteArrayOutputStream.toByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dispatchMessage(byte[] message) {
|
|
||||||
for (ServerInfo server : plugin.getProxy().getServers().values()) {
|
|
||||||
server.sendData(CHANNEL, message, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: QuestsBungee
|
|
||||||
main: me.blackvein.quests.QuestsBungee
|
|
||||||
version: ${project.version}-b${env.BUILD_NUMBER}
|
|
||||||
description: An extensive questing system.
|
|
||||||
author: PikaMug
|
|
@ -37,7 +37,6 @@ import me.blackvein.quests.exceptions.QuestFormatException;
|
|||||||
import me.blackvein.quests.exceptions.StageFormatException;
|
import me.blackvein.quests.exceptions.StageFormatException;
|
||||||
import me.blackvein.quests.interfaces.ReloadCallback;
|
import me.blackvein.quests.interfaces.ReloadCallback;
|
||||||
import me.blackvein.quests.listeners.BlockListener;
|
import me.blackvein.quests.listeners.BlockListener;
|
||||||
import me.blackvein.quests.listeners.BungeeListener;
|
|
||||||
import me.blackvein.quests.listeners.CommandManager;
|
import me.blackvein.quests.listeners.CommandManager;
|
||||||
import me.blackvein.quests.listeners.ConvoListener;
|
import me.blackvein.quests.listeners.ConvoListener;
|
||||||
import me.blackvein.quests.listeners.ItemListener;
|
import me.blackvein.quests.listeners.ItemListener;
|
||||||
@ -161,7 +160,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
private ConditionFactory conditionFactory;
|
private ConditionFactory conditionFactory;
|
||||||
private ConvoListener convoListener;
|
private ConvoListener convoListener;
|
||||||
private BlockListener blockListener;
|
private BlockListener blockListener;
|
||||||
private BungeeListener bungeeListener;
|
|
||||||
private ItemListener itemListener;
|
private ItemListener itemListener;
|
||||||
private NpcListener npcListener;
|
private NpcListener npcListener;
|
||||||
private PlayerListener playerListener;
|
private PlayerListener playerListener;
|
||||||
@ -190,7 +188,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
}
|
}
|
||||||
convoListener = new ConvoListener();
|
convoListener = new ConvoListener();
|
||||||
blockListener = new BlockListener(this);
|
blockListener = new BlockListener(this);
|
||||||
bungeeListener = new BungeeListener(this);
|
|
||||||
itemListener = new ItemListener(this);
|
itemListener = new ItemListener(this);
|
||||||
npcListener = new NpcListener(this);
|
npcListener = new NpcListener(this);
|
||||||
playerListener = new PlayerListener(this);
|
playerListener = new PlayerListener(this);
|
||||||
@ -271,9 +268,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
} else if (depends.getPartiesApi() != null) {
|
} else if (depends.getPartiesApi() != null) {
|
||||||
getServer().getPluginManager().registerEvents(getPartiesListener(), this);
|
getServer().getPluginManager().registerEvents(getPartiesListener(), this);
|
||||||
}
|
}
|
||||||
if (hasBungeeEnabled()) {
|
|
||||||
getServer().getMessenger().registerIncomingPluginChannel(this, "quests:update", getBungeeListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 11 - Attempt to check for updates
|
// 11 - Attempt to check for updates
|
||||||
new UpdateChecker(this, 3711).getVersion(version -> {
|
new UpdateChecker(this, 3711).getVersion(version -> {
|
||||||
@ -585,10 +579,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
return blockListener;
|
return blockListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BungeeListener getBungeeListener() {
|
|
||||||
return bungeeListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemListener getItemListener() {
|
public ItemListener getItemListener() {
|
||||||
return itemListener;
|
return itemListener;
|
||||||
}
|
}
|
||||||
@ -750,11 +740,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasBungeeEnabled() {
|
|
||||||
final ConfigurationSection section = getServer().spigot().getConfig().getConfigurationSection("settings");
|
|
||||||
return section != null && section.getBoolean("bungeecord");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer language files from jar to disk
|
* Transfer language files from jar to disk
|
||||||
*/
|
*/
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
package me.blackvein.quests.listeners;
|
|
||||||
|
|
||||||
import me.blackvein.quests.Quester;
|
|
||||||
import me.blackvein.quests.Quests;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class BungeeListener implements PluginMessageListener {
|
|
||||||
private static final String CHANNEL = "quests:update";
|
|
||||||
|
|
||||||
private final Quests plugin;
|
|
||||||
|
|
||||||
public BungeeListener(final Quests plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, byte[] bytes) {
|
|
||||||
if (!channel.equalsIgnoreCase(CHANNEL) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
|
|
||||||
final DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
|
|
||||||
try {
|
|
||||||
final String input = dataInputStream.readUTF();
|
|
||||||
final UUID uuid = UUID.fromString(input.substring(input.lastIndexOf(":") + 1));
|
|
||||||
if (input.startsWith("SaveData:")) {
|
|
||||||
final Quester quester = plugin.getQuester(uuid);
|
|
||||||
if (quester != null) {
|
|
||||||
plugin.getLogger().info(ChatColor.GREEN + "[Bungee] Saved quester data for UUID " + uuid);
|
|
||||||
quester.saveData();
|
|
||||||
}
|
|
||||||
} else if (input.startsWith("LoadData:")) {
|
|
||||||
final Quester quester = plugin.getQuester(uuid);
|
|
||||||
if (quester != null) {
|
|
||||||
plugin.getLogger().info(ChatColor.GREEN + "[Bungee] Loaded quester data for UUID " + uuid);
|
|
||||||
quester.hasData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user