The Tower teleporter got moved to this plugin, fixed /mwiki, added teleport controlling, Fs are now divided by deaths
This commit is contained in:
parent
60620fb154
commit
63929b7006
14 changed files with 179 additions and 51 deletions
Binary file not shown.
|
@ -26,5 +26,7 @@
|
||||||
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/PermissionsEx-1.23.3.jar"/>
|
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/PermissionsEx-1.23.3.jar"/>
|
||||||
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/votifier-1.9.jar"/>
|
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/votifier-1.9.jar"/>
|
||||||
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/Vault.jar"/>
|
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/Vault.jar"/>
|
||||||
|
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/Factions.jar"/>
|
||||||
|
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/MassiveCore.jar"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: TheButtonMCPlugin
|
name: TheButtonMCPlugin
|
||||||
main: tk.sznp.thebuttonautoflair.PluginMain
|
main: tk.sznp.thebuttonautoflair.PluginMain
|
||||||
version: 3.0
|
version: 4.0
|
||||||
commands:
|
commands:
|
||||||
u:
|
u:
|
||||||
description: Auto-flair system. Accept or ignore flair.
|
description: Auto-flair system. Accept or ignore flair.
|
||||||
|
@ -19,7 +19,7 @@ commands:
|
||||||
description: Search the wiki.
|
description: Search the wiki.
|
||||||
usage: "&vUsage: /mwiki [query]&r"
|
usage: "&vUsage: /mwiki [query]&r"
|
||||||
author: NorbiPeti
|
author: NorbiPeti
|
||||||
depend: [Essentials, Towny, Minigames, Votifier]
|
depend: [Essentials, Towny, Minigames, Votifier, Factions]
|
||||||
permissions:
|
permissions:
|
||||||
tbmc.admin:
|
tbmc.admin:
|
||||||
description: Gives access to /un- commands and /u admin commands
|
description: Gives access to /un- commands and /u admin commands
|
||||||
|
|
|
@ -212,9 +212,11 @@ public class Commands implements CommandExecutor {
|
||||||
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
||||||
p.sendMessage("§b* " + p.getDisplayName() + " YEEHAWs.");
|
p.sendMessage("§b* " + p.getDisplayName() + " YEEHAWs.");
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
case "mwiki": {
|
case "mwiki": {
|
||||||
DoMWiki(player, args);
|
DoMWiki(player, args);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
player.sendMessage("Unknown command: " + cmd.getName());
|
player.sendMessage("Unknown command: " + cmd.getName());
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class MaybeOfflinePlayer {
|
||||||
public Channel CurrentChannel = Channel.GlobalChat;
|
public Channel CurrentChannel = Channel.GlobalChat;
|
||||||
public int FCount;
|
public int FCount;
|
||||||
public boolean SendingLink = false;
|
public boolean SendingLink = false;
|
||||||
|
public int FDeaths;
|
||||||
|
|
||||||
public UUID UUID;
|
public UUID UUID;
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ public class MaybeOfflinePlayer {
|
||||||
mp.PlayerName = cs2.getString("playername");
|
mp.PlayerName = cs2.getString("playername");
|
||||||
mp.UserNames = cs2.getStringList("usernames");
|
mp.UserNames = cs2.getStringList("usernames");
|
||||||
mp.FCount = cs2.getInt("fcount");
|
mp.FCount = cs2.getInt("fcount");
|
||||||
|
mp.FDeaths = cs2.getInt("fdeaths");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ public class MaybeOfflinePlayer {
|
||||||
cs2.set("uuid", mp.UUID.toString());
|
cs2.set("uuid", mp.UUID.toString());
|
||||||
cs2.set("usernames", mp.UserNames);
|
cs2.set("usernames", mp.UserNames);
|
||||||
cs2.set("fcount", mp.FCount);
|
cs2.set("fcount", mp.FCount);
|
||||||
|
cs2.set("fdeaths", mp.FDeaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,5 @@
|
||||||
package tk.sznp.thebuttonautoflair;
|
package tk.sznp.thebuttonautoflair;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.help.HelpTopic;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.scoreboard.Objective;
|
|
||||||
|
|
||||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownBlock;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
|
||||||
import com.palmergames.bukkit.towny.object.WorldCoord;
|
|
||||||
import com.vexsoftware.votifier.model.Vote;
|
|
||||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
|
||||||
|
|
||||||
import au.com.mineauz.minigames.MinigamePlayer;
|
|
||||||
import au.com.mineauz.minigames.Minigames;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
@ -50,7 +12,49 @@ import java.util.TimerTask;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.earth2me.essentials.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
||||||
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
import org.bukkit.help.HelpTopic;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.scoreboard.Objective;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||||
|
import au.com.mineauz.minigames.MinigamePlayer;
|
||||||
|
import au.com.mineauz.minigames.Minigames;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
import com.massivecraft.factions.entity.BoardColl;
|
||||||
|
import com.massivecraft.massivecore.ps.PS;
|
||||||
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
|
import com.palmergames.bukkit.towny.object.Nation;
|
||||||
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownBlock;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
|
import com.palmergames.bukkit.towny.object.WorldCoord;
|
||||||
|
import com.vexsoftware.votifier.model.Vote;
|
||||||
|
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||||
|
|
||||||
public class PlayerListener implements Listener { // 2015.07.16.
|
public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
public static HashMap<String, UUID> nicknames = new HashMap<>();
|
public static HashMap<String, UUID> nicknames = new HashMap<>();
|
||||||
|
@ -318,14 +322,14 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
json.append(String
|
json.append(String
|
||||||
.format("\"color\":\"aqua\"},{\"text\":\"World: %s\n\",\"color\":\"white\"},",
|
.format("\"color\":\"aqua\"},{\"text\":\"World: %s\n\",\"color\":\"white\"},",
|
||||||
event.getPlayer().getWorld().getName()));
|
event.getPlayer().getWorld().getName()));
|
||||||
json.append(String.format(
|
json.append(String
|
||||||
"{\"text\":\"Respect: %s%s%s\",\"color\":\"white\"}]}}},",
|
.format("{\"text\":\"Respect: %s%s%s\",\"color\":\"white\"}]}}},",
|
||||||
(player.FCount == Integer.MAX_VALUE - 1 ? player.FCount + "+"
|
player.FCount / (double) player.FDeaths,
|
||||||
: player.FCount), (player.UserName != null
|
(player.UserName != null && !player.UserName.isEmpty() ? "\nUserName: "
|
||||||
&& !player.UserName.isEmpty() ? "\nUserName: "
|
+ player.UserName
|
||||||
+ player.UserName : ""), (player.PlayerName
|
: ""), (player.PlayerName
|
||||||
.equals("\nAlpha_Bacca44") ? "\nDeaths: " + AlphaDeaths
|
.equals("\nAlpha_Bacca44") ? "\nDeaths: "
|
||||||
: "")));
|
+ AlphaDeaths : "")));
|
||||||
json.append("{\"text\":\"> \",\"color\":\"white\"},");
|
json.append("{\"text\":\"> \",\"color\":\"white\"},");
|
||||||
|
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
@ -684,6 +688,63 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
.getPlayer().getDisplayName(), message));
|
.getPlayer().getDisplayName(), message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
boolean tping = false;
|
||||||
|
boolean tphering = false;
|
||||||
|
if (cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("call")
|
||||||
|
|| cmd.equalsIgnoreCase("ecall")
|
||||||
|
|| cmd.equalsIgnoreCase("etpa")
|
||||||
|
|| cmd.equalsIgnoreCase("tpask")
|
||||||
|
|| cmd.equalsIgnoreCase("etpask"))
|
||||||
|
tping = true;
|
||||||
|
if (cmd.equalsIgnoreCase("tpahere")
|
||||||
|
|| cmd.equalsIgnoreCase("etpahere"))
|
||||||
|
tphering = true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* for (HelpTopic ht : PluginMain.Instance.getServer()
|
||||||
|
* .getHelpMap().getHelpTopics()) { if
|
||||||
|
* (ht.getName().equalsIgnoreCase("/tpa")) { tping = true; break; }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* for (HelpTopic ht : PluginMain.Instance.getServer()
|
||||||
|
* .getHelpMap().getHelpTopics()) { if
|
||||||
|
* (ht.getName().equalsIgnoreCase("/tpahere")) tphering = true;
|
||||||
|
* break; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (tphering) {
|
||||||
|
Player target = Bukkit.getPlayer(event.getMessage()
|
||||||
|
.substring(index + 1).split(" ")[0]);
|
||||||
|
if (target != null
|
||||||
|
&& BoardColl.get()
|
||||||
|
.getFactionAt(PS.valueOf(target.getLocation()))
|
||||||
|
.getId().equalsIgnoreCase("tower")) {
|
||||||
|
event.getPlayer()
|
||||||
|
.sendMessage(
|
||||||
|
"§cYou are not allowed to teleport players out from the Tower");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* for (String s : Bukkit.getCommandAliases().get("/tpahere")) { if
|
||||||
|
* (cmd.equalsIgnoreCase(s)) { tping = true; break; } }
|
||||||
|
*/
|
||||||
|
if (tping) {
|
||||||
|
if (
|
||||||
|
// MPlayer.get(event.getPlayer()).getFaction().getId().equalsIgnoreCase("nomansland"))
|
||||||
|
// {
|
||||||
|
BoardColl
|
||||||
|
.get()
|
||||||
|
.getFactionAt(
|
||||||
|
PS.valueOf(event.getPlayer().getLocation()))
|
||||||
|
.getId().equalsIgnoreCase("tower")) {
|
||||||
|
event.getPlayer().sendMessage(
|
||||||
|
"§cYou are not allowed to teleport to the Tower");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cmd.equalsIgnoreCase("sethome")) {
|
if (cmd.equalsIgnoreCase("sethome")) {
|
||||||
TownyUniverse tu = PluginMain.Instance.TU;
|
TownyUniverse tu = PluginMain.Instance.TU;
|
||||||
|
@ -790,7 +851,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean ActiveF = false;
|
private boolean ActiveF = false;
|
||||||
private int FCount = 0; // TODO: Change to rate
|
private int FCount = 0;
|
||||||
private MaybeOfflinePlayer FPlayer = null;
|
private MaybeOfflinePlayer FPlayer = null;
|
||||||
private Timer Ftimer;
|
private Timer Ftimer;
|
||||||
public static int AlphaDeaths;
|
public static int AlphaDeaths;
|
||||||
|
@ -801,13 +862,18 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
AlphaDeaths++;
|
AlphaDeaths++;
|
||||||
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e
|
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e
|
||||||
.getEntity());
|
.getEntity());
|
||||||
if ((mgp != null && !mgp.isInMinigame()) && new Random().nextBoolean()) { //Don't store Fs for NPCs
|
if ((mgp != null && !mgp.isInMinigame()) && new Random().nextBoolean()) { // Don't
|
||||||
|
// store
|
||||||
|
// Fs
|
||||||
|
// for
|
||||||
|
// NPCs
|
||||||
if (Ftimer != null)
|
if (Ftimer != null)
|
||||||
Ftimer.cancel();
|
Ftimer.cancel();
|
||||||
ActiveF = true;
|
ActiveF = true;
|
||||||
FCount = 0;
|
FCount = 0;
|
||||||
FPlayer = MaybeOfflinePlayer.AllPlayers.get(e.getEntity()
|
FPlayer = MaybeOfflinePlayer.AllPlayers.get(e.getEntity()
|
||||||
.getUniqueId());
|
.getUniqueId());
|
||||||
|
FPlayer.FDeaths++;
|
||||||
for (Player p : PluginMain.GetPlayers()) {
|
for (Player p : PluginMain.GetPlayers()) {
|
||||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p
|
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p
|
||||||
.getUniqueId());
|
.getUniqueId());
|
||||||
|
@ -884,6 +950,61 @@ public class PlayerListener implements Listener { // 2015.07.16.
|
||||||
if (op != null) {
|
if (op != null) {
|
||||||
PluginMain.economy.depositPlayer(op, 50.0);
|
PluginMain.economy.depositPlayer(op, 50.0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @EventHandler public void onPlayerLogin(PlayerLoginEvent e) {
|
||||||
|
* System.out.println("Result:" + e.getResult());
|
||||||
|
* System.out.println("Kick message: " + e.getKickMessage()); }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @EventHandler public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
||||||
|
* System.out.println("Pre - LoginResult:" + e.getLoginResult());
|
||||||
|
* System.out.println("Pre - Kick message: " + e.getKickMessage()); }
|
||||||
|
*/
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerMove(PlayerMoveEvent e) {
|
||||||
|
// minecraft:tp @a[x=190,y=-80,z=45,dx=5,dy=50,dz=5] 190 1 45
|
||||||
|
if (e.getPlayer().getWorld().getName().equals("wilds")
|
||||||
|
&& e.getTo().getBlockX() > 185 && e.getTo().getBlockX() < 200
|
||||||
|
&& e.getTo().getBlockZ() > 40 && e.getTo().getBlockZ() < 60
|
||||||
|
&& e.getTo().getBlockY() < -64) {
|
||||||
|
final Player p = e.getPlayer();
|
||||||
|
p.setVelocity(new Vector(0, 0, 0));
|
||||||
|
p.setFallDistance(0);
|
||||||
|
Bukkit.getServer()
|
||||||
|
.getScheduler()
|
||||||
|
.scheduleSyncDelayedTask(PluginMain.Instance,
|
||||||
|
new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
p.setVelocity(new Vector(0, 0, 0));
|
||||||
|
p.setFallDistance(0);
|
||||||
|
p.teleport(new Location(Bukkit
|
||||||
|
.getWorld("wilds"), 190, 1, 50));
|
||||||
|
p.setVelocity(new Vector(0, 0, 0));
|
||||||
|
p.setFallDistance(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onPlayerTeleport(PlayerTeleportEvent e) {
|
||||||
|
if (BoardColl.get().getFactionAt(PS.valueOf(e.getFrom())).getId()
|
||||||
|
.equalsIgnoreCase("nomansland")
|
||||||
|
|| BoardColl.get().getFactionAt(PS.valueOf(e.getTo())).getId()
|
||||||
|
.equalsIgnoreCase("nomansland")) {
|
||||||
|
// e.setTo(e.getFrom());
|
||||||
|
e.setCancelled(true); // Relative coordinates mess it up
|
||||||
|
/*
|
||||||
|
* System.out.println("From: " + e.getFrom());
|
||||||
|
* System.out.println("To: " + e.getTo());
|
||||||
|
* System.out.println("Cause: "+e.getCause());
|
||||||
|
*/
|
||||||
|
e.getPlayer().sendMessage(
|
||||||
|
"§cYou are not allowed to teleport to/from No Mans Land.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue