mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-21 18:16:03 +01:00
Merge pull request #174 from dalbodeule/master
add bungeecord destination warp through subchannel
This commit is contained in:
commit
a5c828e010
@ -34,13 +34,16 @@ configurations {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "http://repo.maven.apache.org/maven2" }
|
||||
maven { url "https://repo.maven.apache.org/maven2" }
|
||||
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
}
|
||||
|
||||
// includeLibs just says to include the library in the final jar
|
||||
dependencies {
|
||||
implementation "org.bukkit:bukkit:1.15.1-R0.1-SNAPSHOT"
|
||||
implementation "net.md-5:bungeecord-api:1.15-SNAPSHOT"
|
||||
|
||||
implementation "io.netty:netty-all:4.0.4.Final"
|
||||
}
|
||||
|
||||
|
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
||||
#Sun Jan 19 19:02:36 KST 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@ -1,90 +0,0 @@
|
||||
# Advanced Portals Config
|
||||
|
||||
# To set this file back to its default state just delete it and reload the server or restart it!
|
||||
|
||||
|
||||
|
||||
# Set to true if you want the normal axes to work normally but the ones gived with /portals selector or wand will still work though
|
||||
# It can be usefull if people with permission want to use an iron axe on a survival server
|
||||
UseOnlyServerMadeAxe: false
|
||||
|
||||
# Preferably an item and not a block but it shouldnt matter
|
||||
AxeItemId: IRON_AXE
|
||||
|
||||
# Will be implemented so you can give yourself the portal block and build manually with it so its easier to make portals with the portal block.
|
||||
CanBuildPortalBlock: true
|
||||
|
||||
# Defines if portals protect themselves
|
||||
PortalProtection: true
|
||||
|
||||
# How many blocks around the portals will be protected from griefing or destruction
|
||||
PortalProtectionArea: 5
|
||||
|
||||
# What the default trigger block is for portals if nothing is defined.
|
||||
DefaultPortalTriggerBlock: PORTAL
|
||||
|
||||
# This stops all water flowing inside a portal area(can be disabled if something like world edit is handelling the water flow or you dont want it active)
|
||||
# you want to
|
||||
StopWaterFlow: true
|
||||
|
||||
# This must be a placeable block or it will not work and may even crash
|
||||
ShowSelectionBlockID: RED_STAINED_GLASS
|
||||
|
||||
# WarpEffect
|
||||
# 0 = disabled(no particles)
|
||||
# 1 = Eye of ender explode effect(loads of portal particles)
|
||||
# adding more soon and may create some custom ones
|
||||
WarpParticles: 1
|
||||
|
||||
# WarpSound generally suggested to keep the same as warpeffect but can usually be used for just the sound and no particle effects
|
||||
# 0 = disabled(no sound)
|
||||
# 1 = Enderman Warp Sound
|
||||
# adding more soon
|
||||
WarpSound: 1
|
||||
|
||||
# In case you want to show the bungee attempting warp message
|
||||
ShowBungeeWarpMessage: false
|
||||
|
||||
# This changes how long the show seletion lasts in seconds
|
||||
|
||||
ShowSelectionShowDuration: 10
|
||||
|
||||
# Where to display the message 0 = disabled(replaces PortalWarpMessages), 1 = in chat and 2 = action bar(1.8 and above only, anything lower will print the message that would
|
||||
# generally on the action bar in the chat without a prefix or extra chat formatting)
|
||||
WarpMessageDisplay: 2
|
||||
|
||||
# Use plugin name in the warp messages
|
||||
UseWarpPrefix: true
|
||||
|
||||
# If this is true a custom prefix can be used, (not fully coded yet!!)
|
||||
|
||||
UseCustomPrefix: false
|
||||
|
||||
CustomPrefix: '&a[&eAdvancedPortals&a]'
|
||||
|
||||
CustomPrefixFail: '&c[&7AdvancedPortals&c]'
|
||||
|
||||
BlockSpectatorMode: false
|
||||
|
||||
PortalCooldown: 5 # How long after trying to enter a portal until the player can try to enter another. 0 or lower to deactivate.
|
||||
ThrowbackAmount: 0.7 # How fast to throw them back, 0 or lower to disable throwback
|
||||
|
||||
# Experimental, works but not all the time (Entities don't seem to be provided in the event sometimes or something is wrong)
|
||||
# We have no plans to further this but if anyone has any tips feel free to contact us here https://discord.gg/25QZVVn
|
||||
DisableGatewayBeam: false
|
||||
|
||||
# Letters are flags. Include them to activate. n always disables everything, remove if you want it to work.
|
||||
# Lettering may not make too much sense but meh its useful. Examples are "ocpk" or "cop" (doesnt matter order)
|
||||
#
|
||||
# Remember enabling this means potentially admins could leave a portal lying around which could let them reop themselves.
|
||||
# If you think this may be an issue use a permission plugin and specifically give the users you trust permissions.
|
||||
#
|
||||
# n Disabled none, best just put this to really make sure the fact none are here is specified. It disables any others too
|
||||
# o Admin Heighten Enabled Permission advancedportals.createportal.commandlevel.op
|
||||
# p Perm Heighten Enabled Permission advancedportals.createportal.commandlevel.perms
|
||||
# c Console Heighten Enabled Permission advancedportals.createportal.commandlevel.console
|
||||
# h Ops can create admin commands without special perms
|
||||
# e Ops can create all perm commands without special perms
|
||||
# k Ops can create console commands without special perms
|
||||
#
|
||||
CommandLevels: opchek
|
@ -1,7 +0,0 @@
|
||||
|
||||
# ExampleDestination:
|
||||
# world: it will be the world name
|
||||
# pos:
|
||||
# X:
|
||||
# Y:
|
||||
# Z:
|
@ -1,55 +0,0 @@
|
||||
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
||||
name: AdvancedPortals
|
||||
version: 0.2.1
|
||||
author: sekwah41
|
||||
description: An advanced portals plugin for bukkit.
|
||||
api-version: 1.13
|
||||
commands:
|
||||
advancedportals:
|
||||
description: The main command for the advanced portals
|
||||
aliases: [portals, aportals, portal, ap]
|
||||
usage: /<command>
|
||||
destination:
|
||||
description: Can be used to access portal destinations.
|
||||
aliases: [desti]
|
||||
usage: /<command>
|
||||
permissions:
|
||||
advancedportals.*:
|
||||
description: Gives access to all commands
|
||||
default: op
|
||||
children:
|
||||
advancedportals.createportal: true
|
||||
advancedportals.portal: true
|
||||
advancedportals.build: true
|
||||
advancedportals.desti: true
|
||||
advancedportals.createportal:
|
||||
description: Allows you to create portals
|
||||
default: op
|
||||
advancedportals.createportal.commandlevel.*:
|
||||
description: Gives access to all level raisers
|
||||
default: false
|
||||
children:
|
||||
advancedportals.createportal.commandlevel.op: true
|
||||
advancedportals.createportal.commandlevel.perms: true
|
||||
advancedportals.createportal.commandlevel.console: true
|
||||
advancedportals.createportal.commandlevel.op:
|
||||
description: Allows you to increase the users level temporaily to op
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.perms:
|
||||
description: Allows you to increase the users level temporaily to have all perms
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.console:
|
||||
description: Executes command in the console
|
||||
default: false
|
||||
advancedportals.portal:
|
||||
description: Allows use of portal commands
|
||||
default: op
|
||||
advancedportals.build:
|
||||
description: Allows you to build in the portal regions
|
||||
default: op
|
||||
advancedportals.desti:
|
||||
description: Gives access to all desti commands
|
||||
default: op
|
||||
advancedportals.warp.*:
|
||||
description: Access to all warps (not really used tbh)
|
||||
default: op
|
@ -1,19 +0,0 @@
|
||||
|
||||
# ExamplePortal:
|
||||
# world: it will be the world name
|
||||
# triggerblock: LAVA # will only be used if the hastriggerblock is true and can be id or text
|
||||
# pos1: # dont mess with the data here, if you do it may stop the portal from working.
|
||||
# X:
|
||||
# Y:
|
||||
# Z:
|
||||
# pos2:
|
||||
# X:
|
||||
# Y:
|
||||
# Z:
|
||||
# destination:
|
||||
# issetpoint: true # if this was false point name would not be used and the coordinates would be saved here, it just adds more customisation.
|
||||
# pointname: examplepoint # if issetpoint is false this wont be here and tppos will be.
|
||||
# tppos:
|
||||
# X:
|
||||
# Y:
|
||||
# Z:
|
@ -1,10 +1,10 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.sekwah.advancedportals.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.listeners.Listeners;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.bukkit.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.bukkit.listeners.Listeners;
|
||||
import com.sekwah.advancedportals.bukkit.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -243,7 +243,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
player.sendMessage(PluginMessages.customPrefix + "\u00A7e You have created a new portal with the following details:");
|
||||
player.sendMessage("\u00A7aname: \u00A7e" + portalName);
|
||||
if (hasDestination) {
|
||||
if (destiPosX == null) {
|
||||
if (!isBungeePortal && destiPosX == null) {
|
||||
player.sendMessage("\u00A7cdestination: \u00A7e" + destination + " (destination does not exist)");
|
||||
return true;
|
||||
}
|
@ -1,20 +1,27 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.sekwah.advancedportals.compat.CraftBukkit;
|
||||
import com.sekwah.advancedportals.destinations.Destination;
|
||||
import com.sekwah.advancedportals.destinations.DestinationCommand;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.listeners.*;
|
||||
import com.sekwah.advancedportals.metrics.Metrics;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.compat.CraftBukkit;
|
||||
import com.sekwah.advancedportals.bukkit.destinations.Destination;
|
||||
import com.sekwah.advancedportals.bukkit.destinations.DestinationCommand;
|
||||
import com.sekwah.advancedportals.bukkit.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.bukkit.listeners.*;
|
||||
import com.sekwah.advancedportals.bukkit.metrics.Metrics;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
|
||||
public CraftBukkit compat = null;
|
||||
private Settings settings;
|
||||
|
||||
public String channelName = "mc:advancedportals";
|
||||
|
||||
// public HashMap<OfflinePlayer, String> PlayerDestiMap = new HashMap<>();
|
||||
|
||||
public void onEnable() {
|
||||
|
||||
String packageName = getServer().getClass().getPackage().getName();
|
||||
@ -61,7 +68,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
|
||||
this.getServer().getConsoleSender().sendMessage("\u00A7aAdvanced portals have been successfully enabled!");
|
||||
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
this.getLogger().warning("This version of craftbukkit is not yet supported, please notify sekwah and tell him about this version v:" + version);
|
||||
@ -106,6 +112,9 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
private void setupBungee() {
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
|
||||
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, channelName);
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, channelName, new PluginMessageReceiver(this));
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
/**
|
||||
* This contains generally used settings mostly
|
@ -1,6 +1,6 @@
|
||||
package com.sekwah.advancedportals.api.events;
|
||||
package com.sekwah.advancedportals.bukkit.api.events;
|
||||
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.AdvancedPortal;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals.api.portaldata;
|
||||
package com.sekwah.advancedportals.bukkit.api.portaldata;
|
||||
|
||||
public class PortalArg {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals.api.portaldata;
|
||||
package com.sekwah.advancedportals.bukkit.api.portaldata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@ -1,7 +1,7 @@
|
||||
package com.sekwah.advancedportals.api.registry;
|
||||
package com.sekwah.advancedportals.bukkit.api.registry;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.api.warphandler.TagHandler;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.api.warphandler.TagHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@ -1,6 +1,6 @@
|
||||
package com.sekwah.advancedportals.api.warphandler;
|
||||
package com.sekwah.advancedportals.bukkit.api.warphandler;
|
||||
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
|
||||
public class ActivationData {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals.api.warphandler;
|
||||
package com.sekwah.advancedportals.bukkit.api.warphandler;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sekwah.advancedportals.compat;
|
||||
package com.sekwah.advancedportals.bukkit.compat;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.reflection.ReflectionHelper;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.reflection.ReflectionHelper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
@ -1,9 +1,9 @@
|
||||
package com.sekwah.advancedportals.destinations;
|
||||
package com.sekwah.advancedportals.bukkit.destinations;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.effects.WarpEffects;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
@ -1,8 +1,8 @@
|
||||
package com.sekwah.advancedportals.destinations;
|
||||
package com.sekwah.advancedportals.bukkit.destinations;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
@ -0,0 +1,5 @@
|
||||
package com.sekwah.advancedportals.bukkit.destinations;
|
||||
|
||||
public class PortalWarp {
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.sekwah.advancedportals.effects;
|
||||
package com.sekwah.advancedportals.bukkit.effects;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
@ -1,7 +1,7 @@
|
||||
package com.sekwah.advancedportals.injector;
|
||||
package com.sekwah.advancedportals.bukkit.injector;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.reflection.ReflectionHelper;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.reflection.ReflectionHelper;
|
||||
import io.netty.channel.Channel;
|
||||
|
||||
import java.lang.reflect.Field;
|
@ -1,11 +1,14 @@
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BungeeListener implements PluginMessageListener {
|
||||
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
@ -19,12 +22,8 @@ public class BungeeListener implements PluginMessageListener {
|
||||
if (!channel.equals("BungeeCord")) {
|
||||
return;
|
||||
}
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||
String subchannel = in.readUTF();
|
||||
if (subchannel.equals("AdvancedPortals")) {
|
||||
// Any data after this is read like the packets used in the naruto mod
|
||||
// (same order as sent)
|
||||
}
|
||||
|
||||
// some codes
|
||||
}
|
||||
|
||||
/**
|
@ -1,8 +1,8 @@
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
@ -1,11 +1,12 @@
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.bukkit.destinations.Destination;
|
||||
import com.sekwah.advancedportals.bukkit.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Orientable;
|
||||
@ -64,6 +65,12 @@ public class Listeners implements Listener {
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerJoinEvent event) {
|
||||
Portal.cooldown.put(event.getPlayer().getName(), System.currentTimeMillis());
|
||||
|
||||
/* if (plugin.PlayerDestiMap.containsKey(event.getPlayer())) {
|
||||
String desti = plugin.PlayerDestiMap.get(event.getPlayer());
|
||||
|
||||
Destination.warp(event.getPlayer(), desti);
|
||||
} */
|
||||
}
|
||||
|
||||
@EventHandler
|
@ -0,0 +1,69 @@
|
||||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.destinations.Destination;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PluginMessageReceiver implements PluginMessageListener {
|
||||
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
|
||||
public PluginMessageReceiver(AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
// plugin.getLogger().info(""+channel.equals(plugin.channelName));
|
||||
|
||||
if (!channel.equals(plugin.channelName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||
String subchannel = in.readUTF();
|
||||
|
||||
// plugin.getLogger().info("bukkit plugin received: " + subchannel);
|
||||
|
||||
if (subchannel.equals("BungeePortal")) {
|
||||
String targetPlayerUUID = in.readUTF();
|
||||
String targetDestination = in.readUTF();
|
||||
|
||||
OfflinePlayer msgPlayer = plugin.getServer().getOfflinePlayer(UUID.fromString(targetPlayerUUID));
|
||||
|
||||
Destination.warp(msgPlayer.getPlayer(), targetDestination);
|
||||
|
||||
/* plugin.PlayerDestiMap.put(msgPlayer, targetDestination);
|
||||
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
plugin.PlayerDestiMap.remove(msgPlayer),
|
||||
20L*10
|
||||
); */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Example forward packet.
|
||||
*
|
||||
* Construct like the forge packets.
|
||||
*
|
||||
* out.writeUTF("Forward"); // So BungeeCord knows to forward it
|
||||
out.writeUTF("ALL");
|
||||
out.writeUTF("MyChannel"); // The channel name to check if this your data
|
||||
|
||||
ByteArrayOutputStream msgbytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgout = new DataOutputStream(msgbytes);
|
||||
msgout.writeUTF("Some kind of data here"); // You can do anything you want with msgout
|
||||
msgout.writeShort(123);
|
||||
|
||||
out.writeShort(msgbytes.toByteArray().length);
|
||||
out.write(msgbytes.toByteArray());
|
||||
*
|
||||
*/
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
@ -1,9 +1,9 @@
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals.metrics;
|
||||
package com.sekwah.advancedportals.bukkit.metrics;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
@ -1,6 +1,6 @@
|
||||
package com.sekwah.advancedportals.portals;
|
||||
package com.sekwah.advancedportals.bukkit.portals;
|
||||
|
||||
import com.sekwah.advancedportals.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.bukkit.api.portaldata.PortalArg;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.sekwah.advancedportals.portals;
|
||||
package com.sekwah.advancedportals.bukkit.portals;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.destinations.Destination;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.bukkit.destinations.Destination;
|
||||
import com.sekwah.advancedportals.bukkit.effects.WarpEffects;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -407,11 +407,23 @@ public class Portal {
|
||||
if (showBungeeMessage) {
|
||||
player.sendMessage(PluginMessages.customPrefix + "\u00A7a Attempting to warp to \u00A7e" + bungeeServer + "\u00A7a.");
|
||||
}
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(bungeeServer);
|
||||
|
||||
if (portal.getDestiation() != null) {
|
||||
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
||||
outForList.writeUTF("PortalEnter");
|
||||
outForList.writeUTF(bungeeServer);
|
||||
outForList.writeUTF(player.getUniqueId().toString());
|
||||
outForList.writeUTF(portal.getDestiation());
|
||||
|
||||
player.sendPluginMessage(plugin, plugin.channelName, outForList.toByteArray());
|
||||
}
|
||||
|
||||
ByteArrayDataOutput outForSend = ByteStreams.newDataOutput();
|
||||
outForSend.writeUTF("Connect");
|
||||
outForSend.writeUTF(bungeeServer);
|
||||
|
||||
portal.inPortal.add(player.getUniqueId());
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
player.sendPluginMessage(plugin, "BungeeCord", outForSend.toByteArray());
|
||||
// Down to bungee to sort out the teleporting but yea theoretically they should warp.
|
||||
}
|
||||
else if (portal.getDestiation() != null) {
|
@ -1,4 +1,4 @@
|
||||
package com.sekwah.advancedportals.reflection;
|
||||
package com.sekwah.advancedportals.bukkit.reflection;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.sekwah.advancedportals.bungee;
|
||||
|
||||
import com.sekwah.advancedportals.bungee.listener.EventListener;
|
||||
import com.sekwah.advancedportals.bungee.listener.PluginMessageReceiver;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AdvancedPortalsPlugin extends Plugin {
|
||||
|
||||
public String channelName = "mc:advancedportals";
|
||||
|
||||
public HashMap<String, String[]> PlayerDestiMap = new HashMap<>();
|
||||
// key: UUID (string)
|
||||
// value: [0] targetServer, [1] targetDestination
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getProxy().registerChannel(channelName);
|
||||
|
||||
getProxy().getPluginManager().registerListener(this, new PluginMessageReceiver(this));
|
||||
getProxy().getPluginManager().registerListener(this, new EventListener(this));
|
||||
|
||||
getLogger().info("\u00A7aAdvanced portals have been successfully enabled!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
getLogger().info("\\u00A7cAdvanced portals are being disabled!");
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.sekwah.advancedportals.bungee.listener;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
|
||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
public class EventListener implements Listener {
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
|
||||
public EventListener(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSwitchServer(ServerSwitchEvent event) {
|
||||
String uuid = event.getPlayer().getUniqueId().toString();
|
||||
|
||||
if (plugin.PlayerDestiMap.containsKey(uuid)) {
|
||||
String[] val = plugin.PlayerDestiMap.get(uuid);
|
||||
// key: UUID (string)
|
||||
// value: [0] targetServer, [1] targetDestination
|
||||
|
||||
if (event.getPlayer().getServer().getInfo().getName().equalsIgnoreCase(val[0])) {
|
||||
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
|
||||
out.writeUTF("BungeePortal");
|
||||
out.writeUTF(uuid);
|
||||
out.writeUTF(val[1]);
|
||||
|
||||
event.getPlayer().getServer().getInfo().sendData(plugin.channelName, out.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.sekwah.advancedportals.bungee.listener;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class PluginMessageReceiver implements Listener {
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
|
||||
public PluginMessageReceiver(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
|
||||
|
||||
@EventHandler
|
||||
public void onMessageReceived(PluginMessageEvent event) {
|
||||
if(!event.getTag().equalsIgnoreCase(plugin.channelName)) return;
|
||||
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
||||
String subChannel = in.readUTF();
|
||||
|
||||
plugin.getProxy().getLogger().info("bungee plugin received: " + subChannel);
|
||||
|
||||
if (subChannel.equalsIgnoreCase("PortalEnter")) {
|
||||
String targetServer = in.readUTF();
|
||||
String targetPlayerUUID = in.readUTF();
|
||||
String targetDestination = in.readUTF();
|
||||
|
||||
// plugin.getProxy().getLogger().info(targetServer + " " + targetPlayerUUID + " " + targetDestination);
|
||||
|
||||
plugin.PlayerDestiMap.put(targetPlayerUUID, new String[]{targetServer, targetDestination});
|
||||
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
if (plugin.PlayerDestiMap.containsKey(targetPlayerUUID)) {
|
||||
plugin.PlayerDestiMap.remove(targetPlayerUUID);
|
||||
}
|
||||
}, 20, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package com.sekwah.advancedportals.destinations;
|
||||
|
||||
public class PortalWarp {
|
||||
|
||||
}
|
4
src/main/resources/bungee.yml
Normal file
4
src/main/resources/bungee.yml
Normal file
@ -0,0 +1,4 @@
|
||||
main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin
|
||||
name: AdvancedPortals
|
||||
version: 0.2.1
|
||||
author: sekwah41
|
@ -1,4 +1,4 @@
|
||||
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
||||
main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin
|
||||
name: AdvancedPortals
|
||||
version: 0.2.1
|
||||
author: sekwah41
|
||||
|
Loading…
Reference in New Issue
Block a user