Last 1.12.2 version

This commit is contained in:
mathias 2019-07-23 16:48:57 +03:00
parent 48b0b4b9f3
commit ce372d2200
4 changed files with 55 additions and 3 deletions

View file

@ -30,6 +30,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -124,6 +125,52 @@ class CommandEnchantAll implements CommandExecutor {
}
}
class CommandHerobrine implements CommandExecutor {
Main main;
CommandHerobrine(Main main) {
this.main = main;
}
private void spawnHerobrine(Player player) {
Location location = player.getLocation();
Player herobrine = (Player) location.getWorld().spawnEntity(
location.add(location.getDirection().multiply(6)),
EntityType.PLAYER
);
main.getSkin("Herobrine", herobrine);
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
Location location = player.getLocation();
if (args.length == 0) {
Player herobrine = (Player) location.getWorld().spawnEntity(
location,
EntityType.PLAYER
);
main.getSkin("Herobrine", herobrine);
} else {
if (args[0].equals("*") || args[0].equals("**")) {
for (Player p : Bukkit.getOnlinePlayers()) {
spawnHerobrine(p);
}
player.sendMessage("Successfully spawned Herobrine behind every player");
} else {
Player target = Bukkit.getPlayer(args[0]);
if (target != null) {
spawnHerobrine(target);
player.sendMessage("Successfully spawned Herobrine behind player \"" + target.getName() + "\"");
} else {
player.sendMessage("Player \"" + target.getName() + "\" not found");
}
}
}
return true;
}
}
class CommandJumpscare implements CommandExecutor {
private void createJumpscare(Player player) {
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);

View file

@ -637,6 +637,7 @@ class Events implements Listener {
@EventHandler
void onPlayerDeath(PlayerDeathEvent event) {
System.out.println("dead");
Player player = event.getEntity();
final AttributeInstance maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
boolean maxHealthLow = false;
@ -724,10 +725,10 @@ class Events implements Listener {
@EventHandler
void onPlayerLogin(PlayerLoginEvent event) {
if (!(event.getHostname().startsWith("play.kaboom.pw") &&
/*if (!(event.getHostname().startsWith("play.kaboom.pw") &&
event.getHostname().endsWith(":53950"))) {
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
} else {
} else {*/
final Player player = event.getPlayer();
event.allow();
@ -766,7 +767,7 @@ class Events implements Listener {
}
});
}
}
/*}*/
}
@EventHandler

View file

@ -441,6 +441,7 @@ public class Main extends JavaPlugin {
this.getCommand("console").setExecutor(new CommandConsole());
this.getCommand("destroyentities").setExecutor(new CommandDestroyEntities());
this.getCommand("enchantall").setExecutor(new CommandEnchantAll());
this.getCommand("herobrine").setExecutor(new CommandHerobrine(this));
this.getCommand("jumpscare").setExecutor(new CommandJumpscare());
this.getCommand("prefix").setExecutor(new CommandPrefix(this));
this.getCommand("pumpkin").setExecutor(new CommandPumpkin());

View file

@ -17,6 +17,9 @@ commands:
enchantall:
description: Adds every enchantment to a held item
permission: extras.enchantall
herobrine:
description: I wonder...
permission: extras.herobrine
jumpscare:
aliases: scare
description: Scares a player