307 Commits

Author SHA1 Message Date
Dylan K. Taylor
eccc249009 KillCommand: clean up old shitcode 2018-07-20 19:44:41 +01:00
Dylan K. Taylor
58f0ad3e3e Command: remove unnecessary getPermission() calls 2018-07-05 10:38:31 +01:00
Dylan K. Taylor
0df3585c81 TellCommand: remove useless strtolower() and temp variable 2018-07-05 09:12:21 +01:00
Dylan K. Taylor
1f9bed275a Merged server and API version 2018-06-17 12:54:18 +01:00
Dylan K. Taylor
0b9ce8a0d4 Remove server codename
This has long been a waste of time and creativity, and that's only going to continue to be the case now that we're going to be properly versioning. New codenames every couple of months is not worth the bother.
2018-06-12 10:51:49 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
c4c6c58615 Added some missing typehints 2018-06-10 17:18:55 +01:00
Dylan K. Taylor
edd150971e CommandReader: Use statics for thread-local storage instead of globals 2018-06-06 10:06:52 +01:00
Dylan K. Taylor
d03f36ebee First look at splitting up AsyncPool and ServerScheduler
This commit contains quite a few breaking changes with respect to how AsyncTasks are handled. This is necessary to allow separation of the ServerScheduler and the AsyncPool, because in the future the ServerScheduler may be removed and instead there will be isolated per-plugin sync-task schedulers - but we cannot have every plugin with its own worker pool for memory usage reasons if nothing else.

The following things have changed:
- ServerScheduler: scheduleAsyncTask(), scheduleAsyncTaskToWorker(), getAsyncTaskPoolSize(), increaseAsyncTaskPoolSize() and similar methods have all been removed. Additionally the static \$WORKERS field has been removed.
- Server: added API method getAsyncPool(). This grants you direct access to the server's AsyncPool. Calls to getScheduler()->scheduleAsyncTask() and scheduleAsyncTaskToWorker() should be replaced with getAsyncPool()->submitTask() and submitTaskToWorker() respectively.
2018-05-30 12:20:10 +01:00
Dylan K. Taylor
81957d133d AsyncTask: Rewrite how thread-local storage works, now non-dependent on Server or ServerScheduler
this implementation was god-awful bad and it was entirely avoidable to make it this complicated.

