Skip to content

Commit

Permalink
Merge pull request #167 from genboy/master
Browse files Browse the repository at this point in the history
Keep up date
  • Loading branch information
genboy committed May 24, 2019
2 parents 50e8de2 + 8964939 commit c112900
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 152 deletions.
40 changes: 40 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Genboy Copyright 2019

Festival Copyright statement, 27 April 2019

1) This Copyright statement is the Festival Copyright statement explaining the terms and conditions of the Copyright statement restrictions in the English vocabulary used by entities worldwide since 2015.

1.a) Festival is the complete software package with HTML/CSS, Javascript, JSON, PHP, visual design elements and concepts, including any version or branch but excluding the explicit named files hereafter, available at github.com/genboy/Festival, hereby called the Product. Files excluded from the Festival Copyright restrictions, if included in the Product, respecting their owners intellectual property rights, copyrights or licenses are:
poggit.yml, .editorconfig, Encoding.php, CustomForm.php, Form.php, ModalForm.php and SimpleForm.php.

1.b) Genboy is the name of the digital identity and trademark of the legal human entity and natural person who is registered as the domainname holder of genboy.net and who is the owner of the GitHub's Service user account github.com/genboy named Genboy at the github.com website by GitHub Inc., Genboy is hereby called the Owner.

1.c) The terms 'use' en 'uses' in this Copyright statement refer to the actions use, duplicate, copy, fork, adjust, market, remarket, sell and reuse by any person, legal entity, service or software.

1.d) The term 'you' and 'User' in this Copyright statement refers to the legal entity that is you, your company, your employer or any software in ownership or used by you, your company, your employer or any other person, legal entity or service that uses the Product and thereby agreed to respect this Copyright statement, hereby called the User.

1.e) The term 'GLA' and 'license' in this Copyright statement refer to the legal binding writing in the form of a part or the whole copy of an original license agreement written by the Owner, also called The Genboy License Agreement, hereby called the GLA. The GLA explains the rights and restrictions the User has to use any portion of the Product in the English vocabulary used by legal entities since 2015.

1.f) The term 'law', 'legislation' and 'copyright' in this Copyright statement refer to any law or legislation that does not contradict this Copyright statement or the GLA.
Any other written law or legislation that does contradict this Copyright statement or the GLA does not apply to this Copyright statement or the GLA.

1.g) This Copyright statement and the GLA, in case there is the GLA (Genboy License Agreement or LICENSE) embedded besides this Copyright statement in the Product, can not be changed by any entity except the Owner

1.h) This Copyright statement and the GLA can be changed by the Owner at any time. The owner will announce any changes of this Copyright statement or the GLA inside the README.md file of the Product in the English vocabulary used by entities worldwide since 2015.

1.i) The user is allowed to translate a copy of the Festival Copyright statement and the GLA into another language only to understand the legal bindings between the Owner, the User and the Product.

2) The Owner retains ownership of all intellectual property rights of any kind related to the Product.
The Owner reserves all rights that are not expressly granted to the User under this Copyright statement or by law.
The look and feel of the Product is copyright © Genboy. All rights reserved.
The User may not use any portion of the Product without express written permission from the Owner.

3) If the User does use any portion of the Product the User agrees to

3.a) have read and understand this Copyright statement and in case there is no GLA (Genboy License Agreement or LICENSE) embedded in the Product
3.b) contact the Owner, through email msg@genboy.net or other means, to ask permission to use any portion of the Product and
3.c) communicate the end means of use of the Product to the Owner and
3.d) pay the fee the Owner communicated to the User for giving out the GLA and
3.e)be aware of the rights of the Owner to take legal action if no express written permission was given in the form of the GLA to the User.

Genboy Copyright 2019
13 changes: 4 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Genboy License Agreement, GLA Public Version 1, 27 April 2019

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Genboy Copyright (C) 2019


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
This version of the GLA incorporates the terms and conditions of the Festival Copyright statement and the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.
0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
Expand Down
44 changes: 35 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@

