Skip to content

Commit

Permalink
Start integrating flags with event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cjburkey01 committed Aug 29, 2024
1 parent e5e2f55 commit 12c7d43
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 137 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/cjburkey/claimchunk/ClaimChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ public final class ClaimChunk extends JavaPlugin implements IClaimChunkPlugin {
@Getter private ChunkHandler chunkHandler;
// An instance of the player handler
@Getter private PlayerHandler playerHandler;
// An instance of the permission flag handler
@Getter private FlagHandler flagHandler;
// An instance of the rank handler
@Getter private RankHandler rankHandler;
// An instance of the world permissions manager
Expand All @@ -116,6 +114,8 @@ public final class ClaimChunk extends JavaPlugin implements IClaimChunkPlugin {
@Getter private ChunkOutlineHandler chunkOutlineHandler;
@Getter private CCGuiHandler guiHandler;

// An instance of the permission flag handler
@Getter private FlagHandler flagHandler;
@Getter private CCInteractClasses interactClasses;
@Getter private CCPermFlags permFlags;

Expand Down Expand Up @@ -288,7 +288,7 @@ public void onEnable() {

chunkHandler = new ChunkHandler(dataHandler, this);
playerHandler = new PlayerHandler(dataHandler, this);
flagHandler = new FlagHandler(dataHandler, this);
flagHandler = new FlagHandler(permFlags, dataHandler);

// As of version 0.0.23, the `ranks.json` file will be located in
// `/plugins/ClaimChunk` instead of `/plugins/ClaimChunk/data` to make
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public void unloadAllProfiles() {
&& Monster.class.isAssignableFrom(
entityType.getEntityClass()))
.forEach(monsters::add);
entityAccessMapping.put("MONSTERS", monsters);

// Add the hanging entities (item frames, leads, paintings)
HashSet<EntityType> hangingEntities = new HashSet<>();
Expand All @@ -258,6 +259,7 @@ public void unloadAllProfiles() {
&& Hanging.class.isAssignableFrom(
entityType.getEntityClass()))
.forEach(hangingEntities::add);
entityAccessMapping.put("HANGING_ENTITIES", hangingEntities);

// Add all animals
HashSet<EntityType> animals = new HashSet<>();
Expand All @@ -268,6 +270,7 @@ public void unloadAllProfiles() {
&& Animals.class.isAssignableFrom(
entityType.getEntityClass()))
.forEach(animals::add);
entityAccessMapping.put("ANIMALS", animals);

// Add mine-carts and boats
HashSet<EntityType> vehicles = new HashSet<>();
Expand All @@ -280,6 +283,7 @@ public void unloadAllProfiles() {
|| Boat.class.isAssignableFrom(
entityType.getEntityClass())))
.forEach(vehicles::add);
entityAccessMapping.put("VEHICLES", vehicles);

// Containers (Keep up to date? Need to work on this)
HashSet<EntityType> containers = new HashSet<>();
Expand All @@ -288,11 +292,6 @@ public void unloadAllProfiles() {
EntityType.CHEST_BOAT,
EntityType.CHEST_MINECART,
EntityType.HOPPER_MINECART);

entityAccessMapping.put("MONSTERS", monsters);
entityAccessMapping.put("HANGING_ENTITIES", hangingEntities);
entityAccessMapping.put("ANIMALS", animals);
entityAccessMapping.put("VEHICLES", vehicles);
entityAccessMapping.put("CONTAINER_ENTITIES", containers);

return entityAccessMapping;
Expand Down
Loading

0 comments on commit 12c7d43

Please sign in to comment.