From d6ac9eeeaa4ee95bf9f6454f58824dbee718d553 Mon Sep 17 00:00:00 2001 From: Major- Date: Thu, 11 Feb 2016 13:07:02 +0000 Subject: [PATCH] Remove message filtering --- data/plugins/cmd/messaging/filter.rb | 6 --- data/plugins/cmd/messaging/plugin.xml | 3 +- data/plugins/consumables/food.rb | 4 +- data/plugins/consumables/potions.rb | 6 +-- data/plugins/dummy/dummy.rb | 2 +- data/plugins/skill/fishing/fishing.rb | 4 +- data/plugins/skill/herblore/herb.rb | 4 +- data/plugins/skill/herblore/ingredient.rb | 2 +- data/plugins/skill/herblore/potion.rb | 4 +- data/plugins/skill/mining/mining.rb | 4 +- data/plugins/skill/runecraft/runecraft.rb | 2 +- .../game/message/impl/ServerChatMessage.java | 20 +++------ .../org/apollo/game/model/entity/Player.java | 41 ++----------------- 13 files changed, 25 insertions(+), 77 deletions(-) delete mode 100644 data/plugins/cmd/messaging/filter.rb diff --git a/data/plugins/cmd/messaging/filter.rb b/data/plugins/cmd/messaging/filter.rb deleted file mode 100644 index 47e92b72..00000000 --- a/data/plugins/cmd/messaging/filter.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'java' - -on :command, :filter do |player, command| - status = player.toggle_message_filter ? 'enabled' : 'disabled' - player.send_message('Your message filter is now ' + status + '.') -end diff --git a/data/plugins/cmd/messaging/plugin.xml b/data/plugins/cmd/messaging/plugin.xml index 622ec93f..546062c0 100644 --- a/data/plugins/cmd/messaging/plugin.xml +++ b/data/plugins/cmd/messaging/plugin.xml @@ -9,8 +9,7 @@ xEliqa - - \ No newline at end of file + diff --git a/data/plugins/consumables/food.rb b/data/plugins/consumables/food.rb index f9c7017f..a190c361 100644 --- a/data/plugins/consumables/food.rb +++ b/data/plugins/consumables/food.rb @@ -27,8 +27,8 @@ class Food < Consumable player.inventory.add(@replace) unless @replace == -1 - player.send_message("You eat the #{name}.", true) - player.send_message('It heals some health.', true) if new_curr > hitpoints_current + player.send_message("You eat the #{name}.") + player.send_message('It heals some health.') if new_curr > hitpoints_current skill = Skill.new(hitpoints.experience, new_curr, hitpoints.maximum_level) player.skill_set.set_skill(Skill::HITPOINTS, skill) diff --git a/data/plugins/consumables/potions.rb b/data/plugins/consumables/potions.rb index 148ce057..c3efe8fb 100644 --- a/data/plugins/consumables/potions.rb +++ b/data/plugins/consumables/potions.rb @@ -30,12 +30,12 @@ class Potion < Consumable if index != @doses.length # Consumable removes the old potion for us, so don't do it here. player.inventory.add(@doses[index]) - player.send_message("You drink some of your #{name} potion.", true) + player.send_message("You drink some of your #{name} potion.") remaining = "You have #{@doses.length - index} dose#{'s' unless index == 3} of potion left." - player.send_message(remaining, true) + player.send_message(remaining) else - player.send_message('You drink the last of your potion.', true) + player.send_message('You drink the last of your potion.') player.inventory.add(Constants::EMPTY_VIAL_ID) end diff --git a/data/plugins/dummy/dummy.rb b/data/plugins/dummy/dummy.rb index e91355c7..f602f32a 100644 --- a/data/plugins/dummy/dummy.rb +++ b/data/plugins/dummy/dummy.rb @@ -35,7 +35,7 @@ class DummyAction < DistancedAction else @started = true - mob.send_message('You hit the dummy.', true) + mob.send_message('You hit the dummy.') mob.turn_to(position) mob.play_animation(PUNCH_ANIMATION) end diff --git a/data/plugins/skill/fishing/fishing.rb b/data/plugins/skill/fishing/fishing.rb index 4f8ba78c..244a8800 100644 --- a/data/plugins/skill/fishing/fishing.rb +++ b/data/plugins/skill/fishing/fishing.rb @@ -27,7 +27,7 @@ class FishingAction < DistancedAction # Starts the fishing process. def start_fishing @started = true - mob.send_message(tool.message, true) + mob.send_message(tool.message) end # Executes the action. @@ -72,7 +72,7 @@ class FishingAction < DistancedAction inventory.add(fish.id) name = fish.name - mob.send_message("You catch #{name.end_with?('s') ? 'some' : 'a'} #{name.downcase}.", true) + mob.send_message("You catch #{name.end_with?('s') ? 'some' : 'a'} #{name.downcase}.") skills.add_experience(Skill::FISHING, fish.experience) if find_bait == -1 diff --git a/data/plugins/skill/herblore/herb.rb b/data/plugins/skill/herblore/herb.rb index db08744d..30a10bf4 100644 --- a/data/plugins/skill/herblore/herb.rb +++ b/data/plugins/skill/herblore/herb.rb @@ -56,10 +56,10 @@ class HerbIdentificationAction < Action identified = @herb.item inventory.add(identified) - + article = LanguageUtil.getIndefiniteArticle(identified.definition.name) player.skill_set.add_experience(Skill::HERBLORE, @herb.experience) - player.send_message("This herb is #{article} #{identified.definition.name}.", true) + player.send_message("This herb is #{article} #{identified.definition.name}.") end stop diff --git a/data/plugins/skill/herblore/ingredient.rb b/data/plugins/skill/herblore/ingredient.rb index c2fdb118..ef36d6b9 100644 --- a/data/plugins/skill/herblore/ingredient.rb +++ b/data/plugins/skill/herblore/ingredient.rb @@ -153,7 +153,7 @@ class GrindingAction < Action item = inventory.get(@slot) name = item.definition.name.downcase - player.send_message("You grind the #{name} to dust.", true) + player.send_message("You grind the #{name} to dust.") inventory.reset(@slot) inventory.add(@ingredient.item) diff --git a/data/plugins/skill/herblore/potion.rb b/data/plugins/skill/herblore/potion.rb index 25d08dbe..d263ac3a 100644 --- a/data/plugins/skill/herblore/potion.rb +++ b/data/plugins/skill/herblore/potion.rb @@ -227,7 +227,7 @@ class UnfinishedMixingAction < MixingAction created = name.sub(/ leaf$/, '') message = "You put the #{name} in the water to make an unfinished #{created} potion." - player.send_message(message, true) + player.send_message(message) @slots.each do |slot, amount| unless inventory.remove_slot(slot, amount) @@ -279,7 +279,7 @@ class FinishedMixingAction < MixingAction ingredient = name_of(@ingredient).downcase name = @potion.item.definition.name.sub('(3)', '') - player.send_message("You add the #{ingredient} to the mixture to make an #{name}.", true) + player.send_message("You add the #{ingredient} to the mixture to make an #{name}.") player.skill_set.add_experience(HERBLORE_SKILL_ID, @potion.experience) inventory = player.inventory diff --git a/data/plugins/skill/mining/mining.rb b/data/plugins/skill/mining/mining.rb index 1853bb92..076577a1 100644 --- a/data/plugins/skill/mining/mining.rb +++ b/data/plugins/skill/mining/mining.rb @@ -33,7 +33,7 @@ class MiningAction < DistancedAction # the ore def start_mine(pickaxe) @started = true - mob.send_message('You swing your pick at the rock.', true) + mob.send_message('You swing your pick at the rock.') mob.play_animation(pickaxe.animation) @counter = pickaxe.pulses end @@ -67,7 +67,7 @@ class MiningAction < DistancedAction if mob.inventory.add(ore.id) name = name_of(@ore.id).sub(/ ore$/, '').downcase - mob.send_message("You manage to mine some #{name}.", true) + mob.send_message("You manage to mine some #{name}.") skills.add_experience(Skill::MINING, ore.exp) # TODO: expire the rock end diff --git a/data/plugins/skill/runecraft/runecraft.rb b/data/plugins/skill/runecraft/runecraft.rb index d6f34ecc..bce1b059 100644 --- a/data/plugins/skill/runecraft/runecraft.rb +++ b/data/plugins/skill/runecraft/runecraft.rb @@ -44,7 +44,7 @@ class RunecraftingAction < DistancedAction inventory.add(@rune.id, added) name = added > 1 ? 'some ' + @rune.name + 's' : 'an ' + @rune.name - @player.send_message("Your craft the rune essence into #{name}.", true) + @player.send_message("You craft the rune essence into #{name}.") @player.skill_set.add_experience(Skill::RUNECRAFT, removed * @rune.experience) stop diff --git a/game/src/main/org/apollo/game/message/impl/ServerChatMessage.java b/game/src/main/org/apollo/game/message/impl/ServerChatMessage.java index 1fe747b5..ab899602 100644 --- a/game/src/main/org/apollo/game/message/impl/ServerChatMessage.java +++ b/game/src/main/org/apollo/game/message/impl/ServerChatMessage.java @@ -10,31 +10,21 @@ import org.apollo.net.message.Message; public final class ServerChatMessage extends Message { /** - * The chat message. + * The message to send. */ private final String message; /** - * Creates a server chat message. + * Creates the ServerChatMessage. * - * @param message The chat message. + * @param message The chat message to send. */ public ServerChatMessage(String message) { - this(message, false); + this.message = message; } /** - * Creates a server chat message. - * - * @param message The chat message. - * @param filterable Whether or not the message can be filtered. - */ - public ServerChatMessage(String message, boolean filterable) { - this.message = message + (filterable ? ":filterable:" : ""); - } - - /** - * Gets the chat message. + * Gets the chat message to send. * * @return The chat message. */ diff --git a/game/src/main/org/apollo/game/model/entity/Player.java b/game/src/main/org/apollo/game/model/entity/Player.java index 169ff898..92d78903 100644 --- a/game/src/main/org/apollo/game/model/entity/Player.java +++ b/game/src/main/org/apollo/game/model/entity/Player.java @@ -143,11 +143,6 @@ public final class Player extends Mob { */ private boolean excessivePlayers; - /** - * Indicates whether this player has the message filter enabled. - */ - private boolean filteringMessages; - /** * The privacy state of this player's private chat. */ @@ -652,15 +647,6 @@ public final class Player extends Mob { localObjects.forEach(object -> object.removeFrom(this)); } - /** - * Indicates whether the message filter is enabled. - * - * @return {@code true} if the filter is enabled, otherwise {@code false}. - */ - public boolean messageFilterEnabled() { - return filteringMessages; - } - /** * Opens this player's bank. */ @@ -768,24 +754,12 @@ public final class Player extends Mob { } /** - * Sends a message to the player. + * Sends the specified chat message to the player. * - * @param message The message. + * @param message The message to send. */ public void sendMessage(String message) { - sendMessage(message, false); - } - - /** - * Sends a message to the player. - * - * @param message The message. - * @param filterable Whether or not the message can be filtered. - */ - public void sendMessage(String message, boolean filterable) { - if (!filterable || !filteringMessages) { - send(new ServerChatMessage(message)); - } + send(new ServerChatMessage(message)); } /** @@ -984,15 +958,6 @@ public final class Player extends Mob { .toString(); } - /** - * Toggles the message filter. - * - * @return The new value of the filter. - */ - public boolean toggleMessageFilter() { - return filteringMessages = !filteringMessages; - } - /** * Toggles the player's run status. */