t
This commit is contained in:
parent
c6ca791676
commit
1e35e555c2
@ -6,7 +6,6 @@ import lombok.Setter;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -22,8 +21,6 @@ import rip.tilly.bedwars.generators.GeneratorType;
|
|||||||
import rip.tilly.bedwars.utils.CC;
|
import rip.tilly.bedwars.utils.CC;
|
||||||
import rip.tilly.bedwars.utils.CustomLocation;
|
import rip.tilly.bedwars.utils.CustomLocation;
|
||||||
import rip.tilly.bedwars.utils.TimeUtils;
|
import rip.tilly.bedwars.utils.TimeUtils;
|
||||||
import rip.tilly.bedwars.villager.CustomVillager;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -314,30 +311,30 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void spawnVillagers() {
|
public void spawnVillagers() {
|
||||||
CustomVillager villager = new CustomVillager(this.copiedArena.getA().toBukkitWorld());
|
// CustomVillager villager = new CustomVillager(this.copiedArena.getA().toBukkitWorld());
|
||||||
villager.register();
|
// villager.register();
|
||||||
villager.spawn(this.copiedArena.getTeamAshop().toBukkitLocation(), "&aItem Shop");
|
// villager.spawn(this.copiedArena.getTeamAshop().toBukkitLocation(), "&aItem Shop");
|
||||||
this.addEntityToRemove(villager.getBukkitEntity());
|
// this.addEntityToRemove(villager.getBukkitEntity());
|
||||||
|
|
||||||
// Villager teamAShopVillager = this.copiedArena.getTeamAshop().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamAshop().toBukkitLocation(), Villager.class);
|
Villager teamAShopVillager = this.copiedArena.getTeamAshop().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamAshop().toBukkitLocation(), Villager.class);
|
||||||
// teamAShopVillager.setCustomName(CC.translate("&aItem Shop"));
|
teamAShopVillager.setCustomName(CC.translate("&aItem Shop"));
|
||||||
// teamAShopVillager.setCustomNameVisible(true);
|
teamAShopVillager.setCustomNameVisible(true);
|
||||||
//
|
|
||||||
// Villager teamBShopVillager = this.copiedArena.getTeamBshop().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamBshop().toBukkitLocation(), Villager.class);
|
Villager teamBShopVillager = this.copiedArena.getTeamBshop().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamBshop().toBukkitLocation(), Villager.class);
|
||||||
// teamBShopVillager.setCustomName(CC.translate("&aItem Shop"));
|
teamBShopVillager.setCustomName(CC.translate("&aItem Shop"));
|
||||||
// teamBShopVillager.setCustomNameVisible(true);
|
teamBShopVillager.setCustomNameVisible(true);
|
||||||
//
|
|
||||||
// Villager teamAUpgradesVillager = this.copiedArena.getTeamAupgrades().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamAupgrades().toBukkitLocation(), Villager.class);
|
Villager teamAUpgradesVillager = this.copiedArena.getTeamAupgrades().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamAupgrades().toBukkitLocation(), Villager.class);
|
||||||
// teamAUpgradesVillager.setCustomName(CC.translate("&aUpgrades Shop"));
|
teamAUpgradesVillager.setCustomName(CC.translate("&aUpgrades Shop"));
|
||||||
// teamAUpgradesVillager.setCustomNameVisible(true);
|
teamAUpgradesVillager.setCustomNameVisible(true);
|
||||||
//
|
|
||||||
// Villager teamBUpgradesVillager = this.copiedArena.getTeamBupgrades().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamBupgrades().toBukkitLocation(), Villager.class);
|
Villager teamBUpgradesVillager = this.copiedArena.getTeamBupgrades().toBukkitLocation().getWorld().spawn(this.copiedArena.getTeamBupgrades().toBukkitLocation(), Villager.class);
|
||||||
// teamBUpgradesVillager.setCustomName(CC.translate("&aUpgrades Shop"));
|
teamBUpgradesVillager.setCustomName(CC.translate("&aUpgrades Shop"));
|
||||||
// teamBUpgradesVillager.setCustomNameVisible(true);
|
teamBUpgradesVillager.setCustomNameVisible(true);
|
||||||
//
|
|
||||||
// this.addEntityToRemove(teamAShopVillager);
|
this.addEntityToRemove(teamAShopVillager);
|
||||||
// this.addEntityToRemove(teamBShopVillager);
|
this.addEntityToRemove(teamBShopVillager);
|
||||||
// this.addEntityToRemove(teamAUpgradesVillager);
|
this.addEntityToRemove(teamAUpgradesVillager);
|
||||||
// this.addEntityToRemove(teamBUpgradesVillager);
|
this.addEntityToRemove(teamBUpgradesVillager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package rip.tilly.bedwars.listeners;
|
package rip.tilly.bedwars.listeners;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Villager;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
@ -15,14 +14,12 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.TrapDoor;
|
import org.bukkit.material.TrapDoor;
|
||||||
import rip.tilly.bedwars.BedWars;
|
import rip.tilly.bedwars.BedWars;
|
||||||
import rip.tilly.bedwars.game.GameState;
|
|
||||||
import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem;
|
import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem;
|
||||||
import rip.tilly.bedwars.menus.queue.PlayAGameMenu;
|
import rip.tilly.bedwars.menus.queue.PlayAGameMenu;
|
||||||
import rip.tilly.bedwars.menus.settings.SettingsMenu;
|
import rip.tilly.bedwars.menus.settings.SettingsMenu;
|
||||||
import rip.tilly.bedwars.menus.shop.blocks.BlocksMenu;
|
import rip.tilly.bedwars.menus.shop.blocks.BlocksMenu;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerState;
|
import rip.tilly.bedwars.playerdata.PlayerState;
|
||||||
import rip.tilly.bedwars.utils.CC;
|
|
||||||
import rip.tilly.bedwars.utils.menusystem.menu.UpgradesMenu;
|
import rip.tilly.bedwars.utils.menusystem.menu.UpgradesMenu;
|
||||||
|
|
||||||
public class InteractListener implements Listener {
|
public class InteractListener implements Listener {
|
||||||
@ -108,7 +105,7 @@ public class InteractListener implements Listener {
|
|||||||
// open party games menu
|
// open party games menu
|
||||||
break;
|
break;
|
||||||
case PARTY_INFO:
|
case PARTY_INFO:
|
||||||
player.performCommand("party info");
|
player.chat("/party info");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PARTY_LEAVE:
|
case PARTY_LEAVE:
|
||||||
@ -147,22 +144,20 @@ public class InteractListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = event.getRightClicked().getCustomName();
|
String name = event.getRightClicked().getName();
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ChatColor.stripColor(name);
|
|
||||||
|
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "Item Shop":
|
case "&aItem Shop":
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
new BlocksMenu().openMenu(player);
|
new BlocksMenu().openMenu(player);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "Upgrades Shop":
|
case "&aUpgrades Shop":
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
new UpgradesMenu(this.plugin.getPlayerMenuUtil(player)).open(player);
|
new UpgradesMenu(this.plugin.getPlayerMenuUtil(player)).open(player);
|
||||||
@ -170,4 +165,15 @@ public class InteractListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
if (event.getEntityType() == EntityType.VILLAGER) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user