From 4953c238c4ccda0db37b01800231c808fee96e57 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Sat, 16 Sep 2023 05:36:47 +0200 Subject: [PATCH] hide constructors of Builders --- .../entity/npc/quest/BringItemTask.java | 5 +++++ .../entity/npc/quest/DeliverItemOrder.java | 5 +++++ .../quest/DeliverItemQuestHistoryBuilder.java | 4 ++++ .../quest/DeliverItemQuestOfferBuilder.java | 5 +++++ .../entity/npc/quest/DeliverItemTask.java | 19 +++++++++++++++++++ .../entity/npc/quest/KillCreaturesTask.java | 5 +++++ .../npc/quest/QuestCompleteBuilder.java | 5 +++++ .../entity/npc/quest/QuestHistoryBuilder.java | 5 +++++ .../entity/npc/quest/QuestInfoBuilder.java | 5 +++++ .../entity/npc/quest/QuestOfferBuilder.java | 5 +++++ .../entity/npc/quest/QuestTaskBuilder.java | 5 +++++ .../npc/quest/SimpleQuestCompleteBuilder.java | 5 +++++ .../npc/quest/SimpleQuestOfferBuilder.java | 15 +++++++++++++++ 13 files changed, 88 insertions(+) diff --git a/src/games/stendhal/server/entity/npc/quest/BringItemTask.java b/src/games/stendhal/server/entity/npc/quest/BringItemTask.java index 35ce3f1c6a4..70b63b8561e 100644 --- a/src/games/stendhal/server/entity/npc/quest/BringItemTask.java +++ b/src/games/stendhal/server/entity/npc/quest/BringItemTask.java @@ -30,6 +30,11 @@ public class BringItemTask extends QuestTaskBuilder { private Pair requestItem; private List> alternativeItems = new LinkedList<>(); + // hide constructor + BringItemTask() { + super(); + } + /** * request an item from the player * diff --git a/src/games/stendhal/server/entity/npc/quest/DeliverItemOrder.java b/src/games/stendhal/server/entity/npc/quest/DeliverItemOrder.java index 053e9cd48d4..31e0430aa0c 100644 --- a/src/games/stendhal/server/entity/npc/quest/DeliverItemOrder.java +++ b/src/games/stendhal/server/entity/npc/quest/DeliverItemOrder.java @@ -103,6 +103,11 @@ String getRespondToSlowDelivery() { return respondToSlowDelivery; } + // hide constructor + DeliverItemOrder() { + super(); + } + public DeliverItemOrder customerNpc(String npc) { deliverItemTask.getOrders().remove(this.npc); this.npc = npc; diff --git a/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestHistoryBuilder.java b/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestHistoryBuilder.java index a54308f254e..11a8e6b8e04 100644 --- a/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestHistoryBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestHistoryBuilder.java @@ -23,6 +23,10 @@ public class DeliverItemQuestHistoryBuilder extends QuestHistoryBuilder { private String whenInTime; private String whenOutOfTime; + // hide constructor + DeliverItemQuestHistoryBuilder() { + super(); + } @Override public DeliverItemQuestHistoryBuilder whenNpcWasMet(String whenNpcWasMet) { diff --git a/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestOfferBuilder.java b/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestOfferBuilder.java index d9472d9d80e..dd0c3641364 100644 --- a/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestOfferBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/DeliverItemQuestOfferBuilder.java @@ -2,4 +2,9 @@ public class DeliverItemQuestOfferBuilder extends QuestOfferBuilder { + // hide constructor + DeliverItemQuestOfferBuilder() { + super(); + } + } diff --git a/src/games/stendhal/server/entity/npc/quest/DeliverItemTask.java b/src/games/stendhal/server/entity/npc/quest/DeliverItemTask.java index 67742f8d2f6..37c71769696 100644 --- a/src/games/stendhal/server/entity/npc/quest/DeliverItemTask.java +++ b/src/games/stendhal/server/entity/npc/quest/DeliverItemTask.java @@ -36,12 +36,31 @@ public class DeliverItemTask extends QuestTaskBuilder { + private final static Outfit UNIFORM = new Outfit(null, Integer.valueOf(990), null, null, null, null, null, null, null); private static final String QUEST_SLOT = "pizza_delivery"; + private Outfit outfit; + private String itemDescription; + private String itemName; + /* + private final static Outfit UNIFORM = new Outfit(null, Integer.valueOf(990), null, null, null, null, null, null, null); + pizza.setDescription(StringUtils.substitute("You see a [flavor].", params)); + npc.say(StringUtils.substitute("You must bring this [flavor] to [customerName] within [time]. Say \"pizza\" so that [customerName] knows that I sent you. Oh, and please wear this uniform on your way.", params)); + npc.say("Come back when you have space to carry the pizza!"); + putOffUniform(player); + npc.say(StringUtils.substitute("I see you failed to deliver the pizza to [customerName] in time. Are you sure you will be more reliable this time?", params)); + npc.say(StringUtils.substitute("You still have to deliver a pizza to [customerName], and hurry!", params)); + } + */ + private Map orders = new HashMap<>(); + // hide constructor + DeliverItemTask() { + super(); + } /** * Get a list of customers appropriate for a player diff --git a/src/games/stendhal/server/entity/npc/quest/KillCreaturesTask.java b/src/games/stendhal/server/entity/npc/quest/KillCreaturesTask.java index ef5577a8142..a706ac650ef 100644 --- a/src/games/stendhal/server/entity/npc/quest/KillCreaturesTask.java +++ b/src/games/stendhal/server/entity/npc/quest/KillCreaturesTask.java @@ -28,6 +28,11 @@ public class KillCreaturesTask extends QuestTaskBuilder { private HashMap> requestKill = new HashMap<>(); + // hide constructor + KillCreaturesTask() { + super(); + } + /** * request killing creatures * diff --git a/src/games/stendhal/server/entity/npc/quest/QuestCompleteBuilder.java b/src/games/stendhal/server/entity/npc/quest/QuestCompleteBuilder.java index a76f62735f4..86a52c80a23 100644 --- a/src/games/stendhal/server/entity/npc/quest/QuestCompleteBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/QuestCompleteBuilder.java @@ -22,6 +22,11 @@ */ public abstract class QuestCompleteBuilder { + // hide constructor + QuestCompleteBuilder() { + super(); + } + abstract void simulate(String npc, QuestSimulator simulator); abstract void build(SpeakerNPC npc, String questSlot, ChatCondition questCompletedCondition, ChatAction questCompleteAction); diff --git a/src/games/stendhal/server/entity/npc/quest/QuestHistoryBuilder.java b/src/games/stendhal/server/entity/npc/quest/QuestHistoryBuilder.java index e2de54eb53c..58e8eda3b8e 100644 --- a/src/games/stendhal/server/entity/npc/quest/QuestHistoryBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/QuestHistoryBuilder.java @@ -25,6 +25,11 @@ public class QuestHistoryBuilder { private String whenQuestCanBeRepeated; private String whenCompletionsShown; + // hide constructor + QuestHistoryBuilder() { + super(); + } + public QuestHistoryBuilder whenNpcWasMet(String whenNpcWasMet) { this.whenNpcWasMet = whenNpcWasMet; return this; diff --git a/src/games/stendhal/server/entity/npc/quest/QuestInfoBuilder.java b/src/games/stendhal/server/entity/npc/quest/QuestInfoBuilder.java index 75d3423384e..907d78b6207 100644 --- a/src/games/stendhal/server/entity/npc/quest/QuestInfoBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/QuestInfoBuilder.java @@ -25,6 +25,11 @@ public class QuestInfoBuilder { private String region = "somewhere"; private String questGiverNpc = null; + // hide constructor + QuestInfoBuilder() { + super(); + } + public QuestInfoBuilder name(String name) { this.name = name; return this; diff --git a/src/games/stendhal/server/entity/npc/quest/QuestOfferBuilder.java b/src/games/stendhal/server/entity/npc/quest/QuestOfferBuilder.java index 7263b156482..c764ee523f6 100644 --- a/src/games/stendhal/server/entity/npc/quest/QuestOfferBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/QuestOfferBuilder.java @@ -49,6 +49,11 @@ public class QuestOfferBuilder> { private List lastRespondTo = null; private Map, String> additionalReplies = new HashMap<>(); + // hide constructor + QuestOfferBuilder() { + super(); + } + @SuppressWarnings("unchecked") public T respondToFailedPreCondition(String respondToFailedPreCondition) { this.respondToFailedPreCondition = respondToFailedPreCondition; diff --git a/src/games/stendhal/server/entity/npc/quest/QuestTaskBuilder.java b/src/games/stendhal/server/entity/npc/quest/QuestTaskBuilder.java index cab264df765..58a705f4459 100644 --- a/src/games/stendhal/server/entity/npc/quest/QuestTaskBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/QuestTaskBuilder.java @@ -25,6 +25,11 @@ */ public abstract class QuestTaskBuilder { + // hide constructor + QuestTaskBuilder() { + super(); + } + abstract void simulate(QuestSimulator simulator); ChatCondition buildQuestPreCondition(@SuppressWarnings("unused") String questSlot) { diff --git a/src/games/stendhal/server/entity/npc/quest/SimpleQuestCompleteBuilder.java b/src/games/stendhal/server/entity/npc/quest/SimpleQuestCompleteBuilder.java index 22eb91513ea..5aeaca3908c 100644 --- a/src/games/stendhal/server/entity/npc/quest/SimpleQuestCompleteBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/SimpleQuestCompleteBuilder.java @@ -38,6 +38,11 @@ public class SimpleQuestCompleteBuilder extends QuestCompleteBuilder { private String respondToAccept = null; private List rewardWith = new LinkedList<>(); + // hide constructor + SimpleQuestCompleteBuilder() { + super(); + } + public SimpleQuestCompleteBuilder greet(String greet) { this.greet = greet; return this; diff --git a/src/games/stendhal/server/entity/npc/quest/SimpleQuestOfferBuilder.java b/src/games/stendhal/server/entity/npc/quest/SimpleQuestOfferBuilder.java index 22bb56e25a6..0aab152af96 100644 --- a/src/games/stendhal/server/entity/npc/quest/SimpleQuestOfferBuilder.java +++ b/src/games/stendhal/server/entity/npc/quest/SimpleQuestOfferBuilder.java @@ -1,5 +1,20 @@ +/*************************************************************************** + * (C) Copyright 2023-2023 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.server.entity.npc.quest; public class SimpleQuestOfferBuilder extends QuestOfferBuilder { + // hide constructor + SimpleQuestOfferBuilder() { + super(); + } }