Commit Graph

1054 Commits (5437c5d45725cd1850b180fca97c2f9363d3e4ee)

Author SHA1 Message Date
blablubbabc 5437c5d457 Further attempt to resolve some Eclipse issue. 2019-08-20 04:26:04 +02:00
blablubbabc 066828e4be Added the config setting 'register-world-guard-allow-shop-flag'
(default: true).

This can be used to disable the registration of the 'allow-shop'
WorldGuard flag. Usually this should not be required though. Note that
changing this setting has no effect until the next server restart or
full server reload.

This replaces the just previously added system property
'shopkeepers.skip-wg-allow-shop-flag' again.
2019-08-20 00:41:33 +02:00
blablubbabc 1939c02877 Added a system property 'shopkeepers.skip-wg-allow-shop-flag' which can
be used to disable the registration of the 'allow-shop' WorldGuard flag.

This should usually not be required though.

Also moved some initialization and config loading into the onLoad phase,
so that it is available for any code running there.
2019-08-19 23:46:24 +02:00
blablubbabc 2a197e439e Trying to solve some issue Eclipse is having with our 'unconventional'
maven project structure by also compiling the source code at the root
project.
2019-08-19 23:14:34 +02:00
blablubbabc 1b6c4146de Added new debug command "/shopkeepers yaml".
This prints Bukkit's yaml serialization and the item data representation
used in the config for the currently held item.
2019-08-19 06:39:55 +02:00
blablubbabc 48f0a06dd4 Also reporting dead and invalid entities retrieved from chunks in
shopkeepers' "check" command output.

Those seem to sometimes differ from the entities retrieved from the
world.
2019-08-19 04:32:09 +02:00
blablubbabc c55162252e Added entity, invalid entity and dead entity count to shopkeeper's
"check" command.

Also restructured the output slightly to make it more compact and
clearer.
2019-08-19 00:54:31 +02:00
blablubbabc d9b4e054ab Changelog categories. Should also make the formatting more compact on
github.
2019-08-18 09:40:13 +02:00
blablubbabc 4dccd1660d Added: The previous, current and next page items inside the editor view
will now use their stack size to visualize the previous, current and
next page number.

This even works for items which are usually not stackable.
2019-08-18 09:11:15 +02:00
blablubbabc cf1635eaa6 Fixed: Also updating default config version to 2. 2019-08-18 08:21:17 +02:00
blablubbabc 93a59f712c Fixed: ItemData deserialization modifying the original data map. 2019-08-18 08:10:22 +02:00
blablubbabc 99ed5dc976 Try to persist original item data position in config during migration. 2019-08-18 08:09:28 +02:00
blablubbabc 43fae6161b Renamed the setting 'high-zero-currency-item' to
'zero-high-currency-item'. This gets automatically updated during the
migration.

Also fixes an issue with the previous migration of this item.
2019-08-18 06:02:54 +02:00
blablubbabc 37b68085f8 Changed how items are getting defined in the config.
Internally this new format uses Bukkit's item serialization for parsing
the item data, which allows it to support the specification of arbitrary
item data and hopefully not require any major updating/maintenance for
future minecraft versions. At the same time it tries to stay (slightly)
more user-friendly than Bukkit's item serialization by omitting any data
that can be restored by the plugin, by avoiding one level of nesting
between the item type and item data, by translating ampersand ('&')
color codes in display name and lore, and by offering a compact
representation for specifying an item only by its type.

This change also allows a more detailed specification of some of the
editor button items. However, many editor buttons still miss
corresponding config settings. Also keep in mind that the display name
and lore for these button items get specified via corresponding message
settings, so any specified item display name and lore will get replaced
by that.

When checking if an in-game item matches the item data specified in the
config, only the specified data gets compared. So this does not check
for item data equality, but instead the checked item is able to contain
additional data but still get matched (like before, but previously this
was limited to checking display name and lore).

The previous item data gets automatically migrated to the new format
(config version 2).

