Skip to content

Commit

Permalink
5.2.1 Version Bump - Add basic DuctPlaceEvent and DuctBreakEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackBeltPanda committed Aug 12, 2020
1 parent f9d0cb1 commit d83385a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.robotricker</groupId>
<artifactId>transportpipes</artifactId>
<version>5.2.0-SNAPSHOT</version>
<version>5.2.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>TransportPipes</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.robotricker.transportpipes.api;

import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class DuctBreakEvent extends Event {

Player player;
private static final HandlerList handlers = new HandlerList();

public DuctBreakEvent(Player player) {
super();
this.player = player;
}

@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}

public Player getPlayer() {
return player;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.robotricker.transportpipes.api;

import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class DuctPlaceEvent extends Event {

Player player;
private static final HandlerList handlers = new HandlerList();

public DuctPlaceEvent(Player player) {
super();
this.player = player;
}

@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}

public Player getPlayer() {
return player;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import de.robotricker.transportpipes.PlayerSettingsService;
import de.robotricker.transportpipes.ThreadService;
import de.robotricker.transportpipes.TransportPipes;
import de.robotricker.transportpipes.api.DuctBreakEvent;
import de.robotricker.transportpipes.api.DuctPlaceEvent;
import de.robotricker.transportpipes.config.GeneralConf;
import de.robotricker.transportpipes.config.LangConf;
import de.robotricker.transportpipes.duct.Duct;
Expand Down Expand Up @@ -279,6 +281,9 @@ else if (placeBlock == null || (clickedDuct != null && !manualPlaceable)) {
globalDuctManager.updateNeighborDuctsInRenderSystems(duct, true);

decreaseHandItem(interaction.p, interaction.hand);

DuctPlaceEvent event = new DuctPlaceEvent(interaction.p);
Bukkit.getPluginManager().callEvent(event);
} else {
LangConf.Key.PROTECTED_BLOCK.sendMessage(interaction.p);
}
Expand Down Expand Up @@ -321,6 +326,9 @@ else if (placeBlock == null || (clickedDuct != null && !manualPlaceable)) {
globalDuctManager.updateNeighborDuctsConnections(clickedDuct);
globalDuctManager.updateNeighborDuctsInRenderSystems(clickedDuct, true);
globalDuctManager.playDuctDestroyActions(clickedDuct, interaction.p);

DuctBreakEvent event = new DuctBreakEvent(interaction.p);
Bukkit.getPluginManager().callEvent(event);
}

interaction.cancel = true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: ${project.versionCode}
authors: [RoboTricker, BlackBeltPanda]
main: ${project.groupId}.${project.artifactId}.${project.name}
depend: [ProtocolLib]
api-version: 1.15
api-version: 1.16
permissions:
transportpipes.*:
children:
Expand Down

0 comments on commit d83385a

Please sign in to comment.