Skip to content

Commit 9caa8e4

Browse files
committed
refactor: remove useless info from ECS systems guide
1 parent a94ad15 commit 9caa8e4

1 file changed

Lines changed: 4 additions & 27 deletions

File tree

content/docs/en/guides/ecs/systems.mdx

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,51 +115,28 @@ public class PermissionAttachmentSystem extends RefChangeSystem<EntityStore, Per
115115
return EntityStoreRegistry.get().getPermissionAttachmentComponentType();
116116
}
117117

118-
private PermissibleProvider getProvider() {
119-
for (PermissionProvider provider : PermissionsModule.get().getProviders()) {
120-
if (provider instanceof PermissibleProvider) {
121-
return (PermissibleProvider) provider;
122-
}
123-
}
124-
LOGGER.atWarning().log("PermissibleProvider not found in PermissionsModule!");
125-
return null;
126-
}
127-
128118
@Override
129119
public void onComponentAdded(@Nonnull Ref<EntityStore> ref, @Nonnull PermissionAttachment permissionAttachment, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer) {
130120
UUIDComponent component = store.getComponent(ref, UUIDComponent.getComponentType());
131121
UUID playerUuid = component.getUuid();
132122

133-
PermissibleProvider provider = getProvider();
134-
if (provider != null) {
135-
provider.updateCache(playerUuid, permissionAttachment.getPermissions(), permissionAttachment.getGroups());
136-
}
123+
// PermissionAttachment component was added to a new entity
137124
}
138125

139126
@Override
140127
public void onComponentSet(@Nonnull Ref<EntityStore> ref, @Nullable PermissionAttachment oldAttachment, @Nonnull PermissionAttachment newAttachment, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer) {
141128
UUIDComponent component = store.getComponent(ref, UUIDComponent.getComponentType());
142129
UUID playerUuid = component.getUuid();
143130

144-
PermissionRepository repository = PermissiblePlugin.getInstance().getInternalPermissionRepository();
145-
repository.savePlayerPermissions(playerUuid, newAttachment.getPermissions());
146-
repository.savePlayerGroups(playerUuid, newAttachment.getGroups());
147-
148-
PermissibleProvider provider = getProvider();
149-
if (provider != null) {
150-
provider.updateCache(playerUuid, newAttachment.getPermissions(), newAttachment.getGroups());
151-
}
131+
// PermissionAttachment component was updated using replaceComponent or putComponent
152132
}
153133

154134
@Override
155135
public void onComponentRemoved(@Nonnull Ref<EntityStore> ref, @Nonnull PermissionAttachment permissionAttachment, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer) {
156136
UUIDComponent component = store.getComponent(ref, UUIDComponent.getComponentType());
157137
UUID playerUuid = component.getUuid();
158138

159-
PermissibleProvider provider = getProvider();
160-
if (provider != null) {
161-
provider.removeFromCache(playerUuid);
162-
}
139+
// PermissionAttachment component was removed from an entity
163140
}
164141

165142
@Nullable
@@ -171,7 +148,7 @@ public class PermissionAttachmentSystem extends RefChangeSystem<EntityStore, Per
171148
```
172149

173150
In this system we listen for changes on the `PermissionAttachment` component inside of the `EntityStore`. This gives us access to `onComponentAdded`, `onComponentSet` and `onComponentRemoved` which in this example caches and persists permission data
174-
which is stored on a player inside of a custom `PermissionAttachment` component. This example comes from [Permissible](https://github.com/oskarscot/Permissible) permissions plugin where you can find more examples of heavy ECS usage.
151+
which is stored on a player inside of a custom `PermissionAttachment` component.
175152

176153

177154

0 commit comments

Comments
 (0)