Other changes:
* Internal: Moved config migrations into a separate package.
* Internal: Moved some function(s) into ConfigUtils.
* Internal: Slightly changed how the plugin checks whether the high
currency is enabled.
* Internal: Avoiding ItemStack#hasItemMeta calls before getting an
item's ItemMeta, since this might be heavier than simply getting the
ItemMeta directly and performing only the relevant checks on that.
Internally ItemStack#hasItemMeta checks emptiness for all item
attributes and might (for CraftItemStacks) even first copy all the
item's data into a new ItemMeta object. And even if the item actually
has no data (Bukkit ItemStack with null ItemMeta), ItemStack#getItemMeta
will simply create a new empty ItemMeta object without having to copy
any data, so this is still a similarly lightweight operation anyways.
* Internal: Added ItemData tests. Unfortunately this requires
CraftBukkit as test dependency.
2019-08-18 04:51:49 +02:00
blablubbabc 490ceb42fb Bumped Bukkit dependency from 1.14.3 to 1.14.4. 2019-08-17 09:03:16 +02:00
blablubbabc be5a8597cb Added interfaces for the different shopkeeper types and their offers to
the API. They allow modifying the shopkeepers' trades. Factory methods
for the different types of offers are provided via ShopkeepersPlugin and
ShopkeepersAPI.

* The internal shopkeeper classes got renamed.
* API: Added a few utility methods to TradingRecipe for comparing the
recipes with given items or other recipes.
* API: Added toString, hashCode and equals to TradingRecipe and the new
offer types.
* Minor javadoc changes.
* Fixed: ShopkeepersAPI was missing getDefaultUITypes.
2019-08-12 21:00:22 +02:00
blablubbabc 3e888f4d56 Added a test to ensure consistency between ShopkeepersPlugin and
ShopkeepersAPI.

Adjusted Eclipse classpath to make tests work. There seems to be
something off with the maven setup for the individual child modules
though.
2019-08-12 20:55:32 +02:00
blablubbabc 1392113525 Added setting 'increment-villager-statistics' (default: false) which
controls whether opening the trading menu and trading with shopkeepers
increment minecraft's 'talked-to-villager' and 'traded-with-villager'
statistics.

Previously the talked-to-villager statistics would always get
incremented and the traded-with-villager statistic was not used.

The setting gets also tracked by bStats.
2019-08-10 00:46:32 +02:00
blablubbabc 0970d6d676 Loading the plugin before GriefPrevention in order to ensure that our
listeners run before those of GP (which listen on LOWEST priority as
well).
2019-08-08 23:43:29 +02:00
blablubbabc 4dbc7b5a7c Formatting. 2019-08-01 21:49:19 +02:00
blablubbabc 165a7eb014 Added discord server link. 2019-08-01 21:48:26 +02:00
blablubbabc 01cd4f1260 Some entity attributes are setup prior to entity spawning now (such as
metadata, non-persist flag and name (if it has/uses one)).

This should help other plugins to identify Shopkeeper entities during
spawning.
2019-07-28 03:27:20 +02:00
blablubbabc 59663f36b9 Printing entity counts of the chunk when shopkeeper spawning fails. 2019-07-27 18:39:48 +02:00
blablubbabc 39f9b27b20 Also print success state. 2019-07-26 07:03:26 +02:00
blablubbabc a805f2b4b6 TravisCI: Using OpenJDK 8 and Ubunut Trusty for building. 2019-07-26 06:55:39 +02:00
blablubbabc 2d1c2470ec Added even more debug output for the case that entity spawning fails and
the spawned entity is marked dead.

This will now retry the spawning and log all event activity for that
spawn attempt.

To slightly reduce debug spam, this debug output will only be created at
most once every 5 minutes.
2019-07-26 06:44:32 +02:00
blablubbabc 87c9c0dc41 Minor changes to DebugListener.
Also prints the class names of all registered listeners now.
2019-07-26 06:19:04 +02:00
blablubbabc cf89a2cb6f Spigot is stopping the conversion of zombie villagers on its own now if
the corresponding transform event gets cancelled.
2019-07-26 03:53:38 +02:00
blablubbabc ca1ba6d1be Added some additional debug output for shopkeeper entities not being
able to spawn.

Also clarified the debug output produced by the spawn verifier.

Also: Skipping spawn attempts in case the world is not loaded (should usually not be the case, but we guard against this anyways now).
2019-07-24 04:43:49 +02:00
blablubbabc 3a7d8158a9 Clarify interact event type in debug message. 2019-07-22 19:05:43 +02:00
blablubbabc 289ed97bec Fixed version. 2019-07-22 19:01:56 +02:00
blablubbabc 60712f36c2 Minor reordering. 2019-07-22 18:38:56 +02:00
blablubbabc 596c530258 Also cancelling the PlayerInteractAtEntityEvent for shopkeeper entity
interactions.

