-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/unchama/master'
- Loading branch information
Showing
27 changed files
with
563 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/com/github/unchama/command/commands/HalfBlockProtectCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.github.unchama.command.commands; | ||
|
||
|
||
import com.github.unchama.gigantic.PlayerManager; | ||
import com.github.unchama.player.GiganticPlayer; | ||
import com.github.unchama.player.protect.HalfBlockProtectData; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabExecutor; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Y5ハーフブロック破壊可能フラグ変更コマンド | ||
* 権限を有する人のみ使用可能 | ||
* | ||
* @author karayuu | ||
*/ | ||
public class HalfBlockProtectCommand implements TabExecutor { | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender arg0, Command arg1, String arg2, String[] arg3) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { | ||
//プレイヤーからの送信ではない時終了 | ||
if(!(commandSender instanceof Player)){ | ||
commandSender.sendMessage(ChatColor.RED + "このコマンドはゲーム内から実行してください."); | ||
return false; | ||
} | ||
|
||
if (strings.length == 0) { | ||
// /halfguard 実行時 | ||
GiganticPlayer gp = PlayerManager.getGiganticPlayer((Player) commandSender); | ||
if (gp == null) { | ||
throw new NullPointerException("/HalfGuardコマンドData取得処理でnull.開発者に報告してください."); | ||
} | ||
HalfBlockProtectData data= gp.getManager(HalfBlockProtectData.class); | ||
|
||
data.toggleHalfBreakFlag(); | ||
commandSender.sendMessage("現在ハーフブロックは" + getStats(data.canBreakHalfBlock()) + ChatColor.RESET + "です."); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
private String getStats (Boolean canBreak) { | ||
if (canBreak) { | ||
return ChatColor.GREEN + "破壊可能"; | ||
} else { | ||
return ChatColor.RED + "破壊不可能"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/com/github/unchama/enchantment/enchantments/AntiKnockbackEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.unchama.enchantment.enchantments; | ||
|
||
import com.github.unchama.enchantment.GiganticEnchantment; | ||
import com.github.unchama.event.PlayerDamageWithArmorEvent; | ||
import com.github.unchama.gigantic.Gigantic; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Sound; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.util.Vector; | ||
|
||
/** | ||
* @author Mon_chi | ||
*/ | ||
public class AntiKnockbackEnchantment implements GiganticEnchantment { | ||
|
||
@Override | ||
public boolean onEvent(Event event, Player player, ItemStack item, int level) { | ||
if (event instanceof PlayerDamageWithArmorEvent) { | ||
System.out.println(player.getName()); | ||
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_PLACE, 3, 3); | ||
Bukkit.getScheduler().runTaskLater(Gigantic.plugin, () -> player.setVelocity(new Vector(0, 0, 0)), 1L); | ||
} | ||
return false; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/com/github/unchama/enchantment/enchantments/ChobaEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.github.unchama.enchantment.enchantments; | ||
|
||
import com.github.unchama.enchantment.GiganticEnchantment; | ||
import com.github.unchama.event.PlayerDamageWithArmorEvent; | ||
import com.github.unchama.event.SecondEvent; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.entity.EntityDamageEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.potion.PotionEffect; | ||
import org.bukkit.potion.PotionEffectType; | ||
|
||
/** | ||
* @author Mon_chi | ||
*/ | ||
public class ChobaEnchantment implements GiganticEnchantment { | ||
|
||
private int countFlag; | ||
|
||
public ChobaEnchantment() { | ||
this.countFlag = 0; | ||
} | ||
|
||
@Override | ||
public boolean onEvent(Event event, Player player, ItemStack item, int level) { | ||
if (event instanceof SecondEvent) { | ||
if (countFlag < 2) { | ||
this.countFlag += 1; | ||
} | ||
else { | ||
this.countFlag = 0; | ||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20 * 5, 2)); | ||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20 * 5, 2)); | ||
} | ||
} | ||
else if (event instanceof PlayerDamageWithArmorEvent) { | ||
EntityDamageEvent e = ((PlayerDamageWithArmorEvent) event).getOriginEvent(); | ||
if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { | ||
e.setDamage(e.getDamage() * 0.5); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/com/github/unchama/enchantment/enchantments/FuroFushiEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.github.unchama.enchantment.enchantments; | ||
|
||
import com.github.unchama.enchantment.GiganticEnchantment; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.entity.FoodLevelChangeEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
/** | ||
* @author Mon_chi | ||
*/ | ||
public class FuroFushiEnchantment implements GiganticEnchantment { | ||
|
||
@Override | ||
public boolean onEvent(Event event, Player player, ItemStack item, int level) { | ||
if (event instanceof FoodLevelChangeEvent) { | ||
if (((FoodLevelChangeEvent) event).getFoodLevel() < 7) { | ||
((FoodLevelChangeEvent) event).setFoodLevel(7); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/com/github/unchama/enchantment/enchantments/HangekiEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.unchama.enchantment.enchantments; | ||
|
||
import com.github.unchama.enchantment.GiganticEnchantment; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.entity.EntityDamageByEntityEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.util.Vector; | ||
|
||
/** | ||
* @author Mon_chi | ||
*/ | ||
public class HangekiEnchantment implements GiganticEnchantment { | ||
|
||
@Override | ||
public boolean onEvent(Event event, Player player, ItemStack item, int level) { | ||
if (event instanceof EntityDamageByEntityEvent) { | ||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event; | ||
if (e.getEntity() == player && e.getDamager() != player) { | ||
Vector direction = e.getDamager().getLocation().getDirection().normalize().multiply(10); | ||
direction.setX(-direction.getX()).setY(-direction.getY()).setZ(-direction.getZ()); | ||
e.getDamager().setVelocity(direction.add(e.getDamager().getVelocity())); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/com/github/unchama/enchantment/enchantments/ItazuraEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.unchama.enchantment.enchantments; | ||
|
||
import com.github.unchama.enchantment.GiganticEnchantment; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.entity.EntityDamageByEntityEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
/** | ||
* @author Mon_chi | ||
*/ | ||
public class ItazuraEnchantment implements GiganticEnchantment { | ||
|
||
@Override | ||
public boolean onEvent(Event event, Player player, ItemStack item, int level) { | ||
if (event instanceof EntityDamageByEntityEvent) { | ||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event; | ||
if (e.getDamager() == player && e.getEntity() instanceof LivingEntity && e.getEntityType() != EntityType.CHICKEN) { | ||
e.getEntity().remove(); | ||
e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.CHICKEN); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/com/github/unchama/enchantment/enchantments/KotueiEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.github.unchama.enchantment.enchantments; | ||
|
||
import com.github.unchama.enchantment.GiganticEnchantment; | ||
import com.github.unchama.util.Util; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.block.BlockBreakEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.potion.PotionEffect; | ||
import org.bukkit.potion.PotionEffectType; | ||
|
||
/** | ||
* @author Mon_chi | ||
*/ | ||
public class KotueiEnchantment implements GiganticEnchantment { | ||
@Override | ||
public boolean onEvent(Event event, Player player, ItemStack item, int level) { | ||
if (event instanceof BlockBreakEvent) { | ||
for (Entity entity : player.getNearbyEntities(20, 20, 20)) { | ||
if (entity.getType() == EntityType.SKELETON && !entity.isDead()) { | ||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 50, 4)); | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.