use of com.jaoafa.MyMaid2.Lib.EscapeJailException in project MyMaid2 by jaoafa.
the class Event_Antijaoium method onPotionSplashEvent.
@SuppressWarnings("deprecation")
@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();
if (Jail.isJail(player)) {
return;
}
boolean jaoium = false;
String malicious = null;
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();
boolean _jaoium = isjaoium(potion.getCustomEffects());
if (_jaoium) {
setjaoiumItemData(player, hand);
inventory.clear(n);
jaoium = _jaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (jaoium) {
inventory.clear();
}
boolean enderjaoium = false;
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();
boolean _enderjaoium = isjaoium(potion.getCustomEffects());
if (_enderjaoium) {
setjaoiumItemData(player, hand);
enderchestinventory.clear(n);
enderjaoium = _enderjaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (enderjaoium) {
enderchestinventory.clear();
}
}
if (jaoium || enderjaoium) {
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage(AchievementAPI.getPrefix() + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
checkjaoiumLocation(player);
try {
if (malicious != null) {
EBan.Add(player, Bukkit.getOfflinePlayer("jaotan"), "禁止クライアントMod「" + malicious + "」使用の疑い。方針「クライアントModの導入・利用に関する規則」の「禁止事項」への違反");
} else {
Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
} catch (ClassNotFoundException | NullPointerException | SQLException e) {
BugReporter(e);
} catch (EscapeJailException e) {
// EscapeJailアイテムで止められた
// 痛くもない雷を落とす
player.getWorld().strikeLightningEffect(player.getLocation());
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "EscapeJailアイテムによって、jaotanからの「jaoium所持」という理由によるJailを無効化しました!");
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "早くjaoiumを始末しよう!");
}
event.setCancelled(true);
}
}
use of com.jaoafa.MyMaid2.Lib.EscapeJailException in project MyMaid2 by jaoafa.
the class Event_Antijaoium method onPlayerItemHeldEvent.
@SuppressWarnings("deprecation")
@EventHandler(ignoreCancelled = true)
public void onPlayerItemHeldEvent(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
Inventory inventory = player.getInventory();
Inventory enderchestinventory = player.getEnderChest();
ItemStack[] is = inventory.getContents();
if (Jail.isJail(player)) {
return;
}
boolean jaoium = false;
String malicious = null;
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();
boolean _jaoium = isjaoium(potion.getCustomEffects());
if (_jaoium) {
setjaoiumItemData(player, hand);
inventory.clear(n);
jaoium = _jaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (jaoium) {
inventory.clear();
}
boolean enderjaoium = false;
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();
boolean _enderjaoium = isjaoium(potion.getCustomEffects());
if (_enderjaoium) {
setjaoiumItemData(player, hand);
enderchestinventory.clear(n);
enderjaoium = _enderjaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (enderjaoium) {
enderchestinventory.clear();
}
}
if (jaoium || enderjaoium) {
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage(AchievementAPI.getPrefix() + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
checkjaoiumLocation(player);
try {
if (malicious != null) {
EBan.Add(player, Bukkit.getOfflinePlayer("jaotan"), "禁止クライアントMod「" + malicious + "」使用の疑い。方針「クライアントModの導入・利用に関する規則」の「禁止事項」への違反");
} else {
Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
} catch (ClassNotFoundException | NullPointerException | SQLException e) {
BugReporter(e);
} catch (EscapeJailException e) {
// EscapeJailアイテムで止められた
// 痛くもない雷を落とす
player.getWorld().strikeLightningEffect(player.getLocation());
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "EscapeJailアイテムによって、jaotanからの「jaoium所持」という理由によるJailを無効化しました!");
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "早くjaoiumを始末しよう!");
}
}
}
use of com.jaoafa.MyMaid2.Lib.EscapeJailException in project MyMaid2 by jaoafa.
the class Event_Antijaoium method InvClick.
@SuppressWarnings("deprecation")
@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;
String malicious = null;
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();
boolean _jaoium = isjaoium(potion.getCustomEffects());
if (_jaoium) {
setjaoiumItemData(player, hand);
if (inventory.getItem(n) != null)
inventory.clear(n);
jaoium = _jaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
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();
boolean _jaoium = isjaoium(potion.getCustomEffects());
if (_jaoium) {
setjaoiumItemData(player, hand);
clickedinventory.clear(n);
jaoium = _jaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (jaoium) {
clickedinventory.clear();
}
}
if (jaoium) {
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage(AchievementAPI.getPrefix() + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
checkjaoiumLocation(player);
try {
if (malicious != null) {
EBan.Add(player, Bukkit.getOfflinePlayer("jaotan"), "禁止クライアントMod「" + malicious + "」使用の疑い。方針「クライアントModの導入・利用に関する規則」の「禁止事項」への違反");
} else {
Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
} catch (ClassNotFoundException | NullPointerException | SQLException e) {
BugReporter(e);
} catch (EscapeJailException e) {
// EscapeJailアイテムで止められた
// 痛くもない雷を落とす
player.getWorld().strikeLightningEffect(player.getLocation());
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "EscapeJailアイテムによって、jaotanからの「jaoium所持」という理由によるJailを無効化しました!");
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "早くjaoiumを始末しよう!");
}
}
}
use of com.jaoafa.MyMaid2.Lib.EscapeJailException in project MyMaid2 by jaoafa.
the class Event_Antijaoium method onPlayerInteractEvent.
@SuppressWarnings("deprecation")
@EventHandler(ignoreCancelled = true)
public void onPlayerInteractEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
Inventory inventory = player.getInventory();
Inventory enderchestinventory = player.getEnderChest();
ItemStack[] is = inventory.getContents();
if (Jail.isJail(player)) {
return;
}
boolean jaoium = false;
String malicious = null;
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();
boolean _jaoium = isjaoium(potion.getCustomEffects());
if (_jaoium) {
setjaoiumItemData(player, hand);
inventory.clear(n);
jaoium = _jaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (jaoium) {
inventory.clear();
}
boolean enderjaoium = false;
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();
boolean _enderjaoium = isjaoium(potion.getCustomEffects());
if (_enderjaoium) {
setjaoiumItemData(player, hand);
enderchestinventory.clear(n);
enderjaoium = _enderjaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (jaoium || enderjaoium) {
enderchestinventory.clear();
}
}
if (jaoium) {
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
checkjaoiumLocation(player);
try {
if (malicious != null) {
EBan.Add(player, Bukkit.getOfflinePlayer("jaotan"), "禁止クライアントMod「" + malicious + "」使用の疑い。方針「クライアントModの導入・利用に関する規則」の「禁止事項」への違反");
} else {
Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
} catch (ClassNotFoundException | NullPointerException | SQLException e) {
e.printStackTrace();
} catch (EscapeJailException e) {
// EscapeJailアイテムで止められた
// 痛くもない雷を落とす
player.getWorld().strikeLightningEffect(player.getLocation());
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "EscapeJailアイテムによって、jaotanからの「jaoium所持」という理由によるJailを無効化しました!");
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "早くjaoiumを始末しよう!");
}
}
}
use of com.jaoafa.MyMaid2.Lib.EscapeJailException in project MyMaid2 by jaoafa.
the class Event_Antijaoium method onProjectileLaunchEvent.
@SuppressWarnings("deprecation")
@EventHandler
public void onProjectileLaunchEvent(ProjectileLaunchEvent 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();
if (Jail.isJail(player)) {
return;
}
boolean jaoium = false;
String malicious = null;
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();
boolean _jaoium = isjaoium(potion.getCustomEffects());
if (_jaoium) {
setjaoiumItemData(player, hand);
inventory.clear(n);
jaoium = _jaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (jaoium) {
inventory.clear();
}
boolean enderjaoium = false;
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();
boolean _enderjaoium = isjaoium(potion.getCustomEffects());
if (_enderjaoium) {
setjaoiumItemData(player, hand);
enderchestinventory.clear(n);
enderjaoium = _enderjaoium;
if (isMalicious(potion) != null) {
malicious = isMalicious(potion);
}
}
}
}
if (enderjaoium) {
enderchestinventory.clear();
}
}
if (jaoium || enderjaoium) {
Bukkit.broadcastMessage("[jaoium_Checker] " + ChatColor.GREEN + "プレイヤー「" + player.getName() + "」からjaoiumと同等の性能を持つアイテムが検出されました。");
if (!Achievementjao.getAchievement(player, new AchievementType(13))) {
player.sendMessage(AchievementAPI.getPrefix() + "実績の解除中に問題が発生しました。もう一度お試しください。");
return;
}
checkjaoiumLocation(player);
try {
if (malicious != null) {
EBan.Add(player, Bukkit.getOfflinePlayer("jaotan"), "禁止クライアントMod「" + malicious + "」使用の疑い。方針「クライアントModの導入・利用に関する規則」の「禁止事項」への違反");
} else {
Jail.JailAdd(player, Bukkit.getOfflinePlayer("jaotan"), "jaoium所持", true);
}
} catch (ClassNotFoundException | NullPointerException | SQLException e) {
BugReporter(e);
} catch (EscapeJailException e) {
// EscapeJailアイテムで止められた
// 痛くもない雷を落とす
player.getWorld().strikeLightningEffect(player.getLocation());
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "EscapeJailアイテムによって、jaotanからの「jaoium所持」という理由によるJailを無効化しました!");
player.sendMessage("[jaoium_Checker] " + ChatColor.GREEN + "早くjaoiumを始末しよう!");
}
event.setCancelled(true);
}
}
Aggregations