This events gets sometimes called additionally to the regular
PlayerInteractEntityEvent. Cancelling it allows other plugins (such as
WorldGuard) to ignore the interaction.
2019-07-22 18:38:42 +02:00
blablubbabc 065ed0243e Added setting 'debug-options', which can be used to enable additional
debugging tools.

Available options so far:
* 'log-all-events': Logs all events. Subsequent calls of the same event
get combined into a single logging entry to slightly reduce spam.
* 'print-listeners': Prints the registered listeners for the first call
of each event.
2019-07-22 18:29:19 +02:00
blablubbabc 47f139c48f Always cancelling the original interaction event with shopkeepers,
regardless of the output of the check-shop-interaction-result check or
whether the block interaction is already cancelled (for sign
shopkeepers).

Small debug message additions.
2019-07-22 18:21:50 +02:00
blablubbabc e1568ee8a0 Bumped version to v2.8.0-SNAPSHOT 2019-07-22 02:12:55 +02:00
blablubbabc b28e88d0e5 All priorities and ignoring of cancelled events were reconsidered.
* Changed: Replaced the 'bypass-shop-interaction-blocking' setting
(default: false) with the new setting 'check-shop-interaction-result'
(default: false).
* Changed: The new 'check-shop-interaction-result' setting also applies
to sign shops now.
* Internal: Made all priorities and ignoring of cancelled events
explicit.
* Internal: Moved code for checking chest access into util package.
* Internal: Metrics will also report now whether the settings
'check-shop-interaction-result', 'bypass-spawn-blocking' and
'enable-spawn-verifier' are used.
* Internal: Minor changes to some debug messages.
2019-07-22 01:56:12 +02:00
blablubbabc 85739b7365 Metrics will now also report whether the settings
'bypass-shop-interaction-blocking', 'bypass-spawn-blocking' and
'enable-spawn-verifier' are used.
2019-07-17 18:14:15 +02:00
blablubbabc 4f1e31e1e5 Javadoc. 2019-07-17 18:06:45 +02:00
blablubbabc 6d1e9e271e When forcing an entity to spawn, the pitch and yaw of the expected and
actual spawn location are ignored now. This avoids a warning message for
some entity types (such as shulkers), which always spawn with fixed
pitch and yaw.
2019-07-17 17:01:25 +02:00
blablubbabc 518b1cd56d The bypass-shop-interaction-blocking setting also applies to sign shops
now.
2019-07-17 11:05:05 +02:00
blablubbabc b852c7446d Prepared working on the next version. 2019-07-02 04:24:32 +02:00
blablubbabc 68e6845307 Version 2.7.2 2019-07-02 03:55:15 +02:00
blablubbabc 737d91f9df Updated changelog. 2019-07-02 02:51:20 +02:00
blablubbabc 913808a5e0 Fixed javadoc. 2019-07-02 02:46:18 +02:00
blablubbabc 454a34d6da Also reducing the event priority for the trading handler (late
processing) from HIGHEST to HIGH.

This allows other plugins to still cancel the trading at normal and
below priorities, while giving other plugins that run late (like
StackableItems) a chance to ignore the event if we are cancelling it.
2019-07-02 02:44:33 +02:00
blablubbabc 0804a37aec Handling most custom inventory interactions early, so that other plugins
can ignore cancelled events.
2019-07-02 02:44:22 +02:00
blablubbabc 878728a359 Fixed compatibility with MC 1.14.3.
* Bumped Bukkit dependency to 1.14.3.
* Changed: With MC 1.14.3 custom merchants will no longer display the
'Villagers restock up to two times per day' message when hovering over
the out of stock icon.
2019-07-02 01:45:34 +02:00
blablubbabc 0c27d12851 Spigot is hiding the unused xp bar from custom merchant inventories now.
The dynamic updating of trades (out of stock icon) was adapted
accordingly.
2019-06-22 16:15:06 +02:00
blablubbabc 60ec9cca13 Use level 0 for now, to hide the name suffix. 2019-06-21 05:17:39 +02:00