mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-02-16 10:30:58 +00:00
portals remove fix + flashback messages and saving/loading
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package me.SuperRonanCraft.BetterRTPAddons;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.extraEffects.AddonExtraEffects;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.flashback.AddonFlashback;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.interfaces.AddonInterface;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.logger.AddonLogger;
|
||||
@@ -36,11 +37,12 @@ public class AddonsHandler {
|
||||
}
|
||||
|
||||
enum Addons {
|
||||
LOGGER(new AddonLogger()),
|
||||
FLASH_BACK(new AddonFlashback()),
|
||||
PORTALS(new AddonPortals()),
|
||||
LOGGER(new AddonLogger()), //Does this thing work?
|
||||
FLASH_BACK(new AddonFlashback()), //Never get lost adventuring
|
||||
PORTALS(new AddonPortals()), //Fancy walk-in portals
|
||||
//INTERFACES(new AddonInterface())
|
||||
MAGICSTICK(new AddonMagicStick()),
|
||||
MAGICSTICK(new AddonMagicStick()), //Handy teleport want
|
||||
EXTRAEFFECTS(new AddonExtraEffects()), //New cosmetica!
|
||||
;
|
||||
|
||||
Addon addon;
|
||||
|
||||
@@ -3,9 +3,13 @@ package me.SuperRonanCraft.BetterRTPAddons.addons.extraEffects;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_TeleportEvent;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.Main;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.util.Files;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
//Teleport the player VERY high into the sky
|
||||
public class ExtraEffectsEffect_Skyhigh implements ExtraEffectsEffect, Listener {
|
||||
@@ -32,5 +36,27 @@ public class ExtraEffectsEffect_Skyhigh implements ExtraEffectsEffect, Listener
|
||||
@EventHandler
|
||||
void tpEvent(RTP_TeleportEvent e) {
|
||||
e.changeLocation(e.getLocation().add(0, offset, 0));
|
||||
new PlayerFalling(e.getPlayer());
|
||||
}
|
||||
|
||||
private static class PlayerFalling implements Listener {
|
||||
Player p;
|
||||
|
||||
PlayerFalling(Player p) {
|
||||
this.p = p;
|
||||
Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void event(EntityDamageEvent e) {
|
||||
if (e.getEntityType() == EntityType.PLAYER && e.getEntity() == p) {
|
||||
e.setCancelled(true);
|
||||
unload();
|
||||
}
|
||||
}
|
||||
|
||||
void unload() {
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,12 @@ import me.SuperRonanCraft.BetterRTPAddons.Addon;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.util.Files;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -51,6 +54,8 @@ public class AddonFlashback implements Addon, Listener {
|
||||
"invalid! Please make sure to format [- INTEGER: 'Message']");
|
||||
}
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
loadPlayer(p);
|
||||
}
|
||||
|
||||
private Long getLong(String str) throws NumberFormatException {
|
||||
@@ -68,6 +73,30 @@ public class AddonFlashback implements Addon, Listener {
|
||||
@EventHandler
|
||||
void onTeleport(RTP_TeleportPostEvent e) { //Create a timer to teleport player back
|
||||
if (e.getType() != RTP_TYPE.ADDON_PORTAL)
|
||||
players.add(new FlashbackPlayer(this, e.getPlayer(), e.getOldLocation(), time));
|
||||
players.add(new FlashbackPlayer(this, e.getPlayer(), e.getOldLocation(), time, warnings));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onJoin(PlayerJoinEvent e) {
|
||||
loadPlayer(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onLeave(PlayerQuitEvent e) {
|
||||
for (FlashbackPlayer fbp : players)
|
||||
if (fbp.p == e.getPlayer())
|
||||
fbp.cancel();
|
||||
}
|
||||
|
||||
void loadPlayer(Player p) {
|
||||
FlashbackPlayerInfo info = database.getPlayer(p);
|
||||
if (info != null) {
|
||||
long _time = (System.currentTimeMillis() - info.getTime()) / 1000;
|
||||
if (_time < 0) { //Still has time to go back
|
||||
_time *= -1;
|
||||
players.add(new FlashbackPlayer(this, p, info.getLocation(), _time, warnings));
|
||||
} else //Overdue! Teleport them back NOW!
|
||||
players.add(new FlashbackPlayer(this, p, info.getLocation(), 0L, warnings));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ public class FlashbackDatabase extends Database {
|
||||
rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
Location loc = LocSerialization.getLocationFromString(rs.getString(Columns.LOCATION_OLD.name));
|
||||
return new FlashbackPlayerInfo(p, loc);
|
||||
Long time = rs.getLong(Columns.TIME_GOAL.name);
|
||||
return new FlashbackPlayerInfo(p, loc, time);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||
@@ -120,4 +121,23 @@ public class FlashbackDatabase extends Database {
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
public void removePlayer(Player p) {
|
||||
Connection conn = null;
|
||||
PreparedStatement ps = null;
|
||||
//boolean success = true;
|
||||
try {
|
||||
conn = getSQLConnection();
|
||||
ps = conn.prepareStatement("DELETE FROM " + table +
|
||||
" WHERE " + Columns.UUID.name + " = ?");
|
||||
UUID id = p.getUniqueId();
|
||||
ps.setString(1, id.toString());
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||
//success = false;
|
||||
} finally {
|
||||
close(ps, null, conn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,20 +7,37 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class FlashbackPlayer {
|
||||
Player p;
|
||||
Location oldLoc;
|
||||
AddonFlashback plugin;
|
||||
BukkitTask task;
|
||||
List<BukkitTask> tasks = new ArrayList<>();
|
||||
|
||||
public FlashbackPlayer(AddonFlashback plugin, Player p, Location oldLoc, Long seconds) {
|
||||
public FlashbackPlayer(AddonFlashback plugin, Player p, Location oldLoc, Long seconds, HashMap<Long, String> warnings) {
|
||||
this.plugin = plugin;
|
||||
this.p = p;
|
||||
this.oldLoc = oldLoc;
|
||||
this.task = Bukkit.getScheduler().runTaskLater(Main.getInstance(), getTimedFlash(seconds), 20L * seconds);
|
||||
if (warnings != null)
|
||||
createTimers(seconds, orderMap(warnings));
|
||||
tasks.add(Bukkit.getScheduler().runTaskLater(Main.getInstance(), runFlashback(seconds), 20L * seconds));
|
||||
}
|
||||
|
||||
private Runnable getTimedFlash(Long seconds) {
|
||||
void createTimers(Long seconds, TreeMap<Long, String> warnings) {
|
||||
for (Map.Entry<Long, String> entry : warnings.entrySet()) {
|
||||
String str = entry.getValue();
|
||||
long time = seconds - entry.getKey();
|
||||
if (time >= 0)
|
||||
tasks.add(Bukkit.getScheduler().runTaskLater(Main.getInstance(), runWarning(str), 20L * time));
|
||||
}
|
||||
}
|
||||
|
||||
TreeMap<Long, String> orderMap(HashMap<Long, String> warnings) {
|
||||
return new TreeMap<>(warnings);
|
||||
}
|
||||
|
||||
private Runnable runFlashback(Long seconds) {
|
||||
if (!plugin.database.setPlayer(p, oldLoc, System.currentTimeMillis() + (seconds * 1000)))
|
||||
p.sendMessage("A Database error has occurred!");
|
||||
return () -> {
|
||||
@@ -30,11 +47,17 @@ public class FlashbackPlayer {
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable runWarning(String msg) {
|
||||
return () -> plugin.msgs.sms(p, msg);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
task.cancel();
|
||||
for (BukkitTask task : tasks)
|
||||
task.cancel();
|
||||
}
|
||||
|
||||
private void completed() {
|
||||
plugin.players.remove(this);
|
||||
plugin.database.removePlayer(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ public class FlashbackPlayerInfo {
|
||||
|
||||
private final Player player;
|
||||
private final Location location;
|
||||
private final Long time;
|
||||
|
||||
public FlashbackPlayerInfo(Player player, Location location) {
|
||||
public FlashbackPlayerInfo(Player player, Location location, Long time) {
|
||||
this.player = player;
|
||||
this.location = location;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@@ -20,4 +22,8 @@ public class FlashbackPlayerInfo {
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public Long getTime() {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package me.SuperRonanCraft.BetterRTPAddons.addons.magicStick;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_CancelledEvent;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_TeleportPostEvent;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.Main;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.magicStick.cmds.MagicStickCommand;
|
||||
@@ -41,7 +43,7 @@ public class MagicStickEvents implements Listener {
|
||||
assert meta != null;
|
||||
meta.setDisplayName(BetterRTP.getInstance().getText().color(title));
|
||||
meta.setLore(lore);
|
||||
lore.forEach((str) -> {lore.set(lore.indexOf(str), BetterRTP.getInstance().getText().color(str)); });
|
||||
lore.forEach((str) -> lore.set(lore.indexOf(str), BetterRTP.getInstance().getText().color(str)));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
this.take = file.getBoolean("MagicStick.Take");
|
||||
@@ -88,9 +90,10 @@ public class MagicStickEvents implements Listener {
|
||||
|
||||
@EventHandler
|
||||
void tp(RTP_TeleportPostEvent e) {
|
||||
if (e.getPlayer() == p && e.getType() == RTP_TYPE.ADDON_MAGICSTICK) {
|
||||
if (e.getPlayer() == p) {
|
||||
if (e.getType() == RTP_TYPE.ADDON_MAGICSTICK)
|
||||
e.getPlayer().getInventory().removeItem(item);
|
||||
teleportingPlayers.remove(this);
|
||||
e.getPlayer().getInventory().removeItem(item);
|
||||
this.unload();
|
||||
}
|
||||
}
|
||||
@@ -100,6 +103,14 @@ public class MagicStickEvents implements Listener {
|
||||
if (e.getPlayer() == p)
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void cancelled(RTP_CancelledEvent e) {
|
||||
if (e.getPlayer() == p) {
|
||||
teleportingPlayers.remove(this);
|
||||
this.unload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class MagicStickMessages implements AddonsMessages {
|
||||
|
||||
//Give
|
||||
public void getGive(CommandSender sendi, String name) {
|
||||
sms(sendi, getLang().getString(preM + "Give").replace("%name%", name));
|
||||
sms(sendi, getLang().getString(preM + "Give").replace("%player%", name));
|
||||
}
|
||||
|
||||
public void getGiven(CommandSender sendi) {
|
||||
|
||||
@@ -23,14 +23,14 @@ public class MagicStickCommand_Give implements MagicStickCommands {
|
||||
} else {
|
||||
Player p = null;
|
||||
for (Player plr : Bukkit.getOnlinePlayers()) {
|
||||
if (plr.getName().startsWith(args[2])) {
|
||||
if (plr.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||
p = plr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (p != null) {
|
||||
p.getInventory().addItem(addon.events.item.clone());
|
||||
addon.msgs.getGiven(sendi);
|
||||
addon.msgs.getGiven(p);
|
||||
addon.msgs.getGive(sendi, p.getName());
|
||||
} else
|
||||
addon.msgs.getPlayerError(sendi, args[2]);
|
||||
|
||||
@@ -92,19 +92,9 @@ public class PortalsDatabase extends Database {
|
||||
boolean success = true;
|
||||
try {
|
||||
conn = getSQLConnection();
|
||||
ps = conn.prepareStatement("INSERT INTO " + table + "(" +
|
||||
Columns.NAME.name + ", " +
|
||||
Columns.LOCATION_1.name + ", " +
|
||||
Columns.LOCATION_2.name + ") VALUES (?, ?, ?) "
|
||||
+ "ON CONFLICT(" + Columns.NAME.name + ") DO UPDATE SET " +
|
||||
Columns.LOCATION_1.name + " = + ?, " + Columns.LOCATION_2.name + " = ?");
|
||||
ps = conn.prepareStatement("DELETE FROM " + table +
|
||||
" WHERE " + Columns.NAME.name + " = ?");
|
||||
ps.setString(1, portal.getName());
|
||||
String serialLocation_1 = LocSerialization.getStringFromLocation(portal.getLoc1());
|
||||
String serialLocation_2 = LocSerialization.getStringFromLocation(portal.getLoc2());
|
||||
ps.setString(2, serialLocation_1);
|
||||
ps.setString(3, serialLocation_2);
|
||||
ps.setString(4, serialLocation_1);
|
||||
ps.setString(5, serialLocation_2);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||
|
||||
@@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTPAddons.addons.portals;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_CancelledEvent;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_TeleportPostEvent;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.Main;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.portals.region.PortalsRegionInfo;
|
||||
@@ -67,4 +68,9 @@ public class PortalsEvents implements Listener {
|
||||
void teleport(RTP_TeleportPostEvent e) {
|
||||
playerPortaling.remove(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void cancelled(RTP_CancelledEvent e) {
|
||||
playerPortaling.remove(e.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,20 @@ public class PortalsCommand implements RTPCommand, RTPCommandHelpable {
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sendi, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (args.length == 2)
|
||||
for (subCmd subCmd : subCmd.values()) {
|
||||
if (subCmd.name().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||
list.add(subCmd.name().toLowerCase());
|
||||
if (args.length == 2) {
|
||||
for (subCmd cmd : subCmd.values()) {
|
||||
if (cmd.name().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||
list.add(cmd.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
} else if (args.length >= 3) {
|
||||
for (subCmd cmd : subCmd.values()) {
|
||||
if (cmd.name().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||
if (cmd.cmd instanceof PortalsCommandsTabable)
|
||||
list.addAll(((PortalsCommandsTabable) cmd.cmd).tabComplete(sendi, args, pl));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package me.SuperRonanCraft.BetterRTPAddons.addons.portals.cmds;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.portals.AddonPortals;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.portals.region.PortalsCache;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.portals.region.PortalsRegionInfo;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PortalsCommand_Remove implements PortalsCommands {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PortalsCommand_Remove implements PortalsCommands, PortalsCommandsTabable {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sendi, String label, String[] args, AddonPortals addonPortals) {
|
||||
@@ -26,4 +30,16 @@ public class PortalsCommand_Remove implements PortalsCommands {
|
||||
//None found
|
||||
addonPortals.msgs.getRemoveNone(sendi, portalName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sendi, String[] args, AddonPortals addonPortals) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (args.length == 3) {
|
||||
for (PortalsRegionInfo portal : addonPortals.getPortals().getRegisteredPortals()) {
|
||||
if (portal.getName().toLowerCase().startsWith(args[2].toLowerCase()))
|
||||
list.add(portal.getName());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package me.SuperRonanCraft.BetterRTPAddons.addons.portals.cmds;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTPAddons.addons.portals.AddonPortals;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PortalsCommandsTabable {
|
||||
|
||||
List<String> tabComplete(CommandSender sendi, String[] args, AddonPortals addonPortals);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package me.SuperRonanCraft.BetterRTPAddons.packets;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.SoundCategory;
|
||||
|
||||
public class WrapperPlayServerNamedSoundEffect extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
PacketType.Play.Server.NAMED_SOUND_EFFECT;
|
||||
|
||||
public WrapperPlayServerNamedSoundEffect() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
handle.getModifier().writeDefaults();
|
||||
}
|
||||
|
||||
public WrapperPlayServerNamedSoundEffect(PacketContainer packet) {
|
||||
super(packet, TYPE);
|
||||
}
|
||||
|
||||
public Sound getSoundEffect() {
|
||||
return handle.getSoundEffects().read(0);
|
||||
}
|
||||
|
||||
public void setSoundEffect(Sound value) {
|
||||
handle.getSoundEffects().write(0, value);
|
||||
}
|
||||
|
||||
public SoundCategory getSoundCategory() {
|
||||
return handle.getSoundCategories().read(0);
|
||||
}
|
||||
|
||||
public void setSoundCategory(SoundCategory value) {
|
||||
handle.getSoundCategories().write(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Effect position X.
|
||||
* <p>
|
||||
* Notes: effect X multiplied by 8
|
||||
*
|
||||
* @return The current Effect position X
|
||||
*/
|
||||
public int getEffectPositionX() {
|
||||
return handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Effect position X.
|
||||
*
|
||||
* @param value - new value.
|
||||
*/
|
||||
public void setEffectPositionX(int value) {
|
||||
handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Effect position Y.
|
||||
* <p>
|
||||
* Notes: effect Y multiplied by 8
|
||||
*
|
||||
* @return The current Effect position Y
|
||||
*/
|
||||
public int getEffectPositionY() {
|
||||
return handle.getIntegers().read(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Effect position Y.
|
||||
*
|
||||
* @param value - new value.
|
||||
*/
|
||||
public void setEffectPositionY(int value) {
|
||||
handle.getIntegers().write(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Effect position Z.
|
||||
* <p>
|
||||
* Notes: effect Z multiplied by 8
|
||||
*
|
||||
* @return The current Effect position Z
|
||||
*/
|
||||
public int getEffectPositionZ() {
|
||||
return handle.getIntegers().read(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Effect position Z.
|
||||
*
|
||||
* @param value - new value.
|
||||
*/
|
||||
public void setEffectPositionZ(int value) {
|
||||
handle.getIntegers().write(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Volume.
|
||||
* <p>
|
||||
* Notes: 1 is 100%, can be more
|
||||
*
|
||||
* @return The current Volume
|
||||
*/
|
||||
public float getVolume() {
|
||||
return handle.getFloat().read(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Volume.
|
||||
*
|
||||
* @param value - new value.
|
||||
*/
|
||||
public void setVolume(float value) {
|
||||
handle.getFloat().write(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Pitch.
|
||||
* <p>
|
||||
* Notes: 63 is 100%, can be more
|
||||
*
|
||||
* @return The current Pitch
|
||||
*/
|
||||
public float getPitch() {
|
||||
return handle.getFloat().read(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pitch.
|
||||
*
|
||||
* @param value - new value.
|
||||
*/
|
||||
public void setPitch(float value) {
|
||||
handle.getFloat().write(1, value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,10 +4,11 @@ Language-File: 'en.yml'
|
||||
Flashback:
|
||||
Enabled: true
|
||||
Timer:
|
||||
Delay: 15 #In Seconds
|
||||
Delay: 600 #In Seconds
|
||||
Warnings: #Warning messages to send to a player when X amount of time is left
|
||||
- 5: "&eYou have 5 seconds left! Grab all your materials quick!"
|
||||
- 1: "&eHang on!"
|
||||
- 600: "&cYou have 10 minutes here, collect and explore and much as you can!"
|
||||
- 60: "&eYou have 60 seconds left! Grab all your materials quick!"
|
||||
- 1: "&eHang on! It's going to get bumpy!"
|
||||
|
||||
##Addon Logger
|
||||
Logger:
|
||||
|
||||
Reference in New Issue
Block a user