use of org.bukkit.inventory.ItemStack in project MyMaid2 by jaoafa.
the class Event_Antijaoium method InvClick.
@EventHandler(priority = EventPriority.HIGHEST)
public void InvClick(InventoryClickEvent event) {
if (!(event.getWhoClicked() instanceof Player)) {
return;
}
Player player = (Player) event.getWhoClicked();
Inventory inventory = event.getInventory();
Inventory clickedinventory = event.getClickedInventory();
ItemStack[] is = inventory.getContents();
/*if(Jail.isJail(player)){
return;
}*/
Boolean jaoium = false;
for (int n = 0; n != is.length; n++) {
if (is[n] == null) {
continue;
}
ItemStack hand = is[n];
if (hand.getType() == Material.SPLASH_POTION || hand.getType() == Material.LINGERING_POTION) {
PotionMeta potion = (PotionMeta) hand.getItemMeta();
jaoium = isjaoium(potion.getCustomEffects());
if (jaoium) {
inventory.clear(n);
}
}
}
if (jaoium) {
inventory.clear();
}
if (clickedinventory != null) {
is = clickedinventory.getContents();
for (int n = 0; n != is.length; n++) {
if (is[n] == null) {
continue;
}
ItemStack hand = is[n];
if (hand.getType() == Material.SPLASH_POTION || hand.getType() == Material.LINGERING_POTION) {
PotionMeta potion = (PotionMeta) hand.getItemMeta();
jaoium = isjaoium(potion.getCustomEffects());
if (jaoium) {
inventory.clear(n);
}
}
}
if (jaoium) {
clickedinventory.clear();
}
}
if (jaoium) {
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage("[" + ChatColor.RED + "j" + ChatColor.GOLD + "a" + ChatColor.YELLOW + "o" + ChatColor.GREEN + "S" + ChatColor.AQUA + "u" + ChatColor.BLUE + "p" + ChatColor.DARK_BLUE + "e" + ChatColor.RED + "r" + ChatColor.GOLD + "A" + ChatColor.YELLOW + "c" + ChatColor.GREEN + "h" + ChatColor.AQUA + "i" + ChatColor.BLUE + "e" + ChatColor.DARK_BLUE + "v" + ChatColor.RED + "e" + ChatColor.GOLD + "m" + ChatColor.YELLOW + "e" + ChatColor.GREEN + "n" + ChatColor.AQUA + "t" + ChatColor.RESET + "] " + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
// Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
}
use of org.bukkit.inventory.ItemStack in project MyMaid2 by jaoafa.
the class Event_Antijaoium method onPotionSplashEvent.
@EventHandler
public void onPotionSplashEvent(PotionSplashEvent event) {
if (!(event.getEntity().getShooter() instanceof Player)) {
return;
}
Player player = (Player) event.getEntity().getShooter();
Inventory inventory = player.getInventory();
Inventory enderchestinventory = player.getEnderChest();
ItemStack[] is = inventory.getContents();
Boolean jaoium = false;
for (int n = 0; n != is.length; n++) {
if (is[n] == null) {
continue;
}
ItemStack hand = is[n];
if (hand.getType() == Material.SPLASH_POTION || hand.getType() == Material.LINGERING_POTION) {
PotionMeta potion = (PotionMeta) hand.getItemMeta();
jaoium = isjaoium(potion.getCustomEffects());
if (jaoium) {
inventory.clear(n);
}
}
}
if (jaoium) {
inventory.clear();
}
if (enderchestinventory != null) {
is = enderchestinventory.getContents();
for (int n = 0; n != is.length; n++) {
if (is[n] == null) {
continue;
}
ItemStack hand = is[n];
if (hand.getType() == Material.SPLASH_POTION || hand.getType() == Material.LINGERING_POTION) {
PotionMeta potion = (PotionMeta) hand.getItemMeta();
jaoium = isjaoium(potion.getCustomEffects());
if (jaoium) {
inventory.clear(n);
}
}
}
if (jaoium) {
enderchestinventory.clear();
}
}
if (jaoium) {
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage("[" + ChatColor.RED + "j" + ChatColor.GOLD + "a" + ChatColor.YELLOW + "o" + ChatColor.GREEN + "S" + ChatColor.AQUA + "u" + ChatColor.BLUE + "p" + ChatColor.DARK_BLUE + "e" + ChatColor.RED + "r" + ChatColor.GOLD + "A" + ChatColor.YELLOW + "c" + ChatColor.GREEN + "h" + ChatColor.AQUA + "i" + ChatColor.BLUE + "e" + ChatColor.DARK_BLUE + "v" + ChatColor.RED + "e" + ChatColor.GOLD + "m" + ChatColor.YELLOW + "e" + ChatColor.GREEN + "n" + ChatColor.AQUA + "t" + ChatColor.RESET + "] " + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
// Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
event.setCancelled(true);
}
}
use of org.bukkit.inventory.ItemStack in project MyMaid2 by jaoafa.
the class Event_Antijaoium method onPlayerItemHeldEvent.
@EventHandler(ignoreCancelled = true)
public void onPlayerItemHeldEvent(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
Inventory inventory = player.getInventory();
Inventory enderchestinventory = player.getEnderChest();
ItemStack[] is = inventory.getContents();
Boolean jaoium = false;
for (int n = 0; n != is.length; n++) {
if (is[n] == null) {
continue;
}
ItemStack hand = is[n];
if (hand.getType() == Material.SPLASH_POTION || hand.getType() == Material.LINGERING_POTION) {
PotionMeta potion = (PotionMeta) hand.getItemMeta();
jaoium = isjaoium(potion.getCustomEffects());
if (jaoium) {
inventory.clear(n);
}
}
}
if (jaoium) {
inventory.clear();
}
if (enderchestinventory != null) {
is = enderchestinventory.getContents();
for (int n = 0; n != is.length; n++) {
if (is[n] == null) {
continue;
}
ItemStack hand = is[n];
if (hand.getType() == Material.SPLASH_POTION || hand.getType() == Material.LINGERING_POTION) {
PotionMeta potion = (PotionMeta) hand.getItemMeta();
jaoium = isjaoium(potion.getCustomEffects());
if (jaoium) {
inventory.clear(n);
}
}
}
if (jaoium) {
enderchestinventory.clear();
}
}
if (jaoium) {
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage("[" + ChatColor.RED + "j" + ChatColor.GOLD + "a" + ChatColor.YELLOW + "o" + ChatColor.GREEN + "S" + ChatColor.AQUA + "u" + ChatColor.BLUE + "p" + ChatColor.DARK_BLUE + "e" + ChatColor.RED + "r" + ChatColor.GOLD + "A" + ChatColor.YELLOW + "c" + ChatColor.GREEN + "h" + ChatColor.AQUA + "i" + ChatColor.BLUE + "e" + ChatColor.DARK_BLUE + "v" + ChatColor.RED + "e" + ChatColor.GOLD + "m" + ChatColor.YELLOW + "e" + ChatColor.GREEN + "n" + ChatColor.AQUA + "t" + ChatColor.RESET + "] " + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
// Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
}
use of org.bukkit.inventory.ItemStack in project MyMaid2 by jaoafa.
the class Cmd_AFK method setAFK_True.
/**
* プレイヤーをAFKにする
*
* @param player 設定するプレイヤー
* @author mine_book000
*/
public static void setAFK_True(Player player) {
if (getHeadICE(player)) {
PlayerInventory playerinv = player.getInventory();
head.put(player.getName(), playerinv.getHelmet());
player.getInventory().setHelmet(new ItemStack(Material.ICE));
player.updateInventory();
}
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + player.getName() + " is afk!");
DiscordSend(player.getName() + " is afk!");
if (!Achievementjao.getAchievement(player, new AchievementType(11))) {
player.sendMessage("[" + ChatColor.RED + "j" + ChatColor.GOLD + "a" + ChatColor.YELLOW + "o" + ChatColor.GREEN + "S" + ChatColor.AQUA + "u" + ChatColor.BLUE + "p" + ChatColor.DARK_BLUE + "e" + ChatColor.RED + "r" + ChatColor.GOLD + "A" + ChatColor.YELLOW + "c" + ChatColor.GREEN + "h" + ChatColor.AQUA + "i" + ChatColor.BLUE + "e" + ChatColor.DARK_BLUE + "v" + ChatColor.RED + "e" + ChatColor.GOLD + "m" + ChatColor.YELLOW + "e" + ChatColor.GREEN + "n" + ChatColor.AQUA + "t" + ChatColor.RESET + "] " + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
String listname = player.getPlayerListName().replaceAll(player.getName(), ChatColor.DARK_GRAY + player.getName());
player.setPlayerListName(listname);
TitleAPI.sendTitle(player, 0, 99999999, 0, ChatColor.RED + "AFK NOW!", ChatColor.BLUE + "" + ChatColor.BOLD + "When you are back, please enter the command '/afk' or Move.");
try {
BukkitTask task = new Task_AFKING(JavaPlugin(), player).runTaskTimer(JavaPlugin(), 0L, 5L);
Cmd_AFK.afking.put(player.getName(), task);
} catch (java.lang.NoClassDefFoundError e) {
BugReporter(e);
Cmd_AFK.afking.put(player.getName(), null);
}
}
use of org.bukkit.inventory.ItemStack in project BKCommonLib by bergerhealer.
the class ItemMaterialTest method testEQIgnoreAmount.
private static void testEQIgnoreAmount(ItemStack item) {
ItemStack a = ItemUtil.cloneItem(item);
ItemStack b = ItemUtil.cloneItem(item);
a.setAmount(1);
b.setAmount(2);
assertTrue(ItemUtil.equalsIgnoreAmount(a, b));
}
Aggregations