mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-01-13 11:41:47 +01:00
Add throwback config
This commit is contained in:
parent
50455376de
commit
161a56d281
@ -71,3 +71,4 @@ CustomPrefix: '&a[&eAdvancedPortals&a]'
|
|||||||
CustomPrefixFail: '&c[&7AdvancedPortals&c]'
|
CustomPrefixFail: '&c[&7AdvancedPortals&c]'
|
||||||
|
|
||||||
PortalCooldown: 5 # How long after trying to enter a portal until the player can try to enter another. 0 or lower to deactivate.
|
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
|
||||||
|
@ -27,12 +27,14 @@ public class Portal {
|
|||||||
private static AdvancedPortalsPlugin plugin;
|
private static AdvancedPortalsPlugin plugin;
|
||||||
public static ConfigAccessor portalData = new ConfigAccessor(plugin, "portals.yml");
|
public static ConfigAccessor portalData = new ConfigAccessor(plugin, "portals.yml");
|
||||||
private static boolean ShowBungeeMessage;
|
private static boolean ShowBungeeMessage;
|
||||||
private static int cooldelay = 5;
|
private static int cooldelay;
|
||||||
|
private static double throwback;
|
||||||
|
|
||||||
public Portal(AdvancedPortalsPlugin plugin) {
|
public Portal(AdvancedPortalsPlugin plugin) {
|
||||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||||
ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
|
ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
|
||||||
cooldelay = config.getConfig().getInt("PortalCooldown");
|
cooldelay = config.getConfig().getInt("PortalCooldown", 5);
|
||||||
|
throwback = config.getConfig().getDouble("ThrowbackAmount", 0.7);
|
||||||
|
|
||||||
Portal.plugin = plugin;
|
Portal.plugin = plugin;
|
||||||
Portal.loadPortals();
|
Portal.loadPortals();
|
||||||
@ -527,7 +529,9 @@ public class Portal {
|
|||||||
|
|
||||||
public static void throwPlayerBack(Player player){
|
public static void throwPlayerBack(Player player){
|
||||||
// Not ensured to remove them out of the portal but it makes it feel nicer for the player.
|
// Not ensured to remove them out of the portal but it makes it feel nicer for the player.
|
||||||
Vector velocity = player.getLocation().getDirection();
|
if (throwback > 0) {
|
||||||
player.setVelocity(velocity.setY(0).normalize().multiply(-1).setY(0.7D));
|
Vector velocity = player.getLocation().getDirection();
|
||||||
|
player.setVelocity(velocity.setY(0).normalize().multiply(-1).setY(throwback));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user