Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Update 2.4.8
Browse files Browse the repository at this point in the history
Hello @everyone!
Mise à jour du plugin en version **2.4.8**, disponible comme d'habite grâce à un /reload ou sur le site internet.

Voici la liste des changements:

**FIX**:
> Changement de la méthode de chute du coffre du parachute, le jeu ne freeze plus lorsque le parachute se casse

> Après un /resume, tous les joueurs étaient TP dans leur base avec inventaire clear

> Le rôle soutien n'apportait pas de soin à ses coéquipiers

> Le coffre à la mort pouvait ne pas apparaitre ou être vide

> Lors de la mort d'un joueur dans le vide, son coffre de mort apparaissait dans le vide ce qui pouvait le rendre inaccessible

> Ajout métric

**META**:

> Le rôle enchanteur garde désormais son XP à la mort
  • Loading branch information
BuildTools committed Aug 28, 2020
1 parent 389c85a commit ff5df17
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 15 deletions.
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>org.apache.maven.plugins</groupId>
<artifactId>MineralContest</artifactId>
<version>2.4.7.1</version>
<version>2.4.8</version>
<packaging>jar</packaging>

<name>Mineral Contest</name>
Expand Down
81 changes: 68 additions & 13 deletions src/main/java/fr/synchroneyes/mineral/Core/Parachute/Parachute.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public class Parachute implements Listener {
// Falling start location, used to check if falling block is from the parachute (from event)
private Location fallingStartLocation;

// ArmorStand, used when falling
private ArmorStand armorStand;

private Vector armorStandVelocity;


/**
* Constructeur, prend en paramètre la santé que doit avoir le parachute
Expand Down Expand Up @@ -312,15 +317,12 @@ private void breakParachute() {
armorStand.setSmall(true);
armorStand.setArms(false);
this.fallingStartLocation = dropLocation;
this.armorStand = armorStand;

/*Bukkit.broadcastMessage("FALLING !!");
FallingBlock fallingBlock = currentWorld.spawnFallingBlock(dropLocation, armorStand);
fallingBlock.setInvulnerable(true);
fallingBlock.setDropItem(false);
fallingBlock.setGlowing(true);
fallingBlock.setVelocity(new Vector(0, -0.1, 0));
this.isParachuteBroken = true;

this.parachuteLoop = Bukkit.getScheduler().runTaskTimer(mineralcontest.plugin, this::doChestFallingTickWhenParachuteIsBroken, 0, 1);

currentWorld.spawnEntity(dropLocation, fallingBlock);*/

}
}
Expand Down Expand Up @@ -523,16 +525,15 @@ public void run() {

int tickActuel = ticks.incrementAndGet();

if(isParachuteBroken) doChestFallingTickWhenParachuteIsBroken();

// Si on est sur un tick où il faut faire descendre le parachute
//if (tickActuel % currentFallingSpeed == 0) {
if (tickActuel % currentFallingSpeed == 0) {

//if (isParachuteBroken) {
/*makeChestGoDown();
} else makeParachuteGoDown(true);*/
if (isParachuteBroken) {
makeChestGoDown();
} else makeParachuteGoDown(true);

//}
}
}
}.runTaskTimer(mineralcontest.plugin, 0, 1);

Expand Down Expand Up @@ -575,6 +576,60 @@ private void playSoundOnChest(Sound effect) {
*/
private void doChestFallingTickWhenParachuteIsBroken() {


if(armorStandVelocity == null) {
this.armorStandVelocity = this.armorStand.getVelocity();
return;
}


// Si l'armorstand est null, on s'arrête
if(armorStand == null) {
Bukkit.getLogger().info("ArmorStand is null!");
parachuteLoop.cancel();
parachuteLoop = null;
return;
}


// On vérifie la vélocité de l'armorstand
if(this.armorStandVelocity.equals(this.armorStand.getVelocity())) {
parachuteLoop.cancel();
parachuteLoop = null;

// On récupère la position au sol du drop
Location feltLocation = this.armorStand.getLocation();


// On descend jusqu'au sol, tant que le bloc en dessous est de l'air
while(feltLocation.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) {
// On change la position pour prendre le bloc du dessous
int y = feltLocation.getBlockY();
y--;
feltLocation.setY(y);
}

// On supprime l'armorStand
this.armorStand.remove();

// On spawn le coffre
this.coffre.setChestLocation(feltLocation);
this.coffre.spawn();

return;
}

// On update la velocité
this.armorStandVelocity = this.armorStand.getVelocity();

Location particleLocation = this.armorStand.getLocation().clone();

particleLocation.setY(particleLocation.getY() + 5);

// On fait spawn des particules pour l'effet de chute
//this.armorStand.getLocation().getWorld().spawnParticle(Particle.REDSTONE, this.armorStand.getLocation(), 10, 0.000, 0, 0, 0, new Particle.DustOptions(Color.BLACK, 10));
this.armorStand.getLocation().getWorld().spawnParticle(Particle.SMOKE_LARGE, this.armorStand.getLocation(), 10, 0.000, 0, 0, 0);

}


Expand Down
16 changes: 16 additions & 0 deletions src/main/java/fr/synchroneyes/mineral/Events/GameEnd.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package fr.synchroneyes.mineral.Events;

import fr.synchroneyes.custom_events.MCGameEndEvent;
import fr.synchroneyes.mineral.Utils.Metric.SendInformation;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

import java.util.List;

public class GameEnd implements Listener {

@EventHandler
public void onGameEnd(MCGameEndEvent endEvent) {
SendInformation.sendGameData(SendInformation.ended, endEvent.getGame());
}
}
14 changes: 14 additions & 0 deletions src/main/java/fr/synchroneyes/mineral/Events/GameStart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package fr.synchroneyes.mineral.Events;

import fr.synchroneyes.custom_events.MCGameStartedEvent;
import fr.synchroneyes.mineral.Utils.Metric.SendInformation;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class GameStart implements Listener {

@EventHandler
public void onGameStart(MCGameStartedEvent event) {
SendInformation.sendGameData(SendInformation.start, event.getGame());
}
}
7 changes: 6 additions & 1 deletion src/main/java/fr/synchroneyes/mineral/mineralcontest.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ private void registerEvents() {
// Drop
Bukkit.getServer().getPluginManager().registerEvents(new ParachuteHitDetection(), this);

// Metric
Bukkit.getServer().getPluginManager().registerEvents(new GameStart(), this);
Bukkit.getServer().getPluginManager().registerEvents(new GameEnd(), this);


// AutomatedChest
//Bukkit.getServer().getPluginManager().registerEvents(new ChestOpenEvent(), this);

Expand Down Expand Up @@ -404,7 +409,7 @@ private void registerCommands() {

//bukkitCommandMap.register("", new SpawnDrop());
bukkitCommandMap.register("", new McStats());
bukkitCommandMap.register("", new ArmorStandCommand());
//bukkitCommandMap.register("", new ArmorStandCommand());


//bukkitCommandMap.register("", new OuvrirMenuShop());
Expand Down

0 comments on commit ff5df17

Please sign in to comment.