-
Notifications
You must be signed in to change notification settings - Fork 0
Player
KabanFriends edited this page Jan 11, 2024
·
15 revisions
A Player
is an object that holds a ClassiCube player. It can be accessed from events or by using level.getPlayers()
or level.getPlayer(name)
.
- Name of the player. Uses the "true name", which does not contain + at the end even if the server is set to use classicube-account-plus.
- X coordinate of the player in decimal.
- Y coordinate of the player in decimal.
- Z coordinate of the player in decimal.
- "Precise" X coordinate used for /TP -precise. Coordinate in units with 1 block being 32 units.
- "Precise" Y coordinate used for /TP -precise. Coordinate in units with 1 block being 32 units.
- "Precise" Z coordinate used for /TP -precise. Coordinate in units with 1 block being 32 units.
- Yaw of the player in decimal.
- Pitch of the player in decimal.
- The motd currently set for the player.
- A boolean value that is true if the player has CEF Loader Plugin installed.
- A boolean value that is true if the player is logged in using mobile version of ClassiCube.
- A boolean value that is true if the player is logged in using web browser version of ClassiCube.
- Name of the model that the player is currently using.
- ID of the block that the player is currently holding.
- Shows a chat message to the player.
- Shows a CPE message to the player. Has a text lengths limit of 64 characters.
Available values forlocation
:announce
bigAnnounce
smallAnnounce
top1
top2
top3
bottom1
bottom2
bottom3
chat
Reference image:
- Kills the player and broadcasts a death message to everyone in the same level.
- Makes the player execute a command. Some commands are blocked to be used in this function.
- Displays a block at the specified coordinate to the player. This will not affect the level itself, and other players cannot see the block.
- The
block
parameter can be either a number of the block ID, or a string of the block name.
tempChunk(number: x1, number: y1, number: z1, number: x2, number: y2, number: z2, number: x3, number: y3, number: z3, [boolean: toAll])
- Copies a chunk of the world defined by first (xyz1) and second (xyz2) coordinates, then pastes it into the spot defined by the third (xyz3) coordinates.
- The
toAll
boolean is an optional parameter. If true, the tempchunk changes are sent to all players in the same level.
- Makes the player unable to move or use hacks.
- Makes the player able to move, and use hacks if they are allowed on the level.
- Makes the player look at the specified coordinate.
- Changes the environment property of the player.
- Available
property
names and their values:-
sky
→ Hex color (string) -
skybox
→ Hex color (string) -
cloud
→ Hex color (string) -
fog
→ Hex color (string) -
shadow
→ Hex color (string) -
sun
→ Hex color (string) -
weather
→ Weather type (string):-
sun
,rain
,snow
-
-
maxFog
→ Fog distance (number) -
expFog
→ Smooth fog (boolean) -
cloudHeight
→ Cloud height (number) -
cloudSpeed
→ Cloud Speed (number)
-
Examples:
player.setEnv("sky", "c0ffee")
player.setEnv("weather", "snow")
player.setEnv("maxFog", 69)
- Changes the MOTD of the player. Use
/help motd
to see a list of MOTD flags.
- Resets the MOTD of the player to the default MOTD of the level.
- Sets the spawnpoint of the player to the specified coordinate.
- Adds a hotkey for the player. Pressing the key will make the player run the /input command with the specified input string. (Thus triggering the onPlayerInput event)
- Hotkeys defined by the level script will automatically be removed when the player leaves the level.
- See https://minecraft.fandom.com/el/wiki/Key_codes#Full_table for a list of key names.
- Available modifier key names:
shift
ctrl
alt
Examples:
player.addHotkey("cat", "L") -- Runs "/input cat" when pressing L
player.addHotkey("hello chat", "F", "ctrl", "shift") -- Runs "/input hello chat" when pressing Ctrl + Shift + F
- Removes a hotkey defined using
addHotkey
.
- Temporarily changes the reach distance of the player. Using
setMotd
or leaving the level will reset the reach distance. - Default reach distance is 5 blocks.
- Changes the model of the player. Leaving the level will reset the model to the model that the player previously had.
- Sets the velocity of the player to the specified X, Y and Z values.
- If the "add" boolean is true, the specified velocity component value will be added to the player's current velocity. (e.g. if xAdd is true, the value x will be added to the player's current x velocity)
- Changes a slot of the player's hotbar to the specified block.
- The
block
parameter can be either a number of the block ID, or a string of the block name.
- Teleports the player to the specified coordinate. Unlike
/TP
command, this function accepts decimal numbers. -
yaw
andpitch
values are optional. If these values are not specified, it will not keep the player's rotation.
playParticle(string: name, number: x, number: y, number: z, [number: originX, number: originY, number: originZ])
- Plays a particle effect by given name. Particle effects must be reigstered before playing one. See Particle page for more information.
-
originX
,originY
,originZ
are optional parametrs to determine from which the particles move away.