mirror of
https://github.com/SangeloDev/Unique.git
synced 2024-11-21 15:52:40 +00:00
Initial commit
This commit is contained in:
commit
994bbb585f
29 changed files with 1587 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
113
.gitignore
vendored
Normal file
113
.gitignore
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
# User-specific
|
||||
.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/
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Sangelo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
79
config-backup.yml
Normal file
79
config-backup.yml
Normal file
|
@ -0,0 +1,79 @@
|
|||
# __ __ _
|
||||
# / / / /___ (_)___ ___ _____
|
||||
# / / / / __ \/ / __ `/ / / / _ \
|
||||
#/ /_/ / / / / / /_/ / /_/ / __/
|
||||
#\____/_/ /_/_/\__, /\__,_/\___/
|
||||
# /_/
|
||||
|
||||
# !! INFO
|
||||
# Placeholders:
|
||||
# %p is the player's name.
|
||||
# %t is the target's name.
|
||||
# %c is the placeholder for the command itself.
|
||||
# %u is the command's usage.
|
||||
# !! Do not replace the placeholders, or change them up, as it will break things !!
|
||||
# For example:
|
||||
# - Do not do this: Replace %c in no-args-msg with %p.
|
||||
# - Do this: Move it around inside of the message, so it makes sense when you translate messages.
|
||||
|
||||
# Sets the prefix for chat messages.
|
||||
prefix: '&8[&2Unique&8]&r '
|
||||
|
||||
# This message will be sent when a player couldn't be found.
|
||||
player-not-online-msg: "&cThis player is not online or doesn't exist."
|
||||
# This is the message that will be sent to the console when it has to be ran in game.
|
||||
console-not-allowed-msg: "&cYou need to be on the server to use this command."
|
||||
# This is the message that is sent to the player, when they don't have the required permissions
|
||||
no-perms-msg: "&cYou don't have the required permissions to execute this command."
|
||||
# This is the error that will be sent when no arguments were given.
|
||||
no-args-msg: "&cNo arguments were given. Usage: &6/%c %u&c."
|
||||
# These are the join and leave messages.
|
||||
join-msg: "&8[&2+&8]&a %p"
|
||||
quit-msg: "&8[&4-&8]&c %p"
|
||||
|
||||
# These are the toggle messages for god mode.
|
||||
god-enabled-msg: '&2God mode is now &aenabled&2.'
|
||||
god-disabled-msg: '&2God mode is now &cdisabled&2.'
|
||||
# These are the toggle messages for god mode, on the sender's side.
|
||||
god-enabled-others-msg: '&2You have &aenabled&2 god mode for &6%t&2.'
|
||||
god-disabled-others-msg: '&2You have &cdisabled&2 god mode for &6%t&2.'
|
||||
# These are the toggle messages for god mode, on the target's side.
|
||||
god-enabled-target-msg: '&2God mode has now been &aenabled&2 for you by &6%p&2.'
|
||||
god-disabled-target-msg: '&2God mode has now been &cdisabled&2 for you by &6%p&2.'
|
||||
|
||||
# These are the toggle messages for flight.
|
||||
flight-enabled-msg: '&2Flight is now &aenabled&2.'
|
||||
flight-disabled-msg: '&2Flight is now &cdisabled&2.'
|
||||
# These are the toggle messages for flight, on the sender's side.
|
||||
flight-enabled-others-msg: '&2You have &aenabled&2 flight for &6%t&2.'
|
||||
flight-disabled-others-msg: '&2You have &cdisabled&2 flight for &6%t&2.'
|
||||
# These are the toggle messages for flight, on the target's side.
|
||||
flight-enabled-target-msg: '&2Flight has now been &aenabled&2 for you by &6%p&2.'
|
||||
flight-disabled-target-msg: '&2Flight has now been &cdisabled&2 for you by &6%p&2.'
|
||||
|
||||
# These are the toggle messages for vanish.
|
||||
vanish-enabled-msg: '&2You are now &ainvisible&2.'
|
||||
vanish-disabled-msg: '&2You are now &cvisible&2.'
|
||||
|
||||
# These are the feed messages.
|
||||
feed-msg: "&2You have now been fed."
|
||||
feed-others-msg: '&2You have now fed &6%t&2.'
|
||||
feed-target-msg: '&2You have been fed by &6%p&2.'
|
||||
|
||||
# These are the heal messages.
|
||||
heal-msg: "&2You have now been healed."
|
||||
heal-others-msg: '&2You have now healed &6%t&2.'
|
||||
heal-target-msg: '&2You have been healed by &6%p&2.'
|
||||
|
||||
# This is the message that is sent to the mod, when they set a new spawn point.
|
||||
setspawn-msg: "&2Spawn location has now been set &asuccessfully."
|
||||
# This is the confirmation message that is sent to the player, when they teleport to the spawn point.
|
||||
spawn-tp-msg: "&2You have been teleported to spawn."
|
||||
# This is the message that is sent to the player, when they tried to teleport to the spawn point, but have to wait for the cooldown.
|
||||
spawn-cooldown-msg: "&cYou cannot teleport for another &6%s&c seconds."
|
||||
# This is the message that is sent to the player, when they tried to teleport to the spawn point, but there is none set.
|
||||
spawn-no-location-msg: "&cThere is no spawn location set. Couldn't initiate teleport."
|
||||
# This is the message that is sent to the moderator, when they tried to teleport to the spawn point, but there is none set.
|
||||
spawn-mod-no-location-msg: "&cThere is no spawn location set. Couldn't initiate teleport. Use &6/setspawn &cto set one."
|
||||
# This is the command cooldown in seconds. You can type 0 to disable it, or any other number to enable it. Default is 3.
|
||||
spawn-command-cooldown: 3
|
63
pom.xml
Normal file
63
pom.xml
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?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>space.sangelo</groupId>
|
||||
<artifactId>unique</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Unique</name>
|
||||
|
||||
<description>Escape the ordinary – Be Unique!</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<url>https://sangelo.space</url>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</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>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
82
src/main/java/space/sangelo/unique/Unique.java
Normal file
82
src/main/java/space/sangelo/unique/Unique.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
package space.sangelo.unique;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import space.sangelo.unique.commands.*;
|
||||
import space.sangelo.unique.listeners.PlayerConnectionListener;
|
||||
import space.sangelo.unique.listeners.SpawnListener;
|
||||
import space.sangelo.unique.listeners.VanishLoginListener;
|
||||
import space.sangelo.unique.listeners.VanishPlayerListener;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
import space.sangelo.unique.util.VanishManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public final class Unique extends JavaPlugin {
|
||||
private MessageUtil messageUtil;
|
||||
private VanishManager vanishManager;
|
||||
//public Config config = new Config("config.yml", this.getDataFolder().getAbsolutePath(), this.getResource("config.yml"));
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
messageUtil = new MessageUtil(this, new File(getDataFolder(), "messages.yml"));
|
||||
vanishManager = new VanishManager(this);
|
||||
loadListeners();
|
||||
loadConfig();
|
||||
loadCommands();
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Unique] " + ChatColor.GREEN + "Plugin has started.");
|
||||
}
|
||||
|
||||
// Load Commands
|
||||
public void loadCommands() {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Unique] " + ChatColor.YELLOW + "Loading commands...");
|
||||
getCommand("unique").setExecutor(new UniqueCommand(this));
|
||||
getCommand("print").setExecutor(new PrintCommand(this));
|
||||
getCommand("god").setExecutor(new GodCommand(this));
|
||||
getCommand("fly").setExecutor(new FlyCommand(this));
|
||||
getCommand("vanish").setExecutor(new VanishCommand(this));
|
||||
getCommand("heal").setExecutor(new HealCommand(this));
|
||||
getCommand("feed").setExecutor(new FeedCommand(this));
|
||||
getCommand("setspawn").setExecutor(new SetSpawnCommand(this));
|
||||
getCommand("spawn").setExecutor(new SpawnCommand(this));
|
||||
getCommand("forcereload").setExecutor(new ForceReloadCommand(this));
|
||||
getCommand("gmc").setExecutor(new GamemodeCCommand(this));
|
||||
getCommand("gms").setExecutor(new GamemodeSCommand(this));
|
||||
getCommand("gmsp").setExecutor(new GamemodeSpCommand(this));
|
||||
getCommand("gma").setExecutor(new GamemodeACommand(this));
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Unique] " + ChatColor.GOLD + "Commands loaded.");
|
||||
}
|
||||
|
||||
// Load Config
|
||||
public void loadConfig() {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Unique] " + ChatColor.YELLOW + "Loading config...");
|
||||
saveResource("config.yml", false);
|
||||
reloadConfig();
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Unique] " + ChatColor.GOLD + "Loading config complete");
|
||||
}
|
||||
|
||||
// Load Listeners
|
||||
public void loadListeners() {
|
||||
final PluginManager pluginManager = getServer().getPluginManager();
|
||||
pluginManager.registerEvents(new PlayerConnectionListener(this), this);
|
||||
pluginManager.registerEvents(new SpawnListener(this), this);
|
||||
pluginManager.registerEvents(new VanishLoginListener(this), this);
|
||||
pluginManager.registerEvents(new VanishPlayerListener(this), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Unique] " + ChatColor.GOLD + "Shutting down...");
|
||||
}
|
||||
|
||||
public MessageUtil getMessageUtil() {
|
||||
return messageUtil;
|
||||
}
|
||||
|
||||
public VanishManager getVanishManager() {
|
||||
return vanishManager;
|
||||
}
|
||||
|
||||
}
|
49
src/main/java/space/sangelo/unique/commands/FeedCommand.java
Normal file
49
src/main/java/space/sangelo/unique/commands/FeedCommand.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class FeedCommand implements CommandExecutor {
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public FeedCommand(final Unique plugin) {
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length == 0) {
|
||||
if (player.hasPermission("unique.moderation.feed")) {
|
||||
player.setFoodLevel(20);
|
||||
player.setSaturation(20);
|
||||
messageUtil.sendMessageWithPrefix(player, "feed-msg");
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else {
|
||||
final String playerName = args[0];
|
||||
final Player target = Bukkit.getServer().getPlayerExact(playerName);
|
||||
if (target == null) {
|
||||
messageUtil.sendMessageWithPrefix(player, "player-not-online-msg");
|
||||
} else {
|
||||
if (player.hasPermission("unique.moderation.feed.others")) {
|
||||
target.setFoodLevel(20);
|
||||
target.setSaturation(20);
|
||||
messageUtil.sendMessageWithPrefix(target, "feed-target-msg", Placeholder.component("player", player.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(player, "feed-others-msg", Placeholder.component("target", target.displayName()));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
59
src/main/java/space/sangelo/unique/commands/FlyCommand.java
Normal file
59
src/main/java/space/sangelo/unique/commands/FlyCommand.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class FlyCommand implements CommandExecutor {
|
||||
private final MessageUtil messageUtil;
|
||||
private final Unique plugin;
|
||||
|
||||
public FlyCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player)
|
||||
if (args.length == 0) {
|
||||
if (player.hasPermission("unique.moderation.fly")) {
|
||||
if (player.getAllowFlight()) {
|
||||
player.setAllowFlight(false);
|
||||
messageUtil.sendMessageWithPrefix(player, "flight-disabled-msg");
|
||||
} else {
|
||||
player.setAllowFlight(true);
|
||||
messageUtil.sendMessageWithPrefix(player, "flight-enabled-msg");
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else {
|
||||
final String playerName = args[0];
|
||||
final Player target = Bukkit.getServer().getPlayerExact(playerName);
|
||||
if (player.hasPermission("unique.moderation.fly.set")) {
|
||||
if (target == null) {
|
||||
messageUtil.sendMessageWithPrefix(player, "player-not-online-msg");
|
||||
} else {
|
||||
if (target.getAllowFlight()) {
|
||||
target.setAllowFlight(false);
|
||||
messageUtil.sendMessageWithPrefix(player, "flight-disabled-target-msg", Placeholder.component("player", player.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(player, "flight-disabled-others-msg", Placeholder.component("target", target.displayName()));
|
||||
} else {
|
||||
target.setAllowFlight(true);
|
||||
messageUtil.sendMessageWithPrefix(player, "flight-enabled-target-msg", Placeholder.component("player", player.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(player, "flight-enabled-others-msg", Placeholder.component("target", target.displayName()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
|
||||
public class ForceReloadCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public ForceReloadCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender.hasPermission("unique.admin.forcereload")) {
|
||||
messageUtil.sendMessageWithPrefix(sender, "force-reload-msg");
|
||||
plugin.reloadConfig();
|
||||
messageUtil.sendMessageWithPrefix(sender, "force-reload-complete-msg");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class GamemodeACommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public GamemodeACommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||
if (sender instanceof Player player && args.length == 0) {
|
||||
adventurePlayerSelf(player);
|
||||
} else if (sender instanceof Player player) {
|
||||
final Player target = Bukkit.getPlayerExact(args[0]);
|
||||
if (player.hasPermission("unique.moderation.adventure.others")) {
|
||||
if (player == target) {
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "adventure"));
|
||||
} else {
|
||||
target.setGameMode(GameMode.ADVENTURE);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-others-msg", Placeholder.unparsed("gamemode", "adventure"), Placeholder.component("target", target.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(target, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "adventure"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sender instanceof ConsoleCommandSender && args.length == 0) {
|
||||
messageUtil.sendMessageWithPrefix(sender, "console-specify-player");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void adventurePlayerSelf(final Player player) {
|
||||
if (player.getGameMode() == GameMode.ADVENTURE) {
|
||||
if (player.hasPermission("unique.moderation.gamemode.adventure.self")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-already-set-msg", Placeholder.unparsed("gamemode", "adventure"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else if (player.hasPermission("unique.moderation.gamemode.adventure.self")) {
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "adventure"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class GamemodeCCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public GamemodeCCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||
if (sender instanceof Player player && args.length == 0) {
|
||||
creativePlayerSelf(player);
|
||||
} else if (sender instanceof Player player) {
|
||||
final Player target = Bukkit.getPlayerExact(args[0]);
|
||||
if (player.hasPermission("unique.moderation.gamemode.creative.others")) {
|
||||
if (player == target) {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "creative"));
|
||||
} else {
|
||||
target.setGameMode(GameMode.CREATIVE);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-others-msg", Placeholder.unparsed("gamemode", "creative"), Placeholder.component("target", target.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(target, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "creative"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sender instanceof ConsoleCommandSender && args.length == 0) {
|
||||
messageUtil.sendMessageWithPrefix(sender, "console-specify-player");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void creativePlayerSelf(final Player player) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
if (player.hasPermission("unique.moderation.gamemode.creative.self")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-already-set-msg", Placeholder.unparsed("gamemode", "creative"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else if (player.hasPermission("unique.moderation.gamemode.creative.self")) {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "creative"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class GamemodeSCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public GamemodeSCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||
if (sender instanceof Player player && args.length == 0) {
|
||||
survivalPlayerSelf(player);
|
||||
} else if (sender instanceof Player player) {
|
||||
final Player target = Bukkit.getPlayerExact(args[0]);
|
||||
if (player.hasPermission("unique.moderation.gamemode.survival.others")) {
|
||||
if (player == target) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "survival"));
|
||||
} else {
|
||||
target.setGameMode(GameMode.SURVIVAL);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-others-msg", Placeholder.unparsed("gamemode", "survival"), Placeholder.component("target", target.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(target, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "survival"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sender instanceof ConsoleCommandSender && args.length == 0) {
|
||||
messageUtil.sendMessageWithPrefix(sender, "console-specify-player");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void survivalPlayerSelf(final Player player) {
|
||||
if (player.getGameMode() == GameMode.SURVIVAL) {
|
||||
if (player.hasPermission("unique.moderation.gamemode.survival.self")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-already-set-msg", Placeholder.unparsed("gamemode", "survival"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else if (player.hasPermission("unique.moderation.gamemode.survival.self")) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "survival"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class GamemodeSpCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public GamemodeSpCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||
if (sender instanceof Player player && args.length == 0) {
|
||||
spectatorPlayerSelf(player);
|
||||
} else if (sender instanceof Player player) {
|
||||
final Player target = Bukkit.getPlayerExact(args[0]);
|
||||
if (player.hasPermission("unique.moderation.gamemode.spectator.others")) {
|
||||
if (player == target) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "spectator"));
|
||||
} else {
|
||||
target.setGameMode(GameMode.SPECTATOR);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-others-msg", Placeholder.unparsed("gamemode", "spectator"), Placeholder.component("target", target.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(target, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "spectator"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sender instanceof ConsoleCommandSender && args.length == 0) {
|
||||
messageUtil.sendMessageWithPrefix(sender, "console-specify-player");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void spectatorPlayerSelf(final Player player) {
|
||||
if (player.getGameMode() == GameMode.SPECTATOR) {
|
||||
if (player.hasPermission("unique.moderation.gamemode.spectator.self")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-already-set-msg", Placeholder.unparsed("gamemode", "spectator"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else if (player.hasPermission("unique.moderation.gamemode.spectator.self")) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
messageUtil.sendMessageWithPrefix(player, "gamemode-switcher-msg", Placeholder.unparsed("gamemode", "spectator"));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
60
src/main/java/space/sangelo/unique/commands/GodCommand.java
Normal file
60
src/main/java/space/sangelo/unique/commands/GodCommand.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class GodCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public GodCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length == 0) {
|
||||
if (player.hasPermission("unique.moderation.god.use")) {
|
||||
if (player.isInvulnerable()) {
|
||||
player.setInvulnerable(false);
|
||||
messageUtil.sendMessageWithPrefix(player, "god-disabled-msg");
|
||||
} else {
|
||||
player.setInvulnerable(true);
|
||||
messageUtil.sendMessageWithPrefix(player, "god-enabled-msg");
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else {
|
||||
final String playerName = args[0];
|
||||
final Player target = Bukkit.getServer().getPlayerExact(playerName);
|
||||
if (player.hasPermission("unique.moderation.god.set")) {
|
||||
if (target == null) {
|
||||
messageUtil.sendMessageWithPrefix(player, "player-not-online");
|
||||
} else {
|
||||
if (target.isInvulnerable()) {
|
||||
target.setInvulnerable(false);
|
||||
messageUtil.sendMessageWithPrefix(target, "god-disabled-target-msg", Placeholder.component("player", player.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(player, "god-disabled-others-msg", Placeholder.component("target", target.displayName()));
|
||||
} else {
|
||||
target.setInvulnerable(true);
|
||||
messageUtil.sendMessageWithPrefix(target, "god-enabled-target-msg", Placeholder.component("player", player.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(player, "god-enabled-others-msg", Placeholder.component("target", target.displayName()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
51
src/main/java/space/sangelo/unique/commands/HealCommand.java
Normal file
51
src/main/java/space/sangelo/unique/commands/HealCommand.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
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 space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
import static org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH;
|
||||
|
||||
public class HealCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public HealCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length == 0) {
|
||||
if (player.hasPermission("unique.moderation.heal")) {
|
||||
player.setHealth(player.getAttribute(GENERIC_MAX_HEALTH).getDefaultValue());
|
||||
messageUtil.sendMessageWithPrefix(player, "heal-msg");
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else {
|
||||
final String playerName = args[0];
|
||||
final Player target = Bukkit.getServer().getPlayerExact(playerName);
|
||||
if (target == null) {
|
||||
messageUtil.sendMessageWithPrefix(player, "player-not-online-msg");
|
||||
} else {
|
||||
if (player.hasPermission("unique.moderation.heal.others")) {
|
||||
target.setHealth(target.getAttribute(GENERIC_MAX_HEALTH).getDefaultValue());
|
||||
messageUtil.sendMessageWithPrefix(target, "heal-target-msg", Placeholder.component("player", player.displayName()));
|
||||
messageUtil.sendMessageWithPrefix(player, "heal-others-msg", Placeholder.component("target", target.displayName()));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class PrintCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public PrintCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length == 0) {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-args-msg", Placeholder.unparsed("command", "print {message}"));
|
||||
} else if (args.length == 1) {
|
||||
final String printMessage = args[0];
|
||||
messageUtil.sendMessageWithPrefix(player, "print-msg", Placeholder.parsed("message", printMessage));
|
||||
} else {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
builder.append(args[i]);
|
||||
builder.append(" ");
|
||||
}
|
||||
String printFinalMessage = builder.toString();
|
||||
printFinalMessage = printFinalMessage.stripTrailing();
|
||||
messageUtil.sendMessageWithPrefix(player, "print-msg", Placeholder.parsed("message", printFinalMessage));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class SetSpawnCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public SetSpawnCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
if (player.hasPermission("unique.moderation.setspawn")) {
|
||||
plugin.getConfig().set("spawn", player.getLocation());
|
||||
plugin.saveConfig();
|
||||
messageUtil.sendMessageWithPrefix(player, "setspawn-msg");
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(sender, "console-not-allowed-msg");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
// Warning! Very duplicate code bc i don't have a clue.
|
||||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SpawnCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
private final HashMap<UUID, Long> cooldown;
|
||||
|
||||
public SpawnCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
this.cooldown = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
|
||||
final Location location = plugin.getConfig().getLocation("spawn");
|
||||
|
||||
if (sender instanceof Player player) {
|
||||
if (!player.hasPermission("unique.moderation.bypass.cooldown")) {
|
||||
if (!this.cooldown.containsKey(player.getUniqueId())) {
|
||||
this.cooldown.put(player.getUniqueId(), System.currentTimeMillis());
|
||||
if (location != null) {
|
||||
player.teleport(location);
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-tp-msg");
|
||||
} else {
|
||||
if (!player.hasPermission("unique.moderation.setspawn")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-no-location-msg");
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-mod-no-location-msg");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final long timeElapsedMs = System.currentTimeMillis() - cooldown.get(player.getUniqueId());
|
||||
final long timeElapsed = (timeElapsedMs / 1000) % 60;
|
||||
if (timeElapsed >= plugin.getConfig().getLong("spawn-command-cooldown")) {
|
||||
this.cooldown.put(player.getUniqueId(), System.currentTimeMillis());
|
||||
if (player.hasPermission("unique.moderation.setspawn")) {
|
||||
if (location != null) {
|
||||
player.teleport(location);
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-tp-msg");
|
||||
} else {
|
||||
if (player.hasPermission("unique.moderation.setspawn")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-mod-no-location-msg");
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-no-location-msg");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-mod-no-location-msg", Placeholder.unparsed("remaining", String.valueOf(plugin.getConfig().getLong("spawn-command-cooldown") - timeElapsed)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (player.hasPermission("unique.general.spawn")) {
|
||||
if (location != null) {
|
||||
player.teleport(location);
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-tp-msg");
|
||||
} else {
|
||||
if (player.hasPermission("unique.moderation.setspawn")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-mod-no-location-msg");
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "spawn-no-location-msg");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
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 space.sangelo.unique.Unique;
|
||||
|
||||
public class UniqueCommand implements CommandExecutor {
|
||||
private final Unique plugin;
|
||||
|
||||
public UniqueCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
// p.sendMessage(ChatColor.DARK_GREEN + "-=-=-=-=-=-=-");
|
||||
player.sendMessage(ChatColor.DARK_GREEN + "Unique - " + ChatColor.GOLD + "v" + plugin.getDescription().getVersion());
|
||||
// p.sendMessage(ChatColor.DARK_GREEN + "-=-=-=-=-=-=-");
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "Author: " + ChatColor.AQUA + "Sangelo");
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "Website: " + ChatColor.BLUE + "" + ChatColor.UNDERLINE + "https://sangelo.space");
|
||||
player.sendMessage(ChatColor.DARK_GREEN + "For help, type " + ChatColor.GOLD + "/help unique");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package space.sangelo.unique.commands;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
import space.sangelo.unique.util.VanishManager;
|
||||
|
||||
public class VanishCommand implements CommandExecutor {
|
||||
|
||||
private final Unique plugin;
|
||||
private final VanishManager vanishManager;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public VanishCommand(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.vanishManager = plugin.getVanishManager();
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String commandLabel, final String[] args) {
|
||||
if (!(sender instanceof final Player player)) return false;
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
if (!player.hasPermission("unique.moderation.vanish.list")) {
|
||||
messageUtil.sendMessageWithPrefix(player, "no-perms-msg");
|
||||
return true;
|
||||
}
|
||||
if (vanishManager.getHiddenUsernames().size() > 0) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < vanishManager.getHiddenUsernames().size(); i++) {
|
||||
builder.append(vanishManager.getHiddenUsernames().get(i));
|
||||
if (i < vanishManager.getHiddenUsernames().size() - 1) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-hidden-list-msg", Placeholder.unparsed("playerlist", String.valueOf(builder)));
|
||||
} else {
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-hidden-none");
|
||||
}
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
|
||||
return false;
|
||||
} else if (player.hasPermission("unique.moderation.vanish.other")) {
|
||||
Player target = plugin.getServer().getPlayer(args[0]);
|
||||
if (target == null) target = plugin.getServer().getPlayerExact(args[0]);
|
||||
if (target == null) {
|
||||
messageUtil.sendMessageWithPrefix(player, "player-not-online-msg");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!vanishManager.isVanished(target)) {
|
||||
vanishManager.vanishPlayer(target);
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-enabled-msg");
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-enabled-others-msg", Placeholder.component("player", player.displayName()));
|
||||
plugin.getServer().broadcast(messageUtil.getMessage("quit-msg", Placeholder.component("player", player.displayName())));
|
||||
return true;
|
||||
} else {
|
||||
vanishManager.showPlayer(target);
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-disabled-msg");
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-disabled-others-msg", Placeholder.component("player", player.displayName()));
|
||||
plugin.getServer().broadcast(messageUtil.getMessage("join-msg", Placeholder.component("player", player.displayName())));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (player.hasPermission("unique.moderation.vanish.use")) {
|
||||
if (!vanishManager.isVanished(player)) {
|
||||
vanishManager.vanishPlayer(player);
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-enabled-msg");
|
||||
plugin.getServer().broadcast(messageUtil.getMessage("quit-msg", Placeholder.component("player", player.displayName())));
|
||||
return true;
|
||||
} else {
|
||||
vanishManager.showPlayer(player);
|
||||
messageUtil.sendMessageWithPrefix(player, "vanish-disabled-msg");
|
||||
plugin.getServer().broadcast(messageUtil.getMessage("join-msg", Placeholder.component("player", player.displayName())));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package space.sangelo.unique.listeners;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.MessageUtil;
|
||||
|
||||
public class PlayerConnectionListener implements Listener {
|
||||
private final Unique plugin;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
public PlayerConnectionListener(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.messageUtil = plugin.getMessageUtil();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(final PlayerJoinEvent event) {
|
||||
event.joinMessage(messageUtil.getMessage("join-msg", Placeholder.component("player", event.getPlayer().displayName())));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(final PlayerQuitEvent event) {
|
||||
event.quitMessage(messageUtil.getMessage("quit-msg", Placeholder.component("player", event.getPlayer().displayName())));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package space.sangelo.unique.listeners;
|
||||
|
||||
import org.bukkit.Location;
|
||||
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.PlayerRespawnEvent;
|
||||
import space.sangelo.unique.Unique;
|
||||
|
||||
public class SpawnListener implements Listener {
|
||||
private final Unique plugin;
|
||||
|
||||
public SpawnListener(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(final PlayerJoinEvent e) {
|
||||
// Spawn the player on the spawn location on first join, if one's set.
|
||||
final Player p = e.getPlayer();
|
||||
if (!e.getPlayer().hasPlayedBefore()) {
|
||||
final Location location = plugin.getConfig().getLocation("spawn");
|
||||
if (location != null) {
|
||||
p.teleport(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerRespawn(final PlayerRespawnEvent e) {
|
||||
// Respawn the player at the spawn location, if one's set.
|
||||
final Location location = plugin.getConfig().getLocation("spawn");
|
||||
if (location != null) {
|
||||
if (e.getPlayer().getBedSpawnLocation() == null) {
|
||||
e.setRespawnLocation(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package space.sangelo.unique.listeners;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.VanishManager;
|
||||
|
||||
public class VanishLoginListener implements Listener {
|
||||
private final Unique plugin;
|
||||
private final VanishManager vanishManager;
|
||||
|
||||
public VanishLoginListener(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.vanishManager = plugin.getVanishManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleLogin(final PlayerLoginEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (vanishManager.isVanished(player)) {
|
||||
vanishManager.showPlayer(player);
|
||||
}
|
||||
if (player.hasPermission("unique.moderation.vanish.see")) return;
|
||||
for (final Player p1 : plugin.getServer().getOnlinePlayers()) {
|
||||
if (vanishManager.isVanished(p1) && !player.equals(p1)) {
|
||||
player.hidePlayer(plugin, p1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleQuit(final PlayerQuitEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (vanishManager.isVanished(player)) {
|
||||
vanishManager.showPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package space.sangelo.unique.listeners;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import space.sangelo.unique.Unique;
|
||||
import space.sangelo.unique.util.VanishManager;
|
||||
|
||||
public class VanishPlayerListener implements Listener {
|
||||
|
||||
private final VanishManager vanishManager;
|
||||
|
||||
public VanishPlayerListener(final Unique plugin) {
|
||||
this.vanishManager = plugin.getVanishManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityTarget(final EntityTargetEvent event) {
|
||||
if (event.getEntity() instanceof Player player && vanishManager.isVanished(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onDamageByBlock(final EntityDamageByBlockEvent event) {
|
||||
if (event.getEntity() instanceof Player player && vanishManager.isVanished(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamageByEntity(final EntityDamageByEntityEvent event) {
|
||||
if (event.getDamager() instanceof Player player && vanishManager.isVanished(player)) {
|
||||
event.setCancelled(true);
|
||||
} else if (event.getEntity() instanceof Player player && vanishManager.isVanished(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemPickup(final EntityPickupItemEvent event) {
|
||||
if (event.getEntity() instanceof Player player && vanishManager.isVanished(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
60
src/main/java/space/sangelo/unique/util/MessageUtil.java
Normal file
60
src/main/java/space/sangelo/unique/util/MessageUtil.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package space.sangelo.unique.util;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import space.sangelo.unique.Unique;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class MessageUtil {
|
||||
|
||||
private final FileConfiguration externalConfig;
|
||||
private final FileConfiguration internalConfig;
|
||||
private final Component prefix;
|
||||
|
||||
public MessageUtil(final Unique plugin, final File messageConfig) {
|
||||
if (!messageConfig.exists()) {
|
||||
plugin.saveResource(messageConfig.getName(), false);
|
||||
}
|
||||
externalConfig = YamlConfiguration.loadConfiguration(messageConfig);
|
||||
|
||||
final InputStream inputStream = plugin.getResource(messageConfig.getName());
|
||||
|
||||
assert inputStream != null;
|
||||
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
|
||||
internalConfig = YamlConfiguration.loadConfiguration(inputStreamReader);
|
||||
|
||||
prefix = MiniMessage.miniMessage().deserialize(getString("prefix"));
|
||||
}
|
||||
|
||||
public void sendMessage(final CommandSender sender, final String configString, final TagResolver... tagResolvers) {
|
||||
sender.sendMessage(getMessage(configString, tagResolvers));
|
||||
}
|
||||
|
||||
public void sendMessageWithPrefix(final CommandSender sender, final String configString, final TagResolver... tagResolvers) {
|
||||
sender.sendMessage(getMessageWithPrefix(configString, tagResolvers));
|
||||
}
|
||||
|
||||
public Component getMessage(final String configString, final TagResolver... tagResolvers) {
|
||||
return MiniMessage.miniMessage().deserialize(getString(configString), tagResolvers);
|
||||
}
|
||||
|
||||
|
||||
public Component getMessageWithPrefix(final String configString, final TagResolver... tagResolvers) {
|
||||
return prefix.append(getMessage(configString, tagResolvers));
|
||||
}
|
||||
|
||||
public String getString(final String configString) {
|
||||
if (externalConfig.contains(configString)) {
|
||||
return externalConfig.getString(configString);
|
||||
} else {
|
||||
return internalConfig.getString(configString);
|
||||
}
|
||||
}
|
||||
}
|
51
src/main/java/space/sangelo/unique/util/VanishManager.java
Normal file
51
src/main/java/space/sangelo/unique/util/VanishManager.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package space.sangelo.unique.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import space.sangelo.unique.Unique;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class VanishManager {
|
||||
private final ArrayList<String> hiddenUsernames;
|
||||
|
||||
private final Unique plugin;
|
||||
|
||||
public VanishManager(final Unique plugin) {
|
||||
this.plugin = plugin;
|
||||
this.hiddenUsernames = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isVanished(final Player player) {
|
||||
return hiddenUsernames.contains(player.getName());
|
||||
}
|
||||
|
||||
public void vanishPlayer(final Player p) {
|
||||
final String vanishModLogsMsg = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("prefix") + plugin.getConfig().getString("vanish-mod-logs-msg"));
|
||||
hiddenUsernames.add(p.getName());
|
||||
for (final Player p1 : plugin.getServer().getOnlinePlayers()) {
|
||||
if (p1 == p) {
|
||||
continue;
|
||||
} else if (p1.hasPermission("unique.moderation.vanish.see")) {
|
||||
p1.sendMessage(vanishModLogsMsg.replace("%p", p.getName()));
|
||||
continue;
|
||||
} else if (p1.hasPermission("unique.moderation.vanish.list")) {
|
||||
p1.hidePlayer(plugin, p);
|
||||
p1.sendMessage(vanishModLogsMsg.replace("%p", p.getName()));
|
||||
continue;
|
||||
}
|
||||
p1.hidePlayer(plugin, p);
|
||||
}
|
||||
}
|
||||
|
||||
public void showPlayer(final Player player) {
|
||||
hiddenUsernames.remove(player.getName());
|
||||
for (final Player p1 : plugin.getServer().getOnlinePlayers()) {
|
||||
p1.showPlayer(plugin, player);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> getHiddenUsernames() {
|
||||
return hiddenUsernames;
|
||||
}
|
||||
}
|
20
src/main/resources/config.yml
Normal file
20
src/main/resources/config.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
# __ __ _
|
||||
# / / / /___ (_)___ ___ _____
|
||||
# / / / / __ \/ / __ `/ / / / _ \
|
||||
#/ /_/ / / / / / /_/ / /_/ / __/
|
||||
#\____/_/ /_/_/\__, /\__,_/\___/
|
||||
# /_/
|
||||
|
||||
# !! INFO
|
||||
# Placeholders:
|
||||
# %p is the player's name.
|
||||
# %t is the target's name.
|
||||
# %c is the placeholder for the command itself.
|
||||
# %u is the command's usage.
|
||||
# !! Do not replace the placeholders, or change them up, as it will break things !!
|
||||
# For example:
|
||||
# - Do not do this: Replace %c in no-args-msg with %p.
|
||||
# - Do this: Move it around inside of the message, so it makes sense when you translate messages.
|
||||
|
||||
# This is the command cooldown in seconds. You can type 0 to disable it, or any other number to enable it. Default is 3.
|
||||
spawn-command-cooldown: 3
|
78
src/main/resources/messages.yml
Normal file
78
src/main/resources/messages.yml
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Sets the prefix for chat messages.
|
||||
prefix: '<dark_gray>[<dark_green>Unique</dark_green>]</dark_gray> '
|
||||
print-msg: '<dark_gray>(print)</dark_gray> <message>'
|
||||
|
||||
# This message will be sent when a player couldn't be found.
|
||||
player-not-online-msg: "<red>This player is not online or doesn't exist.</red>"
|
||||
# This message is sent to the console, when they try to run a command that only works on players.
|
||||
console-specify-player: '<red>Please specify a player.</red>'
|
||||
# This is the message that will be sent to the console when it has to be ran in game.
|
||||
console-not-allowed-msg: "<red>You need to be on the server to use this command.</red>"
|
||||
# This is the message that is sent to the player, when they don't have the required permissions
|
||||
no-perms-msg: "<red>You don't have the required permissions to execute this command.</red>"
|
||||
# This is the error that will be sent when no arguments were given.
|
||||
no-args-msg: "<red>No arguments were given. Usage: <gold>/<command> <usage>.</red>"
|
||||
# This are the force reload messages.
|
||||
force-reload-msg: "<dark_green>Forcing reload of the plugin..."
|
||||
force-reload-complete-msg: "<dark_green>Forcing reload of the plugin <green>complete</green><dark_green>!"
|
||||
# These are the join and leave messages.
|
||||
join-msg: "<dark_gray>[<dark_green>+</dark_green>] <green><player></green></dark_gray>"
|
||||
quit-msg: "<dark_gray>[<dark_red>-</dark_red>] <red><player></red>"
|
||||
|
||||
# These are the toggle messages for god mode.
|
||||
god-enabled-msg: '<dark_green>God mode is now <green>enabled</green><dark_green>.'
|
||||
god-disabled-msg: '<dark_green>God mode is now <red>disabled</red><dark_green>.'
|
||||
# These are the toggle messages for god mode, on the sender's side.
|
||||
god-enabled-others-msg: '<dark_green>You have <green>enabled</green> god mode for <gold><target></gold>.</dark_green>'
|
||||
god-disabled-others-msg: '<dark_green>You have <red>disabled</red> god mode for <gold><target></gold>.</dark_green>'
|
||||
# These are the toggle messages for god mode, on the target's side.
|
||||
god-enabled-target-msg: '<dark_green>God mode has now been <green>enabled</green> for you by <gold><player></gold></dark_green>.'
|
||||
god-disabled-target-msg: '<dark_green>God mode has now been <red>disabled</red> for you by <gold><player></gold><dark_green>.'
|
||||
|
||||
# These are the toggle messages for flight.
|
||||
flight-enabled-msg: '<dark_green>Flight is now <green>enabled</green>.'
|
||||
flight-disabled-msg: '<dark_green>Flight is now <red>disabled</red><dark_green>.'
|
||||
# These are the toggle messages for flight, on the sender's side.
|
||||
flight-enabled-others-msg: '<dark_green>You have <green>enabled</green> flight for <gold><target></gold><dark_green>.'
|
||||
flight-disabled-others-msg: '<dark_green>You have <red>disabled</red> flight for <gold><target></gold><dark_green>.'
|
||||
# These are the toggle messages for flight, on the target's side.
|
||||
flight-enabled-target-msg: '<dark_green>Flight has now been <green>enabled</green> for you by <gold><player></gold><dark_green>.'
|
||||
flight-disabled-target-msg: '<dark_green>Flight has now been <red>disabled</red> for you by <gold><player></gold><dark_green>.'
|
||||
|
||||
# These are the toggle messages for vanish.
|
||||
vanish-enabled-msg: '<dark_green>You are now <green>invisible</green><dark_green>.'
|
||||
vanish-disabled-msg: '<dark_green>You are now <red>visible</red><dark_green>.'
|
||||
vanish-enabled-others-msg: '<gold><target></gold><dark_green> is now <green>invisible</green><dark_green>.'
|
||||
vanish-disabled-others-msg: '<gold><target></gold><dark_green> is now <red>visible</red><dark_green>.'
|
||||
# Other vanish related messages.
|
||||
vanish-hidden-list-msg: '<dark_green>Hidden players: <gold><playerlist></gold>'
|
||||
vanish-hidden-none-msg: '<dark_green>There are no hidden players.'
|
||||
vanish-mod-logs-msg: '<dark_green><player> <gray>has vanished.'
|
||||
|
||||
|
||||
# These are the feed messages.
|
||||
feed-msg: "<dark_green>You have now been fed."
|
||||
feed-others-msg: '<dark_green>You have now fed <gold><target></gold></dark_green>.'
|
||||
feed-target-msg: '<dark_green>You have been fed by <gold><player></gold></dark_green>.'
|
||||
|
||||
# These are the heal messages.
|
||||
heal-msg: "<dark_green>You have now been healed."
|
||||
heal-others-msg: '<dark_green>You have now healed <gold><target></gold><dark_green>.'
|
||||
heal-target-msg: '<dark_green>You have been healed by <gold><player></gold><dark_green>.'
|
||||
|
||||
# These are the gamemode switcher messages.
|
||||
gamemode-switcher-msg: '<dark_green>Your gamemode has been updated to <gold><gamemode></gold>.</dark_green>'
|
||||
gamemode-already-set-msg: '<red>You already are in <gold><gamemode></gold>.</red>'
|
||||
gamemode-already-set-others-msg: "<red><gold><target></gold>'s gamemode is already set to <gold><gamemode></gold>.</red>"
|
||||
gamemode-switch-others-msg: "<dark_green>You have changed <gold><target>'s</gold> to <gold><gamemode></gold>.<dark_green>"
|
||||
|
||||
# This is the message that is sent to the mod, when they set a new spawn point.
|
||||
setspawn-msg: "<dark_green>Spawn location has now been set <green>successfully.</green>"
|
||||
# This is the confirmation message that is sent to the player, when they teleport to the spawn point.
|
||||
spawn-tp-msg: "<dark_green>You have been teleported to spawn."
|
||||
# This is the message that is sent to the player, when they tried to teleport to the spawn point, but have to wait for the cooldown.
|
||||
spawn-cooldown-msg: "<red>You cannot teleport for another <gold><remaining></gold> seconds.</red>"
|
||||
# This is the message that is sent to the player, when they tried to teleport to the spawn point, but there is none set.
|
||||
spawn-no-location-msg: "<red>There is no spawn location set. Couldn't initiate teleport.</red>"
|
||||
# This is the message that is sent to the moderator, when they try to teleport to the spawn point, but there is none set.
|
||||
spawn-mod-no-location-msg: "<red>There is no spawn location set. Couldn't initiate teleport. Use <click:run_command:setspawn><u><gold>/setspawn</gold></u></click> to set one.</red>"
|
87
src/main/resources/plugin.yml
Normal file
87
src/main/resources/plugin.yml
Normal file
|
@ -0,0 +1,87 @@
|
|||
name: Unique
|
||||
version: '${project.version}'
|
||||
main: space.sangelo.unique.Unique
|
||||
api-version: 1.18
|
||||
authors: [ Sangelo ]
|
||||
description: Escape the ordinary – Be Unique!
|
||||
website: https://sangelo.space
|
||||
commands:
|
||||
unique:
|
||||
description: Main Plugin Command. Just a little about page.
|
||||
usage: /<command>
|
||||
aliases:
|
||||
- uq
|
||||
- about
|
||||
print:
|
||||
description: Print a message.
|
||||
usage: /<command> {message}
|
||||
aliases:
|
||||
- hello
|
||||
- test
|
||||
- message
|
||||
god:
|
||||
description: Become invulnerable! Or let anyone else be.
|
||||
usage: /<command> [player]
|
||||
fly:
|
||||
description: Be able to fly! Or let anyone else be.
|
||||
usage: /<command> [player]
|
||||
vanish:
|
||||
description: Become invisible to others!
|
||||
usage: /<command>
|
||||
aliases:
|
||||
- v
|
||||
- invis
|
||||
- invisible
|
||||
heal:
|
||||
description: Heal yourself (or if you'd like, someone else)!
|
||||
usage: /<command> [player]
|
||||
feed:
|
||||
description: Feed yourself (or if you'd like, someone else)!
|
||||
usage: /<command> [player]
|
||||
aliases:
|
||||
- food
|
||||
gmc:
|
||||
description: Set your gamemode to creative.
|
||||
usage: /<command> [player]
|
||||
aliases:
|
||||
- gamemodec
|
||||
- modec
|
||||
- creative
|
||||
- c
|
||||
gms:
|
||||
description: Set your gamemode to survival.
|
||||
usage: /<command> [player]
|
||||
aliases:
|
||||
- gamemodes
|
||||
- modes
|
||||
- survival
|
||||
- s
|
||||
gma:
|
||||
description: Set your gamemode to adventure.
|
||||
usage: /<command> [player]
|
||||
aliases:
|
||||
- gamemodea
|
||||
- modea
|
||||
- adventure
|
||||
- a
|
||||
gmsp:
|
||||
description: Set your gamemode to spectator.
|
||||
usage: /<command> [player]
|
||||
aliases:
|
||||
- gamemodesp
|
||||
- modesp
|
||||
- spectator
|
||||
- sp
|
||||
setspawn:
|
||||
description: Sets the spawnpoint to the current player location.
|
||||
usage: /<command>
|
||||
spawn:
|
||||
description: Teleports the player to the spawnpoint, if there is one specified.
|
||||
usage: /<command>
|
||||
forcereload:
|
||||
description: Force the server to reload the plugin configuration.
|
||||
usage: /<command>
|
||||
aliases:
|
||||
- rlu
|
||||
- rlunique
|
||||
- reloadunique
|
Loading…
Reference in a new issue