mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-24 12:35:53 +01:00
1.3.3 Update
* Fix startup NPE with 1.8.8 and 1.12.2. * Fix another bug related to ghost claims. * Fix withers using owner for block break. * Fix ice being ignored. * Fix context exception when using wilderness in default/override flag definition. * Add support for multiple default/override contexts in flag definitions. * Move chat input handling to lowest event priority. * (Sponge) Fix debug not turning off properly. * (Sponge) Fix walk/fly speed checks by rounding result.
This commit is contained in:
parent
fa2b986f26
commit
cf2d6047cb
@ -384,10 +384,13 @@ private void deleteChunkHashes(GDClaim claim) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Long chunkHash : chunkHashes) {
|
for (Long chunkHash : chunkHashes) {
|
||||||
Set<Claim> claimsInChunk = this.getInternalChunksToClaimsMap().get(chunkHash);
|
Set<Claim> claimsInChunk = this.chunksToClaimsMap.get(chunkHash);
|
||||||
if (claimsInChunk != null) {
|
if (claimsInChunk != null) {
|
||||||
claimsInChunk.remove(claim);
|
claimsInChunk.remove(claim);
|
||||||
}
|
}
|
||||||
|
if (claimsInChunk.isEmpty()) {
|
||||||
|
this.chunksToClaimsMap.remove(chunkHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,21 +88,20 @@ public void initDefaults() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Set<Context> contexts = new HashSet<>(flagDefinition.getContexts());
|
Set<Context> contexts = new HashSet<>(flagDefinition.getContexts());
|
||||||
boolean shouldApply = false;
|
Set<Context> defaultContexts = new HashSet<>();
|
||||||
boolean isOverride = false;
|
Set<Context> overrideContexts = new HashSet<>();
|
||||||
String groupStr = null;
|
String groupStr = null;
|
||||||
final Iterator<Context> iterator = contexts.iterator();
|
final Iterator<Context> iterator = contexts.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final Context context = iterator.next();
|
final Context context = iterator.next();
|
||||||
if (context.getKey().equalsIgnoreCase("gd_claim_default")) {
|
if (context.getKey().equalsIgnoreCase("gd_claim_default")) {
|
||||||
shouldApply = true;
|
defaultContexts.add(context);
|
||||||
} else if (context.getKey().equalsIgnoreCase("gd_claim_override")) {
|
} else if (context.getKey().equalsIgnoreCase("gd_claim_override")) {
|
||||||
if (context.getValue().equalsIgnoreCase("claim")) {
|
if (context.getValue().equalsIgnoreCase("claim")) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
shouldApply = true;
|
overrideContexts.add(context);
|
||||||
isOverride = true;
|
|
||||||
} else if (context.getKey().equalsIgnoreCase("group")) {
|
} else if (context.getKey().equalsIgnoreCase("group")) {
|
||||||
groupStr = context.getValue();
|
groupStr = context.getValue();
|
||||||
}
|
}
|
||||||
@ -117,14 +116,19 @@ public void initDefaults() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (FlagData flagData : flagDefinition.getFlagData()) {
|
for (FlagData flagData : flagDefinition.getFlagData()) {
|
||||||
Set<Context> permissionContexts = new HashSet<>(contexts);
|
Set<Context> permissionContexts = new HashSet<>();
|
||||||
permissionContexts.addAll(flagData.getContexts());
|
permissionContexts.addAll(flagData.getContexts());
|
||||||
if (shouldApply) {
|
// apply defaults
|
||||||
if (isOverride) {
|
for (Context context : defaultContexts) {
|
||||||
PermissionUtil.getInstance().setPermissionValue(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
permissionContexts.add(context);
|
||||||
} else {
|
PermissionUtil.getInstance().setTransientPermission(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
||||||
PermissionUtil.getInstance().setTransientPermission(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
permissionContexts.remove(context);
|
||||||
}
|
}
|
||||||
|
// apply overrides
|
||||||
|
for (Context context : overrideContexts) {
|
||||||
|
permissionContexts.add(context);
|
||||||
|
PermissionUtil.getInstance().setPermissionValue(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
||||||
|
permissionContexts.remove(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,13 +144,13 @@ public FlagDefinition deserialize(TypeToken<?> type, ConfigurationNode node) thr
|
|||||||
final String value = parts[1];
|
final String value = parts[1];
|
||||||
if (key.equalsIgnoreCase("default") || key.equalsIgnoreCase("gd_claim_default")) {
|
if (key.equalsIgnoreCase("default") || key.equalsIgnoreCase("gd_claim_default")) {
|
||||||
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
||||||
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town")) {
|
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town") && !value.equalsIgnoreCase("wilderness")) {
|
||||||
throw new ObjectMappingException("Invalid context '" + key + "' with value '" + value + "'.");
|
throw new ObjectMappingException("Invalid context '" + key + "' with value '" + value + "'.");
|
||||||
}
|
}
|
||||||
contexts.add(new Context("gd_claim_default", value));
|
contexts.add(new Context("gd_claim_default", value));
|
||||||
} else if (key.equalsIgnoreCase("override") || key.equalsIgnoreCase("gd_claim_override")) {
|
} else if (key.equalsIgnoreCase("override") || key.equalsIgnoreCase("gd_claim_override")) {
|
||||||
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
||||||
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town") && !value.equalsIgnoreCase("claim")) {
|
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town") && !value.equalsIgnoreCase("claim") && !value.equalsIgnoreCase("wilderness")) {
|
||||||
// try UUID
|
// try UUID
|
||||||
if (value.length() == 36) {
|
if (value.length() == 36) {
|
||||||
try {
|
try {
|
||||||
|
@ -82,18 +82,22 @@ public void onRemoteServerCommand(RemoteServerCommandEvent event) {
|
|||||||
// CauseTracker.getInstance().getCauseStack().add(event.getSender());
|
// CauseTracker.getInstance().getCauseStack().add(event.getSender());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerChatPost(AsyncPlayerChatEvent event) {
|
public void onPlayerChatInput(AsyncPlayerChatEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||||
final Iterator<Player> iterator = event.getRecipients().iterator();
|
|
||||||
// check for command input
|
// check for command input
|
||||||
if (playerData.isWaitingForInput()) {
|
if (playerData.isWaitingForInput()) {
|
||||||
playerData.commandInput = event.getMessage();
|
playerData.commandInput = event.getMessage();
|
||||||
playerData.commandConsumer.accept(player);
|
playerData.commandConsumer.accept(player);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onPlayerChatPost(AsyncPlayerChatEvent event) {
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
final Iterator<Player> iterator = event.getRecipients().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final Player receiver = iterator.next();
|
final Player receiver = iterator.next();
|
||||||
|
@ -142,9 +142,15 @@ public void handleBlockModify(Event event, Object source, BlockState newState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(source instanceof Player) && user == null && !NMSUtil.getInstance().isBlockIce(newState.getType())) {
|
if (!(source instanceof Player) && user == null) {
|
||||||
// always allow
|
if (source instanceof Block) {
|
||||||
return;
|
if (!NMSUtil.getInstance().isBlockIce(((Block) source).getType())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// always allow
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, targetClaim, Flags.BLOCK_MODIFY, source, newState, user, TrustTypes.BUILDER, true);
|
final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, targetClaim, Flags.BLOCK_MODIFY, source, newState, user, TrustTypes.BUILDER, true);
|
||||||
|
@ -156,7 +156,7 @@ public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
|
|||||||
user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
|
user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (user == null) {
|
if (user == null && !NMSUtil.getInstance().isEntityMonster(event.getEntity())) {
|
||||||
final GDEntity gdEntity = EntityTracker.getCachedEntity(event.getEntity().getEntityId());
|
final GDEntity gdEntity = EntityTracker.getCachedEntity(event.getEntity().getEntityId());
|
||||||
if (gdEntity != null) {
|
if (gdEntity != null) {
|
||||||
user = PermissionHolderCache.getInstance().getOrCreateUser(gdEntity.getOwnerUUID());
|
user = PermissionHolderCache.getInstance().getOrCreateUser(gdEntity.getOwnerUUID());
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.12.2",
|
"name": "com.griefdefender:adapter:1.12.2",
|
||||||
"sha1": "73421d4599201a371858653a7d31c054eb972949",
|
"sha1": "ac5ae7a5dab7bbf4efda26d66cb99a4cd1e91a23",
|
||||||
"path": "com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20200607.224144-34.jar",
|
"path": "com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20200608.154737-35.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20200607.224144-34.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20200608.154737-35.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.13.2",
|
"name": "com.griefdefender:adapter:1.13.2",
|
||||||
"sha1": "78e6b190a71d1213632ed0c9eacb0017836e9a45",
|
"sha1": "a8b277590f2f2e4725c059f963109a232b5400e8",
|
||||||
"path": "com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20200607.224012-33.jar",
|
"path": "com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20200608.154648-34.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20200607.224012-33.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20200608.154648-34.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.14.2",
|
"name": "com.griefdefender:adapter:1.14.2",
|
||||||
"sha1": "49837d3d065b2e642d86a43d4106edf5e89c1f42",
|
"sha1": "9b698ff86706e3e2378b01f500d48e7dde3753fb",
|
||||||
"path": "com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20200607.223940-33.jar",
|
"path": "com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20200608.155146-34.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20200607.223940-33.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20200608.155146-34.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.14.3",
|
"name": "com.griefdefender:adapter:1.14.3",
|
||||||
"sha1": "bc12031edab59cdb998248a9048f225ec5bfbf34",
|
"sha1": "cd56f66cfb67cc151496a19a0788b4d868950d47",
|
||||||
"path": "com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20200607.223828-34.jar",
|
"path": "com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20200608.154518-35.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20200607.223828-34.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20200608.154518-35.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.14.4",
|
"name": "com.griefdefender:adapter:1.14.4",
|
||||||
"sha1": "fc030c3b3b95439abd341df479e297b183a2cf13",
|
"sha1": "83d35e56feb96ab9f88378ab97945be15a04ed3d",
|
||||||
"path": "com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20200607.223535-32.jar",
|
"path": "com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20200608.154430-33.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20200607.223535-32.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20200608.154430-33.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.15.2",
|
"name": "com.griefdefender:adapter:1.15.2",
|
||||||
"sha1": "2d8a21c18abae4184fb6bc80cad4175fe8cbdda6",
|
"sha1": "b9ba833d0305ea7e74074d664e1ecceee405aca8",
|
||||||
"path": "com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20200607.223430-13.jar",
|
"path": "com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20200608.154231-14.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20200607.223430-13.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20200608.154231-14.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.15",
|
"name": "com.griefdefender:adapter:1.15",
|
||||||
"sha1": "a20a6b8aa707a1e13333078cf10c49b64732e334",
|
"sha1": "b5f4c81abce44d0f12b488b1ff0dba4ec9ff81ba",
|
||||||
"path": "com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20200607.223501-14.jar",
|
"path": "com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20200608.154335-15.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20200607.223501-14.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20200608.154335-15.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"libraries": [
|
"libraries": [
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:adapter:1.8.8",
|
"name": "com.griefdefender:adapter:1.8.8",
|
||||||
"sha1": "0694300ced47831481d1bd01f91bc2a6ad180305",
|
"sha1": "9d183a6a2ec921d7907118e4e728c62554850c87",
|
||||||
"path": "com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20200607.174827-33.jar",
|
"path": "com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20200608.154829-34.jar",
|
||||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20200607.174827-33.jar"
|
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20200608.154829-34.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.griefdefender:api:1.0.0",
|
"name": "com.griefdefender:api:1.0.0",
|
||||||
|
@ -3,5 +3,5 @@ main: com.griefdefender.GDBootstrap
|
|||||||
softdepend: [dynmap, PlaceholderAPI, WorldEdit, WorldGuard, Vault]
|
softdepend: [dynmap, PlaceholderAPI, WorldEdit, WorldGuard, Vault]
|
||||||
depend: [LuckPerms]
|
depend: [LuckPerms]
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
version: '1.3.2'
|
version: '1.3.3'
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
name=GriefDefender
|
name=GriefDefender
|
||||||
group=com.griefdefender
|
group=com.griefdefender
|
||||||
url=https://github.com/bloodmc/GriefDefender
|
url=https://github.com/bloodmc/GriefDefender
|
||||||
version=1.3.2
|
version=1.3.3
|
||||||
apiVersion=1.0.0-20200528.202302-24
|
apiVersion=1.0.0-20200528.202302-24
|
||||||
# Bukkit
|
# Bukkit
|
||||||
adapterVersion=1.15.2-20200607.223430-13
|
adapterVersion=1.15.2-20200608.154231-14
|
||||||
spigotVersion=1.15.2-R0.1-SNAPSHOT
|
spigotVersion=1.15.2-R0.1-SNAPSHOT
|
||||||
# Sponge
|
# Sponge
|
||||||
adapterSpongeVersion=1.12.2-20200607.180353-5
|
adapterSpongeVersion=1.12.2-20200607.180353-5
|
||||||
|
@ -380,9 +380,12 @@ private void deleteChunkHashes(GDClaim claim) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Long chunkHash : chunkHashes) {
|
for (Long chunkHash : chunkHashes) {
|
||||||
Set<Claim> claimsInChunk = this.getInternalChunksToClaimsMap().get(chunkHash);
|
Set<Claim> claimsInChunk = this.chunksToClaimsMap.get(chunkHash);
|
||||||
if (claimsInChunk != null) {
|
if (claimsInChunk != null) {
|
||||||
claimsInChunk.remove(claim);
|
claimsInChunk.remove(claim);
|
||||||
|
if (claimsInChunk.isEmpty()) {
|
||||||
|
this.chunksToClaimsMap.remove(chunkHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public void execute(CommandSource src, String command, @Optional String filter)
|
|||||||
} else if (command.equalsIgnoreCase("paste")) {
|
} else if (command.equalsIgnoreCase("paste")) {
|
||||||
paste = true;
|
paste = true;
|
||||||
} else if (command.equalsIgnoreCase("off")) {
|
} else if (command.equalsIgnoreCase("off")) {
|
||||||
GriefDefenderPlugin.getInstance().getDebugUserMap().remove(src.getIdentifier());
|
GriefDefenderPlugin.getInstance().getDebugUserMap().remove(src.getName());
|
||||||
if (GriefDefenderPlugin.getInstance().getDebugUserMap().isEmpty()) {
|
if (GriefDefenderPlugin.getInstance().getDebugUserMap().isEmpty()) {
|
||||||
GriefDefenderPlugin.debugActive = false;
|
GriefDefenderPlugin.debugActive = false;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public void execute(CommandSource src, String command, @Optional String filter)
|
|||||||
|
|
||||||
if (debugData == null) {
|
if (debugData == null) {
|
||||||
if (paste) {
|
if (paste) {
|
||||||
debugData = GriefDefenderPlugin.getInstance().getDebugUserMap().get(src.getIdentifier());
|
debugData = GriefDefenderPlugin.getInstance().getDebugUserMap().get(src.getName());
|
||||||
if (debugData == null) {
|
if (debugData == null) {
|
||||||
TextAdapter.sendComponent(src, TextComponent.of("Nothing to paste!", TextColor.RED));
|
TextAdapter.sendComponent(src, TextComponent.of("Nothing to paste!", TextColor.RED));
|
||||||
} else {
|
} else {
|
||||||
@ -87,7 +87,7 @@ public void execute(CommandSource src, String command, @Optional String filter)
|
|||||||
.append("Debug ", TextColor.GRAY)
|
.append("Debug ", TextColor.GRAY)
|
||||||
.append("OFF", TextColor.RED)
|
.append("OFF", TextColor.RED)
|
||||||
.build());
|
.build());
|
||||||
GriefDefenderPlugin.getInstance().getDebugUserMap().remove(src.getIdentifier());
|
GriefDefenderPlugin.getInstance().getDebugUserMap().remove(src.getName());
|
||||||
if (GriefDefenderPlugin.getInstance().getDebugUserMap().isEmpty()) {
|
if (GriefDefenderPlugin.getInstance().getDebugUserMap().isEmpty()) {
|
||||||
GriefDefenderPlugin.debugActive = false;
|
GriefDefenderPlugin.debugActive = false;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ private GDDebugData getOrCreateDebugUser(CommandSource src, String filter, boole
|
|||||||
}
|
}
|
||||||
|
|
||||||
debugData = new GDDebugData(src, filter, verbose);
|
debugData = new GDDebugData(src, filter, verbose);
|
||||||
GriefDefenderPlugin.getInstance().getDebugUserMap().put(src.getIdentifier(), debugData);
|
GriefDefenderPlugin.getInstance().getDebugUserMap().put(src.getName(), debugData);
|
||||||
GriefDefenderPlugin.debugActive = true;
|
GriefDefenderPlugin.debugActive = true;
|
||||||
return debugData;
|
return debugData;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ public class ClaimCategory extends ConfigCategory {
|
|||||||
+ "\nNote: To disable, set value to '0'.")
|
+ "\nNote: To disable, set value to '0'.")
|
||||||
public int explosionCancelBlockLimit = 50;
|
public int explosionCancelBlockLimit = 50;
|
||||||
@Setting(value = "worldedit-schematics", comment = "Whether to use WorldEdit for schematics. Default: false"
|
@Setting(value = "worldedit-schematics", comment = "Whether to use WorldEdit for schematics. Default: false"
|
||||||
+ "\nNote: Sponge schematics do not support Entities. If you want entities, then you must set this to true to use WorldEdit instead."
|
|
||||||
+ "\nNote: If you were using schematics in older GD/GP versions and want old schematics to work then you should keep this setting disabled.")
|
+ "\nNote: If you were using schematics in older GD/GP versions and want old schematics to work then you should keep this setting disabled.")
|
||||||
public boolean useWorldEditSchematics = false;
|
public boolean useWorldEditSchematics = false;
|
||||||
@Setting(value = "auto-chest-claim-block-radius", comment = "Radius used (in blocks) for auto-created claim when a chest is placed. Set to -1 to disable chest claim creation.")
|
@Setting(value = "auto-chest-claim-block-radius", comment = "Radius used (in blocks) for auto-created claim when a chest is placed. Set to -1 to disable chest claim creation.")
|
||||||
|
@ -88,21 +88,20 @@ public void initDefaults() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Set<Context> contexts = new HashSet<>(flagDefinition.getContexts());
|
Set<Context> contexts = new HashSet<>(flagDefinition.getContexts());
|
||||||
boolean shouldApply = false;
|
Set<Context> defaultContexts = new HashSet<>();
|
||||||
boolean isOverride = false;
|
Set<Context> overrideContexts = new HashSet<>();
|
||||||
String groupStr = null;
|
String groupStr = null;
|
||||||
final Iterator<Context> iterator = contexts.iterator();
|
final Iterator<Context> iterator = contexts.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final Context context = iterator.next();
|
final Context context = iterator.next();
|
||||||
if (context.getKey().equalsIgnoreCase("gd_claim_default")) {
|
if (context.getKey().equalsIgnoreCase("gd_claim_default")) {
|
||||||
shouldApply = true;
|
defaultContexts.add(context);
|
||||||
} else if (context.getKey().equalsIgnoreCase("gd_claim_override")) {
|
} else if (context.getKey().equalsIgnoreCase("gd_claim_override")) {
|
||||||
if (context.getValue().equalsIgnoreCase("claim")) {
|
if (context.getValue().equalsIgnoreCase("claim")) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
shouldApply = true;
|
overrideContexts.add(context);
|
||||||
isOverride = true;
|
|
||||||
} else if (context.getKey().equalsIgnoreCase("group")) {
|
} else if (context.getKey().equalsIgnoreCase("group")) {
|
||||||
groupStr = context.getValue();
|
groupStr = context.getValue();
|
||||||
}
|
}
|
||||||
@ -117,14 +116,19 @@ public void initDefaults() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (FlagData flagData : flagDefinition.getFlagData()) {
|
for (FlagData flagData : flagDefinition.getFlagData()) {
|
||||||
Set<Context> permissionContexts = new HashSet<>(contexts);
|
Set<Context> permissionContexts = new HashSet<>();
|
||||||
permissionContexts.addAll(flagData.getContexts());
|
permissionContexts.addAll(flagData.getContexts());
|
||||||
if (shouldApply) {
|
// apply defaults
|
||||||
if (isOverride) {
|
for (Context context : defaultContexts) {
|
||||||
PermissionUtil.getInstance().setPermissionValue(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
permissionContexts.add(context);
|
||||||
} else {
|
PermissionUtil.getInstance().setTransientPermission(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
||||||
PermissionUtil.getInstance().setTransientPermission(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
permissionContexts.remove(context);
|
||||||
}
|
}
|
||||||
|
// apply overrides
|
||||||
|
for (Context context : overrideContexts) {
|
||||||
|
permissionContexts.add(context);
|
||||||
|
PermissionUtil.getInstance().setPermissionValue(holder, flagData.getFlag().getPermission(), flagDefinition.getDefaultValue(), permissionContexts);
|
||||||
|
permissionContexts.remove(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,13 +144,13 @@ public FlagDefinition deserialize(TypeToken<?> type, ConfigurationNode node) thr
|
|||||||
final String value = parts[1];
|
final String value = parts[1];
|
||||||
if (key.equalsIgnoreCase("default") || key.equalsIgnoreCase("gd_claim_default")) {
|
if (key.equalsIgnoreCase("default") || key.equalsIgnoreCase("gd_claim_default")) {
|
||||||
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
||||||
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town")) {
|
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town") && !value.equalsIgnoreCase("wilderness")) {
|
||||||
throw new ObjectMappingException("Invalid context '" + key + "' with value '" + value + "'.");
|
throw new ObjectMappingException("Invalid context '" + key + "' with value '" + value + "'.");
|
||||||
}
|
}
|
||||||
contexts.add(new Context("gd_claim_default", value));
|
contexts.add(new Context("gd_claim_default", value));
|
||||||
} else if (key.equalsIgnoreCase("override") || key.equalsIgnoreCase("gd_claim_override")) {
|
} else if (key.equalsIgnoreCase("override") || key.equalsIgnoreCase("gd_claim_override")) {
|
||||||
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
if (!value.equalsIgnoreCase("global") && !value.equalsIgnoreCase("basic") && !value.equalsIgnoreCase("admin")
|
||||||
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town") && !value.equalsIgnoreCase("claim")) {
|
&& !value.equalsIgnoreCase("subdivision") && !value.equalsIgnoreCase("town") && !value.equalsIgnoreCase("claim") && !value.equalsIgnoreCase("wilderness")) {
|
||||||
// try UUID
|
// try UUID
|
||||||
if (value.length() == 36) {
|
if (value.length() == 36) {
|
||||||
try {
|
try {
|
||||||
|
@ -631,7 +631,7 @@ private void checkPlayerFlySpeed(GDPermissionUser user, GDClaim fromClaim, GDCla
|
|||||||
}
|
}
|
||||||
|
|
||||||
final GDPlayerData playerData = user.getInternalPlayerData();
|
final GDPlayerData playerData = user.getInternalPlayerData();
|
||||||
final double currentFlySpeed = player.get(Keys.FLYING_SPEED).get();
|
final double currentFlySpeed = Math.round(player.get(Keys.FLYING_SPEED).get() * 100.0) / 100.0;
|
||||||
final double flySpeed = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Double.class), playerData.getSubject(), Options.PLAYER_FLY_SPEED, toClaim);
|
final double flySpeed = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Double.class), playerData.getSubject(), Options.PLAYER_FLY_SPEED, toClaim);
|
||||||
if (flySpeed <= 0) {
|
if (flySpeed <= 0) {
|
||||||
String configValue = GriefDefenderPlugin.getOptionConfig().getConfig().vanillaFallbackMap.get(Options.PLAYER_FLY_SPEED.getName().toLowerCase());
|
String configValue = GriefDefenderPlugin.getOptionConfig().getConfig().vanillaFallbackMap.get(Options.PLAYER_FLY_SPEED.getName().toLowerCase());
|
||||||
@ -679,7 +679,7 @@ private void checkPlayerWalkSpeed(GDPermissionUser user, GDClaim fromClaim, GDCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
final GDPlayerData playerData = user.getInternalPlayerData();
|
final GDPlayerData playerData = user.getInternalPlayerData();
|
||||||
final double currentWalkSpeed = player.get(Keys.WALKING_SPEED).get();
|
final double currentWalkSpeed = Math.round(player.get(Keys.WALKING_SPEED).get() * 100.0) / 100.0;
|
||||||
final double walkSpeed = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Double.class), playerData.getSubject(), Options.PLAYER_WALK_SPEED, toClaim);
|
final double walkSpeed = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Double.class), playerData.getSubject(), Options.PLAYER_WALK_SPEED, toClaim);
|
||||||
if (walkSpeed <= 0) {
|
if (walkSpeed <= 0) {
|
||||||
String configValue = GriefDefenderPlugin.getOptionConfig().getConfig().vanillaFallbackMap.get(Options.PLAYER_WALK_SPEED.getName().toLowerCase());
|
String configValue = GriefDefenderPlugin.getOptionConfig().getConfig().vanillaFallbackMap.get(Options.PLAYER_WALK_SPEED.getName().toLowerCase());
|
||||||
|
Loading…
Reference in New Issue
Block a user