add /spawngiant
This commit is contained in:
parent
57aa85a3fc
commit
2f055e59cf
3 changed files with 23 additions and 3 deletions
2
pom.xml
2
pom.xml
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>giants</groupId>
|
||||
<artifactId>giants</artifactId>
|
||||
<version>22.2.0</version>
|
||||
<version>22.2.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -14,6 +14,9 @@ import org.bstats.bukkit.Metrics;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -32,7 +35,7 @@ import org.bukkit.potion.PotionEffect;
|
|||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Main extends JavaPlugin implements Listener {
|
||||
public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
||||
File configFile = new File(getDataFolder(), "config.yml");
|
||||
FileConfiguration config;
|
||||
|
||||
|
@ -107,6 +110,7 @@ public class Main extends JavaPlugin implements Listener {
|
|||
}
|
||||
}
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
getCommand("spawngiant").setExecutor(this);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -137,6 +141,12 @@ public class Main extends JavaPlugin implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
spawnGiant(true, ((Player) sender).getLocation());
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entitySpawn(EntitySpawnEvent e) {
|
||||
if (e.getEntityType() == EntityType.ZOMBIE) {
|
||||
|
|
|
@ -3,3 +3,13 @@ version: ${project.version}
|
|||
api-version: 1.18
|
||||
main: pl.minecon724.giants.Main
|
||||
author: Minecon724
|
||||
website: https://www.spigotmc.org/resources/giants.99600/
|
||||
commands:
|
||||
spawngiant:
|
||||
description: Spawns a giant at players location.
|
||||
permission: giants.spawngiant
|
||||
permission-message: You do not have permission to use this command.
|
||||
permissions:
|
||||
giants.spawngiant:
|
||||
description: Allows to use /spawngiant
|
||||
default: op
|
Loading…
Reference in a new issue