mirror of
https://github.com/darksaid98/AlathranCommands.git
synced 2026-12-01 23:48:52 +00:00
Complete Code Overhaul
This commit is contained in:
1 parent
b2b59d2408
commit
44c76711be
18 files changed
+915
-488
No files matched your search
@@ -1,8 +1,9 @@
|
||||
package com.jklmao.plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -12,71 +13,40 @@ import com.jklmao.plugin.commands.CommandTpToggle;
|
||||
import com.jklmao.plugin.commands.CommandTpa;
|
||||
import com.jklmao.plugin.commands.CommandTpaDeny;
|
||||
import com.jklmao.plugin.commands.CommandTpaHere;
|
||||
import com.jklmao.plugin.commands.CommandTpaccept;
|
||||
import com.jklmao.plugin.commands.CommandTpo;
|
||||
import com.jklmao.plugin.commands.CommandTpoHere;
|
||||
import com.jklmao.plugin.commands.Commands;
|
||||
import com.jklmao.plugin.events.PlayerEvents;
|
||||
import com.jklmao.plugin.utils.CustomList;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
|
||||
public final class ClickTpa extends JavaPlugin {
|
||||
public static ClickTpa instance;
|
||||
|
||||
private HashMap<Player, Player> tpacommandlist = new HashMap<>();
|
||||
|
||||
private HashMap<Player, Player> tpaherecommandlist = new HashMap<>();
|
||||
|
||||
private HashMap<String, String> tpacancel = new HashMap<>();
|
||||
|
||||
private ArrayList<Player> tptoggled = new ArrayList<>();
|
||||
|
||||
private ArrayList<Player> willTeleport = new ArrayList<>();
|
||||
|
||||
private ArrayList<Player> whosFault = new ArrayList<>();
|
||||
|
||||
private ArrayList<Player> graceList = new ArrayList<>();
|
||||
|
||||
private HashMap<Player, CustomList> tpaInfo = new HashMap<>();
|
||||
private HashSet<Player> graceList = new HashSet<>();
|
||||
private HashMap<Player, Player> tpaCancel = new HashMap<>();
|
||||
private HashMap<Player, CustomList> playerTpaList = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
commandHandler();
|
||||
instance = this;
|
||||
addAllPlayers();
|
||||
|
||||
saveDefaultConfig();
|
||||
getServer().getPluginManager().registerEvents(new PlayerEvents(this), this);
|
||||
getLogger().info("ClickTPA has been loaded Successfully!");
|
||||
|
||||
}
|
||||
|
||||
public HashMap<Player, Player> getHash() {
|
||||
return this.tpacommandlist;
|
||||
}
|
||||
|
||||
public HashMap<Player, Player> getTpaHere() {
|
||||
return this.tpaherecommandlist;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getTpaCancel() {
|
||||
return this.tpacancel;
|
||||
}
|
||||
|
||||
public ArrayList<Player> getTpToggled() {
|
||||
return this.tptoggled;
|
||||
}
|
||||
|
||||
public ArrayList<Player> getTeleportStatus() {
|
||||
return this.willTeleport;
|
||||
}
|
||||
|
||||
public ArrayList<Player> getWhosFault() {
|
||||
return this.whosFault;
|
||||
}
|
||||
|
||||
public ArrayList<Player> getGraceList() {
|
||||
public HashSet<Player> getGraceList() {
|
||||
return this.graceList;
|
||||
}
|
||||
|
||||
public HashMap<Player, CustomList> getTpaInfo() {
|
||||
return this.tpaInfo;
|
||||
public HashMap<Player, Player> getTpaCancel() {
|
||||
return tpaCancel;
|
||||
}
|
||||
|
||||
public HashMap<Player, CustomList> getTpaPlayers() {
|
||||
return this.playerTpaList;
|
||||
}
|
||||
|
||||
public void reloadTheConfig() {
|
||||
@@ -87,11 +57,23 @@ public final class ClickTpa extends JavaPlugin {
|
||||
getCommand("tpa").setExecutor(new CommandTpa(this));
|
||||
getCommand("tpahere").setExecutor(new CommandTpaHere(this));
|
||||
getCommand("tpacancel").setExecutor(new CommandTpCancel(this));
|
||||
getCommand("tpaccept").setExecutor(new Commands(this));
|
||||
getCommand("tpaccept").setExecutor(new CommandTpaccept(this));
|
||||
getCommand("tpdeny").setExecutor(new CommandTpaDeny(this));
|
||||
getCommand("tpo").setExecutor(new CommandTpo(this));
|
||||
getCommand("tpohere").setExecutor(new CommandTpoHere(this));
|
||||
getCommand("tptoggle").setExecutor(new CommandTpToggle(this));
|
||||
getCommand("clicktparl").setExecutor(new CommandReload(this));
|
||||
}
|
||||
|
||||
public void addAllPlayers() {
|
||||
|
||||
CustomList list = new CustomList();
|
||||
list.setMode(TeleportMode.DEFAULT);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
playerTpaList.put(p, list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,64 +8,71 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.TpaInfoList;
|
||||
|
||||
public class CommandTpCancel implements CommandExecutor {
|
||||
private ClickTpa clicktpa;
|
||||
|
||||
public CommandTpCancel(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
if (p != null) {
|
||||
if (!p.hasPermission("clicktpa.tpacancel")) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Insufficient-permission")));
|
||||
Player p = (Player) sender;
|
||||
|
||||
if (!p.hasPermission("clicktpa.tpacancel")) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Insufficient-permission")));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.clicktpa.getTpaCancel().containsKey(p)) {
|
||||
|
||||
Player poorRejectedGuy = Bukkit.getServer().getPlayer(this.clicktpa.getTpaCancel().get(p).getName());
|
||||
|
||||
if (poorRejectedGuy == null) {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Tpacancel-message")));
|
||||
clicktpa.getTpaCancel().remove(p);
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getTpaCancel().containsKey(p.getName())) {
|
||||
Player poorRejectedGuy = Bukkit.getServer()
|
||||
.getPlayer((String) this.clicktpa.getTpaCancel().get(p.getName()));
|
||||
clearLists(p, poorRejectedGuy);
|
||||
if (poorRejectedGuy != null) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Tpacancel-message")));
|
||||
poorRejectedGuy.sendMessage(colorize(this.clicktpa.getConfig().getString("Tpacancel-message")));
|
||||
return true;
|
||||
}
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
} else if (!this.clicktpa.getTpaCancel().containsKey(p.getName())) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
|
||||
if (poorRejectedGuy.isOnline()) {
|
||||
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Tpacancel-message")));
|
||||
poorRejectedGuy.sendMessage(colorize(clicktpa.getConfig().getString("Tpacancel-message")));
|
||||
removeTpaInfo(p, poorRejectedGuy);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Tpacancel-message")));
|
||||
removeTpaInfo(p, poorRejectedGuy);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
}
|
||||
|
||||
public String returnStatementPlayer(String configMessages, Player player) {
|
||||
return this.clicktpa.getConfig().getString(configMessages).replaceAll("%player%", player.getName());
|
||||
private void removeTpaInfo(Player p, Player target) {
|
||||
|
||||
for (TpaInfoList list : clicktpa.getTpaPlayers().get(target).getTpaList()) {
|
||||
if (list.getRequester() == p) {
|
||||
clicktpa.getTpaPlayers().get(target).getTpaList().remove(list);
|
||||
clicktpa.getTpaCancel().remove(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String returnStatementTarget(String configMessages, Player target) {
|
||||
return this.clicktpa.getConfig().getString(configMessages).replaceAll("%target%", target.getName());
|
||||
}
|
||||
|
||||
private void clearLists(Player player, Player target) {
|
||||
this.clicktpa.getHash().remove(player);
|
||||
this.clicktpa.getHash().remove(target);
|
||||
this.clicktpa.getTpaHere().remove(player);
|
||||
this.clicktpa.getTpaHere().remove(target);
|
||||
this.clicktpa.getTeleportStatus().remove(player);
|
||||
this.clicktpa.getTeleportStatus().remove(target);
|
||||
this.clicktpa.getTpaCancel().remove(player.getName());
|
||||
this.clicktpa.getTpaCancel().remove(target.getName());
|
||||
}
|
||||
|
||||
public static String colorize(String message) {
|
||||
public String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public CommandTpCancel(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,14 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class CommandTpToggle implements CommandExecutor {
|
||||
private ClickTpa clicktpa;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
@@ -20,19 +22,26 @@ public class CommandTpToggle implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (p.hasPermission("clicktpa.tptoggle")) {
|
||||
if (!this.clicktpa.getTpToggled().contains(p)) {
|
||||
this.clicktpa.getTpToggled().add(p);
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-TpToggle-Off")));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getTpToggled().contains(p)) {
|
||||
this.clicktpa.getTpToggled().remove(p);
|
||||
|
||||
TeleportMode mode = clicktpa.getTpaPlayers().get(p).getMode();
|
||||
|
||||
switch (mode) {
|
||||
|
||||
case DEFAULT:
|
||||
// turn on tptoggle
|
||||
clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.TPTOGGLE_ON);
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-TpToggle-On")));
|
||||
return true;
|
||||
break;
|
||||
case TPTOGGLE_ON:
|
||||
clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-TpToggle-Off")));
|
||||
break;
|
||||
case TELEPORTING:
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("TpToggle-While-Teleporting")));
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
package com.jklmao.plugin.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.CustomList;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
import com.jklmao.plugin.utils.TeleportMsgs;
|
||||
import com.jklmao.plugin.utils.TeleportType;
|
||||
import com.jklmao.plugin.utils.TpaInfoList;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.hover.content.Content;
|
||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
||||
|
||||
public class CommandTpa implements CommandExecutor {
|
||||
|
||||
private ClickTpa clicktpa;
|
||||
private BukkitTask task;
|
||||
private final TeleportMsgs msgs = new TeleportMsgs();
|
||||
private TpaInfoList info;
|
||||
|
||||
public CommandTpa(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
@@ -44,91 +47,93 @@ public class CommandTpa implements CommandExecutor {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-teleporting-self")));
|
||||
return true;
|
||||
}
|
||||
if (target != null) {
|
||||
if (this.clicktpa.getTpToggled().contains(p)) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-Is-TpToggled")));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getTpToggled().contains(target)) {
|
||||
p.sendMessage(colorize(
|
||||
this.clicktpa.getConfig().getString("Target-Is-TpToggled").replaceAll("%target%", target.getName())));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getHash().containsKey(p)) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-already-requested")));
|
||||
return true;
|
||||
}
|
||||
if (!this.clicktpa.getTpToggled().contains(target)) {
|
||||
this.clicktpa.getHash().put(p, p);
|
||||
this.clicktpa.getHash().put(target, target);
|
||||
this.clicktpa.getTeleportStatus().add(p);
|
||||
CustomList info = new CustomList();
|
||||
info.setTarget(target);
|
||||
info.setType(0);
|
||||
this.clicktpa.getTpaInfo().put(p, info);
|
||||
addThemToList(target, p);
|
||||
TextComponent eemptyspace = new TextComponent(" ");
|
||||
TextComponent bemptyspace = new TextComponent(" ");
|
||||
|
||||
TextComponent accept = new TextComponent(colorize(this.clicktpa.getConfig().getString("Click-to-accept")));
|
||||
Text acceptHoverText = new Text(colorize(this.clicktpa.getConfig().getString("Hover-message-on-accept")));
|
||||
accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { acceptHoverText }));
|
||||
|
||||
TextComponent deny = new TextComponent(colorize(this.clicktpa.getConfig().getString("Click-to-deny")));
|
||||
Text denyHoverText = new Text(colorize(this.clicktpa.getConfig().getString("Hover-message-on-deny")));
|
||||
deny.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { denyHoverText }));
|
||||
|
||||
TextComponent requestsent = new TextComponent(colorize(
|
||||
this.clicktpa.getConfig().getString("Player-sent-request").replaceAll("%target%", target.getName())));
|
||||
|
||||
List<String> tpa = this.clicktpa.getConfig().getStringList("Tpa-message");
|
||||
for (String m : tpa) {
|
||||
target.sendMessage(colorize(m).replaceAll("%player%", p.getName())
|
||||
.replaceAll("%accept%", accept.getText()).replaceAll("%deny%", deny.getText()));
|
||||
}
|
||||
accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + p.getName()));
|
||||
deny.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpadeny " + p.getName()));
|
||||
|
||||
if (this.clicktpa.getConfig().getBoolean("Added-accept-deny-space")) {
|
||||
target.spigot().sendMessage(new BaseComponent[] { bemptyspace, accept, eemptyspace, deny });
|
||||
p.spigot().sendMessage(requestsent);
|
||||
} else {
|
||||
target.spigot().sendMessage(new BaseComponent[] { accept, deny });
|
||||
p.spigot().sendMessage(requestsent);
|
||||
}
|
||||
}
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (CommandTpa.this.clicktpa.getHash().containsKey(p)
|
||||
&& CommandTpa.this.clicktpa.getHash().containsKey(target)) {
|
||||
CommandTpa.this.clicktpa.getHash().remove(p);
|
||||
CommandTpa.this.clicktpa.getHash().remove(target);
|
||||
p.sendMessage(CommandTpa.this
|
||||
.colorize(CommandTpa.this.clicktpa.getConfig().getString("Player-teleportation-request-expire")));
|
||||
target.sendMessage(CommandTpa.this
|
||||
.colorize(CommandTpa.this.clicktpa.getConfig().getString("Target-teleportation-request-expire")));
|
||||
}
|
||||
}
|
||||
}).runTaskLaterAsynchronously(ClickTpa.instance, 2400L);
|
||||
if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TPTOGGLE_ON) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-Is-TpToggled")));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(target).getMode() == TeleportMode.TPTOGGLE_ON) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Target-Is-TpToggled").replaceAll("%target%", target.getName())));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.DEFAULT) {
|
||||
|
||||
for (TpaInfoList list : clicktpa.getTpaPlayers().get(target).getTpaList()) {
|
||||
|
||||
if (list.getRequester() == p) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-already-requested")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// create a new tpa info
|
||||
info = new TpaInfoList(TeleportType.TPA, p);
|
||||
|
||||
clicktpa.getTpaPlayers().get(target).getTpaList().add(info);
|
||||
clicktpa.getTpaCancel().put(p, target);
|
||||
msgs.sendRequestMsg(clicktpa, TeleportType.TPA, p, target);
|
||||
startTimer(p, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
sender.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
|
||||
}
|
||||
sender.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addThemToList(Player sender, Player recipient) {
|
||||
String senderName = sender.getName();
|
||||
String recipientName = recipient.getName();
|
||||
this.clicktpa.getTpaCancel().put(recipientName, senderName);
|
||||
private void startTimer(Player p, Player target) {
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(clicktpa, new Runnable() {
|
||||
|
||||
int time = clicktpa.getConfig().getInt("Request-expire-time") * 4;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (time == 0) {
|
||||
task.cancel();
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Player-teleportation-request-expire")));
|
||||
target.sendMessage(colorize(clicktpa.getConfig().getString("Target-teleportation-request-expire")));
|
||||
|
||||
// expired request
|
||||
clicktpa.getTpaPlayers().get(target).getTpaList().remove(info);
|
||||
clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
|
||||
task = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isOnline()) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
return;
|
||||
} else {
|
||||
|
||||
if (!clicktpa.getTpaPlayers().get(target).getTpaList().contains(info)) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TELEPORTING) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
return;
|
||||
}
|
||||
|
||||
time = time - 1;
|
||||
}
|
||||
|
||||
}, 0, 5);
|
||||
|
||||
}
|
||||
|
||||
public String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public CommandTpa(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,17 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.TpaInfoList;
|
||||
|
||||
public class CommandTpaDeny implements CommandExecutor {
|
||||
|
||||
private ClickTpa clicktpa;
|
||||
|
||||
String targetsname = new String();
|
||||
public CommandTpaDeny(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
@@ -25,61 +30,47 @@ public class CommandTpaDeny implements CommandExecutor {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Tpdeny-usage")));
|
||||
return true;
|
||||
}
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (target != null) {
|
||||
if (target.isOnline()) {
|
||||
if (this.clicktpa.getHash().containsKey(target) || this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
clearLists(p, target);
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-deny-tpa-message")));
|
||||
target.sendMessage(colorize(this.clicktpa.getConfig().getString("Target-deny-tpa-message")));
|
||||
return true;
|
||||
}
|
||||
if (!this.clicktpa.getHash().containsKey(p) || !this.clicktpa.getTpaHere().containsKey(p)) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
final Player target = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (target == null) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("No-player-found")));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.isOnline()) {
|
||||
|
||||
boolean hasRequester = false;
|
||||
|
||||
for (TpaInfoList list : clicktpa.getTpaPlayers().get(p).getTpaList()) {
|
||||
if (list.getRequester() == target) {
|
||||
clicktpa.getTpaPlayers().get(p).getTpaList().remove(list);
|
||||
clicktpa.getTpaCancel().remove(target);
|
||||
hasRequester = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasRequester) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-deny-tpa-message")));
|
||||
target.sendMessage(colorize(this.clicktpa.getConfig().getString("Target-deny-tpa-message")));
|
||||
clicktpa.getTpaCancel().remove(target);
|
||||
return true;
|
||||
} else {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Target-is-offline")));
|
||||
clearLists(p, target);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!this.clicktpa.getHash().containsKey(target) || !this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
clearLists(p, target);
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Target-is-offline")));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getHash().containsKey(target) || this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
clearLists(p, target);
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Target-is-offline")));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clearLists(Player player, Player target) {
|
||||
this.clicktpa.getHash().remove(player);
|
||||
this.clicktpa.getHash().remove(target);
|
||||
this.clicktpa.getTpaHere().remove(player);
|
||||
this.clicktpa.getTpaHere().remove(target);
|
||||
this.clicktpa.getTeleportStatus().remove(player);
|
||||
this.clicktpa.getTeleportStatus().remove(target);
|
||||
this.clicktpa.getTpaCancel().remove(player.getName());
|
||||
this.clicktpa.getTpaCancel().remove(target.getName());
|
||||
this.clicktpa.getGraceList().remove(player);
|
||||
this.clicktpa.getGraceList().remove(target);
|
||||
this.clicktpa.getTpaInfo().remove(target);
|
||||
}
|
||||
|
||||
public static String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public CommandTpaDeny(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,32 @@
|
||||
package com.jklmao.plugin.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.CustomList;
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.hover.content.Content;
|
||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
import com.jklmao.plugin.utils.TeleportMsgs;
|
||||
import com.jklmao.plugin.utils.TeleportType;
|
||||
import com.jklmao.plugin.utils.TpaInfoList;
|
||||
|
||||
public class CommandTpaHere implements CommandExecutor {
|
||||
|
||||
private ClickTpa clicktpa;
|
||||
private BukkitTask task;
|
||||
private final TeleportMsgs msgs = new TeleportMsgs();
|
||||
private TpaInfoList info;
|
||||
|
||||
public CommandTpaHere(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
final Player p = (Player) sender;
|
||||
if (!p.hasPermission("clicktpa.tpahere")) {
|
||||
@@ -44,90 +46,93 @@ public class CommandTpaHere implements CommandExecutor {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-teleporting-self")));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getTpToggled().contains(p)) {
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TPTOGGLE_ON) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-Is-TpToggled")));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getTpaHere().containsKey(p)) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-already-requested")));
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(target).getMode() == TeleportMode.TPTOGGLE_ON) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Target-Is-TpToggled").replaceAll("%target%", target.getName())));
|
||||
return true;
|
||||
}
|
||||
if (this.clicktpa.getTpToggled().contains(target)) {
|
||||
p.sendMessage(colorize(
|
||||
this.clicktpa.getConfig().getString("Target-Is-TpToggled").replaceAll("%target%", target.getName())));
|
||||
return true;
|
||||
}
|
||||
if (!this.clicktpa.getTpToggled().contains(target)) {
|
||||
this.clicktpa.getTpaHere().put(p, p);
|
||||
this.clicktpa.getTpaHere().put(target, target);
|
||||
this.clicktpa.getTeleportStatus().add(target);
|
||||
addThemToList(target, p);
|
||||
CustomList info = new CustomList();
|
||||
info.setTarget(target);
|
||||
info.setType(1);
|
||||
this.clicktpa.getTpaInfo().put(p, info);
|
||||
TextComponent eemptyspace = new TextComponent(" ");
|
||||
TextComponent bemptyspace = new TextComponent(" ");
|
||||
|
||||
TextComponent accept = new TextComponent(colorize(this.clicktpa.getConfig().getString("Click-to-accept")));
|
||||
Text acceptHoverText = new Text(colorize(this.clicktpa.getConfig().getString("Hover-message-on-accept")));
|
||||
accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { acceptHoverText }));
|
||||
if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.DEFAULT) {
|
||||
|
||||
TextComponent deny = new TextComponent(colorize(this.clicktpa.getConfig().getString("Click-to-deny")));
|
||||
Text denyHoverText = new Text(colorize(this.clicktpa.getConfig().getString("Hover-message-on-deny")));
|
||||
deny.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { denyHoverText }));
|
||||
for (TpaInfoList list : clicktpa.getTpaPlayers().get(target).getTpaList()) {
|
||||
|
||||
TextComponent requestsent = new TextComponent(colorize(
|
||||
this.clicktpa.getConfig().getString("Player-sent-request").replaceAll("%target%", target.getName())));
|
||||
List<String> tpa = this.clicktpa.getConfig().getStringList("Tpahere-message");
|
||||
|
||||
for (String m : tpa) {
|
||||
target.sendMessage(colorize(m).replaceAll("%player%", p.getName()).replaceAll("%accept%", accept.getText())
|
||||
.replaceAll("%deny%", deny.getText()));
|
||||
}
|
||||
|
||||
accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + p.getName()));
|
||||
deny.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpadeny " + p.getName()));
|
||||
|
||||
if (this.clicktpa.getConfig().getBoolean("Added-accept-deny-space")) {
|
||||
target.spigot().sendMessage(new BaseComponent[] { bemptyspace, accept, eemptyspace, deny });
|
||||
p.spigot().sendMessage(requestsent);
|
||||
} else {
|
||||
target.spigot().sendMessage(new BaseComponent[] { accept, deny });
|
||||
p.spigot().sendMessage(requestsent);
|
||||
}
|
||||
}
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (CommandTpaHere.this.clicktpa.getTpaHere().containsKey(p)
|
||||
&& CommandTpaHere.this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
CommandTpaHere.this.clicktpa.getTpaHere().clear();
|
||||
p.sendMessage(CommandTpaHere
|
||||
.colorize(CommandTpaHere.this.clicktpa.getConfig().getString("Player-teleportation-request-expire")));
|
||||
target.sendMessage(CommandTpaHere
|
||||
.colorize(CommandTpaHere.this.clicktpa.getConfig().getString("Target-teleportation-request-expire")));
|
||||
if (list.getRequester() == p) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-already-requested")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).runTaskLaterAsynchronously(ClickTpa.instance, 2400L);
|
||||
|
||||
// create a new tpa info
|
||||
info = new TpaInfoList(TeleportType.TPAHERE, p);
|
||||
|
||||
clicktpa.getTpaPlayers().get(target).getTpaList().add(info);
|
||||
clicktpa.getTpaCancel().put(p, target);
|
||||
msgs.sendRequestMsg(clicktpa, TeleportType.TPAHERE, p, target);
|
||||
startTimer(p, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
sender.sendMessage(colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addThemToList(Player sender, Player recipient) {
|
||||
String senderName = sender.getName();
|
||||
String recipientName = recipient.getName();
|
||||
this.clicktpa.getTpaCancel().put(recipientName, senderName);
|
||||
private void startTimer(Player p, Player target) {
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(clicktpa, new Runnable() {
|
||||
|
||||
int time = clicktpa.getConfig().getInt("Request-expire-time") * 4;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (time == 0) {
|
||||
task.cancel();
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Player-teleportation-request-expire")));
|
||||
target.sendMessage(colorize(clicktpa.getConfig().getString("Target-teleportation-request-expire")));
|
||||
|
||||
// expired request
|
||||
clicktpa.getTpaPlayers().get(target).getTpaList().remove(info);
|
||||
clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
|
||||
task = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isOnline()) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
return;
|
||||
} else {
|
||||
|
||||
if (!clicktpa.getTpaPlayers().get(target).getTpaList().contains(info)) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TELEPORTING) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
return;
|
||||
}
|
||||
|
||||
time = time - 1;
|
||||
}
|
||||
|
||||
}, 0, 5);
|
||||
|
||||
}
|
||||
|
||||
public static String colorize(String message) {
|
||||
public String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public CommandTpaHere(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.jklmao.plugin.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.events.TpaCountdownListener;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
import com.jklmao.plugin.utils.TeleportType;
|
||||
import com.jklmao.plugin.utils.TpaInfoList;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class CommandTpaccept implements CommandExecutor {
|
||||
private int seconds;
|
||||
private ClickTpa clicktpa;
|
||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||
|
||||
public CommandTpaccept(ClickTpa pl) {
|
||||
clicktpa = pl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
seconds = clicktpa.getConfig().getInt("Seconds-until-tpa");
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(colorize(clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (!p.hasPermission("clicktpa.tpaccept")) {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Insufficient-permission")));
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Tpaccept-usage")));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (target == null) {
|
||||
p.sendMessage(colorize(this.clicktpa.getConfig().getString("No-player-found")));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!target.isOnline()) {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Target-is-offline")));
|
||||
|
||||
for (TpaInfoList list : clicktpa.getTpaPlayers().get(p).getTpaList()) {
|
||||
if (list.getRequester() == target) {
|
||||
clicktpa.getTpaPlayers().get(p).getTpaList().remove(list);
|
||||
clicktpa.getTpaCancel().remove(target);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(p).getTpaList().isEmpty()) {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
}
|
||||
|
||||
TpaInfoList tpaInfo = null;
|
||||
|
||||
if (clicktpa.getTpaPlayers().get(p).getTpaList().size() > 0) {
|
||||
|
||||
boolean hasRequester = false;
|
||||
for (TpaInfoList list : clicktpa.getTpaPlayers().get(p).getTpaList()) {
|
||||
|
||||
if (list.getRequester() != target) {
|
||||
hasRequester = false;
|
||||
} else {
|
||||
hasRequester = true;
|
||||
tpaInfo = list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasRequester == false) {
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Player-got-accepted-tpa")));
|
||||
target.sendMessage(colorize(clicktpa.getConfig().getString("Target-accepted-tpa-request")));
|
||||
|
||||
TpaCountdownListener cdListener = new TpaCountdownListener();
|
||||
|
||||
switch (tpaInfo.getType()) {
|
||||
|
||||
case TPA:
|
||||
target.sendMessage(colorize(clicktpa.getConfig().getString("Countdown-until-tpa")));
|
||||
clicktpa.getTpaPlayers().get(target).setMode(TeleportMode.TELEPORTING);
|
||||
clicktpa.getGraceList().add(target);
|
||||
cdListener.tpaCountdown(clicktpa, seconds, TeleportType.TPA, p, target);
|
||||
break;
|
||||
case TPAHERE:
|
||||
p.sendMessage(colorize(clicktpa.getConfig().getString("Countdown-until-tpa")));
|
||||
clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.TELEPORTING);
|
||||
clicktpa.getGraceList().add(p);
|
||||
cdListener.tpaCountdown(clicktpa, seconds, TeleportType.TPAHERE, p, target);
|
||||
break;
|
||||
}
|
||||
clicktpa.getTpaCancel().remove(target);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
package com.jklmao.plugin.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class Commands implements CommandExecutor {
|
||||
private int seconds;
|
||||
private int countdown;
|
||||
private ClickTpa clicktpa;
|
||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
this.seconds = this.clicktpa.getConfig().getInt("Seconds-until-tpa");
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-only-command")));
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (!p.hasPermission("clicktpa.tpaccept")) {
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Insufficient-permission")));
|
||||
return true;
|
||||
} else if (args.length == 0) {
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Tpaccept-usage")));
|
||||
return true;
|
||||
} else {
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (args.length >= 1) {
|
||||
if (target != null) {
|
||||
if (!target.isOnline()) {
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Target-is-offline")));
|
||||
this.clearLists(p, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!this.clicktpa.getHash().containsKey(target) && !this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
if (this.clicktpa.getTpaHere().containsKey(p) && this.clicktpa.getHash().containsKey(p)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
}
|
||||
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-got-accepted-tpa")));
|
||||
target.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Target-accepted-tpa-request")));
|
||||
if (this.clicktpa.getHash().containsKey(target)) {
|
||||
target.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Countdown-until-tpa")));
|
||||
} else {
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Countdown-until-tpa")));
|
||||
}
|
||||
|
||||
this.clicktpa.getHash().remove(p);
|
||||
this.clicktpa.getHash().remove(target);
|
||||
this.clicktpa.getTpaHere().remove(p);
|
||||
this.clicktpa.getTpaHere().remove(target);
|
||||
this.clicktpa.getTpaCancel().remove(p.getName());
|
||||
this.clicktpa.getTpaCancel().remove(target.getName());
|
||||
if (this.clicktpa.getTpaInfo().get(target).getType() == 0) {
|
||||
this.clicktpa.getGraceList().add(target);
|
||||
}
|
||||
|
||||
if (this.clicktpa.getTpaInfo().get(target).getType() == 1) {
|
||||
this.clicktpa.getGraceList().add(p);
|
||||
}
|
||||
|
||||
this.clicktpa.getTpaInfo().remove(target);
|
||||
this.countdown = this.clicktpa.getServer().getScheduler().scheduleSyncRepeatingTask(this.clicktpa, () -> {
|
||||
if (this.seconds != -1) {
|
||||
if (this.seconds != 0) {
|
||||
if (!this.clicktpa.getTeleportStatus().contains(target) && !this.clicktpa.getTeleportStatus().contains(p)) {
|
||||
this.clicktpa.getServer().getScheduler().cancelTask(this.countdown);
|
||||
|
||||
if (!this.clicktpa.getTeleportStatus().contains(target) || !this.clicktpa.getTeleportStatus().contains(p)) {
|
||||
if (this.clicktpa.getWhosFault().contains(p)) {
|
||||
target.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-moved-before-tp")
|
||||
.replaceAll("%player%", p.getName())));
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-moved-before-tp")
|
||||
.replaceAll("%player%", p.getName())));
|
||||
this.clicktpa.getWhosFault().remove(p);
|
||||
this.clicktpa.getWhosFault().remove(target);
|
||||
}
|
||||
|
||||
if (this.clicktpa.getWhosFault().contains(target)) {
|
||||
target.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-moved-before-tp")
|
||||
.replaceAll("%player%", target.getName())));
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-moved-before-tp")
|
||||
.replaceAll("%player%", target.getName())));
|
||||
this.clicktpa.getWhosFault().remove(target);
|
||||
this.clicktpa.getWhosFault().remove(p);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
--this.seconds;
|
||||
}
|
||||
} else {
|
||||
this.clicktpa.getTeleportStatus().remove(p);
|
||||
this.clicktpa.getTeleportStatus().remove(target);
|
||||
|
||||
if (clicktpa.getTpaInfo().get(target).getType() == 1) {
|
||||
p.teleport(target);
|
||||
|
||||
} else if (clicktpa.getTpaInfo().get(target).getType() == 0) {
|
||||
target.teleport(p);
|
||||
}
|
||||
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Target-currently-teleporting")));
|
||||
target.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-currently-teleporting")));
|
||||
this.clicktpa.getServer().getScheduler().cancelTask(this.countdown);
|
||||
}
|
||||
}
|
||||
|
||||
}, 0L, 20L);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
if (this.clicktpa.getHash().containsKey(target) && !this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
if (!this.clicktpa.getHash().containsKey(target) && !this.clicktpa.getTpaHere().containsKey(target)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.clearLists(p, target);
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Player-no-pendingtpa-message")));
|
||||
return true;
|
||||
}
|
||||
|
||||
this.clearLists(p, target);
|
||||
p.sendMessage(this.colorize(this.clicktpa.getConfig().getString("Target-is-offline")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearLists(Player player, Player target) {
|
||||
this.clicktpa.getHash().remove(player);
|
||||
this.clicktpa.getHash().remove(target);
|
||||
this.clicktpa.getTpaHere().remove(player);
|
||||
this.clicktpa.getTpaHere().remove(target);
|
||||
this.clicktpa.getTeleportStatus().remove(player);
|
||||
this.clicktpa.getTeleportStatus().remove(target);
|
||||
this.clicktpa.getTpaCancel().remove(player.getName());
|
||||
this.clicktpa.getTpaCancel().remove(target.getName());
|
||||
}
|
||||
|
||||
public String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public Commands(ClickTpa pl) {
|
||||
this.clicktpa = pl;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.jklmao.plugin.events;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.CustomList;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
|
||||
public class PlayerEvents implements Listener {
|
||||
private ClickTpa clicktpa;
|
||||
@@ -16,24 +19,36 @@ public class PlayerEvents implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWalk(PlayerMoveEvent e) {
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
|
||||
CustomList list = new CustomList();
|
||||
|
||||
list.setMode(TeleportMode.DEFAULT);
|
||||
|
||||
clicktpa.getTpaPlayers().put(e.getPlayer(), list);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e) {
|
||||
|
||||
clicktpa.getTpaPlayers().remove(e.getPlayer());
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
if (this.clicktpa.getConfig().getBoolean("Allow-player-to-move"))
|
||||
return;
|
||||
Player p = e.getPlayer();
|
||||
if (!this.clicktpa.getGraceList().contains(p))
|
||||
return;
|
||||
|
||||
if (this.clicktpa.getGraceList().contains(p)) {
|
||||
if (e.getFrom().getX() != e.getTo().getX() || e.getFrom().getZ() != e.getTo().getZ()) {
|
||||
this.clicktpa.getTeleportStatus().remove(p);
|
||||
this.clicktpa.getWhosFault().add(p);
|
||||
if (e.getFrom().getBlockX() != e.getTo().getBlockX() || e.getFrom().getBlockZ() != e.getTo().getBlockZ()) {
|
||||
this.clicktpa.getGraceList().remove(p);
|
||||
clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.jklmao.plugin.events;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
import com.jklmao.plugin.utils.TeleportMode;
|
||||
import com.jklmao.plugin.utils.TeleportMsgs;
|
||||
import com.jklmao.plugin.utils.TeleportType;
|
||||
import com.jklmao.plugin.utils.TpaInfoList;
|
||||
|
||||
public class TpaCountdownListener {
|
||||
|
||||
private final TeleportMsgs tpMsgs = new TeleportMsgs();
|
||||
private BukkitTask cdTask;
|
||||
|
||||
public void tpaCountdown(ClickTpa plugin, int secs, TeleportType type, Player sender, Player target) {
|
||||
|
||||
switch (type) {
|
||||
case TPA:
|
||||
tpMsgs.currentlyTeleportingTitle(plugin, secs, target);
|
||||
break;
|
||||
case TPAHERE:
|
||||
tpMsgs.currentlyTeleportingTitle(plugin, secs, sender);
|
||||
break;
|
||||
}
|
||||
|
||||
cdTask = Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
|
||||
int time = secs * 2;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
// if a player moves
|
||||
|
||||
if (time == 0) {
|
||||
teleport(plugin, type, sender, target);
|
||||
cdTask.cancel();
|
||||
} else {
|
||||
moveListener(plugin, type, sender, target);
|
||||
}
|
||||
|
||||
time = time - 1;
|
||||
|
||||
}
|
||||
|
||||
}, 0, 10);
|
||||
|
||||
}
|
||||
|
||||
private void teleport(ClickTpa plugin, TeleportType type, Player sender, Player target) {
|
||||
switch (type) {
|
||||
case TPA:
|
||||
target.teleport(sender);
|
||||
tpMsgs.successfulTPATitle(plugin, target, sender);
|
||||
plugin.getTpaPlayers().get(target).setMode(TeleportMode.DEFAULT);
|
||||
break;
|
||||
case TPAHERE:
|
||||
sender.teleport(target);
|
||||
tpMsgs.successfulTPATitle(plugin, sender, target);
|
||||
plugin.getTpaPlayers().get(sender).setMode(TeleportMode.DEFAULT);
|
||||
break;
|
||||
}
|
||||
|
||||
removeTpaInfo(plugin, sender, target);
|
||||
|
||||
}
|
||||
|
||||
private void moveListener(ClickTpa plugin, TeleportType type, Player sender, Player target) {
|
||||
|
||||
switch (type) {
|
||||
case TPA:
|
||||
|
||||
if (!plugin.getGraceList().contains(target)) {
|
||||
cdTask.cancel();
|
||||
tpMsgs.sendMoveBeforeTPATitle(plugin, sender, target);
|
||||
removeTpaInfo(plugin, sender, target);
|
||||
}
|
||||
|
||||
return;
|
||||
case TPAHERE:
|
||||
|
||||
if (!plugin.getGraceList().contains(sender)) {
|
||||
cdTask.cancel();
|
||||
tpMsgs.sendMoveBeforeTPAHERETitle(plugin, sender, target);
|
||||
removeTpaInfo(plugin, sender, target);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void removeTpaInfo(ClickTpa plugin, Player sender, Player target) {
|
||||
|
||||
for (TpaInfoList tpaInfo : plugin.getTpaPlayers().get(sender).getTpaList()) {
|
||||
|
||||
if (tpaInfo.getRequester() != target) {
|
||||
continue;
|
||||
} else {
|
||||
plugin.getTpaPlayers().get(sender).getTpaList().remove(tpaInfo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +1,23 @@
|
||||
package com.jklmao.plugin.utils;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomList {
|
||||
private Player target;
|
||||
|
||||
private int type;
|
||||
private TeleportMode mode;
|
||||
private List<TpaInfoList> tpaList = new ArrayList<>();
|
||||
|
||||
public void setTarget(Player t) {
|
||||
this.target = t;
|
||||
public TeleportMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public Player getTarget() {
|
||||
return this.target;
|
||||
public void setMode(TeleportMode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
public List<TpaInfoList> getTpaList() {
|
||||
return tpaList;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.jklmao.plugin.utils;
|
||||
|
||||
public enum TeleportMode {
|
||||
|
||||
DEFAULT, TELEPORTING, TPTOGGLE_ON
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.jklmao.plugin.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jklmao.plugin.ClickTpa;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.hover.content.Content;
|
||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
||||
|
||||
public class TeleportMsgs {
|
||||
|
||||
public TeleportMsgs() {
|
||||
}
|
||||
|
||||
public void sendRequestMsg(ClickTpa clicktpa, TeleportType type, Player player, Player target) {
|
||||
|
||||
TextComponent eemptyspace = new TextComponent(" ");
|
||||
TextComponent bemptyspace = new TextComponent(" ");
|
||||
|
||||
TextComponent accept = new TextComponent(colorize(clicktpa.getConfig().getString("Click-to-accept")));
|
||||
Text acceptHoverText = new Text(colorize(clicktpa.getConfig().getString("Hover-message-on-accept")));
|
||||
accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { acceptHoverText }));
|
||||
|
||||
TextComponent deny = new TextComponent(colorize(clicktpa.getConfig().getString("Click-to-deny")));
|
||||
Text denyHoverText = new Text(colorize(clicktpa.getConfig().getString("Hover-message-on-deny")));
|
||||
deny.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { denyHoverText }));
|
||||
|
||||
TextComponent requestsent = new TextComponent(
|
||||
colorize(clicktpa.getConfig().getString("Player-sent-request").replaceAll("%target%", target.getName())));
|
||||
|
||||
List<String> tpa = null;
|
||||
|
||||
switch (type) {
|
||||
case TPA:
|
||||
tpa = clicktpa.getConfig().getStringList("Tpa-message");
|
||||
break;
|
||||
case TPAHERE:
|
||||
tpa = clicktpa.getConfig().getStringList("Tpahere-message");
|
||||
break;
|
||||
}
|
||||
|
||||
for (String m : tpa) {
|
||||
target.sendMessage(
|
||||
colorize(m).replaceAll("%player%", player.getName()).replaceAll("%accept%", accept.getText()).replaceAll("%deny%", deny.getText()));
|
||||
}
|
||||
accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + player.getName()));
|
||||
|
||||
deny.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpadeny " + player.getName()));
|
||||
|
||||
if (clicktpa.getConfig().getBoolean("Added-accept-deny-space")) {
|
||||
target.spigot().sendMessage(new BaseComponent[] { bemptyspace, accept, eemptyspace, deny });
|
||||
player.spigot().sendMessage(requestsent);
|
||||
} else {
|
||||
target.spigot().sendMessage(new BaseComponent[] { accept, deny });
|
||||
player.spigot().sendMessage(requestsent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void successfulTPATitle(ClickTpa clicktpa, Player teleporter, Player waiter) {
|
||||
|
||||
String successMsg = clicktpa.getConfig().getString("On-screen-teleported");
|
||||
|
||||
if (clicktpa.getConfig().getBoolean("Send-on-screen-message")) {
|
||||
teleporter.sendTitle(colorize(successMsg), "", 1, 20, 1);
|
||||
}
|
||||
|
||||
teleporter.sendMessage(colorize(clicktpa.getConfig().getString("Target-currently-teleporting")));
|
||||
waiter.sendMessage(colorize(clicktpa.getConfig().getString("Player-currently-teleporting")));
|
||||
|
||||
}
|
||||
|
||||
public void currentlyTeleportingTitle(ClickTpa clicktpa, int secs, Player teleporter) {
|
||||
|
||||
if (clicktpa.getConfig().getBoolean("Send-on-screen-message")) {
|
||||
|
||||
String mainTitle = clicktpa.getConfig().getStringList("On-screen-teleporting").get(0);
|
||||
String subTitle = clicktpa.getConfig().getStringList("On-screen-teleporting").get(1);
|
||||
|
||||
teleporter.sendTitle(colorize(mainTitle), colorize(subTitle), 1, secs * 20, 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMoveBeforeTPAHERETitle(ClickTpa clicktpa, Player player, Player target) {
|
||||
|
||||
target.sendMessage(colorize(clicktpa.getConfig().getString("Player-moved-before-tp").replaceAll("%player%", player.getName())));
|
||||
player.sendMessage(colorize(clicktpa.getConfig().getString("Player-moved-before-tp").replaceAll("%player%", player.getName())));
|
||||
|
||||
if (clicktpa.getConfig().getBoolean("Send-on-screen-message")) {
|
||||
String cancelMsg = clicktpa.getConfig().getString("On-screen-canceled-tp");
|
||||
player.sendTitle(colorize(cancelMsg), "", 1, 30, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMoveBeforeTPATitle(ClickTpa clicktpa, Player player, Player target) {
|
||||
|
||||
target.sendMessage(colorize(clicktpa.getConfig().getString("Player-moved-before-tp").replaceAll("%player%", target.getName())));
|
||||
player.sendMessage(colorize(clicktpa.getConfig().getString("Player-moved-before-tp").replaceAll("%player%", target.getName())));
|
||||
|
||||
if (clicktpa.getConfig().getBoolean("Send-on-screen-message")) {
|
||||
String cancelMsg = clicktpa.getConfig().getString("On-screen-canceled-tp");
|
||||
target.sendTitle(colorize(cancelMsg), "", 1, 30, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.jklmao.plugin.utils;
|
||||
|
||||
public enum TeleportType {
|
||||
|
||||
TPA, TPAHERE
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jklmao.plugin.utils;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TpaInfoList {
|
||||
|
||||
private TeleportType type;
|
||||
private Player target;
|
||||
|
||||
public TpaInfoList(TeleportType t, Player p) {
|
||||
type = t;
|
||||
target = p;
|
||||
}
|
||||
|
||||
public Player getRequester() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public TeleportType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
# Config for ClickTpa
|
||||
# Version v1.7
|
||||
# Author: jklmao
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# ClickTpa Config #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
# Be aware of all warnings! #
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# Place Holders #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
# Use '%player%' for the player who sent the request.
|
||||
# Use '%accept%' for the 'Click-to-accept' message.
|
||||
# Use '%deny%' for the 'Click-to-deny' message.
|
||||
# Use '%target%' for the player who they wanted to teleport to, and for the 'Player-sent-request' message.
|
||||
# Example: /tpa <player>, where <player> is '%target%'.
|
||||
|
||||
Player-only-command: '&cOnly players can use this command!'
|
||||
|
||||
Insufficient-permission: '&cYou do not have sufficient permission!'
|
||||
|
||||
Player-deny-tpa-message: '&cTeleportation request has been denied.'
|
||||
|
||||
Target-deny-tpa-message: '&cTeleportation request has been denied.'
|
||||
|
||||
Target-teleportion-canceled: '&cTeleportation canceled...'
|
||||
|
||||
Player-got-accepted-tpa: '&bTeleportation request has been accepted.'
|
||||
|
||||
Countdown-until-tpa: '&eTeleporting in 3 seconds...'
|
||||
|
||||
Player-no-pendingtpa-message: '&cYou do not have a pending request!'
|
||||
|
||||
Target-accepted-tpa-request: '&eRequest for teleportation is accepted.'
|
||||
|
||||
Target-is-offline: '&cThis player is offline!'
|
||||
|
||||
No-player-found: '&cThis player does not exist!'
|
||||
|
||||
Player-teleporting-self: '&cYou can not teleport yourself!'
|
||||
|
||||
Player-already-requested: '&cYou already requested, please wait..'
|
||||
|
||||
Player-teleportation-request-expire: '&cTeleportation request has expired.'
|
||||
|
||||
Target-teleportation-request-expire: '&cTeleportation request has expired.'
|
||||
|
||||
Player-currently-teleporting: '&bTeleporting...'
|
||||
|
||||
Target-currently-teleporting: '&eTeleporting...'
|
||||
|
||||
Player-TpToggle-Off: '&eTeleportation &6OFF'
|
||||
|
||||
Player-TpToggle-On: '&eTeleportation &6ON'
|
||||
|
||||
Target-Is-TpToggled: '&6%target% &ehas teleportation off'
|
||||
|
||||
Player-Is-TpToggled: '&cYou are tptoggled!'
|
||||
|
||||
TpToggle-While-Teleporting: '&cCannot TpToggle while teleporting!'
|
||||
|
||||
Tpacancel-message: '&6Tpa request has been canceled.'
|
||||
|
||||
# TPA request expires in seconds
|
||||
Request-expire-time: 120
|
||||
|
||||
|
||||
# Seconds until tpa
|
||||
# Please use whole numbers
|
||||
|
||||
Seconds-until-tpa: 3
|
||||
|
||||
# Becareful in this part!
|
||||
# This is when a player uses not enough args
|
||||
# For example, when a player does '/tpa', it will say 'Usage: /tpa <player>'
|
||||
# So please fit the correct command under the correct message!
|
||||
# P.S '/tpohere' is also '/s' (essentials-type command).
|
||||
|
||||
Tpa-usage: '&cUse: /tpa <player>'
|
||||
|
||||
Tpahere-usage: '&cUse: /tpahere <player>'
|
||||
|
||||
Tpaccept-usage: '&cUse: /tpaccept <player>'
|
||||
|
||||
Tpdeny-usage: '&cUse: /tpadeny <player>'
|
||||
|
||||
Tpo-usage: '&cUse: /tpo <player>'
|
||||
|
||||
Tpohere-usage: '&cUse: /tpohere <player> or /s <player>'
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# Please Read! #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
# This section is when a player gets a tpa request
|
||||
# Since the code used is broken into many parts, there will be many messages.
|
||||
# Whatever you do to the "Click-to-x" messages, will be the same in the 'Tpa-message'
|
||||
# Be careful!
|
||||
|
||||
|
||||
# Lets you choose if you want players to be able
|
||||
# to move before being teleported
|
||||
Allow-player-to-move: false
|
||||
|
||||
Player-moved-before-tp: '&6The request was canceled because %player% moved!'
|
||||
|
||||
Player-sent-request: '&eYou have sent a request to &6%target%'
|
||||
|
||||
Tpa-message:
|
||||
- ''
|
||||
- '&6%player% &ehas requested to teleport to you.'
|
||||
- '&eClick %accept% &eto accept or click %deny% &eto deny.'
|
||||
- '&eThe request expires in 120 seconds.'
|
||||
- ''
|
||||
|
||||
Tpahere-message:
|
||||
- ''
|
||||
- '&6%player% &ehas requested to teleport you to them.'
|
||||
- '&eClick %accept% &eto accept or click %deny% &eto deny.'
|
||||
- '&eThe request expires in 120 seconds.'
|
||||
- ''
|
||||
|
||||
# This will put additional spaces for the accept/deny messages
|
||||
Added-accept-deny-space: true
|
||||
|
||||
Click-to-accept: '&a&l&n[ACCEPT]&r'
|
||||
Click-to-deny: '&c&l&n[DENY]&r'
|
||||
|
||||
Hover-message-on-accept: '&aClick to accept'
|
||||
Hover-message-on-deny: '&cClick to deny'
|
||||
|
||||
#
|
||||
# On-Screen Messages
|
||||
# It pops up in the middle of the player's screen
|
||||
#
|
||||
|
||||
Send-on-screen-message: true
|
||||
|
||||
# When a player accepts a tp
|
||||
On-screen-teleporting:
|
||||
- '&6Teleporting...'
|
||||
- '&eDo not move!'
|
||||
|
||||
# When a player has successfully tp'd.
|
||||
On-screen-teleported: '&aTeleported!'
|
||||
|
||||
# If a player moves while they are being tp'd
|
||||
On-screen-canceled-tp: '&cCanceled TP!'
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~#
|
||||
# More Coming Soon!#
|
||||
#~~~~~~~~~~~~~~~~~~#
|
||||
@@ -0,0 +1,32 @@
|
||||
name: ClickTpa
|
||||
version: 1.6.4
|
||||
main: com.jklmao.plugin.ClickTpa
|
||||
authors: [ jklmao ]
|
||||
description: Simple TPA plugin for Spigot/Paper Software
|
||||
|
||||
commands:
|
||||
tpa:
|
||||
usage: /<command>
|
||||
aliases: [teleport]
|
||||
tpahere:
|
||||
usage: /<command>
|
||||
tpaccept:
|
||||
usage: /<command>
|
||||
aliases: [tpyes]
|
||||
tpadeny:
|
||||
usage: /<command>
|
||||
aliases: [tpdeny, tpno]
|
||||
tpo:
|
||||
usage: /<command>
|
||||
alises: [tp]
|
||||
tpohere:
|
||||
usage: /<command>
|
||||
aliases: [s, tphere]
|
||||
tptoggle:
|
||||
usage: /<command>
|
||||
tpacancel:
|
||||
usage: /<command>
|
||||
aliases: [tpcancel]
|
||||
clicktparl:
|
||||
usage: /<command>
|
||||
aliases: [ctparl]
|
||||
Reference in new issue
Block a user