Documentation ¶
Index ¶
- Constants
- type Announce
- type BanPlayer
- type KickPlayer
- type PalworldAPI
- func (p *PalworldAPI) Announce(message string) (err error)
- func (p *PalworldAPI) Ban(user_id string, message string) (err error)
- func (p *PalworldAPI) BanList() (bannedPlayers []string, err error)
- func (p *PalworldAPI) ForceStop() (err error)
- func (p *PalworldAPI) Info() (info *ServerInfo, err error)
- func (p *PalworldAPI) Kick(user_id string, message string) (err error)
- func (p *PalworldAPI) Metrics() (metrics *ServerMetrics, err error)
- func (p *PalworldAPI) Players() (players []*Player, err error)
- func (p *PalworldAPI) SaveWorld() (err error)
- func (p *PalworldAPI) Settings() (settings *ServerSettings, err error)
- func (p *PalworldAPI) Shutdown(waittime time.Duration, message string) (err error)
- func (p *PalworldAPI) Unban(user_id string) (err error)
- type Player
- type PlayerList
- type ServerInfo
- type ServerMetrics
- type ServerSettings
- type ServerShutdown
- type UnbanPlayer
Constants ¶
const (
Endpoint = "/v1/api"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KickPlayer ¶
type PalworldAPI ¶
type PalworldAPI struct { Host string // Defaults to localhost:8212 Username string // Defaults to "admin" AdminPassword string // contains filtered or unexported fields }
func New ¶
func New(host, username, password string) *PalworldAPI
func (*PalworldAPI) Announce ¶
func (p *PalworldAPI) Announce(message string) (err error)
Announces a message to the server Palworld docs: https://tech.palworldgame.com/api/rest-api/announce
func (*PalworldAPI) Ban ¶
func (p *PalworldAPI) Ban(user_id string, message string) (err error)
Bans a player from the server Palworld docs: https://tech.palworldgame.com/api/rest-api/ban
func (*PalworldAPI) BanList ¶ added in v0.0.3
func (p *PalworldAPI) BanList() (bannedPlayers []string, err error)
Gets a list of banned players by requesting the banlist provided in the server settings Not documented, this is just a helper function WARNING: This could request external sources, for example the default banlist located at https://api.palworldgame.com/api/banlist.txt, be sure to query these not too fast
func (*PalworldAPI) ForceStop ¶
func (p *PalworldAPI) ForceStop() (err error)
Force stops the server Palworld docs: https://tech.palworldgame.com/api/rest-api/stop
func (*PalworldAPI) Info ¶
func (p *PalworldAPI) Info() (info *ServerInfo, err error)
Gets the server info Palworld docs: https://tech.palworldgame.com/api/rest-api/info
func (*PalworldAPI) Kick ¶
func (p *PalworldAPI) Kick(user_id string, message string) (err error)
Kicks a player from the server Palworld docs: https://tech.palworldgame.com/api/rest-api/kick
func (*PalworldAPI) Metrics ¶
func (p *PalworldAPI) Metrics() (metrics *ServerMetrics, err error)
Gets the server metrics Palworld docs: https://tech.palworldgame.com/api/rest-api/metrics
func (*PalworldAPI) Players ¶
func (p *PalworldAPI) Players() (players []*Player, err error)
Gets the player list Palworld docs: https://tech.palworldgame.com/api/rest-api/players
func (*PalworldAPI) SaveWorld ¶
func (p *PalworldAPI) SaveWorld() (err error)
Saves the world Palworld docs: https://tech.palworldgame.com/api/rest-api/save
func (*PalworldAPI) Settings ¶
func (p *PalworldAPI) Settings() (settings *ServerSettings, err error)
Gets the server settings Palworld docs: https://tech.palworldgame.com/api/rest-api/settings
func (*PalworldAPI) Shutdown ¶
func (p *PalworldAPI) Shutdown(waittime time.Duration, message string) (err error)
Shuts the server down Palworld docs: https://tech.palworldgame.com/api/rest-api/shutdown
func (*PalworldAPI) Unban ¶
func (p *PalworldAPI) Unban(user_id string) (err error)
Unbans a player from the server Palworld docs: https://tech.palworldgame.com/api/rest-api/unban
type Player ¶
type Player struct { Name string `json:"name"` AccountName string `json:"accountName"` PlayerID string `json:"playerId"` UserID string `json:"userId"` IP string `json:"ip"` Ping float64 `json:"ping"` LocationX float64 `json:"location_x"` LocationY float64 `json:"location_y"` Level int `json:"level"` }
type PlayerList ¶
type PlayerList struct {
Players []*Player `json:"players"`
}
type ServerInfo ¶
type ServerMetrics ¶
type ServerSettings ¶
type ServerSettings struct { Difficulty string `json:"Difficulty"` DayTimeSpeedRate int `json:"DayTimeSpeedRate"` NightTimeSpeedRate int `json:"NightTimeSpeedRate"` ExpRate int `json:"ExpRate"` PalCaptureRate int `json:"PalCaptureRate"` PalSpawnNumRate int `json:"PalSpawnNumRate"` PalDamageRateAttack int `json:"PalDamageRateAttack"` PalDamageRateDefense int `json:"PalDamageRateDefense"` PlayerDamageRateAttack int `json:"PlayerDamageRateAttack"` PlayerDamageRateDefense int `json:"PlayerDamageRateDefense"` PlayerStomachDecreaceRate int `json:"PlayerStomachDecreaceRate"` PlayerStaminaDecreaceRate int `json:"PlayerStaminaDecreaceRate"` PlayerAutoHPRegeneRate int `json:"PlayerAutoHPRegeneRate"` PlayerAutoHpRegeneRateInSleep int `json:"PlayerAutoHpRegeneRateInSleep"` PalStomachDecreaceRate int `json:"PalStomachDecreaceRate"` PalStaminaDecreaceRate int `json:"PalStaminaDecreaceRate"` PalAutoHPRegeneRate int `json:"PalAutoHPRegeneRate"` PalAutoHpRegeneRateInSleep int `json:"PalAutoHpRegeneRateInSleep"` BuildObjectDamageRate int `json:"BuildObjectDamageRate"` BuildObjectDeteriorationDamageRate int `json:"BuildObjectDeteriorationDamageRate"` CollectionDropRate int `json:"CollectionDropRate"` CollectionObjectHpRate int `json:"CollectionObjectHpRate"` CollectionObjectRespawnSpeedRate int `json:"CollectionObjectRespawnSpeedRate"` EnemyDropItemRate int `json:"EnemyDropItemRate"` DeathPenalty string `json:"DeathPenalty"` EnablePlayerToPlayerDamage bool `json:"bEnablePlayerToPlayerDamage"` EnableFriendlyFire bool `json:"bEnableFriendlyFire"` EnableInvaderEnemy bool `json:"bEnableInvaderEnemy"` ActiveUNKO bool `json:"bActiveUNKO"` EnableAimAssistPad bool `json:"bEnableAimAssistPad"` EnableAimAssistKeyboard bool `json:"bEnableAimAssistKeyboard"` DropItemMaxNum int `json:"DropItemMaxNum"` DropItemMaxNum_UNKO int `json:"DropItemMaxNum_UNKO"` BaseCampMaxNum int `json:"BaseCampMaxNum"` BaseCampWorkerMaxNum int `json:"BaseCampWorkerMaxNum"` DropItemAliveMaxHours int `json:"DropItemAliveMaxHours"` AutoResetGuildNoOnlinePlayers bool `json:"bAutoResetGuildNoOnlinePlayers"` AutoResetGuildTimeNoOnlinePlayers int `json:"AutoResetGuildTimeNoOnlinePlayers"` GuildPlayerMaxNum int `json:"GuildPlayerMaxNum"` PalEggDefaultHatchingTime int `json:"PalEggDefaultHatchingTime"` WorkSpeedRate int `json:"WorkSpeedRate"` IsMultiplay bool `json:"bIsMultiplay"` IsPvP bool `json:"bIsPvP"` CanPickupOtherGuildDeathPenaltyDrop bool `json:"bCanPickupOtherGuildDeathPenaltyDrop"` EnableNonLoginPenalty bool `json:"bEnableNonLoginPenalty"` EnableFastTravel bool `json:"bEnableFastTravel"` IsStartLocationSelectByMap bool `json:"bIsStartLocationSelectByMap"` ExistPlayerAfterLogout bool `json:"bExistPlayerAfterLogout"` EnableDefenseOtherGuildPlayer bool `json:"bEnableDefenseOtherGuildPlayer"` CoopPlayerMaxNum int `json:"CoopPlayerMaxNum"` ServerPlayerMaxNum int `json:"ServerPlayerMaxNum"` ServerName string `json:"ServerName"` ServerDescription string `json:"ServerDescription"` PublicPort int `json:"PublicPort"` PublicIP string `json:"PublicIP"` RCONEnabled bool `json:"RCONEnabled"` RCONPort int `json:"RCONPort"` Region string `json:"Region"` UseAuth bool `json:"bUseAuth"` BanListURL string `json:"BanListURL"` RESTAPIEnabled bool `json:"RESTAPIEnabled"` RESTAPIPort int `json:"RESTAPIPort"` BShowPlayerList bool `json:"bShowPlayerList"` AllowConnectPlatform string `json:"AllowConnectPlatform"` IsUseBackupSaveData bool `json:"bIsUseBackupSaveData"` LogFormatType string `json:"LogFormatType"` }
type ServerShutdown ¶
type UnbanPlayer ¶
type UnbanPlayer struct {
UserID string `json:"userid"`
}