api, added option to not need a sender (used by magicstick addon)

This commit is contained in:
RonanCraft 2022-03-08 11:46:48 -05:00
parent f819bd782e
commit c5d4997cf4
4 changed files with 14 additions and 9 deletions

View File

@ -65,7 +65,7 @@ public class MagicStickEvents implements Listener {
if (listener.p == e.getPlayer())
return;
//Rtp the player
HelperRTP.tp(e.getPlayer(), e.getPlayer(), e.getPlayer().getWorld().getName(), null, RTP_TYPE.ADDON_MAGICSTICK);
HelperRTP.tp(e.getPlayer(), e.getPlayer().getWorld().getName(), null, RTP_TYPE.ADDON_MAGICSTICK);
if (this.take)
teleportingPlayers.add(new PlayerListener(e.getPlayer()));
}

View File

@ -0,0 +1,4 @@
package me.SuperRonanCraft.BetterRTPAddons.addons.menus;
public class AddonMenus {
}

View File

@ -29,8 +29,7 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
for (String location_name : getLocations().keySet()) {
if (location_name.equalsIgnoreCase(args[1].toLowerCase())) {
Player p = (Player) sendi;
HelperRTP.tp(p, sendi, null, null, RTP_TYPE.COMMAND,
false, false, (WorldLocations) getLocations().get(location_name));
HelperRTP.tp(p, sendi, null, null, RTP_TYPE.COMMAND, false, false, (WorldLocations) getLocations().get(location_name));
return;
}
}
@ -42,8 +41,7 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
if (p != null && p.isOnline()) {
for (String location_name : getLocations().keySet()) {
if (location_name.equalsIgnoreCase(args[1].toLowerCase())) {
HelperRTP.tp(p, sendi, null, null, RTP_TYPE.COMMAND,
false, false, (WorldLocations) getLocations().get(location_name));
HelperRTP.tp(p, sendi, null, null, RTP_TYPE.COMMAND, false, false, (WorldLocations) getLocations().get(location_name));
return;
}
}
@ -82,10 +80,6 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
return BetterRTP.getInstance().getRTP().worldLocations;
}
private Commands getCmd() {
return BetterRTP.getInstance().getCmd();
}
@Override
public String getHelp() {
return BetterRTP.getInstance().getText().getHelpLocation();

View File

@ -20,10 +20,17 @@ public class HelperRTP {
BetterRTP.getInstance().getText().getNotPlayer(sendi, cmd);
}
//Teleporter and sender are the same
public static void tp(Player player, String world, List<String> biomes, RTP_TYPE rtpType) {
tp(player, player, world, biomes, rtpType, false, false);
}
//Teleported and Sender MAY be different
public static void tp(Player player, CommandSender sendi, String world, List<String> biomes, RTP_TYPE rtpType) {
tp(player, sendi, world, biomes, rtpType, false, false);
}
//
public static void tp(Player player, CommandSender sendi, String world, List<String> biomes, RTP_TYPE rtpType,
boolean ignoreCooldown, boolean ignoreDelay) {
tp(player, sendi, world, biomes, rtpType, ignoreCooldown, ignoreDelay, null);