mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-13 10:54:32 +01:00
Fix claim visuals not reverting properly. Fixes #1
* Fix version. * Ignore '_nextClaimID' file during GP Bukkit migration.
This commit is contained in:
parent
8a8d4dd08c
commit
83b4596690
@ -180,8 +180,9 @@ public void revertActiveVisual(Player player) {
|
||||
this.visualRevertTask = null;
|
||||
}
|
||||
|
||||
GDClaim claim = null;
|
||||
if (this.visualClaimId != null) {
|
||||
GDClaim claim = (GDClaim) GriefDefenderPlugin.getInstance().dataStore.getClaim(this.worldUniqueId, this.visualClaimId);
|
||||
claim = (GDClaim) GriefDefenderPlugin.getInstance().dataStore.getClaim(this.worldUniqueId, this.visualClaimId);
|
||||
if (claim != null) {
|
||||
claim.playersWatching.remove(this.playerID);
|
||||
}
|
||||
@ -193,6 +194,13 @@ public void revertActiveVisual(Player player) {
|
||||
|
||||
for (int i = 0; i < this.visualBlocks.size(); i++) {
|
||||
BlockSnapshot snapshot = this.visualBlocks.get(i).getOriginal();
|
||||
// If original block does not exist, do not send to player
|
||||
if (NMSUtil.getInstance().getBlockData(snapshot.getLocation().getBlock()) != snapshot.getState()) {
|
||||
if (claim != null) {
|
||||
claim.markVisualDirty = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
NMSUtil.getInstance().sendBlockChange(player, snapshot);
|
||||
}
|
||||
}
|
||||
|
@ -189,15 +189,14 @@ public class GriefDefenderPlugin {
|
||||
public static final String MOD_ID = "GriefDefender";
|
||||
public static final String API_VERSION = GriefDefenderPlugin.class.getPackage().getSpecificationVersion();
|
||||
public static final String IMPLEMENTATION_NAME = GriefDefenderPlugin.class.getPackage().getImplementationTitle();
|
||||
public static final String IMPLEMENTATION_VERSION = GriefDefenderPlugin.class.getPackage().getImplementationVersion();
|
||||
public static String VERSION = "1.0.0";
|
||||
public static final String IMPLEMENTATION_VERSION = GriefDefenderPlugin.class.getPackage().getImplementationVersion() == null ? "unknown" : GriefDefenderPlugin.class.getPackage().getImplementationVersion();
|
||||
private Path configPath = Paths.get(".", "plugins", "GriefDefender");
|
||||
public MessageStorage messageStorage;
|
||||
public MessageDataConfig messageData;
|
||||
public Map<UUID, Random> worldGeneratorRandoms = new HashMap<>();
|
||||
public static ClaimBlockSystem CLAIM_BLOCK_SYSTEM;
|
||||
|
||||
public static final String CONFIG_HEADER = "1.0.0\n"
|
||||
public static final String CONFIG_HEADER = IMPLEMENTATION_VERSION + "\n"
|
||||
+ "# If you need help with the configuration or have any issues related to GriefDefender,\n"
|
||||
+ "# create a ticket on https://github.com/bloodmc/GriefDefender/issues.\n"
|
||||
+ "# Note: If you have not purchased GriefDefender, please consider doing so to get \n"
|
||||
|
@ -131,6 +131,7 @@ public class GDClaim implements Claim {
|
||||
private UUID ownerUniqueId;
|
||||
|
||||
public boolean cuboid = false;
|
||||
public boolean markVisualDirty = false;
|
||||
|
||||
protected ClaimStorageData claimStorage;
|
||||
protected IClaimData claimData;
|
||||
@ -243,8 +244,9 @@ public void setType(ClaimType type) {
|
||||
}
|
||||
|
||||
public ClaimVisual getVisualizer() {
|
||||
if (this.claimVisual == null) {
|
||||
if (this.claimVisual == null || this.markVisualDirty) {
|
||||
this.claimVisual = new ClaimVisual(this, ClaimVisual.getClaimVisualType(this));
|
||||
this.markVisualDirty = false;
|
||||
}
|
||||
return this.claimVisual;
|
||||
}
|
||||
|
@ -47,16 +47,10 @@ public class CommandGDVersion extends BaseCommand {
|
||||
@Subcommand("version")
|
||||
public void execute(CommandSender src) {
|
||||
|
||||
String version = GriefDefenderPlugin.IMPLEMENTATION_VERSION;
|
||||
if (version == null) {
|
||||
version = "unknown";
|
||||
}
|
||||
|
||||
Component gpVersion = TextComponent.builder("")
|
||||
.append(GriefDefenderPlugin.GD_TEXT)
|
||||
.append("Running ")
|
||||
// TODO : Use version from manifest
|
||||
.append("GriefDefender " + GriefDefenderPlugin.VERSION, TextColor.AQUA)
|
||||
.append("GriefDefender " + GriefDefenderPlugin.IMPLEMENTATION_VERSION, TextColor.AQUA)
|
||||
.build();
|
||||
Component bukkitVersion = TextComponent.builder("")
|
||||
.append(GriefDefenderPlugin.GD_TEXT)
|
||||
|
@ -526,6 +526,8 @@ public void onBlockBreak(BlockBreakEvent event) {
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(targetClaim, player, message);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
targetClaim.markVisualDirty = true;
|
||||
}
|
||||
|
||||
GDTimings.BLOCK_BREAK_EVENT.stopTiming();
|
||||
|
@ -76,6 +76,10 @@ public static void migrate(World world, Path gpClassicDataPath) throws FileNotFo
|
||||
int claimId = Integer.parseInt(file.getName().replaceFirst("[.][^.]+$", ""));
|
||||
idToUUID.put(claimId, UUID.randomUUID());
|
||||
} catch (NumberFormatException e) {
|
||||
if (file.getName().equalsIgnoreCase("_nextClaimID")) {
|
||||
// GP keeps track of next claim ID in this file so we can safely ignore the exception
|
||||
continue;
|
||||
}
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user