use of sqlite.kripton209.model2.User in project Village_Defense by Plajer.
the class LooterKit method onDeath.
@EventHandler
public void onDeath(EntityDeathEvent event) {
if (event.getEntity().getType() != EntityType.ZOMBIE)
return;
if (event.getEntity().getKiller() == null)
return;
Player player = event.getEntity().getKiller();
if (ArenaRegistry.getArena(player) == null)
return;
User user = UserManager.getUser(player.getUniqueId());
if (user.getKit() instanceof LooterKit) {
player.getInventory().addItem(new ItemStack(Material.ROTTEN_FLESH, 1));
}
}
use of sqlite.kripton209.model2.User in project Village_Defense by Plajer.
the class WorkerKit method onDoorPlace.
@EventHandler(priority = EventPriority.HIGHEST)
public void onDoorPlace(BlockPlaceEvent event) {
Arena arena = ArenaRegistry.getArena(event.getPlayer());
if (arena == null)
return;
User user = UserManager.getUser(event.getPlayer().getUniqueId());
if (user.isSpectator()) {
event.setCancelled(true);
return;
}
if (event.getPlayer().getItemInHand() == null) {
event.setCancelled(true);
return;
}
if (!(event.getPlayer().getItemInHand().getType() == Material.WOOD_DOOR || event.getPlayer().getItemInHand().getType() == Material.WOODEN_DOOR)) {
event.setCancelled(true);
return;
}
if (!arena.getDoorLocations().containsKey(event.getBlock().getLocation())) {
event.setCancelled(true);
return;
}
event.setCancelled(false);
event.getPlayer().sendMessage(ChatManager.colorMessage("Kits.Worker.Game-Item-Place-Message"));
}
use of sqlite.kripton209.model2.User in project Village_Defense by Plajer.
the class AdminCommands method addOrbsOther.
public void addOrbsOther(CommandSender sender, String p, String number) {
// check only target player, maybe sender would do this from console.
if (Bukkit.getPlayerExact(p) == null) {
sender.sendMessage(ChatColor.RED + "Target player doesn't exist!");
}
Player player = Bukkit.getPlayer(p);
if (!checkIsInGameInstance(player))
return;
if (!hasPermission(sender, "villagedefense.admin.addorbs.others"))
return;
if (NumberUtils.isNumber(number)) {
User user = UserManager.getUser(player.getUniqueId());
user.setInt("orbs", user.getInt("orbs") + Integer.parseInt(number));
sender.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("Commands.Admin-Commands.Added-Orbs"));
} else {
sender.sendMessage(ChatColor.RED + "Wrong usage. Do /villagedefense addorbs <player> <amount>");
}
}
use of sqlite.kripton209.model2.User in project Village_Defense by Plajer.
the class AdminCommands method respawn.
public void respawn(CommandSender sender) {
if (checkSenderIsConsole(sender))
return;
Player player = (Player) sender;
if (!hasPermission(player, "villagedefense.admin.respawn"))
return;
if (!checkIsInGameInstance(player))
return;
Arena arena = ArenaRegistry.getArena(player);
player.setGameMode(GameMode.SURVIVAL);
User user = UserManager.getUser(player.getUniqueId());
user.setFakeDead(false);
user.setSpectator(false);
arena.teleportToStartLocation(player);
player.setFlying(false);
player.setAllowFlight(false);
ArenaUtils.showPlayer(player, arena);
player.getInventory().clear();
user.getKit().giveKitItems(player);
player.sendMessage(ChatManager.colorMessage("In-Game.Back-In-Game"));
}
use of sqlite.kripton209.model2.User in project Village_Defense by Plajer.
the class AdminCommands method addOrbs.
public void addOrbs(CommandSender sender, String number) {
if (!checkIsInGameInstance((Player) sender))
return;
if (!hasPermission(sender, "villagedefense.admin.addorbs"))
return;
if (NumberUtils.isNumber(number)) {
User user = UserManager.getUser(((Player) sender).getUniqueId());
user.setInt("orbs", user.getInt("orbs") + Integer.parseInt(number));
sender.sendMessage(ChatManager.PLUGIN_PREFIX + ChatManager.colorMessage("Commands.Admin-Commands.Added-Orbs"));
} else {
sender.sendMessage(ChatColor.RED + "Wrong usage. Do /villagedefense addorbs <amount>");
}
}
Aggregations