-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9969594
commit cdbb1e6
Showing
2 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
package com.cjburkey.claimchunk.flags; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
/** | ||
* Permission flag stuff | ||
* | ||
* @since 0.0.26 | ||
*/ | ||
public class PermFlag { | ||
|
||
// TODO: INCLUDE BLOCK/ENTITY PROTECTIONS | ||
|
||
|
||
} |
69 changes: 67 additions & 2 deletions
69
src/main/java/com/cjburkey/claimchunk/flags/PermFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,79 @@ | ||
package com.cjburkey.claimchunk.flags; | ||
|
||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import java.io.File; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
/** | ||
* Keeps track of loading the permission flags specified in the flags.yml | ||
* configuration file. | ||
* | ||
* @since 0.0.26 | ||
*/ | ||
public class PermFlags { | ||
|
||
private final JavaPlugin plugin; | ||
private final File defaultFlagsFile; | ||
private final String defaultFlagsResource; | ||
private final File flagsFile; | ||
private final HashMap<String, PermFlag> flagMap = new HashMap<>(); | ||
private final HashMap<String, BlockFlagData> blockControls = new HashMap<>(); | ||
private final HashMap<String, EntityFlagData> entityControls = new HashMap<>(); | ||
|
||
public PermFlags(File flagsFile) { | ||
public PermFlags(JavaPlugin plugin, File defaultFlagsFile, String defaultFlagsResource, File flagsFile) { | ||
this.plugin= plugin; | ||
this.defaultFlagsFile = defaultFlagsFile; | ||
this.defaultFlagsResource = defaultFlagsResource; | ||
this.flagsFile = flagsFile; | ||
} | ||
|
||
public void load() { | ||
// TODO: | ||
} | ||
|
||
// -- CLASSES -- // | ||
|
||
public static final class FlagData { | ||
public boolean isListInclude; | ||
public List<String> list; | ||
|
||
public FlagData(boolean isListInclude, List<String> list) { | ||
this.isListInclude = isListInclude; | ||
this.list = list; | ||
} | ||
} | ||
|
||
public enum BlockFlagType { | ||
BREAK, | ||
PLACE, | ||
INTERACT, | ||
EXPLODE, | ||
} | ||
|
||
public static class BlockFlagData { | ||
public BlockFlagType flagType; | ||
public FlagData flagData; | ||
|
||
public BlockFlagData(BlockFlagType flagType, boolean isListInclude, List<String> list) { | ||
this.flagType = flagType; | ||
this.flagData = new FlagData(isListInclude, list); | ||
} | ||
} | ||
|
||
public enum EntityFlagType { | ||
DAMAGE, | ||
INTERACT, | ||
EXPLODE, | ||
} | ||
|
||
public static class EntityFlagData { | ||
public EntityFlagType flagType; | ||
public FlagData flagData; | ||
|
||
public EntityFlagData(EntityFlagType flagType, boolean isListInclude, List<String> list) { | ||
this.flagType = flagType; | ||
this.flagData = new FlagData(isListInclude, list); | ||
} | ||
} | ||
} |