-
Notifications
You must be signed in to change notification settings - Fork 22
Making Protections
Protections are a big part of the MyTown2 project and is something incredibly difficult to maintain due to the everchanging environment of Minecraft and its modding community.
There are two reasons we have created the current protection system:
- The difficulty of maintaining a protection system that takes into account basically any mod.
- Not many people know how to program in Java (at least not in the Minecraft community). This system requires minimal to no knowledge of Java.
The protection system is based on reading a set of files, each file representing a protection "dictionary" for a mod, we'll call those protections or protection files.
Each of the file is broken down into, so called, segments. Each segment represents something in the mod (entity, tile entity, item, block etc.). The segments tell the protection system what each thing does.
Example: a segment can tell the system that the
Creeperfrom vanilla Minecraft is a hostile mob that will attack the player when it sees it. The system can use this information to control exactly which mob can spawn inTownsorPlots.
- Each protection file is in json format (more information about the format can be found HERE) and needs to be saved as (any_name).json
- There are only three elements that are needed in each of the protection files:
-
modid(of type STRING) is the unique identifier of the mod you want to protect against -
version(of type STRING) is the minimum version to which this mod is compatible. The system simply performs astartsWithcheck against the mod version. For example: if the version that is specified is0.1and the mod's actual version is0.1.10bthe protection will initialize, but if the mod's version is0.2.20it will not because0.2.20does not start with0.1. -
segments(of type ARRAY) which represents an array of all the segments.
-