本文整理汇总了Java中org.bukkit.entity.Player.removePotionEffect方法的典型用法代码示例。如果您正苦于以下问题:Java Player.removePotionEffect方法的具体用法?Java Player.removePotionEffect怎么用?Java Player.removePotionEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.removePotionEffect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resetPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
player.setLevel(0);
player.setExp(0);
player.setFoodLevel(20);
player.setHealth(20);
player.setHealthScale(20);
player.setExhaustion(0);
player.getInventory().clear();
ItemStack blankItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta blankMeta = blankItem.getItemMeta();
blankMeta.setDisplayName("" + ChatColor.RED);
blankItem.setItemMeta(blankMeta);
for(int i=9; i<=35; i++) {
player.getInventory().setItem(i, blankItem);
}
player.getInventory().setHelmet(new ItemStack(Material.AIR, 1));
player.getInventory().setChestplate(new ItemStack(Material.AIR, 1));
player.getInventory().setLeggings(new ItemStack(Material.AIR, 1));
player.getInventory().setBoots(new ItemStack(Material.AIR, 1));
for(PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
player.setFireTicks(0);
}
示例2: giveKit
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void giveKit(final Player p) {
Kit k = getKit(p);
p.getInventory().clear();
p.getInventory().setArmorContents(null);
for (ItemStack i : k.getItems()) {
int id = i.getType().getId();
if ((id < 298) || (317 < id))
p.getInventory().addItem(i);
else if ((id == 298) || (id == 302) || (id == 306) || (id == 310) || (id == 314))
p.getInventory().setHelmet(new ItemStack(id, 1));
else if ((id == 299) || (id == 303) || (id == 307) || (id == 311) || (id == 315))
p.getInventory().setChestplate(new ItemStack(id, 1));
else if ((id == 300) || (id == 304) || (id == 308) || (id == 312) || (id == 316))
p.getInventory().setLeggings(new ItemStack(id, 1));
else if ((id == 301) || (id == 305) || (id == 309) || (id == 313) || (id == 317))
p.getInventory().setBoots(new ItemStack(id, 1));
}
p.getInventory().addItem(new ItemStack(Material.COMPASS));
for (PotionEffect potion : p.getActivePotionEffects())
p.removePotionEffect(potion.getType());
}
示例3: cleanPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Clean player's inventory
*
* @param player Player
*/
public static void cleanPlayer(Player player)
{
if(player != null && Bukkit.getPlayer(player.getUniqueId()) != null)
{
player.getInventory().clear();
player.getInventory().setHelmet(null);
player.getInventory().setChestplate(null);
player.getInventory().setLeggings(null);
player.getInventory().setBoots(null);
player.setSaturation(20.0F);
player.setHealth(player.getMaxHealth());
player.setExp(0.0F);
player.setLevel(0);
for(PotionEffect potionEffect : player.getActivePotionEffects())
player.removePotionEffect(potionEffect.getType());
}
}
示例4: onConsume
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onConsume(PlayerItemConsumeEvent event)
{
if(event.isCancelled()) return;
Player player = event.getPlayer();
if(event.getItem().getType() == Material.BEETROOT)
{
int amp = 0;
int dur = 200;
for (PotionEffect effect : player.getActivePotionEffects())
{
if(effect.getType().equals(PotionEffectType.INCREASE_DAMAGE))
{
dur += effect.getDuration();
if(dur > 600) dur = 600;
player.removePotionEffect(effect.getType());
}
}
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, dur, amp));
}
}
示例5: playerDeath
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void playerDeath(PlayerDeathEvent e) {
Player player = (Player) e.getEntity();
if (player.getKiller() instanceof Player) {
Bukkit.broadcastMessage(ChatColor.GREEN + player.getKiller().getName() + ChatColor.DARK_GRAY + " has killed " + ChatColor.GREEN + player.getName());
for (PotionEffect effect : player.getActivePotionEffects())
player.removePotionEffect(effect.getType());
Datafiles.addDeath(player.getName());
Datafiles.addKill(player.getKiller().getName());
}else{
Datafiles.addDeath(player.getName());
}
}
示例6: unfreeze
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void unfreeze(Player player) {
player.removePotionEffect(PotionEffectType.JUMP);
player.removePotionEffect(PotionEffectType.SLOW);
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 50000, 1, true, false));
}
示例7: removeStealth
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void removeStealth(Player p) {
Spell.notify(p, "You are no longer stealthed.");
invis.remove(p);
for(Player p2 : plugin.getServer().getOnlinePlayers())
p2.showPlayer(p);
p.removePotionEffect(PotionEffectType.INVISIBILITY);
RParticles.showWithOffset(ParticleEffect.CLOUD, p.getLocation().add(0, p.getEyeHeight() * 0.7, 0), 1.0, 15);
}
示例8: removeStealth
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void removeStealth() {
if (!isStealthed())
return;
stealthCounter++;
stealthed = false;
Player p = getPlayer();
if (p != null && p.isValid()) {
StealthManager.removeStealth(p);
for (PotionEffect pe : p.getActivePotionEffects())
p.removePotionEffect(pe.getType());
}
}
示例9: handleTimedEffects
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Adding potion effects to ability items
* @param player The player
* @param item The item with ability
*/
private void handleTimedEffects(Player player, ItemStack item) {
if(item == null)
return;
if(!plugin.getAbilityManager().hasAbility(item))
return;
Ability ability = plugin.getAbilityManager().getAbility(item);
PotionEffectType type;
switch(ability.getName()) {
case "Haste":
type = PotionEffectType.FAST_DIGGING;
break;
case "High Jump":
type = PotionEffectType.JUMP;
break;
case "Speed":
type = PotionEffectType.SPEED;
break;
default:
return;
}
if(player.hasPotionEffect(type)) {
player.removePotionEffect(type);
}
player.addPotionEffect(new PotionEffect(type, 60, 1));
}
示例10: onWorldChanged
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onWorldChanged(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
World from = event.getFrom();
World to = player.getWorld();
if (from.getEnvironment() != World.Environment.THE_END && to.getEnvironment() == World.Environment.THE_END && player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
}
}
示例11: removeSpectator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void removeSpectator(Player player) {
player.setFoodLevel(20);
player.setLevel(0);
player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(false);
player.setExp(0);
player.setHealthScale(20);
player.setHealth(20);
player.setTotalExperience(0);
player.setCanPickupItems(false);
for (PotionEffect eff : player.getActivePotionEffects()) {
player.removePotionEffect(eff.getType());
}
if (PREFIXES.containsKey(player.getName())) {
player.setCustomName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
player.setPlayerListName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
player.setDisplayName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
player.setCustomNameVisible(true);
}
for (Player p : Bukkit.getOnlinePlayers()) {
p.showPlayer(player);
}
PlayerUtil.removeDeadPlayer(player);
}
示例12: onConsume
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onConsume(PlayerItemConsumeEvent event)
{
if(event.isCancelled()) return;
Random rand = new Random();
Player player = event.getPlayer();
switch(event.getItem().getType())
{
case RAW_BEEF:
case PORK:
case MUTTON:
case RAW_FISH:
case RAW_CHICKEN:
case ROTTEN_FLESH:
int hungerChance = rand.nextInt(10) + 1;
if(hungerChance >= 1 && hungerChance <= 8)
{
int dur = 600;
for (PotionEffect effect : player.getActivePotionEffects())
{
if(effect.getType().equals(PotionEffectType.HUNGER))
{
dur += effect.getDuration();
player.removePotionEffect(effect.getType());
}
}
player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, dur, 0, false));
}
break;
default:
}
}
示例13: onConsume
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onConsume(PlayerItemConsumeEvent event)
{
if(event.isCancelled()) return;
Player player = event.getPlayer();
if(event.getItem().getType() == Material.COOKIE)
{
int amp = -1;
int dur = 600;
for (PotionEffect effect : player.getActivePotionEffects())
{
if(effect.getType().equals(PotionEffectType.HEALTH_BOOST))
{
dur += effect.getDuration();
if(effect.getDuration() >= 300)
amp++;
if(effect.getDuration() >= 1200)
amp++;
if(effect.getDuration() >= 3600)
amp++;
player.removePotionEffect(effect.getType());
}
}
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, dur, amp));
player.setSaturation(player.getSaturation() + 4.6f);
}
}
示例14: onStart
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onStart(GameStartEvent event) {
for (UUID uuid : OpenUHC.getCurrentGame().getPlayers()) {
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
for (PotionEffect effect : EFFECTS) {
player.removePotionEffect(effect.getType());
}
}
}
}
示例15: setSpectator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void setSpectator(Player player, String prefix, Location spawn) {
if (!PREFIXES.containsKey(player.getName()))
PREFIXES.put(player.getName(), prefix);
player.setFoodLevel(20);
player.setLevel(0);
player.setGameMode(GameMode.ADVENTURE);
player.setAllowFlight(true);
player.setPlayerListName(prefix + player.getDisplayName());
player.setDisplayName(prefix + player.getDisplayName());
player.setExp(0);
player.setHealthScale(20);
player.setHealth(20);
player.setTotalExperience(0);
player.setCanPickupItems(false);
player.setCustomName(prefix + player.getDisplayName());
player.setCustomNameVisible(true);
for (PotionEffect eff : player.getActivePotionEffects()) {
player.removePotionEffect(eff.getType());
}
player.teleport(spawn);
for (Player p : Bukkit.getOnlinePlayers()) {
p.hidePlayer(player);
}
PlayerUtil.addDeadPlayer(player);
}