Fix bad position on /f map, fixes #8
This commit is contained in:
parent
2a4777c4b1
commit
e4e1b666d2
@ -43,36 +43,36 @@ public class EngineMoveChunk extends Engine
|
|||||||
// ... gather info on the player and the move ...
|
// ... gather info on the player and the move ...
|
||||||
MPlayer mplayer = MPlayer.get(player);
|
MPlayer mplayer = MPlayer.get(player);
|
||||||
|
|
||||||
PS chunkFrom = PS.valueOf(event.getFrom()).getChunk(true);
|
PS psFrom = PS.valueOf(event.getFrom());
|
||||||
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
|
PS psTo = PS.valueOf(event.getTo());
|
||||||
|
|
||||||
// ... send info onwards and try auto-claiming.
|
// ... send info onwards and try auto-claiming.
|
||||||
sendChunkInfo(mplayer, player, chunkFrom, chunkTo);
|
sendChunkInfo(mplayer, player, psFrom, psTo);
|
||||||
tryAutoClaim(mplayer, chunkTo);
|
tryAutoClaim(mplayer, psTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// MOVE CHUNK: SEND CHUNK INFO
|
// MOVE CHUNK: SEND CHUNK INFO
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static void sendChunkInfo(MPlayer mplayer, Player player, PS chunkFrom, PS chunkTo)
|
private static void sendChunkInfo(MPlayer mplayer, Player player, PS psFrom, PS psTo)
|
||||||
{
|
{
|
||||||
sendAutoMapUpdate(mplayer, player);
|
sendAutoMapUpdate(mplayer, psTo);
|
||||||
sendFactionTerritoryInfo(mplayer, player, chunkFrom, chunkTo);
|
sendFactionTerritoryInfo(mplayer, player, psFrom, psTo);
|
||||||
sendTerritoryAccessMessage(mplayer, chunkFrom, chunkTo);
|
sendTerritoryAccessMessage(mplayer, psFrom, psTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendAutoMapUpdate(MPlayer mplayer, Player player)
|
private static void sendAutoMapUpdate(MPlayer mplayer, PS ps)
|
||||||
{
|
{
|
||||||
if (!mplayer.isMapAutoUpdating()) return;
|
if (!mplayer.isMapAutoUpdating()) return;
|
||||||
AsciiMap map = new AsciiMap(mplayer, player, false);
|
AsciiMap map = new AsciiMap(mplayer, ps, false);
|
||||||
mplayer.message(map.render());
|
mplayer.message(map.render());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendFactionTerritoryInfo(MPlayer mplayer, Player player, PS chunkFrom, PS chunkTo)
|
private static void sendFactionTerritoryInfo(MPlayer mplayer, Player player, PS psFrom, PS psTo)
|
||||||
{
|
{
|
||||||
Faction factionFrom = BoardColl.get().getFactionAt(chunkFrom);
|
Faction factionFrom = BoardColl.get().getFactionAt(psFrom);
|
||||||
Faction factionTo = BoardColl.get().getFactionAt(chunkTo);
|
Faction factionTo = BoardColl.get().getFactionAt(psTo);
|
||||||
|
|
||||||
if (factionFrom == factionTo) return;
|
if (factionFrom == factionTo) return;
|
||||||
|
|
||||||
@ -105,11 +105,11 @@ public class EngineMoveChunk extends Engine
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendTerritoryAccessMessage(MPlayer mplayer, PS chunkFrom, PS chunkTo)
|
private static void sendTerritoryAccessMessage(MPlayer mplayer, PS psFrom, PS psTo)
|
||||||
{
|
{
|
||||||
// Get TerritoryAccess for from & to chunks
|
// Get TerritoryAccess for from & to chunks
|
||||||
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(chunkFrom);
|
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(psFrom);
|
||||||
TerritoryAccess accessTo = BoardColl.get().getTerritoryAccessAt(chunkTo);
|
TerritoryAccess accessTo = BoardColl.get().getTerritoryAccessAt(psTo);
|
||||||
|
|
||||||
// See if the status has changed
|
// See if the status has changed
|
||||||
AccessStatus statusFrom = accessFrom.getTerritoryAccess(mplayer);
|
AccessStatus statusFrom = accessFrom.getTerritoryAccess(mplayer);
|
||||||
|
@ -9,7 +9,6 @@ import com.massivecraft.massivecore.mson.Mson;
|
|||||||
import com.massivecraft.massivecore.ps.PS;
|
import com.massivecraft.massivecore.ps.PS;
|
||||||
import com.massivecraft.massivecore.util.Txt;
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -18,9 +17,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import static com.massivecraft.massivecore.mson.Mson.EMPTY;
|
import static com.massivecraft.massivecore.mson.Mson.*;
|
||||||
import static com.massivecraft.massivecore.mson.Mson.SPACE;
|
|
||||||
import static com.massivecraft.massivecore.mson.Mson.mson;
|
|
||||||
|
|
||||||
public class AsciiMap
|
public class AsciiMap
|
||||||
{
|
{
|
||||||
@ -81,13 +78,18 @@ public class AsciiMap
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public AsciiMap(RelationParticipator relationParticipator, Player player, boolean extraHeight)
|
public AsciiMap(RelationParticipator relationParticipator, Player player, boolean extraHeight)
|
||||||
|
{
|
||||||
|
this(relationParticipator, PS.valueOf(player), extraHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AsciiMap(RelationParticipator relationParticipator, PS ps, boolean extraHeight)
|
||||||
{
|
{
|
||||||
this.relationParticipator = relationParticipator;
|
this.relationParticipator = relationParticipator;
|
||||||
Location location = player.getLocation();
|
this.angle = ps.getYaw();
|
||||||
this.angle = location.getYaw();
|
this.center = ps.getChunk(true);
|
||||||
this.center = PS.valueOf(location).getChunk(true);
|
|
||||||
this.height = extraHeight ? HEIGHT_EXTRA : HEIGHT;
|
this.height = extraHeight ? HEIGHT_EXTRA : HEIGHT;
|
||||||
this.heightHalf = extraHeight ? HEIGHT_EXTRA_HALF : HEIGHT_HALF;
|
this.heightHalf = extraHeight ? HEIGHT_EXTRA_HALF : HEIGHT_HALF;
|
||||||
this.topLeft = this.center.plusChunkCoords(-WIDTH_HALF, -this.heightHalf);
|
this.topLeft = this.center.plusChunkCoords(-WIDTH_HALF, -this.heightHalf);
|
||||||
|
Loading…
Reference in New Issue
Block a user