Skip to content

Commit

Permalink
gem classes formatting/chores and test auto update
Browse files Browse the repository at this point in the history
  • Loading branch information
FN-FAL113 committed Dec 8, 2023
1 parent 3b6be0e commit bcce7ee
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 62 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ne.fnfal113</groupId>
<artifactId>FNAmplifications</artifactId>
<version>Unoffical-4.1.3</version>
<version>Unoffical-4.1.4</version>
<packaging>jar</packaging>

<name>FNAmplifications</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onProjectileDamage(EntityDamageByEntityEvent event, Player shooter, LivingEntity entity, Projectile projectile, ItemStack itemStack) {
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}

if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId()) &&
(projectile.getLocation().getY() - entity.getLocation().getY()) < 0.5){
(projectile.getLocation().getY() - entity.getLocation().getY()) < 0.5) {
event.setDamage(event.getDamage() * 2.0);
sendGemMessage(shooter, this.getItemName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDurabilityChange(PlayerItemDamageEvent event) {
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(event.getItem(), this.getId())){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(event.getItem(), this.getId())) {
event.setCancelled(true);
sendGemMessage(event.getPlayer(), this.getItemName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(!(event.getEntity() instanceof LivingEntity)){
if(!(event.getEntity() instanceof LivingEntity)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack) {
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}

if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId()) &&
event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE){
event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
if(event.getEntity() instanceof Player) {
sendGemMessage((Player) event.getEntity(), this.getItemName());
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/ne/fnfal113/fnamplifications/gems/AtrohpyGem.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(!(event.getEntity() instanceof LivingEntity)){
if(!(event.getEntity() instanceof LivingEntity)) {
return;
}
if(!(event.getDamager() instanceof Player)){

if(!(event.getDamager() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand All @@ -55,7 +57,7 @@ public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){

int tier = getTier(itemStack, this.getId());

if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier) {
int level = Math.abs(tier - 4);

livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 80, level));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onPlayerDeath(PlayerDeathEvent event, ItemStack itemStack) {
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())) {
Player player = event.getEntity();
Location loc = player.getLocation();
Creeper creeper = player.getWorld().spawn(loc.clone(), Creeper.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onPlayerDeath(PlayerDeathEvent event, ItemStack itemStack) {
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())) {
Player player = event.getEntity();
Location loc = player.getLocation();

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/ne/fnfal113/fnamplifications/gems/BaneGem.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(!(event.getEntity() instanceof LivingEntity)){
if(!(event.getEntity() instanceof LivingEntity)) {
return;
}
if(!(event.getDamager() instanceof Player)){

if(!(event.getDamager() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand All @@ -55,7 +57,7 @@ public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){

int tier = getTier(itemStack, this.getId());

if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier) {
int level = Math.abs(tier - 4);

livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 80, level));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onProjectileDamage(EntityDamageByEntityEvent event, Player shooter, LivingEntity entity, Projectile projectile, ItemStack itemStack) {
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}

if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())) {
entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 2, true, false, false));
sendGemMessage(shooter, this.getItemName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(!(event.getEntity() instanceof Player)){
if(!(event.getEntity() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Player victim = (Player) event.getEntity();

int tier = getTier(itemStack, this.getId());

if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier) {
int level = Math.abs(tier - 4);

victim.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, level));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte
}

@Override
public void onRightClick(Player player){
public void onRightClick(Player player) {
if(!player.isSneaking()){
return;
}
if(!hasPermissionToThrow(player)){

if(!hasPermissionToThrow(player)) {
player.sendMessage(Utils.colorTranslator("&eYou don't have the permission to use damnation here! (Needs block interaction flag enabled)"));
return;
} // check if player has the permission to build on current location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack) {
if(!(event.getDamager() instanceof LivingEntity)){
if(!(event.getDamager() instanceof LivingEntity)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

LivingEntity damager = (LivingEntity) event.getDamager();

if(damager.getEquipment() == null){
if(damager.getEquipment() == null) {
return;
}

if(WeaponArmorEnum.AXES.isTagged(damager.getEquipment().getItemInMainHand().getType())){
if(WeaponArmorEnum.AXES.isTagged(damager.getEquipment().getItemInMainHand().getType())) {
if(ThreadLocalRandom.current().nextInt(100) < getChance() / getTier(itemStack, this.getId())){
event.setDamage(event.getDamage() * 0.75);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(!(event.getDamager() instanceof LivingEntity)){
if(!(event.getDamager() instanceof LivingEntity)) {
return;
}
if(!(event.getEntity() instanceof Player)){

if(!(event.getEntity() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand All @@ -56,7 +58,7 @@ public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){

int tier = getTier(itemStack, this.getId());

if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier) {
int level = Math.abs(tier - 4);

livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, level));
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/ne/fnfal113/fnamplifications/gems/DecrepitGem.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(!(event.getDamager() instanceof LivingEntity)){
if(!(event.getDamager() instanceof LivingEntity)) {
return;
}
if(!(event.getEntity() instanceof Player)){

if(!(event.getEntity() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand All @@ -56,7 +58,7 @@ public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){

int tier = getTier(itemStack, this.getId());

if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier){
if(ThreadLocalRandom.current().nextInt(100) < getChance() / tier) {
int level = Math.abs(tier - 4);

livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 80, level));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack) {
if(!(event.getEntity() instanceof Player)){
if(!(event.getEntity() instanceof Player)) {
return;
}
if(!(event.getDamager() instanceof Player)){

if(!(event.getDamager() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack) {
if(!(event.getEntity() instanceof Player)){
if(!(event.getEntity() instanceof Player)) {
return;
}
if(!(event.getDamager() instanceof Player)){

if(!(event.getDamager() instanceof Player)) {
return;
}
if(event.isCancelled()){

if(event.isCancelled()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onGuardianSpawn(GuardianSpawnEvent event, ItemStack itemStack){
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}

Expand Down
11 changes: 6 additions & 5 deletions src/main/java/ne/fnfal113/fnamplifications/gems/GuardianGem.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,22 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}
if(!(event.getEntity() instanceof Player)){

if(!(event.getEntity() instanceof Player)) {
return;
}

Player player = (Player) event.getEntity();

if(event.getDamager() instanceof Phantom || event.getDamager() instanceof Flying || event.getDamager() instanceof EnderDragon){
if(event.getDamager() instanceof Phantom || event.getDamager() instanceof Flying || event.getDamager() instanceof EnderDragon) {
return;
} // prevent guardian from attacking flying entities

if(runnableMap.containsKey(player.getUniqueId())){
if(runnableMap.get(player.getUniqueId()).isCancelled()){
if(runnableMap.containsKey(player.getUniqueId())) {
if(runnableMap.get(player.getUniqueId()).isCancelled()) {
entityUUIDMap.remove(player.getUniqueId());
runnableMap.remove(player.getUniqueId());
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onBlockBreak(BlockBreakEvent event, Player player, ItemStack itemStack){
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}

Block block = event.getBlock();

if(SlimefunTag.ORES.isTagged(block.getType()) || SlimefunTag.STONE_VARIANTS.isTagged(block.getType())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}
if(!(event.getEntity() instanceof Player)){

if(!(event.getEntity() instanceof Player)) {
return;
}
if(!(event.getDamager() instanceof LivingEntity)){

if(!(event.getDamager() instanceof LivingEntity)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ public void onDrag(Player player, SlimefunItem slimefunGemItem, ItemStack gemIte

@Override
public void onDamage(EntityDamageByEntityEvent event, ItemStack itemStack){
if(event.isCancelled()){
if(event.isCancelled()) {
return;
}
if(!(event.getEntity() instanceof LivingEntity)){

if(!(event.getEntity() instanceof LivingEntity)) {
return;
}

Expand Down
Loading

0 comments on commit bcce7ee

Please sign in to comment.