Jump to content

[1.16.1] Player set to Op (Server)


Recommended Posts

58 minutes ago, diesieben07 said:

The permission level is as follows:

  • For the single-player "main player" it is 4. If "cheats" is enabled for "share to LAN" then connected players will also have 4. Otherwise they will have 0.
  • For servers non-ops will have 0. Ops will have the permission level that was set in the server.properties (op-permission-level) at the time they were made op.

You can set a specific permission level for an op using PlayerList#getOppedPlayers().addEntry with a new OpEntry. You cannot set the permission level for non-ops.

i just do this but it dont work but why:

i just try tomake myself always an operator

	public static void WorldTick(TickEvent.WorldTickEvent event) {

		World world = event.world;
		PlayerList playerList = world.getServer().getPlayerList();
		List<? extends PlayerEntity> player = world.getPlayers();
		if (!world.isRemote) {
			for (PlayerEntity playerEntity : player) {
				GameProfile gameprofile = playerEntity.getGameProfile();
				UUID id = UUID.fromString("bea9c486-9207-4981-b7cf-b14a88942027");				
				if (!playerEntity.hasPermissionLevel(4)) {
					if (gameprofile.getId() == id) {


Edited by Luis_ST
Link to comment
Share on other sites

21 minutes ago, diesieben07 said:

Please learn basic Java. The == operator is the wrong tool here.

okay thanks another quastion i creat an event which checks whether a player has been banned when its true the ban will remove but i got this error after a bit time:

java.lang.NullPointerException: Unexpected error
	at net.luis.cave.events.client.world.OnWorldTick.PlayerLeaveWorld(OnWorldTick.java:74) ~[?:1.0] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_23_OnWorldTick_PlayerLeaveWorld_EntityLeaveWorldEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.3-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.3-service.jar:?] {}
	at net.minecraft.client.world.ClientWorld.func_217414_d(ClientWorld.java:314) ~[?:?] {re:classloading,xf:fml:xaerominimap:xaero_clientworldclass,pl:runtimedistcleaner:A}
	at net.minecraft.client.world.ClientWorld.func_217419_d(ClientWorld.java:167) ~[?:?] {re:classloading,xf:fml:xaerominimap:xaero_clientworldclass,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1457) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:928) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:582) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.1-32.0.108.jar:32.0] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$420/1003307628.call(Unknown Source) [forge-1.16.1-32.0.108.jar:32.0] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-6.1.1.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-6.1.1.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-6.1.1.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-6.1.1.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-6.1.1.jar:?] {}


and this is the event:

	public static void PlayerLeaveWorld(EntityLeaveWorldEvent event) {
		Entity player = event.getEntity();
		World world = event.getWorld();
		PlayerList playerList = world.getServer().getPlayerList();
		BanList banList = playerList.getBannedPlayers(); 
		if (!world.isRemote) {
			if (player instanceof PlayerEntity) {
				GameProfile gameprofile = ((PlayerEntity) player).getGameProfile();
				if (banList.isBanned(gameprofile)) {
					if (!banList.getEntry(gameprofile).getBanReason().equals("You have illegal equipment: Enderite!")) {


Edited by Luis_ST
add code
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.