This utilizes the fact that pthreads treats static properties as thread-local. AsyncTask local storage now utilizes a \SplObjectStorage stored in an AsyncTask private static field.
2018-05-29 19:41:00 +01:00
Dylan K. Taylor
ad15ab5b42 EnchantCommand: use Item->isNull() instead of maths on ID 2018-05-28 19:45:37 +01:00
Dylan K. Taylor
b75413e3c4 CommandReader: Use stream_isatty() instead of posix_isatty() (new in 7.2) 2018-05-18 16:46:48 +01:00
Dylan K. Taylor
edaef588ab CommandReader: remove unnecessary setClassLoader() call
this is already handled in start() anyway.
2018-05-12 12:47:28 +01:00
Dylan K. Taylor
c3822b795c CommandReader: use PTHREADS_INHERIT_NONE
probably not necessary to register autoloader, but just in case...
2018-05-09 20:02:51 +01:00
Dylan K. Taylor
be0e85dfae CommandReader: fix notifier race condition crash, don't start self in constructor
self-start is extremely annoying!
2018-05-09 20:01:16 +01:00
Dylan K. Taylor
2ff2a2de08 FormattedCommandAlias: use multiple catch clauses 2018-05-09 16:58:55 +01:00
Dylan K. Taylor
2a0a2134d1
Server: Implemented an signal/sleep interrupt mechanism for ticking (#2171)
This allows other threads to notify the main thread to wake it up while it's sleeping between ticks, allowing reduction of processing latency.

Currently only RakLib and the CommandReader threads utilize this, but it's planned to extend it to more things in the near future.

CommandReader is now event-driven instead of poll-based - the server will not poll the CommandReader thread for messages each tick anymore.

RakLib utilizes this mechanism to get packets processed without delays to lower latency.

This now adds an extra dependency - `pocketmine/snooze` library contains the meat of the code used for this. See the Snooze repository for details.
2018-05-09 14:18:13 +01:00
Dylan K. Taylor
76854da7ba Command: remove dead field 2018-04-10 12:11:27 +01:00
Dylan K. Taylor
3f31f6d310 TimeCommand: Use Level constant instead of hardcoded value 2018-04-05 15:41:59 +01:00
Dylan K. Taylor
99134de6b6 Updated NBT dependency
this needs further changes (particularly to Furnace) to stop things abusing NBT for runtime data handling, otherwise performance is going to drop off a cliff.
2018-04-04 10:29:32 +01:00
Dylan K. Taylor
5ed2d6022c GiveCommand: don't catch Throwables
this caused me to think a thyntax error in my code was a syntax error in the NBT I was trying to parse.
2018-04-01 12:17:17 +01:00
Dylan K. Taylor
d53258c943 EffectCommand: restrict range of values for duration, fixes #2055 2018-03-30 11:51:20 +01:00
Dylan K. Taylor
773f760fff VanillaCommand: added getBoundedInt() 2018-03-30 11:48:42 +01:00
Dylan K. Taylor
1648fff916 Replaced Position->getLevel() null checks with isValid() 2018-03-20 11:10:36 +00:00
Dylan K. Taylor
73e09392b6 Timings: Clean up some terrible code, move namespaces 2018-03-19 19:05:51 +00:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
c243daabe1 DumpMemoryCommand: removed token annoyance, use date/time to identify memory dumps by default 2018-03-18 12:17:31 +00:00
Dylan K. Taylor
357674cb54 DumpMemoryCommand: move memory dumps to their own folder
this is for ease of ignoring in IDEs.
2018-03-18 12:06:15 +00:00
Dylan K. Taylor
e88541b269 TeleportCommand: add /teleport alias 2018-03-16 10:49:57 +00:00
Dylan K. Taylor
dc3bf8546e Refactored effects handling, split up concerns of effect types and instances
Removed json insanity for effects

Split up effect types and effect instances

Saturation is an instant effect
2018-03-07 12:42:31 +00:00
Dylan K. Taylor
3104a312b2 ConsoleCommandSender: Remove useless function isPlayer()
This function is not declared in any useful places (like the CommandSender interface) and it is not present in Player (!!!). Additionally, an is-player check is better done with an instanceof so that type safety is enforced and IDEs can give auto-complete.

This is a BC break, but this is such a pointless function that it's probably not even worth mentioning.
2018-02-27 16:43:40 +00:00
Dylan K. Taylor
0ad8ea6e92 Remove unused imports 2018-02-24 19:01:09 +00:00
TheNewHEROBRINEX
bd47852ca4 Allow Command::getPermissionMessage() to return null (#2057) 2018-02-24 18:15:27 +00:00
Dylan K. Taylor
c26e3aa9fa GiveCommand: Make invalid player checking logic less confusing
some code in this namespace is just total WTF...
2018-02-15 18:19:41 +00:00
Dylan K. Taylor
aeba15c5c6 GiveCommand: don't crash when an invalid item is specified 2018-02-15 18:18:09 +00:00
Dylan K. Taylor
e7e4645c0b Fixed a wide range of bugs with floating-point coordinates getting incorrectly int-casted
This causes lots of bugs in negative coordinates.

This fixes #1789 after world load & save.
2018-02-15 10:27:42 +00:00
Dylan K. Taylor
610e62e2cd Timings: don't return the paste we just sent in the response 2018-02-11 11:56:16 +00:00
Dylan K. Taylor
906442136b Merge branch 'legacy/alpha11' 2018-02-11 09:56:10 +00:00
Dylan K. Taylor
3600542d78 Timings: fixed pastes not working after ubuntu pastebin update 2018-02-11 09:55:52 +00:00
Dylan K. Taylor
906d7eb176 Lang: Move TranslationContainer and TextContainer to \pocketmine\lang namespace
why the hell were they ever put in \pocketmine\event in the first place??

This change was suggested many months ago but I forgot all about it.
2018-02-04 20:03:30 +00:00
Dylan K. Taylor
9014eb72e9 TeleportCommand: Fixed the bug fix again
This all comes from a shitty bugfix by @PEMapModder. Should be applied globally really, but it wasn't - and not properly tested either :P
2018-01-30 15:08:11 +00:00
Dylan K. Taylor
0e538ee51d
Enchantment: Split up enchantment type data and enchantment instance data (#1825)
* Enchantment: Split enchantment type data from instance data
This commit splits enchantments into (effectively) enchantment TYPES vs enchantment INSTANCES.

When applying an enchantment to an item, it only needs to know 2 things:
1. the enchantment ID (identifier) which is used to identify the TYPE
2. the enchantment LEVEL which is used to modify the enchantment's power IN THIS INSTANCE.

Therefore, the LEVEL is not an immutable property. However, all other properties of the currently-named "Enchantment" class are immutable type properties.
Currently, when applying an enchantment to an item, a copy of the enchantment object is created from the registry, and returned. This copies all of the properties contained by the type, which is obviously sub optimal.
2017-12-21 12:40:33 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
9fd7312629 EnchantCommand: Fix vanilla translation
This parameter isn't required server side, but it doesn't matter anyway.
2017-12-16 10:34:38 +00:00
Dylan K. Taylor
8a90d159fe Cleanup unused imports 2017-12-10 12:09:46 +00:00
Dylan K. Taylor
d80f711d18 CommandReader: Removed redundant else branch 2017-12-07 13:50:24 +00:00
Dylan K. Taylor
ebd3d207e4 Fixed server not accepting commands after pressing ctrl+D (non-readline) 2017-12-07 13:42:34 +00:00
Dylan K. Taylor
31f0437c96 fix readline crash when user presses ctrl+D 2017-12-07 13:41:58 +00:00
Dylan K. Taylor
472bf1a1ef Kill off the JSON garbage in commands
kill it with fire!
2017-12-02 16:33:19 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00