fixed imports for bungee packet listener and also looking at horse fix

This commit is contained in:
Alastair 2016-03-31 22:34:12 +01:00
parent 2500ecef0c
commit 703919bf4a
5 changed files with 29 additions and 10 deletions

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
name: AdvancedPortals
version: 0.0.16
version: 0.0.17
author: sekwah41
description: An advanced portals plugin for bukkit.
commands:

View File

@ -7,10 +7,14 @@ 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.Chunk;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
public class AdvancedPortalsPlugin extends JavaPlugin {
@ -31,8 +35,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
// Failed to submit the stats :-(
}
this.getServer().getConsoleSender().sendMessage("\u00A7aAdvanced portals have been successfully enabled!");
String packageName = getServer().getClass().getPackage().getName();
String[] packageSplit = packageName.split("\\.");
String version = packageSplit[packageSplit.length - 1];
@ -104,6 +106,8 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
this.getServer().getConsoleSender().sendMessage("\u00A7aAdvanced portals have been successfully enabled!");
}

View File

@ -10,6 +10,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.InventoryView;
import org.bukkit.metadata.FixedMetadataValue;
import java.util.Collections;
import java.util.LinkedList;
@ -21,12 +23,21 @@ public class Destination {
private static AdvancedPortalsPlugin plugin;
private static boolean TeleportRiding = false;
public Destination(AdvancedPortalsPlugin plugin) {
Destination.plugin = plugin;
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
TeleportRiding = config.getConfig().getBoolean("WarpRiddenEntity");
}
// TODO add permissions for destinations.
// TODO try keeping the chunks loaded and add different delays to events to make
// the horse teleport when you have more time.(its an annoying bug caused by changed)
// in mc
public static void create(Location location, String name) {
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
@ -112,11 +123,14 @@ public class Destination {
Chunk c = loc.getChunk();
Entity riding = player.getVehicle();
if (!c.isLoaded()) c.load();
if (player.getVehicle() != null) {
if (player.getVehicle() != null && TeleportRiding) {
riding.eject();
riding.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN);
player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN);
riding.setPassenger(player);
} else {
player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN);
}

View File

@ -1,8 +1,8 @@
package com.sekwah.advancedportals.listeners;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
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;

View File

@ -7,11 +7,9 @@ import com.sekwah.advancedportals.events.WarpEvent;
import com.sekwah.advancedportals.portals.AdvancedPortal;
import com.sekwah.advancedportals.portals.Portal;
import com.sun.org.apache.regexp.internal.RE;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -23,8 +21,11 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.metadata.FixedMetadataValue;
import java.util.HashMap;
public class Listeners implements Listener {
// The needed config values will be stored so they are easier to access later