Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reopen #66 #82

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import de.zoeyvid.stacker.loadLanguage;
import de.zoeyvid.stacker.main;
import org.bukkit.ChatColor;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.util.Vector;

public class EntityInteractListener implements Listener {

Expand All @@ -22,7 +24,13 @@ public void onEntityInteract(PlayerInteractEntityEvent event) {
}
} else {
if (player.getWorld().getPlayers().contains(target)) {
player.addPassenger(target);
ArmorStand placeholder = player.getWorld().spawn(player.getLocation(), ArmorStand.class);
placeholder.setVisible(false);
placeholder.setSmall(true);
placeholder.setRemoveWhenFarAway(true);
placeholder.addScoreboardTag("Stacker_Placeholder");
placeholder.addPassenger(target);
player.addPassenger(placeholder);
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/de/zoeyvid/stacker/Listener/ShiftListener.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.zoeyvid.stacker.Listener;

import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand All @@ -10,9 +12,11 @@ public class ShiftListener implements Listener {
@EventHandler
public void onShift(PlayerToggleSneakEvent event) {
Player player = event.getPlayer();
if (!player.getPassengers().equals(null)) {
player.eject();
player.eject();
for(Entity e : player.getWorld().getEntities()) {
if(!(e instanceof ArmorStand)) return;
e.getScoreboardTags().contains("Stacker_Placeholder");
}
}

}
}