## Festival
Consider posting your first [share your experience and issues](https://github.com/genboy/Festival/issues) before posting a [vote](https://poggit.pmmp.io/p/Festival/1.1.1) if you like to use Festival!
That way it will improve Festival, my coding skills, your PMMP insights and the PMMP community, thank you!

If you like to use Festival consider [sharing your experience and issues](https://github.com/genboy/Festival/issues) to fix any usability problems before posting a [vote](https://poggit.pmmp.io/p/Festival/1.1.1)!
That way it will improve Festival, my coding skills, your Pocketmine-MP insights and strenghten the PMMP community, thank you!

![Festival plugin logo large](https://genboy.net/wp-content/uploads/2018/02/festival_plugin_logo.png)


!Take notice of the Copyright Statement if you use Festival for the first time since 27 April 2019.
Read the Legal Notice at the bottom of this README file or the Legal Notice tab at poggit.pmmp.io/p/Festival

Create a festival with this custom area events plugin for Pocketmine Server:

### Manage area's and run commmands attachted to area events.


![Festival creation & usage](https://genboy.net/wp-content/uploads/2019/03/festival_usage_1.1.0.png)
![Festival creation & usage](https://genboy.net/wp-content/uploads/2019/04/festival_usage_v1.1.3.png)


###### Copyright [Genboy](https://genboy.net) 2018

---

## Info
Festival 1.1.2 functionalities will not extend further more. Maybe Flight flag will change. Important translations and bug fixes will still be done untill Festival 2 is ready.
Festival 2 is in [development](https://github.com/genboy/Festival/projects/2) including FormUI for easy control, a new code structure and some of the flags will be completely rewritten. I probably dump the translations untill there is request for it. Just to let you know ..
Since Festival 1.1.3 the config option to disable Flight flag (flight control off) is available!
Festival 2 is being implemented step by step now, [development](https://github.com/genboy/Festival/projects/2) including FormUI for easy control, a new code structure and some of the flags will be completely rewritten. Just to let you know ..

# Festival

Expand All @@ -31,7 +37,7 @@ Festival 2 is in [development](https://github.com/genboy/Festival/projects/2) in

More info also available at [the Festival Wiki](https://github.com/genboy/Festival/wiki)

Download the latest .phar files from [poggit.pmmp.io](https://poggit.pmmp.io/p/Festival/1.1.1), also available at [mcpehost.ru](https://panel.mcpehost.ru/repository/plugin?name=Festival)
Download the latest .phar files from [poggit.pmmp.io](https://poggit.pmmp.io/p/Festival/1.1.3), also available at [mcpehost.ru](https://panel.mcpehost.ru/repository/plugin?name=Festival)

!Please before asking; first double-check your server basic world configurations, other plugins configurations (ie. worldguard) and the used player permissions incl. Festival whitelistings.

Expand All @@ -43,6 +49,7 @@ Download the latest .phar files from [poggit.pmmp.io](https://poggit.pmmp.io/p/F
- Msgtype: msg - Area Messages Display position (msg/title/tip/pop)
- Msgdisplay: off - Area Messages persist display to ops (off/op/on)
- Areadisplay: op - Area Floating Title display to ops (off/op/on)
- FlightControl: on - To disable flight flag for all Festival usage (on/off)
- AutoWhitelist: on - Auto whitelist area creator (on/off)

**Area**
Expand Down Expand Up @@ -145,17 +152,19 @@ and all [other iProtector devs](https://github.com/LDX-MCPE/iProtector/network).

##### A visualisation of Festival command usage

![Festival creation & usage](https://genboy.net/wp-content/uploads/2019/03/festival_usage_1.1.0.png)
![Festival creation & usage](https://genboy.net/wp-content/uploads/2019/04/festival_usage_v1.1.3.png)

###### Copyright [Genboy](https://genboy.net) 2018



#### Language

Set Festival language en/nl for area and command returned messages.
Set Festival language en/nl/es/pl for area and command returned messages.
en = english
nl = nederlands
es = Espanol
pl = Polski
__ = your language, please help [translate __.js](https://github.com/genboy/Festival/blob/master/resources/en.json)


Expand Down Expand Up @@ -439,12 +448,29 @@ Thank you

**Since v1.1.2**
- new pl.json and @dearminder reviewed Polskie(/fe lang pl)

**Since v1.1.3**
- new class ForceUTF8 for json encoding translations
- new FlightControl option to disable flight flag

------


## Credits

The area code derives from the [iProctector plugin](https://github.com/LDX-MCPE/iProtector). All credits for the area creation and protection code go to the iProtector creator [LDX-MCPE](https://github.com/LDX-MCPE) and [other iProtector devs](https://github.com/LDX-MCPE/iProtector/network).

The Festival code is written and tested by Genboy and first released on 12 Feb 2018, first extending the area object with area events (enter and leave messages) and soon added functions and ingame commands to attach a commandstring to a area-event. Since v1.0.7 the area's and players can be protected with 12 flags, and trigger commands on areaEnter, areaCenter and areaLeave.

## Legal Notice

-- Legal notice --

For Festival the General Public License agreement version 3, as in the LICENSE file is still included and operative.

To protect this software since 27 April 2019 the Festival software package is copyrighted by Genboy.
You are legally bind to read the Festival Copyright statement.

In short this change of Copyright statement does not change the usage levels as stated in the GPU, for a part it now prohibits any entities to sell the software without the knowledge of the owner.

-- end legal notice --
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Festival
author: Genboy
version: 1.1.2
version: 1.1.3
main: genboy\Festival\Main
load: POSTWORLD
api: [3.0.0]
Expand Down
5 changes: 4 additions & 1 deletion resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Config file for Festival 1.1.1
# Config file for Festival 1.1.3

# Festival options
Options:
Expand All @@ -14,6 +14,9 @@ Options:
# Area Messages persist display to ops (off/op/on)
Msgdisplay: off

# Use flight flag (on/off) - since v.1.1.3 flight flag usage can be turn off
FlightControl: on

# Auto whitelist area creator (on/off)
AutoWhitelist: on

Expand Down
76 changes: 73 additions & 3 deletions src/genboy/Festival/Area.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php declare(strict_types = 1);
/** Festival 1.1.4
* src/genboy/Festival/Area.php
* copyright Genbay 2019
* Options in config.yml
*
*/

/** src/genboy/Festival/Area.php */

namespace genboy\Festival;

Expand All @@ -19,6 +24,8 @@ class Area{
private $pos1;
/** @var Vector3 */
private $pos2;
/** @var Vector3 */
private $radius;
/** @var string */
private $levelName;
/** @var string[] */
Expand All @@ -30,12 +37,13 @@ class Area{
/** @var Main */
private $plugin;

public function __construct(string $name, string $desc, array $flags, Vector3 $pos1, Vector3 $pos2, string $levelName, array $whitelist, array $commands, array $events, Main $plugin){
public function __construct(string $name, string $desc, array $flags, Vector3 $pos1, Vector3 $pos2, int $radius, string $levelName, array $whitelist, array $commands, array $events, Main $plugin){
$this->name = strtolower($name);
$this->desc = $desc;
$this->flags = $flags;
$this->pos1 = $pos1;
$this->pos2 = $pos2;
$this->radius = $radius;
$this->levelName = $levelName;
$this->whitelist = $whitelist;
$this->commands = $commands;
Expand Down Expand Up @@ -72,6 +80,19 @@ public function getSecondPosition() : Vector3{
return $this->pos2;
}

/**
* @param int
*/
public function setRadius( $int ) : int{
$this->radius = $int;
}
/**
* @return int
*/
public function getRadius() : int{
return $this->radius;
}

/**
* @return string[]
*/
Expand Down Expand Up @@ -169,7 +190,32 @@ public function setEvent( string $type, string $cmdid) : array{
* @return bool
*/
public function contains(Vector3 $pos, string $levelName) : bool{

// check if area is sphere or cube (given radius)
if( isset( $this->radius ) && $this->radius > 0 && isset( $this->pos1 ) ){
// in sphere area
return ( $pos->getX() >= ( $this->pos1->getX() - $this->radius )
&& $pos->getX() <= ( $this->pos1->getX() + $this->radius )
&& $pos->getY() >= ( $this->pos1->getY() - $this->radius )
&& $pos->getY() <= ( $this->pos1->getY() + $this->radius )
&& $pos->getZ() >= ( $this->pos1->getZ() - $this->radius )
&& $pos->getZ() <= ( $this->pos1->getZ() + $this->radius )
&& strtolower( $this->levelName ) === strtolower( $levelName ) );
}else if( isset( $this->pos1 ) && isset( $this->pos2 ) ){
// in cube area
return ((min($this->pos1->getX(), $this->pos2->getX()) <= $pos->getX())
&& (max($this->pos1->getX(), $this->pos2->getX()) >= $pos->getX())
&& (min($this->pos1->getY(), $this->pos2->getY()) <= $pos->getY())
&& (max($this->pos1->getY(), $this->pos2->getY()) >= $pos->getY())
&& (min($this->pos1->getZ(), $this->pos2->getZ()) <= $pos->getZ())
&& (max($this->pos1->getZ(), $this->pos2->getZ()) >= $pos->getZ())
&& strtolower( $this->levelName ) === strtolower( $levelName ) );
}

/* only cube area's
return ((min($this->pos1->getX(), $this->pos2->getX()) <= $pos->getX()) && (max($this->pos1->getX(), $this->pos2->getX()) >= $pos->getX()) && (min($this->pos1->getY(), $this->pos2->getY()) <= $pos->getY()) && (max($this->pos1->getY(), $this->pos2->getY()) >= $pos->getY()) && (min($this->pos1->getZ(), $this->pos2->getZ()) <= $pos->getZ()) && (max($this->pos1->getZ(), $this->pos2->getZ()) >= $pos->getZ()) && ($this->levelName === $levelName));
*/

}


Expand All @@ -180,6 +226,30 @@ public function contains(Vector3 $pos, string $levelName) : bool{
*/
public function centerContains(Vector3 $pos, string $levelName) : bool{

if( isset( $this->radius ) && $this->radius > 1 && isset( $this->pos1 ) ){
// in sphere area center
return ( $pos->getX() >= ( $this->pos1->getX() - 2 )
&& $pos->getX() <= ( $this->pos1->getX() + 2 )
&& $pos->getY() >= ( $this->pos1->getY() - 2 )
&& $pos->getY() <= ( $this->pos1->getY() + 2 )
&& $pos->getZ() >= ( $this->pos1->getZ() - 2 )
&& $pos->getZ() <= ( $this->pos1->getZ() + 2 )
&& strtolower( $this->levelName ) === strtolower( $levelName ) );
}else if( isset( $this->pos1 ) && isset( $this->pos2 ) ){
// in cube area center
$cx = $this->pos2->getX() + ( ( $this->pos1->getX() - $this->pos2->getX() ) / 2 );
$cz = $this->pos2->getZ() + ( ( $this->pos1->getZ() - $this->pos2->getZ() ) / 2 );
$cy1 = min( $this->pos2->getY(), $this->pos1->getY());
$cy2 = max( $this->pos2->getY(), $this->pos1->getY());
$px = $pos->getX();
$py = $pos->getY();
$pz = $pos->getZ();
return( $px >= ($cx - 1) && $px <= ($cx + 1) && $pz >= ($cz - 1) && $pz <= ($cz + 1) && $py >= $cy1 && $py <= $cy2
&& strtolower( $this->levelName ) === strtolower( $levelName ) );
}


/* only cube area's
$cx = $this->pos2->getX() + ( ( $this->pos1->getX() - $this->pos2->getX() ) / 2 );
$cz = $this->pos2->getZ() + ( ( $this->pos1->getZ() - $this->pos2->getZ() ) / 2 );
$cy1 = min( $this->pos2->getY(), $this->pos1->getY());
Expand All @@ -190,6 +260,7 @@ public function centerContains(Vector3 $pos, string $levelName) : bool{
return( $px >= ($cx - 1) && $px <= ($cx + 1) && $pz >= ($cz - 1) && $pz <= ($cz + 1) && $py >= $cy1 && $py <= $cy2 && ($this->levelName === $levelName) );
//return ((min($this->pos1->getX(), $this->pos2->getX()) <= $pos->getX()) && (max($this->pos1->getX(), $this->pos2->getX()) >= $pos->getX()) && (min($this->pos1->getY(), $this->pos2->getY()) <= $pos->getY()) && (max($this->pos1->getY(), $this->pos2->getY()) >= $pos->getY()) && (min($this->pos1->getZ(), $this->pos2->getZ()) <= $pos->getZ()) && (max($this->pos1->getZ(), $this->pos2->getZ()) >= $pos->getZ()) && ($this->levelName === $levelName));
*/
}

/**
Expand Down Expand Up @@ -274,5 +345,4 @@ public function delete() : void{
public function save() : void{
$this->plugin->areas[$this->name] = $this;
}

}
Loading

0 comments on commit c112900

Please sign in to comment.