Difference between revisions of "Builtin Namespace Guide"

From MINR.ORG WIKI
(Operators TODO)
Line 26: Line 26:
 
'''Unary Operators (always before the Boolean)'''
 
'''Unary Operators (always before the Boolean)'''
 
* Boolean !<Boolean>
 
* Boolean !<Boolean>
'''Same-Type Binary Operators'''
+
'''Type-Preserving Binary Operators'''
* Boolean <Boolean>&&<Boolean>
+
* '''Boolean <Boolean> && <Boolean>''' : Returns the AND of two Booleans (e.g. returns true if both operands are true, otherwise returns false).
* Boolean <Boolean>||<Boolean>
+
* '''Boolean <Boolean> || <Boolean>''' : Returns the OR of two Booleans (e.g. returns false if both operands are false, otherwise returns true).
* Boolean <Boolean>==<Boolean>
+
* '''Boolean <Boolean> == <Boolean>''' : Returns true if two Booleans have the same value, otherwise returns false.
* Boolean <Boolean>!=<Boolean>
+
* '''Boolean <Boolean> != <Boolean>''' : Returns false if two Booleans have the same value, otherwise returns true.
'''Type-Alter
+
'''Type-Casting Binary Operators'''
 +
* '''String <Boolean> + <String>''' : Casts the Boolean to a String, then returns the strings joined in order (also accepts <String> + <Boolean>).
 
</div></div>
 
</div></div>
 
<div class="mw-collapsible mw-collapsed" style="border:1px solid #888888; padding:7px;>
 
<div class="mw-collapsible mw-collapsed" style="border:1px solid #888888; padding:7px;>
 +
 
==== Methods TODO ====
 
==== Methods TODO ====
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">

Revision as of 21:00, 30 April 2020

Return to namespace list

Built-Ins (page is not ready yet)

Status: STABLE (safe to use - but not the documentation!)

Variables

  • constant Double pi

Types

Boolean

Constructors (2)

  • Boolean(Boolean other) : Creates a new Boolean with the value of other.
  • Boolean(String other) : Creates a Boolean with value true if other matches "true" in any casing (e.g. "tRuE") or false otherwise.

Operators TODO

Unary Operators (always before the Boolean)

  • Boolean !<Boolean>

Type-Preserving Binary Operators

  • Boolean <Boolean> && <Boolean> : Returns the AND of two Booleans (e.g. returns true if both operands are true, otherwise returns false).
  • Boolean <Boolean> || <Boolean> : Returns the OR of two Booleans (e.g. returns false if both operands are false, otherwise returns true).
  • Boolean <Boolean> == <Boolean> : Returns true if two Booleans have the same value, otherwise returns false.
  • Boolean <Boolean> != <Boolean> : Returns false if two Booleans have the same value, otherwise returns true.

Type-Casting Binary Operators

  • String <Boolean> + <String> : Casts the Boolean to a String, then returns the strings joined in order (also accepts <String> + <Boolean>).

Methods TODO

Int

Long

Float

Double

String

Block

Item

Entity

Player

<Type>[] (List)

TpData

A data structure to manage teleport destinations that are set by a player positioned at the desired location.

Fields EDIT ME (6)

  • Double x : x-coordinate of the teleport destination
  • Double y : y-coordinate of the teleport destination
  • Double z : z-coordinate of the teleport destination
  • Float yaw : yaw of the teleport destination
  • Float pitch : pitch of the teleport destination
  • String world : world of the teleport destination

Constructors (1)

  • rtp::TpData(Player setter) : destination fields are set to match the setter's position at the time of initialization

Methods (3)

  • String string() : returns a simplified representation of the position held by the structure
  • String tpString() : returns a string representation of an anonymous tp call performed by tpHere
  • Void tpHere(Player player): teleports the player to the position held by the structure

Rtp

A TpData list selector and management tool that mimics the /rtp plugin functionality.

Fields (3)

  • String name : custom identifier for the set of teleport locations
  • Boolean doLogging : flag to enable logging of each use of teleportation
  • rtp::TpData[] tpList : list of potential teleport locations

Constructors (4)

  • rtp::Rtp() : initialize an empty location manager (defaults "UNNAMED", true)
  • rtp::Rtp(String name) : initialize a location manager with identifier name set
  • rtp::Rtp(Boolean doLogging) : initialize with logging option set
  • rtp::Rtp(String name, Boolean doLogging) : initialize with name and logging set

Methods (8)

  • String string() : returns a representation of name, logging status, and capacity of the structure
  • Int count() : returns size of the managed location list
  • Void setName(String name) : updates the name of the structure
  • Void setLogging(Boolean doLogging) : updates the logging status of the structure
  • Void addWarp(Player setter) : adds a location generated from setter's position at the time of the function call
  • Void removeWarp(Int index) : removes a location specified by the index (between 1 and Rtp.count() inclusive)
  • Void useWarp(Player player, Int index) : warps the player to the location specified by index (1 to count() inclusive), performing optional logging
  • Void rtp(Player player) : Selects a location randomly and performs the actions of useWarp using the player