mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 20:16:00 +01:00
Add optional support for fabric-permissions-api
This commit is contained in:
parent
3f049d0523
commit
407c9586ec
@ -24,19 +24,19 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.fabric;
|
package de.bluecolored.bluemap.fabric;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import com.flowpowered.math.vector.Vector3d;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||||
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
||||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||||
import de.bluecolored.bluemap.core.world.World;
|
import de.bluecolored.bluemap.core.world.World;
|
||||||
|
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FabricCommandSource implements CommandSource {
|
public class FabricCommandSource implements CommandSource {
|
||||||
|
|
||||||
private FabricMod mod;
|
private FabricMod mod;
|
||||||
@ -56,7 +56,12 @@ public void sendMessage(Text text) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return delegate.hasPermissionLevel(1);
|
try {
|
||||||
|
Class.forName("me.lucko.fabric.api.permissions.v0.Permissions");
|
||||||
|
return Permissions.check(delegate, permission, 1);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
return delegate.hasPermissionLevel(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,19 +24,19 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.fabric;
|
package de.bluecolored.bluemap.fabric;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import com.flowpowered.math.vector.Vector3d;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||||
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
||||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||||
import de.bluecolored.bluemap.core.world.World;
|
import de.bluecolored.bluemap.core.world.World;
|
||||||
|
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FabricCommandSource implements CommandSource {
|
public class FabricCommandSource implements CommandSource {
|
||||||
|
|
||||||
private FabricMod mod;
|
private FabricMod mod;
|
||||||
@ -56,7 +56,12 @@ public void sendMessage(Text text) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return delegate.hasPermissionLevel(1);
|
try {
|
||||||
|
Class.forName("me.lucko.fabric.api.permissions.v0.Permissions");
|
||||||
|
return Permissions.check(delegate, permission, 1);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
return delegate.hasPermissionLevel(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.fabric;
|
package de.bluecolored.bluemap.fabric;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import com.flowpowered.math.vector.Vector3d;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||||
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
||||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||||
@ -38,6 +34,9 @@
|
|||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FabricCommandSource implements CommandSource {
|
public class FabricCommandSource implements CommandSource {
|
||||||
|
|
||||||
private FabricMod mod;
|
private FabricMod mod;
|
||||||
@ -57,7 +56,12 @@ public void sendMessage(Text text) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return Permissions.check(delegate, permission, 1);
|
try {
|
||||||
|
Class.forName("me.lucko.fabric.api.permissions.v0.Permissions");
|
||||||
|
return Permissions.check(delegate, permission, 1);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
return delegate.hasPermissionLevel(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.fabric;
|
package de.bluecolored.bluemap.fabric;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import com.flowpowered.math.vector.Vector3d;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||||
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
||||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||||
@ -38,6 +34,9 @@
|
|||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FabricCommandSource implements CommandSource {
|
public class FabricCommandSource implements CommandSource {
|
||||||
|
|
||||||
private FabricMod mod;
|
private FabricMod mod;
|
||||||
@ -57,7 +56,12 @@ public void sendMessage(Text text) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return Permissions.check(delegate, permission, 1);
|
try {
|
||||||
|
Class.forName("me.lucko.fabric.api.permissions.v0.Permissions");
|
||||||
|
return Permissions.check(delegate, permission, 1);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
return delegate.hasPermissionLevel(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.fabric;
|
package de.bluecolored.bluemap.fabric;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import com.flowpowered.math.vector.Vector3d;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||||
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
|
||||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||||
@ -38,6 +34,9 @@
|
|||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FabricCommandSource implements CommandSource {
|
public class FabricCommandSource implements CommandSource {
|
||||||
|
|
||||||
private FabricMod mod;
|
private FabricMod mod;
|
||||||
@ -57,7 +56,12 @@ public void sendMessage(Text text) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return Permissions.check(delegate, permission, 1);
|
try {
|
||||||
|
Class.forName("me.lucko.fabric.api.permissions.v0.Permissions");
|
||||||
|
return Permissions.check(delegate, permission, 1);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
return delegate.hasPermissionLevel(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user