-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6a7bcee
Showing
11 changed files
with
434 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# User-specific stuff | ||
.idea/ | ||
|
||
*.iml | ||
*.ipr | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
target/ | ||
|
||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
|
||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
.mvn/wrapper/maven-wrapper.jar | ||
.flattened-pom.xml | ||
|
||
# Common working directory | ||
run/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>xyz.arr4nn</groupId> | ||
<artifactId>VulcanSpectate</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>VulcanSpectate</name> | ||
|
||
<description>Used to spectate players cheating detected by Vulcan</description> | ||
<properties> | ||
<java.version>1.8</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<createDependencyReducedPom>false</createDependencyReducedPom> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spigotmc-repo</id> | ||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
<repository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/content/groups/public/</url> | ||
</repository> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>1.18.1-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.MilkBowl</groupId> | ||
<artifactId>VaultAPI</artifactId> | ||
<version>1.7</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package xyz.arr4nn.vulcanspectate; | ||
|
||
import org.bukkit.GameMode; | ||
import org.bukkit.Location; | ||
|
||
public class VanishData { | ||
GameMode gameMode; | ||
Location location; | ||
|
||
public GameMode getGameMode() { | ||
return gameMode; | ||
} | ||
|
||
public Location getLocation() { | ||
return location; | ||
} | ||
|
||
public VanishData(GameMode gameMode, Location location) { | ||
this.gameMode = gameMode; | ||
this.location = location; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/xyz/arr4nn/vulcanspectate/VulcanSpectate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package xyz.arr4nn.vulcanspectate; | ||
|
||
import net.milkbowl.vault.permission.Permission; | ||
import org.bukkit.plugin.RegisteredServiceProvider; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
import xyz.arr4nn.vulcanspectate.commands.CommandManager; | ||
import xyz.arr4nn.vulcanspectate.events.Events; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public final class VulcanSpectate extends JavaPlugin { | ||
|
||
private static VulcanSpectate instance; | ||
|
||
public static VulcanSpectate getInstance() { return instance; } | ||
|
||
{ | ||
instance = this; | ||
} | ||
public static Map<UUID, VanishData> vanishedPlayers = new HashMap<>(); | ||
@Override | ||
public void onEnable() { | ||
getConfig().options().copyDefaults(); | ||
saveDefaultConfig(); | ||
getCommand("vs").setExecutor(new CommandManager()); | ||
getServer().getPluginManager().registerEvents(new Events(),this); | ||
|
||
// Final Thing to do | ||
getLogger().info("has started"); | ||
|
||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
// Plugin shutdown logic | ||
getLogger().info("has stopped"); | ||
|
||
} | ||
} | ||
|
51 changes: 51 additions & 0 deletions
51
src/main/java/xyz/arr4nn/vulcanspectate/commands/CommandManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package xyz.arr4nn.vulcanspectate.commands; | ||
|
||
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 xyz.arr4nn.vulcanspectate.VulcanSpectate; | ||
import xyz.arr4nn.vulcanspectate.commands.subcommands.spectatePlayer; | ||
import xyz.arr4nn.vulcanspectate.commands.subcommands.stopSpectate; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class CommandManager implements CommandExecutor { | ||
|
||
|
||
private ArrayList<SubCommand> subcommands = new ArrayList<>(); | ||
public CommandManager(){ | ||
subcommands.add(new spectatePlayer()); | ||
subcommands.add(new stopSpectate()); | ||
} | ||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if(sender instanceof Player){ | ||
String permissionString = VulcanSpectate.getInstance().getConfig().getString("permission"); | ||
if(sender.hasPermission(permissionString)){ | ||
Player p = (Player) sender; | ||
if(args.length > 0){ | ||
|
||
for (int i = 0; i < getSubcommands().size(); i++){ | ||
if (args[0].equalsIgnoreCase(getSubcommands().get(i).getName())){ | ||
getSubcommands().get(i).perform(p,args); | ||
} | ||
} | ||
}else{ | ||
sender.sendMessage(ChatColor.RED+"Unknown Sub-Command"); | ||
} | ||
}else{ | ||
sender.sendMessage(ChatColor.RED+"You don't have permission to use this command!"); | ||
} | ||
} | ||
|
||
|
||
return true; | ||
} | ||
|
||
public ArrayList<SubCommand> getSubcommands(){ | ||
return subcommands; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/xyz/arr4nn/vulcanspectate/commands/SubCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package xyz.arr4nn.vulcanspectate.commands; | ||
|
||
import org.bukkit.entity.Player; | ||
|
||
public abstract class SubCommand { | ||
public abstract String getName(); | ||
|
||
public abstract String getDescription(); | ||
|
||
public abstract String getSyntax(); | ||
|
||
public abstract void perform(Player player, String args[]); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/xyz/arr4nn/vulcanspectate/commands/subcommands/spectatePlayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package xyz.arr4nn.vulcanspectate.commands.subcommands; | ||
|
||
import net.md_5.bungee.api.ChatMessageType; | ||
import net.md_5.bungee.api.chat.TextComponent; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.GameMode; | ||
import org.bukkit.entity.Player; | ||
import xyz.arr4nn.vulcanspectate.VanishData; | ||
import xyz.arr4nn.vulcanspectate.commands.SubCommand; | ||
|
||
import static xyz.arr4nn.vulcanspectate.VulcanSpectate.vanishedPlayers; | ||
|
||
public class spectatePlayer extends SubCommand { | ||
@Override | ||
public String getName() { | ||
return "spectate"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Spectate a cheating player"; | ||
} | ||
|
||
@Override | ||
public String getSyntax() { | ||
return "/vs spectate <player name>"; | ||
} | ||
|
||
@Override | ||
public void perform(Player player, String[] args) { | ||
if(args.length > 1) { | ||
vanishedPlayers.put(player.getUniqueId(), new VanishData(player.getGameMode(), player.getLocation())); | ||
Player target = Bukkit.getPlayer(args[1]); | ||
player.setGameMode(GameMode.SPECTATOR); | ||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Spectating "+target.getDisplayName())); | ||
player.teleport(target.getLocation()); | ||
}else if(args.length == 1) { | ||
player.sendMessage(ChatColor.RED + "Please provide a user to spectate! (/vs spectate <player>)"); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.