Skip to content

Commit

Permalink
Remove block highlights and protocollib (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 authored Jul 30, 2022
1 parent 379925a commit 0cf847b
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 1,040 deletions.
7 changes: 0 additions & 7 deletions modules/Movecraft/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@
<version>8.5.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.7.0</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import net.countercraft.movecraft.sign.StatusSign;
import net.countercraft.movecraft.sign.SubcraftRotateSign;
import net.countercraft.movecraft.sign.TeleportSign;
import net.countercraft.movecraft.util.BlockHighlight;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bukkit.Bukkit;
import org.bukkit.Material;
Expand Down Expand Up @@ -215,7 +214,6 @@ public void onEnable() {


getServer().getPluginManager().registerEvents(new InteractListener(), this);
getServer().getPluginManager().registerEvents(new BlockHighlight(), this);

getCommand("movecraft").setExecutor(new MovecraftCommand());
getCommand("release").setExecutor(new ReleaseCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.countercraft.movecraft.craft.type.CraftType;
import net.countercraft.movecraft.events.CraftReleaseEvent;
import net.countercraft.movecraft.localisation.I18nSupport;
import net.countercraft.movecraft.util.BlockHighlight;
import net.countercraft.movecraft.util.MathUtils;
import org.bukkit.Location;
import org.bukkit.Material;
Expand All @@ -47,7 +46,6 @@

public class PlayerListener implements Listener {
private final Map<Craft, Long> timeToReleaseAfter = new WeakHashMap<>();
private final Map<Craft, Queue<Integer>> highlights = new WeakHashMap<>();

private Set<Location> checkCraftBorders(Craft craft) {
Set<Location> mergePoints = new HashSet<>();
Expand Down Expand Up @@ -126,18 +124,14 @@ public void onPlayerMove(PlayerMoveEvent event) {
return;
}

highlights.computeIfAbsent(c, (craft) -> new LinkedList<>());

if(MathUtils.locationNearHitBox(c.getHitBox(), p.getLocation(), 2)){
timeToReleaseAfter.remove(c);
clearHighlights(c, p);
return;
}

if(timeToReleaseAfter.containsKey(c) && timeToReleaseAfter.get(c) < System.currentTimeMillis()){
CraftManager.getInstance().release(c, CraftReleaseEvent.Reason.PLAYER, false);
timeToReleaseAfter.remove(c);
clearHighlights(c, p);
return;
}

Expand All @@ -153,23 +147,7 @@ public void onPlayerMove(PlayerMoveEvent event) {
var mergePoints = checkCraftBorders(c);
if (!mergePoints.isEmpty())
p.sendMessage(I18nSupport.getInternationalisedString("Manoverboard - Craft May Merge"));
for (var location : mergePoints){
highlights.get(c).add(BlockHighlight.highlightBlockAt(location, p));
}
timeToReleaseAfter.put(c, System.currentTimeMillis() + c.getType().getIntProperty(CraftType.RELEASE_TIMEOUT) * 1000L);
}
}

@EventHandler
public void onCraftRelease(CraftReleaseEvent event) {
if(event.getCraft() instanceof PlayerCraft)
clearHighlights(event.getCraft(), ((PlayerCraft) event.getCraft()).getPilot());
}

private void clearHighlights(Craft craft, Player player) {
highlights.computeIfAbsent(craft, (c) -> new LinkedList<>());
var queue = highlights.get(craft);
BlockHighlight.removeHighlights(queue, player);
queue.clear();
}
}

This file was deleted.

1 change: 0 additions & 1 deletion modules/Movecraft/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Movecraft
version: ${project.version}
api-version: 1.14
depend: [ProtocolLib]
description: The original flight and movement plugin for minecraft.
authors: [cccm5, BaccaYarro, TylerS1066, eirik1996, drfiveminusmint, HumorousFool]
website: https://github.com/APDevTeam/Movecraft
Expand Down
6 changes: 0 additions & 6 deletions modules/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

Loading

0 comments on commit 0cf847b

Please sign in to comment.