mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 10:36:17 +01:00
Moved code around and started adding bungee destination warps as well as starting the tag registration
This commit is contained in:
parent
541a7f11e9
commit
08d2a58c45
@ -1,5 +1,6 @@
|
||||
package com.sekwah.advancedportals;
|
||||
|
||||
import com.sekwah.advancedportals.listeners.Listeners;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import com.sekwah.advancedportals.portals.PortalArg;
|
||||
import org.bukkit.Location;
|
||||
|
@ -4,6 +4,7 @@ import com.sekwah.advancedportals.DataCollector.DataCollector;
|
||||
import com.sekwah.advancedportals.compat.bukkit.NMS;
|
||||
import com.sekwah.advancedportals.destinations.Destination;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.listeners.*;
|
||||
import com.sekwah.advancedportals.metrics.Metrics;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -97,6 +98,10 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
Selection.LoadData(this);
|
||||
|
||||
DataCollector.setupMetrics();
|
||||
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
53
src/com/sekwah/advancedportals/listeners/BungeeListener.java
Normal file
53
src/com/sekwah/advancedportals/listeners/BungeeListener.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import net.minecraft.util.com.google.common.io.ByteArrayDataInput;
|
||||
import net.minecraft.util.com.google.common.io.ByteStreams;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
/**
|
||||
* Created by on 29/03/2016.
|
||||
*
|
||||
* @author sekwah41
|
||||
*/
|
||||
public class BungeeListener implements PluginMessageListener {
|
||||
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
|
||||
public BungeeListener(AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,5 +1,7 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.block.Block;
|
@ -1,5 +1,7 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
@ -1,5 +1,7 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.Material;
|
@ -1,5 +1,7 @@
|
||||
package com.sekwah.advancedportals;
|
||||
package com.sekwah.advancedportals.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.block.Block;
|
42
src/com/sekwah/advancedportals/portals/PortalTags.java
Normal file
42
src/com/sekwah/advancedportals/portals/PortalTags.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.sekwah.advancedportals.portals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by on 29/03/2016.
|
||||
*
|
||||
* TODO add all the normal tags then add the extradata tags
|
||||
*
|
||||
* @author sekwah41
|
||||
*/
|
||||
public class PortalTags {
|
||||
|
||||
// TODO create a list or hashmap of tags to check for.
|
||||
|
||||
public Map<String, String> tagDesc = new HashMap<String,String>();
|
||||
|
||||
public ArrayList<String> tags = new ArrayList<String>();
|
||||
|
||||
|
||||
public void registerTag(String tagName){
|
||||
this.registerTag(tagName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will only be used if a /portal tags command is created. The descriptions will be used for help text
|
||||
* so please keep it short.
|
||||
*
|
||||
* @param tagName
|
||||
* @param description
|
||||
*/
|
||||
public void registerTag(String tagName, boolean multiWord, String description){
|
||||
this.registerTag(tagName, multiWord);
|
||||
}
|
||||
|
||||
public void registerTag(String tagName, boolean multiWord){
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user