adapt area_perms to work better with sub-folders + some improvements
All checks were successful
/ Auto-Build-App (push) Successful in 1m17s
All checks were successful
/ Auto-Build-App (push) Successful in 1m17s
This commit is contained in:
parent
066bae3d90
commit
56930a839d
6 changed files with 13 additions and 8 deletions
|
@ -166,7 +166,10 @@ public class Region {
|
|||
area.setCorners(a, b);
|
||||
|
||||
|
||||
area.name=f.getName();
|
||||
area.name = f.getPath().replace(regions_folder.getPath(), "").replace("\\", "/");
|
||||
if (area.name.startsWith("/"))
|
||||
area.name = area.name.substring(1);
|
||||
|
||||
area.enabled=region.getBoolean("enabled",true);
|
||||
area.protect=region.getBoolean("protect",false);
|
||||
|
||||
|
@ -263,7 +266,9 @@ public class Region {
|
|||
if (perm.player_id.isEmpty())
|
||||
continue;
|
||||
|
||||
perm.filename=f.getName();
|
||||
perm.filename = f.getPath().replace(perms_folder.getPath(), "").replace("\\", "/");
|
||||
if (area.name.startsWith("/"))
|
||||
area.name = area.name.substring(1);
|
||||
perm.type=perm_json.getString("type", "");
|
||||
perm.enabled=perm_json.getBoolean("enabled", false);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BlockBreakMixin {
|
|||
|
||||
@Inject(method = "handle", at = @At("HEAD"), cancellable = true)
|
||||
private void event_block_break(CallbackInfo ci, @Local NetworkIdentity identity, @Local ChannelHandlerContext ctx){
|
||||
if (identity.getSide() != NetworkSide.CLIENT) {
|
||||
if (identity.isServer()) {
|
||||
Account account = ServerSingletons.getAccount(identity);
|
||||
|
||||
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(blockPos,"break",account.getUniqueId())) {
|
||||
|
|
|
@ -35,11 +35,11 @@ public class BlockPlaceMixin {
|
|||
|
||||
@Inject(method = "handle", at = @At("HEAD"), cancellable = true)
|
||||
private void event_block_place(CallbackInfo ci, @Local NetworkIdentity identity, @Local ChannelHandlerContext ctx){
|
||||
if (identity.getSide() != NetworkSide.CLIENT) {
|
||||
if (identity.isServer()) {
|
||||
if (targetBlockState instanceof BlockStateMissing)
|
||||
ci.cancel();
|
||||
}
|
||||
if (identity.getSide() != NetworkSide.CLIENT && !ci.isCancelled()) {
|
||||
if (identity.isServer() && !ci.isCancelled()) {
|
||||
Account account = ServerSingletons.getAccount(identity);
|
||||
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(blockPos,"place",account.getUniqueId())) {
|
||||
ci.cancel();
|
||||
|
|
|
@ -34,7 +34,7 @@ public class InteractBlockMixin {
|
|||
|
||||
@Inject(method = "handle", at = @At("HEAD"), cancellable = true)
|
||||
private void event_block_interact(CallbackInfo ci, @Local NetworkIdentity identity, @Local ChannelHandlerContext ctx){
|
||||
if (identity.getSide() != NetworkSide.CLIENT) {
|
||||
if (identity.isServer()) {
|
||||
Account account = ServerSingletons.getAccount(identity);
|
||||
if (blockPos!=null) {
|
||||
BlockPosition temp = blockPos.copy();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MessagePacketMixin {
|
|||
ply_msgs.put(playerUniqueId,new MessageInfo());
|
||||
}
|
||||
|
||||
if (identity.getSide() != NetworkSide.CLIENT && !ci.isCancelled()) {
|
||||
if (identity.isServer() && !ci.isCancelled()) {
|
||||
Account account = ServerSingletons.getAccount(identity);
|
||||
if (message.startsWith(":")) {
|
||||
String cmd = message.replaceFirst(":","");
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PlayerPositionMixin {
|
|||
|
||||
@Inject(method = "handle", at = @At("HEAD"), cancellable = true)
|
||||
private void event_player_move(CallbackInfo ci, @Local NetworkIdentity identity, @Local ChannelHandlerContext ctx){
|
||||
if (identity.getSide() != NetworkSide.CLIENT) {
|
||||
if (identity.isServer()) {
|
||||
Account account = ServerSingletons.getAccount(identity);
|
||||
Player player = ServerSingletons.getPlayer(identity);
|
||||
|
||||
|
|
Loading…
Reference in a new issue