Merge pull request 'Fixing Loader String Double Activation' (#159) from loader_string_interaction into master
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
230de54cbf
@ -83,5 +83,5 @@ public class Detoloader {
|
|||||||
public static final int WOODEN_BUTTON = 30;
|
public static final int WOODEN_BUTTON = 30;
|
||||||
public static final int PRESSURE_PLATE = 20;
|
public static final int PRESSURE_PLATE = 20;
|
||||||
public static final int NOTE_BLOCK = 1;
|
public static final int NOTE_BLOCK = 1;
|
||||||
public static final int TRIPWIRE = 10;
|
public static final int TRIPWIRE = 20;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.world;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
|
import de.steamwar.core.VersionedCallable;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -64,6 +65,7 @@ public class AutoLoader extends IAutoLoader implements Listener {
|
|||||||
private int waitTicks;
|
private int waitTicks;
|
||||||
private ListIterator<LoaderAction> lastAction;
|
private ListIterator<LoaderAction> lastAction;
|
||||||
private boolean setup;
|
private boolean setup;
|
||||||
|
private Location lastLocation;
|
||||||
|
|
||||||
private AutoLoader(Player player){
|
private AutoLoader(Player player){
|
||||||
this.player = player;
|
this.player = player;
|
||||||
@ -163,28 +165,28 @@ public class AutoLoader extends IAutoLoader implements Listener {
|
|||||||
if (event.getPlayer().isSneaking())
|
if (event.getPlayer().isSneaking())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!setup || !event.getPlayer().equals(player))
|
if (!setup || !event.getPlayer().equals(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Detoloader detoloader = null;
|
Detoloader detoloader = VersionedCallable.call(
|
||||||
switch(Core.getVersion()){
|
new VersionedCallable<>(() -> AutoLoader_12.onPlayerInteractLoader(event), 12),
|
||||||
case 15:
|
new VersionedCallable<>(() -> AutoLoader_15.onPlayerInteractLoader(event), 15));
|
||||||
detoloader = AutoLoader_15.onPlayerInteractLoader(event);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
detoloader = AutoLoader_12.onPlayerInteractLoader(event);
|
|
||||||
|
|
||||||
}
|
if (detoloader == null || detoloader.getActivation() < 0) return;
|
||||||
if(detoloader == null || detoloader.getActivation() < 0) return;
|
|
||||||
if(detoloader.useActive)
|
if (lastLocation != null && lastLocation.distance(event.getClickedBlock().getLocation()) <= 1) return;
|
||||||
|
|
||||||
|
if (detoloader.useActive) {
|
||||||
new IAutoLoader.RedstoneActivation(this, event.getClickedBlock().getLocation()
|
new IAutoLoader.RedstoneActivation(this, event.getClickedBlock().getLocation()
|
||||||
, detoloader.getActivation() == 0 ? getLastActivation() : detoloader.getActivation()
|
, detoloader.getActivation() == 0 ? getLastActivation() : detoloader.getActivation()
|
||||||
, detoloader.isActive());
|
, detoloader.isActive());
|
||||||
else
|
} else {
|
||||||
new IAutoLoader.TemporaryActivation(this, event.getClickedBlock().getLocation()
|
new IAutoLoader.TemporaryActivation(this, event.getClickedBlock().getLocation()
|
||||||
, detoloader.getActivation());
|
, detoloader.getActivation());
|
||||||
|
}
|
||||||
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " betätigt" :
|
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " betätigt" :
|
||||||
detoloader.getBlock(), detoloader.addBack);
|
detoloader.getBlock(), detoloader.addBack);
|
||||||
|
lastLocation = event.getClickedBlock().getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren