mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-02-04 06:21:39 +01:00
Ch
This commit is contained in:
parent
ac8d5a9725
commit
3366e9705a
@ -1,6 +1,6 @@
|
|||||||
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
||||||
name: AdvancedPortals
|
name: AdvancedPortals
|
||||||
version: 0.0.33
|
version: 0.0.34
|
||||||
author: sekwah41
|
author: sekwah41
|
||||||
description: An advanced portals plugin for bukkit.
|
description: An advanced portals plugin for bukkit.
|
||||||
commands:
|
commands:
|
||||||
|
2
pom.xml
2
pom.xml
@ -16,7 +16,7 @@
|
|||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<version>0.0.33-snapshot</version>
|
<version>0.0.34-snapshot</version>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
|
@ -193,7 +193,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||||||
Location pos2 = new Location(world, player.getMetadata("Pos2X").get(0).asInt(), player.getMetadata("Pos2Y").get(0).asInt(), player.getMetadata("Pos2Z").get(0).asInt());
|
Location pos2 = new Location(world, player.getMetadata("Pos2X").get(0).asInt(), player.getMetadata("Pos2Y").get(0).asInt(), player.getMetadata("Pos2Z").get(0).asInt());
|
||||||
|
|
||||||
ConfigAccessor desticonfig = new ConfigAccessor(plugin, "destinations.yml");
|
ConfigAccessor desticonfig = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
String destiPosX = desticonfig.getConfig().getString(destination + ".pos1.X");
|
String destiPosX = desticonfig.getConfig().getString(destination + ".pos.X");
|
||||||
|
|
||||||
if (!Portal.portalExists(portalName)) {
|
if (!Portal.portalExists(portalName)) {
|
||||||
|
|
||||||
|
@ -18,10 +18,7 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
@ -74,7 +71,12 @@ public class Listeners implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinEvent(PlayerJoinEvent event) {
|
public void onJoinEvent(PlayerJoinEvent event) {
|
||||||
Portal.cooldown.put(event.getPlayer(), System.currentTimeMillis());
|
Portal.cooldown.put(event.getPlayer().getName(), System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onLeaveEvent(PlayerQuitEvent event) {
|
||||||
|
Portal.cooldown.remove(event.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
@ -22,7 +22,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class Portal {
|
public class Portal {
|
||||||
|
|
||||||
public static HashMap<Player, Long> cooldown = new HashMap<Player, Long>();
|
public static HashMap<String, Long> cooldown = new HashMap<String, Long>();
|
||||||
// Config values
|
// Config values
|
||||||
public static boolean portalsActive = false;
|
public static boolean portalsActive = false;
|
||||||
public static AdvancedPortal[] portals = new AdvancedPortal[0];
|
public static AdvancedPortal[] portals = new AdvancedPortal[0];
|
||||||
@ -125,6 +125,7 @@ public class Portal {
|
|||||||
portalsActive = true;
|
portalsActive = true;
|
||||||
} else {
|
} else {
|
||||||
portalsActive = false;
|
portalsActive = false;
|
||||||
|
portals = new AdvancedPortal[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,8 +388,8 @@ public class Portal {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cooldown.get(player) != null) {
|
if (cooldown.get(player.getName()) != null) {
|
||||||
int diff = (int) ((System.currentTimeMillis() - cooldown.get(player)) / 1000);
|
int diff = (int) ((System.currentTimeMillis() - cooldown.get(player.getName())) / 1000);
|
||||||
if (diff < cooldelay) {
|
if (diff < cooldelay) {
|
||||||
player.sendMessage(ChatColor.RED + "Please wait " + ChatColor.YELLOW + (cooldelay - diff) + ChatColor.RED + " seconds until attempting to teleport again.");
|
player.sendMessage(ChatColor.RED + "Please wait " + ChatColor.YELLOW + (cooldelay - diff) + ChatColor.RED + " seconds until attempting to teleport again.");
|
||||||
failSound(player, portal);
|
failSound(player, portal);
|
||||||
@ -396,7 +397,7 @@ public class Portal {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cooldown.put(player, System.currentTimeMillis());
|
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||||
boolean showFailMessage = !portal.hasArg("command.1");
|
boolean showFailMessage = !portal.hasArg("command.1");
|
||||||
|
|
||||||
//plugin.getLogger().info(portal.getName() + ":" + portal.getDestiation());
|
//plugin.getLogger().info(portal.getName() + ":" + portal.getDestiation());
|
||||||
|
Loading…
Reference in New Issue
Block a user