-
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 4eb9b09
Showing
10 changed files
with
657 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,20 @@ | ||
# CurseOfVanishing | ||
A Minecraft plugin that allows to be invisible | ||
|
||
⚠ This plugin requires [PaperMC](https://papermc.io/) | ||
|
||
ℹ When a player vanishes it becomes invisible, uncollidable and invulnerable, it can fly even if it isn't in creative or spectator gamemode, it can open chests, shulker boxes and barrels as if it is in spectator gamemode and its messages of join, quit, death and advancement done are visibile in green only by players with the permission `cov.vanish.read`. | ||
|
||
## Commands | ||
/vanish: To vanish yourself | ||
|
||
/vanish <player>: To vanish an other player | ||
|
||
/vanish list: To show the list of vanished players | ||
|
||
## Permissions | ||
`cov.vanish.use`: To use the /vanish command | ||
|
||
`cov.vanish.see`: To see the vanished players | ||
|
||
`cov.vanish.read`: To read the vanish notifications (e.g. Player1234 vanished) |
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,71 @@ | ||
<?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>me.xenkys</groupId> | ||
<artifactId>CurseOfVanishing</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>CurseOfVanishing</name> | ||
|
||
<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>16</source> | ||
<target>16</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> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>papermc-repo</id> | ||
<url>https://repo.papermc.io/repository/maven-public/</url> | ||
</repository> | ||
<repository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/content/groups/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.papermc.paper</groupId> | ||
<artifactId>paper-api</artifactId> | ||
<version>1.21-R0.1-SNAPSHOT</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,26 @@ | ||
package me.xenkys.curseofvanishing; | ||
|
||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.format.TextColor; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
|
||
public class Broadcast { | ||
public static void announceSilentMessage(Component message) { | ||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { | ||
if (onlinePlayer.hasPermission("cov.vanish.read")) { | ||
onlinePlayer.sendMessage(message.color(TextColor.color(85, 255, 85))); | ||
} | ||
} | ||
} | ||
|
||
public static void announcePlayerVanish(Player player) { | ||
VanishPlayer vanishPlayer = VanishManager.get(player); | ||
|
||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { | ||
if (onlinePlayer.hasPermission("cov.vanish.read")) { | ||
onlinePlayer.sendMessage("§a" + player.getName() + (vanishPlayer.isVanished() ? " vanished" : " appeared")); | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/me/xenkys/curseofvanishing/CurseOfVanishing.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,19 @@ | ||
package me.xenkys.curseofvanishing; | ||
|
||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public final class CurseOfVanishing extends JavaPlugin { | ||
@Override | ||
public void onEnable() { | ||
getCommand("vanish").setExecutor(new VanishCommand()); | ||
|
||
getServer().getPluginManager().registerEvents(new VanishEvents(), this); | ||
|
||
getLogger().info("Enabled"); | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
getLogger().info("Disabled"); | ||
} | ||
} |
112 changes: 112 additions & 0 deletions
112
src/main/java/me/xenkys/curseofvanishing/VanishCommand.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,112 @@ | ||
package me.xenkys.curseofvanishing; | ||
|
||
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 org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.ArrayList; | ||
import java.util.UUID; | ||
|
||
public class VanishCommand implements CommandExecutor { | ||
@Override | ||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { | ||
if (sender instanceof Player player) { | ||
if (args.length == 0) { | ||
VanishPlayer vanishPlayer = VanishManager.get(player); | ||
|
||
vanishPlayer.setVanish(!vanishPlayer.isVanished()); | ||
|
||
Broadcast.announcePlayerVanish(player); | ||
} else if (args[0].equals("list")) { | ||
ArrayList<UUID> vanishedPlayersUniqueIds = VanishManager.getVanishedPlayersUniqueIds(); | ||
|
||
if (vanishedPlayersUniqueIds.isEmpty()) { | ||
player.sendMessage("§cThere are no vanished players!"); | ||
|
||
return true; | ||
} | ||
|
||
StringBuilder message = new StringBuilder(); | ||
|
||
for (int i = 0; i < vanishedPlayersUniqueIds.size(); i++) { | ||
if (i > 0) { | ||
message.append(", "); | ||
} | ||
|
||
message.append(Bukkit.getOfflinePlayer(vanishedPlayersUniqueIds.get(i)).getName()); | ||
} | ||
|
||
player.sendMessage("§aCurrently vanished players: " + message); | ||
} else { | ||
VanishPlayer target = VanishManager.get(Bukkit.getPlayer(args[0])); | ||
|
||
if (target.getPlayer() == null) { | ||
player.sendMessage("§cThe player " + args[0] + " doesn't exists!"); | ||
|
||
return true; | ||
} | ||
|
||
if (!target.getPlayer().isOnline()) { | ||
player.sendMessage("§c" + target.getPlayer().getName() + " isn't online!"); | ||
|
||
return true; | ||
} | ||
|
||
target.setVanish(!target.isVanished()); | ||
|
||
Broadcast.announcePlayerVanish(target.getPlayer()); | ||
} | ||
} else if (sender instanceof ConsoleCommandSender) { | ||
if (args.length == 0) { | ||
sender.sendMessage("§cYou don't entered the nickname of a player!"); | ||
|
||
return true; | ||
} else if (args[0].equals("list")) { | ||
ArrayList<UUID> vanishedPlayersUniqueIds = VanishManager.getVanishedPlayersUniqueIds(); | ||
|
||
if (vanishedPlayersUniqueIds.isEmpty()) { | ||
sender.sendMessage("§cThere are no vanished players!"); | ||
|
||
return true; | ||
} | ||
|
||
StringBuilder message = new StringBuilder(); | ||
|
||
for (int i = 0; i < vanishedPlayersUniqueIds.size(); i++) { | ||
if (i > 0) { | ||
message.append(", "); | ||
} | ||
|
||
message.append(Bukkit.getOfflinePlayer(vanishedPlayersUniqueIds.get(i)).getName()); | ||
} | ||
|
||
|
||
sender.sendMessage("§aCurrently vanished players: " + message); | ||
} else { | ||
VanishPlayer target = VanishManager.get(Bukkit.getPlayer(args[0])); | ||
|
||
if (target.getPlayer() == null) { | ||
sender.sendMessage("§cThe player " + args[0] + " doesn't exists!"); | ||
|
||
return true; | ||
} | ||
|
||
if (!target.getPlayer().isOnline()) { | ||
sender.sendMessage("§c" + target.getPlayer().getName() + " isn't online!"); | ||
|
||
return true; | ||
} | ||
|
||
target.setVanish(!target.isVanished()); | ||
|
||
Broadcast.announcePlayerVanish(target.getPlayer()); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.